业主相关 功能 从listener 迁移为 cmd 模式
18个文件已删除
3 文件已重命名
5个文件已添加
| New file |
| | |
| | | package com.java110.user.cmd.owner; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.core.factory.SendSmsFactory; |
| | | import com.java110.dto.community.CommunityDto; |
| | | import com.java110.dto.msg.SmsDto; |
| | | import com.java110.dto.owner.OwnerAppUserDto; |
| | | import com.java110.dto.owner.OwnerDto; |
| | | import com.java110.dto.user.UserDto; |
| | | import com.java110.intf.common.IFileInnerServiceSMO; |
| | | import com.java110.intf.common.ISmsInnerServiceSMO; |
| | | import com.java110.intf.community.ICommunityInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerAppUserInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerAppUserV1InnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerInnerServiceSMO; |
| | | import com.java110.intf.user.IUserInnerServiceSMO; |
| | | import com.java110.po.owner.OwnerAppUserPo; |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Java110Cmd(serviceCode = "owner.appUserBindingOwner") |
| | | public class AppUserBindingOwnerCmd extends Cmd { |
| | | |
| | | @Autowired |
| | | private IFileInnerServiceSMO fileInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private ISmsInnerServiceSMO smsInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private ICommunityInnerServiceSMO communityInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IUserInnerServiceSMO userInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerAppUserV1InnerServiceSMO ownerAppUserV1InnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | Assert.hasKeyAndValue(reqJson, "communityName", "未包含小区名称"); |
| | | Assert.hasKeyAndValue(reqJson, "areaCode", "未包含小区地区"); |
| | | Assert.hasKeyAndValue(reqJson, "appUserName", "未包含用户名称"); |
| | | Assert.hasKeyAndValue(reqJson, "idCard", "未包含身份证号"); |
| | | Assert.hasKeyAndValue(reqJson, "link", "未包含联系电话"); |
| | | Assert.hasKeyAndValue(reqJson, "msgCode", "未包含联系电话验证码"); |
| | | |
| | | //判断是否有用户ID |
| | | Map<String, String> headers = context.getReqHeaders(); |
| | | |
| | | Assert.hasKeyAndValue(headers, "user_id", "请求头中未包含用户信息"); |
| | | SmsDto smsDto = new SmsDto(); |
| | | smsDto.setTel(reqJson.getString("link")); |
| | | smsDto.setCode(reqJson.getString("msgCode")); |
| | | smsDto = smsInnerServiceSMOImpl.validateCode(smsDto); |
| | | |
| | | if (!smsDto.isSuccess() && "ON".equals(MappingCache.getValue(SendSmsFactory.SMS_SEND_SWITCH))) { |
| | | throw new IllegalArgumentException(smsDto.getMsg()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | |
| | | Map<String, String> headers = context.getReqHeaders(); |
| | | |
| | | String userId = headers.get("user_id"); |
| | | UserDto userDto = new UserDto(); |
| | | userDto.setUserId(userId); |
| | | List<UserDto> userDtos = userInnerServiceSMOImpl.getUsers(userDto); |
| | | |
| | | Assert.listOnlyOne(userDtos, "未找到相应用户信息,或查询到多条"); |
| | | |
| | | String openId = userDtos.get(0).getOpenId(); |
| | | |
| | | Assert.hasLength(openId, "该用户不是能力开放用户"); |
| | | |
| | | OwnerAppUserDto ownerAppUserDto = BeanConvertUtil.covertBean(reqJson, OwnerAppUserDto.class); |
| | | ownerAppUserDto.setStates(new String[]{"10000", "12000"}); |
| | | |
| | | List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto); |
| | | |
| | | //Assert.listOnlyOne(ownerAppUserDtos, "已经申请过入驻小区"); |
| | | if (ownerAppUserDtos != null && ownerAppUserDtos.size() > 0) { |
| | | throw new IllegalArgumentException("已经申请过绑定业主"); |
| | | } |
| | | |
| | | //查询小区是否存在 |
| | | CommunityDto communityDto = new CommunityDto(); |
| | | communityDto.setCityCode(reqJson.getString("areaCode")); |
| | | communityDto.setName(reqJson.getString("communityName")); |
| | | communityDto.setState("1100"); |
| | | List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto); |
| | | |
| | | Assert.listOnlyOne(communityDtos, "填写小区信息错误"); |
| | | |
| | | CommunityDto tmpCommunityDto = communityDtos.get(0); |
| | | |
| | | OwnerDto ownerDto = new OwnerDto(); |
| | | ownerDto.setCommunityId(tmpCommunityDto.getCommunityId()); |
| | | ownerDto.setIdCard(reqJson.getString("idCard")); |
| | | ownerDto.setName(reqJson.getString("appUserName")); |
| | | ownerDto.setLink(reqJson.getString("link")); |
| | | List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwnerMembers(ownerDto); |
| | | |
| | | Assert.listOnlyOne(ownerDtos, "填写业主信息错误"); |
| | | |
| | | OwnerDto tmpOwnerDto = ownerDtos.get(0); |
| | | |
| | | reqJson.put("openId", openId); |
| | | reqJson.put("userId", userId); |
| | | |
| | | //添加小区楼 |
| | | JSONObject businessOwnerAppUser = new JSONObject(); |
| | | businessOwnerAppUser.putAll(reqJson); |
| | | //状态类型,10000 审核中,12000 审核成功,13000 审核失败 |
| | | businessOwnerAppUser.put("state", "12000"); |
| | | businessOwnerAppUser.put("appTypeCd", "10010"); |
| | | businessOwnerAppUser.put("appUserId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_appUserId)); |
| | | businessOwnerAppUser.put("memberId", ownerDto.getMemberId()); |
| | | businessOwnerAppUser.put("communityName", communityDto.getName()); |
| | | businessOwnerAppUser.put("communityId", communityDto.getCommunityId()); |
| | | businessOwnerAppUser.put("appUserName", ownerDto.getName()); |
| | | businessOwnerAppUser.put("idCard", ownerDto.getIdCard()); |
| | | businessOwnerAppUser.put("link", ownerDto.getLink()); |
| | | businessOwnerAppUser.put("userId", reqJson.getString("userId")); |
| | | OwnerAppUserPo ownerAppUserPo = BeanConvertUtil.covertBean(businessOwnerAppUser, OwnerAppUserPo.class); |
| | | int flag = ownerAppUserV1InnerServiceSMOImpl.saveOwnerAppUser(ownerAppUserPo); |
| | | if (flag < 1) { |
| | | throw new IllegalArgumentException("保存业主失败"); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.user.cmd.owner; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.dto.file.FileDto; |
| | | import com.java110.dto.owner.OwnerRoomRelDto; |
| | | import com.java110.intf.common.IFileInnerServiceSMO; |
| | | import com.java110.intf.common.IFileRelInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerV1InnerServiceSMO; |
| | | import com.java110.po.file.FileRelPo; |
| | | import com.java110.po.owner.OwnerPo; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Java110Cmd(serviceCode = "owner.applicationKey") |
| | | public class ApplicationKeyCmd extends Cmd { |
| | | |
| | | @Autowired |
| | | private IOwnerRoomRelInnerServiceSMO ownerRoomRelInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerV1InnerServiceSMO ownerV1InnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFileInnerServiceSMO fileInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFileRelInnerServiceSMO fileRelInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | Assert.jsonObjectHaveKey(reqJson, "name", "请求报文中未包含name"); |
| | | Assert.jsonObjectHaveKey(reqJson, "roomId", "请求报文中未包含房屋信息"); |
| | | Assert.jsonObjectHaveKey(reqJson, "age", "请求报文中未包含age"); |
| | | Assert.jsonObjectHaveKey(reqJson, "link", "请求报文中未包含link"); |
| | | Assert.jsonObjectHaveKey(reqJson, "sex", "请求报文中未包含sex"); |
| | | //Assert.jsonObjectHaveKey(paramIn, "ownerTypeCd", "请求报文中未包含sex"); //这个不需要 这个直接写成钥匙申请,临时人员 |
| | | Assert.jsonObjectHaveKey(reqJson, "communityId", "请求报文中未包含communityId"); |
| | | Assert.jsonObjectHaveKey(reqJson, "idCard", "请求报文中未包含身份证号"); |
| | | Assert.jsonObjectHaveKey(reqJson, "ownerPhoto", "请求报文中未包含照片信息"); |
| | | } |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | //根据房屋ID查询业主ID,自动生成成员ID |
| | | OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto(); |
| | | ownerRoomRelDto.setRoomId(reqJson.getString("roomId")); |
| | | List<OwnerRoomRelDto> ownerRoomRelDtoList = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto); |
| | | |
| | | Assert.listOnlyOne(ownerRoomRelDtoList, "根据房屋查询不到业主信息或查询到多条"); |
| | | reqJson.put("ownerId", ownerRoomRelDtoList.get(0).getOwnerId()); |
| | | |
| | | |
| | | String memberId = GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_ownerId); |
| | | reqJson.put("memberId", memberId); |
| | | |
| | | JSONObject businessOwner = new JSONObject(); |
| | | businessOwner.putAll(reqJson); |
| | | businessOwner.put("ownerTypeCd", "1004");//临时人员 |
| | | businessOwner.put("state", "1000");//待审核 |
| | | |
| | | OwnerPo ownerPo = BeanConvertUtil.covertBean(businessOwner, OwnerPo.class); |
| | | int flag = ownerV1InnerServiceSMOImpl.saveOwner(ownerPo); |
| | | |
| | | if (flag < 1) { |
| | | throw new IllegalArgumentException("保存业主失败"); |
| | | } |
| | | |
| | | FileDto fileDto = new FileDto(); |
| | | fileDto.setFileId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_file_id)); |
| | | fileDto.setFileName(fileDto.getFileId()); |
| | | fileDto.setContext(reqJson.getString("ownerPhoto")); |
| | | fileDto.setSuffix("jpeg"); |
| | | fileDto.setCommunityId(reqJson.getString("communityId")); |
| | | String fileName = fileInnerServiceSMOImpl.saveFile(fileDto); |
| | | reqJson.put("ownerPhotoId", fileDto.getFileId()); |
| | | reqJson.put("fileSaveName", fileName); |
| | | |
| | | JSONObject businessUnit = new JSONObject(); |
| | | businessUnit.put("fileRelId", "-1"); |
| | | businessUnit.put("relTypeCd", "10000"); |
| | | businessUnit.put("saveWay", "table"); |
| | | businessUnit.put("objId", reqJson.getString("memberId")); |
| | | businessUnit.put("fileRealName", reqJson.getString("ownerPhotoId")); |
| | | businessUnit.put("fileSaveName", reqJson.getString("fileSaveName")); |
| | | |
| | | FileRelPo fileRelPo = BeanConvertUtil.covertBean(businessUnit, FileRelPo.class); |
| | | flag = fileRelInnerServiceSMOImpl.saveFileRel(fileRelPo); |
| | | if (flag < 1) { |
| | | throw new IllegalArgumentException("保存业主失败"); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.user.cmd.owner; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.owner.OwnerCarDto; |
| | | import com.java110.dto.parking.ParkingSpaceDto; |
| | | import com.java110.intf.community.IParkingSpaceInnerServiceSMO; |
| | | import com.java110.intf.community.IParkingSpaceV1InnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerCarInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerCarV1InnerServiceSMO; |
| | | import com.java110.po.car.OwnerCarPo; |
| | | import com.java110.po.parking.ParkingSpacePo; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Java110Cmd(serviceCode = "owner.carAddParkingSpace") |
| | | public class CarAddParkingSpaceCmd extends Cmd { |
| | | |
| | | @Autowired |
| | | private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl; |
| | | |
| | | |
| | | @Autowired |
| | | private IParkingSpaceInnerServiceSMO parkingSpaceInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IParkingSpaceV1InnerServiceSMO parkingSpaceV1InnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerCarV1InnerServiceSMO ownerCarV1InnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | Assert.jsonObjectHaveKey(reqJson, "communityId", "未包含小区ID"); |
| | | Assert.jsonObjectHaveKey(reqJson, "carId", "请求报文中未包含carId"); |
| | | Assert.jsonObjectHaveKey(reqJson, "startTime", "请求报文中未包含startTime"); |
| | | Assert.jsonObjectHaveKey(reqJson, "endTime", "请求报文中未包含startTime"); |
| | | Assert.jsonObjectHaveKey(reqJson, "psId", "请求报文中未包含psId"); |
| | | Assert.hasLength(reqJson.getString("communityId"), "小区ID不能为空"); |
| | | |
| | | OwnerCarDto ownerCarDto = new OwnerCarDto(); |
| | | ownerCarDto.setCarId(reqJson.getString("carId")); |
| | | ownerCarDto.setCommunityId(reqJson.getString("communityId")); |
| | | List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto); |
| | | Assert.listOnlyOne(ownerCarDtos, "未找到车辆信息"); |
| | | |
| | | String state = ownerCarDtos.get(0).getState(); |
| | | |
| | | if (!StringUtil.isEmpty(state) && !state.equals(OwnerCarDto.STATE_FINISH)) { |
| | | throw new IllegalArgumentException("已有车位无需续租"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | OwnerCarPo ownerCarPo = BeanConvertUtil.covertBean(reqJson, OwnerCarPo.class); |
| | | ParkingSpaceDto parkingSpaceDto = new ParkingSpaceDto(); |
| | | parkingSpaceDto.setPsId(ownerCarPo.getPsId()); |
| | | List<ParkingSpaceDto> parkingSpaceDtos = parkingSpaceInnerServiceSMOImpl.queryParkingSpaces(parkingSpaceDto); |
| | | Assert.listOnlyOne(parkingSpaceDtos, "查询车位信息错误!"); |
| | | //获取车位状态(出售 S,出租 H ,空闲 F) |
| | | String state = parkingSpaceDtos.get(0).getState(); |
| | | if (!StringUtil.isEmpty(state) && !state.equals("F")) { //如果车位状态不是空闲的,就不能续租 |
| | | throw new IllegalArgumentException("车位已被使用,无法继续续租!"); |
| | | } |
| | | ownerCarPo.setState(OwnerCarDto.STATE_NORMAL); |
| | | int flag = ownerCarV1InnerServiceSMOImpl.updateOwnerCar(ownerCarPo); |
| | | if (flag < 1) { |
| | | throw new IllegalArgumentException("修改车辆出错"); |
| | | } |
| | | reqJson.put("carNumType", ParkingSpaceDto.STATE_HIRE); |
| | | parkingSpaceDto = new ParkingSpaceDto(); |
| | | parkingSpaceDto.setCommunityId(reqJson.getString("communityId")); |
| | | parkingSpaceDto.setPsId(reqJson.getString("psId")); |
| | | parkingSpaceDtos = parkingSpaceInnerServiceSMOImpl.queryParkingSpaces(parkingSpaceDto); |
| | | |
| | | if (parkingSpaceDtos == null || parkingSpaceDtos.size() != 1) { |
| | | //throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "未查询到停车位信息" + JSONObject.toJSONString(parkingSpaceDto)); |
| | | return; |
| | | } |
| | | |
| | | parkingSpaceDto = parkingSpaceDtos.get(0); |
| | | |
| | | JSONObject businessParkingSpace = new JSONObject(); |
| | | |
| | | businessParkingSpace.putAll(BeanConvertUtil.beanCovertMap(parkingSpaceDto)); |
| | | businessParkingSpace.put("state", reqJson.getString("carNumType")); |
| | | ParkingSpacePo parkingSpacePo = BeanConvertUtil.covertBean(businessParkingSpace, ParkingSpacePo.class); |
| | | flag = parkingSpaceV1InnerServiceSMOImpl.updateParkingSpace(parkingSpacePo); |
| | | if (flag < 1) { |
| | | throw new IllegalArgumentException("修改车辆出错"); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.user.cmd.owner; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.fee.FeeDto; |
| | | import com.java110.dto.owner.OwnerCarDto; |
| | | import com.java110.dto.parking.ParkingSpaceDto; |
| | | import com.java110.intf.community.IParkingSpaceInnerServiceSMO; |
| | | import com.java110.intf.community.IParkingSpaceV1InnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerCarInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerCarV1InnerServiceSMO; |
| | | import com.java110.po.car.OwnerCarPo; |
| | | import com.java110.po.parking.ParkingSpacePo; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Java110Cmd(serviceCode = "owner.deleteCarParkingSpace") |
| | | public class DeleteCarParkingSpaceCmd extends Cmd { |
| | | |
| | | @Autowired |
| | | private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeInnerServiceSMO feeInnerServiceSMOImpl; |
| | | |
| | | |
| | | @Autowired |
| | | private IParkingSpaceInnerServiceSMO parkingSpaceInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IParkingSpaceV1InnerServiceSMO parkingSpaceV1InnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerCarV1InnerServiceSMO ownerCarV1InnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | Assert.jsonObjectHaveKey(reqJson, "communityId", "未包含小区ID"); |
| | | // Assert.jsonObjectHaveKey(reqJson, "carId", "请求报文中未包含carId"); |
| | | Assert.hasLength(reqJson.getString("communityId"), "小区ID不能为空"); |
| | | |
| | | OwnerCarDto ownerCarDto = new OwnerCarDto(); |
| | | ownerCarDto.setCarId(reqJson.getString("carId")); |
| | | ownerCarDto.setCommunityId(reqJson.getString("communityId")); |
| | | ownerCarDto.setStatusCd("0"); |
| | | List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto); |
| | | if (ownerCarDtos != null && ownerCarDtos.size() > 1) { |
| | | throw new IllegalArgumentException("有多个车辆绑定此车位,请先删除车辆!"); |
| | | } |
| | | |
| | | String state = ownerCarDtos.get(0).getState(); |
| | | |
| | | if (StringUtil.isEmpty(state) || state.equals(OwnerCarDto.STATE_FINISH)) { |
| | | throw new IllegalArgumentException("车位已经释放无需释放"); |
| | | } |
| | | |
| | | // if (ownerCarDtos.get(0).getEndTime().getTime() > DateUtil.getCurrentDate().getTime()) { |
| | | // throw new IllegalArgumentException("车位租用还未结束不能释放"); |
| | | // } |
| | | reqJson.put("ownerCarDto", ownerCarDtos.get(0)); |
| | | } |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | |
| | | OwnerCarDto ownerCarDto = (OwnerCarDto) reqJson.get("ownerCarDto"); |
| | | FeeDto feeDto = new FeeDto(); |
| | | feeDto.setPayerObjId(reqJson.getString("carId")); |
| | | feeDto.setCommunityId(reqJson.getString("communityId")); |
| | | feeDto.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_CAR); |
| | | feeDto.setState(FeeDto.STATE_FINISH); |
| | | List<FeeDto> feeDtoList = feeInnerServiceSMOImpl.queryFees(feeDto); |
| | | boolean oweFee = false; |
| | | if (feeDtoList == null || feeDtoList.size() < 1) { |
| | | oweFee = true; |
| | | } |
| | | for (FeeDto tmpFeeDto : feeDtoList) { |
| | | |
| | | if (tmpFeeDto.getEndTime().getTime() <= ownerCarDto.getEndTime().getTime()) { |
| | | oweFee = true; |
| | | break; |
| | | } else { |
| | | throw new IllegalArgumentException("费用未开始!"); |
| | | } |
| | | } |
| | | |
| | | if (OwnerCarDto.STATE_FINISH.equals(ownerCarDto.getState())) { |
| | | oweFee = false; |
| | | } |
| | | |
| | | |
| | | OwnerCarPo ownerCarPo = new OwnerCarPo(); |
| | | // ownerCarPo.setPsId("-1"); |
| | | ownerCarPo.setCarId(reqJson.getString("carId")); |
| | | ownerCarPo.setMemberId(reqJson.getString("memberId")); |
| | | ownerCarPo.setCommunityId(reqJson.getString("communityId")); |
| | | if (oweFee) { |
| | | ownerCarPo.setState(OwnerCarDto.STATE_FINISH); |
| | | } |
| | | int flag = ownerCarV1InnerServiceSMOImpl.updateOwnerCar(ownerCarPo); |
| | | if (flag < 1) { |
| | | throw new IllegalArgumentException("修改车辆出错"); |
| | | } |
| | | reqJson.put("carNumType", ParkingSpaceDto.STATE_FREE); |
| | | reqJson.put("psId", ownerCarDto.getPsId()); |
| | | ParkingSpaceDto parkingSpaceDto = new ParkingSpaceDto(); |
| | | parkingSpaceDto.setCommunityId(reqJson.getString("communityId")); |
| | | parkingSpaceDto.setPsId(reqJson.getString("psId")); |
| | | List<ParkingSpaceDto> parkingSpaceDtos = parkingSpaceInnerServiceSMOImpl.queryParkingSpaces(parkingSpaceDto); |
| | | |
| | | if (parkingSpaceDtos == null || parkingSpaceDtos.size() != 1) { |
| | | //throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "未查询到停车位信息" + JSONObject.toJSONString(parkingSpaceDto)); |
| | | return; |
| | | } |
| | | |
| | | parkingSpaceDto = parkingSpaceDtos.get(0); |
| | | |
| | | JSONObject businessParkingSpace = new JSONObject(); |
| | | |
| | | businessParkingSpace.putAll(BeanConvertUtil.beanCovertMap(parkingSpaceDto)); |
| | | businessParkingSpace.put("state", reqJson.getString("carNumType")); |
| | | ParkingSpacePo parkingSpacePo = BeanConvertUtil.covertBean(businessParkingSpace, ParkingSpacePo.class); |
| | | flag = parkingSpaceV1InnerServiceSMOImpl.updateParkingSpace(parkingSpacePo); |
| | | if (flag < 1) { |
| | | throw new IllegalArgumentException("修改车辆出错"); |
| | | } |
| | | } |
| | | } |
old mode 100755
new mode 100644
| File was renamed from service-api/src/main/java/com/java110/api/listener/owner/DeleteOwnerCarListener.java |
| | |
| | | package com.java110.api.listener.owner; |
| | | package com.java110.user.cmd.owner; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.bmo.parkingSpace.IParkingSpaceBMO; |
| | | import com.java110.api.listener.AbstractServiceApiPlusListener; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.event.service.api.ServiceDataFlowEvent; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.fee.FeeDto; |
| | | import com.java110.dto.owner.OwnerCarDto; |
| | | import com.java110.dto.parking.ParkingSpaceDto; |
| | | import com.java110.intf.community.IParkingSpaceInnerServiceSMO; |
| | | import com.java110.intf.community.IParkingSpaceV1InnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerCarInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerCarV1InnerServiceSMO; |
| | | import com.java110.po.car.OwnerCarPo; |
| | | import com.java110.utils.constant.BusinessTypeConstant; |
| | | import com.java110.utils.constant.ServiceCodeConstant; |
| | | import com.java110.po.parking.ParkingSpacePo; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpMethod; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 保存小区侦听 |
| | | * add by wuxw 2019-06-30 |
| | | */ |
| | | @Java110Listener("deleteOwnerCarListener") |
| | | public class DeleteOwnerCarListener extends AbstractServiceApiPlusListener { |
| | | |
| | | @Java110Cmd(serviceCode = "owner.deleteOwnerCars") |
| | | public class DeleteOwnerCarCmd extends Cmd { |
| | | @Autowired |
| | | private IFeeInnerServiceSMO feeInnerServiceSMOImpl; |
| | | |
| | |
| | | private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IParkingSpaceBMO parkingSpaceBMOImpl; |
| | | |
| | | @Autowired |
| | | private IParkingSpaceInnerServiceSMO parkingSpaceInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IParkingSpaceV1InnerServiceSMO parkingSpaceV1InnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerCarV1InnerServiceSMO ownerCarV1InnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | //Assert.hasKeyAndValue(reqJson, "xxx", "xxx"); |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | //Assert.hasKeyAndValue(reqJson, "xxx", "xxx"); |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "carId", "carId不能为空"); |
| | | Assert.hasKeyAndValue(reqJson, "memberId", "memberId不能为空"); |
| | |
| | | |
| | | Assert.listOnlyOne(ownerCarDtos, "当前未找到需要删除车辆"); |
| | | reqJson.put("psId", ownerCarDtos.get(0).getPsId()); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | if (reqJson.containsKey("psId") && !StringUtil.isEmpty(reqJson.getString("psId"))) { |
| | | ParkingSpaceDto parkingSpaceDto = new ParkingSpaceDto(); |
| | | parkingSpaceDto.setPsId(reqJson.getString("psId")); |
| | |
| | | ownerCarPo.setCommunityId(reqJson.getString("communityId")); |
| | | ownerCarPo.setCarId(reqJson.getString("carId")); |
| | | ownerCarPo.setMemberId(reqJson.getString("memberId")); |
| | | super.delete(context, ownerCarPo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_OWNER_CAR); |
| | | |
| | | int flag = ownerCarV1InnerServiceSMOImpl.deleteOwnerCar(ownerCarPo); |
| | | if (flag < 1) { |
| | | throw new IllegalArgumentException("删除车辆出错"); |
| | | } |
| | | if (StringUtil.isEmpty(reqJson.getString("psId")) || "-1".equals(reqJson.getString("psId"))) { |
| | | return; |
| | | } |
| | | //释放车位 |
| | | if (reqJson.getString("carId").equals(reqJson.getString("memberId"))) { |
| | | reqJson.put("carNumType", ParkingSpaceDto.STATE_FREE);//修改为空闲 |
| | | parkingSpaceBMOImpl.modifySellParkingSpaceState(reqJson, context); |
| | | ParkingSpaceDto parkingSpaceDto = new ParkingSpaceDto(); |
| | | parkingSpaceDto.setCommunityId(reqJson.getString("communityId")); |
| | | parkingSpaceDto.setPsId(reqJson.getString("psId")); |
| | | List<ParkingSpaceDto> parkingSpaceDtos = parkingSpaceInnerServiceSMOImpl.queryParkingSpaces(parkingSpaceDto); |
| | | |
| | | if (parkingSpaceDtos == null || parkingSpaceDtos.size() != 1) { |
| | | //throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "未查询到停车位信息" + JSONObject.toJSONString(parkingSpaceDto)); |
| | | return; |
| | | } |
| | | |
| | | parkingSpaceDto = parkingSpaceDtos.get(0); |
| | | |
| | | JSONObject businessParkingSpace = new JSONObject(); |
| | | |
| | | businessParkingSpace.putAll(BeanConvertUtil.beanCovertMap(parkingSpaceDto)); |
| | | businessParkingSpace.put("state", reqJson.getString("carNumType")); |
| | | ParkingSpacePo parkingSpacePo = BeanConvertUtil.covertBean(businessParkingSpace, ParkingSpacePo.class); |
| | | flag = parkingSpaceV1InnerServiceSMOImpl.updateParkingSpace(parkingSpacePo); |
| | | if (flag < 1) { |
| | | throw new IllegalArgumentException("修改车辆出错"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeConstant.SERVICE_CODE_DELETE_OWNER_CAR; |
| | | } |
| | | |
| | | @Override |
| | | public HttpMethod getHttpMethod() { |
| | | return HttpMethod.POST; |
| | | } |
| | | |
| | | } |
old mode 100755
new mode 100644
| File was renamed from service-api/src/main/java/com/java110/api/listener/owner/ListAppUserBindingOwnersListener.java |
| | |
| | | package com.java110.api.listener.owner; |
| | | package com.java110.user.cmd.owner; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.listener.AbstractServiceApiListener; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.event.service.api.ServiceDataFlowEvent; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.community.CommunityDto; |
| | | import com.java110.dto.owner.OwnerAppUserDto; |
| | | import com.java110.intf.community.ICommunityInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerAppUserInnerServiceSMO; |
| | | import com.java110.intf.user.IUserInnerServiceSMO; |
| | | import com.java110.dto.community.CommunityDto; |
| | | import com.java110.dto.owner.OwnerAppUserDto; |
| | | import com.java110.utils.constant.ServiceCodeConstant; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpMethod; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 查询小区侦听类 |
| | | */ |
| | | @Java110Listener("listAppUserBindingOwnersListener") |
| | | public class ListAppUserBindingOwnersListener extends AbstractServiceApiListener { |
| | | @Java110Cmd(serviceCode = "owner.listAppUserBindingOwners") |
| | | public class ListAppUserBindingOwnersCmd extends Cmd { |
| | | |
| | | @Autowired |
| | | private IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMOImpl; |
| | |
| | | private IUserInnerServiceSMO userInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeConstant.LIST_APPUSERBINDINGOWNERS; |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public HttpMethod getHttpMethod() { |
| | | return HttpMethod.GET; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return DEFAULT_ORDER; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | //super.validatePageInfo(reqJson); |
| | | |
| | | // Map<String, String> headers = event.getDataFlowContext().getRequestHeaders(); |
| | | |
| | | // Assert.hasKeyAndValue(headers, "userid", "请求头中未包含用户信息"); |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | |
| | | Map<String, String> headers = event.getDataFlowContext().getRequestHeaders(); |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | Map<String, String> headers = context.getReqHeaders(); |
| | | |
| | | if (!reqJson.containsKey("page")) { |
| | | reqJson.put("page", 1); |
| | |
| | | } else { |
| | | ownerAppUserDtos = new ArrayList<>(); |
| | | } |
| | | context.setResponseEntity(ResultVo.createResponseEntity((int) Math.ceil((double) count / (double) reqJson.getInteger("row")),count,ownerAppUserDtos)); |
| | | context.setResponseEntity(ResultVo.createResponseEntity((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, ownerAppUserDtos)); |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | private void refreshCommunityArea(List<OwnerAppUserDto> ownerAppUserDtos) { |
| | | String[] communityIds = getCommunityIds(ownerAppUserDtos); |
| | | if(communityIds == null || communityIds.length < 1){ |
| | | return ; |
| | | if (communityIds == null || communityIds.length < 1) { |
| | | return; |
| | | } |
| | | CommunityDto communityDto = new CommunityDto(); |
| | | communityDto.setCommunityIds(communityIds); |
| | |
| | | } |
| | | |
| | | return communityIds.toArray(new String[communityIds.size()]); |
| | | } |
| | | |
| | | public IOwnerAppUserInnerServiceSMO getOwnerAppUserInnerServiceSMOImpl() { |
| | | return ownerAppUserInnerServiceSMOImpl; |
| | | } |
| | | |
| | | public void setOwnerAppUserInnerServiceSMOImpl(IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMOImpl) { |
| | | this.ownerAppUserInnerServiceSMOImpl = ownerAppUserInnerServiceSMOImpl; |
| | | } |
| | | } |
old mode 100755
new mode 100644
| File was renamed from service-api/src/main/java/com/java110/api/listener/owner/ListOwnerMachines.java |
| | |
| | | package com.java110.api.listener.owner; |
| | | package com.java110.user.cmd.owner; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.listener.AbstractServiceApiListener; |
| | | import com.java110.core.annotation.Java110Listener; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.intf.community.ICommunityInnerServiceSMO; |
| | | import com.java110.intf.common.IMachineInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerInnerServiceSMO; |
| | | import com.java110.intf.community.IRoomInnerServiceSMO; |
| | | import com.java110.intf.community.IUnitInnerServiceSMO; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.RoomDto; |
| | | import com.java110.dto.community.CommunityDto; |
| | | import com.java110.dto.machine.MachineDto; |
| | | import com.java110.dto.owner.OwnerDto; |
| | | import com.java110.dto.unit.FloorAndUnitDto; |
| | | import com.java110.core.event.service.api.ServiceDataFlowEvent; |
| | | import com.java110.utils.constant.ServiceCodeConstant; |
| | | import com.java110.intf.common.IMachineInnerServiceSMO; |
| | | import com.java110.intf.community.ICommunityInnerServiceSMO; |
| | | import com.java110.intf.community.IRoomInnerServiceSMO; |
| | | import com.java110.intf.community.IUnitInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerInnerServiceSMO; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.vo.api.machine.ApiMachineDataVo; |
| | | import com.java110.vo.api.machine.ApiMachineVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 查询业主或成员 对应门禁设备,一般是房屋门,单元门 小区大门 |
| | | */ |
| | | @Java110Listener("listOwnerMachines") |
| | | public class ListOwnerMachines extends AbstractServiceApiListener { |
| | | @Java110Cmd(serviceCode = "owner.listOwnerMachines") |
| | | public class ListOwnerMachinesCmd extends Cmd { |
| | | |
| | | @Autowired |
| | | private IRoomInnerServiceSMO roomInnerServiceSMOImpl; |
| | |
| | | private IUnitInnerServiceSMO unitInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | Assert.hasKeyAndValue(reqJson, "memberId", "请求报文中未包含业主信息"); |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含小区信息"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | String communityId = reqJson.getString("communityId"); |
| | | String memberId = reqJson.getString("memberId"); |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeConstant.LIST_OWNER_MACHINES; |
| | | } |
| | | |
| | | @Override |
| | | public HttpMethod getHttpMethod() { |
| | | return HttpMethod.GET; |
| | | } |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return DEFAULT_ORDER; |
| | | } |
| | | |
| | | public IRoomInnerServiceSMO getRoomInnerServiceSMOImpl() { |
| | | return roomInnerServiceSMOImpl; |
| | | } |
| | | |
| | | public void setRoomInnerServiceSMOImpl(IRoomInnerServiceSMO roomInnerServiceSMOImpl) { |
| | | this.roomInnerServiceSMOImpl = roomInnerServiceSMOImpl; |
| | | } |
| | | |
| | | public IMachineInnerServiceSMO getMachineInnerServiceSMOImpl() { |
| | | return machineInnerServiceSMOImpl; |
| | | } |
| | | |
| | | public void setMachineInnerServiceSMOImpl(IMachineInnerServiceSMO machineInnerServiceSMOImpl) { |
| | | this.machineInnerServiceSMOImpl = machineInnerServiceSMOImpl; |
| | | } |
| | | |
| | | public IOwnerInnerServiceSMO getOwnerInnerServiceSMOImpl() { |
| | | return ownerInnerServiceSMOImpl; |
| | | } |
| | | |
| | | public void setOwnerInnerServiceSMOImpl(IOwnerInnerServiceSMO ownerInnerServiceSMOImpl) { |
| | | this.ownerInnerServiceSMOImpl = ownerInnerServiceSMOImpl; |
| | | } |
| | | |
| | | public ICommunityInnerServiceSMO getCommunityInnerServiceSMOImpl() { |
| | | return communityInnerServiceSMOImpl; |
| | | } |
| | | |
| | | public void setCommunityInnerServiceSMOImpl(ICommunityInnerServiceSMO communityInnerServiceSMOImpl) { |
| | | this.communityInnerServiceSMOImpl = communityInnerServiceSMOImpl; |
| | | } |
| | | |
| | | public IUnitInnerServiceSMO getUnitInnerServiceSMOImpl() { |
| | | return unitInnerServiceSMOImpl; |
| | | } |
| | | |
| | | public void setUnitInnerServiceSMOImpl(IUnitInnerServiceSMO unitInnerServiceSMOImpl) { |
| | | this.unitInnerServiceSMOImpl = unitInnerServiceSMOImpl; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.user.cmd.owner; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.basePrivilege.BasePrivilegeDto; |
| | | import com.java110.dto.owner.OwnerDto; |
| | | import com.java110.intf.community.IMenuInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerInnerServiceSMO; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.api.ApiOwnerDataVo; |
| | | import com.java110.vo.api.ApiOwnerVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Java110Cmd(serviceCode = "owner.queryOwnerMembers") |
| | | public class QueryOwnerMembersCmd extends Cmd { |
| | | |
| | | @Autowired |
| | | private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IMenuInnerServiceSMO menuInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | Assert.jsonObjectHaveKey(reqJson, "communityId", "请求中未包含communityId信息"); |
| | | Assert.jsonObjectHaveKey(reqJson, "ownerId", "请求中未包含ownerId信息"); |
| | | // Assert.jsonObjectHaveKey(reqJson, "ownerTypeCd", "请求中未包含ownerTypeCd信息"); |
| | | } |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | String userId = context.getReqHeaders().get("user-id"); |
| | | OwnerDto ownerDto = BeanConvertUtil.covertBean(reqJson, OwnerDto.class); |
| | | ownerDto.setOwnerTypeCds(new String[]{"1002", "1003", "1004", "1005"}); |
| | | List<OwnerDto> ownerDtoList = ownerInnerServiceSMOImpl.queryOwnerMembers(ownerDto); |
| | | //查询是否有脱敏权限 |
| | | List<Map> privileges = null; |
| | | BasePrivilegeDto basePrivilegeDto = new BasePrivilegeDto(); |
| | | basePrivilegeDto.setResource("/roomCreateFee"); |
| | | basePrivilegeDto.setUserId(userId); |
| | | privileges = menuInnerServiceSMOImpl.checkUserHasResource(basePrivilegeDto); |
| | | if (privileges == null || privileges.size() == 0) { |
| | | for (OwnerDto owner : ownerDtoList) { |
| | | String idCard = owner.getIdCard(); |
| | | if (!StringUtil.isEmpty(idCard)) { |
| | | idCard = idCard.substring(0, 6) + "**********" + idCard.substring(16); |
| | | owner.setIdCard(idCard); |
| | | } |
| | | String link = owner.getLink(); |
| | | if (!StringUtil.isEmpty(link)) { |
| | | link = link.substring(0, 3) + "****" + link.substring(7); |
| | | owner.setLink(link); |
| | | } |
| | | } |
| | | } |
| | | ApiOwnerVo apiOwnerVo = new ApiOwnerVo(); |
| | | apiOwnerVo.setOwners(BeanConvertUtil.covertBeanList(ownerDtoList, ApiOwnerDataVo.class)); |
| | | apiOwnerVo.setTotal(ownerDtoList.size()); |
| | | apiOwnerVo.setRecords(1); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiOwnerVo), HttpStatus.OK); |
| | | context.setResponseEntity(responseEntity); |
| | | } |
| | | } |