Browse Source

Merge remote-tracking branch 'origin/dev'

dev
yinzuomei 4 years ago
parent
commit
3e1a11a89b
  1. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/UserDemandNameQueryFormDTO.java
  2. 36
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/IcResiDemandDictDTO.java
  3. 3
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java
  4. 3
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java
  5. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcResiDemandDictController.java
  6. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcResiDemandDictDao.java
  7. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcResiDemandDictService.java
  8. 11
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java
  9. 12
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml
  10. 43
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

2
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) @NotBlank(message = "客户id不能为空",groups =AddUserInternalGroup.class)
private String customerId; private String customerId;
@NotEmpty(message = "分类编码不能为空",groups =AddUserInternalGroup.class) // @NotEmpty(message = "分类编码不能为空",groups =AddUserInternalGroup.class)
private Set<String> codeSet; private Set<String> codeSet;
} }

36
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;
}

3
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.CommonCustomerFormDTO;
import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO;
import com.epmet.dto.form.resi.VolunteerCommonFormDTO; import com.epmet.dto.form.resi.VolunteerCommonFormDTO;
import com.epmet.dto.result.demand.IcResiDemandDictDTO;
import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO; import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO;
import com.epmet.feign.fallback.EpmetHeartOpenFeignClientFallbackFactory; import com.epmet.feign.fallback.EpmetHeartOpenFeignClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
@ -59,7 +60,7 @@ public interface EpmetHeartOpenFeignClient {
Result<VolunteerInfoDTO> queryUserVolunteerInfo(@PathVariable("userId") String userId); Result<VolunteerInfoDTO> queryUserVolunteerInfo(@PathVariable("userId") String userId);
@PostMapping("/heart/icresidemanddict/demangnames") @PostMapping("/heart/icresidemanddict/demangnames")
Result<String> queryDemandNames(@RequestBody UserDemandNameQueryFormDTO formDTO); Result<List<IcResiDemandDictDTO>> queryDemandNames(@RequestBody UserDemandNameQueryFormDTO formDTO);
/** /**
* 分页查询志愿者列表 * 分页查询志愿者列表

3
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.CommonCustomerFormDTO;
import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO;
import com.epmet.dto.form.resi.VolunteerCommonFormDTO; import com.epmet.dto.form.resi.VolunteerCommonFormDTO;
import com.epmet.dto.result.demand.IcResiDemandDictDTO;
import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO; import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO;
import com.epmet.feign.EpmetHeartOpenFeignClient; import com.epmet.feign.EpmetHeartOpenFeignClient;
@ -53,7 +54,7 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli
} }
@Override @Override
public Result<String> queryDemandNames(UserDemandNameQueryFormDTO formDTO) { public Result<List<IcResiDemandDictDTO>> queryDemandNames(UserDemandNameQueryFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "queryDemandNames", formDTO); return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "queryDemandNames", formDTO);
} }

6
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.form.demand.*;
import com.epmet.dto.result.demand.DemandCategoryResDTO; import com.epmet.dto.result.demand.DemandCategoryResDTO;
import com.epmet.dto.result.demand.DemandPageResDTO; import com.epmet.dto.result.demand.DemandPageResDTO;
import com.epmet.dto.result.demand.IcResiDemandDictDTO;
import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.service.IcResiDemandDictService; import com.epmet.service.IcResiDemandDictService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -153,11 +154,12 @@ public class IcResiDemandDictController {
* @return * @return
*/ */
@PostMapping("demangnames") @PostMapping("demangnames")
public Result<String> queryDemandNames(@RequestBody UserDemandNameQueryFormDTO formDTO){ public Result<List<IcResiDemandDictDTO>> queryDemandNames(@RequestBody UserDemandNameQueryFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO,UserDemandNameQueryFormDTO.AddUserInternalGroup.class); ValidatorUtils.validateEntity(formDTO,UserDemandNameQueryFormDTO.AddUserInternalGroup.class);
return icResiDemandDictService.queryDemandNames(formDTO); return new Result<List<IcResiDemandDictDTO>>().ok(icResiDemandDictService.queryDemandNames(formDTO));
} }
/** /**
* 居民需求查询条件一级分类列表 0 * 居民需求查询条件一级分类列表 0
* 区域化党建单位服务事项下拉框 1010 * 区域化党建单位服务事项下拉框 1010

3
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.commons.tools.dto.result.OptionResultDTO;
import com.epmet.dto.result.demand.DemandCategoryResDTO; import com.epmet.dto.result.demand.DemandCategoryResDTO;
import com.epmet.dto.result.demand.DemandPageResDTO; import com.epmet.dto.result.demand.DemandPageResDTO;
import com.epmet.dto.result.demand.IcResiDemandDictDTO;
import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.entity.IcResiDemandDictEntity; import com.epmet.entity.IcResiDemandDictEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -40,7 +41,7 @@ public interface IcResiDemandDictDao extends BaseDao<IcResiDemandDictEntity> {
List<OptionResultDTO> selectDemandOptions(@Param("customerId") String customerId,@Param("usableFlagFormValue") String usableFlagFormValue); List<OptionResultDTO> selectDemandOptions(@Param("customerId") String customerId,@Param("usableFlagFormValue") String usableFlagFormValue);
List<OptionResultDTO> selectChildDemands(@Param("customerId")String customerId, @Param("parentCode") String parentCode,@Param("usableFlagFormValue") String usableFlagFormValue); List<OptionResultDTO> selectChildDemands(@Param("customerId")String customerId, @Param("parentCode") String parentCode,@Param("usableFlagFormValue") String usableFlagFormValue);
String selectCategoryNames(@Param("customerId") String customerId,@Param("codeSet") Set<String> codeSet); List<IcResiDemandDictDTO> selectCategoryNames(@Param("customerId") String customerId,@Param("codeSet") Set<String> codeSet);
List<OptionDTO> selectByPCode(@Param("pcode") String pcode, List<OptionDTO> selectByPCode(@Param("pcode") String pcode,
@Param("customerId") String customerId, @Param("customerId") String customerId,

3
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.form.demand.*;
import com.epmet.dto.result.demand.DemandCategoryResDTO; import com.epmet.dto.result.demand.DemandCategoryResDTO;
import com.epmet.dto.result.demand.DemandPageResDTO; import com.epmet.dto.result.demand.DemandPageResDTO;
import com.epmet.dto.result.demand.IcResiDemandDictDTO;
import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.entity.IcResiDemandDictEntity; import com.epmet.entity.IcResiDemandDictEntity;
@ -93,7 +94,7 @@ public interface IcResiDemandDictService extends BaseService<IcResiDemandDictEnt
* @param formDTO * @param formDTO
* @return * @return
*/ */
Result<String> queryDemandNames(UserDemandNameQueryFormDTO formDTO); List<IcResiDemandDictDTO> queryDemandNames(UserDemandNameQueryFormDTO formDTO);
List<OptionDTO> querySubCodeList(SubCodeFormDTO formDTO); List<OptionDTO> querySubCodeList(SubCodeFormDTO formDTO);

11
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.exception.RenException;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcResiDemandDictDao; import com.epmet.dao.IcResiDemandDictDao;
import com.epmet.dto.form.demand.*; import com.epmet.dto.form.demand.*;
import com.epmet.dto.result.demand.DemandCategoryResDTO; import com.epmet.dto.result.demand.DemandCategoryResDTO;
import com.epmet.dto.result.demand.DemandPageResDTO; import com.epmet.dto.result.demand.DemandPageResDTO;
import com.epmet.dto.result.demand.IcResiDemandDictDTO;
import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.entity.IcResiDemandDictEntity; import com.epmet.entity.IcResiDemandDictEntity;
import com.epmet.service.IcResiDemandDictService; import com.epmet.service.IcResiDemandDictService;
@ -207,8 +207,13 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl<IcResiDemandDic
} }
@Override @Override
public Result<String> queryDemandNames(UserDemandNameQueryFormDTO formDTO) { public List<IcResiDemandDictDTO> queryDemandNames(UserDemandNameQueryFormDTO formDTO) {
return new Result<String>().ok(baseDao.selectCategoryNames(formDTO.getCustomerId(),formDTO.getCodeSet())); List<IcResiDemandDictDTO> list=baseDao.selectCategoryNames(formDTO.getCustomerId(),formDTO.getCodeSet());
if(CollectionUtils.isEmpty(list)){
log.warn("当前客户下未配置需求分类");
return new ArrayList<>();
}
return list;
} }
@Override @Override

12
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml

@ -72,11 +72,19 @@
</select> </select>
<select id="selectCategoryNames" parameterType="map" resultType="java.lang.String"> <select id="selectCategoryNames" parameterType="map" resultType="com.epmet.dto.result.demand.IcResiDemandDictDTO">
SELECT 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 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 WHERE
m.DEL_FLAG = '0' m.DEL_FLAG = '0'
AND m.CUSTOMER_ID = #{customerId} AND m.CUSTOMER_ID = #{customerId}

43
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -53,6 +53,7 @@ import com.epmet.dto.*;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.dto.result.demand.IcResiDemandDictDTO;
import com.epmet.entity.IcResiUserEntity; import com.epmet.entity.IcResiUserEntity;
import com.epmet.excel.support.ExportResiUserItemDTO; import com.epmet.excel.support.ExportResiUserItemDTO;
import com.epmet.feign.*; import com.epmet.feign.*;
@ -341,14 +342,14 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
// 查询列表展示项需要用到哪些子表 // 查询列表展示项需要用到哪些子表
Result<List<SubTableJoinDTO>> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO1); Result<List<SubTableJoinDTO>> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO1);
List<SubTableJoinDTO> subTables =subTablesRes.getData(); List<SubTableJoinDTO> subTables =subTablesRes.getData();
log.info("1、所有的子表subTables:"+JSON.toJSONString(subTables,true)); // log.info("1、所有的子表subTables:"+JSON.toJSONString(subTables,true));
//关联哪些子表:查询条件用到的表名+查询的列对应的表 并集去重 //关联哪些子表:查询条件用到的表名+查询的列对应的表 并集去重
Set<String> whereConditionTables=formDTO.getConditions().stream().map(ResiUserQueryValueDTO::getTableName).collect(Collectors.toSet()); Set<String> whereConditionTables=formDTO.getConditions().stream().map(ResiUserQueryValueDTO::getTableName).collect(Collectors.toSet());
Set<String> tables=new HashSet<>(); Set<String> tables=new HashSet<>();
tables.addAll(whereConditionTables); tables.addAll(whereConditionTables);
tables.addAll(resultColumnTables); tables.addAll(resultColumnTables);
log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true)); // log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true));
//最终关联的子表对应的sql: //最终关联的子表对应的sql:
List<String> finalSubTables =new ArrayList<>(); List<String> finalSubTables =new ArrayList<>();
subTables.forEach(subTable->{ subTables.forEach(subTable->{
@ -403,6 +404,16 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
Result<List<HouseInfoDTO>> houseInfoRes=govOrgOpenFeignClient.queryListHouseInfo(houseIds); Result<List<HouseInfoDTO>> houseInfoRes=govOrgOpenFeignClient.queryListHouseInfo(houseIds);
List<HouseInfoDTO> houseInfoDTOList = houseInfoRes.success() && !CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>(); List<HouseInfoDTO> houseInfoDTOList = houseInfoRes.success() && !CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>();
Map<String, HouseInfoDTO> houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity())); Map<String, HouseInfoDTO> houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity()));
//查询需求分类字典
UserDemandNameQueryFormDTO userDemandNameQueryFormDTO=new UserDemandNameQueryFormDTO();
userDemandNameQueryFormDTO.setCustomerId(formDTO.getCustomerId());
Result<List<IcResiDemandDictDTO>> demandNameRes=heartOpenFeignClient.queryDemandNames(userDemandNameQueryFormDTO);
if(!demandNameRes.success()||CollectionUtils.isEmpty(demandNameRes.getData())){
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"获取需求分类字典表数据异常",EpmetErrorCode.SERVER_ERROR.getMsg());
}
Map<String,IcResiDemandDictDTO> demandDictMap=demandNameRes.getData().stream().collect(Collectors.toMap(IcResiDemandDictDTO::getCategoryCode,Function.identity()));
for (Map<String, Object> resultMap : list) { for (Map<String, Object> resultMap : list) {
String gridIdValue = null != resultMap.get(UserConstant.GRID_ID) ? resultMap.get(UserConstant.GRID_ID).toString() : StrConstant.EPMETY_STR; String gridIdValue = null != resultMap.get(UserConstant.GRID_ID) ? resultMap.get(UserConstant.GRID_ID).toString() : StrConstant.EPMETY_STR;
resultMap.put("GRID_ID_VALUE", gridIdValue); resultMap.put("GRID_ID_VALUE", gridIdValue);
@ -439,7 +450,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
} }
resultMap.put(UserConstant.HOME_ID, neighBorName.concat(buildName).concat(unitName).concat(doorName)); resultMap.put(UserConstant.HOME_ID, neighBorName.concat(buildName).concat(unitName).concat(doorName));
resultMap.put("CATEGORY_NAME",queryUserDemandName(formDTO.getCustomerId(),(String) resultMap.get("icResiUserId"))); resultMap.put("CATEGORY_NAME",queryUserDemandName((String) resultMap.get("icResiUserId"),demandDictMap));
} }
if (resultMap.containsKey(UserConstant.GENDER)) { if (resultMap.containsKey(UserConstant.GENDER)) {
@ -457,32 +468,34 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
return new PageData<>(pageInfo.getList(), pageInfo.getTotal()); return new PageData<>(pageInfo.getList(), pageInfo.getTotal());
} }
private String queryUserDemandName(String customerId,String icResiUserId) { private String queryUserDemandName(String icResiUserId,Map<String,IcResiDemandDictDTO> demandDictMap) {
// epmet_user.ic_resi_demand.category_code存储的值为 分类编码的全路径,eg:
// 1003,10030002
// 1012,10120003
// 1016,10160003
Set<String> demandCodePath=baseDao.selectUserDemandCode(icResiUserId); Set<String> demandCodePath=baseDao.selectUserDemandCode(icResiUserId);
if(CollectionUtils.isEmpty(demandCodePath)){ if(CollectionUtils.isEmpty(demandCodePath)){
return StrConstant.EPMETY_STR; return StrConstant.EPMETY_STR;
} }
Set<String> codeSet=new HashSet<>(); List<String> nameList=new ArrayList<>();
for(String codePath:demandCodePath){ for(String codePath:demandCodePath){
if(codePath.contains(StrConstant.COMMA)){ if(codePath.contains(StrConstant.COMMA)){
String[] codeAtt=codePath.split(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{ }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<String> demandNameRes=heartOpenFeignClient.queryDemandNames(userDemandNameQueryFormDTO);
if(demandNameRes.success()){
demandName=demandNameRes.getData();
} }
String demandName=String.join(StrConstant.COMMA_ZH,nameList);
return demandName; return demandName;
} }
/** /**
* 编辑页面显示居民信息详情 * 编辑页面显示居民信息详情
* *

Loading…
Cancel
Save