Commit 715acd0f authored by tianyiming's avatar tianyiming

特设大屏-气瓶页面-区域安全指数排名、区域安全指标统计修改

parent d957a4a2
...@@ -42,4 +42,14 @@ public class SecurityIndexCountItemDto { ...@@ -42,4 +42,14 @@ public class SecurityIndexCountItemDto {
* 充装检查率 * 充装检查率
*/ */
String czjchege; String czjchege;
/**
* 人员合规率(资质有效期统计)
*/
String ryhg;
/**
* 数据合规率
*/
String sjhg;
} }
...@@ -19,11 +19,12 @@ ...@@ -19,11 +19,12 @@
count(DISTINCT(a.use_unit_credit_code)) as num count(DISTINCT(a.use_unit_credit_code)) as num
FROM FROM
"tzs_jg_use_registration_manage" a, "tzs_jg_use_registration_manage" a,
privilege_company c "tz_base_enterprise_info" tbei
where where
a.receive_company_code = c.company_code a.use_unit_credit_code = tbei.use_code
AND tbei.unit_type LIKE'%充装单位%'
and a.certificate_status='已登记' and a.certificate_status='已登记'
and c.org_code like concat(#{orgCode},'%')) s1, and tbei.supervise_org_code like concat(#{orgCode},'%')) s1,
(SELECT (SELECT
count(1) as total count(1) as total
FROM "tz_base_enterprise_info" FROM "tz_base_enterprise_info"
......
...@@ -13,26 +13,17 @@ import com.yeejoin.amos.boot.module.statistics.api.dto.EquipQuestionNumCountDto; ...@@ -13,26 +13,17 @@ 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.statistics.api.mapper.CylinderStatisticsMapper;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
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.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.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.core.CountRequest; import org.elasticsearch.client.core.CountRequest;
import org.elasticsearch.client.core.CountResponse; import org.elasticsearch.client.core.CountResponse;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -166,13 +157,15 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -166,13 +157,15 @@ public class AQZSDPStatisticsServiceImpl {
public Map<String, Object> getChildEarlyWarning(DPFilterParamDto dpFilterParamDto) { public Map<String, Object> getChildEarlyWarning(DPFilterParamDto dpFilterParamDto) {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParentAndNoAccessIf3Level(dpFilterParamDto.getCityCode()); List<RegionModel> regionModels = stCommonService.setRegionIfRootParentAndNoAccessIf3Level(dpFilterParamDto.getCityCode());
Map<String, SecurityIndexCountItemDto> regionCodeSecurityIndexMap = getSecurityIndexCountItemDtoMap(regionModels); Map<String, SecurityIndexCountItemDto> regionCodeSecurityIndexMap = getSecurityIndexCountItemDtoMap(regionModels);
Set<String> legendData = getLegendForCyArea(); Set<Map<String,String>> legendData = getLegendForCyArea();
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> ryhg = new ArrayList<>();
List<String> sjhg = new ArrayList<>();
//TODO 多线程处理后,regionCodeSecurityIndexMap顺序与regionModels的顺序不一致,需让数据和x轴的顺序保存一致 //TODO 多线程处理后,regionCodeSecurityIndexMap顺序与regionModels的顺序不一致,需让数据和x轴的顺序保存一致
List<String> xdata = stCommonService.buildXData(regionModels); List<String> xdata = stCommonService.buildXData(regionModels);
regionModels.forEach(r -> { regionModels.forEach(r -> {
...@@ -183,6 +176,8 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -183,6 +176,8 @@ public class AQZSDPStatisticsServiceImpl {
jianyanhege.add(this.castScore2Percent(countItemDto.getJianyanhege())); jianyanhege.add(this.castScore2Percent(countItemDto.getJianyanhege()));
czjc.add(this.castScore2Percent(countItemDto.getCzjc())); czjc.add(this.castScore2Percent(countItemDto.getCzjc()));
czjchege.add(this.castScore2Percent(countItemDto.getCzjchege())); czjchege.add(this.castScore2Percent(countItemDto.getCzjchege()));
ryhg.add(this.castScore2Percent(countItemDto.getRyhg()));
sjhg.add(this.castScore2Percent(countItemDto.getSjhg()));
}); });
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result.put("xdata", xdata); result.put("xdata", xdata);
...@@ -193,6 +188,8 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -193,6 +188,8 @@ 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);
result.put("ryhg", ryhg);
result.put("sjhg", sjhg);
return result; return result;
} }
...@@ -202,14 +199,37 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -202,14 +199,37 @@ public class AQZSDPStatisticsServiceImpl {
return percent.toPlainString(); return percent.toPlainString();
} }
private Set<String> getLegendForCyArea() { private Set<Map<String,String>> getLegendForCyArea() {
Set<String> legendData = new HashSet<>(); Set<Map<String,String>> legendData = new HashSet<>();
legendData.add("许可有效率"); for (int i = 0; i < 8; i++) {
legendData.add("使用登记办理率"); Map<String, String> map = new HashMap<>();
legendData.add("检验超期率"); if (i == 0) {
legendData.add("检验合格率"); map.put("dataKey", "xuke");
legendData.add("充装检查率"); map.put("value", "许可有效率");
legendData.add("充装检查合格率"); } else if (i == 1) {
map.put("dataKey", "shiyongdengji");
map.put("value", "使用登记办理率");
} else if (i == 2) {
map.put("dataKey", "jianyanchaoqi");
map.put("value", "检验超期率");
} else if (i == 3) {
map.put("dataKey", "jianyanhege");
map.put("value", "检验合格率");
} else if (i == 4) {
map.put("dataKey", "czjc");
map.put("value", "充装检查");
} else if (i == 5) {
map.put("dataKey", "czjchege");
map.put("value", "充装检查合格率");
} else if (i == 6) {
map.put("dataKey", "ryhg");
map.put("value", "人员合规率(资质有效期统计)");
} else if (i == 7) {
map.put("dataKey", "sjhg");
map.put("value", "数据合规率");
}
legendData.add(map);
}
return legendData; return legendData;
} }
...@@ -219,20 +239,34 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -219,20 +239,34 @@ public class AQZSDPStatisticsServiceImpl {
Map<String, SecurityIndexCountItemDto> regionCodeSecurityIndexMap = getSecurityIndexCountItemDtoMap(regionModels); Map<String, SecurityIndexCountItemDto> regionCodeSecurityIndexMap = getSecurityIndexCountItemDtoMap(regionModels);
List<Map<String, String>> data = new ArrayList<>(); List<Map<String, String>> data = new ArrayList<>();
List<Map<String, String>> finalData = data; List<Map<String, String>> finalData = data;
/**
* 计算权重,总分100分:
* 检验超期率、检验合格率、充装检查率、充装检查合格率,占15%
* 许可有效率、使用登记办理率、人员合规率(资质有效期统计)、数据合规率,占10%
*/
double weightTen = 0.10;
double weightFifteen = 0.15;
regionCodeSecurityIndexMap.forEach((k, v) -> { regionCodeSecurityIndexMap.forEach((k, v) -> {
Map<String, String> item = new HashMap<>(); Map<String, String> item = new HashMap<>();
item.put("name", v.getRegionName()); item.put("name", v.getRegionName());
// 计算xuke的加权值 // 许可有效率的加权值
double xukeWeighted = Double.parseDouble(v.getXuke()) * 0.10; double xukeWeighted = Double.parseDouble(v.getXuke()) * weightTen;
// 剩余权重平均分配给四个因素,每个因素大约22.5%(但为了简化,我们这里用25%的剩余权重) // 使用登记办理率的加权值
double remainingWeightPerFactor = 0.90 / 4; double sydjWeighted = Double.parseDouble(v.getShiyongdengji()) * weightTen;
// 计算其他四个因素的加权值 // 人员合规率(资质有效期统计)的加权值
double jianyanchaoqiWeighted = Double.parseDouble(v.getJianyanchaoqi()) * remainingWeightPerFactor; double ryhgWeighted = Double.parseDouble(v.getRyhg()) * weightTen;
double jianyanhegeWeighted = Double.parseDouble(v.getJianyanhege()) * remainingWeightPerFactor; // 数据合规率的加权值
double czjcWeighted = Double.parseDouble(v.getCzjc()) * remainingWeightPerFactor; double sjhgWeighted = Double.parseDouble(v.getSjhg()) * weightTen;
double czjchegeWeighted = Double.parseDouble(v.getCzjchege()) * remainingWeightPerFactor; // 检验超期率的加权值
double jianyanchaoqiWeighted = Double.parseDouble(v.getJianyanchaoqi()) * weightFifteen;
// 检验合格率的加权值
double jianyanhegeWeighted = Double.parseDouble(v.getJianyanhege()) * weightFifteen;
// 充装检查率的加权值
double czjcWeighted = Double.parseDouble(v.getCzjc()) * weightFifteen;
// 充装检查合格率的加权值
double czjchegeWeighted = Double.parseDouble(v.getCzjchege()) * weightFifteen;
// 计算总指数 // 计算总指数
double totalIndex = xukeWeighted + jianyanchaoqiWeighted + jianyanhegeWeighted + czjcWeighted + czjchegeWeighted; double totalIndex = xukeWeighted + sydjWeighted + ryhgWeighted + sjhgWeighted + jianyanchaoqiWeighted + jianyanhegeWeighted + czjcWeighted + czjchegeWeighted;
item.put("value", String.format("%.2f", totalIndex)); item.put("value", String.format("%.2f", totalIndex));
finalData.add(item); finalData.add(item);
}); });
...@@ -303,6 +337,11 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -303,6 +337,11 @@ public class AQZSDPStatisticsServiceImpl {
} else { } else {
countItemDto.setCzjchege("0"); countItemDto.setCzjchege("0");
} }
// todo: 7.人员合规率(资质有效期统计) 8.数据合规率需求未明确暂时都为0
// 7.人员合规率(资质有效期统计)
countItemDto.setRyhg("0");
// 8.数据合规率
countItemDto.setSjhg("0");
} }
return countItemDto; return countItemDto;
}).collect(Collectors.toList()); }).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