diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CollectHouseFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CollectHouseFormDTO.java index 7dca0d8d58..677660bdbb 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CollectHouseFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CollectHouseFormDTO.java @@ -23,4 +23,14 @@ public class CollectHouseFormDTO implements Serializable { * 房主姓名 */ private String ownerName; + + /** + * 客户ID + */ + private String customerId; + + /** + * 居住人数 + */ + private Integer resiNumber; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java index 31f9f46a97..225c28405a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java @@ -55,6 +55,16 @@ public interface HouseService { */ void houseChangeRecord(String houseId, String customerId, IcHouseDTO houseDTO); + /** + * Desc: 房屋变更记录(信息登记) + * @param houseId + * @param customerId + * @param houseDTO + * @author wgf + * @date 2022/5/10 10:57 + */ + void houseChangeRecordCollect(String houseId, String customerId, IcHouseDTO houseDTO); + /** * 小寨子社区-合同签订后变更成出租状态 * diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java index cf986f6f34..f7c5713e7a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java @@ -257,6 +257,12 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { entity.setId(formDTO.getId()); entity.setRentFlag(formDTO.getRentFlag()); entity.setOwnerName(formDTO.getOwnerName()); + entity.setResiNumber(formDTO.getResiNumber()); + + // 更新变更记录 + IcHouseDTO icHouseDTO = ConvertUtils.sourceToTarget(formDTO, IcHouseDTO.class); + houseChangeRecordCollect(formDTO.getId(), formDTO.getCustomerId(), icHouseDTO); + icHouseDao.updateById(entity); //删除房屋缓存 icHouseRedis.delHouseInfo(formDTO.getId(), entity.getCustomerId()); @@ -355,6 +361,64 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { } } + /** + * Desc: 房屋变更记录(信息登记) + * + * @param houseId + * @param customerId + * @param houseDTO + * @author wgf + * @date 2022/5/10 10:57 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void houseChangeRecordCollect(String houseId, String customerId, IcHouseDTO houseDTO) { + IcHouseEntity entity = icHouseService.selectById(houseId); + entity.setOwnerName(null == entity.getOwnerName() ? "" : entity.getOwnerName()); + entity.setOwnerPhone(null == entity.getOwnerPhone() ? "" : entity.getOwnerPhone()); + entity.setOwnerIdCard(null == entity.getOwnerIdCard() ? "" : entity.getOwnerIdCard()); + if (null == entity) { + throw new EpmetException("不存在此房屋..."); + } + StringBuilder sbBefore = new StringBuilder(); + StringBuilder sbAfter = new StringBuilder(); + List entityList = new ArrayList<>(); + + if (!houseDTO.getRentFlag().equals(entity.getRentFlag())) { + sbAfter.append(HouseChangeEnums.RENT_FLAG.getColumnName()).append(":").append(null == houseDTO.getRentName() ? HouseRentFlagEnums.getTypeValue(houseDTO.getRentFlag()) : houseDTO.getRentName()).append(";"); + sbBefore.append(HouseChangeEnums.RENT_FLAG.getColumnName()).append(":").append(HouseRentFlagEnums.getTypeValue(entity.getRentFlag())).append(";"); + IcHouseChangeDetailEntity e = new IcHouseChangeDetailEntity(); + e.setChangeCol(HouseChangeEnums.RENT_FLAG.getColumn()); + e.setChangeAfter(null == houseDTO.getRentName() ? HouseRentFlagEnums.getTypeValue(houseDTO.getRentFlag()) : houseDTO.getRentName()); + e.setChangeBefore(HouseRentFlagEnums.getTypeValue(entity.getRentFlag())); + entityList.add(e); + } + if (null != houseDTO.getOwnerName() && !houseDTO.getOwnerName().equals(entity.getOwnerName())) { + sbAfter.append(HouseChangeEnums.OWNER_NAME.getColumnName()).append(":").append(StringUtils.isNotBlank(houseDTO.getOwnerName()) ? houseDTO.getOwnerName() : "无").append(";"); + sbBefore.append(HouseChangeEnums.OWNER_NAME.getColumnName()).append(":").append(StringUtils.isNotBlank(entity.getOwnerName()) ? entity.getOwnerName() : "无").append(";"); + IcHouseChangeDetailEntity e = new IcHouseChangeDetailEntity(); + e.setChangeCol(HouseChangeEnums.OWNER_NAME.getColumn()); + e.setChangeAfter(StringUtils.isNotBlank(houseDTO.getOwnerName()) ? houseDTO.getOwnerName() : "无"); + e.setChangeBefore(StringUtils.isNotBlank(entity.getOwnerName()) ? entity.getOwnerName() : "无"); + entityList.add(e); + } + if (StringUtils.isNotBlank(sbAfter)) { + String before = sbBefore.substring(NumConstant.ZERO, sbBefore.length() - NumConstant.ONE); + String after = sbAfter.substring(NumConstant.ZERO, sbAfter.length() - NumConstant.ONE); + HouseAgencyInfoResultDTO houseAgencyInfo = icHouseDao.getHouseAgencyInfo(houseId); + IcHouseChangeRecordEntity recordEntity = ConvertUtils.sourceToTarget(houseAgencyInfo, IcHouseChangeRecordEntity.class); + recordEntity.setCustomerId(customerId); + recordEntity.setChangeBefore(before); + recordEntity.setChangeAfter(after); + changeRecordService.insert(recordEntity); + entityList.forEach(e -> { + e.setCustomerId(customerId); + e.setRecordId(recordEntity.getId()); + }); + changeDetailService.insertBatch(entityList); + } + } + @Override @Transactional(rollbackFor = Exception.class) public void update2Rent(RentHouseFormDTO formDTO) { diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiCollectCheckFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiCollectCheckFormDTO.java index 65197e4925..bbf0d029be 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiCollectCheckFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiCollectCheckFormDTO.java @@ -51,19 +51,20 @@ public class IcResiCollectCheckFormDTO implements Serializable { */ private String doorName; - // 修改房屋信息使用 /** - * 房屋ID + * 客户ID(审核人) */ - private String homeId; + private String customerId; + /** - * 房屋状态1:出租 0:自住 2:闲置 3:未售出 + * 员工ID(审核人) */ - private Integer rentFlag; + private String userId; + /** - * 房主姓名 + * 员工姓名(审核人) */ - private String ownerName; + private String realName; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java index eb7a6a320b..d339ed039c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java @@ -159,9 +159,9 @@ public class IcResiCollectController { */ @PostMapping("collectCheck") public Result collectCheck(@RequestBody IcResiCollectCheckFormDTO formDTO, @LoginUser TokenDto tokenDto) { -// formDTO.setUserId(tokenDto.getUserId()); -// formDTO.setCustomerId(tokenDto.getCustomerId()); - icResiCollectService.collectCheck(formDTO); + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + icResiCollectService.collectCheck(formDTO,tokenDto); return new Result(); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiMemberDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiMemberDao.java index 629908f470..bd4c629d53 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiMemberDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiMemberDao.java @@ -20,5 +20,11 @@ public interface IcResiMemberDao extends BaseDao { List selectMySubmit(@Param("latestResiCollectId") String latestResiCollectId, @Param("userId")String userId); + /** + * 审核在用 + * @param collectId + * @return + */ List selectListByCollectId(@Param("collectId") String collectId); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectService.java index 33d9081f52..07a97f933d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectService.java @@ -2,6 +2,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.*; import com.epmet.dto.result.CollectHouseInfoResultDTO; @@ -62,7 +63,7 @@ public interface IcResiCollectService extends BaseService { * @param formDTO * @return */ - void collectCheck(IcResiCollectCheckFormDTO formDTO); + void collectCheck(IcResiCollectCheckFormDTO formDTO, TokenDto tokenDto); /** * @describe: 扫描社区/小区二维码进行居民信息登记 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java index bab42db4c5..d0ff7f8641 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java @@ -5,6 +5,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.enums.RelationshipEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; @@ -12,22 +13,24 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.redis.common.bean.GridInfoCache; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IcResiCollectDao; import com.epmet.dao.IcResiMemberDao; +import com.epmet.dao.IcResiUserDao; import com.epmet.dto.IcNeighborHoodDTO; import com.epmet.dto.form.*; -import com.epmet.dto.result.CollectHouseInfoResultDTO; -import com.epmet.dto.result.CollectListResultDTO; -import com.epmet.dto.result.IcHouseInfoCollectResultDTO; -import com.epmet.dto.result.CollectPageListDTO; -import com.epmet.dto.result.LatestCollectResDTO; +import com.epmet.dto.result.*; import com.epmet.entity.IcResiCollectEntity; import com.epmet.entity.IcResiMemberEntity; +import com.epmet.entity.IcResiUserEntity; +import com.epmet.entity.IcUserChangeRecordEntity; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.IcResiCollectService; +import com.epmet.service.IcUserChangeRecordService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.apache.commons.collections4.CollectionUtils; @@ -55,10 +58,20 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl userResult = epmetUserOpenFeignClient.selectUserBaseInfo(tokenDto); + if (!userResult.success()){ + throw new EpmetException("查询用户信息失败..."); + } + formDTO.setRealName(userResult.getData().getRealName()); - }else{ - // 通过 + // 获取登记表信息 + IcResiCollectEntity icResiCollectEntity = baseDao.selectById(formDTO.getId()); - // fegin获取房屋信息 - GetHouseInfoToCollectFormDTO getHouseInfoToCollectFormDTO = new GetHouseInfoToCollectFormDTO(); - getHouseInfoToCollectFormDTO.setBuildingUnitId(formDTO.getBuildingUnitId()); - getHouseInfoToCollectFormDTO.setDoorName(formDTO.getDoorName()); - Result resultDTOResult = govOrgFeignClient.getHouseInfoToCollect(getHouseInfoToCollectFormDTO); - IcHouseInfoCollectResultDTO icHouseInfoCollectResultDTO = resultDTOResult.getData(); + // 获取登记的成员 + List memberList = icResiMemberDao.selectListByCollectId(formDTO.getId()); - if("1".equals(formDTO.getAddFlag())){ - // 新增房屋 ( todo 需要collect更新上房屋ID) + // 更新审核信息 + icResiCollectEntity.setCheckState(formDTO.getCheckState()); + icResiCollectEntity.setCheckReason(formDTO.getCheckReason()); + baseDao.updateById(icResiCollectEntity); + // 审核通过 + if("2".equals(formDTO.getCheckState())){ + if("1".equals(formDTO.getAddFlag())){ + // 新增房屋(新增房屋操作已在审核接口之前,前端调用新增接口实现) + // 更新登记表房屋ID + icResiCollectEntity = updateHomeId(icResiCollectEntity,formDTO); + + for(int i = 0 ; i < memberList.size() ; i++){ + // 根据身份证号和房屋ID获取人员信息 + IcResiUserEntity userIdCardEntity = queryOriginUserByIdCard(memberList.get(i).getIdNum(),icResiCollectEntity.getCustomerId()); + Map userMap = queryOriginUserByHomeId(icResiCollectEntity.getHomeId(),icResiCollectEntity.getCustomerId()); + if(userIdCardEntity != null){ + // 已存在人员 人员房屋不一致(更新人员信息和变更记录) + updateUserInfo(icResiCollectEntity,memberList.get(i),true,formDTO,userIdCardEntity); + }else{ + // 不存在人员 + insertUserInfo(icResiCollectEntity,memberList.get(i),formDTO); + } + } }else{ // 更新房屋 - CollectHouseFormDTO collectHouseFormDTO = new CollectHouseFormDTO(); - collectHouseFormDTO.setId(formDTO.getHomeId()); - collectHouseFormDTO.setOwnerName(formDTO.getOwnerName()); - collectHouseFormDTO.setRentFlag(formDTO.getRentFlag()); - govOrgFeignClient.updateCollect(collectHouseFormDTO); + updateHouseInfo(icResiCollectEntity); + + for(int i = 0 ; i < memberList.size() ; i++){ + // 根据身份证号和房屋ID获取人员信息 + IcResiUserEntity userIdCardEntity = queryOriginUserByIdCard(memberList.get(i).getIdNum(),icResiCollectEntity.getCustomerId()); + Map userMap = queryOriginUserByHomeId(icResiCollectEntity.getHomeId(),icResiCollectEntity.getCustomerId()); + if(userIdCardEntity != null){ + // 已存在人员 + if(userMap.containsKey(memberList.get(i).getIdNum())){ + // 人员房屋一致(只更新人员信息) + updateUserInfo(icResiCollectEntity,memberList.get(i),false,formDTO,userIdCardEntity); + }else{ + // 人员房屋不一致(更新人员信息和变更记录) + updateUserInfo(icResiCollectEntity,memberList.get(i),true,formDTO,userIdCardEntity); + } + }else{ + // 不存在人员 + insertUserInfo(icResiCollectEntity,memberList.get(i),formDTO); + } + } + } + } + } + + /** + * 更新登记表房屋ID + * @param icResiCollectEntity + * @param formDTO + * @return + */ + private IcResiCollectEntity updateHomeId(IcResiCollectEntity icResiCollectEntity,IcResiCollectCheckFormDTO formDTO){ + + // fegin获取房屋信息 + GetHouseInfoToCollectFormDTO getHouseInfoToCollectFormDTO = new GetHouseInfoToCollectFormDTO(); + getHouseInfoToCollectFormDTO.setBuildingUnitId(formDTO.getBuildingUnitId()); + getHouseInfoToCollectFormDTO.setDoorName(formDTO.getDoorName()); + Result resultDTOResult = govOrgFeignClient.getHouseInfoToCollect(getHouseInfoToCollectFormDTO); + IcHouseInfoCollectResultDTO icHouseInfoCollectResultDTO = resultDTOResult.getData(); - // 获取登记的成员 + // 新增房屋后需要collect更新上房屋ID + icResiCollectEntity.setHomeId(icHouseInfoCollectResultDTO.getId()); + baseDao.updateById(icResiCollectEntity); + return icResiCollectEntity; + } + /** + * 更新房屋信息 + * @param icResiCollectEntity + */ + private void updateHouseInfo(IcResiCollectEntity icResiCollectEntity){ + CollectHouseFormDTO collectHouseFormDTO = new CollectHouseFormDTO(); + collectHouseFormDTO.setId(icResiCollectEntity.getHomeId()); + collectHouseFormDTO.setOwnerName(icResiCollectEntity.getHouseHolderName()); + collectHouseFormDTO.setRentFlag(Integer.parseInt(icResiCollectEntity.getHouseType())); + collectHouseFormDTO.setCustomerId(icResiCollectEntity.getCustomerId()); + collectHouseFormDTO.setResiNumber(icResiCollectEntity.getTotalResi()); + govOrgFeignClient.updateCollect(collectHouseFormDTO); + } + /** + * 更新人员信息 + * @param icResiCollectEntity 登记信息 + * @param icResiCollectMemDetailDTO 登记城阳信息 + * @param isUpdateLog 是否更新记录 + * @param formDTO 入参 + * @param userEntity 根据身份证号查询到的user信息 + */ + private void updateUserInfo(IcResiCollectEntity icResiCollectEntity,IcResiCollectMemDetailDTO icResiCollectMemDetailDTO,Boolean isUpdateLog, + IcResiCollectCheckFormDTO formDTO,IcResiUserEntity userEntity){ + + // 这个房屋下已经设置了户主后,再次选择户主时提示提示“房屋下已存在户主” PS.户主指与户主关系是本人的用户 + if (RelationshipEnum.SELF.getCode().equals(icResiCollectMemDetailDTO.getRelationship())) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcResiUserEntity::getHomeId, icResiCollectEntity.getHomeId()); + wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()); + List entityList = icResiUserDao.selectList(wrapper); + if (CollectionUtils.isNotEmpty(entityList)) { + String errorMsg = "房屋下已存在户主"; + throw new EpmetException(EpmetErrorCode.ORG_ADD_FAILED.getCode(), errorMsg, errorMsg); } + } + userEntity.setPids(icResiCollectEntity.getPids()); + userEntity.setAgencyId(icResiCollectEntity.getAgencyId()); + userEntity.setGridId(icResiCollectEntity.getGridId()); + userEntity.setVillageId(icResiCollectEntity.getVillageId()); + userEntity.setBuildId(icResiCollectEntity.getBuildId()); + userEntity.setUnitId(icResiCollectEntity.getUnitId()); + userEntity.setHomeId(icResiCollectEntity.getHomeId()); + userEntity.setName(icResiCollectMemDetailDTO.getName()); + userEntity.setMobile(icResiCollectMemDetailDTO.getMobile()); + userEntity.setIdCard(icResiCollectMemDetailDTO.getIdNum()); + userEntity.setYhzgx(icResiCollectMemDetailDTO.getRelationship()); + userEntity.setGzdw(icResiCollectMemDetailDTO.getWorkPlace()); + userEntity.setRemarks(icResiCollectMemDetailDTO.getRemark()); + icResiUserDao.updateById(userEntity); + + // 判断是否需要更新记录 + if(isUpdateLog){ + //变更记录表 + IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity(); + changeRecordEntity.setCustomerId(icResiCollectEntity.getCustomerId()); + changeRecordEntity.setOperatorId(formDTO.getUserId()); + changeRecordEntity.setIcUserId(userEntity.getId()); + changeRecordEntity.setOperatorName(formDTO.getRealName()); + changeRecordEntity.setIcUserName(userEntity.getName()); + changeRecordEntity.setType("update"); + changeRecordEntity.setTypeName("修改"); + changeRecordEntity.setBeforeChangeName("-"); + changeRecordEntity.setAfterChangeName("-"); + changeRecordEntity.setChangeTime(new java.util.Date()); + icUserChangeRecordService.insert(changeRecordEntity); + } + } + /** + * 新增人员信息 + * @param icResiCollectMemDetailDTO + */ + private void insertUserInfo(IcResiCollectEntity icResiCollectEntity,IcResiCollectMemDetailDTO icResiCollectMemDetailDTO,IcResiCollectCheckFormDTO formDTO){ + + // 这个房屋下已经设置了户主后,再次选择户主时提示提示“房屋下已存在户主” PS.户主指与户主关系是本人的用户 + if (RelationshipEnum.SELF.getCode().equals(icResiCollectMemDetailDTO.getRelationship())) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcResiUserEntity::getHomeId, icResiCollectEntity.getHomeId()); + wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()); + List entityList = icResiUserDao.selectList(wrapper); + if (CollectionUtils.isNotEmpty(entityList)) { + String errorMsg = "房屋下已存在户主"; + throw new EpmetException(EpmetErrorCode.ORG_ADD_FAILED.getCode(), errorMsg, errorMsg); + } } + // 新增人员 + IcResiUserEntity userEntity = new IcResiUserEntity(); + userEntity.setPids(icResiCollectEntity.getPids()); + userEntity.setAgencyId(icResiCollectEntity.getAgencyId()); + userEntity.setGridId(icResiCollectEntity.getGridId()); + userEntity.setVillageId(icResiCollectEntity.getVillageId()); + userEntity.setBuildId(icResiCollectEntity.getBuildId()); + userEntity.setUnitId(icResiCollectEntity.getUnitId()); + userEntity.setHomeId(icResiCollectEntity.getHomeId()); + userEntity.setName(icResiCollectMemDetailDTO.getName()); + userEntity.setMobile(icResiCollectMemDetailDTO.getMobile()); + userEntity.setIdCard(icResiCollectMemDetailDTO.getIdNum()); + userEntity.setYhzgx(icResiCollectMemDetailDTO.getRelationship()); + userEntity.setGzdw(icResiCollectMemDetailDTO.getWorkPlace()); + userEntity.setRemarks(icResiCollectMemDetailDTO.getRemark()); + icResiUserDao.updateById(userEntity); + + //变更记录表 + IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity(); + changeRecordEntity.setCustomerId(icResiCollectEntity.getCustomerId()); + changeRecordEntity.setOperatorId(formDTO.getUserId()); + changeRecordEntity.setIcUserId(userEntity.getId()); + changeRecordEntity.setOperatorName(formDTO.getRealName()); + changeRecordEntity.setIcUserName(userEntity.getName()); + changeRecordEntity.setType("add"); + changeRecordEntity.setTypeName("新增"); + changeRecordEntity.setBeforeChangeName("-"); + changeRecordEntity.setAfterChangeName("-"); + changeRecordEntity.setChangeTime(new java.util.Date()); + icUserChangeRecordService.insert(changeRecordEntity); + } + /** + * 获取人员信息 + * @param idCard + * @return + */ + private IcResiUserEntity queryOriginUserByIdCard(String idCard,String customerId) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcResiUserEntity::getIdCard, idCard); + query.eq(IcResiUserEntity::getCustomerId, customerId); + IcResiUserEntity originUser = icResiUserDao.selectOne(query); + return originUser; + } + private Map queryOriginUserByHomeId(String homeId,String customerId) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcResiUserEntity::getHomeId, homeId); + query.eq(IcResiUserEntity::getCustomerId, customerId); + List originUserList = icResiUserDao.selectList(query); + Map memMap = originUserList.stream().collect(Collectors.toMap(IcResiUserEntity::getIdCard, Function.identity())); + return memMap; } @Override