|
|
@ -5,7 +5,6 @@ import cn.afterturn.easypoi.excel.annotation.Excel; |
|
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams; |
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
import com.alibaba.excel.EasyExcelFactory; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.epmet.bean.ResiImportCategoryData; |
|
|
|
import com.epmet.bean.ResiImportResiCategoryChangedCache; |
|
|
|
import com.epmet.bean.ResiImportChangedData; |
|
|
@ -420,7 +419,12 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
try { |
|
|
|
convertColumnWrappers2Map4Persist(itemIdAndColumnWrapper, row, currUserAgencyId, checkBoxOptionColumnIdxAndLabel, columnAndValues, true); |
|
|
|
|
|
|
|
// 因为还没有读取子sheet,所以这些居民类别没有办法获取,先默认设置成0,后面读取子sheet的时候再更新
|
|
|
|
String idCard = columnAndValues.get("ID_CARD"); |
|
|
|
|
|
|
|
Map<String, String> existingResiMap = icResiUserDao.selectResiInfoMap(idCard); |
|
|
|
|
|
|
|
if (existingResiMap == null) { |
|
|
|
// 新导入的居民,因为还没有读取子sheet,所以这些居民类别没有办法获取,先默认设置成0,后面读取子sheet的时候再更新
|
|
|
|
columnAndValues.put("IS_ENSURE_HOUSE", "0"); |
|
|
|
columnAndValues.put("IS_OLD_PEOPLE", "0"); |
|
|
|
columnAndValues.put("IS_PARTY", "0"); |
|
|
@ -429,6 +433,17 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
columnAndValues.put("IS_UNITED_FRONT", "0"); |
|
|
|
columnAndValues.put("IS_VETERANS", "0"); |
|
|
|
columnAndValues.put("IS_VOLUNTEER", "0"); |
|
|
|
} else { |
|
|
|
// 该居民已存在,要做更新操作,因为还没有读取子sheet,所以这些居民最新类别没有办法获取,先设置上旧的数据
|
|
|
|
columnAndValues.put("IS_ENSURE_HOUSE", existingResiMap.get("IS_ENSURE_HOUSE")); |
|
|
|
columnAndValues.put("IS_OLD_PEOPLE", existingResiMap.get("IS_OLD_PEOPLE")); |
|
|
|
columnAndValues.put("IS_PARTY", existingResiMap.get("IS_PARTY")); |
|
|
|
columnAndValues.put("IS_SPECIAL", existingResiMap.get("IS_SPECIAL")); |
|
|
|
columnAndValues.put("IS_UNEMPLOYED", existingResiMap.get("IS_UNEMPLOYED")); |
|
|
|
columnAndValues.put("IS_UNITED_FRONT", existingResiMap.get("IS_UNITED_FRONT")); |
|
|
|
columnAndValues.put("IS_VETERANS", existingResiMap.get("IS_VETERANS")); |
|
|
|
columnAndValues.put("IS_VOLUNTEER", existingResiMap.get("IS_VOLUNTEER")); |
|
|
|
} |
|
|
|
|
|
|
|
columnAndValues.put("AGENCY_ID", currUserAgencyId); |
|
|
|
columnAndValues.put("PIDS", currUserAgencyPids); |
|
|
@ -436,14 +451,6 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
|
|
|
|
columnAndValues.put("UPDATED_BY", currentUserId); |
|
|
|
|
|
|
|
// 验证居民信息是否存在
|
|
|
|
String idCard = columnAndValues.get("ID_CARD"); |
|
|
|
LambdaQueryWrapper<IcResiUserEntity> idCardQuery = new LambdaQueryWrapper<>(); |
|
|
|
idCardQuery.eq(IcResiUserEntity::getIdCard, idCard); |
|
|
|
//IcResiUserEntity resiBaseInfo = icResiUserDao.selectOne(idCardQuery);
|
|
|
|
|
|
|
|
Map<String, String> existingResiMap = icResiUserDao.selectResiInfoMap(idCard); |
|
|
|
|
|
|
|
if (existingResiMap != null) { |
|
|
|
// 修改居民信息
|
|
|
|
icResiUserDao.upTable(tableName, existingResiMap.get("ID"), columnAndValues); |
|
|
@ -533,15 +540,13 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
} |
|
|
|
|
|
|
|
// 检查用户是否存在
|
|
|
|
LambdaQueryWrapper<IcResiUserEntity> idCardQuery = new LambdaQueryWrapper<>(); |
|
|
|
idCardQuery.eq(IcResiUserEntity::getIdCard, idCard); |
|
|
|
Map<String, String> resiInfoMap = icResiUserDao.selectResiInfoMap(idCard); |
|
|
|
|
|
|
|
IcResiUserEntity icResiUserBaseInfo = icResiUserDao.selectOne(idCardQuery); |
|
|
|
if (icResiUserBaseInfo == null) { |
|
|
|
if (resiInfoMap == null || resiInfoMap.size() == 0) { |
|
|
|
throw new RenException(EpmetErrorCode.RESI_NOT_FOUND.getCode(), String.format("身份证号为【%s】的居民信息未找到,请确认该居民信息存在", idCard)); |
|
|
|
} |
|
|
|
|
|
|
|
String icResiId = icResiUserBaseInfo.getId(); |
|
|
|
String icResiId = resiInfoMap.get("ID"); |
|
|
|
|
|
|
|
columnAndValues.put("IC_RESI_USER", icResiId); |
|
|
|
columnAndValues.put("CUSTOMER_ID", loginUserUtil.getLoginUserCustomerId()); |
|
|
@ -567,7 +572,9 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
} |
|
|
|
|
|
|
|
// 保存到类别变更缓存中
|
|
|
|
saveSubTableInfoToCategoryChangedResiCache(icResiId, Objects.requireNonNull(IcResiUserTableEnum.getObjectByTableName(targetTableName)).getMainTableFlagColumnName()); |
|
|
|
saveSubTableInfoToCategoryChangedResiCache(icResiId, |
|
|
|
Objects.requireNonNull(IcResiUserTableEnum.getObjectByTableName(targetTableName)).getMainTableFlagColumnName(), |
|
|
|
resiInfoMap); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
String errorMsg; |
|
|
@ -1042,7 +1049,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
|
|
|
|
/** |
|
|
|
* 生成导入调动数据 |
|
|
|
* 1.新老数据中,只要状态是1的,都放入缓存 |
|
|
|
* 1.新老数据中,0/1都存入 |
|
|
|
* @param existingResiMap |
|
|
|
* @param newResiMap |
|
|
|
* @return |
|
|
@ -1067,13 +1074,22 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
String oldCategoryValue = existingResiMap.get(categoryColumnName); |
|
|
|
String newCategoryValue = newResiMap.get(categoryColumnName); |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(oldCategoryValue) && "1".equals(oldCategoryValue)) { |
|
|
|
if (StringUtils.isBlank(oldCategoryValue)) oldCategoryValue = "0"; |
|
|
|
if (StringUtils.isBlank(newCategoryValue)) newCategoryValue = "0"; |
|
|
|
|
|
|
|
if ("1".equals(oldCategoryValue) || "1".equals(newCategoryValue)) { |
|
|
|
// 新旧值有一个为1,则放入
|
|
|
|
existingResiCategories.put(categoryColumnName, oldCategoryValue); |
|
|
|
newResiCategories.put(categoryColumnName, newCategoryValue); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(newCategoryValue) && "1".equals(newCategoryValue)) { |
|
|
|
newResiCategories.put(categoryColumnName, newResiMap.get(categoryColumnName)); |
|
|
|
} |
|
|
|
// if ("1".equals(oldCategoryValue)) {
|
|
|
|
// existingResiCategories.put(categoryColumnName, oldCategoryValue);
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// if ("1".equals(newCategoryValue)) {
|
|
|
|
// newResiCategories.put(categoryColumnName, newCategoryValue);
|
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
ResiImportCategoryData oldOne = new ResiImportCategoryData( |
|
|
@ -1098,7 +1114,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 类别变更的居民信息封装 |
|
|
|
* 类别变更的居民信息封装。只要发生变化,0或者1都要保存 |
|
|
|
* 1. |
|
|
|
* @param existingResiMap |
|
|
|
* @param newResiMap |
|
|
@ -1111,13 +1127,10 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
|
|
|
|
Set<String> categoryColumnNames = resiCategoryColumnNameAndLabel.get().keySet(); |
|
|
|
for (String categoryColumnName : categoryColumnNames) { |
|
|
|
|
|
|
|
String existingColumnValue = existingResiMap.get(categoryColumnName); |
|
|
|
String newColumnValue = newResiMap.get(categoryColumnName); |
|
|
|
|
|
|
|
if (StringUtils.isAllBlank(existingColumnValue, newColumnValue)) { |
|
|
|
// 都为空,则没发生变化
|
|
|
|
continue; |
|
|
|
} else { |
|
|
|
// 先转为0再对比
|
|
|
|
if (StringUtils.isBlank(existingColumnValue)) existingColumnValue = "0"; |
|
|
|
if (StringUtils.isBlank(newColumnValue)) newColumnValue = "0"; |
|
|
@ -1126,7 +1139,13 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
oldCategories.put(categoryColumnName, existingColumnValue); |
|
|
|
newCategories.put(categoryColumnName, newColumnValue); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// if (StringUtils.isAllBlank(existingColumnValue, newColumnValue)) {
|
|
|
|
// // 都为空,则没发生变化
|
|
|
|
// continue;
|
|
|
|
// } else {
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
if (oldCategories.size() == 0) { |
|
|
@ -1158,7 +1177,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
* @param icResiId 居民id |
|
|
|
* @param columnName 该项信息在主表的列名 |
|
|
|
*/ |
|
|
|
private void saveSubTableInfoToCategoryChangedResiCache(String icResiId, String columnName) { |
|
|
|
private void saveSubTableInfoToCategoryChangedResiCache(String icResiId, String columnName, Map<String, String> resiInfoMap) { |
|
|
|
|
|
|
|
ResiImportResiCategoryChangedCache cc = newlyOrChangedResi.get(); |
|
|
|
Map<String, ResiImportCategoryData> newResis = cc.getNewResis(); |
|
|
@ -1178,26 +1197,27 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
Map<String, String> oldCategories = categoryChangedData.getOldData().getCategories(); |
|
|
|
Map<String, String> newCategories = categoryChangedData.getNewData().getCategories(); |
|
|
|
|
|
|
|
if (!oldCategories.containsKey(columnName)) { |
|
|
|
// 没有这个类别,说明旧数据中是0,新数据中也是0,新数据改成1
|
|
|
|
if ("0".equals(resiInfoMap.get(columnName))) { |
|
|
|
oldCategories.put(columnName, "0"); |
|
|
|
newCategories.put(columnName, "1"); |
|
|
|
} else { |
|
|
|
// 有这个类别,说明旧数据中是1,新数据中是0,新数据改成1,最后保存的时候,需要判断,新旧都是1,那么不创建变更记录
|
|
|
|
newCategories.put(columnName, "1"); |
|
|
|
} |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
ResiImportChangedData transferedData = transferedResis.get(icResiId); |
|
|
|
if (transferedData != null) { |
|
|
|
// 说明是发生调动的居民,旧数据不用管了,新数据改成1
|
|
|
|
// 说明是发生调动的居民,新数据值为1
|
|
|
|
Map<String, String> newCategories = transferedData.getNewData().getCategories(); |
|
|
|
Map<String, String> oldCategories = transferedData.getOldData().getCategories(); |
|
|
|
|
|
|
|
oldCategories.put(columnName, "0"); |
|
|
|
newCategories.put(columnName, "1"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 非新增,非调动,那么就是居民类别变更的,只不过变更的数据不在主sheet中,而在附sheet中
|
|
|
|
if ("0".equals(resiInfoMap.get(columnName))) { |
|
|
|
// 非新增,非调动,变更的数据不在主sheet中,而在附sheet中。看是否发生人员类型变更(从0->1)
|
|
|
|
ResiImportCategoryData oldOne = new ResiImportCategoryData(); |
|
|
|
ResiImportCategoryData newOne = new ResiImportCategoryData(); |
|
|
|
|
|
|
@ -1207,6 +1227,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
ResiImportChangedData cd = new ResiImportChangedData(oldOne, newOne); |
|
|
|
categoryChangedResis.put(icResiId, cd); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 居民类别变更record |
|
|
@ -1217,7 +1238,6 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
|
|
|
|
CustomerStaffInfoCacheResult operator = CustomerStaffRedis.getStaffInfo(loginUserUtil.getLoginUserCustomerId(), loginUserUtil.getLoginUserId()); |
|
|
|
|
|
|
|
// 循环当前居民的所有类别的map
|
|
|
|
for (Map.Entry<String, ResiImportChangedData> entry : categoryChangedResis.entrySet()) { |
|
|
|
String resiId = entry.getKey(); |
|
|
|
|
|
|
@ -1226,32 +1246,26 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
Map<String, String> oldCategories = oldData.getCategories(); |
|
|
|
Map<String, String> newCategories = newData.getCategories(); |
|
|
|
|
|
|
|
fillResiSubCategoryInfo4TransferAndCategoryChange(oldData, newData); |
|
|
|
|
|
|
|
StringBuilder sbBefore = new StringBuilder(""); |
|
|
|
StringBuilder sbAfter = new StringBuilder(""); |
|
|
|
|
|
|
|
//主表的语言描述
|
|
|
|
for (Map.Entry<String, String> newEntry : newCategories.entrySet()) { |
|
|
|
String columnName = newEntry.getKey(); |
|
|
|
String newColumnValue = newEntry.getValue(); |
|
|
|
String oldColumnValue = oldCategories.get(columnName); |
|
|
|
|
|
|
|
if (newColumnValue.equals(oldColumnValue)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
String beforeValueName = "0".equals(oldColumnValue) ? "否" : "是"; |
|
|
|
String newValueName = "0".equals(newColumnValue) ? "否" : "是"; |
|
|
|
generateCategoryChangeDesc(oldCategories, newCategories, sbBefore, sbAfter); |
|
|
|
|
|
|
|
String label = resiCategoryColumnNameAndLabel.get().get(columnName); |
|
|
|
String descBefore = sbBefore.toString(); |
|
|
|
String descAfter = sbAfter.toString(); |
|
|
|
|
|
|
|
sbBefore.append(label).append(":").append(beforeValueName).append("\n"); |
|
|
|
sbAfter.append(label).append(":").append(newValueName).append("\n"); |
|
|
|
// 没有任何变化,跳过该居民
|
|
|
|
if (StringUtils.isAllBlank(descBefore,descAfter)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
// 生成changeRecord并存入
|
|
|
|
IcResiUserEntity resiInfo = icResiUserDao.selectById(resiId); |
|
|
|
IcUserChangeRecordEntity changeRecord = fillChangeRecord(loginUserUtil.getLoginUserCustomerId(), resiId, resiInfo.getName(), null, loginUserUtil.getLoginUserId(), |
|
|
|
operator.getRealName() , sbBefore.toString(), sbAfter.toString(), "category", "类别", "", now); |
|
|
|
operator.getRealName() , descBefore, descAfter, "category", "类别", "", now); |
|
|
|
icUserChangeRecordDao.insert(changeRecord); |
|
|
|
|
|
|
|
for (Map.Entry<String, String> columnEntry : newCategories.entrySet()) { |
|
|
@ -1266,16 +1280,58 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
|
|
|
|
int value = newValue.equals("1") && oldValue.equals("0") ? 1 : -1; |
|
|
|
|
|
|
|
|
|
|
|
IcUserChangeDetailedEntity newDetail = fillChangeDetail(loginUserUtil.getLoginUserCustomerId(), resiId, changeRecord.getId(), newData.getAgencyId(), |
|
|
|
newData.getGridId(), newData.getVillageId(), newData.getBuildId(), newData.getUnitId(), |
|
|
|
newData.getHomeId(), "category", "类别", columnEntry.getKey(), value, resiInfo.getPids()); |
|
|
|
String agencyId = newData.getAgencyId(); |
|
|
|
String gridId = newData.getGridId(); |
|
|
|
String villageId = newData.getVillageId(); |
|
|
|
String buildId = newData.getBuildId(); |
|
|
|
String unitId = newData.getUnitId(); |
|
|
|
String homeId = newData.getHomeId(); |
|
|
|
|
|
|
|
// 如果只有附加表信息,但是没有主表信息,并且附加表基础信息很多空着的,此处需要从主表获取了然后填充一下该信息
|
|
|
|
if (agencyId == null) agencyId = resiInfo.getAgencyId(); |
|
|
|
if (gridId == null) gridId = resiInfo.getGridId(); |
|
|
|
if (villageId == null) villageId = resiInfo.getVillageId(); |
|
|
|
if (buildId == null) buildId = resiInfo.getBuildId(); |
|
|
|
if (unitId == null) unitId = resiInfo.getUnitId(); |
|
|
|
if (homeId == null) homeId = resiInfo.getHomeId(); |
|
|
|
|
|
|
|
IcUserChangeDetailedEntity newDetail = fillChangeDetail(loginUserUtil.getLoginUserCustomerId(), resiId, changeRecord.getId(), agencyId, |
|
|
|
gridId, villageId, buildId, unitId, |
|
|
|
homeId, "category", "类别", columnEntry.getKey(), value, resiInfo.getPids()); |
|
|
|
|
|
|
|
icUserChangeDetailedDao.insert(newDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 生成类别变更描述 |
|
|
|
* @param oldCategories |
|
|
|
* @param newCategories |
|
|
|
* @param sbBefore |
|
|
|
* @param sbAfter |
|
|
|
*/ |
|
|
|
private void generateCategoryChangeDesc(Map<String, String> oldCategories, Map<String, String> newCategories, |
|
|
|
StringBuilder sbBefore, StringBuilder sbAfter) { |
|
|
|
for (Map.Entry<String, String> newEntry : newCategories.entrySet()) { |
|
|
|
String columnName = newEntry.getKey(); |
|
|
|
String newColumnValue = newEntry.getValue(); |
|
|
|
String oldColumnValue = oldCategories.get(columnName); |
|
|
|
|
|
|
|
if (newColumnValue.equals(oldColumnValue)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
String beforeValueName = "0".equals(oldColumnValue) ? "否" : "是"; |
|
|
|
String newValueName = "0".equals(newColumnValue) ? "否" : "是"; |
|
|
|
|
|
|
|
String label = resiCategoryColumnNameAndLabel.get().get(columnName); |
|
|
|
|
|
|
|
sbBefore.append(label).append(":").append(beforeValueName).append("\n"); |
|
|
|
sbAfter.append(label).append(":").append(newValueName).append("\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 保存新增居民类别记录 |
|
|
|
* @param newResis |
|
|
@ -1322,6 +1378,9 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
ResiImportCategoryData oldData = resi.getValue().getOldData(); |
|
|
|
ResiImportCategoryData newData = resi.getValue().getNewData(); |
|
|
|
|
|
|
|
// 把附加表的旧数据填充到新数据中
|
|
|
|
fillResiSubCategoryInfo4TransferAndCategoryChange(oldData, newData); |
|
|
|
|
|
|
|
StringBuilder sbBefore = new StringBuilder(); |
|
|
|
StringBuilder sbAfter = new StringBuilder(); |
|
|
|
|
|
|
@ -1435,9 +1494,42 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
icUserChangeRecordDao.insert(transferChangeRecord); |
|
|
|
|
|
|
|
// 保存 类别变更changeRecord
|
|
|
|
sbBefore = new StringBuilder(); |
|
|
|
sbAfter = new StringBuilder(); |
|
|
|
|
|
|
|
// 过滤居民类别的key并集
|
|
|
|
Set<String> bingji = new HashSet<>(); |
|
|
|
newData.getCategories().keySet().forEach((k) -> bingji.add(k)); |
|
|
|
oldData.getCategories().keySet().forEach((k) -> bingji.add(k)); |
|
|
|
|
|
|
|
for (String category : bingji) { |
|
|
|
String newColumnValue = newData.getCategories().get(category); |
|
|
|
String oldColumnValue = oldData.getCategories().get(category); |
|
|
|
|
|
|
|
if (oldColumnValue == null) oldColumnValue = "0"; |
|
|
|
if (newColumnValue == null) newColumnValue = "0"; |
|
|
|
|
|
|
|
if (newColumnValue.equals(oldColumnValue)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
String beforeValueName = "0".equals(oldColumnValue) ? "否" : "是"; |
|
|
|
String newValueName = "0".equals(newColumnValue) ? "否" : "是"; |
|
|
|
|
|
|
|
String label = resiCategoryColumnNameAndLabel.get().get(category); |
|
|
|
|
|
|
|
sbBefore.append(label).append(":").append(beforeValueName).append("\n"); |
|
|
|
sbAfter.append(label).append(":").append(newValueName).append("\n"); |
|
|
|
} |
|
|
|
|
|
|
|
String categoryDescBefore = sbBefore.toString(); |
|
|
|
String categoryDescAfter = sbAfter.toString(); |
|
|
|
|
|
|
|
if (!StringUtils.isAllBlank(categoryDescBefore, categoryDescAfter)) { |
|
|
|
IcUserChangeRecordEntity categoryChangeRecord = fillChangeRecord(customerId, resiId, resiInfo.getName(), transferRecord.getId(), operator.getStaffId(), |
|
|
|
operator.getRealName(), sbBefore.toString(), sbAfter.toString(), "category", "类别", "", now); |
|
|
|
operator.getRealName(), categoryDescBefore, categoryDescAfter , "category", "类别", "", now); |
|
|
|
icUserChangeRecordDao.insert(categoryChangeRecord); |
|
|
|
} |
|
|
|
|
|
|
|
// 保存 changeDetail
|
|
|
|
for (Map.Entry<String, String> oldCategories : oldData.getCategories().entrySet()) { |
|
|
@ -1445,27 +1537,50 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
// String value = oldCategories.getValue();
|
|
|
|
|
|
|
|
// 之前是这个类型,那这个类型需要-1
|
|
|
|
IcUserChangeDetailedEntity changeDetail = fillChangeDetail(customerId, resiId, categoryChangeRecord.getId(), oldData.getAgencyId(), |
|
|
|
String oldValue = oldCategories.getValue(); |
|
|
|
if ("1".equals(oldValue)) { |
|
|
|
IcUserChangeDetailedEntity changeDetail = fillChangeDetail(customerId, resiId, transferChangeRecord.getId(), oldData.getAgencyId(), |
|
|
|
oldData.getGridId(), oldData.getVillageId(), oldData.getBuildId(), oldData.getUnitId(), |
|
|
|
oldData.getHomeId(), categoryChangeRecord.getType(), categoryChangeRecord.getTypeName(), key, -1, resiInfo.getPids()); |
|
|
|
|
|
|
|
oldData.getHomeId(), transferChangeRecord.getType(), transferChangeRecord.getTypeName(), key, -1, resiInfo.getPids()); |
|
|
|
icUserChangeDetailedDao.insert(changeDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 保存 changeDetail
|
|
|
|
for (Map.Entry<String, String> newCategories : newData.getCategories().entrySet()) { |
|
|
|
String key = newCategories.getKey(); |
|
|
|
// String value = newCategories.getValue();
|
|
|
|
String newValue = newCategories.getValue(); |
|
|
|
|
|
|
|
// 现在是这个类型,这个类型要+1
|
|
|
|
IcUserChangeDetailedEntity changeDetail = fillChangeDetail(customerId, resiId, categoryChangeRecord.getId(), newData.getAgencyId(), |
|
|
|
if ("1".equals(newValue)) { |
|
|
|
IcUserChangeDetailedEntity changeDetail = fillChangeDetail(customerId, resiId, transferChangeRecord.getId(), newData.getAgencyId(), |
|
|
|
newData.getGridId(), newData.getVillageId(), newData.getBuildId(), newData.getUnitId(), |
|
|
|
newData.getHomeId(), categoryChangeRecord.getType(), categoryChangeRecord.getTypeName(), key, 1, resiInfo.getPids()); |
|
|
|
|
|
|
|
newData.getHomeId(), transferChangeRecord.getType(), transferChangeRecord.getTypeName(), key, 1, resiInfo.getPids()); |
|
|
|
icUserChangeDetailedDao.insert(changeDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 把居民原有的子表的人员类别标记拿到,看是否需要给新导入的数据填充。因为一个人可能以前是党员, |
|
|
|
* 后来做了调动,但是调动的时候没有填写党员信息,这样newData中是没有的,所以需要从oldData中拿到,填充到newData |
|
|
|
* @param oldData |
|
|
|
* @param newData |
|
|
|
*/ |
|
|
|
private void fillResiSubCategoryInfo4TransferAndCategoryChange(ResiImportCategoryData oldData, ResiImportCategoryData newData) { |
|
|
|
for (String category : oldData.getCategories().keySet()) { |
|
|
|
String newValue = newData.getCategories().get(category); |
|
|
|
String oldValue = oldData.getCategories().get(category); |
|
|
|
|
|
|
|
// 如果新数据中没有或者是0,并且是附加表信息,并且旧数据是1, 拿旧数据的过来
|
|
|
|
if ((newValue == null || "0".equals(newValue)) |
|
|
|
&& "1".equals(oldValue) |
|
|
|
&& IcResiUserTableEnum.existsColumn(category)) { |
|
|
|
newData.getCategories().put(category, "1"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 填充变更明细 |
|
|
|