Commit e15b8edc authored by 麻笑宇's avatar 麻笑宇

指标管理 安全追溯 / 当年主体单位隐患排名(Top10)代码提交

parent 5cfeee77
......@@ -137,10 +137,12 @@
FROM
tzs_safety_problem_tracing
WHERE
principal_unit_code IN
<foreach collection="unitCodeList" item="item" separator="," open="(" close=")">
principal_unit_code = #{item}
</foreach>
principal_unit_code IN (
<foreach collection="unitCodeList" item="item" separator=",">
#{item}
</foreach>
)
AND source_type_code = '2'
GROUP BY
principal_unit_code,
problem_type_code
......
package com.yeejoin.amos.boot.module.statistcs.biz.service.impl.ZBGLImpl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.UUID;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
......@@ -86,25 +87,42 @@ public class DnztdwyhpmServiceImpl implements IZBGLService {
@Override
public Page<Map<String, Object>> getPage(Page page,DPFilterParamForDetailDto dpFilterParamForDetailDto) {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamForDetailDto.getCityCode());
List<Map<String,Object>> result = regionModels.parallelStream().map(r -> {
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode()+"");
DPFilterParamForDetailDto dpFilterParamForDetailDtoNew = new DPFilterParamForDetailDto();
dpFilterParamForDetailDtoNew.setOrgCode(orgCode);
Map<String, Object> itemResult = new HashMap<>();
Page<Map<String,Object>> returnPage = zbglStatisticsMapper.getUnitByOrgCode(page,dpFilterParamForDetailDtoNew);
List<String> unitCodeList = new ArrayList<>();
for(int i = 0;i<returnPage.getRecords().size();i++){
unitCodeList.add(returnPage.getRecords().get(i).get("principalUnitCode").toString());
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamForDetailDto.getCityCode());
dpFilterParamForDetailDto.setOrgCode(orgCode);
Page<Map<String,Object>> returnPage = zbglStatisticsMapper.getUnitByOrgCode(page,dpFilterParamForDetailDto);
List<String> unitCodeList = new ArrayList<>();
Map<String,Map<String,Object>> unitMap = new HashMap<>();
for(int i = 0;i<returnPage.getRecords().size();i++){
unitMap.put(returnPage.getRecords().get(i).get("principalUnitCode").toString(),new HashMap<>());
unitCodeList.add(returnPage.getRecords().get(i).get("principalUnitCode").toString());
}
Map<String,Long> countMap = new HashMap<>();
if(!CollectionUtil.isEmpty(unitCodeList)) {
List<Map<String, Object>> list = zbglStatisticsMapper.getDNZTDWYHPMPageData(unitCodeList);
for (int i = 0; i < list.size(); i++) {
Map<String, Object> map = unitMap.get(list.get(i).get("principalUnitCode"));
map.put(list.get(i).get("problemTypeCode") + "", list.get(i).get("count"));
map.put("principalUnit", list.get(i).get("principalUnit"));
map.put("principalUnitCode", list.get(i).get("principalUnitCode"));
Long aLong = countMap.get(list.get(i).get("principalUnitCode"));
if (aLong == null) {
countMap.put(list.get(i).get("principalUnitCode").toString(), (Long) list.get(i).get("count"));
} else {
countMap.put(list.get(i).get("principalUnitCode").toString(), aLong + (Long) list.get(i).get("count"));
}
}
List<Map<String,Object>> list = zbglStatisticsMapper.getDNZTDWYHPMPageData(unitCodeList);
Long sum = 0L;
itemResult.put("sequenceNbr", UUID.fastUUID().toString());
return itemResult;
}).collect(Collectors.toList());
page.setRecords(result);
page.setTotal(result.size());
List<Map<String, Object>> resultList = new ArrayList();
unitMap.entrySet().forEach(item -> {
Map<String, Object> value = item.getValue();
value.entrySet().forEach(t -> {
if (!t.getKey().equals("principalUnit") && !t.getKey().equals("principalUnitCode")) {
t.setValue(t.getValue() + " / " + new BigDecimal(t.getValue() + "").divide(BigDecimal.valueOf(countMap.get(item.getValue().get("principalUnitCode"))), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).stripTrailingZeros().toPlainString() + "%");
}
});
resultList.add(value);
});
page.setRecords(resultList);
}
return page;
}
......@@ -116,12 +134,16 @@ public class DnztdwyhpmServiceImpl implements IZBGLService {
Map<String,String> map = new HashMap<>();
map.put("dataIndex",list.get(i).get("code"));
map.put("title",list.get(i).get("name"));
list.add(map);
returnList.add(map);
}
Map<String,String> map = new HashMap<>();
map.put("dataIndex","unitName");
map.put("title","主体信息");
map.put("dataIndex","principalUnit");
map.put("title","主体名称");
returnList.add(0,map);
Map<String,String> map1 = new HashMap<>();
map1.put("dataIndex","principalUnitCode");
map1.put("title","主体编码");
returnList.add(1,map1);
return returnList;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment