diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/UserDemandNameQueryFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/UserDemandNameQueryFormDTO.java index 2a0141713f..deae2c3f43 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/UserDemandNameQueryFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/UserDemandNameQueryFormDTO.java @@ -16,6 +16,6 @@ public class UserDemandNameQueryFormDTO implements Serializable { @NotBlank(message = "客户id不能为空",groups =AddUserInternalGroup.class) private String customerId; - @NotEmpty(message = "分类编码不能为空",groups =AddUserInternalGroup.class) + // @NotEmpty(message = "分类编码不能为空",groups =AddUserInternalGroup.class) private Set codeSet; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/IcResiDemandDictDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/IcResiDemandDictDTO.java new file mode 100644 index 0000000000..ec6f715dc1 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/IcResiDemandDictDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.result.demand; + +import lombok.Data; + +import java.io.Serializable; + + +@Data +public class IcResiDemandDictDTO implements Serializable { + /** + * 客户Id customer.id + */ + private String customerId; + + /** + * 父级 + */ + private String parentCode; + private String parentName; + + /** + * 字典值 + */ + private String categoryCode; + + /** + * 字典描述 + */ + private String categoryName; + + /** + * 级别 + */ + private Integer level; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java index ffce4482d0..1a3f20439a 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java @@ -8,6 +8,7 @@ import com.epmet.dto.form.AutoEvaluateDemandFormDTO; import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.form.resi.VolunteerCommonFormDTO; +import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO; import com.epmet.feign.fallback.EpmetHeartOpenFeignClientFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; @@ -24,7 +25,7 @@ import java.util.List; * @date 2020/6/4 13:25 */ @FeignClient(name = ServiceConstant.EPMET_HEART_SERVER, fallbackFactory = EpmetHeartOpenFeignClientFallbackFactory.class) -//@FeignClient(name = ServiceConstant.EPMET_HEART_SERVER, fallbackFactory = EpmetHeartOpenFeignClientFallbackFactory.class, url = "http://localhost:8111") +// @FeignClient(name = ServiceConstant.EPMET_HEART_SERVER, fallbackFactory = EpmetHeartOpenFeignClientFallbackFactory.class, url = "http://localhost:8111") public interface EpmetHeartOpenFeignClient { /** @@ -59,7 +60,7 @@ public interface EpmetHeartOpenFeignClient { Result queryUserVolunteerInfo(@PathVariable("userId") String userId); @PostMapping("/heart/icresidemanddict/demangnames") - Result queryDemandNames(@RequestBody UserDemandNameQueryFormDTO formDTO); + Result> queryDemandNames(@RequestBody UserDemandNameQueryFormDTO formDTO); /** * 分页查询志愿者列表 diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java index db83d85a27..aab5bdb70d 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java @@ -9,6 +9,7 @@ import com.epmet.dto.form.AutoEvaluateDemandFormDTO; import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.form.resi.VolunteerCommonFormDTO; +import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO; import com.epmet.feign.EpmetHeartOpenFeignClient; @@ -53,7 +54,7 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli } @Override - public Result queryDemandNames(UserDemandNameQueryFormDTO formDTO) { + public Result> queryDemandNames(UserDemandNameQueryFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "queryDemandNames", formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcResiDemandDictController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcResiDemandDictController.java index 2fb6ad864f..15c61893ea 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcResiDemandDictController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcResiDemandDictController.java @@ -29,6 +29,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.demand.*; import com.epmet.dto.result.demand.DemandCategoryResDTO; import com.epmet.dto.result.demand.DemandPageResDTO; +import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.service.IcResiDemandDictService; import org.springframework.beans.factory.annotation.Autowired; @@ -154,11 +155,12 @@ public class IcResiDemandDictController { * @return */ @PostMapping("demangnames") - public Result queryDemandNames(@RequestBody UserDemandNameQueryFormDTO formDTO){ + public Result> queryDemandNames(@RequestBody UserDemandNameQueryFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO,UserDemandNameQueryFormDTO.AddUserInternalGroup.class); - return icResiDemandDictService.queryDemandNames(formDTO); + return new Result>().ok(icResiDemandDictService.queryDemandNames(formDTO)); } + /** * 居民需求查询条件:一级分类列表 0 * 区域化党建单位:服务事项下拉框 1010 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcResiDemandDictDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcResiDemandDictDao.java index 73ad65dcd6..95d9227ac3 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcResiDemandDictDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcResiDemandDictDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.dto.result.demand.DemandCategoryResDTO; import com.epmet.dto.result.demand.DemandPageResDTO; +import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.entity.IcResiDemandDictEntity; import org.apache.ibatis.annotations.Mapper; @@ -40,7 +41,7 @@ public interface IcResiDemandDictDao extends BaseDao { List selectDemandOptions(@Param("customerId") String customerId,@Param("usableFlagFormValue") String usableFlagFormValue); List selectChildDemands(@Param("customerId")String customerId, @Param("parentCode") String parentCode,@Param("usableFlagFormValue") String usableFlagFormValue); - String selectCategoryNames(@Param("customerId") String customerId,@Param("codeSet") Set codeSet); + List selectCategoryNames(@Param("customerId") String customerId,@Param("codeSet") Set codeSet); List selectByPCode(@Param("pcode") String pcode, @Param("customerId") String customerId, diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcResiDemandDictService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcResiDemandDictService.java index b3adf2301c..ce861497cf 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcResiDemandDictService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcResiDemandDictService.java @@ -24,6 +24,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.demand.*; import com.epmet.dto.result.demand.DemandCategoryResDTO; import com.epmet.dto.result.demand.DemandPageResDTO; +import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.entity.IcResiDemandDictEntity; @@ -93,7 +94,7 @@ public interface IcResiDemandDictService extends BaseService queryDemandNames(UserDemandNameQueryFormDTO formDTO); + List queryDemandNames(UserDemandNameQueryFormDTO formDTO); List querySubCodeList(SubCodeFormDTO formDTO); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java index 2780e27b38..c6d0e0946f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java @@ -29,11 +29,11 @@ import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IcResiDemandDictDao; import com.epmet.dto.form.demand.*; import com.epmet.dto.result.demand.DemandCategoryResDTO; import com.epmet.dto.result.demand.DemandPageResDTO; +import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.demand.OptionDTO; import com.epmet.entity.IcResiDemandDictEntity; import com.epmet.service.IcResiDemandDictService; @@ -207,8 +207,13 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl queryDemandNames(UserDemandNameQueryFormDTO formDTO) { - return new Result().ok(baseDao.selectCategoryNames(formDTO.getCustomerId(),formDTO.getCodeSet())); + public List queryDemandNames(UserDemandNameQueryFormDTO formDTO) { + List list=baseDao.selectCategoryNames(formDTO.getCustomerId(),formDTO.getCodeSet()); + if(CollectionUtils.isEmpty(list)){ + log.warn("当前客户下未配置需求分类"); + return new ArrayList<>(); + } + return list; } @Override diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml index 0d7a8dc0a7..55bf6ef6a5 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml @@ -72,11 +72,19 @@ - SELECT - GROUP_CONCAT(m.CATEGORY_NAME) + m.CUSTOMER_ID, + m.CATEGORY_CODE, + m.CATEGORY_NAME, + m.LEVEL, + m.PARENT_CODE, + IFNULL(p.CATEGORY_NAME,'') as parentName FROM - ic_resi_demand_dict m + ic_resi_demand_dict m + left join ic_resi_demand_dict p + on(m.PARENT_CODE=p.CATEGORY_CODE + and p.CUSTOMER_ID=#{customerId}) WHERE m.DEL_FLAG = '0' AND m.CUSTOMER_ID = #{customerId} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java index 73044f21c4..1fddb41280 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java @@ -78,6 +78,7 @@ public interface UserResiInfoDao extends BaseDao { * @date 2020/5/11 11:18 */ IssueInitiatorResultDTO selectIssueInitiator(IssueInitiatorFormDTO formDTO); + IssueInitiatorResultDTO issueInitiatorByBaseInfo(IssueInitiatorFormDTO formDTO); /** * @param userId 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 fddb3f1f43..9a71e31e82 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,6 +54,7 @@ import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.result.*; +import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.entity.IcResiUserEntity; import com.epmet.entity.IcUserChangeDetailedEntity; import com.epmet.entity.IcUserChangeRecordEntity; @@ -499,14 +500,14 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO1); List subTables =subTablesRes.getData(); - log.info("1、所有的子表subTables:"+JSON.toJSONString(subTables,true)); + // log.info("1、所有的子表subTables:"+JSON.toJSONString(subTables,true)); //关联哪些子表:查询条件用到的表名+查询的列对应的表 并集去重 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)); + // log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true)); //最终关联的子表对应的sql: List finalSubTables =new ArrayList<>(); subTables.forEach(subTable->{ @@ -560,6 +561,16 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> 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.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()); + } + 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; resultMap.put("GRID_ID_VALUE", gridIdValue); @@ -596,7 +607,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl(pageInfo.getList(), pageInfo.getTotal()); } - private String queryUserDemandName(String customerId,String icResiUserId) { + 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)){ return StrConstant.EPMETY_STR; } - Set codeSet=new HashSet<>(); + List nameList=new ArrayList<>(); for(String codePath:demandCodePath){ if(codePath.contains(StrConstant.COMMA)){ String[] codeAtt=codePath.split(StrConstant.COMMA); - codeSet.add(codeAtt[codeAtt.length-1]); + String code=codeAtt[codeAtt.length-1]; + if(StringUtils.isNotBlank(code)&&demandDictMap.containsKey(code)){ + nameList.add(demandDictMap.get(code).getParentName()); + } }else{ - codeSet.add(codePath); + if(StringUtils.isNotBlank(codePath)&&demandDictMap.containsKey(codePath)){ + nameList.add(demandDictMap.get(codePath).getParentName()); + } } } - String demandName=""; -// String demandName=baseDao.selectCategoryNames(customerId,codeSet); - UserDemandNameQueryFormDTO userDemandNameQueryFormDTO=new UserDemandNameQueryFormDTO(); - userDemandNameQueryFormDTO.setCustomerId(customerId); - userDemandNameQueryFormDTO.setCodeSet(codeSet); - Result demandNameRes=heartOpenFeignClient.queryDemandNames(userDemandNameQueryFormDTO); - if(demandNameRes.success()){ - demandName=demandNameRes.getData(); - } + String demandName=String.join(StrConstant.COMMA_ZH,nameList); return demandName; } + /** * 编辑页面,显示居民信息详情 * diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java index 017a0469df..ee80c0809d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java @@ -387,7 +387,9 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl + +