Commit 719ac0c0 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 d3be4e02 06061da2
...@@ -2332,7 +2332,7 @@ ...@@ -2332,7 +2332,7 @@
</w:rPr> </w:rPr>
</w:pPr> </w:pPr>
<#list installLicenseExpirationDateList as item1> <#list equipList.installLicenseExpirationDateList as item1>
<w:r> <w:r>
<w:rPr> <w:rPr>
<w:rFonts w:hint="eastAsia" w:ascii="宋体" w:hAnsi="宋体" w:cs="宋体"/> <w:rFonts w:hint="eastAsia" w:ascii="宋体" w:hAnsi="宋体" w:cs="宋体"/>
......
...@@ -42,24 +42,22 @@ public class AQZSDPStatisticsController { ...@@ -42,24 +42,22 @@ public class AQZSDPStatisticsController {
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-气瓶-区域安全指数统计") @ApiOperation(httpMethod = "POST", value = "大屏-气瓶-区域安全指数统计")
@RequestMapping(value = "/earlyWarning/child", method = RequestMethod.POST) @RequestMapping(value = "/earlyWarning/child", method = RequestMethod.POST)
public ResponseModel<Map<String, Object>> getChildEarlyWarning(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> getChildEarlyWarning(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult bindingResult) throws Exception {
Object regionCode = map.get("cityCode"); List<FieldError> fieldErrors = bindingResult.getFieldErrors();
if (ObjectUtils.isEmpty(regionCode)) { if (!fieldErrors.isEmpty()) {
regionCode = "610000"; throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
} }
return ResponseHelper.buildResponse(statisticsService.getChildEarlyWarning(dpFilterParamDto));
return ResponseHelper.buildResponse(statisticsService.getChildEarlyWarning(regionCode.toString()));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-左屏-问题类型主体统计") @ApiOperation(value = "大屏-安全追溯-左屏-问题类型主体统计")
@PostMapping(value = "/mainBodyCount") @PostMapping(value = "/mainBodyCount")
public ResponseModel<Map<String, Object>> mainBodyCount(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> mainBodyCount(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) { if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000"; regionCode = "610000";
...@@ -72,7 +70,7 @@ public class AQZSDPStatisticsController { ...@@ -72,7 +70,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-左屏-设备问题近30天统计") @ApiOperation(value = "大屏-安全追溯-左屏-设备问题近30天统计")
@PostMapping(value = "/equipmentCount") @PostMapping(value = "/equipmentCount")
public ResponseModel<Map<String, Object>> equipmentCount(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> equipmentCount(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) { if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000"; regionCode = "610000";
...@@ -85,7 +83,7 @@ public class AQZSDPStatisticsController { ...@@ -85,7 +83,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-左屏-企业问题近30天统计") @ApiOperation(value = "大屏-安全追溯-左屏-企业问题近30天统计")
@PostMapping(value = "/companyCount") @PostMapping(value = "/companyCount")
public ResponseModel<List<Map<String, Object>>> companyCount(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<List<Map<String, Object>>> companyCount(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) { if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000"; regionCode = "610000";
...@@ -98,7 +96,7 @@ public class AQZSDPStatisticsController { ...@@ -98,7 +96,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-左屏-人员问题近30天统计") @ApiOperation(value = "大屏-安全追溯-左屏-人员问题近30天统计")
@PostMapping(value = "/personCount") @PostMapping(value = "/personCount")
public ResponseModel<Map<String, Object>> personCount(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> personCount(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) { if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000"; regionCode = "610000";
...@@ -112,7 +110,7 @@ public class AQZSDPStatisticsController { ...@@ -112,7 +110,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-左屏-气瓶问题近30天统计") @ApiOperation(value = "大屏-安全追溯-左屏-气瓶问题近30天统计")
@PostMapping(value = "/cylinderCount") @PostMapping(value = "/cylinderCount")
public ResponseModel<Map<String, Object>> cylinderCount(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> cylinderCount(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) { if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000"; regionCode = "610000";
...@@ -125,7 +123,7 @@ public class AQZSDPStatisticsController { ...@@ -125,7 +123,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-右屏-按月统计近12个月的问题数量趋势") @ApiOperation(value = "大屏-安全追溯-右屏-按月统计近12个月的问题数量趋势")
@PostMapping(value = "/issueCountByMonth") @PostMapping(value = "/issueCountByMonth")
public ResponseModel<Map<String, Object>> issueCountByMonth(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> issueCountByMonth(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) { if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000"; regionCode = "610000";
...@@ -138,7 +136,7 @@ public class AQZSDPStatisticsController { ...@@ -138,7 +136,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-右屏-按月统计近30天的问题数量趋势") @ApiOperation(value = "大屏-安全追溯-右屏-按月统计近30天的问题数量趋势")
@PostMapping(value = "/issueCountByDay") @PostMapping(value = "/issueCountByDay")
public ResponseModel<Map<String, Object>> issueCountByDay(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> issueCountByDay(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) { if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000"; regionCode = "610000";
...@@ -150,7 +148,7 @@ public class AQZSDPStatisticsController { ...@@ -150,7 +148,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-中屏-当前区域数据统计") @ApiOperation(value = "大屏-安全追溯-中屏-当前区域数据统计")
@PostMapping(value = "/issueCountByCityCode") @PostMapping(value = "/issueCountByCityCode")
public ResponseModel<Map<String, Object>> issueCountByCityCode(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> issueCountByCityCode(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) { if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000"; regionCode = "610000";
...@@ -176,7 +174,7 @@ public class AQZSDPStatisticsController { ...@@ -176,7 +174,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-左屏-当月问题列表(主体类型、问题类型、问题时间、操作)") @ApiOperation(value = "大屏-安全追溯-左屏-当月问题列表(主体类型、问题类型、问题时间、操作)")
@PostMapping(value = "/issueMonthList") @PostMapping(value = "/issueMonthList")
public ResponseModel<List<Map<String, Object>>> issueMonthList(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<List<Map<String, Object>>> issueMonthList(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) { if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000"; regionCode = "610000";
...@@ -188,7 +186,7 @@ public class AQZSDPStatisticsController { ...@@ -188,7 +186,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-右屏-当年问题等级分类统计") @ApiOperation(value = "大屏-安全追溯-右屏-当年问题等级分类统计")
@PostMapping(value = "/issueProblemLevelCount") @PostMapping(value = "/issueProblemLevelCount")
public ResponseModel<Map<String, Object>> issueProblemLevelCount(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> issueProblemLevelCount(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) { if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000"; regionCode = "610000";
...@@ -200,7 +198,7 @@ public class AQZSDPStatisticsController { ...@@ -200,7 +198,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-右屏-按问题类型排名top 10") @ApiOperation(value = "大屏-安全追溯-右屏-按问题类型排名top 10")
@PostMapping(value = "/issueCompanyTop") @PostMapping(value = "/issueCompanyTop")
public ResponseModel<List<Map<String, Object>>> issueCompanyTop(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<List<Map<String, Object>>> issueCompanyTop(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) { if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000"; regionCode = "610000";
...@@ -235,7 +233,7 @@ public class AQZSDPStatisticsController { ...@@ -235,7 +233,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-右屏-按问题类型排名top 10") @ApiOperation(value = "大屏-安全追溯-右屏-按问题类型排名top 10")
@PostMapping(value = "/issueCountTopByProblemType") @PostMapping(value = "/issueCountTopByProblemType")
public ResponseModel<List<Map<String, Object>>> issueCountTopByProblemType(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<List<Map<String, Object>>> issueCountTopByProblemType(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) { if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000"; regionCode = "610000";
......
...@@ -6,24 +6,20 @@ import com.yeejoin.amos.boot.biz.common.dto.KeyValueDto; ...@@ -6,24 +6,20 @@ import com.yeejoin.amos.boot.biz.common.dto.KeyValueDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto; import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.enums.IssueMainBodyEnum; import com.yeejoin.amos.boot.module.common.api.enums.IssueMainBodyEnum;
import com.yeejoin.amos.boot.module.common.api.enums.IssueTypeEnum; import com.yeejoin.amos.boot.module.common.api.enums.IssueTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.ReginStepEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.DPMapStatisticsItemEnum; import com.yeejoin.amos.boot.module.jg.api.enums.DPMapStatisticsItemEnum;
import com.yeejoin.amos.boot.module.statistics.api.dto.EquipQuestionNumCountDto; import com.yeejoin.amos.boot.module.statistics.api.dto.EquipQuestionNumCountDto;
import com.yeejoin.amos.boot.module.statistics.api.dto.SecurityIndexCountItemDto; import com.yeejoin.amos.boot.module.statistics.api.dto.SecurityIndexCountItemDto;
import com.yeejoin.amos.boot.module.statistics.api.mapper.AQZSDPStatisticsMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.AQZSDPStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.mapper.CylinderStatisticsMapper;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto; import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.statistics.api.mapper.CylinderStatisticsMapper;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipTechParamPipelineMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipTechParamPipelineMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import joptsimple.internal.Strings;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.queryparser.classic.QueryParser; import org.apache.lucene.queryparser.classic.QueryParser;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
...@@ -38,10 +34,8 @@ import org.elasticsearch.search.aggregations.AggregationBuilders; ...@@ -38,10 +34,8 @@ import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -51,10 +45,9 @@ import java.text.NumberFormat; ...@@ -51,10 +45,9 @@ import java.text.NumberFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -100,38 +93,33 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -100,38 +93,33 @@ public class AQZSDPStatisticsServiceImpl {
*/ */
private final static String COMPANY_TYPE_FILLING = "充装单位"; private final static String COMPANY_TYPE_FILLING = "充装单位";
/**
* 监管-中屏-地图行政区划code
*/
private final static String REGION_CODE = "regionCode";
/**
* 监管-中屏-地图行政区划code
*/
private final static String REGION_NAME = "regionName";
private static List<EquipmentCategoryDto> equipmentCategoryDtos; private static List<EquipmentCategoryDto> equipmentCategoryDtos;
private static List<RegionModel> regionModels = new ArrayList<>(); private static List<RegionModel> regionModels = new ArrayList<>();
private static Map<String, String> regionCodeOrgCodeMap = new ConcurrentHashMap<>();
private RestHighLevelClient restHighLevelClient; private RestHighLevelClient restHighLevelClient;
private AQZSDPStatisticsMapper statisticsMapper; private AQZSDPStatisticsMapper statisticsMapper;
@Autowired
private EquipmentCategoryMapper equipmentCategoryMapper; private EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired
private EquipTechParamPipelineMapper techParamsPipelineMapper; private EquipTechParamPipelineMapper techParamsPipelineMapper;
@Autowired
private TzBaseEnterpriseInfoMapper enterpriseInfoMapper; private TzBaseEnterpriseInfoMapper enterpriseInfoMapper;
@Autowired
private TzsUserInfoMapper userInfoMapper; private TzsUserInfoMapper userInfoMapper;
private CylinderStatisticsMapper cylinderStatisticsMapper;
private StCommonServiceImpl stCommonService;
public void init() { public void init() {
// 数据不变所以放到内存,提高响应时间 // 数据不变所以放到内存,提高响应时间
equipmentCategoryDtos = equipmentCategoryMapper.selectClassify(); equipmentCategoryDtos = equipmentCategoryMapper.selectClassify();
...@@ -156,14 +144,14 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -156,14 +144,14 @@ public class AQZSDPStatisticsServiceImpl {
} }
} }
private CylinderStatisticsMapper cylinderStatisticsMapper;
private StCommonServiceImpl stCommonService; public AQZSDPStatisticsServiceImpl(RestHighLevelClient restHighLevelClient, AQZSDPStatisticsMapper statisticsMapper, EquipmentCategoryMapper equipmentCategoryMapper, EquipTechParamPipelineMapper techParamsPipelineMapper, TzBaseEnterpriseInfoMapper enterpriseInfoMapper, TzsUserInfoMapper userInfoMapper, CylinderStatisticsMapper cylinderStatisticsMapper, StCommonServiceImpl stCommonService) {
public AQZSDPStatisticsServiceImpl(RestHighLevelClient restHighLevelClient, AQZSDPStatisticsMapper statisticsMapper, CylinderStatisticsMapper cylinderStatisticsMapper, StCommonServiceImpl stCommonService) {
this.restHighLevelClient = restHighLevelClient; this.restHighLevelClient = restHighLevelClient;
this.statisticsMapper = statisticsMapper; this.statisticsMapper = statisticsMapper;
this.equipmentCategoryMapper = equipmentCategoryMapper;
this.techParamsPipelineMapper = techParamsPipelineMapper;
this.enterpriseInfoMapper = enterpriseInfoMapper;
this.userInfoMapper = userInfoMapper;
this.cylinderStatisticsMapper = cylinderStatisticsMapper; this.cylinderStatisticsMapper = cylinderStatisticsMapper;
this.stCommonService = stCommonService; this.stCommonService = stCommonService;
} }
...@@ -222,73 +210,28 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -222,73 +210,28 @@ public class AQZSDPStatisticsServiceImpl {
} }
} }
public Map<String, Object> getChildEarlyWarning(String regionCode) throws Exception { public Map<String, Object> getChildEarlyWarning(DPFilterParamDto dpFilterParamDto) throws Exception {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(regionCode); List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamDto.getCityCode());
List<String> collect = regionModels.stream().map(c -> c.getRegionCode().toString()).collect(Collectors.toList()); Map<String, SecurityIndexCountItemDto> regionCodeSecurityIndexMap = getSecurityIndexCountItemDtoMap(regionModels);
List<CompanyModel> companyModelList = Privilege.companyClient.queryListByCompanyCode(Strings.join(collect, ",")).getResult(); Set<String> legendData = getLegendForCyArea();
Map<String, CompanyModel> companyMap = companyModelList.stream().collect(Collectors.toMap(CompanyModel::getCompanyCode, c -> c));
Set<String> legendData = new HashSet<>();
List<String> xdata = new ArrayList<>();
List<String> xuke = new ArrayList<>(); List<String> xuke = new ArrayList<>();
List<String> shiyongdengji = new ArrayList<>(); List<String> shiyongdengji = new ArrayList<>();
List<String> jianyanchaoqi = new ArrayList<>(); List<String> jianyanchaoqi = new ArrayList<>();
List<String> jianyanhege = new ArrayList<>(); List<String> jianyanhege = new ArrayList<>();
List<String> czjc = new ArrayList<>(); List<String> czjc = new ArrayList<>();
List<String> czjchege = new ArrayList<>(); List<String> czjchege = new ArrayList<>();
// List<String> renyuan = new ArrayList<>(); //TODO 多线程处理后,regionCodeSecurityIndexMap顺序与regionModels的顺序不一致,需让数据和x轴的顺序保存一致
List<String> xdata = stCommonService.buildXData(regionModels);
legendData.add("许可有效率"); regionModels.forEach(r -> {
legendData.add("使用登记办理率"); SecurityIndexCountItemDto countItemDto = regionCodeSecurityIndexMap.get(r.getRegionCode().toString());
legendData.add("检验超期率"); xuke.add(countItemDto.getXuke());
legendData.add("检验合格率"); shiyongdengji.add(countItemDto.getShiyongdengji());
legendData.add("充装检查率"); jianyanchaoqi.add(countItemDto.getJianyanchaoqi());
legendData.add("充装检查合格率"); jianyanhege.add(countItemDto.getJianyanhege());
czjc.add(countItemDto.getCzjc());
for (RegionModel region : regionModels) { czjchege.add(countItemDto.getCzjchege());
});
CompanyModel companyModel = companyMap.get(region.getRegionCode().toString());
if (ObjectUtils.isEmpty(companyModel)) {
continue;
}
// 是否有充装企业在指定区域下
Boolean isHavingUnitInRegion = true;
String orgCode = companyModel.getOrgCode();
xdata.add(region.getRegionName());
// 1.许可有效率
if (!ValidationUtil.isEmpty(companyModel)) {
String value = this.getLicenseEfficiencyByRegion(orgCode);
if (NO_DATA_STR.equals(value)) {
xuke.add("0");
} else {
xuke.add(String.format("%.4f", Double.parseDouble(value) / 100.0000));
}
}
// 2.使用登记办理率
shiyongdengji.add("1");
// 3.检验超期率
jianyanchaoqi.add(String.format("%.4f", Double.parseDouble(statisticsMapper.getInspectionExpiredRate(orgCode, null).get("expiredRate").toString()) / 100.0000));
// 4.检验合格率
jianyanhege.add(String.format("%.4f", Double.parseDouble(statisticsMapper.getInspectionResultRate(orgCode, null).get("resultRate").toString()) / 100.0000));
// 5.充装检查率
long totalAll = searchEsCount(false, false, orgCode, null);
long totalCheck = searchEsCount(true, false, orgCode, null);
long totalResult = searchEsCount(false, true, orgCode, null);
if (totalAll != 0) {
czjc.add(new DecimalFormat("#.0000").format(((double) totalCheck / totalAll)));
} else {
czjc.add("0");
}
// 6.充装检查合格率
if (totalAll != 0) {
czjchege.add(new DecimalFormat("#.0000").format(((double) totalResult / totalAll)));
} else {
czjchege.add("0");
}
}
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result.put("xdata", xdata); result.put("xdata", xdata);
result.put("legendData", legendData); result.put("legendData", legendData);
result.put("xuke", xuke); result.put("xuke", xuke);
...@@ -297,10 +240,20 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -297,10 +240,20 @@ public class AQZSDPStatisticsServiceImpl {
result.put("jianyanhege", jianyanhege); result.put("jianyanhege", jianyanhege);
result.put("czjc", czjc); result.put("czjc", czjc);
result.put("czjchege", czjchege); result.put("czjchege", czjchege);
return result; return result;
} }
private Set<String> getLegendForCyArea() {
Set<String> legendData = new HashSet<>();
legendData.add("许可有效率");
legendData.add("使用登记办理率");
legendData.add("检验超期率");
legendData.add("检验合格率");
legendData.add("充装检查率");
legendData.add("充装检查合格率");
return legendData;
}
public Map<String, Object> getSecurityIndex(DPFilterParamDto dpFilterParamDto) throws Exception { public Map<String, Object> getSecurityIndex(DPFilterParamDto dpFilterParamDto) throws Exception {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamDto.getCityCode()); List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamDto.getCityCode());
...@@ -348,6 +301,7 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -348,6 +301,7 @@ public class AQZSDPStatisticsServiceImpl {
} }
private Map<String, SecurityIndexCountItemDto> getSecurityIndexCountItemDtoMap(List<RegionModel> regionModels) { private Map<String, SecurityIndexCountItemDto> getSecurityIndexCountItemDtoMap(List<RegionModel> regionModels) {
// 多线程处理后,顺序与regionModels的顺序不一致,故生成list
List<SecurityIndexCountItemDto> countItemDtoList = getSecurityIndexCountDtoList(regionModels); List<SecurityIndexCountItemDto> countItemDtoList = getSecurityIndexCountDtoList(regionModels);
return countItemDtoList.stream().collect(Collectors.toMap(SecurityIndexCountItemDto::getRegionCode, Function.identity(), (k1, k2) -> k2)); return countItemDtoList.stream().collect(Collectors.toMap(SecurityIndexCountItemDto::getRegionCode, Function.identity(), (k1, k2) -> k2));
} }
...@@ -899,6 +853,7 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -899,6 +853,7 @@ public class AQZSDPStatisticsServiceImpl {
dpFilterParamDto.setEndDate(DateUtil.today()); dpFilterParamDto.setEndDate(DateUtil.today());
} }
} }
public Map<String, Object> getCenterMapCountDataForGlobal(DPFilterParamDto dpFilterParamDto) { public Map<String, Object> getCenterMapCountDataForGlobal(DPFilterParamDto dpFilterParamDto) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode()); String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
...@@ -922,16 +877,16 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -922,16 +877,16 @@ public class AQZSDPStatisticsServiceImpl {
private void staticsCenterMapCountDataForIssue(Map<String, Object> result, String orgCode) { private void staticsCenterMapCountDataForIssue(Map<String, Object> result, String orgCode) {
List<Map<String, Object>> list = statisticsMapper.selectByOrg(orgCode); List<Map<String, Object>> list = statisticsMapper.selectByOrg(orgCode);
Map<String,Object> dataMap = new HashMap<>(); Map<String, Object> dataMap = new HashMap<>();
AtomicReference<Long> issueCount = new AtomicReference<>(0L); AtomicReference<Long> issueCount = new AtomicReference<>(0L);
list.stream().forEach(t -> { list.stream().forEach(t -> {
dataMap.put(t.get("sourceType").toString(), t.get("count")); dataMap.put(t.get("sourceType").toString(), t.get("count"));
issueCount.updateAndGet(v -> v + Long.parseLong(t.get("count").toString())); issueCount.updateAndGet(v -> v + Long.parseLong(t.get("count").toString()));
}); });
result.put("issueCount", issueCount.get()); result.put("issueCount", issueCount.get());
result.put("deviceIssueCount", dataMap.getOrDefault(DPMapStatisticsItemEnum.EQU_ISSUES_COUNT,0L)); result.put("deviceIssueCount", dataMap.getOrDefault(DPMapStatisticsItemEnum.EQU_ISSUES_COUNT, 0L));
result.put("companyIssueCount", dataMap.getOrDefault(DPMapStatisticsItemEnum.COMPANY_ISSUES_COUNT,0L)); result.put("companyIssueCount", dataMap.getOrDefault(DPMapStatisticsItemEnum.COMPANY_ISSUES_COUNT, 0L));
result.put("personIssueCount", dataMap.getOrDefault(DPMapStatisticsItemEnum.PERSON_ISSUES_COUNT,0L)); result.put("personIssueCount", dataMap.getOrDefault(DPMapStatisticsItemEnum.PERSON_ISSUES_COUNT, 0L));
} }
...@@ -1051,11 +1006,10 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -1051,11 +1006,10 @@ public class AQZSDPStatisticsServiceImpl {
} }
private void setCompanyDataBatch(List<Map<String, Object>> result) { private void setCompanyDataBatch(List<Map<String, Object>> result) {
List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCodeNoParam(); List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCodeNoParam();
result.forEach(m -> { result.forEach(m -> {
String cityCode = m.get("regionCode").toString(); String cityCode = m.get("regionCode").toString();
String orgCode = regionCodeOrgCodeMap.get(cityCode); String orgCode = stCommonService.getAndSetOrgCode(cityCode);
if (orgCode != null) { if (orgCode != null) {
m.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE) && c.getLabel().contains(orgCode)).mapToInt(CountDto::getIntValue).sum()); m.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE) && c.getLabel().contains(orgCode)).mapToInt(CountDto::getIntValue).sum());
m.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE) && c.getLabel().contains(orgCode)).mapToInt(CountDto::getIntValue).sum()); m.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE) && c.getLabel().contains(orgCode)).mapToInt(CountDto::getIntValue).sum());
......
...@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service; ...@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
/** /**
* @author Administrator * @author Administrator
...@@ -78,4 +79,9 @@ public class StCommonServiceImpl { ...@@ -78,4 +79,9 @@ public class StCommonServiceImpl {
} }
return regionList; return regionList;
} }
public List<String> buildXData(List<RegionModel> regionList) {
return regionList.stream().map(RegionModel::getRegionName).collect(Collectors.toList());
}
} }
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