| | |
| | | resource = "userDoc", |
| | | author = "吴学文", |
| | | serviceCode = "owner.editOwner", |
| | | seq = 10 |
| | | ) |
| | | seq = 10) |
| | | |
| | | @Java110ParamsDoc(params = { |
| | | @Java110ParamDoc(name = "communityId", length = 30, remark = "小区ID"), |
| | |
| | | params = { |
| | | @Java110ParamDoc(name = "code", type = "int", length = 11, defaultValue = "0", remark = "返回编号,0 成功 其他失败"), |
| | | @Java110ParamDoc(name = "msg", type = "String", length = 250, defaultValue = "成功", remark = "描述"), |
| | | } |
| | | ) |
| | | }) |
| | | |
| | | @Java110ExampleDoc( |
| | | reqBody = "{\n" + |
| | |
| | | Assert.jsonObjectHaveKey(reqJson, "communityId", "请求报文中未包含communityId"); |
| | | // Assert.jsonObjectHaveKey(paramIn, "idCard", "请求报文中未包含身份证号"); |
| | | Assert.judgeAttrValue(reqJson); |
| | | |
| | | //获取手机号(判断手机号是否重复) |
| | | String link = reqJson.getString("link"); |
| | | if (!StringUtil.isEmpty(link) && link.contains("*")) { |
| | |
| | | } |
| | | //获取身份证号(判断身份证号是否重复) |
| | | String idCard = reqJson.getString("idCard"); |
| | | |
| | | if (!StringUtil.isEmpty(idCard) && idCard.contains("*")) { |
| | | OwnerDto owner = new OwnerDto(); |
| | | owner.setOwnerId(reqJson.getString("ownerId")); |
| | |
| | | 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")); |
| | |
| | | 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("手机号输入不正确!"); |
| | |
| | | } |
| | | //todo 修改 业主信息 |
| | | editOwner(reqJson); |
| | | |
| | | JSONArray attrs = reqJson.getJSONArray("attrs"); |
| | | if (attrs == null || attrs.size() < 1) { |
| | | return; |
| | |
| | | throw new CmdException("修改业主属性失败"); |
| | | } |
| | | } |
| | | |
| | | //todo 如果 业主做了绑定则修改绑定的手机号 |
| | | updateOwnerAppUser(reqJson); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | public void editOwner(JSONObject paramInJson) { |
| | | |
| | | OwnerDto ownerDto = new OwnerDto(); |
| | | ownerDto.setMemberId(paramInJson.getString("memberId")); |
| | | List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwnerMembers(ownerDto); |
| | | |
| | | Assert.listOnlyOne(ownerDtos, "未查询到业主信息或查询到多条"); |
| | | |
| | | JSONObject businessOwner = new JSONObject(); |
| | | businessOwner.putAll(BeanConvertUtil.beanCovertMap(ownerDtos.get(0))); |
| | | businessOwner.putAll(paramInJson); |
| | | |
| | | if (paramInJson.containsKey("wxPhoto")) { |
| | | businessOwner.put("link", paramInJson.getString("wxPhoto")); |
| | | } |
| | |
| | | if (flag < 1) { |
| | | throw new CmdException("修改业主失败"); |
| | | } |
| | | |
| | | //todo 判断业主手机号和账户手机号是否相同,不相同修改账户手机号 |
| | | AccountDto accountDto = new AccountDto(); |
| | | accountDto.setObjId(ownerDtos.get(0).getMemberId()); |
| | | accountDto.setPartId(ownerDtos.get(0).getCommunityId()); |
| | | List<AccountDto> accountDtos = accountInnerServiceSMOImpl.queryAccounts(accountDto); |
| | | if(accountDtos == null || accountDtos.size()< 1){ |
| | | return ; |
| | | } |
| | | if(accountDtos.get(0).getLink().equals(ownerDtos.get(0).getLink())){ |
| | | if (accountDtos == null || accountDtos.size() < 1) { |
| | | return; |
| | | } |
| | | //查询更新后的业主信息 |
| | | OwnerDto owner = new OwnerDto(); |
| | | owner.setMemberId(paramInJson.getString("memberId")); |
| | | List<OwnerDto> owners = ownerInnerServiceSMOImpl.queryOwnerMembers(owner); |
| | | Assert.listOnlyOne(owners, "未查询到业主信息或查询到多条"); |
| | | /*if (accountDtos.get(0).getLink().equals(ownerDtos.get(0).getLink())) { |
| | | return; |
| | | }*/ |
| | | if (!accountDtos.get(0).getLink().equals(owners.get(0).getLink()) || !accountDtos.get(0).getAcctName().equals(owners.get(0).getName())) { |
| | | AccountPo accountPo = new AccountPo(); |
| | | accountPo.setAcctName(owners.get(0).getName()); |
| | | accountPo.setLink(owners.get(0).getLink()); |
| | | accountPo.setAcctId(accountDtos.get(0).getAcctId()); |
| | | accountInnerServiceSMOImpl.updateAccount(accountPo); |
| | | } |
| | | |
| | | AccountPo accountPo = new AccountPo(); |
| | |
| | | } |
| | | |
| | | public void editOwnerPhoto(JSONObject paramInJson) { |
| | | |
| | | String _photo = paramInJson.getString("ownerPhoto"); |
| | | if (_photo.length() > 512) { |
| | | FileDto fileDto = new FileDto(); |
| | |
| | | fileDto.setCommunityId(paramInJson.getString("communityId")); |
| | | _photo = fileInnerServiceSMOImpl.saveFile(fileDto); |
| | | } |
| | | |
| | | FileRelDto fileRelDto = new FileRelDto(); |
| | | fileRelDto.setRelTypeCd("10000"); |
| | | fileRelDto.setObjId(paramInJson.getString("memberId")); |
| | |
| | | } |
| | | return; |
| | | } |
| | | |
| | | JSONObject businessUnit = new JSONObject(); |
| | | businessUnit.putAll(BeanConvertUtil.beanCovertMap(fileRelDtos.get(0))); |
| | | businessUnit.put("fileRealName", _photo); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 如果 业主做了绑定则修改绑定的手机号 |
| | | * |
| | | * @param reqJson |
| | | */ |
| | | private void updateOwnerAppUser(JSONObject reqJson) { |
| | | |
| | | OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto(); |
| | | ownerAppUserDto.setMemberId(reqJson.getString("memberId")); |
| | | |
| | | //todo 查询app用户表 |
| | | List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto); |
| | | if (ownerAppUserDtos == null || ownerAppUserDtos.size() < 1) { |
| | |
| | | OwnerAppUserPo ownerAppUserPo = BeanConvertUtil.covertBean(ownerAppUser, OwnerAppUserPo.class); |
| | | ownerAppUserPo.setLink(reqJson.getString("link")); |
| | | ownerAppUserV1InnerServiceSMOImpl.updateOwnerAppUser(ownerAppUserPo); |
| | | |
| | | if (StringUtil.isEmpty(ownerAppUser.getUserId())) { |
| | | continue; |
| | | } |
| | |
| | | userPo.setTel(reqJson.getString("link")); |
| | | userV1InnerServiceSMOImpl.updateUser(userPo); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |