From 1e3a21386755f518035b3cd1c17c69e337760d8c Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 17 Jan 2022 17:19:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E6=96=B0=E5=A2=9E=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=B0=83=E6=95=B4=E5=88=A4=E6=96=AD=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E8=AF=81=E5=8F=B7=E5=94=AF=E4=B8=80=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E8=AE=B0=E5=BD=95=E3=80=81=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/IcResiUserServiceImpl.java | 84 ++++++++++++++++--- 1 file changed, 74 insertions(+), 10 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index cfa57f050e..93d7eaefca 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -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 getWrapper(Map params){ String id = (String)params.get(FieldConstant.ID_HUMP); @@ -162,9 +170,12 @@ public class IcResiUserServiceImpl extends BaseServiceImpl { + String name = ""; + LinkedHashMap map = new LinkedHashMap<>(); + for (IcResiUserFormDTO d : formDTO) { if ("ic_resi_user".equals(d.getTableName())) { - LinkedHashMap 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 { if (!"ic_resi_user".equals(d.getTableName())) { - for (LinkedHashMap 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 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 changeDetailedEntityList = saveChangeRecord(tokenDto, map, resiUserId, changeRecordEntity.getId()); + icUserChangeDetailedService.insertBatch(changeDetailedEntityList); + return resiUserId; } + /** + * @Author sun + * @Description 变更明细表 + **/ + private List saveChangeRecord(TokenDto tokenDto, LinkedHashMap map, String icUserId, String icUserChangeRecordId) { + List list = new ArrayList<>(); + Result> 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 党建互联平台--修改居民信息