Browse Source

Merge remote-tracking branch 'origin/dev_bugfix_ljj' into dev

# Conflicts:
#	epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleContentDao.xml
master
yinzuomei 2 years ago
parent
commit
289f95387f
  1. 9
      doc/epmet-cloud.md
  2. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  3. 1
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideDTO.java
  4. 38
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideServiceImpl.java
  5. 168
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java
  6. 30
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

9
doc/epmet-cloud.md

@ -10,4 +10,11 @@
例如:有A、B2个服务,并且A调用B,如果我们只需要开发A服务,那本地只启动A服务即可,A调用B的时候,会调用服务器的B服务。 例如:有A、B2个服务,并且A调用B,如果我们只需要开发A服务,那本地只启动A服务即可,A调用B的时候,会调用服务器的B服务。
如果需要开发AB2个服务,那么将A中的FeignClient的url属性指向localhost。 如果需要开发AB2个服务,那么将A中的FeignClient的url属性指向localhost。
PS:目前正在测试通过负载均衡器和本地环境变量实现动态修改目标服务IP,成功之后就不需要再修改FeignClient的url,配置一下环境变量即可,到时候具体说 PS:目前正在测试通过负载均衡器和本地环境变量实现动态修改目标服务IP,成功之后就不需要再修改FeignClient的url,配置一下环境变量即可,到时候具体说
``` ```
## 私有化部署
##### 需要开放哪些域名
- epmet-cloud.elinkservice.cn 微信交互代理
- dysmsapi.aliyuncs.com 阿里云短信

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); houseChangeRecordCollect(formDTO.getId(), formDTO.getCustomerId(), icHouseDTO);
icHouseDao.updateById(entity); 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,英文:隔开 * 所有上级组织ID,英文:隔开
* orgId的orgIdPath
*/ */
private String pids; 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.constant.StrConstant;
import com.epmet.commons.tools.dto.form.PageFormDTO; import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; 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.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData; 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.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.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils; 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.commons.tools.utils.SpringContextUtils;
import com.epmet.constant.OrgInfoConstant;
import com.epmet.dao.GuideDao; import com.epmet.dao.GuideDao;
import com.epmet.dto.GuideDTO; import com.epmet.dto.GuideDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.GuideDetailResultDTO; import com.epmet.dto.result.GuideDetailResultDTO;
import com.epmet.dto.result.GuideListResultDTO; import com.epmet.dto.result.GuideListResultDTO;
import com.epmet.dto.result.OrgResultDTO;
import com.epmet.entity.*; import com.epmet.entity.*;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.*; import com.epmet.service.*;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@ -66,8 +67,6 @@ import java.util.stream.Collectors;
@Service @Service
public class GuideServiceImpl extends BaseServiceImpl<GuideDao, GuideEntity> implements GuideService { public class GuideServiceImpl extends BaseServiceImpl<GuideDao, GuideEntity> implements GuideService {
@Resource
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Resource @Resource
private GuideModuleService guideModuleService; private GuideModuleService guideModuleService;
@Resource @Resource
@ -184,7 +183,7 @@ public class GuideServiceImpl extends BaseServiceImpl<GuideDao, GuideEntity> imp
orgFormDTO.setOrgId(formDTO.getOrgId()); orgFormDTO.setOrgId(formDTO.getOrgId());
orgFormDTO.setOrgType(formDTO.getOrgType()); orgFormDTO.setOrgType(formDTO.getOrgType());
//获取组织的pId和pIds //获取组织的pId和pIds
Result<OrgResultDTO> result = govOrgOpenFeignClient.getAgencyInfo(orgFormDTO); /*Result<OrgResultDTO> result = govOrgOpenFeignClient.getAgencyInfo(orgFormDTO);
if (!result.success() || null == result.getData()) { if (!result.success() || null == result.getData()) {
throw new RenException(result.getCode(), result.getMsg()); throw new RenException(result.getCode(), result.getMsg());
} }
@ -193,7 +192,16 @@ public class GuideServiceImpl extends BaseServiceImpl<GuideDao, GuideEntity> imp
} else { } else {
guideDTO.setPid(result.getData().getAgencyId()); 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); insert(guideDTO);
//保存办事指南内容模块 //保存办事指南内容模块
if (CollectionUtils.isNotEmpty(formDTO.getModuleList())) { if (CollectionUtils.isNotEmpty(formDTO.getModuleList())) {
@ -273,7 +281,7 @@ public class GuideServiceImpl extends BaseServiceImpl<GuideDao, GuideEntity> imp
orgFormDTO.setOrgType(formDTO.getOrgType()); orgFormDTO.setOrgType(formDTO.getOrgType());
guideDTO.setOrgName(formDTO.getOrgName()); guideDTO.setOrgName(formDTO.getOrgName());
//获取组织的pId和pIds //获取组织的pId和pIds
Result<OrgResultDTO> result = govOrgOpenFeignClient.getAgencyInfo(orgFormDTO); /*Result<OrgResultDTO> result = govOrgOpenFeignClient.getAgencyInfo(orgFormDTO);
if (!result.success() || null == result.getData()) { if (!result.success() || null == result.getData()) {
throw new RenException(result.getCode(), result.getMsg()); throw new RenException(result.getCode(), result.getMsg());
} }
@ -282,7 +290,17 @@ public class GuideServiceImpl extends BaseServiceImpl<GuideDao, GuideEntity> imp
} else { } else {
guideDTO.setPid(result.getData().getAgencyId()); 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); update(guideDTO);
//保存办事指南内容模块 //保存办事指南内容模块
if (CollectionUtils.isNotEmpty(formDTO.getModuleList())) { if (CollectionUtils.isNotEmpty(formDTO.getModuleList())) {

168
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java

@ -9,10 +9,12 @@ import com.epmet.commons.tools.enums.RelationshipEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData; 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.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; 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.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; 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.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.PidUtils; import com.epmet.commons.tools.utils.PidUtils;
@ -43,6 +45,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
@ -421,6 +424,7 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao,
updateUserInfo(icResiCollectEntity,memberList.get(i),false,formDTO,userIdCardEntity); updateUserInfo(icResiCollectEntity,memberList.get(i),false,formDTO,userIdCardEntity);
}else{ }else{
// 人员房屋不一致(更新人员信息和变更记录) // 人员房屋不一致(更新人员信息和变更记录)
// 数据库中:ic_resi_user已存在居民,但是不住在当前信息采集他填写的房屋,
updateUserInfo(icResiCollectEntity,memberList.get(i),true,formDTO,userIdCardEntity); updateUserInfo(icResiCollectEntity,memberList.get(i),true,formDTO,userIdCardEntity);
} }
}else{ }else{
@ -446,7 +450,9 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao,
getHouseInfoToCollectFormDTO.setDoorName(formDTO.getDoorName()); getHouseInfoToCollectFormDTO.setDoorName(formDTO.getDoorName());
Result<IcHouseInfoCollectResultDTO> resultDTOResult = govOrgFeignClient.getHouseInfoToCollect(getHouseInfoToCollectFormDTO); Result<IcHouseInfoCollectResultDTO> resultDTOResult = govOrgFeignClient.getHouseInfoToCollect(getHouseInfoToCollectFormDTO);
IcHouseInfoCollectResultDTO icHouseInfoCollectResultDTO = resultDTOResult.getData(); IcHouseInfoCollectResultDTO icHouseInfoCollectResultDTO = resultDTOResult.getData();
if(null==icHouseInfoCollectResultDTO){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"房屋不存在","房屋不存在,请先新建同名房屋");
}
// 新增房屋后需要collect更新上房屋ID // 新增房屋后需要collect更新上房屋ID
// log // log
icResiCollectEntity.setHomeId(icHouseInfoCollectResultDTO.getId()); icResiCollectEntity.setHomeId(icHouseInfoCollectResultDTO.getId());
@ -462,7 +468,9 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao,
private void updateHouseInfo(IcResiCollectEntity icResiCollectEntity){ private void updateHouseInfo(IcResiCollectEntity icResiCollectEntity){
CollectHouseFormDTO collectHouseFormDTO = new CollectHouseFormDTO(); CollectHouseFormDTO collectHouseFormDTO = new CollectHouseFormDTO();
collectHouseFormDTO.setId(icResiCollectEntity.getHomeId()); collectHouseFormDTO.setId(icResiCollectEntity.getHomeId());
//户主姓名
collectHouseFormDTO.setOwnerName(icResiCollectEntity.getHouseHolderName()); collectHouseFormDTO.setOwnerName(icResiCollectEntity.getHouseHolderName());
// 房屋状态:1:出租 0:自住 2:闲置 3:未售出
collectHouseFormDTO.setRentFlag(Integer.parseInt(icResiCollectEntity.getHouseType())); collectHouseFormDTO.setRentFlag(Integer.parseInt(icResiCollectEntity.getHouseType()));
collectHouseFormDTO.setCustomerId(icResiCollectEntity.getCustomerId()); collectHouseFormDTO.setCustomerId(icResiCollectEntity.getCustomerId());
collectHouseFormDTO.setResiNumber(icResiCollectEntity.getTotalResi()); collectHouseFormDTO.setResiNumber(icResiCollectEntity.getTotalResi());
@ -476,60 +484,86 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao,
* @param icResiCollectMemDetailDTO 登记城阳信息 * @param icResiCollectMemDetailDTO 登记城阳信息
* @param isUpdateLog 是否更新记录 * @param isUpdateLog 是否更新记录
* @param formDTO 入参 * @param formDTO 入参
* @param userEntity 根据身份证号查询到的user信息 * @param existedUserEntity 根据身份证号查询到的user信息
*/ */
private void updateUserInfo(IcResiCollectEntity icResiCollectEntity,IcResiCollectMemDetailDTO icResiCollectMemDetailDTO,Boolean isUpdateLog, private void updateUserInfo(IcResiCollectEntity icResiCollectEntity,
IcResiCollectCheckFormDTO formDTO,IcResiUserEntity userEntity){ IcResiCollectMemDetailDTO icResiCollectMemDetailDTO,
Boolean isUpdateLog,
IcResiCollectCheckFormDTO formDTO,
IcResiUserEntity existedUserEntity){
// 这个房屋下已经设置了户主后,再次选择户主时提示提示“房屋下已存在户主” PS.户主指与户主关系是本人的用户 // 这个房屋下已经设置了户主后,再次选择户主时提示提示“房屋下已存在户主” PS.户主指与户主关系是本人的用户
if (RelationshipEnum.SELF.getCode().equals(icResiCollectMemDetailDTO.getRelationship())) { if (RelationshipEnum.SELF.getCode().equals(icResiCollectMemDetailDTO.getRelationship())) {
LambdaQueryWrapper<IcResiUserEntity> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IcResiUserEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcResiUserEntity::getHomeId, icResiCollectEntity.getHomeId()); 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); List<IcResiUserEntity> entityList = icResiUserDao.selectList(wrapper);
if (CollectionUtils.isNotEmpty(entityList)) { if (CollectionUtils.isNotEmpty(entityList)) {
String errorMsg = "房屋下已存在户主"; String errorMsg = "当前房屋下已存在户主";
throw new EpmetException(EpmetErrorCode.ORG_ADD_FAILED.getCode(), errorMsg, 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){ if(isUpdateLog){
//变更记录表 //变更记录表
IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity(); IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity();
changeRecordEntity.setCustomerId(icResiCollectEntity.getCustomerId()); changeRecordEntity.setCustomerId(icResiCollectEntity.getCustomerId());
changeRecordEntity.setOperatorId(formDTO.getUserId()); changeRecordEntity.setOperatorId(formDTO.getUserId());
changeRecordEntity.setIcUserId(userEntity.getId()); changeRecordEntity.setIcUserId(existedUserEntity.getId());
changeRecordEntity.setOperatorName(formDTO.getRealName()); changeRecordEntity.setOperatorName(formDTO.getRealName());
changeRecordEntity.setIcUserName(userEntity.getName()); changeRecordEntity.setIcUserName(existedUserEntity.getName());
changeRecordEntity.setType("update"); changeRecordEntity.setType("transfer");
changeRecordEntity.setTypeName("修改"); changeRecordEntity.setTypeName("调动");
changeRecordEntity.setBeforeChangeName("-"); changeRecordEntity.setBeforeChangeName("-");
HouseInfoCache originHouseInfoCache= CustomerIcHouseRedis.getHouseInfo(icResiCollectEntity.getCustomerId(),existedUserEntity.getHomeId());
if(null!=originHouseInfoCache){
changeRecordEntity.setBeforeChangeName(originHouseInfoCache.getAgencyPathName().concat(StrConstant.HYPHEN).concat(originHouseInfoCache.getGridName()).concat(StrConstant.HYPHEN).concat(originHouseInfoCache.getAllName()));
}
changeRecordEntity.setAfterChangeName("-"); changeRecordEntity.setAfterChangeName("-");
HouseInfoCache newHouseInfoCache = CustomerIcHouseRedis.getHouseInfo(icResiCollectEntity.getCustomerId(), icResiCollectEntity.getHomeId());
if (null != newHouseInfoCache) {
//信息采集时居民自己填写的房屋 以他填写的为准!!!!!!
changeRecordEntity.setAfterChangeName(newHouseInfoCache.getAgencyPathName().concat(StrConstant.HYPHEN).concat(newHouseInfoCache.getGridName()).concat(StrConstant.HYPHEN).concat(newHouseInfoCache.getAllName()));
}
changeRecordEntity.setChangeTime(new java.util.Date()); changeRecordEntity.setChangeTime(new java.util.Date());
changeRecordEntity.setReason("来源于信息采集:更新居民所属房屋信息");
icUserChangeRecordService.insert(changeRecordEntity); 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 +576,65 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao,
if (RelationshipEnum.SELF.getCode().equals(icResiCollectMemDetailDTO.getRelationship())) { if (RelationshipEnum.SELF.getCode().equals(icResiCollectMemDetailDTO.getRelationship())) {
LambdaQueryWrapper<IcResiUserEntity> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IcResiUserEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcResiUserEntity::getHomeId, icResiCollectEntity.getHomeId()); 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); List<IcResiUserEntity> entityList = icResiUserDao.selectList(wrapper);
// 已经存在户主了,当前成员填写的也是户主... 暂不处理
if (CollectionUtils.isNotEmpty(entityList)) { if (CollectionUtils.isNotEmpty(entityList)) {
String errorMsg = "房屋下已存在户主"; String errorMsg = "当前房屋下已存在户主";
throw new EpmetException(EpmetErrorCode.ORG_ADD_FAILED.getCode(), errorMsg, 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()); AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(icResiCollectEntity.getAgencyId());
if (null == agencyInfoCache) { if (null == agencyInfoCache) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所属组织查询异常,agencyId:" + icResiCollectEntity.getAgencyId(), "所属组织查询异常"); 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(icResiCollectEntity.getPids() + ":" + icResiCollectEntity.getAgencyId()); // ic_resi_user表的组织的pids 含agencyId本身 !!!
userEntity.setPids(PidUtils.convertPid2OrgIdPath(icResiCollectEntity.getAgencyId(), agencyInfoCache.getPids())); insertUserEntity.setPids(PidUtils.convertPid2OrgIdPath(icResiCollectEntity.getAgencyId(), agencyInfoCache.getPids()));
userEntity.setAgencyId(icResiCollectEntity.getAgencyId()); // 网格所属组织id
userEntity.setGridId(icResiCollectEntity.getGridId()); insertUserEntity.setAgencyId(icResiCollectEntity.getAgencyId());
userEntity.setVillageId(icResiCollectEntity.getVillageId()); // 网格id
userEntity.setBuildId(icResiCollectEntity.getBuildId()); insertUserEntity.setGridId(icResiCollectEntity.getGridId());
userEntity.setUnitId(icResiCollectEntity.getUnitId()); // 小区id
userEntity.setHomeId(icResiCollectEntity.getHomeId()); insertUserEntity.setVillageId(icResiCollectEntity.getVillageId());
userEntity.setName(icResiCollectMemDetailDTO.getName()); // 楼栋id
userEntity.setMobile(icResiCollectMemDetailDTO.getMobile()); insertUserEntity.setBuildId(icResiCollectEntity.getBuildId());
userEntity.setIdCard(icResiCollectMemDetailDTO.getIdNum()); //单元id
userEntity.setYhzgx(icResiCollectMemDetailDTO.getRelationship()); insertUserEntity.setUnitId(icResiCollectEntity.getUnitId());
userEntity.setGzdw(icResiCollectMemDetailDTO.getWorkPlace()); //房屋id
userEntity.setRemarks(icResiCollectMemDetailDTO.getRemark()); insertUserEntity.setHomeId(icResiCollectEntity.getHomeId());
userEntity.setCustomerId(icResiCollectMemDetailDTO.getCustomerId()); //姓名
userEntity.setHjszd(icResiCollectMemDetailDTO.getDomicilePlace()); insertUserEntity.setName(icResiCollectMemDetailDTO.getName());
icResiUserDao.insert(userEntity); //手机号
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(); IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity();
changeRecordEntity.setCustomerId(icResiCollectEntity.getCustomerId()); changeRecordEntity.setCustomerId(icResiCollectEntity.getCustomerId());
changeRecordEntity.setOperatorId(formDTO.getUserId()); changeRecordEntity.setOperatorId(formDTO.getUserId());
changeRecordEntity.setIcUserId(userEntity.getId()); changeRecordEntity.setIcUserId(insertUserEntity.getId());
changeRecordEntity.setOperatorName(formDTO.getRealName()); changeRecordEntity.setOperatorName(formDTO.getRealName());
changeRecordEntity.setIcUserName(userEntity.getName()); changeRecordEntity.setIcUserName(insertUserEntity.getName());
changeRecordEntity.setType("add"); changeRecordEntity.setType("add");
changeRecordEntity.setTypeName("新增"); changeRecordEntity.setTypeName("新增");
changeRecordEntity.setBeforeChangeName("-"); changeRecordEntity.setBeforeChangeName("-");
changeRecordEntity.setAfterChangeName("-"); changeRecordEntity.setAfterChangeName("-");
changeRecordEntity.setReason("来源于信息采集");
changeRecordEntity.setChangeTime(new java.util.Date()); changeRecordEntity.setChangeTime(new java.util.Date());
icUserChangeRecordService.insert(changeRecordEntity); icUserChangeRecordService.insert(changeRecordEntity);
@ -602,11 +652,21 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao,
IcResiUserEntity originUser = icResiUserDao.selectOne(query); IcResiUserEntity originUser = icResiUserDao.selectOne(query);
return originUser; return originUser;
} }
/**
* 放回当前房屋内住的所有居民
* @param homeId
* @param customerId
* @return
*/
private Map<String, IcResiUserEntity> queryOriginUserByHomeId(String homeId,String customerId) { private Map<String, IcResiUserEntity> queryOriginUserByHomeId(String homeId,String customerId) {
LambdaQueryWrapper<IcResiUserEntity> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IcResiUserEntity> query = new LambdaQueryWrapper<>();
query.eq(IcResiUserEntity::getHomeId, homeId); query.eq(IcResiUserEntity::getHomeId, homeId);
query.eq(IcResiUserEntity::getCustomerId, customerId); query.eq(IcResiUserEntity::getCustomerId, customerId);
List<IcResiUserEntity> originUserList = icResiUserDao.selectList(query); 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())); Map<String, IcResiUserEntity> memMap = originUserList.stream().collect(Collectors.toMap(IcResiUserEntity::getIdCard, Function.identity()));
return memMap; return memMap;
} }

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

@ -712,7 +712,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
throw new RenException(String.format("居民信息修改,获取基础信息失败,基础信息Id->", resiUserId)); throw new RenException(String.format("居民信息修改,获取基础信息失败,基础信息Id->", resiUserId));
} }
//2022-1-18 信息修改判断基础信息表人员网格、小区、楼栋、单元、房屋维度数据以及十八类的类别数据是否变化,相应生成变更记录和变更明细数据 sun start //2022-1-18 信息修改判断基础信息表人员网格、小区、楼栋、单元、房屋维度数据以及十八类的类别数据是否变化,相应生成变更记录和变更明细数据 sun start
icUserChangeRecord(tokenDto, entity, map); icUserChangeRecord(entity, map);
//2022-1-18 sun end //2022-1-18 sun end
//2.更新主表数据 //2.更新主表数据
if (map.size() > NumConstant.ONE) { if (map.size() > NumConstant.ONE) {
@ -793,10 +793,16 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
} }
/** /**
* @Author sun * @description: 生成居民变更记录
* @Description 居民信息修改--生成变更记录和变更明细 * @param null:
**/ * @return
private void icUserChangeRecord(TokenDto tokenDto, IcResiUserEntity entity, LinkedHashMap<String, String> map) { * @author: sun
*/
public void icUserChangeRecord(IcResiUserEntity entity, LinkedHashMap<String, String> map) {
// prepare
String customerId = EpmetRequestHolder.getLoginUserCustomerId();
String staffId = EpmetRequestHolder.getLoginUserId();
java.util.Date date = new java.util.Date(); java.util.Date date = new java.util.Date();
//1.判断维度数据是否修改【网格、小区、楼栋、单元、房间有变化则先走人员调动逻辑】 //1.判断维度数据是否修改【网格、小区、楼栋、单元、房间有变化则先走人员调动逻辑】
if ((map.containsKey("GRID_ID") && !entity.getGridId().equals(map.get("GRID_ID"))) || (map.containsKey("VILLAGE_ID") && !entity.getVillageId().equals(map.get("VILLAGE_ID"))) if ((map.containsKey("GRID_ID") && !entity.getGridId().equals(map.get("GRID_ID"))) || (map.containsKey("VILLAGE_ID") && !entity.getVillageId().equals(map.get("VILLAGE_ID")))
@ -813,13 +819,13 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
formDTO.setNewHouseId(map.containsKey("HOME_ID") ? map.get("HOME_ID") : entity.getHomeId()); formDTO.setNewHouseId(map.containsKey("HOME_ID") ? map.get("HOME_ID") : entity.getHomeId());
formDTO.setTransferTime(date); formDTO.setTransferTime(date);
formDTO.setIdEdit(false); formDTO.setIdEdit(false);
formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setCustomerId(customerId);
formDTO.setStaffId(tokenDto.getUserId()); formDTO.setStaffId(staffId);
icUserTransferRecordService.add(formDTO); icUserTransferRecordService.add(formDTO);
} }
//2.判断类别数据是否修改[类别修改的变更明细里边存修改后的新值,是就存1否就存-1] //2.判断类别数据是否修改[类别修改的变更明细里边存修改后的新值,是就存1否就存-1]
IcResiCategoryStatsConfigDTO sfdto = new IcResiCategoryStatsConfigDTO(); IcResiCategoryStatsConfigDTO sfdto = new IcResiCategoryStatsConfigDTO();
sfdto.setCustomerId(tokenDto.getCustomerId()); sfdto.setCustomerId(customerId);
Result<List<IcResiCategoryStatsConfigDTO>> categoryListResult = operCustomizeOpenFeignClient.getCategoryList(sfdto); Result<List<IcResiCategoryStatsConfigDTO>> categoryListResult = operCustomizeOpenFeignClient.getCategoryList(sfdto);
if (!categoryListResult.success()) { if (!categoryListResult.success()) {
throw new RenException("居民信息修改,获取客户居民类别预警配置表数据失败"); throw new RenException("居民信息修改,获取客户居民类别预警配置表数据失败");
@ -844,7 +850,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
afterChangeName.append(dto.getLabel()).append(":").append("1".equals(newVlaue) ? "是" : "否").append(";"); afterChangeName.append(dto.getLabel()).append(":").append("1".equals(newVlaue) ? "是" : "否").append(";");
//变更明细里边存修改后的新值,是就存1否就存-1 //变更明细里边存修改后的新值,是就存1否就存-1
categoryEntity = new IcUserChangeDetailedEntity(); categoryEntity = new IcUserChangeDetailedEntity();
categoryEntity.setCustomerId(tokenDto.getCustomerId()); categoryEntity.setCustomerId(customerId);
categoryEntity.setPids(entity.getPids()); categoryEntity.setPids(entity.getPids());
categoryEntity.setAgencyId(entity.getAgencyId()); categoryEntity.setAgencyId(entity.getAgencyId());
categoryEntity.setGridId(map.containsKey("GRID_ID") ? map.get("GRID_ID") : entity.getGridId()); categoryEntity.setGridId(map.containsKey("GRID_ID") ? map.get("GRID_ID") : entity.getGridId());
@ -863,9 +869,9 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
//居民信息修改中有类别修改的才会生成变更记录和变更明细 //居民信息修改中有类别修改的才会生成变更记录和变更明细
if (list.size() > NumConstant.ZERO) { if (list.size() > NumConstant.ZERO) {
//变更记录 //变更记录
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, staffId);
changeRecordEntity.setCustomerId(tokenDto.getCustomerId()); changeRecordEntity.setCustomerId(customerId);
changeRecordEntity.setOperatorId(tokenDto.getUserId()); changeRecordEntity.setOperatorId(staffId);
changeRecordEntity.setIcUserId(entity.getId()); changeRecordEntity.setIcUserId(entity.getId());
changeRecordEntity.setOperatorName(staffInfoCache.getRealName()); changeRecordEntity.setOperatorName(staffInfoCache.getRealName());
changeRecordEntity.setIcUserName(map.containsKey("NAME") ? map.get("NAME") : entity.getName()); changeRecordEntity.setIcUserName(map.containsKey("NAME") ? map.get("NAME") : entity.getName());

Loading…
Cancel
Save