| | |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.AbstractServiceCmdListener; |
| | | 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.OwnerDto; |
| | | import com.java110.intf.common.IFileInnerServiceSMO; |
| | | import com.java110.intf.common.IFileRelInnerServiceSMO; |
| | | import com.java110.intf.community.IOwnerV1InnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerV1InnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerAppUserInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerAppUserV1InnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerAttrInnerServiceSMO; |
| | |
| | | import com.java110.po.owner.OwnerAppUserPo; |
| | | import com.java110.po.owner.OwnerAttrPo; |
| | | import com.java110.po.owner.OwnerPo; |
| | | 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 java.util.List; |
| | | |
| | | @Java110Cmd(serviceCode = "owner.editOwner") |
| | | public class EditOwnerCmd extends AbstractServiceCmdListener { |
| | | |
| | | public class EditOwnerCmd extends Cmd { |
| | | |
| | | @Autowired |
| | | private IFileInnerServiceSMO fileInnerServiceSMOImpl; |
| | |
| | | |
| | | @Autowired |
| | | private IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerAppUserV1InnerServiceSMO ownerAppUserV1InnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFileRelInnerServiceSMO fileRelInnerServiceSMOImpl; |
| | | |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { |
| | | Assert.jsonObjectHaveKey(reqJson, "memberId", "请求报文中未包含ownerId"); |
| | | Assert.jsonObjectHaveKey(reqJson, "name", "请求报文中未包含name"); |
| | | Assert.jsonObjectHaveKey(reqJson, "userId", "请求报文中未包含userId"); |
| | | Assert.jsonObjectHaveKey(reqJson, "age", "请求报文中未包含age"); |
| | | // Assert.jsonObjectHaveKey(reqJson, "age", "请求报文中未包含age"); |
| | | Assert.jsonObjectHaveKey(reqJson, "link", "请求报文中未包含link"); |
| | | Assert.jsonObjectHaveKey(reqJson, "sex", "请求报文中未包含sex"); |
| | | Assert.jsonObjectHaveKey(reqJson, "ownerTypeCd", "请求报文中未包含ownerTypeCd"); |
| | | Assert.jsonObjectHaveKey(reqJson, "communityId", "请求报文中未包含communityId"); |
| | | // Assert.jsonObjectHaveKey(paramIn, "idCard", "请求报文中未包含身份证号"); |
| | | Assert.judgeAttrValue(reqJson); |
| | | } |
| | | |
| | | @Override |
| | | @Java110Transactional |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { |
| | | if (!reqJson.containsKey("ownerId") || OwnerDto.OWNER_TYPE_CD_OWNER.equals(reqJson.getString("ownerTypeCd"))) { |
| | | reqJson.put("ownerId", reqJson.getString("memberId")); |
| | | } |
| | | //获取手机号(判断手机号是否重复) |
| | | String link = reqJson.getString("link"); |
| | | if (link.length() != 11) { |
| | | throw new IllegalArgumentException("手机号输入不正确!"); |
| | | } |
| | | if (!StringUtil.isEmpty(link) && link.contains("*")) { |
| | | OwnerDto ownerDto = new OwnerDto(); |
| | | ownerDto.setOwnerId(reqJson.getString("ownerId")); |
| | |
| | | link = ownerDtos.get(0).getLink(); |
| | | reqJson.put("link", link); |
| | | } |
| | | //获取身份证号(判断身份证号是否重复) |
| | | String idCard = reqJson.getString("idCard"); |
| | | |
| | | if (!StringUtil.isEmpty(idCard) && idCard.contains("*")) { |
| | | OwnerDto owner = new OwnerDto(); |
| | | owner.setOwnerId(reqJson.getString("ownerId")); |
| | | //业主 |
| | | owner.setOwnerTypeCd("1001"); |
| | | List<OwnerDto> owners = ownerInnerServiceSMOImpl.queryOwners(owner); |
| | | Assert.listOnlyOne(owners, "查询业主信息错误!"); |
| | | idCard = owners.get(0).getIdCard(); |
| | | reqJson.put("idCard", idCard); |
| | | } |
| | | |
| | | String userValidate = MappingCache.getValue("USER_VALIDATE"); |
| | | |
| | | if (!"ON".equals(userValidate)) { |
| | | return; |
| | | } |
| | | |
| | | OwnerDto ownerDto = new OwnerDto(); |
| | | ownerDto.setLink(link); |
| | | ownerDto.setCommunityId(reqJson.getString("communityId")); |
| | |
| | | throw new IllegalArgumentException("手机号重复,请重新输入"); |
| | | } |
| | | } |
| | | } |
| | | //获取身份证号(判断身份证号是否重复) |
| | | String idCard = reqJson.getString("idCard"); |
| | | if (!StringUtil.isEmpty(idCard) && idCard.contains("*")) { |
| | | OwnerDto owner = new OwnerDto(); |
| | | owner.setOwnerId(reqJson.getString("ownerId")); |
| | | //业主 |
| | | owner.setOwnerTypeCd("1001"); |
| | | List<OwnerDto> owners = ownerInnerServiceSMOImpl.queryOwners(owner); |
| | | Assert.listOnlyOne(owners, "查询业主信息错误!"); |
| | | idCard = owners.get(0).getIdCard(); |
| | | reqJson.put("idCard", idCard); |
| | | } |
| | | if (!StringUtil.isEmpty(idCard)) { |
| | | OwnerDto owner = new OwnerDto(); |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Java110Transactional |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { |
| | | if (!reqJson.containsKey("ownerId") || OwnerDto.OWNER_TYPE_CD_OWNER.equals(reqJson.getString("ownerTypeCd"))) { |
| | | reqJson.put("ownerId", reqJson.getString("memberId")); |
| | | } |
| | | |
| | | //这里注释 因为 有国外的手机号 不是11位 |
| | | // if (link.length() != 11) { |
| | | // throw new IllegalArgumentException("手机号输入不正确!"); |
| | | // } |
| | | if (reqJson.containsKey("ownerPhoto") && !StringUtils.isEmpty(reqJson.getString("ownerPhoto"))) { |
| | | FileDto fileDto = new FileDto(); |
| | | fileDto.setFileId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_file_id)); |
| | |
| | | } |
| | | businessOwner.put("state", ownerDtos.get(0).getState()); |
| | | OwnerPo ownerPo = BeanConvertUtil.covertBean(businessOwner, OwnerPo.class); |
| | | if (StringUtil.isEmpty(ownerPo.getIdCard())) { |
| | | ownerPo.setAge(null); |
| | | } |
| | | int flag = ownerV1InnerServiceSMOImpl.updateOwner(ownerPo); |
| | | if (flag < 1) { |
| | | throw new CmdException("修改业主失败"); |
| | | } |
| | | OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto(); |
| | | ownerAppUserDto.setMemberId(paramInJson.getString("ownerId")); |
| | | |
| | | //查询app用户表 |
| | | List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto); |
| | | if (ownerAppUserDtos != null && ownerAppUserDtos.size() > 0) { |
| | |
| | | List<FileRelDto> fileRelDtos = fileRelInnerServiceSMOImpl.queryFileRels(fileRelDto); |
| | | if (fileRelDtos == null || fileRelDtos.size() == 0) { |
| | | JSONObject businessUnit = new JSONObject(); |
| | | businessUnit.put("fileRelId", "-1"); |
| | | businessUnit.put("fileRelId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_fileRelId)); |
| | | businessUnit.put("relTypeCd", "10000"); |
| | | businessUnit.put("saveWay", "table"); |
| | | businessUnit.put("objId", paramInJson.getString("memberId")); |
| | | businessUnit.put("fileRealName", paramInJson.getString("ownerPhotoId")); |
| | | businessUnit.put("fileSaveName", paramInJson.getString("ownerPhotoId")); |
| | | businessUnit.put("fileSaveName", paramInJson.getString("fileSaveName")); |
| | | FileRelPo fileRelPo = BeanConvertUtil.covertBean(businessUnit, FileRelPo.class); |
| | | flag = fileRelInnerServiceSMOImpl.saveFileRel(fileRelPo); |
| | | if (flag < 1) { |