|
|
@ -54,9 +54,13 @@ import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.IcResiUserEntity; |
|
|
|
import com.epmet.entity.IcUserChangeDetailedEntity; |
|
|
|
import com.epmet.entity.IcUserChangeRecordEntity; |
|
|
|
import com.epmet.excel.support.ExportResiUserItemDTO; |
|
|
|
import com.epmet.feign.*; |
|
|
|
import com.epmet.service.IcResiUserService; |
|
|
|
import com.epmet.service.IcUserChangeDetailedService; |
|
|
|
import com.epmet.service.IcUserChangeRecordService; |
|
|
|
import com.epmet.service.UserService; |
|
|
|
import com.github.pagehelper.Page; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
@ -106,6 +110,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
private EpmetAdminOpenFeignClient epmetAdminOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private IcResiUserDao icResiUserDao; |
|
|
|
@Autowired |
|
|
|
private IcUserChangeRecordService icUserChangeRecordService; |
|
|
|
@Autowired |
|
|
|
private IcUserChangeDetailedService icUserChangeDetailedService; |
|
|
|
|
|
|
|
private QueryWrapper<IcResiUserEntity> getWrapper(Map<String, Object> params){ |
|
|
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
|
|
@ -162,9 +170,12 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
//1.先往主表新增数据
|
|
|
|
//主表Id
|
|
|
|
String resiUserId = UUID.randomUUID().toString().replaceAll("-", ""); |
|
|
|
formDTO.forEach(d -> { |
|
|
|
String name = ""; |
|
|
|
LinkedHashMap<String, String> map = new LinkedHashMap<>(); |
|
|
|
for (IcResiUserFormDTO d : formDTO) { |
|
|
|
if ("ic_resi_user".equals(d.getTableName())) { |
|
|
|
LinkedHashMap<String, String> map = d.getList().get(0); |
|
|
|
map = d.getList().get(0); |
|
|
|
name = map.get("NAME"); |
|
|
|
map.put("id", resiUserId); |
|
|
|
map.put("customer_id", tokenDto.getCustomerId()); |
|
|
|
map.put("created_by", tokenDto.getUserId()); |
|
|
@ -195,26 +206,79 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
//新增主表数据
|
|
|
|
baseDao.add(d.getTableName(), map); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
//2.循环字表新增数据
|
|
|
|
formDTO.forEach(d -> { |
|
|
|
if (!"ic_resi_user".equals(d.getTableName())) { |
|
|
|
for (LinkedHashMap<String, String> map : d.getList()) { |
|
|
|
map.put("id", UUID.randomUUID().toString().replaceAll("-", "")); |
|
|
|
map.put("ic_resi_user", resiUserId); |
|
|
|
map.put("customer_id", tokenDto.getCustomerId()); |
|
|
|
map.put("created_by", tokenDto.getUserId()); |
|
|
|
map.put("updated_by", tokenDto.getUserId()); |
|
|
|
for (LinkedHashMap<String, String> hash : d.getList()) { |
|
|
|
hash.put("id", UUID.randomUUID().toString().replaceAll("-", "")); |
|
|
|
hash.put("ic_resi_user", resiUserId); |
|
|
|
hash.put("customer_id", tokenDto.getCustomerId()); |
|
|
|
hash.put("created_by", tokenDto.getUserId()); |
|
|
|
hash.put("updated_by", tokenDto.getUserId()); |
|
|
|
//字表新增数据
|
|
|
|
baseDao.add(d.getTableName(), map); |
|
|
|
baseDao.add(d.getTableName(), hash); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
//3.变更记录表和变更记录明细表新增数据
|
|
|
|
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); |
|
|
|
//3-1.变更记录表
|
|
|
|
IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity(); |
|
|
|
changeRecordEntity.setCustomerId(tokenDto.getCustomerId()); |
|
|
|
changeRecordEntity.setOperatorId(tokenDto.getUserId()); |
|
|
|
changeRecordEntity.setIcUserId(resiUserId); |
|
|
|
changeRecordEntity.setOperatorName(staffInfoCache.getRealName()); |
|
|
|
changeRecordEntity.setIcUserName(name); |
|
|
|
changeRecordEntity.setType("add"); |
|
|
|
changeRecordEntity.setTypeName("新增"); |
|
|
|
changeRecordEntity.setBeforeChangeName("-"); |
|
|
|
changeRecordEntity.setAfterChangeName("-"); |
|
|
|
changeRecordEntity.setChangeTime(new java.util.Date()); |
|
|
|
icUserChangeRecordService.insert(changeRecordEntity); |
|
|
|
//3-2.变更明细表
|
|
|
|
List<IcUserChangeDetailedEntity> changeDetailedEntityList = saveChangeRecord(tokenDto, map, resiUserId, changeRecordEntity.getId()); |
|
|
|
icUserChangeDetailedService.insertBatch(changeDetailedEntityList); |
|
|
|
|
|
|
|
return resiUserId; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 变更明细表 |
|
|
|
**/ |
|
|
|
private List<IcUserChangeDetailedEntity> saveChangeRecord(TokenDto tokenDto, LinkedHashMap<String, String> map, String icUserId, String icUserChangeRecordId) { |
|
|
|
List<IcUserChangeDetailedEntity> list = new ArrayList<>(); |
|
|
|
Result<List<IcResiCategoryWarnConfigDTO>> resultList = operCustomizeOpenFeignClient.categoryWarnConfigList(tokenDto.getCustomerId()); |
|
|
|
if (!resultList.success()) { |
|
|
|
throw new RuntimeException("人员新增,获取客户居民类别预警配置表数据失败"); |
|
|
|
} |
|
|
|
IcUserChangeDetailedEntity outEntity = null; |
|
|
|
for (IcResiCategoryWarnConfigDTO cf : resultList.getData()) { |
|
|
|
if (map.containsKey(cf.getColumnName()) && "1".equals(map.get(cf.getColumnName()))) { |
|
|
|
//新增
|
|
|
|
outEntity = new IcUserChangeDetailedEntity(); |
|
|
|
outEntity.setCustomerId(tokenDto.getCustomerId()); |
|
|
|
outEntity.setIcUserChangeRecordId(icUserChangeRecordId); |
|
|
|
outEntity.setAgencyId(map.get("AGENCY_ID")); |
|
|
|
outEntity.setGridId(map.get("GRID_ID")); |
|
|
|
outEntity.setNeighborHoodId(map.get("VILLAGE_ID")); |
|
|
|
outEntity.setBuildingId(map.get("BUILD_ID")); |
|
|
|
outEntity.setBuildingUnitId(map.get("UNIT_ID")); |
|
|
|
outEntity.setHouseId(map.get("HOME_ID")); |
|
|
|
outEntity.setIcUserId(icUserId); |
|
|
|
outEntity.setType("add"); |
|
|
|
outEntity.setTypeName("新增"); |
|
|
|
outEntity.setFieldName(cf.getColumnName()); |
|
|
|
outEntity.setValue(1); |
|
|
|
list.add(outEntity); |
|
|
|
} |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 党建互联平台--修改居民信息 |
|
|
|