|
|
@ -17,6 +17,7 @@ |
|
|
|
|
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
@ -54,6 +55,7 @@ import com.epmet.service.IcResiDemandDictService; |
|
|
|
import com.epmet.service.IcUserDemandRecService; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -71,6 +73,7 @@ import java.util.stream.Collectors; |
|
|
|
* @author generator generator@elink-cn.com |
|
|
|
* @since v1.0.0 2021-11-19 |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecDao, IcUserDemandRecEntity> implements IcUserDemandRecService { |
|
|
|
@Autowired |
|
|
@ -722,6 +725,8 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
}); |
|
|
|
LegendDTO unfinishLegend = new LegendDTO("unfinished", "未完成"); |
|
|
|
legend.add(unfinishLegend); |
|
|
|
|
|
|
|
log.info("阶段性胜利1:"+ JSON.toJSONString(legend)); |
|
|
|
// 3、传进来的是组织id的话,查询出全路径
|
|
|
|
if("agency".equals(formDTO.getOrgType())){ |
|
|
|
if(NumConstant.ZERO_STR.equals(formDTO.getPid())){ |
|
|
@ -737,8 +742,18 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 4、查询出有数据的一级分类
|
|
|
|
// 4、sql计算出detail
|
|
|
|
//4、构造最后的反参
|
|
|
|
List<CategoryAnalysisDTO> list=new ArrayList<>(); |
|
|
|
// firstCategoryList是所有的一级分类字典
|
|
|
|
firstCategoryList.forEach(firstCategory->{ |
|
|
|
CategoryAnalysisDTO categoryAnalysisDTO=new CategoryAnalysisDTO(firstCategory.getValue(),firstCategory.getLabel(),NumConstant.ZERO,Collections.EMPTY_LIST); |
|
|
|
categoryAnalysisDTO.setDetail(constructDefaultDetail(legend)); |
|
|
|
list.add(categoryAnalysisDTO); |
|
|
|
}); |
|
|
|
|
|
|
|
log.info("阶段性胜利2:"+ JSON.toJSONString(list)); |
|
|
|
|
|
|
|
// 5、查询出有数据的一级分类,sql计算出detail
|
|
|
|
List<CategoryAnalysisDTO> haveDemandList=baseDao.selectListCategoryAnalysisDTO(firstCategoryList, |
|
|
|
formDTO.getCusotmerId(), |
|
|
|
formDTO.getOrgId(), |
|
|
@ -747,25 +762,32 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
formDTO.getStartDateId(), |
|
|
|
formDTO.getEndDateId()); |
|
|
|
if(!CollectionUtils.isEmpty(haveDemandList)){ |
|
|
|
for(CategoryAnalysisDTO analysisRes:haveDemandList){ |
|
|
|
//todo
|
|
|
|
//List<CategoryAnalysisDetail> detail=
|
|
|
|
log.info("阶段性胜利3:"+ JSON.toJSONString(haveDemandList)); |
|
|
|
Map<String, CategoryAnalysisDTO> map = haveDemandList.stream().filter(temp -> CollectionUtils.isNotEmpty(temp.getDetail())).collect(Collectors.toMap(CategoryAnalysisDTO::getCategoryCode, dto -> dto)); |
|
|
|
if(MapUtils.isNotEmpty(map)){ |
|
|
|
for(CategoryAnalysisDTO result:list){ |
|
|
|
if (map.containsKey(result.getCategoryCode()) && null != map.get(result.getCategoryCode())) { |
|
|
|
result.setDetail(map.get(result.getCategoryCode()).getDetail()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//构造最后的反参
|
|
|
|
List<CategoryAnalysisDTO> list=new ArrayList<>(); |
|
|
|
// firstCategoryList是所有的一级分类字典
|
|
|
|
firstCategoryList.forEach(firstCategory->{ |
|
|
|
CategoryAnalysisDTO categoryAnalysisDTO=new CategoryAnalysisDTO(firstCategory.getValue(),firstCategory.getLabel(),NumConstant.ZERO,Collections.EMPTY_LIST); |
|
|
|
list.add(categoryAnalysisDTO); |
|
|
|
}); |
|
|
|
|
|
|
|
//返回结果,也不知道对不对
|
|
|
|
CategoryAnalysisResDTO result=new CategoryAnalysisResDTO(); |
|
|
|
result.setLegend(legend); |
|
|
|
result.setCategoryList(list); |
|
|
|
return null; |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
private List<CategoryAnalysisDetail> constructDefaultDetail(List<LegendDTO> legend) { |
|
|
|
List<CategoryAnalysisDetail> l = new ArrayList<>(); |
|
|
|
legend.forEach(legendDTO -> { |
|
|
|
CategoryAnalysisDetail d = ConvertUtils.sourceToTarget(legendDTO, CategoryAnalysisDetail.class); |
|
|
|
d.setServiceDemandTotal(NumConstant.ZERO); |
|
|
|
d.setTotalService(NumConstant.ZERO); |
|
|
|
}); |
|
|
|
return l; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|