Browse Source

人员调动

dev
sunyuchao 4 years ago
parent
commit
2632dd99ca
  1. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/IcResiUserEntity.java
  2. 7
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  3. 12
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  4. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  5. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  6. 32
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  7. 7
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java
  8. 5
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java
  9. 9
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcResiCategoryWarnConfigController.java
  10. 6
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcResiCategoryWarnConfigService.java
  11. 14
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcResiCategoryWarnConfigServiceImpl.java
  12. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcResiUserDTO.java
  13. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcUserChangeDetailedDTO.java
  14. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcUserChangeRecordDTO.java
  15. 23
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcUserTransferRecordController.java
  16. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  17. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java
  18. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcUserChangeDetailedEntity.java
  19. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcUserChangeRecordEntity.java
  20. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserTransferRecordService.java
  21. 229
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java
  22. 28
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

5
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
*/

7
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<IcResiUserOrgMsgResultDTO> icResiUserOrgMsg(@RequestBody IcResiUserOrgMsgFormDTO formDTO);
}

12
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<IcResiUserOrgMsgResultDTO> icResiUserOrgMsg(IcResiUserOrgMsgFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "icResiUserOrgMsg", formDTO);
}
}

10
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<IcResiUserOrgMsgResultDTO> icResiUserOrgMsg(@RequestBody IcResiUserOrgMsgFormDTO formDTO) {
return new Result<IcResiUserOrgMsgResultDTO>().ok(customerAgencyService.icResiUserOrgMsg(formDTO));
}
}

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -276,4 +276,11 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
* @return
*/
void configCustomerAreaCode(CustomerAreaCodeFormDTO formDTO);
/**
* @Author sun
* @Description 查询组织网格小区楼栋单元房屋信息
**/
IcResiUserOrgMsgResultDTO icResiUserOrgMsg(IcResiUserOrgMsgFormDTO formDTO);
}

32
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<CustomerAgencyDao
private CustomerOrgParameterDao customerOrgParameterDao;
@Autowired
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient;
@Autowired
private IcNeighborHoodDao icNeighborHoodDao;
@Autowired
private IcBuildingDao icBuildingDao;
@Autowired
private IcBuildingUnitDao icBuildingUnitDao;
@Autowired
private IcHouseDao icHouseDao;
@Override
@ -1369,4 +1377,28 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
}
return newAreaCode;
}
/**
* @Author sun
* @Description 查询组织网格小区楼栋单元房屋信息
**/
@Override
public IcResiUserOrgMsgResultDTO icResiUserOrgMsg(IcResiUserOrgMsgFormDTO formDTO) {
IcResiUserOrgMsgResultDTO resultDTO = new IcResiUserOrgMsgResultDTO();
CustomerAgencyDTO agencyDTO = ConvertUtils.sourceToTarget(baseDao.selectById(formDTO.getAgencyId()), CustomerAgencyDTO.class);
CustomerGridDTO gridDTO = ConvertUtils.sourceToTarget(customerGridDao.selectById(formDTO.getGridId()), CustomerGridDTO.class);
IcNeighborHoodDTO neighborHoodDTO = ConvertUtils.sourceToTarget(icNeighborHoodDao.selectById(formDTO.getGridId()), IcNeighborHoodDTO.class);
IcBuildingDTO buildingDTO = ConvertUtils.sourceToTarget(icBuildingDao.selectById(formDTO.getGridId()), IcBuildingDTO.class);
IcBuildingUnitDTO buildingUnitDTO = ConvertUtils.sourceToTarget(icBuildingUnitDao.selectById(formDTO.getGridId()), IcBuildingUnitDTO.class);
IcHouseDTO houseDTO = ConvertUtils.sourceToTarget(icHouseDao.selectById(formDTO.getGridId()), IcHouseDTO.class);
resultDTO.setAgencyDTO(agencyDTO);
resultDTO.setGridDTO(gridDTO);
resultDTO.setNeighborHoodDTO(neighborHoodDTO);
resultDTO.setBuildingDTO(buildingDTO);
resultDTO.setBuildingUnitDTO(buildingUnitDTO);
resultDTO.setHouseDTO(houseDTO);
return resultDTO;
}
}

7
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java

@ -129,4 +129,11 @@ public interface OperCustomizeOpenFeignClient {
@PostMapping("/oper/customize/icformitemoptions/list-by-item-conditions")
Result<List<IcFormItemOptionsDTO>> listOptionsByItemConditions(@RequestBody IcFormOptionsQueryFormDTO input);
/**
* @author sun
* @Description 获取客户居民类别预警配置表数据
*/
@PostMapping("/oper/customize/icresicategorywarnconfig/categorywarnconfiglist/{customerId}")
Result<List<IcResiCategoryWarnConfigDTO>> categoryWarnConfigList(@PathVariable String customerId);
}

5
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<List<IcFormItemOptionsDTO>> listOptionsByItemConditions(IcFormOptionsQueryFormDTO input) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "listOptionsByItemConditions", input);
}
@Override
public Result<List<IcResiCategoryWarnConfigDTO>> categoryWarnConfigList(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "categoryWarnConfigList", customerId);
}
}

9
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<List<IcResiCategoryWarnConfigDTO>> categoryWarnConfigList(@PathVariable String customerId) {
return new Result<List<IcResiCategoryWarnConfigDTO>>().ok(icResiCategoryWarnConfigService.categoryWarnConfigList(customerId));
}
}

6
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcResiCategoryWarnConfigService.java

@ -92,4 +92,10 @@ public interface IcResiCategoryWarnConfigService extends BaseService<IcResiCateg
* @date 2021-11-04
*/
void delete(String[] ids);
/**
* @author sun
* @Description 获取客户居民类别预警配置表数据
*/
List<IcResiCategoryWarnConfigDTO> categoryWarnConfigList(String customerId);
}

14
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<IcResiC
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @author sun
* @Description 获取客户居民类别预警配置表数据
*/
@Override
public List<IcResiCategoryWarnConfigDTO> categoryWarnConfigList(String customerId) {
LambdaQueryWrapper<IcResiCategoryWarnConfigEntity> wrapperWarn = new LambdaQueryWrapper<>();
wrapperWarn.eq(IcResiCategoryWarnConfigEntity::getCustomerId, customerId);
wrapperWarn.orderByAsc(IcResiCategoryWarnConfigEntity::getSort);
List<IcResiCategoryWarnConfigEntity> entityList = baseDao.selectList(wrapperWarn);
return ConvertUtils.sourceToTarget(entityList, IcResiCategoryWarnConfigDTO.class);
}
}

5
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.已删除
*/

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

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

23
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();
}
}

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

@ -229,4 +229,6 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
@Param("code") String code);
List<VolunteerDistributionResultDTO.Distribution> listIcResiInfosByUserIds(@Param("userIds") List<String> userIds);
Map<String, String> getCategoryListMap(@Param("icUserId") String icUserId);
}

5
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
*/

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

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

7
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<IcUserTransferRecordEntity> {
/**
* @Author sun
* @Description 基础信息人员调动
**/
void add(IcResiUserTransferFormDTO formDTO);
}

229
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<IcUserTransferRecordDao, IcUserTransferRecordEntity> 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<IcResiUserOrgMsgResultDTO> 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<IcResiUserOrgMsgResultDTO> 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<List<IcResiCategoryWarnConfigDTO>> resultList = operCustomizeOpenFeignClient.categoryWarnConfigList(formDTO.getCustomerId());
if (!resultList.success()) {
throw new RuntimeException("人员调动,获取客户居民类别预警配置表数据失败");
}
Map<String, String> map = icResiUserDao.getCategoryListMap(formDTO.getIcUserId());
List<IcUserChangeDetailedEntity> 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<IcUserChangeDetailedEntity> saveChangeDetailed(List<IcResiCategoryWarnConfigDTO> configList, Map<String, String> map, String icUserChangeRecordId, IcResiUserTransferFormDTO formDTO, IcResiUserDTO resiUserDTO) {
List<IcUserChangeDetailedEntity> 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;
}
}

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

@ -513,4 +513,32 @@
#{userId}
</foreach>
</select>
<select id="getCategoryListMap" resultType="java.util.Map">
SELECT
IFNULL(is_kc,'0') IS_KC,
IFNULL(is_cj,'0') IS_CJ,
IFNULL(is_ylfn,'0') IS_YLFN,
IFNULL(is_sn,'0') IS_SN,
IFNULL(is_special,'0') IS_SPECIAL,
IFNULL(is_volunteer,'0') IS_VOLUNTEER,
IFNULL(is_unemployed,'0') IS_UNEMPLOYED,
IFNULL(is_mb,'0') IS_MB,
IFNULL(is_sz,'0') IS_SZ,
IFNULL(is_sd,'0') IS_SD,
IFNULL(is_veterans,'0') IS_VETERANS,
IFNULL(is_ensure_house,'0') IS_ENSURE_HOUSE,
IFNULL(is_party,'0') IS_PARTY,
IFNULL(is_old_people,'0') IS_OLD_PEOPLE,
IFNULL(is_xfry,'0')IS_XFRY,
IFNULL(is_united_front,'0') IS_UNITED_FRONT,
IFNULL(is_db,'0') IS_DB,
IFNULL(is_dbh,'0') IS_DBH
FROM
ic_resi_user
WHERE
del_flag = '0'
AND id = #{icUserId}
</select>
</mapper>

Loading…
Cancel
Save