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

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into…

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into develop_tzs_register_to_0715
parents c8a1aa04 f91fb6ac
......@@ -59,6 +59,16 @@ public class DPFilterParamForDetailDto {
private String companyName;
/**
* 维保单位名称
*/
private String maintenanceCompanyName;
/**
* 地市名称
*/
private String regionName;
/**
* 报警类型code
*/
private String typeCode;
......
package com.yeejoin.amos.boot.module.statistcs.biz.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.common.api.entity.AlertUseUnitStatistics;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.YJDPStatisticsServiceImpl;
import com.yeejoin.amos.boot.module.statistics.api.dto.AlertUseUnitStatisticsDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.AlertPaperInfoDto;
......@@ -20,9 +22,8 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* 大屏统计controller
......@@ -193,4 +194,36 @@ public class YJDPStatisticsController {
public ResponseModel<IPage<Map<String, Object>>> alertRecordTableForDP(DPFilterParamForDetailDto recordFilterVo) {
return statisticsService.alertRecordTableForDP(recordFilterVo);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "月度困人故障高发使用单位-右上角更多-地市月度应急事件高发使用单位-侧边树",
notes = "月度困人故障高发使用单位-右上角更多-地市月度应急事件高发使用单位-侧边树")
@PostMapping("/alertUnitOption/dp")
public ResponseModel<Object> alertUnitOption() {
List<JSONObject> subList = Collections.singletonList(new JSONObject()
.fluentPut("value", "use")
.fluentPut("title", "使用单位"));
JSONObject jsonObject = new JSONObject()
.fluentPut("title", "企业类型")
.fluentPut("value", "all")
.fluentPut("children", subList);
return ResponseHelper.buildResponse(jsonObject);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "月度困人故障高发使用单位-右上角更多-地市月度应急事件高发使用单位-柱状图",
notes = "月度困人故障高发使用单位-右上角更多-地市月度应急事件高发使用单位-柱状图")
@PostMapping("/alertUnitBarChart/dp")
public ResponseModel<JSONObject> alertUnitBarChartForDP(@Validated @RequestBody DPFilterParamForDetailDto detailDto) {
return statisticsService.alertUnitBarChartForDP(detailDto);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "月度困人故障高发使用单位-右上角更多-地市月度应急事件高发使用单位-表格",
notes = "月度困人故障高发使用单位-右上角更多-地市月度应急事件高发使用单位-表格")
@PostMapping("/alertUseUnitTable/dp")
public ResponseModel<IPage<AlertUseUnitStatistics>> alertUseUnitTableForDP(@Validated @RequestBody DPFilterParamForDetailDto detailDto) {
return statisticsService.alertUseUnitTableForDP(detailDto);
}
}
......@@ -535,10 +535,82 @@ public class YJDPStatisticsServiceImpl {
public ResponseModel<IPage<Map<String, Object>>> alertRecordTableForDP(DPFilterParamForDetailDto recordFilterVo) {
String orgCode = stCommonService.getAndSetOrgCode(recordFilterVo.getCityCode());
if (orgCode == null) {
return ResponseHelper.buildResponse(new Page<>());
}
if (!ValidationUtil.isEmpty(recordFilterVo.getTreeValue())){
recordFilterVo.setAlertTypeCode(recordFilterVo.getTreeValue());
}
Page<Map<String, Object>> mapPage = alertStatisticsMapper.alertRecordForPage(new Page<>(recordFilterVo.getCurrent(), recordFilterVo.getSize()),recordFilterVo,orgCode);
return ResponseHelper.buildResponse(mapPage);
}
public ResponseModel<JSONObject> alertUnitBarChartForDP(DPFilterParamForDetailDto detailDto){
JSONObject res = new JSONObject();
JSONArray legendData = new JSONArray();
legendData.add(new JSONObject()
.fluentPut("dataKey", "alertUnitTotal")
.fluentPut("value", "故障高发企业总数")
.fluentPut("chartType", "bar"));
List<RegionModel> regionList = stCommonService.setRegionIfRootParentAndNoAccessIf3Level(ValidationUtil.isEmpty(detailDto.getCityCode()) ? "610000" : detailDto.getCityCode());
List<String> xData = regionList.stream()
.map(RegionModel::getRegionName)
.filter(regionName -> !"西咸新区".equals(regionName))
.collect(Collectors.toList());
List<? extends Number> alertUnitTotal = regionList.stream()
.map(region -> {
String orgCode = stCommonService.getAndSetOrgCode(String.valueOf(region.getRegionCode()));
if (ValidationUtil.isEmpty(orgCode)) {
return 0L;
}
return alertUseUnitStatisticsMapper.selectCount(new QueryWrapper<AlertUseUnitStatistics>().lambda()
.likeRight(AlertUseUnitStatistics::getSupervisoryUnitOrgCode, orgCode)
.isNotNull(AlertUseUnitStatistics::getUseUnitCode));
}).collect(Collectors.toList());
res.put("legendData", legendData);
res.put("xdata", xData);
res.put("alertUnitTotal", alertUnitTotal);
return ResponseHelper.buildResponse(res);
}
public ResponseModel<IPage<AlertUseUnitStatistics>> alertUseUnitTableForDP(DPFilterParamForDetailDto detailDto){
Page<AlertUseUnitStatistics> page = new Page<>();
page.setCurrent(detailDto.getCurrent());
page.setSize(detailDto.getSize());
String orgCode = stCommonService.getAndSetOrgCode(ValidationUtil.isEmpty(detailDto.getCityCode()) ? "610000" : detailDto.getCityCode());
if (orgCode == null) {
return ResponseHelper.buildResponse(page);
}
LambdaQueryWrapper<AlertUseUnitStatistics> lambda = new QueryWrapper<AlertUseUnitStatistics>().lambda();
lambda.isNotNull(AlertUseUnitStatistics::getUseUnitCode);
// 地市搜索
if (!ValidationUtil.isEmpty(detailDto.getRegionName())) {
List<RegionModel> regionList = stCommonService.setRegionIfRootParentAndNoAccessIf3Level(
ValidationUtil.isEmpty(detailDto.getCityCode()) ? "610000" : detailDto.getCityCode()
);
RegionModel matchedRegion = regionList.stream()
.filter(region -> detailDto.getRegionName().equals(region.getRegionName()))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Region not found"));
String cityOrgCode = stCommonService.getAndSetOrgCode(String.valueOf(matchedRegion.getRegionCode()));
lambda.likeRight(AlertUseUnitStatistics::getSupervisoryUnitOrgCode, cityOrgCode);
}else {
lambda.likeRight(AlertUseUnitStatistics::getSupervisoryUnitOrgCode, orgCode);
}
// 使用单位
if (!ValidationUtil.isEmpty(detailDto.getCompanyName())){
lambda.like(AlertUseUnitStatistics::getUseUnit, detailDto.getCompanyName());
}
// 维保单位
if (!ValidationUtil.isEmpty(detailDto.getMaintenanceCompanyName())){
lambda.like(AlertUseUnitStatistics::getMaintenanceUnit, detailDto.getMaintenanceCompanyName());
}
IPage<AlertUseUnitStatistics> alertUseUnitStatistics = alertUseUnitStatisticsMapper.selectPage(page, lambda);
return ResponseHelper.buildResponse(alertUseUnitStatistics);
}
}
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