|
|
@ -18,7 +18,6 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.enums.IcResiUserSubStatusEnum; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
@ -29,6 +28,7 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
|
import com.epmet.constant.IcResiUserConstant; |
|
|
|
import com.epmet.dao.IcResiUserDao; |
|
|
|
import com.epmet.dao.IcUserTransferRecordDao; |
|
|
|
import com.epmet.dto.IcResiCategoryStatsConfigDTO; |
|
|
@ -171,7 +171,7 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans |
|
|
|
} |
|
|
|
List<String> columns = categoryListResult.getData().stream().map(IcResiCategoryStatsConfigDTO::getColumnName).collect(Collectors.toList()); |
|
|
|
Map<String, String> map = icResiUserDao.getCategoryListMap(columns, formDTO.getIcUserId()); |
|
|
|
List<IcUserChangeDetailedEntity> changeDetailedEntityList = saveChangeDetailed(categoryListResult.getData(), map, changeRecordEntity.getId(), formDTO, resiUserDTO, NumConstant.ONE_STR); |
|
|
|
List<IcUserChangeDetailedEntity> changeDetailedEntityList = saveChangeDetailed(categoryListResult.getData(), map, changeRecordEntity.getId(), formDTO, resiUserDTO, IcResiUserConstant.CHANGE); |
|
|
|
icUserChangeDetailedService.insertBatch(changeDetailedEntityList); |
|
|
|
|
|
|
|
} |
|
|
@ -222,6 +222,7 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans |
|
|
|
|
|
|
|
/** |
|
|
|
* @param origin 1:变动;2:迁出;3:死亡 |
|
|
|
* @param origin:变动:change; 迁出:out; 死亡:died; 出生birth; 迁入:in |
|
|
|
* @Author sun |
|
|
|
* @Description 变更明细 |
|
|
|
**/ |
|
|
@ -239,15 +240,19 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans |
|
|
|
throw new EpmetException(String.format("查询组织信息失败%s", resiUserDTO.getAgencyId())); |
|
|
|
} |
|
|
|
AgencyInfoCache newAgencyInfo = new AgencyInfoCache(); |
|
|
|
if (IcResiUserConstant.CHANGE.equals(origin) || IcResiUserConstant.OUT.equals(origin)) { |
|
|
|
//变动和迁出才会校验新组织
|
|
|
|
if ("in".equals(formDTO.getType())) { |
|
|
|
newAgencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getNewAgencyId()); |
|
|
|
if (null == newAgencyInfo) { |
|
|
|
throw new EpmetException(String.format("查询组织信息失败%s", formDTO.getNewAgencyId())); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
for (IcResiCategoryStatsConfigDTO cf : configList) { |
|
|
|
if ("1".equals(map.get(cf.getColumnName()))) { |
|
|
|
//迁出
|
|
|
|
if (IcResiUserConstant.CHANGE.equals(origin) || IcResiUserConstant.OUT.equals(origin) || IcResiUserConstant.DIED.equals(origin)) { |
|
|
|
outEntity = new IcUserChangeDetailedEntity(); |
|
|
|
outEntity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
outEntity.setIcUserChangeRecordId(icUserChangeRecordId); |
|
|
@ -259,18 +264,37 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans |
|
|
|
outEntity.setBuildingUnitId(resiUserDTO.getUnitId()); |
|
|
|
outEntity.setHouseId(resiUserDTO.getHomeId()); |
|
|
|
outEntity.setIcUserId(formDTO.getIcUserId()); |
|
|
|
if (NumConstant.ONE_STR.equals(origin) || NumConstant.TWO_STR.equals(origin)) { |
|
|
|
if (IcResiUserConstant.CHANGE.equals(origin) || IcResiUserConstant.OUT.equals(origin)) { |
|
|
|
outEntity.setType("out"); |
|
|
|
outEntity.setTypeName("迁出"); |
|
|
|
}else if( NumConstant.THREE_STR.equals(origin)){ |
|
|
|
} else if (IcResiUserConstant.DIED.equals(origin)) { |
|
|
|
outEntity.setType("die"); |
|
|
|
outEntity.setTypeName("死亡"); |
|
|
|
} |
|
|
|
outEntity.setFieldName(cf.getColumnName()); |
|
|
|
outEntity.setValue(-1); |
|
|
|
list.add(outEntity); |
|
|
|
} |
|
|
|
//原来的变动,并且是迁入到同客户内走下面的流程
|
|
|
|
if ("in".equals(formDTO.getType()) && NumConstant.ONE_STR.equals(origin)) { |
|
|
|
if ("in".equals(formDTO.getType()) && IcResiUserConstant.CHANGE.equals(origin)) { |
|
|
|
inEntity = new IcUserChangeDetailedEntity(); |
|
|
|
inEntity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
inEntity.setIcUserChangeRecordId(icUserChangeRecordId); |
|
|
|
inEntity.setPids(newAgencyInfo.getPids()); |
|
|
|
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); |
|
|
|
}else if(IcResiUserConstant.IN.equals(origin)||IcResiUserConstant.BIRTH.equals(origin)){ |
|
|
|
// 迁入和出生的
|
|
|
|
inEntity = new IcUserChangeDetailedEntity(); |
|
|
|
inEntity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
inEntity.setIcUserChangeRecordId(icUserChangeRecordId); |
|
|
@ -282,6 +306,7 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans |
|
|
|
inEntity.setBuildingUnitId(formDTO.getNewBuildingUnitId()); |
|
|
|
inEntity.setHouseId(formDTO.getNewHouseId()); |
|
|
|
inEntity.setIcUserId(formDTO.getIcUserId()); |
|
|
|
//出生和迁入 =》迁入
|
|
|
|
inEntity.setType("in"); |
|
|
|
inEntity.setTypeName("迁入"); |
|
|
|
inEntity.setFieldName(cf.getColumnName()); |
|
|
@ -307,13 +332,13 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans |
|
|
|
IcResiUserDTO resiUserDTO = getIcResiUserDTO(formDTO.getCustomerId(), formDTO.getIcUserId()); |
|
|
|
//2.查询人员调动前的组织、网格、小区、楼栋、单元、房屋信息
|
|
|
|
IcResiUserOrgMsgResultDTO icResiUserOrgMsgResultDTO = getIcResiUserOrgMsgResultDTO(resiUserDTO); |
|
|
|
//3.查询人员调动后的组织、网格、小区、楼栋、单元、房屋信息;
|
|
|
|
//3.查询人员调动后的组织、网格、小区、楼栋、单元、房屋信息;(只有moveType=out迁出时result2才有值)
|
|
|
|
Result<IcResiUserOrgMsgResultDTO> result2 = getNewHouseInfo(formDTO); |
|
|
|
|
|
|
|
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); |
|
|
|
IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity(); |
|
|
|
//5.生成调动记录: 只有迁出的才生成
|
|
|
|
if("out".equals(formDTO.getMoveType())){ |
|
|
|
if(IcResiUserConstant.OUT.equals(formDTO.getOrigin())){ |
|
|
|
IcUserTransferRecordEntity recordEntity = saveTransferRecord(staffInfoCache, formDTO, resiUserDTO, icResiUserOrgMsgResultDTO, result2.getData()); |
|
|
|
insert(recordEntity); |
|
|
|
changeRecordEntity.setIcUserTransferRecordId(recordEntity.getId()); |
|
|
@ -327,13 +352,19 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans |
|
|
|
changeRecordEntity.setOperatorName(staffInfoCache.getRealName()); |
|
|
|
changeRecordEntity.setIcUserName(resiUserDTO.getName()); |
|
|
|
//迁出存调动,死亡存注销
|
|
|
|
if ("out".equals(formDTO.getMoveType())) { |
|
|
|
if (IcResiUserConstant.OUT.equals(formDTO.getOrigin())) { |
|
|
|
changeRecordEntity.setType("transfer"); |
|
|
|
changeRecordEntity.setTypeName("调动"); |
|
|
|
} else if ("died".equals(formDTO.getMoveType())) { |
|
|
|
} else if (IcResiUserConstant.DIED.equals(formDTO.getOrigin())) { |
|
|
|
changeRecordEntity.setType("logout"); |
|
|
|
changeRecordEntity.setTypeName("注销"); |
|
|
|
} else if (IcResiUserConstant.IN.equals(formDTO.getOrigin()) || IcResiUserConstant.BIRTH.equals(formDTO.getOrigin())) { |
|
|
|
//迁入和出生都是新增???
|
|
|
|
changeRecordEntity.setType("add"); |
|
|
|
changeRecordEntity.setTypeName("新增"); |
|
|
|
} |
|
|
|
//只有迁出才会赋值变更前,变更后这两句话
|
|
|
|
if (IcResiUserConstant.OUT.equals(formDTO.getOrigin())) { |
|
|
|
StringBuffer beforeName = new StringBuffer(); |
|
|
|
beforeName.append(icResiUserOrgMsgResultDTO.getAgencyDTO().getOrganizationName()).append("-").append(icResiUserOrgMsgResultDTO.getGridDTO().getGridName()).append("-") |
|
|
|
.append(icResiUserOrgMsgResultDTO.getNeighborHoodDTO().getNeighborHoodName()).append("-").append(icResiUserOrgMsgResultDTO.getBuildingDTO().getBuildingName()).append("-") |
|
|
@ -346,6 +377,8 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans |
|
|
|
.append(result2.getData().getBuildingUnitDTO().getUnitName()).append("-").append(result2.getData().getHouseDTO().getHouseName()); |
|
|
|
} |
|
|
|
changeRecordEntity.setAfterChangeName(StringUtils.isEmpty(afterName.toString()) ? "-" : afterName.toString()); |
|
|
|
} |
|
|
|
|
|
|
|
changeRecordEntity.setChangeTime(formDTO.getTransferTime()); |
|
|
|
changeRecordEntity.setReason(formDTO.getReason()); |
|
|
|
changeRecordEntity.setRemark(formDTO.getRemark()); |
|
|
@ -359,7 +392,7 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans |
|
|
|
} |
|
|
|
List<String> columns = categoryListResult.getData().stream().map(IcResiCategoryStatsConfigDTO::getColumnName).collect(Collectors.toList()); |
|
|
|
Map<String, String> map = icResiUserDao.getCategoryListMap(columns, formDTO.getIcUserId()); |
|
|
|
List<IcUserChangeDetailedEntity> changeDetailedEntityList = saveChangeDetailed(categoryListResult.getData(), map, changeRecordEntity.getId(), formDTO, resiUserDTO, NumConstant.TWO_STR); |
|
|
|
List<IcUserChangeDetailedEntity> changeDetailedEntityList = saveChangeDetailed(categoryListResult.getData(), map, changeRecordEntity.getId(), formDTO, resiUserDTO, formDTO.getOrigin()); |
|
|
|
icUserChangeDetailedService.insertBatch(changeDetailedEntityList); |
|
|
|
} |
|
|
|
|
|
|
@ -408,7 +441,7 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans |
|
|
|
*/ |
|
|
|
private Result<IcResiUserOrgMsgResultDTO> getNewHouseInfo(IcResiUserTransferFormDTO formDTO) { |
|
|
|
Result<IcResiUserOrgMsgResultDTO> result2 = new Result<>(); |
|
|
|
if ("out".equals(formDTO.getMoveType())) { |
|
|
|
if (IcResiUserConstant.OUT.equals(formDTO.getOrigin())) { |
|
|
|
IcResiUserOrgMsgFormDTO orgMsgFormDTO2 = new IcResiUserOrgMsgFormDTO(); |
|
|
|
orgMsgFormDTO2.setCustomerId(formDTO.getCustomerId()); |
|
|
|
orgMsgFormDTO2.setAgencyId(formDTO.getNewAgencyId()); |
|
|
|