diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/HomeUserBriefResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/HomeUserBriefResultDTO.java new file mode 100644 index 0000000000..c8b4b5b67a --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/HomeUserBriefResultDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/11/1 10:47 + */ +@Data +public class HomeUserBriefResultDTO implements Serializable { + private static final long serialVersionUID = 7747977114455488862L; + private String id; + private String homeId; + private String name; + private String isParty; + private String gender; + private String yhzgx; + private String mobile; + private String idCard; + private String birthday; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 490767dff7..142a824c97 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -229,7 +229,7 @@ public class IcResiUserController implements ResultDataResolver { //推送MQ事件 IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg(); mqMsg.setCustomerId(tokenDto.getCustomerId()); - log.info("customer id is {}",tokenDto.getCustomerId()); + log.info("customer id is {}", tokenDto.getCustomerId()); mqMsg.setIcResiUser(resiUserId); SystemMsgFormDTO form = new SystemMsgFormDTO(); form.setMessageType(SystemMessageType.IC_RESI_USER_EDIT); @@ -252,25 +252,26 @@ public class IcResiUserController implements ResultDataResolver { /** * 根据ic_resi_user找家属 + * * @param icResiUserId * @return */ @GetMapping("findfamilymem/{icResiUserId}") - public Result findFamilyMem(@PathVariable("icResiUserId") String icResiUserId){ - if(StringUtils.isNotBlank(icResiUserId)){ + public Result findFamilyMem(@PathVariable("icResiUserId") String icResiUserId) { + if (StringUtils.isNotBlank(icResiUserId)) { return new Result().ok(icResiUserService.findFamilyMem(icResiUserId)); } return new Result<>(); } @PostMapping("listresi") - @MaskResponse(fieldNames = { "MOBILE", "ID_CARD" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) + @MaskResponse(fieldNames = {"MOBILE", "ID_CARD"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD}) public Result>> queryListResi1(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO) { //pageFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc"); pageFormDTO.setCustomerId(tokenDto.getCustomerId()); pageFormDTO.setStaffId(tokenDto.getUserId()); ValidatorUtils.validateEntity(pageFormDTO, IcResiUserPageFormDTO.AddUserInternalGroup.class); - if(null==pageFormDTO.getConditions()){ + if (null == pageFormDTO.getConditions()) { pageFormDTO.setConditions(new ArrayList<>()); } return new Result>>().ok(icResiUserService.pageResiMap(pageFormDTO)); @@ -302,12 +303,12 @@ public class IcResiUserController implements ResultDataResolver { * @return void * @author LiuJanJun * @date 2021/11/19 4:24 下午 - * @remark:分页批量导出 oss目录在 各个环境对应的前缀文件夹/file-template/resi-template/客户ID.xlsx, + * @remark:分页批量导出 oss目录在 各个环境对应的前缀文件夹/file-template/resi-template/客户ID.xlsx, * 如果某个客户需要更新模版 则替换掉上面的模版文件;然后 更新缓存里的值或者删除也行 再导出就会下载新的模版了 */ @NoRepeatSubmit @RequestMapping(value = "/exportExcel") - public void exportExcelByEasyExcel(@RequestHeader String customerId,@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws Exception { + public void exportExcelByEasyExcel(@RequestHeader String customerId, @LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws Exception { //tokenDto.setUserId("9e37adcce6472152e6508a19d3683e02"); long startM = System.currentTimeMillis(); CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(customerId, tokenDto.getUserId()); @@ -333,23 +334,23 @@ public class IcResiUserController implements ResultDataResolver { List resiFormAllItems = icResiUserService.listFormItems(customerId, IcFormCodeEnum.RESI_BASE_INFO.getCode()); Map allItemMap = resiFormAllItems.stream().collect(Collectors.toMap(FormItemResult::getItemId, o -> o)); Map map = new HashMap<>(); - allItemMap.values().forEach(item->{ + allItemMap.values().forEach(item -> { String tableName = item.getTableName(); ExportResiUserItemDTO exportItem = map.getOrDefault(tableName, new ExportResiUserItemDTO()); - map.putIfAbsent(tableName,exportItem); + map.putIfAbsent(tableName, exportItem); String columnName = item.getColumnName().concat(item.getColumnNum() == NumConstant.ZERO ? StrConstant.EPMETY_STR : item.getColumnNum().toString()); - exportItem.getItemMap().put(columnName,item); - if (Constant.OPITON_SOURCE_REMOTE.equals(item.getOptionSourceType())&&item.getOptionSourceValue().contains(StrConstant.QUESTION_MARK)){ + exportItem.getItemMap().put(columnName, item); + if (Constant.OPITON_SOURCE_REMOTE.equals(item.getOptionSourceType()) && item.getOptionSourceValue().contains(StrConstant.QUESTION_MARK)) { //多个参数 String[] paramArr = item.getOptionSourceValue().split(StrConstant.QUESTION_MARK_TRANSFER)[NumConstant.ONE].split(StrConstant.AND_MARK); - Arrays.stream(paramArr).forEach(o->{ + Arrays.stream(paramArr).forEach(o -> { FormItemResult value = allItemMap.get(o); - if (value == null){ + if (value == null) { return; } - Set conditionSet = exportItem.getRemoteItemConditionMap().getOrDefault(item.getItemId(),new HashSet<>()); + Set conditionSet = exportItem.getRemoteItemConditionMap().getOrDefault(item.getItemId(), new HashSet<>()); conditionSet.add(value); - exportItem.getRemoteItemConditionMap().putIfAbsent(item.getItemId(),conditionSet); + exportItem.getRemoteItemConditionMap().putIfAbsent(item.getItemId(), conditionSet); }); } }); @@ -376,7 +377,7 @@ public class IcResiUserController implements ResultDataResolver { stopSearchSet.add(tableName); } //如果没有 构建新的writeSheet - WriteSheet writeSheet = childTableWriteSheetMap.getOrDefault(tableName,EasyExcel.writerSheet(tableEnum.getSheetNo()).build()); + WriteSheet writeSheet = childTableWriteSheetMap.getOrDefault(tableName, EasyExcel.writerSheet(tableEnum.getSheetNo()).build()); childTableWriteSheetMap.putIfAbsent(tableName, writeSheet); //写入数据 excelWriter.fill(new FillWrapper("t" + (tableEnum.getSheetNo() + NumConstant.ONE), resiResultList), writeSheet); @@ -389,10 +390,10 @@ public class IcResiUserController implements ResultDataResolver { } } finally { - if (excelWriter != null){ + if (excelWriter != null) { excelWriter.finish(); } - log.info("exportExcelByEasyExcel resi info cost time:{}s",(System.currentTimeMillis()-startM)/NumConstant.ONE_THOUSAND); + log.info("exportExcelByEasyExcel resi info cost time:{}s", (System.currentTimeMillis() - startM) / NumConstant.ONE_THOUSAND); } } @@ -402,7 +403,7 @@ public class IcResiUserController implements ResultDataResolver { * @param customerId * @return */ - private File getIcResiTemplateFile(String customerId, IcUserTemplateEnums template) throws Exception{ + private File getIcResiTemplateFile(String customerId, IcUserTemplateEnums template) throws Exception { String fileType = ".xlsx"; String fileName = customerId + fileType; File file = new File(IC_RESI_DOWNLOAD_DIR.resolve(fileName).toString()); @@ -420,11 +421,11 @@ public class IcResiUserController implements ResultDataResolver { if (result == null || !result.success()) { log.warn("获取居民模版失败,path:{},走默认模版", ossFilePath); InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream(template.getPathInApp()); - FileUtils.copyInputStreamToFile(resourceAsStream,file); - log.warn("getIcResiTemplateFile copy default file to template,customerId:{}",customerId); + FileUtils.copyInputStreamToFile(resourceAsStream, file); + log.warn("getIcResiTemplateFile copy default file to template,customerId:{}", customerId); } else { - log.warn("getIcResiTemplateFile reload file form oss default file to template,customerId:{}",customerId); - FileUtils.writeByteArrayToFile(file,result.getData()); + log.warn("getIcResiTemplateFile reload file form oss default file to template,customerId:{}", customerId); + FileUtils.writeByteArrayToFile(file, result.getData()); } redisUtils.hSet(RedisKeys.getResiTempChangedKey(customerId), serverIp, NumConstant.ZERO_STR); return file; @@ -439,7 +440,7 @@ public class IcResiUserController implements ResultDataResolver { */ @NoRepeatSubmit @PostMapping("importExcel") - public Result importExcelByEasyExcel(@RequestHeader("customerId") String customerId,@RequestPart("file") MultipartFile file, HttpServletRequest multipartRequest, HttpServletResponse response) { + public Result importExcelByEasyExcel(@RequestHeader("customerId") String customerId, @RequestPart("file") MultipartFile file, HttpServletRequest multipartRequest, HttpServletResponse response) { if (file.isEmpty()) { throw new RenException("请上传文件"); } @@ -470,7 +471,7 @@ public class IcResiUserController implements ResultDataResolver { executorService.execute(() -> { boolean isAllSuccess = false; try { - List formItemList = icResiUserService.listFormItems(customerId,IcFormCodeEnum.RESI_BASE_INFO.getCode()); + List formItemList = icResiUserService.listFormItems(customerId, IcFormCodeEnum.RESI_BASE_INFO.getCode()); isAllSuccess = icResiUserImportService.importIcResiInfoFromExcel(importTaskId, formItemList, importTempFileSavePath.toString(), response, IC_RESI_UPLOAD_DIR); } catch (Throwable e) { String errorMsg = ExceptionUtils.getThrowableErrorStackTrace(e); @@ -488,7 +489,7 @@ public class IcResiUserController implements ResultDataResolver { } finally { try { // 都导入成功了没问题,才删除 - if (importTempFileSavePath != null){ + if (importTempFileSavePath != null) { if (isAllSuccess) { Files.delete(importTempFileSavePath); } else { @@ -520,9 +521,9 @@ public class IcResiUserController implements ResultDataResolver { * @date 2021/11/3 9:21 上午 */ @PostMapping("persondata") - public Result personData(@LoginUser TokenDto tokenDto,@RequestBody PersonDataFormDTO formDTO) { + public Result personData(@LoginUser TokenDto tokenDto, @RequestBody PersonDataFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); - ValidatorUtils.validateEntity(formDTO,PersonDataFormDTO.PersonDataForm.class); + ValidatorUtils.validateEntity(formDTO, PersonDataFormDTO.PersonDataForm.class); return new Result().ok(icResiUserService.personData(formDTO)); } @@ -543,6 +544,7 @@ public class IcResiUserController implements ResultDataResolver { /** * 需求: http://zentao.elinkservice.cn/task-view-4193.html 第11条 + * * @param formDTO * @param tokenDto * @return 根据分类搜索 @@ -592,10 +594,10 @@ public class IcResiUserController implements ResultDataResolver { } /** - * @LoginUser TokenDto tokenDto, - * 新增需求,需求人列表:展示当前工作人员所属组织+页面已选择所属网格 下的居民列表 * @param formDTO * @return + * @LoginUser TokenDto tokenDto, + * 新增需求,需求人列表:展示当前工作人员所属组织+页面已选择所属网格 下的居民列表 */ @PostMapping("demandusers") public Result> queryDemandUsers(@RequestBody DemandUserFormDTO formDTO) { @@ -605,6 +607,7 @@ public class IcResiUserController implements ResultDataResolver { /** * 下载ic居民信息导入excel模板 + * * @return */ @PostMapping("import/download-template") @@ -635,6 +638,7 @@ public class IcResiUserController implements ResultDataResolver { /** * 党员年龄范围统计 + * * @Param formDTO * @Return {@link Result< List< OptionDataResultDTO >>} * @Author zhaoqifeng @@ -648,13 +652,14 @@ public class IcResiUserController implements ResultDataResolver { /** * 党员年龄列表 + * * @Param formDTO * @Return {@link Result< PageData< PartyMemberEducationResultDTO>>} * @Author zhaoqifeng * @Date 2021/12/10 17:54 */ @PostMapping("partymemberagelist") - @MaskResponse(fieldNames = { "mobile" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE }) + @MaskResponse(fieldNames = {"mobile"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE}) public Result> partyMemberAgelist(@RequestBody PartyMemberListFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return new Result>().ok(icResiUserService.getPartyMemberAgeList(formDTO)); @@ -712,6 +717,7 @@ public class IcResiUserController implements ResultDataResolver { /** * 党员学历统计 + * * @Param formDTO * @Return {@link Result< List< OptionDataResultDTO>>} * @Author zhaoqifeng @@ -725,13 +731,14 @@ public class IcResiUserController implements ResultDataResolver { /** * 党员学历列表 + * * @Param formDTO * @Return {@link Result< PageData< PartyMemberEducationResultDTO>>} * @Author zhaoqifeng * @Date 2021/12/10 17:58 */ @PostMapping("partymembereducationlist") - @MaskResponse(fieldNames = { "mobile" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE }) + @MaskResponse(fieldNames = {"mobile"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE}) public Result> partyMemberEducationlist(@RequestBody PartyMemberListFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return new Result>().ok(icResiUserService.getPartyMemberEducationList(formDTO)); @@ -795,6 +802,7 @@ public class IcResiUserController implements ResultDataResolver { /** * 根据居民id查询居民信息简介 + * * @param resiUserId * @return */ @@ -807,12 +815,13 @@ public class IcResiUserController implements ResultDataResolver { /** * 获取ic_resi_user + * * @param icResiUserId * @return */ @PostMapping("geticresiuser/{icResiUserId}") - public Result getIcResiUserDTO(@PathVariable("icResiUserId") String icResiUserId){ - if(StringUtils.isNotBlank(icResiUserId)){ + public Result getIcResiUserDTO(@PathVariable("icResiUserId") String icResiUserId) { + if (StringUtils.isNotBlank(icResiUserId)) { return new Result().ok(icResiUserService.get(icResiUserId)); } return new Result<>(); @@ -820,6 +829,7 @@ public class IcResiUserController implements ResultDataResolver { /** * 【社区查询】搜索居民们 + * * @param input * @return */ @@ -848,34 +858,35 @@ public class IcResiUserController implements ResultDataResolver { } /** - * @Description 【社区查询】人员预警右侧列表 * @param formDTO * @param tokenDto + * @Description 【社区查询】人员预警右侧列表 * @author zxc * @date 2022/1/17 4:25 下午 */ @PostMapping("personwarn/rightlist") - @MaskResponse(fieldNames = "mobile", fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE }) - public Result personWarnRightList(@RequestBody PersonWarnRightListFormDTO formDTO,@LoginUser TokenDto tokenDto){ + @MaskResponse(fieldNames = "mobile", fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE}) + public Result personWarnRightList(@RequestBody PersonWarnRightListFormDTO formDTO, @LoginUser TokenDto tokenDto) { ValidatorUtils.validateEntity(formDTO, PersonWarnRightListFormDTO.PersonWarnRightListForm.class); - return new Result().ok(icResiUserService.personWarnRightList(formDTO,tokenDto)); + return new Result().ok(icResiUserService.personWarnRightList(formDTO, tokenDto)); } /** * Desc: 根据房屋IDs查询房屋下是否有存在居民的 + * * @param ids * @author zxc * @date 2022/3/2 10:32 上午 */ @PostMapping("getexistuserbyhouseids") - public Result> getExistUserByHouseIds(@RequestBody List ids){ + public Result> getExistUserByHouseIds(@RequestBody List ids) { return new Result>().ok(icResiUserService.getExistUserByHouseIds(ids)); } // public static ThreadLocal tl = new ThreadLocal(); @PostMapping("test-async") - public Result testAsync(HttpServletRequest request){ + public Result testAsync(HttpServletRequest request) { // tl.set("wxz"); executorService.submit(() -> { try { @@ -910,4 +921,19 @@ public class IcResiUserController implements ResultDataResolver { return new Result>().ok(icResiUserService.userChartList(formDTO)); } + /** + * 根据房屋主键查询户内家庭成员简信息 + * + * @param houseId 房屋主键 + * @param loginUser 登录用户 + * @return com.epmet.commons.tools.utils.Result> + * @author work@yujt.net.cn + * @date 2022/4/21/0021 15:00 + */ + @PostMapping("listhomeuserbrief/{houseId}") + public Result> listHomeUserBrief(@PathVariable("houseId") String houseId, @LoginUser TokenDto loginUser) { + String customerId = loginUser.getCustomerId(); + List r = icResiUserService.listHomeUserBrief(houseId, customerId); + return new Result().ok(r); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java index 11c9397558..d242530a09 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java @@ -67,37 +67,37 @@ public interface IcResiUserService extends BaseService { */ List getPeopleByRoom(String homeId); - PageData> pageResiMap(IcResiUserPageFormDTO formDTO); + PageData> pageResiMap(IcResiUserPageFormDTO formDTO); + /** * 编辑页面,显示居民信息详情 * * @param pageFormDTO - * @return java.util.Map + * @return java.util.Map * @author yinzuomei * @date 2021/10/28 10:29 上午 */ Map queryIcResiDetail(IcResiDetailFormDTO pageFormDTO); - - List> dynamicQuery(String customerId, - String formCode, - String resultTableName, - List conditions, - String currentStaffAgencyId, - String staffOrgPath); + List> dynamicQuery(String customerId, + String formCode, + String resultTableName, + List conditions, + String currentStaffAgencyId, + String staffOrgPath); /** - * @Description 查询个人数据 * @param formDTO + * @Description 查询个人数据 * @author zxc * @date 2021/11/3 9:21 上午 */ PersonDataResultDTO personData(PersonDataFormDTO formDTO); /** - * @Description 根据名字搜索 * @param formDTO + * @Description 根据名字搜索 * @author zxc * @date 2021/11/3 1:42 下午 */ @@ -109,7 +109,7 @@ public interface IcResiUserService extends BaseService { * * @param exportResiUserItemDTO * @param baseTableName - * @return Map> 用户Id:用户信息所有的字段名及值 + * @return Map> 用户Id:用户信息所有的字段名及值 */ List> getDataForExport(ExportResiUserItemDTO exportResiUserItemDTO, String baseTableName, IcResiUserPageFormDTO pageFormDTO, String currentStaffAgencyId, String staffOrgPath); @@ -150,12 +150,13 @@ public interface IcResiUserService extends BaseService { * @param idNum * @return */ - IcResiUserDTO getByIdCard(String customerId, String idNum,String icResiUserId); + IcResiUserDTO getByIdCard(String customerId, String idNum, String icResiUserId); IcResiUserBriefDTO findFamilyMem(String icResiUserId); /** * 党员年龄范围统计 + * * @Param formDTO * @Return {@link List< OptionDataResultDTO >} * @Author zhaoqifeng @@ -165,6 +166,7 @@ public interface IcResiUserService extends BaseService { /** * 获取年龄范围内党员列表 + * * @Param formDTO * @Return {@link PageData< PartyMemberAgeResultDTO>} * @Author zhaoqifeng @@ -174,6 +176,7 @@ public interface IcResiUserService extends BaseService { /** * 党员文化程度统计 + * * @Param formDTO * @Return {@link List< OptionDataResultDTO>} * @Author zhaoqifeng @@ -183,6 +186,7 @@ public interface IcResiUserService extends BaseService { /** * 按教育程度获取党员列表 + * * @Param formDTO * @Return {@link PageData< PartyMemberEducationResultDTO>} * @Author zhaoqifeng @@ -194,15 +198,16 @@ public interface IcResiUserService extends BaseService { /** * 获取居民主表记录 + * * @param icResiUserId * @return */ IcResiUserDTO get(String icResiUserId); /** - * @Description 【社区查询】人员预警右侧列表 * @param formDTO * @param tokenDto + * @Description 【社区查询】人员预警右侧列表 * @author zxc * @date 2022/1/17 4:25 下午 */ @@ -210,6 +215,7 @@ public interface IcResiUserService extends BaseService { /** * Desc: 根据房屋IDs查询房屋下是否有存在居民的 + * * @param ids * @author zxc * @date 2022/3/2 10:32 上午 @@ -225,10 +231,12 @@ public interface IcResiUserService extends BaseService { * @Date 2022/3/29 14:27 */ PageData epidemicPreventionList(EpidemicPreventionFormDTO formDTO); + PageData userList(EpidemicPreventionFormDTO formDTO); /** * 居民防疫信息详情 + * * @Param formDTO * @Return {@link EpidemicPreventionResultDTO} * @Author zhaoqifeng @@ -238,6 +246,7 @@ public interface IcResiUserService extends BaseService { /** * 居民防疫信息详情:核酸,疫苗,行程 + * * @Param formDTO * @Return {@link EpidemicPreventionInfoDTO} * @Author zhaoqifeng @@ -256,4 +265,15 @@ public interface IcResiUserService extends BaseService { * @Description 【人房】居民总数列表数据 **/ List userChartList(UserChartFormDTO formDTO); + + /** + * 根据房屋主键查询户内家庭成员简信息 + * + * @param houseId 房屋主键 + * @param customerId 客户ID + * @return java.util.List + * @author work@yujt.net.cn + * @date 2022/4/21/0021 15:02 + */ + List listHomeUserBrief(String houseId, String customerId); } 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 0bb3eefaf4..cf3dc2db77 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 @@ -18,6 +18,7 @@ package com.epmet.service.impl; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.bean.ResiExportBaseInfoData; @@ -66,6 +67,7 @@ import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; @@ -128,8 +130,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); @@ -194,7 +196,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> categoryListResult = operCustomizeOpenFeignClient.getCategoryList(sfdto); - if (!categoryListResult.success()){ + if (!categoryListResult.success()) { throw new RenException("居民信息修改,获取客户居民类别预警配置表数据失败"); } //修改前数据库居民十八类信息值 @@ -496,7 +498,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl getPeopleByRoom(String homeId) { - if(StringUtils.isBlank(homeId)) { + if (StringUtils.isBlank(homeId)) { return Collections.emptyList(); } LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); @@ -516,72 +518,70 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> pageResiMap(IcResiUserPageFormDTO formDTO) { - CustomerStaffInfoCacheResult staffInfoCacheResult=CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(),formDTO.getStaffId()); + CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); String staffOrgPath; - if(StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds())&& !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())){ - staffOrgPath=staffInfoCacheResult.getAgencyPIds().concat(":").concat(staffInfoCacheResult.getAgencyId()); - }else{ - staffOrgPath=staffInfoCacheResult.getAgencyId(); + if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { + staffOrgPath = staffInfoCacheResult.getAgencyPIds().concat(":").concat(staffInfoCacheResult.getAgencyId()); + } else { + staffOrgPath = staffInfoCacheResult.getAgencyId(); } // 查询列表展示项,如果没有,直接返回 - CustomerFormQueryDTO queryDTO1=new CustomerFormQueryDTO(); + CustomerFormQueryDTO queryDTO1 = new CustomerFormQueryDTO(); queryDTO1.setCustomerId(formDTO.getCustomerId()); queryDTO1.setFormCode(formDTO.getFormCode()); - Result> resultColumnRes=operCustomizeOpenFeignClient.queryConditions(queryDTO1); + Result> resultColumnRes = operCustomizeOpenFeignClient.queryConditions(queryDTO1); if (!resultColumnRes.success() || CollectionUtils.isEmpty(resultColumnRes.getData())) { log.warn("没有配置列表展示列"); return new PageData(new ArrayList(), NumConstant.ZERO); } List resultColumns = resultColumnRes.getData(); // 查询结果列对应的表: - Set resultColumnTables=resultColumns.stream().map(IcFormResColumnDTO::getTableName).collect(Collectors.toSet()); + Set resultColumnTables = resultColumns.stream().map(IcFormResColumnDTO::getTableName).collect(Collectors.toSet()); // 查询列表展示项需要用到哪些子表 - Result> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO1); - List subTables =subTablesRes.getData(); + Result> subTablesRes = operCustomizeOpenFeignClient.querySubTables(queryDTO1); + List subTables = subTablesRes.getData(); // log.info("1、所有的子表subTables:"+JSON.toJSONString(subTables,true)); //关联哪些子表:查询条件用到的表名+查询的列对应的表 并集去重 - Set whereConditionTables=formDTO.getConditions().stream().map(ResiUserQueryValueDTO::getTableName).collect(Collectors.toSet()); - Set tables=new HashSet<>(); + Set whereConditionTables = formDTO.getConditions().stream().map(ResiUserQueryValueDTO::getTableName).collect(Collectors.toSet()); + Set tables = new HashSet<>(); tables.addAll(whereConditionTables); tables.addAll(resultColumnTables); // log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true)); //最终关联的子表对应的sql: - List finalSubTables =new ArrayList<>(); - subTables.forEach(subTable->{ - if(tables.contains(subTable.getTableName())){ + List finalSubTables = new ArrayList<>(); + subTables.forEach(subTable -> { + if (tables.contains(subTable.getTableName())) { finalSubTables.add(subTable.getJoinTableSql()); } }); - PageInfo> pageInfo=new PageInfo<>(); - if (null == formDTO.getPageFlag()||formDTO.getPageFlag()) { + PageInfo> pageInfo = new PageInfo<>(); + if (null == formDTO.getPageFlag() || formDTO.getPageFlag()) { //分页 String finalStaffOrgPath = staffOrgPath; - pageInfo= PageHelper.startPage(formDTO.getPageNo(), + pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectListResiMap(formDTO.getCustomerId(), formDTO.getFormCode(), formDTO.getConditions(), resultColumns, finalSubTables, - staffInfoCacheResult.getAgencyId(), finalStaffOrgPath,null, formDTO.getKeyword())); - }else{ - List> list=baseDao.selectListResiMap(formDTO.getCustomerId(), + staffInfoCacheResult.getAgencyId(), finalStaffOrgPath, null, formDTO.getKeyword())); + } else { + List> list = baseDao.selectListResiMap(formDTO.getCustomerId(), formDTO.getFormCode(), formDTO.getConditions(), resultColumns, finalSubTables, staffInfoCacheResult.getAgencyId(), - staffOrgPath,null, + staffOrgPath, null, formDTO.getKeyword()); - pageInfo.setTotal(CollectionUtils.isEmpty(list)?NumConstant.ZERO:list.size()); + pageInfo.setTotal(CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size()); pageInfo.setList(list); } @@ -597,23 +597,23 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> gridInfoRes=govOrgOpenFeignClient.getGridListByGridIds(gridIds); + Result> gridInfoRes = govOrgOpenFeignClient.getGridListByGridIds(gridIds); List gridInfoList = gridInfoRes.success() && !CollectionUtils.isEmpty(gridInfoRes.getData()) ? gridInfoRes.getData() : new ArrayList<>(); Map gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, Function.identity())); //查询房子名称 - Result> houseInfoRes=govOrgOpenFeignClient.queryListHouseInfo(houseIds,formDTO.getCustomerId()); + Result> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, formDTO.getCustomerId()); List houseInfoDTOList = houseInfoRes.success() && !CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>(); Map houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity())); //查询需求分类字典 - UserDemandNameQueryFormDTO userDemandNameQueryFormDTO=new UserDemandNameQueryFormDTO(); + UserDemandNameQueryFormDTO userDemandNameQueryFormDTO = new UserDemandNameQueryFormDTO(); userDemandNameQueryFormDTO.setCustomerId(formDTO.getCustomerId()); - Result> demandNameRes=heartOpenFeignClient.queryDemandNames(userDemandNameQueryFormDTO); - if(!demandNameRes.success()||CollectionUtils.isEmpty(demandNameRes.getData())){ - throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"获取需求分类字典表数据异常",EpmetErrorCode.SERVER_ERROR.getMsg()); + Result> demandNameRes = heartOpenFeignClient.queryDemandNames(userDemandNameQueryFormDTO); + if (!demandNameRes.success() || CollectionUtils.isEmpty(demandNameRes.getData())) { + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "获取需求分类字典表数据异常", EpmetErrorCode.SERVER_ERROR.getMsg()); } - Map demandDictMap=demandNameRes.getData().stream().collect(Collectors.toMap(IcResiDemandDictDTO::getCategoryCode,Function.identity())); + Map demandDictMap = demandNameRes.getData().stream().collect(Collectors.toMap(IcResiDemandDictDTO::getCategoryCode, Function.identity())); for (Map resultMap : list) { String gridIdValue = null != resultMap.get(UserConstant.GRID_ID) ? resultMap.get(UserConstant.GRID_ID).toString() : StrConstant.EPMETY_STR; @@ -651,7 +651,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl(pageInfo.getList(), pageInfo.getTotal()); } - private String queryUserDemandName(String icResiUserId,Map demandDictMap) { + private String queryUserDemandName(String icResiUserId, Map demandDictMap) { // epmet_user.ic_resi_demand.category_code存储的值为 分类编码的全路径,eg: // 1003,10030002 // 1012,10120003 // 1016,10160003 - Set demandCodePath=baseDao.selectUserDemandCode(icResiUserId); - if(CollectionUtils.isEmpty(demandCodePath)){ + Set demandCodePath = baseDao.selectUserDemandCode(icResiUserId); + if (CollectionUtils.isEmpty(demandCodePath)) { return StrConstant.EPMETY_STR; } - List nameList=new ArrayList<>(); - for(String codePath:demandCodePath){ + List nameList = new ArrayList<>(); + for (String codePath : demandCodePath) { if (StringUtils.isNotBlank(codePath) && codePath.contains(StrConstant.COMMA)) { - String[] codeAtt=codePath.split(StrConstant.COMMA); - String code=codeAtt[codeAtt.length-1]; - if(StringUtils.isNotBlank(code)&&demandDictMap.containsKey(code)){ + String[] codeAtt = codePath.split(StrConstant.COMMA); + String code = codeAtt[codeAtt.length - 1]; + if (StringUtils.isNotBlank(code) && demandDictMap.containsKey(code)) { nameList.add(demandDictMap.get(code).getParentName()); } - }else{ - if(StringUtils.isNotBlank(codePath)&&demandDictMap.containsKey(codePath)){ + } else { + if (StringUtils.isNotBlank(codePath) && demandDictMap.containsKey(codePath)) { nameList.add(demandDictMap.get(codePath).getParentName()); } } } - String demandName=String.join(StrConstant.COMMA_ZH,nameList); - return demandName; + String demandName = String.join(StrConstant.COMMA_ZH, nameList); + return demandName; } @@ -709,17 +709,17 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> icResiUserMapList = baseDao.selectListMapById(pageFormDTO.getCustomerId(),pageFormDTO.getIcResiUserId()); + List> icResiUserMapList = baseDao.selectListMapById(pageFormDTO.getCustomerId(), pageFormDTO.getIcResiUserId()); if (CollectionUtils.isEmpty(icResiUserMapList)) { return new HashMap(); } resultMap.put("ic_resi_user", icResiUserMapList); - CustomerFormQueryDTO queryDTO=ConvertUtils.sourceToTarget(pageFormDTO,CustomerFormQueryDTO.class); + CustomerFormQueryDTO queryDTO = ConvertUtils.sourceToTarget(pageFormDTO, CustomerFormQueryDTO.class); //循环查询每个子表的记录 - Result> subTableRes=operCustomizeOpenFeignClient.queryIcResiSubTables(queryDTO); - if(subTableRes.success()&&!CollectionUtils.isEmpty(subTableRes.getData())){ + Result> subTableRes = operCustomizeOpenFeignClient.queryIcResiSubTables(queryDTO); + if (subTableRes.success() && !CollectionUtils.isEmpty(subTableRes.getData())) { for (String subTalbeName : subTableRes.getData()) { - List> list = baseDao.selectSubTableRecords(pageFormDTO.getCustomerId(),pageFormDTO.getIcResiUserId(), subTalbeName); + List> list = baseDao.selectSubTableRecords(pageFormDTO.getCustomerId(), pageFormDTO.getIcResiUserId(), subTalbeName); if (!CollectionUtils.isEmpty(list)) { resultMap.put(subTalbeName, list); } @@ -733,6 +733,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> dynamicQuery(String customerId, - String formCode, - String resultTableName, - List conditions, - String currentStaffAgencyId, - String staffOrgPath){ - CustomerFormQueryDTO queryDTO=new CustomerFormQueryDTO(); + public List> dynamicQuery(String customerId, + String formCode, + String resultTableName, + List conditions, + String currentStaffAgencyId, + String staffOrgPath) { + CustomerFormQueryDTO queryDTO = new CustomerFormQueryDTO(); queryDTO.setCustomerId(customerId); queryDTO.setFormCode(formCode); //所有的子表 - Result> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO); + Result> subTablesRes = operCustomizeOpenFeignClient.querySubTables(queryDTO); /*List subTablesBak=new ArrayList<>(); if(subTablesRes.success()&&CollectionUtils.isNotEmpty(subTablesRes.getData())){ subTablesBak =subTablesRes.getData().stream().map(SubTableJoinDTO::getJoinTableSql).collect(Collectors.toList()); }*/ - List subTables =subTablesRes.getData(); + List subTables = subTablesRes.getData(); // log.info("1、所有的子表subTables:"+JSON.toJSONString(subTables,true)); //关联哪些子表:查询条件用到的表名+查询的列对应的表 并集去重 - Set whereConditionTables=conditions.stream().map(ResiUserQueryValueDTO::getTableName).collect(Collectors.toSet()); - Set tables=new HashSet<>(); + Set whereConditionTables = conditions.stream().map(ResiUserQueryValueDTO::getTableName).collect(Collectors.toSet()); + Set tables = new HashSet<>(); tables.addAll(whereConditionTables); tables.add(resultTableName); // log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true)); //最终关联的子表对应的sql: - List finalSubTables =new ArrayList<>(); - subTables.forEach(subTable->{ - if(tables.contains(subTable.getTableName())){ + List finalSubTables = new ArrayList<>(); + subTables.forEach(subTable -> { + if (tables.contains(subTable.getTableName())) { finalSubTables.add(subTable.getJoinTableSql()); } }); - return baseDao.dynamicQuery(customerId,resultTableName,conditions,finalSubTables,currentStaffAgencyId,staffOrgPath); + return baseDao.dynamicQuery(customerId, resultTableName, conditions, finalSubTables, currentStaffAgencyId, staffOrgPath); } /** - * @Description 查询个人数据 * @param formDTO + * @Description 查询个人数据 * @author zxc * @date 2021/11/3 9:21 上午 */ @Override public PersonDataResultDTO personData(PersonDataFormDTO formDTO) { PersonDataResultDTO personData = baseDao.personData(formDTO.getUserId()); - if (null == personData){ + if (null == personData) { return new PersonDataResultDTO(); } //新增以下2个返参 @@ -797,16 +798,16 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> listResult = govOrgOpenFeignClient.selectHouseInfoByIdCard(personData.getIdCard(),formDTO.getCustomerId()); - if (!listResult.success()){ + Result> listResult = govOrgOpenFeignClient.selectHouseInfoByIdCard(personData.getIdCard(), formDTO.getCustomerId()); + if (!listResult.success()) { throw new RenException("查询房屋信息失败"); } personData.setHouseInfo(listResult.getData()); // 志愿者处理 - if (personData.getIsVolunteer().equals(NumConstant.ONE_STR)){ + if (personData.getIsVolunteer().equals(NumConstant.ONE_STR)) { List volunteerList = baseDao.selectVolunteerByUserId(formDTO.getUserId()); - if (!CollectionUtils.isEmpty(volunteerList)){ + if (!CollectionUtils.isEmpty(volunteerList)) { List volunteers = new ArrayList<>(); List finalVolunteers = volunteers; volunteerList.forEach(v -> { @@ -816,7 +817,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> volunteerResult = operCustomizeOpenFeignClient.volunteerLabelByValues(volunteers, personData.getCustomerId()); - if (!volunteerResult.success()){ + if (!volunteerResult.success()) { throw new RenException("查询志愿者类别失败..."); } personData.setVolunteerCategory(volunteerResult.getData()); @@ -824,7 +825,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> categoryListResult = operCustomizeOpenFeignClient.getCategoryList(dto); - if (!categoryListResult.success()){ + if (!categoryListResult.success()) { throw new RenException("查询客户下的人员类别失败..."); } List categoryData = categoryListResult.getData(); - if (!CollectionUtils.isEmpty(categoryData)){ + if (!CollectionUtils.isEmpty(categoryData)) { Map> groupByStatus = categoryData.stream().collect(Collectors.groupingBy(IcResiCategoryStatsConfigDTO::getStatus)); List showList = groupByStatus.get(IcPlatformConstant.PERSON_CATEGORY_SHOW); List personCategoryList = new ArrayList<>(); - if (!CollectionUtils.isEmpty(showList)){ + if (!CollectionUtils.isEmpty(showList)) { Map> groupByTableName = showList.stream().collect(Collectors.groupingBy(IcResiCategoryStatsConfigDTO::getTableName)); - groupByTableName.forEach((tableName,list) -> { + groupByTableName.forEach((tableName, list) -> { List columns = list.stream().map(IcResiCategoryStatsConfigDTO::getColumnName).collect(Collectors.toList()); - Map result = baseDao.selectPersonType(columns, personData.getCustomerId(), tableName,formDTO.getUserId()); + Map result = baseDao.selectPersonType(columns, personData.getCustomerId(), tableName, formDTO.getUserId()); list.forEach(l -> { - result.forEach((k,v) -> { - if (l.getColumnName().equals(k) && v.equals(NumConstant.ONE_STR)){ + result.forEach((k, v) -> { + if (l.getColumnName().equals(k) && v.equals(NumConstant.ONE_STR)) { personCategoryList.add(l.getLabel()); } }); @@ -863,7 +864,6 @@ public class IcResiUserServiceImpl extends BaseServiceImpl pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.searchByName(formDTO.getName(), formDTO.getColumnName(),staffInfo.getAgencyId(), no)); List result = pageInfo.getList(); - if (CollectionUtils.isEmpty(result)){ + if (CollectionUtils.isEmpty(result)) { return new PageData<>(new ArrayList<>(), pageInfo.getTotal()); } // 查询小区,楼号,网格 Result> gridResult = govOrgOpenFeignClient.getGridListByGridIds(result.stream().map(SearchByNameResultDTO::getGridId).collect(Collectors.toList())); if (!gridResult.success()) { - throw new RenException(gridResult.getCode(),gridResult.getMsg()); + throw new RenException(gridResult.getCode(), gridResult.getMsg()); } Map gridMap = gridResult.getData().stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, AllGridsByUserIdResultDTO::getGridName)); Result> neighborHoodResult = govOrgOpenFeignClient.getListByIds(result.stream().map(SearchByNameResultDTO::getNeighborHoodId).collect(Collectors.toList())); if (!neighborHoodResult.success()) { - throw new RenException(neighborHoodResult.getCode(),neighborHoodResult.getMsg()); + throw new RenException(neighborHoodResult.getCode(), neighborHoodResult.getMsg()); } Map neighborHoodMap = neighborHoodResult.getData().stream().collect(Collectors.toMap(IcNeighborHoodDTO::getId, IcNeighborHoodDTO::getNeighborHoodName)); Result> buildResult = govOrgOpenFeignClient.buildingListByIds(result.stream().map(SearchByNameResultDTO::getBuildId).collect(Collectors.toList())); if (!buildResult.success()) { - throw new RenException(buildResult.getCode(),buildResult.getMsg()); + throw new RenException(buildResult.getCode(), buildResult.getMsg()); } Map buildMap = buildResult.getData().stream().collect(Collectors.toMap(BuildingResultDTO::getBuildingId, BuildingResultDTO::getBuildingName)); AtomicInteger i = new AtomicInteger(NumConstant.ONE); @@ -911,8 +911,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl { - if (o instanceof java.sql.Date){ - o = DateUtils.format(((Date) o),DateUtils.DATE_PATTERN); - }else if (o instanceof java.sql.Timestamp){ - o = DateUtils.format(new Date(((Timestamp) o).getTime()),DateUtils.DATE_TIME_PATTERN); + resiUser.forEach((k, o) -> { + if (o instanceof java.sql.Date) { + o = DateUtils.format(((Date) o), DateUtils.DATE_PATTERN); + } else if (o instanceof java.sql.Timestamp) { + o = DateUtils.format(new Date(((Timestamp) o).getTime()), DateUtils.DATE_TIME_PATTERN); } - resiUser.put(k,o); + resiUser.put(k, o); }); //当前条数据原始的id值 resiUser - Map originalConditionMap = new ConcurrentHashMap<>(); - formItemMap.getItemMap().values().parallelStream().forEach(e->{ + Map originalConditionMap = new ConcurrentHashMap<>(); + formItemMap.getItemMap().values().parallelStream().forEach(e -> { String columnName = getColumnName(e); Object temp = resiUser.get(columnName); String vauleStr = temp == null ? StrConstant.EPMETY_STR : temp.toString(); - originalConditionMap.putIfAbsent(columnName,vauleStr); + originalConditionMap.putIfAbsent(columnName, vauleStr); if (Constant.OPITON_SOURCE_REMOTE.equals(e.getOptionSourceType()) && StringUtils.isNotBlank(vauleStr)) { - putRemoteValue(formItemMap.getRemoteItemConditionMap().get(e.getItemId()), currentStaffAgencyId, resiUser,originalConditionMap, e, columnName, vauleStr); + putRemoteValue(formItemMap.getRemoteItemConditionMap().get(e.getItemId()), currentStaffAgencyId, resiUser, originalConditionMap, e, columnName, vauleStr); } else { putOptionValue(resiUser, e, columnName, vauleStr); } @@ -963,14 +962,14 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> remoteOptionCacheMap = new HashMap<>(); + private static Map> remoteOptionCacheMap = new HashMap<>(); + private void putRemoteValue(Set conditionItemSet, String currentStaffAgencyId, Map map, Map originalConditionMap, FormItemResult e, String columnName, String vauleStr) { try { Map columnWrappers = new HashMap<>(); - if (e.getOptionSourceValue().contains(StrConstant.QUESTION_MARK)){ + if (e.getOptionSourceValue().contains(StrConstant.QUESTION_MARK)) { for (FormItemResult o : conditionItemSet) { String column = getColumnName(o); Object conditionValue = originalConditionMap.getOrDefault(column, map.get(column)); - originalConditionMap.putIfAbsent(column,conditionValue.toString()); + originalConditionMap.putIfAbsent(column, conditionValue.toString()); IcResiUserImportServiceImpl.ColumnWrapper value = new IcResiUserImportServiceImpl.ColumnWrapper(); value.setColValue(conditionValue.toString()); columnWrappers.put(o.getItemId(), value); @@ -1004,10 +1004,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl cache = remoteOptionCacheMap.getOrDefault(e.getItemId(), CacheBuilder.newBuilder().maximumSize(NumConstant.FIVE_HUNDRED).build()); - remoteOptionCacheMap.putIfAbsent(e.getItemId(),cache); + remoteOptionCacheMap.putIfAbsent(e.getItemId(), cache); String cacheValue = cache.getIfPresent(vauleStr); - if (StringUtils.isNotBlank(cacheValue)){ - map.put(columnName,cacheValue); + if (StringUtils.isNotBlank(cacheValue)) { + map.put(columnName, cacheValue); } else { String[] parts = icResiUserImportService.splitOptionSourceUrl(e.getOptionSourceValue()); @@ -1019,7 +1019,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl queryDemandUsers(DemandUserFormDTO formDTO) { - return baseDao.selectDemandUsers(formDTO.getAgencyId(),formDTO.getGridId(),formDTO.getName()); + return baseDao.selectDemandUsers(formDTO.getAgencyId(), formDTO.getGridId(), formDTO.getName()); } /** @@ -1131,11 +1131,11 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> configListResult = operCustomizeOpenFeignClient.getCustomerCategoryShowAndWarnList(tokenDto.getCustomerId()); - if (!configListResult.success()){ + if (!configListResult.success()) { throw new EpmetException("查询居民分类配置失败..."); } PersonWarnRightListResultDTO result = new PersonWarnRightListResultDTO(); - if (CollectionUtils.isEmpty(configListResult.getData())){ + if (CollectionUtils.isEmpty(configListResult.getData())) { return result; } List configListOrigin = configListResult.getData(); List configList = new ArrayList<>(); - if (StringUtils.isNotBlank(formDTO.getCategoryCode())){ + if (StringUtils.isNotBlank(formDTO.getCategoryCode())) { for (CustomerCategoryShowAndWarnListResultDTO c : configListOrigin) { - if (c.getColumnName().equals(formDTO.getCategoryCode())){ + if (c.getColumnName().equals(formDTO.getCategoryCode())) { configList.add(c); } } - }else { + } else { configList = configListOrigin; } List finalConfigList = configList; @@ -1238,8 +1238,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl userList = disposeCategory(list, configList); - Result> houseInfosResult = govOrgOpenFeignClient.queryListHouseInfo(userList.stream().distinct().map(m -> m.getHomeId()).collect(Collectors.toSet()),tokenDto.getCustomerId()); - if (!houseInfosResult.success()){ + Result> houseInfosResult = govOrgOpenFeignClient.queryListHouseInfo(userList.stream().distinct().map(m -> m.getHomeId()).collect(Collectors.toSet()), tokenDto.getCustomerId()); + if (!houseInfosResult.success()) { throw new EpmetException("查询房屋信息失败..."); } List houseInfos = houseInfosResult.getData(); @@ -1257,6 +1257,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl houseIds = new HashSet<>(); List houseIdList = list.stream().map(EpidemicPreventionResultDTO::getHomeId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList()); houseIds.addAll(houseIdList); - Result> houseInfoRes=govOrgOpenFeignClient.queryListHouseInfo(houseIds,formDTO.getCustomerId()); + Result> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, formDTO.getCustomerId()); List houseInfoDTOList = houseInfoRes.success() && !CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>(); Map houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity())); list.forEach(item -> { @@ -1319,9 +1320,9 @@ public class IcResiUserServiceImpl extends BaseServiceImpl list = new ArrayList<>(); - if (formDTO.getAttentionType().equals(NumConstant.TWO)){ + if (formDTO.getAttentionType().equals(NumConstant.TWO)) { list = baseDao.natList(formDTO); - }else if (formDTO.getAttentionType().equals(NumConstant.ONE)){ + } else if (formDTO.getAttentionType().equals(NumConstant.ONE)) { list = baseDao.vaccineList(formDTO); } Set homeIds = list.stream().filter(m -> StringUtils.isNotBlank(m.getIdCard())).map(m -> m.getHomeId()).distinct().collect(Collectors.toSet()); @@ -1403,31 +1404,31 @@ public class IcResiUserServiceImpl extends BaseServiceImpl disposeCategory(List> list,List configList){ + public List disposeCategory(List> list, List configList) { List userList = new ArrayList<>(); list.forEach(l -> { PersonWarnRightListResultDTO.PersonWarnRightList dto = ConvertUtils.mapToEntity(l, PersonWarnRightListResultDTO.PersonWarnRightList.class); // 分类名字 List types = new ArrayList<>(); configList.forEach(c -> { - l.forEach((k,v) -> { - if (c.getColumnName().equals(k) && null != v && v.equals(NumConstant.ONE_STR)){ + l.forEach((k, v) -> { + if (c.getColumnName().equals(k) && null != v && v.equals(NumConstant.ONE_STR)) { types.add(c.getLabel()); } }); }); // 只显示有类别的居民 - if (CollectionUtils.isNotEmpty(types)){ + if (CollectionUtils.isNotEmpty(types)) { dto.setType(types); GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId()); - if (null == gridInfo){ - throw new EpmetException(String.format("查询网格信息失败%s",dto.getGridId())); + if (null == gridInfo) { + throw new EpmetException(String.format("查询网格信息失败%s", dto.getGridId())); } dto.setGridName(gridInfo.getGridNamePath()); userList.add(dto); @@ -1438,6 +1439,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl listHomeUserBrief(String houseId, String customerId) { + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + lqw.eq(IcResiUserEntity::getCustomerId, customerId) + .eq(IcResiUserEntity::getHomeId, houseId) + .select( + IcResiUserEntity::getId, + IcResiUserEntity::getHomeId, + IcResiUserEntity::getName, + IcResiUserEntity::getIsParty, + IcResiUserEntity::getYhzgx, + IcResiUserEntity::getGender, + IcResiUserEntity::getMobile, + IcResiUserEntity::getIdCard, + IcResiUserEntity::getBirthday + ) + .orderByAsc(IcResiUserEntity::getYhzgx); + + List homeUserList = baseDao.selectList(lqw); + if (CollUtil.isEmpty(homeUserList)) { + return Lists.newArrayList(); + } + homeUserList.forEach( + item -> item.setYhzgx(RelationshipEnum.getEnum(item.getYhzgx()).getName()) + ); + + return ConvertUtils.sourceToTarget(homeUserList, HomeUserBriefResultDTO.class); + } }