diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/IcResiUserEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/IcResiUserEntity.java index e40441101d..657b37bb14 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/IcResiUserEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/IcResiUserEntity.java @@ -440,6 +440,11 @@ public class IcResiUserEntity extends BaseEpmetEntity { */ private String jtxxRemakes; + /** + * 用户状态【0:正常 1:转出】 + */ + private String status; + /** * 预留字段1 */ diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 9bd7bfb642..497cae9547 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -576,4 +576,11 @@ public interface GovOrgOpenFeignClient { */ @PostMapping("/gov/org/customeragency/configcustomerareacode") Result configCustomerAreaCode(@RequestBody CustomerAreaCodeFormDTO formDTO); + + /** + * @Author sun + * @Description 查询组织、网格、小区、楼栋、单元、房屋信息 + **/ + @PostMapping(value = "/gov/org/customeragency/icresiuserorgmsg") + Result icResiUserOrgMsg(@RequestBody IcResiUserOrgMsgFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index c3ddd39202..d4330f90d0 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -362,11 +362,21 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { /** * 运营端-客户管理,修改客户信息,调用gov-org服务,修改组织区划开关,修改根组织areaCode入参。 * - * @param areaCodeFormDTO + * @param formDTO * @return */ @Override public Result configCustomerAreaCode(CustomerAreaCodeFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "configCustomerAreaCode", formDTO); } + + /** + * @Author sun + * @Description 查询组织、网格、小区、楼栋、单元、房屋信息 + **/ + @Override + public Result icResiUserOrgMsg(IcResiUserOrgMsgFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "icResiUserOrgMsg", formDTO); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index d826060c2d..db2a0eec32 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -395,4 +395,14 @@ public class CustomerAgencyController { customerAgencyService.configCustomerAreaCode(formDTO); return new Result(); } + + /** + * @Author sun + * @Description 查询组织、网格、小区、楼栋、单元、房屋信息 + **/ + @PostMapping(value = "icresiuserorgmsg") + Result icResiUserOrgMsg(@RequestBody IcResiUserOrgMsgFormDTO formDTO) { + return new Result().ok(customerAgencyService.icResiUserOrgMsg(formDTO)); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 3e7406594e..3e4f44cd36 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -276,4 +276,11 @@ public interface CustomerAgencyService extends BaseService * @return */ void configCustomerAreaCode(CustomerAreaCodeFormDTO formDTO); + + /** + * @Author sun + * @Description 查询组织、网格、小区、楼栋、单元、房屋信息 + **/ + IcResiUserOrgMsgResultDTO icResiUserOrgMsg(IcResiUserOrgMsgFormDTO formDTO); + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 0cb99364a8..372aafa390 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -98,6 +98,14 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl> listOptionsByItemConditions(@RequestBody IcFormOptionsQueryFormDTO input); + /** + * @author sun + * @Description 获取客户居民类别预警配置表数据 + */ + @PostMapping("/oper/customize/icresicategorywarnconfig/categorywarnconfiglist/{customerId}") + Result> categoryWarnConfigList(@PathVariable String customerId); + } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java index da282124bb..9e4b5eca25 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java @@ -109,4 +109,9 @@ public class OperCustomizeOpenFeignClientFallback implements OperCustomizeOpenFe public Result> listOptionsByItemConditions(IcFormOptionsQueryFormDTO input) { return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "listOptionsByItemConditions", input); } + + @Override + public Result> categoryWarnConfigList(String customerId) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "categoryWarnConfigList", customerId); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcResiCategoryWarnConfigController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcResiCategoryWarnConfigController.java index 5e1ac6667b..004912ec40 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcResiCategoryWarnConfigController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcResiCategoryWarnConfigController.java @@ -91,4 +91,13 @@ public class IcResiCategoryWarnConfigController { ExcelUtils.exportExcelToTarget(response, null, list, IcResiCategoryWarnConfigExcel.class); } + /** + * @author sun + * @Description 获取客户居民类别预警配置表数据 + */ + @PostMapping("categorywarnconfiglist/{customerId}") + Result> categoryWarnConfigList(@PathVariable String customerId) { + return new Result>().ok(icResiCategoryWarnConfigService.categoryWarnConfigList(customerId)); + } + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcResiCategoryWarnConfigService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcResiCategoryWarnConfigService.java index bef9c7360f..adc78df071 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcResiCategoryWarnConfigService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcResiCategoryWarnConfigService.java @@ -92,4 +92,10 @@ public interface IcResiCategoryWarnConfigService extends BaseService categoryWarnConfigList(String customerId); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcResiCategoryWarnConfigServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcResiCategoryWarnConfigServiceImpl.java index 3235b04f0d..9559cf07f0 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcResiCategoryWarnConfigServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcResiCategoryWarnConfigServiceImpl.java @@ -17,6 +17,7 @@ package com.epmet.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; @@ -101,4 +102,17 @@ public class IcResiCategoryWarnConfigServiceImpl extends BaseServiceImpl categoryWarnConfigList(String customerId) { + LambdaQueryWrapper wrapperWarn = new LambdaQueryWrapper<>(); + wrapperWarn.eq(IcResiCategoryWarnConfigEntity::getCustomerId, customerId); + wrapperWarn.orderByAsc(IcResiCategoryWarnConfigEntity::getSort); + List entityList = baseDao.selectList(wrapperWarn); + return ConvertUtils.sourceToTarget(entityList, IcResiCategoryWarnConfigDTO.class); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcResiUserDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcResiUserDTO.java index 62fa0e45cf..72769ea31e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcResiUserDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcResiUserDTO.java @@ -448,6 +448,11 @@ public class IcResiUserDTO implements Serializable { */ private String jtxxRemakes; + /** + * 用户状态【0:正常 1:转出】 + */ + private String status; + /** * 删除标识 0.未删除 1.已删除 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcUserChangeDetailedDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcUserChangeDetailedDTO.java index 2c5203eddd..2220f907f5 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcUserChangeDetailedDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcUserChangeDetailedDTO.java @@ -45,7 +45,7 @@ public class IcUserChangeDetailedDTO implements Serializable { private String customerId; /** - * 字段名【18类对应的ic_resi_user表字段名】 + * 变更记录表主键【ic_user_change_record.id】 */ private String icUserChangeRecordId; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcUserChangeRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcUserChangeRecordDTO.java index e9f4e3ff91..5e4818d8f8 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcUserChangeRecordDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcUserChangeRecordDTO.java @@ -69,12 +69,12 @@ public class IcUserChangeRecordDTO implements Serializable { private String icUserName; /** - * 操作类型【add:新增 category:类别变动 transfer】 + * 操作类型【add:新增 category:类别 transfer:调动】 */ private String type; /** - * 操作类型名称【add:新增 category:类别变动 transfer:迁出】 + * 操作类型名称【add:新增 category:类别 transfer:调动】 */ private String typeName; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcUserTransferRecordController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcUserTransferRecordController.java index ead153c8cf..bb45818970 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcUserTransferRecordController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcUserTransferRecordController.java @@ -17,8 +17,16 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.IcResiUserTransferFormDTO; import com.epmet.service.IcUserTransferRecordService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -37,4 +45,19 @@ public class IcUserTransferRecordController { private IcUserTransferRecordService icUserTransferRecordService; + /** + * @Author sun + * @Description 【基础信息】人员调动 + **/ + @NoRepeatSubmit + @PostMapping("add") + public Result add(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserTransferFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, IcResiUserTransferFormDTO.TransferAdd.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + icUserTransferRecordService.add(formDTO); + return new Result(); + } + + } \ No newline at end of file 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 3a9cffbf7e..db5f3aa613 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 @@ -229,4 +229,6 @@ public interface IcResiUserDao extends BaseDao { @Param("code") String code); List listIcResiInfosByUserIds(@Param("userIds") List userIds); + + Map getCategoryListMap(@Param("icUserId") String icUserId); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java index f647871525..4a25a479af 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java @@ -440,6 +440,11 @@ public class IcResiUserEntity extends BaseEpmetEntity { */ private String jtxxRemakes; + /** + * 用户状态【0:正常 1:转出】 + */ + private String status; + /** * 预留字段1 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcUserChangeDetailedEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcUserChangeDetailedEntity.java index e230fbfd2a..35608feae9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcUserChangeDetailedEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcUserChangeDetailedEntity.java @@ -42,7 +42,7 @@ public class IcUserChangeDetailedEntity extends BaseEpmetEntity { private String customerId; /** - * 字段名【18类对应的ic_resi_user表字段名】 + * 变更记录表主键【ic_user_change_record.id】 */ private String icUserChangeRecordId; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcUserChangeRecordEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcUserChangeRecordEntity.java index eaf7226588..82b964d104 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcUserChangeRecordEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcUserChangeRecordEntity.java @@ -68,12 +68,12 @@ public class IcUserChangeRecordEntity extends BaseEpmetEntity { private String icUserName; /** - * 操作类型【add:新增 category:类别变动 transfer】 + * 操作类型【add:新增 category:类别 transfer:调动】 */ private String type; /** - * 操作类型名称【add:新增 category:类别变动 transfer:迁出】 + * 操作类型名称【add:新增 category:类别 transfer:调动】 */ private String typeName; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserTransferRecordService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserTransferRecordService.java index 5ce1565dcf..4d1d25f952 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserTransferRecordService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserTransferRecordService.java @@ -18,6 +18,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.form.IcResiUserTransferFormDTO; import com.epmet.entity.IcUserTransferRecordEntity; /** @@ -28,4 +29,10 @@ import com.epmet.entity.IcUserTransferRecordEntity; */ public interface IcUserTransferRecordService extends BaseService { + /** + * @Author sun + * @Description 【基础信息】人员调动 + **/ + void add(IcResiUserTransferFormDTO formDTO); + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java index 4e06314238..2f7dafb468 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java @@ -18,11 +18,35 @@ package com.epmet.service.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.IcResiUserDao; import com.epmet.dao.IcUserTransferRecordDao; +import com.epmet.dto.IcResiCategoryWarnConfigDTO; +import com.epmet.dto.IcResiUserDTO; +import com.epmet.dto.form.IcResiUserOrgMsgFormDTO; +import com.epmet.dto.form.IcResiUserTransferFormDTO; +import com.epmet.dto.result.IcResiUserOrgMsgResultDTO; +import com.epmet.entity.IcResiUserEntity; +import com.epmet.entity.IcUserChangeDetailedEntity; +import com.epmet.entity.IcUserChangeRecordEntity; import com.epmet.entity.IcUserTransferRecordEntity; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.feign.OperCustomizeOpenFeignClient; +import com.epmet.service.IcUserChangeDetailedService; +import com.epmet.service.IcUserChangeRecordService; import com.epmet.service.IcUserTransferRecordService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + /** * 居民调动记录表 * @@ -31,6 +55,211 @@ import org.springframework.stereotype.Service; */ @Service public class IcUserTransferRecordServiceImpl extends BaseServiceImpl implements IcUserTransferRecordService { + private Logger log = LoggerFactory.getLogger(IcUserTransferRecordServiceImpl.class); + @Autowired + private IcResiUserDao icResiUserDao; + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + @Autowired + private IcUserChangeRecordService icUserChangeRecordService; + @Autowired + private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; + @Autowired + private IcUserChangeDetailedService icUserChangeDetailedService; + + /** + * @Author sun + * @Description 【基础信息】人员调动 + **/ + @Override + public void add(IcResiUserTransferFormDTO formDTO) { + //1.判断被调动人员是否有效 + IcResiUserDTO resiUserDTO = icResiUserDao.selectIdByIdCard(formDTO.getCustomerId(), null, formDTO.getIcUserId()); + if (null == resiUserDTO) { + throw new RenException("9000", "人员调动失败,被调动人不存在!"); + } + + //2.查询人员调动前的组织、网格、小区、楼栋、单元、房屋信息 + IcResiUserOrgMsgFormDTO orgMsgFormDTO1 = new IcResiUserOrgMsgFormDTO(); + orgMsgFormDTO1.setCustomerId(resiUserDTO.getCustomerId()); + orgMsgFormDTO1.setAgencyId(resiUserDTO.getAgencyId()); + orgMsgFormDTO1.setGridId(resiUserDTO.getGridId()); + orgMsgFormDTO1.setNeighborHoodId(resiUserDTO.getVillageId()); + orgMsgFormDTO1.setBuildingId(resiUserDTO.getBuildId()); + orgMsgFormDTO1.setBuildingUnitId(resiUserDTO.getUnitId()); + orgMsgFormDTO1.setHouseId(resiUserDTO.getHomeId()); + Result result1 = govOrgOpenFeignClient.icResiUserOrgMsg(orgMsgFormDTO1); + if (!result1.success() || null == result1.getData().getAgencyDTO() || null == result1.getData().getGridDTO() || null == result1.getData().getNeighborHoodDTO() + || null == result1.getData().getBuildingDTO() || null == result1.getData().getBuildingUnitDTO() || null == result1.getData().getHouseDTO()) { + log.warn("查找被调动人调动前的组织、网格、小区、楼栋、单元、房屋信息失败"); + throw new RenException("9000", "获取被调动人基础信息失败"); + } + + //3.查询人员调动后的组织、网格、小区、楼栋、单元、房屋信息 + IcResiUserOrgMsgFormDTO orgMsgFormDTO2 = new IcResiUserOrgMsgFormDTO(); + orgMsgFormDTO2.setCustomerId(formDTO.getCustomerId()); + orgMsgFormDTO2.setAgencyId(formDTO.getNewAgencyId()); + orgMsgFormDTO2.setGridId(formDTO.getNewGridId()); + orgMsgFormDTO2.setNeighborHoodId(formDTO.getNewNeighborHoodId()); + orgMsgFormDTO2.setBuildingId(formDTO.getNewBuildingId()); + orgMsgFormDTO2.setBuildingUnitId(formDTO.getNewBuildingUnitId()); + orgMsgFormDTO2.setHouseId(formDTO.getNewHouseId()); + Result result2 = govOrgOpenFeignClient.icResiUserOrgMsg(orgMsgFormDTO2); + if (!result2.success() || null == result2.getData().getAgencyDTO() || null == result2.getData().getGridDTO() || null == result2.getData().getNeighborHoodDTO() + || null == result2.getData().getBuildingDTO() || null == result2.getData().getBuildingUnitDTO() || null == result2.getData().getHouseDTO()) { + log.warn("查找被调动人调动后的组织、网格、小区、楼栋、单元、房屋信息失败"); + throw new RenException("9000", "获取被调动人基础信息失败"); + } + + //4.修改被调动人所属各维度信息或人员状态信息 + IcResiUserEntity userEntity = new IcResiUserEntity(); + userEntity.setId(formDTO.getIcUserId()); + if ("out".equals(formDTO.getType())) { + //4-1.转到客户外修改基础信息表人员信息状态 + userEntity.setStatus("1"); + } else { + //4-2.客户内部流转修改所属各维度信息 + userEntity.setAgencyId(formDTO.getNewAgencyId()); + userEntity.setGridId(formDTO.getNewGridId()); + userEntity.setVillageId(formDTO.getNewNeighborHoodId()); + userEntity.setBuildId(formDTO.getNewBuildingId()); + userEntity.setUnitId(formDTO.getNewBuildingUnitId()); + userEntity.setHomeId(formDTO.getNewHouseId()); + } + icResiUserDao.updateById(userEntity); + + //5.生成调动记录 + CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + IcUserTransferRecordEntity recordEntity = saveTransferRecord(staffInfoCache, formDTO, resiUserDTO, result1.getData(), result2.getData()); + insert(recordEntity); + + //6.生成调动前后的变更记录、变更明细 + //6-1.变更记录 + IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity(); + changeRecordEntity.setIcUserTransferRecordId(recordEntity.getId()); + if ("in".equals(formDTO.getType())) { + changeRecordEntity.setCustomerId(resiUserDTO.getCustomerId()); + } + changeRecordEntity.setOperatorId(formDTO.getStaffId()); + changeRecordEntity.setIcUserId(formDTO.getIcUserId()); + changeRecordEntity.setOperatorName(staffInfoCache.getRealName()); + changeRecordEntity.setIcUserName(resiUserDTO.getName()); + changeRecordEntity.setType("transfer"); + changeRecordEntity.setTypeName("调动"); + StringBuffer beforeName = new StringBuffer(); + beforeName.append(result1.getData().getAgencyDTO().getOrganizationName()).append("-").append(result1.getData().getGridDTO().getGridName()).append("-") + .append(result1.getData().getNeighborHoodDTO().getNeighborHoodName()).append("-").append(result1.getData().getBuildingDTO().getBuildingName()).append("-") + .append(result1.getData().getBuildingUnitDTO().getUnitName()).append("-").append(result1.getData().getHouseDTO().getHouseName()); + changeRecordEntity.setBeforeChangeName(beforeName.toString()); + StringBuffer afterName = new StringBuffer(); + afterName.append(result2.getData().getAgencyDTO().getOrganizationName()).append("-").append(result2.getData().getGridDTO().getGridName()).append("-") + .append(result2.getData().getNeighborHoodDTO().getNeighborHoodName()).append("-").append(result2.getData().getBuildingDTO().getBuildingName()).append("-") + .append(result2.getData().getBuildingUnitDTO().getUnitName()).append("-").append(result2.getData().getHouseDTO().getHouseName()); + changeRecordEntity.setAfterChangeName(afterName.toString()); + changeRecordEntity.setChangeTime(formDTO.getTransferTime()); + changeRecordEntity.setRemark(formDTO.getRemark()); + icUserChangeRecordService.insert(changeRecordEntity); + //6-2.变更明细【类别明细迁出组织的-1,迁入组织的1】 + Result> resultList = operCustomizeOpenFeignClient.categoryWarnConfigList(formDTO.getCustomerId()); + if (!resultList.success()) { + throw new RuntimeException("人员调动,获取客户居民类别预警配置表数据失败"); + } + Map map = icResiUserDao.getCategoryListMap(formDTO.getIcUserId()); + List changeDetailedEntityList = saveChangeDetailed(resultList.getData(), map, changeRecordEntity.getId(), formDTO, resiUserDTO); + icUserChangeDetailedService.insertBatch(changeDetailedEntityList); + + } + + /** + * @Author sun + * @Description 调动记录 + **/ + private IcUserTransferRecordEntity saveTransferRecord(CustomerStaffInfoCacheResult staffInfoCache, IcResiUserTransferFormDTO formDTO, IcResiUserDTO resiUserDTO, IcResiUserOrgMsgResultDTO result1, IcResiUserOrgMsgResultDTO result2) { + IcUserTransferRecordEntity recordEntity = new IcUserTransferRecordEntity(); + recordEntity.setIcUserId(formDTO.getIcUserId()); + recordEntity.setOperatorId(formDTO.getStaffId()); + recordEntity.setIcUserName(resiUserDTO.getName()); + recordEntity.setOperatorName(null == staffInfoCache ? "" : staffInfoCache.getRealName()); + recordEntity.setOldCustomerId(formDTO.getCustomerId()); + if ("in".equals(formDTO.getType())) { + recordEntity.setNewCustomerId(resiUserDTO.getCustomerId()); + } + recordEntity.setOldAgencyId(resiUserDTO.getAgencyId()); + recordEntity.setNewAgencyId(formDTO.getNewAgencyId()); + recordEntity.setOldAgencyName(result1.getAgencyDTO().getOrganizationName()); + recordEntity.setNewAgencyName(result2.getAgencyDTO().getOrganizationName()); + recordEntity.setOldGridId(resiUserDTO.getGridId()); + recordEntity.setNewGridId(formDTO.getNewGridId()); + recordEntity.setOldGridName(result1.getGridDTO().getGridName()); + recordEntity.setNewGridName(result2.getGridDTO().getGridName()); + recordEntity.setOldNeighborHoodId(resiUserDTO.getVillageId()); + recordEntity.setNewNeighborHoodId(formDTO.getNewNeighborHoodId()); + recordEntity.setOldNeighborHoodName(result1.getNeighborHoodDTO().getNeighborHoodName()); + recordEntity.setNewNeighborHoodName(result2.getNeighborHoodDTO().getNeighborHoodName()); + recordEntity.setOldBuildingId(resiUserDTO.getBuildId()); + recordEntity.setNewBuildingId(formDTO.getNewBuildingId()); + recordEntity.setOldBuildingName(result1.getBuildingDTO().getBuildingName()); + recordEntity.setNewBuildingName(result2.getBuildingDTO().getBuildingName()); + recordEntity.setOldBuildingUnitId(resiUserDTO.getUnitId()); + recordEntity.setNewBuildingUnitId(formDTO.getNewBuildingUnitId()); + recordEntity.setOldBuildingUnitName(result1.getBuildingUnitDTO().getUnitName()); + recordEntity.setNewBuildingUnitName(result2.getBuildingUnitDTO().getUnitName()); + recordEntity.setOldHouseId(resiUserDTO.getHomeId()); + recordEntity.setNewHouseId(formDTO.getNewHouseId()); + recordEntity.setOldHouseName(result1.getHouseDTO().getHouseName()); + recordEntity.setNewHouseName(result2.getHouseDTO().getHouseName()); + recordEntity.setTransferTime(formDTO.getTransferTime()); + recordEntity.setRemark(formDTO.getRemark()); + return recordEntity; + } + /** + * @Author sun + * @Description 变更明细 + **/ + private List saveChangeDetailed(List configList, Map map, String icUserChangeRecordId, IcResiUserTransferFormDTO formDTO, IcResiUserDTO resiUserDTO) { + List list = new ArrayList<>(); + IcUserChangeDetailedEntity outEntity = null; + IcUserChangeDetailedEntity inEntity = null; + for (IcResiCategoryWarnConfigDTO cf : configList) { + if ("1".equals(map.get(cf.getColumnName()))) { + //迁出 + outEntity = new IcUserChangeDetailedEntity(); + outEntity.setCustomerId(formDTO.getCustomerId()); + outEntity.setIcUserChangeRecordId(icUserChangeRecordId); + outEntity.setAgencyId(resiUserDTO.getAgencyId()); + outEntity.setGridId(resiUserDTO.getGridId()); + outEntity.setNeighborHoodId(resiUserDTO.getVillageId()); + outEntity.setBuildingId(resiUserDTO.getBuildId()); + outEntity.setBuildingUnitId(resiUserDTO.getUnitId()); + outEntity.setHouseId(resiUserDTO.getHomeId()); + outEntity.setIcUserId(formDTO.getIcUserId()); + outEntity.setType("out"); + outEntity.setTypeName("迁出"); + outEntity.setFieldName(cf.getColumnName()); + outEntity.setValue(-1); + list.add(outEntity); + //迁入 + if ("in".equals(formDTO.getType())) { + inEntity = new IcUserChangeDetailedEntity(); + inEntity.setCustomerId(formDTO.getCustomerId()); + inEntity.setIcUserChangeRecordId(icUserChangeRecordId); + inEntity.setAgencyId(formDTO.getNewAgencyId()); + inEntity.setGridId(formDTO.getNewGridId()); + inEntity.setNeighborHoodId(formDTO.getNewNeighborHoodId()); + inEntity.setBuildingId(formDTO.getNewBuildingId()); + inEntity.setBuildingUnitId(formDTO.getNewBuildingUnitId()); + inEntity.setHouseId(formDTO.getNewHouseId()); + inEntity.setIcUserId(formDTO.getIcUserId()); + inEntity.setType("in"); + inEntity.setTypeName("迁入"); + inEntity.setFieldName(cf.getColumnName()); + inEntity.setValue(1); + list.add(inEntity); + } + } + } + return list; + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index 9d07548103..ba5276177a 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -513,4 +513,32 @@ #{userId} + + +