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 baf6ad7abd..92fb0d2116 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 @@ -272,10 +272,10 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { houseChangeRecordCollect(formDTO.getId(), formDTO.getCustomerId(), icHouseDTO); icHouseDao.updateById(entity); - IcHouseDTO houseDTO = icHouseService.get(formDTO.getId()); + // IcHouseDTO houseDTO = icHouseService.get(formDTO.getId()); //删除房屋缓存 - icHouseRedis.delHouseInfo(formDTO.getId(), houseDTO.getCustomerId()); + icHouseRedis.delHouseInfo(formDTO.getId(), formDTO.getCustomerId()); } /** diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideDTO.java index f5fe57d143..db7177a3fa 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideDTO.java @@ -66,6 +66,7 @@ public class GuideDTO implements Serializable { /** * 所有上级组织ID,英文:隔开 + * orgId的orgIdPath */ private String pids; diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideServiceImpl.java index eadca17c92..b02baa9609 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideServiceImpl.java @@ -25,23 +25,24 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.form.PageFormDTO; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.enums.OrgTypeEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +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.commons.tools.utils.PidUtils; import com.epmet.commons.tools.utils.SpringContextUtils; -import com.epmet.constant.OrgInfoConstant; import com.epmet.dao.GuideDao; import com.epmet.dto.GuideDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.GuideDetailResultDTO; import com.epmet.dto.result.GuideListResultDTO; -import com.epmet.dto.result.OrgResultDTO; import com.epmet.entity.*; -import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.*; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -66,8 +67,6 @@ import java.util.stream.Collectors; @Service public class GuideServiceImpl extends BaseServiceImpl implements GuideService { - @Resource - private GovOrgOpenFeignClient govOrgOpenFeignClient; @Resource private GuideModuleService guideModuleService; @Resource @@ -184,7 +183,7 @@ public class GuideServiceImpl extends BaseServiceImpl imp orgFormDTO.setOrgId(formDTO.getOrgId()); orgFormDTO.setOrgType(formDTO.getOrgType()); //获取组织的pId和pIds - Result result = govOrgOpenFeignClient.getAgencyInfo(orgFormDTO); + /*Result result = govOrgOpenFeignClient.getAgencyInfo(orgFormDTO); if (!result.success() || null == result.getData()) { throw new RenException(result.getCode(), result.getMsg()); } @@ -193,7 +192,16 @@ public class GuideServiceImpl extends BaseServiceImpl imp } else { guideDTO.setPid(result.getData().getAgencyId()); } - guideDTO.setPids(result.getData().getPids().concat(":").concat(result.getData().getAgencyId())); + guideDTO.setPids(result.getData().getPids().concat(":").concat(result.getData().getAgencyId()));*/ + if(OrgTypeEnum.GRID.getCode().equals(formDTO.getOrgType())){ + GridInfoCache gridInfoCache=CustomerOrgRedis.getGridInfo(formDTO.getOrgId()); + guideDTO.setPid(gridInfoCache.getPid()); + guideDTO.setPids(gridInfoCache.getPids().concat(StrConstant.COLON).concat(gridInfoCache.getId())); + }else{ + AgencyInfoCache agencyInfoCache=CustomerOrgRedis.getAgencyInfo(formDTO.getOrgId()); + guideDTO.setPid(agencyInfoCache.getPid()); + guideDTO.setPids(PidUtils.convertPid2OrgIdPath(agencyInfoCache.getId(),agencyInfoCache.getPids())); + } insert(guideDTO); //保存办事指南内容模块 if (CollectionUtils.isNotEmpty(formDTO.getModuleList())) { @@ -273,7 +281,7 @@ public class GuideServiceImpl extends BaseServiceImpl imp orgFormDTO.setOrgType(formDTO.getOrgType()); guideDTO.setOrgName(formDTO.getOrgName()); //获取组织的pId和pIds - Result result = govOrgOpenFeignClient.getAgencyInfo(orgFormDTO); + /*Result result = govOrgOpenFeignClient.getAgencyInfo(orgFormDTO); if (!result.success() || null == result.getData()) { throw new RenException(result.getCode(), result.getMsg()); } @@ -282,7 +290,17 @@ public class GuideServiceImpl extends BaseServiceImpl imp } else { guideDTO.setPid(result.getData().getAgencyId()); } - guideDTO.setPids(result.getData().getPids().concat(":").concat(result.getData().getAgencyId())); + guideDTO.setPids(result.getData().getPids().concat(":").concat(result.getData().getAgencyId()));*/ + + if(OrgTypeEnum.GRID.getCode().equals(formDTO.getOrgType())){ + GridInfoCache gridInfoCache=CustomerOrgRedis.getGridInfo(formDTO.getOrgId()); + guideDTO.setPid(gridInfoCache.getPid()); + guideDTO.setPids(gridInfoCache.getPids().concat(StrConstant.COLON).concat(gridInfoCache.getId())); + }else{ + AgencyInfoCache agencyInfoCache=CustomerOrgRedis.getAgencyInfo(formDTO.getOrgId()); + guideDTO.setPid(agencyInfoCache.getPid()); + guideDTO.setPids(PidUtils.convertPid2OrgIdPath(agencyInfoCache.getId(),agencyInfoCache.getPids())); + } update(guideDTO); //保存办事指南内容模块 if (CollectionUtils.isNotEmpty(formDTO.getModuleList())) { diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CollectListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CollectListFormDTO.java index 99957503cf..8e0a581428 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CollectListFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CollectListFormDTO.java @@ -29,6 +29,15 @@ public class CollectListFormDTO extends PageFormDTO { */ private String domicilePlace; + /** + * 审核状态:0待审核 1审核不通过 2审核通过 + */ + private String checkState; + /** + * 户主姓名 + */ + private String houseHolderName; + private String userId; private String customerId; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectHouseInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectHouseInfoResultDTO.java index 6e9fa340ee..8677b71c5a 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectHouseInfoResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectHouseInfoResultDTO.java @@ -3,7 +3,6 @@ package com.epmet.dto.result; import lombok.Data; import java.io.Serializable; -import java.util.List; /** * @Author wgf @@ -54,4 +53,6 @@ public class CollectHouseInfoResultDTO implements Serializable { * 房主姓名 */ private String ownerName; + + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListExcelResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListExcelResultDTO.java index 04a34bb814..0b4dc12e1a 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListExcelResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListExcelResultDTO.java @@ -17,6 +17,10 @@ import java.util.List; public class CollectListExcelResultDTO implements Serializable { private static final long serialVersionUID = -5659769436514116680L; + + @Excel(name = "所属网格",width = 30, needMerge = true) + private String gridName; + /** * 户主姓名 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListResultDTO.java index 9851be6340..44edef865e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListResultDTO.java @@ -1,6 +1,5 @@ package com.epmet.dto.result; -import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -26,7 +25,8 @@ public class CollectListResultDTO implements Serializable { // 组织Id private String agencyId; - + private String gridId; + private String gridName; /** * 居住地址 */ @@ -113,7 +113,21 @@ public class CollectListResultDTO implements Serializable { * 与户主关系 */ private String relationship; - + /** + * 来源于字典表 + * 暂不清楚:0 + * 本人:1 + * 配偶:2 + * 子女:3 + * 父母:4 + * 岳父母或公婆:5 + * 祖父母:6 + * 媳婿:7 + * 孙子女:8 + * 兄弟姐妹:9 + * 其他:10 + */ + private String relationShipName; /** * 人脸照片 */ 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 d508f670e8..944e2721cd 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 @@ -8,10 +8,7 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.ExcelUtils; -import com.epmet.commons.tools.utils.IdCardRegexUtils; -import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.*; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.*; import com.epmet.dto.result.*; @@ -25,6 +22,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; +import java.util.Date; import java.util.List; @@ -121,8 +119,8 @@ public class IcResiCollectController { resultDTO.setListP(children); list.add(resultDTO); }); - - ExcelUtils.exportExcelToTarget(response, null, list, CollectListExcelResultDTO.class); + String fileName="信息采集"+ DateUtils.format(new Date(),DateUtils.DATE_PATTERN); + ExcelUtils.exportExcelToTarget(response, fileName, list, CollectListExcelResultDTO.class); } /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java index dba99aadfa..31f4614347 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java @@ -464,4 +464,10 @@ public interface IcResiUserDao extends BaseDao { List getImportUserList(@Param("customerId")String customerId,@Param("agencyId")String agencyId); + /** + * 根据ic_resi_user.id查询,不限制任何状态 + * @param icResiUserId + * @return + */ + IcResiUserEntity getById(String icResiUserId); } 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 bfecfa4671..47971cdf45 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,14 +5,17 @@ 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.DictTypeEnum; 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; +import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; 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.redis.common.bean.HouseInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.PidUtils; @@ -27,7 +30,7 @@ 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.EpmetAdminOpenFeignClient; import com.epmet.feign.GovOrgFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.IcResiCollectService; @@ -43,6 +46,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Function; @@ -62,19 +66,15 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl collectList = baseDao.getCollectList(formDTO); result.setList(collectList); } + result.getList().forEach(collectDTO->{ + GridInfoCache gridInfoCache=CustomerOrgRedis.getGridInfo(collectDTO.getGridId()); + if(null!=gridInfoCache){ + collectDTO.setGridName(gridInfoCache.getGridNamePath()); + } + }); return result; } @@ -149,7 +155,18 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl list = baseDao.getCollectList(formDTO); if (CollectionUtils.isNotEmpty(list)) { - return list.get(NumConstant.ZERO); + CollectListResultDTO resultDTO=list.get(NumConstant.ZERO); + GridInfoCache gridInfoCache=CustomerOrgRedis.getGridInfo(resultDTO.getGridId()); + if(null!=gridInfoCache){ + resultDTO.setGridName(gridInfoCache.getGridNamePath()); + } + Result> relationShipRes=adminOpenFeignClient.dictMap(DictTypeEnum.RELATIONSHIP.getCode()); + for(CollectListResultDTO.CollectListMemberResultDTO member:resultDTO.getList()){ + if(StringUtils.isNotBlank(member.getRelationship())&&relationShipRes.success()&&relationShipRes.getData().containsKey(member.getRelationship())){ + member.setRelationShipName(relationShipRes.getData().get(member.getRelationship())); + } + } + return resultDTO; } return null; } @@ -421,6 +438,7 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl resultDTOResult = govOrgFeignClient.getHouseInfoToCollect(getHouseInfoToCollectFormDTO); IcHouseInfoCollectResultDTO icHouseInfoCollectResultDTO = resultDTOResult.getData(); - + if(null==icHouseInfoCollectResultDTO){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"房屋不存在","房屋不存在,请先新建同名房屋"); + } // 新增房屋后需要collect更新上房屋ID // log icResiCollectEntity.setHomeId(icHouseInfoCollectResultDTO.getId()); @@ -462,7 +482,9 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); wrapper.eq(IcResiUserEntity::getHomeId, icResiCollectEntity.getHomeId()); - wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()); + wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()) + .ne(IcResiUserEntity::getIdCard,icResiCollectMemDetailDTO.getIdNum()); List entityList = icResiUserDao.selectList(wrapper); if (CollectionUtils.isNotEmpty(entityList)) { - String errorMsg = "房屋下已存在户主"; - throw new EpmetException(EpmetErrorCode.ORG_ADD_FAILED.getCode(), errorMsg, errorMsg); + String errorMsg = "当前房屋下已存在户主"; + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); } } - AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(icResiCollectEntity.getAgencyId()); - if (null == agencyInfoCache) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所属组织查询异常,agencyId:" + icResiCollectEntity.getAgencyId(), "所属组织查询异常"); - } - // userEntity.setPids(icResiCollectEntity.getPids() + ":" + icResiCollectEntity.getAgencyId()); // ic_resi_user表的组织的pids 含agencyId本身 - userEntity.setPids(PidUtils.convertPid2OrgIdPath(icResiCollectEntity.getAgencyId(), agencyInfoCache.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()); - userEntity.setHjszd(icResiCollectMemDetailDTO.getDomicilePlace()); - icResiUserDao.updateById(userEntity); - // 判断是否需要更新记录 if(isUpdateLog){ //变更记录表 IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity(); changeRecordEntity.setCustomerId(icResiCollectEntity.getCustomerId()); changeRecordEntity.setOperatorId(formDTO.getUserId()); - changeRecordEntity.setIcUserId(userEntity.getId()); + changeRecordEntity.setIcUserId(existedUserEntity.getId()); changeRecordEntity.setOperatorName(formDTO.getRealName()); - changeRecordEntity.setIcUserName(userEntity.getName()); - changeRecordEntity.setType("update"); - changeRecordEntity.setTypeName("修改"); + changeRecordEntity.setIcUserName(existedUserEntity.getName()); + changeRecordEntity.setType("transfer"); + changeRecordEntity.setTypeName("调动"); changeRecordEntity.setBeforeChangeName("-"); + HouseInfoCache originHouseInfoCache= CustomerIcHouseRedis.getHouseInfo(icResiCollectEntity.getCustomerId(),existedUserEntity.getHomeId()); + if(null!=originHouseInfoCache){ + changeRecordEntity.setBeforeChangeName(originHouseInfoCache.getGridName().concat(StrConstant.HYPHEN).concat(originHouseInfoCache.getAllName())); + } changeRecordEntity.setAfterChangeName("-"); + HouseInfoCache newHouseInfoCache = CustomerIcHouseRedis.getHouseInfo(icResiCollectEntity.getCustomerId(), icResiCollectEntity.getHomeId()); + if (null != newHouseInfoCache) { + //信息采集时居民自己填写的房屋 以他填写的为准!!!!!! + changeRecordEntity.setAfterChangeName(newHouseInfoCache.getGridName().concat(StrConstant.HYPHEN).concat(newHouseInfoCache.getAllName())); + } changeRecordEntity.setChangeTime(new java.util.Date()); + changeRecordEntity.setReason("来源于信息采集:更新居民所属房屋信息"); icUserChangeRecordService.insert(changeRecordEntity); } + AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(icResiCollectEntity.getAgencyId()); + if (null == agencyInfoCache) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所属组织查询异常,agencyId:" + icResiCollectEntity.getAgencyId(), "所属组织查询异常"); + } + // userEntity.setPids(icResiCollectEntity.getPids() + ":" + icResiCollectEntity.getAgencyId()); // ic_resi_user表的组织的pids 含agencyId本身 + existedUserEntity.setPids(PidUtils.convertPid2OrgIdPath(icResiCollectEntity.getAgencyId(), agencyInfoCache.getPids())); + // 组织Id + existedUserEntity.setAgencyId(icResiCollectEntity.getAgencyId()); + // 网格id + existedUserEntity.setGridId(icResiCollectEntity.getGridId()); + // 小区id + existedUserEntity.setVillageId(icResiCollectEntity.getVillageId()); + // 楼栋id + existedUserEntity.setBuildId(icResiCollectEntity.getBuildId()); + // 单元id + existedUserEntity.setUnitId(icResiCollectEntity.getUnitId()); + // 房屋id + existedUserEntity.setHomeId(icResiCollectEntity.getHomeId()); + // 姓名 + existedUserEntity.setName(icResiCollectMemDetailDTO.getName()); + // 手机号 + existedUserEntity.setMobile(icResiCollectMemDetailDTO.getMobile()); + // 身份证号 + existedUserEntity.setIdCard(icResiCollectMemDetailDTO.getIdNum()); + // 与户主关系 + existedUserEntity.setYhzgx(icResiCollectMemDetailDTO.getRelationship()); + // 工作单位 + existedUserEntity.setGzdw(icResiCollectMemDetailDTO.getWorkPlace()); + // 备注 + existedUserEntity.setRemarks(icResiCollectMemDetailDTO.getRemark()); + // 户籍所在地 + existedUserEntity.setHjszd(icResiCollectMemDetailDTO.getDomicilePlace()); + icResiUserDao.updateById(existedUserEntity); } /** @@ -542,49 +590,65 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); wrapper.eq(IcResiUserEntity::getHomeId, icResiCollectEntity.getHomeId()); - wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()); + wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()) + .ne(IcResiUserEntity::getIdCard,icResiCollectMemDetailDTO.getIdNum()); List entityList = icResiUserDao.selectList(wrapper); + // 已经存在户主了,当前成员填写的也是户主... 暂不处理 if (CollectionUtils.isNotEmpty(entityList)) { - String errorMsg = "房屋下已存在户主"; - throw new EpmetException(EpmetErrorCode.ORG_ADD_FAILED.getCode(), errorMsg, errorMsg); + String errorMsg = "当前房屋下已存在户主"; + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); } } // 新增人员 - IcResiUserEntity userEntity = new IcResiUserEntity(); + IcResiUserEntity insertUserEntity = new IcResiUserEntity(); AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(icResiCollectEntity.getAgencyId()); if (null == agencyInfoCache) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所属组织查询异常,agencyId:" + icResiCollectEntity.getAgencyId(), "所属组织查询异常"); } + // 组织的pids 含agencyId本身 // userEntity.setPids(icResiCollectEntity.getPids() + ":" + icResiCollectEntity.getAgencyId()); // ic_resi_user表的组织的pids 含agencyId本身 !!! - userEntity.setPids(PidUtils.convertPid2OrgIdPath(icResiCollectEntity.getAgencyId(), agencyInfoCache.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()); - userEntity.setCustomerId(icResiCollectMemDetailDTO.getCustomerId()); - userEntity.setHjszd(icResiCollectMemDetailDTO.getDomicilePlace()); - icResiUserDao.insert(userEntity); + insertUserEntity.setPids(PidUtils.convertPid2OrgIdPath(icResiCollectEntity.getAgencyId(), agencyInfoCache.getPids())); + // 网格所属组织id + insertUserEntity.setAgencyId(icResiCollectEntity.getAgencyId()); + // 网格id + insertUserEntity.setGridId(icResiCollectEntity.getGridId()); + // 小区id + insertUserEntity.setVillageId(icResiCollectEntity.getVillageId()); + // 楼栋id + insertUserEntity.setBuildId(icResiCollectEntity.getBuildId()); + //单元id + insertUserEntity.setUnitId(icResiCollectEntity.getUnitId()); + //房屋id + insertUserEntity.setHomeId(icResiCollectEntity.getHomeId()); + //姓名 + insertUserEntity.setName(icResiCollectMemDetailDTO.getName()); + //手机号 + insertUserEntity.setMobile(icResiCollectMemDetailDTO.getMobile()); + insertUserEntity.setIdCard(icResiCollectMemDetailDTO.getIdNum()); + //与户主关系 + insertUserEntity.setYhzgx(icResiCollectMemDetailDTO.getRelationship()); + //工作单位 + insertUserEntity.setGzdw(icResiCollectMemDetailDTO.getWorkPlace()); + // 备注 + insertUserEntity.setRemarks(icResiCollectMemDetailDTO.getRemark()); + insertUserEntity.setCustomerId(icResiCollectMemDetailDTO.getCustomerId()); + // 户籍所在地 + insertUserEntity.setHjszd(icResiCollectMemDetailDTO.getDomicilePlace()); + icResiUserDao.insert(insertUserEntity); //变更记录表 IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity(); changeRecordEntity.setCustomerId(icResiCollectEntity.getCustomerId()); changeRecordEntity.setOperatorId(formDTO.getUserId()); - changeRecordEntity.setIcUserId(userEntity.getId()); + changeRecordEntity.setIcUserId(insertUserEntity.getId()); changeRecordEntity.setOperatorName(formDTO.getRealName()); - changeRecordEntity.setIcUserName(userEntity.getName()); + changeRecordEntity.setIcUserName(insertUserEntity.getName()); changeRecordEntity.setType("add"); changeRecordEntity.setTypeName("新增"); changeRecordEntity.setBeforeChangeName("-"); changeRecordEntity.setAfterChangeName("-"); + changeRecordEntity.setReason("来源于信息采集"); changeRecordEntity.setChangeTime(new java.util.Date()); icUserChangeRecordService.insert(changeRecordEntity); @@ -602,11 +666,21 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl queryOriginUserByHomeId(String homeId,String customerId) { LambdaQueryWrapper query = new LambdaQueryWrapper<>(); query.eq(IcResiUserEntity::getHomeId, homeId); query.eq(IcResiUserEntity::getCustomerId, customerId); List originUserList = icResiUserDao.selectList(query); + if(CollectionUtils.isEmpty(originUserList)){ + return new HashMap<>(); + } Map memMap = originUserList.stream().collect(Collectors.toMap(IcResiUserEntity::getIdCard, Function.identity())); return memMap; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index 7b9434043a..9a3863b42d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -328,7 +328,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); wrapper.eq(IcResiUserEntity::getHomeId, map.get("HOME_ID")); - wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()); + wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()) + .eq(IcResiUserEntity::getStatus,NumConstant.ZERO_STR); List entityList = baseDao.selectList(wrapper); if (CollectionUtils.isNotEmpty(entityList)) { String errorMsg = "房屋下已存在户主"; @@ -597,7 +598,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); wrapper.eq(IcResiUserEntity::getHomeId, entity.getHomeId()); - wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()); + wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()) + .eq(IcResiUserEntity::getStatus,NumConstant.ZERO_STR); List entityList = baseDao.selectList(wrapper); if (CollectionUtils.isNotEmpty(entityList)) { String errorMsg = "房屋下已存在户主"; @@ -1714,7 +1716,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); wrapper.eq(IcResiUserEntity::getHomeId, dto.getHomeId()); - wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()); + wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()) + .eq(IcResiUserEntity::getStatus,NumConstant.ZERO_STR); List entityList = baseDao.selectList(wrapper); if (CollectionUtils.isNotEmpty(entityList)) { String errorMsg = "房屋下已存在户主"; @@ -2792,7 +2795,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); wrapper.eq(IcResiUserEntity::getHomeId, dto.getHomeId()); - wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()); + wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()) + .eq(IcResiUserEntity::getStatus,NumConstant.ZERO_STR); List entityList = baseDao.selectList(wrapper); if (CollectionUtils.isNotEmpty(entityList)) { String errorMsg = "房屋下已存在户主"; @@ -2842,7 +2846,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); wrapper.eq(IcResiUserEntity::getHomeId, user.getHomeId()); - wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()); + wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()) + .eq(IcResiUserEntity::getStatus,NumConstant.ZERO_STR); List entityList = baseDao.selectList(wrapper); if (CollectionUtils.isNotEmpty(entityList)) { String errorMsg = "房屋下已存在户主"; @@ -2874,7 +2879,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); wrapper.eq(IcResiUserEntity::getHomeId, houseInfo.getHouseId()); - wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()); + wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()) + .eq(IcResiUserEntity::getStatus,NumConstant.ZERO_STR); List entityList = baseDao.selectList(wrapper); if (CollectionUtils.isNotEmpty(entityList)) { String errorMsg = "房屋下已存在户主"; diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml index 35090d4a12..ea43232174 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml @@ -19,6 +19,7 @@ + @@ -32,6 +33,7 @@ c.HOME_ID as homeId, c.CHECK_STATE as checkState, c.AGENCY_ID as agencyId, + c.GRID_ID as gridId, #{domicilePlace} as domicile_place FROM ic_resi_collect c left join ic_resi_member m on(c.id=m.IC_RESI_COLLECT_ID and m.del_flag='0') @@ -54,6 +56,12 @@ AND m.DOMICILE_PLACE LIKE CONCAT('%',#{domicilePlace},'%') + + AND c.CHECK_STATE = #{checkState} + + + AND c.HOUSE_HOLDER_NAME like concat('%', #{houseHolderName},'%') + ORDER BY c.CREATED_TIME DESC + +