Commit 1b3e46ce authored by suhuiguang's avatar suhuiguang

1.三库建设大屏接口自测

parent 9306cd4a
......@@ -171,6 +171,7 @@
tui.unit_code = bi.use_code
and ((bi.supervise_org_code != '50' and bi.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (bi.supervise_org_code = '50' and bi.office_region LIKE CONCAT ('%', #{regionCode}, '%')))
and tui.is_delete=false
and bi.is_delete= '0'
group by keyStr
</select>
</mapper>
......
......@@ -610,7 +610,7 @@ public class JGDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏总览-右侧-三库建设情况统计", notes = "大屏总览-右侧-三库建设情况统计")
@ApiOperation(httpMethod = "POST", value = "大屏总览-右侧-三库建设情况统计(柱状图)", notes = "大屏总览-右侧-三库建设情况统计(柱状图)")
@PostMapping(value = "/zl/skjs")
public ResponseModel<Map<String, Object>> queryBarChartDataForSkjs(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
......
......@@ -520,8 +520,8 @@ public class JGDPStatisticsServiceImpl {
countItemDto.setCompany(String.valueOf(u1 + u2 + u3 + u4 + u5 + u6));
}
private void staticsUserForSkjs(SkjsCountItemDto countItemDto, DPFilterParamDto dpFilterParamDto, String orgCode) {
Long num = userInfoMapper.countUserByPostAndAreaCode(orgCode, null, dpFilterParamDto.getCityCode());
private void staticsUserForSkjs(SkjsCountItemDto countItemDto, String regionCode, String orgCode) {
Long num = userInfoMapper.countUserByPostAndAreaCode(orgCode, null, regionCode);
countItemDto.setUser(String.valueOf(num));
}
......@@ -3639,10 +3639,12 @@ public class JGDPStatisticsServiceImpl {
List<String> pipelineYData = new ArrayList<>();
List<String> companyYData = new ArrayList<>();
List<String> userYData = new ArrayList<>();
// 多线程处理
Map<String, SkjsCountItemDto> countItemMap = regionModels.parallelStream().map(r -> {
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode().toString());
String regionCode = r.getRegionCode().toString();
String orgCode = stCommonService.getAndSetOrgCode(regionCode);
SkjsCountItemDto countItemDto = new SkjsCountItemDto();
countItemDto.setRegionCode(r.getRegionCode().toString());
countItemDto.setRegionCode(regionCode);
if (!ValidationUtil.isEmpty(orgCode)) {
Map<String, Object> data = new HashMap<>();
// 查询各自统计数据作为Y轴数据
......@@ -3654,15 +3656,16 @@ public class JGDPStatisticsServiceImpl {
countItemDto.setOneSet(String.valueOf(oneSetNum));
// 2. 压力管道长度统计
countItemDto.setPipeline(stCommonService.staticsCenterMapCountDataForPipeline(data, orgCode, true));
// 3.单位数量统计
this.staticsCompanyForSkjs(countItemDto, orgCode, dpFilterParamDto.getCityCode());
// 3. 单位数量统计
this.staticsCompanyForSkjs(countItemDto, orgCode, regionCode);
// 4. 人员数量统计
this.staticsUserForSkjs(countItemDto, dpFilterParamDto, orgCode);
this.staticsUserForSkjs(countItemDto, regionCode, orgCode);
} else {
countItemDto.setDefaultValues();
}
return countItemDto;
}).collect(Collectors.toMap(SkjsCountItemDto::getRegionCode, Function.identity()));
// 排序及数据构建
regionModels.forEach(r -> {
xData.add(r.getRegionName());
SkjsCountItemDto countItemDto = countItemMap.get(r.getRegionCode().toString());
......@@ -3672,7 +3675,6 @@ public class JGDPStatisticsServiceImpl {
companyYData.add(countItemDto.getCompany());
userYData.add(countItemDto.getUser());
});
//2.3 x轴数据构造
result.put("oneSet", oneSetYData);
result.put("cylinder", cylinderYData);
result.put("pipeline", pipelineYData);
......@@ -3709,11 +3711,12 @@ public class JGDPStatisticsServiceImpl {
if (orgCodeP == null) {
return new ArrayList<>();
}
// 多线程处理
Map<String, SkjsEquipCountItemDto> countItemMap = regionModels.parallelStream().map(r -> {
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode().toString());
String regionCode = r.getRegionCode().toString();
String orgCode = stCommonService.getAndSetOrgCode(regionCode);
SkjsEquipCountItemDto countItemDto = new SkjsEquipCountItemDto();
countItemDto.setRegionCode(r.getRegionCode().toString());
countItemDto.setRegionCode(r.getRegionCode().toString());
countItemDto.setRegionCode(regionCode);
countItemDto.setRegionName(r.getRegionName());
if (!ValidationUtil.isEmpty(orgCode)) {
Map<String, Object> data = new HashMap<>();
......@@ -3736,7 +3739,9 @@ public class JGDPStatisticsServiceImpl {
}
return countItemDto;
}).collect(Collectors.toMap(SkjsEquipCountItemDto::getRegionCode, Function.identity()));
// 排序
List<SkjsEquipCountItemDto> countItemDtos = regionModels.stream().map(r -> countItemMap.get(r.getRegionCode().toString())).collect(Collectors.toList());
// 设置汇总数据
this.setEquipSummaryRow(countItemDtos);
return countItemDtos;
}
......@@ -3747,19 +3752,21 @@ public class JGDPStatisticsServiceImpl {
if (orgCodeP == null) {
return new ArrayList<>();
}
// 多线程处理
Map<String, SkjsCompanyCountItemDto> companyCountItemDtoMap = regionModels.parallelStream().map(r -> {
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode().toString());
String regionCode = r.getRegionCode().toString();
String orgCode = stCommonService.getAndSetOrgCode(regionCode);
SkjsCompanyCountItemDto companyCountItemDto = new SkjsCompanyCountItemDto();
companyCountItemDto.setRegionCode(r.getRegionCode().toString());
companyCountItemDto.setRegionCode(regionCode);
companyCountItemDto.setRegionName(r.getRegionName());
if (StringUtils.isNotEmpty(orgCode)) {
List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, r.getRegionCode() + "");
List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, regionCode);
int u1 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE) || c.getKeyStr().contains(COMPANY_TYPE_PERSON)).mapToInt(CountDto::getIntValue).sum();
int u2 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)).mapToInt(CountDto::getIntValue).sum();
int u3 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE)).mapToInt(CountDto::getIntValue).sum();
int u2 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)).mapToInt(CountDto::getIntValue).sum();
int u4 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING)).mapToInt(CountDto::getIntValue).sum();
int u5 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_DESIGN)).mapToInt(CountDto::getIntValue).sum();
int u6 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_JYJC)).mapToInt(CountDto::getIntValue).sum();
int u5 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_DESIGN)).mapToInt(CountDto::getIntValue).sum();
companyCountItemDto.setSydw(String.valueOf(u1));
companyCountItemDto.setZzdw(String.valueOf(u3));
companyCountItemDto.setAgwdw(String.valueOf(u2));
......@@ -3771,7 +3778,9 @@ public class JGDPStatisticsServiceImpl {
}
return companyCountItemDto;
}).collect(Collectors.toMap(SkjsCompanyCountItemDto::getRegionCode, Function.identity()));
// 按照区域排序
List<SkjsCompanyCountItemDto> countItemDtos = regionModels.stream().map(r -> companyCountItemDtoMap.get(r.getRegionCode().toString())).collect(Collectors.toList());
// 汇总数据处理
this.setCompanySummaryRow(countItemDtos);
return countItemDtos;
}
......@@ -3783,15 +3792,20 @@ public class JGDPStatisticsServiceImpl {
if (orgCodeP == null) {
return new ArrayList<>();
}
// 多线程处理
Map<String, SkjsUserCountItemDto> userCountItemDtoMap = regionModels.parallelStream().map(r -> {
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode().toString());
String regionCode = r.getRegionCode().toString();
String orgCode = stCommonService.getAndSetOrgCode(regionCode);
SkjsUserCountItemDto userCountItemDto = new SkjsUserCountItemDto();
userCountItemDto.setRegionCode(r.getRegionCode().toString());
userCountItemDto.setRegionCode(regionCode);
userCountItemDto.setRegionName(r.getRegionName());
if (StringUtils.isNotEmpty(orgCode)) {
List<CountDto> countDtos = zlStatisticsMapper.countUserByPostAndAreaCode(orgCode, r.getRegionCode().toString());
List<CountDto> countDtos = zlStatisticsMapper.countUserByPostAndAreaCode(orgCode, regionCode);
// 作业人员
int zyry = countDtos.stream().filter(c -> c.getKeyStr().contains(UserPostEnum.ZYRY.getCode())).mapToInt(CountDto::getIntValue).sum();
// 检验人员
int jyry = countDtos.stream().filter(c -> c.getKeyStr().contains(UserPostEnum.ZJRY.getCode())).mapToInt(CountDto::getIntValue).sum();
// 检测人员
int jcyr = countDtos.stream().filter(c -> c.getKeyStr().contains(UserPostEnum.JCRY.getCode())).mapToInt(CountDto::getIntValue).sum();
// 生产[设计单位、安改维、制造单位]-主要负责人
int sczyfzr = countDtos.stream().filter(c -> (c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE) || c.getKeyStr().contains(COMPANY_TYPE_DESIGN) || c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)) && c.getKeyStr().contains(UserPostEnum.ZYFZR.getCode())).mapToInt(CountDto::getIntValue).sum();
......@@ -3800,7 +3814,7 @@ public class JGDPStatisticsServiceImpl {
// 生产[设计单位、安改维、制造单位]-质量安全员
int sczlaqy = countDtos.stream().filter(c -> (c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE) || c.getKeyStr().contains(COMPANY_TYPE_DESIGN) || c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)) && c.getKeyStr().contains(UserPostEnum.ZLAQY.getCode())).mapToInt(CountDto::getIntValue).sum();
// 使用单位-主要负责人
int syzyfzr = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE) && c.getKeyStr().contains(UserPostEnum.ZLAQY.getCode())).mapToInt(CountDto::getIntValue).sum();
int syzyfzr = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE) && c.getKeyStr().contains(UserPostEnum.ZYFZR.getCode())).mapToInt(CountDto::getIntValue).sum();
// 使用单位-安全总监
int syaqzj = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE) && c.getKeyStr().contains(UserPostEnum.AQZJ.getCode())).mapToInt(CountDto::getIntValue).sum();
// 使用单位-安全员
......@@ -3819,55 +3833,57 @@ public class JGDPStatisticsServiceImpl {
}
return userCountItemDto;
}).collect(Collectors.toMap(SkjsUserCountItemDto::getRegionCode, Function.identity()));
// 排序
List<SkjsUserCountItemDto> userCountItemDtos = regionModels.stream().map(r -> userCountItemDtoMap.get(r.getRegionCode().toString())).collect(Collectors.toList());
// 汇总行构建
this.setUserSummaryRow(userCountItemDtos);
return userCountItemDtos;
}
private void setUserSummaryRow(List<SkjsUserCountItemDto> userCountItemDtos) {
private void setUserSummaryRow(List<SkjsUserCountItemDto> countItems) {
SkjsUserCountItemDto summary = new SkjsUserCountItemDto();
summary.setRegionCode("summary");
summary.setRegionName("合计");
summary.setZyry(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getZyry())).sum()));
summary.setJyry(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getJyry())).sum()));
summary.setJcry(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getJcry())).sum()));
summary.setSczyfzr(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getSczyfzr())).sum()));
summary.setSczlaqzj(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getSczlaqzj())).sum()));
summary.setSczlaqy(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getSczlaqy())).sum()));
summary.setSyzyfzr(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getSyzyfzr())).sum()));
summary.setSyaqzj(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getSyaqzj())).sum()));
summary.setSyaqy(String.valueOf(userCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getSyaqy())).sum()));
userCountItemDtos.add(summary);
}
private void setCompanySummaryRow(List<SkjsCompanyCountItemDto> companyCountItemDtos) {
summary.setZyry(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getZyry())).sum()));
summary.setJyry(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getJyry())).sum()));
summary.setJcry(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getJcry())).sum()));
summary.setSczyfzr(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getSczyfzr())).sum()));
summary.setSczlaqzj(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getSczlaqzj())).sum()));
summary.setSczlaqy(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getSczlaqy())).sum()));
summary.setSyzyfzr(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getSyzyfzr())).sum()));
summary.setSyaqzj(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getSyaqzj())).sum()));
summary.setSyaqy(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getSyaqy())).sum()));
countItems.add(summary);
}
private void setCompanySummaryRow(List<SkjsCompanyCountItemDto> countItems) {
SkjsCompanyCountItemDto summary = new SkjsCompanyCountItemDto();
summary.setRegionCode("summary");
summary.setRegionName("合计");
summary.setSydw(String.valueOf(companyCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getSydw())).sum()));
summary.setZzdw(String.valueOf(companyCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getZzdw())).sum()));
summary.setAgwdw(String.valueOf(companyCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getAgwdw())).sum()));
summary.setCzdw(String.valueOf(companyCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getCzdw())).sum()));
summary.setJyjcjg(String.valueOf(companyCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getJyjcjg())).sum()));
summary.setSjdw(String.valueOf(companyCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getSjdw())).sum()));
companyCountItemDtos.add(summary);
summary.setSydw(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getSydw())).sum()));
summary.setZzdw(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getZzdw())).sum()));
summary.setAgwdw(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getAgwdw())).sum()));
summary.setCzdw(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getCzdw())).sum()));
summary.setJyjcjg(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getJyjcjg())).sum()));
summary.setSjdw(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getSjdw())).sum()));
countItems.add(summary);
}
private void setEquipSummaryRow(List<SkjsEquipCountItemDto> equipCountItemDtos) {
private void setEquipSummaryRow(List<SkjsEquipCountItemDto> countItems) {
SkjsEquipCountItemDto summary = new SkjsEquipCountItemDto();
summary.setRegionCode("summary");
summary.setRegionName("合计");
summary.setDt(String.valueOf(equipCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getDt())).sum()));
summary.setQzjx(String.valueOf(equipCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getQzjx())).sum()));
summary.setKysd(String.valueOf(equipCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getKysd())).sum()));
summary.setDxylss(String.valueOf(equipCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getDxylss())).sum()));
summary.setCc(String.valueOf(equipCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getCc())).sum()));
summary.setGl(String.valueOf(equipCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getGl())).sum()));
summary.setYlrq(String.valueOf(equipCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getYlrq())).sum()));
summary.setYlgd(sumWithValidation(equipCountItemDtos));
summary.setQp(String.valueOf(equipCountItemDtos.stream().mapToLong(e -> Long.parseLong(e.getQp())).sum()));
equipCountItemDtos.add(summary);
summary.setDt(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getDt())).sum()));
summary.setQzjx(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getQzjx())).sum()));
summary.setKysd(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getKysd())).sum()));
summary.setDxylss(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getDxylss())).sum()));
summary.setCc(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getCc())).sum()));
summary.setGl(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getGl())).sum()));
summary.setYlrq(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getYlrq())).sum()));
summary.setYlgd(sumWithValidation(countItems));
summary.setQp(String.valueOf(countItems.stream().mapToLong(e -> Long.parseLong(e.getQp())).sum()));
countItems.add(summary);
}
public String sumWithValidation(List<SkjsEquipCountItemDto> list) {
......
......@@ -299,6 +299,7 @@
"tz_base_enterprise_info" a
where
((a.supervise_org_code != '50' and a.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (a.supervise_org_code = '50' and a.office_region LIKE CONCAT ('%', #{cityCode}, '%')))
and a.is_delete = '0'
group by a.unit_type
</select>
<select id="countByUnitTypeAndOrgCodeNoParam" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
......
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