wxz 2 years ago
parent
commit
3776c6fe21
  1. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  2. 1
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideDTO.java
  3. 38
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideServiceImpl.java
  4. 9
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CollectListFormDTO.java
  5. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectHouseInfoResultDTO.java
  6. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListExcelResultDTO.java
  7. 20
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListResultDTO.java
  8. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java
  9. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  10. 198
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java
  11. 20
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  12. 8
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml
  13. 6
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

4
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());
}
/**

1
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;

38
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<GuideDao, GuideEntity> implements GuideService {
@Resource
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Resource
private GuideModuleService guideModuleService;
@Resource
@ -184,7 +183,7 @@ public class GuideServiceImpl extends BaseServiceImpl<GuideDao, GuideEntity> imp
orgFormDTO.setOrgId(formDTO.getOrgId());
orgFormDTO.setOrgType(formDTO.getOrgType());
//获取组织的pId和pIds
Result<OrgResultDTO> result = govOrgOpenFeignClient.getAgencyInfo(orgFormDTO);
/*Result<OrgResultDTO> 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<GuideDao, GuideEntity> 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<GuideDao, GuideEntity> imp
orgFormDTO.setOrgType(formDTO.getOrgType());
guideDTO.setOrgName(formDTO.getOrgName());
//获取组织的pId和pIds
Result<OrgResultDTO> result = govOrgOpenFeignClient.getAgencyInfo(orgFormDTO);
/*Result<OrgResultDTO> 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<GuideDao, GuideEntity> 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())) {

9
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;

3
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;
}

4
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;
/**
* 户主姓名
*/

20
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;
/**
* 人脸照片
*/

10
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);
}
/**

6
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java

@ -464,4 +464,10 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
List<IcResiUserDTO> getImportUserList(@Param("customerId")String customerId,@Param("agencyId")String agencyId);
/**
* 根据ic_resi_user.id查询不限制任何状态
* @param icResiUserId
* @return
*/
IcResiUserEntity getById(String icResiUserId);
}

198
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<IcResiCollectDao,
private IcResiMemberDao icResiMemberDao;
@Autowired
private IcResiUserDao icResiUserDao;
@Autowired
private IcResiCollectDao icResiCollectDao;
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private IcUserChangeRecordService icUserChangeRecordService;
@Autowired
private DhDeviceUtil dhDeviceUtil;
@Autowired
private EpmetAdminOpenFeignClient adminOpenFeignClient;
@Override
@Transactional(rollbackFor = Exception.class)
@ -136,6 +136,12 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao,
List<CollectListResultDTO> 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<IcResiCollectDao,
public CollectListResultDTO detail(CollectListFormDTO formDTO) {
List<CollectListResultDTO> 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<Map<String, String>> 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<IcResiCollectDao,
updateUserInfo(icResiCollectEntity,memberList.get(i),false,formDTO,userIdCardEntity);
}else{
// 人员房屋不一致(更新人员信息和变更记录)
// 数据库中:ic_resi_user已存在居民,但是不住在当前信息采集他填写的房屋,
updateUserInfo(icResiCollectEntity,memberList.get(i),true,formDTO,userIdCardEntity);
}
}else{
@ -446,7 +464,9 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao,
getHouseInfoToCollectFormDTO.setDoorName(formDTO.getDoorName());
Result<IcHouseInfoCollectResultDTO> 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<IcResiCollectDao,
private void updateHouseInfo(IcResiCollectEntity icResiCollectEntity){
CollectHouseFormDTO collectHouseFormDTO = new CollectHouseFormDTO();
collectHouseFormDTO.setId(icResiCollectEntity.getHomeId());
//户主姓名
collectHouseFormDTO.setOwnerName(icResiCollectEntity.getHouseHolderName());
// 房屋状态:1:出租 0:自住 2:闲置 3:未售出
collectHouseFormDTO.setRentFlag(Integer.parseInt(icResiCollectEntity.getHouseType()));
collectHouseFormDTO.setCustomerId(icResiCollectEntity.getCustomerId());
collectHouseFormDTO.setResiNumber(icResiCollectEntity.getTotalResi());
@ -476,60 +498,86 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao,
* @param icResiCollectMemDetailDTO 登记城阳信息
* @param isUpdateLog 是否更新记录
* @param formDTO 入参
* @param userEntity 根据身份证号查询到的user信息
* @param existedUserEntity 根据身份证号查询到的user信息
*/
private void updateUserInfo(IcResiCollectEntity icResiCollectEntity,IcResiCollectMemDetailDTO icResiCollectMemDetailDTO,Boolean isUpdateLog,
IcResiCollectCheckFormDTO formDTO,IcResiUserEntity userEntity){
private void updateUserInfo(IcResiCollectEntity icResiCollectEntity,
IcResiCollectMemDetailDTO icResiCollectMemDetailDTO,
Boolean isUpdateLog,
IcResiCollectCheckFormDTO formDTO,
IcResiUserEntity existedUserEntity){
// 这个房屋下已经设置了户主后,再次选择户主时提示提示“房屋下已存在户主” PS.户主指与户主关系是本人的用户
if (RelationshipEnum.SELF.getCode().equals(icResiCollectMemDetailDTO.getRelationship())) {
LambdaQueryWrapper<IcResiUserEntity> 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<IcResiUserEntity> 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<IcResiCollectDao,
if (RelationshipEnum.SELF.getCode().equals(icResiCollectMemDetailDTO.getRelationship())) {
LambdaQueryWrapper<IcResiUserEntity> 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<IcResiUserEntity> 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<IcResiCollectDao,
IcResiUserEntity originUser = icResiUserDao.selectOne(query);
return originUser;
}
/**
* 放回当前房屋内住的所有居民
* @param homeId
* @param customerId
* @return
*/
private Map<String, IcResiUserEntity> queryOriginUserByHomeId(String homeId,String customerId) {
LambdaQueryWrapper<IcResiUserEntity> query = new LambdaQueryWrapper<>();
query.eq(IcResiUserEntity::getHomeId, homeId);
query.eq(IcResiUserEntity::getCustomerId, customerId);
List<IcResiUserEntity> originUserList = icResiUserDao.selectList(query);
if(CollectionUtils.isEmpty(originUserList)){
return new HashMap<>();
}
Map<String, IcResiUserEntity> memMap = originUserList.stream().collect(Collectors.toMap(IcResiUserEntity::getIdCard, Function.identity()));
return memMap;
}

20
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -328,7 +328,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
if (map.containsKey("YHZGX") && RelationshipEnum.SELF.getCode().equals(map.get("YHZGX"))) {
LambdaQueryWrapper<IcResiUserEntity> 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<IcResiUserEntity> entityList = baseDao.selectList(wrapper);
if (CollectionUtils.isNotEmpty(entityList)) {
String errorMsg = "房屋下已存在户主";
@ -597,7 +598,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
if (entity != null && !RelationshipEnum.SELF.getCode().equals(entity.getYhzgx())) {
LambdaQueryWrapper<IcResiUserEntity> 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<IcResiUserEntity> entityList = baseDao.selectList(wrapper);
if (CollectionUtils.isNotEmpty(entityList)) {
String errorMsg = "房屋下已存在户主";
@ -1714,7 +1716,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
@Override
public IcResiUserDTO get(String icResiUserId) {
IcResiUserEntity icResiUserEntity = baseDao.selectById(icResiUserId);
IcResiUserEntity icResiUserEntity =baseDao.getById(icResiUserId);
return ConvertUtils.sourceToTarget(icResiUserEntity, IcResiUserDTO.class);
}
@ -2770,7 +2772,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
if (RelationshipEnum.SELF.getCode().equals(dto.getYhzgx())) {
LambdaQueryWrapper<IcResiUserEntity> 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<IcResiUserEntity> entityList = baseDao.selectList(wrapper);
if (CollectionUtils.isNotEmpty(entityList)) {
String errorMsg = "房屋下已存在户主";
@ -2792,7 +2795,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
if (RelationshipEnum.SELF.getCode().equals(dto.getYhzgx())) {
LambdaQueryWrapper<IcResiUserEntity> 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<IcResiUserEntity> entityList = baseDao.selectList(wrapper);
if (CollectionUtils.isNotEmpty(entityList)) {
String errorMsg = "房屋下已存在户主";
@ -2842,7 +2846,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
if (RelationshipEnum.SELF.getCode().equals(dto.getYhzgx())) {
LambdaQueryWrapper<IcResiUserEntity> 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<IcResiUserEntity> entityList = baseDao.selectList(wrapper);
if (CollectionUtils.isNotEmpty(entityList)) {
String errorMsg = "房屋下已存在户主";
@ -2874,7 +2879,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
if (RelationshipEnum.SELF.getCode().equals(dto.getYhzgx())) {
LambdaQueryWrapper<IcResiUserEntity> 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<IcResiUserEntity> entityList = baseDao.selectList(wrapper);
if (CollectionUtils.isNotEmpty(entityList)) {
String errorMsg = "房屋下已存在户主";

8
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml

@ -19,6 +19,7 @@
<result property="homeId" column="homeId"/>
<result property="checkState" column="checkState"/>
<result property="agencyId" column="agencyId"/>
<result property="gridId" column="gridId"/>
<result property="domicilePlace" column="domicilePlace"></result>
<collection property="list" ofType="com.epmet.dto.result.CollectListResultDTO$CollectListMemberResultDTO" column="{id=id,domicilePlace=domicile_place}" select="selectMemberList"/>
</resultMap>
@ -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 @@
<if test='domicilePlace != null and domicilePlace != "" '>
AND m.DOMICILE_PLACE LIKE CONCAT('%',#{domicilePlace},'%')
</if>
<if test='checkState != null and checkState != "" '>
AND c.CHECK_STATE = #{checkState}
</if>
<if test='houseHolderName != null and houseHolderName != "" '>
AND c.HOUSE_HOLDER_NAME like concat('%', #{houseHolderName},'%')
</if>
ORDER BY c.CREATED_TIME DESC
</select>
<select id="selectMemberList" parameterType="map" resultType="com.epmet.dto.result.CollectListResultDTO$CollectListMemberResultDTO">

6
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -255,7 +255,7 @@
</when>
<otherwise>
ORDER BY
IC_RESI_USER.GRID_ID desc,
IC_RESI_USER.GRID_ID asc,
IC_RESI_USER.VILLAGE_ID ASC,
IC_RESI_USER.BUILD_ID ASC,
IC_RESI_USER.UNIT_ID ASC,
@ -1527,4 +1527,8 @@
</select>
<!-- 不限制任何状态 -->
<select id="getById" parameterType="java.lang.String" resultType="com.epmet.entity.IcResiUserEntity">
select r.* from ic_resi_user r where r.id = #{icResiUserId}
</select>
</mapper>

Loading…
Cancel
Save