Commit b6b6939b authored by 韩桐桐's avatar 韩桐桐

验收:运营监管分析中间地图补充假数据

parent 352a0bdd
......@@ -5,11 +5,9 @@ import com.yeejoin.amos.boot.module.ys.biz.service.CommonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.velocity.runtime.directive.Evaluate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -45,4 +43,12 @@ public class CommonController extends BaseController {
@PathVariable(value = "statisticalType") String statisticalType) {
return ResponseHelper.buildResponse(commonService.safetyTraceabilitySynthesis(statisticalType));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "运营监管分析中间地图", notes = "运营监管分析中间地图")
@RequestMapping(value = "/analysis/cityMapData", method = RequestMethod.GET)
public ResponseModel<Object> analysisCityMapData(@RequestParam(value = "firstMenuKey") String firstMenuKey,
@RequestParam(value = "secondMenuKey") String secondMenuKey) {
return ResponseHelper.buildResponse(commonService.analysisCityMapData(firstMenuKey, secondMenuKey));
}
}
......@@ -6,4 +6,6 @@ public interface CommonService {
Object safetyTraceabilitySynthesis(String statisticalType);
Object analysisCityMapData(String firstMenuKey, String secondMenuKey);
}
......@@ -4,6 +4,8 @@ import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DynamicFormInstanceServiceImpl;
import com.yeejoin.amos.boot.module.jg.api.entity.SafetyProblemTracing;
import com.yeejoin.amos.boot.module.jg.api.mapper.SafetyProblemTracingMapper;
......@@ -30,10 +32,14 @@ import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicLong;
......@@ -110,6 +116,20 @@ public class CommonServiceImpl implements CommonService {
.fluentPut("rehearsal", "应急演练数").fluentPut("prePlan", "应急预案数");
}
@Value("classpath:/json/analysisCityMapData.json")
private Resource analysisCityMapData;
private JsonNode jsonData;
@PostConstruct
public void init() {
try {
jsonData = new ObjectMapper().readTree(analysisCityMapData.getInputStream());
} catch (IOException e) {
throw new RuntimeException("Failed to read or parse JSON data", e);
}
}
/**
* 排序 :页面列表排序功能支持,将 "字段,ascend" 或 "字段,descend" 转化为对应JSONObject
*
......@@ -286,6 +306,7 @@ public class CommonServiceImpl implements CommonService {
/**
* 安全追溯-综合分析统计
*
* @param statisticalType 统计类型 creditSupervision(信用监管) 、 exceptionDirectory(异常名录)、seriousViolationOfLaw(严重违法)
* @return result
*/
......@@ -295,39 +316,39 @@ public class CommonServiceImpl implements CommonService {
if ("seriousViolationOfLaw".equals(statisticalType)) {
// 红码警示企业数
long comp = safetyProblemTracingMapper.selectCount(new LambdaQueryWrapper<SafetyProblemTracing>()
.eq(SafetyProblemTracing::getProblemStatusCode,0)
.eq(SafetyProblemTracing::getSourceTypeCode,2));
.eq(SafetyProblemTracing::getProblemStatusCode, 0)
.eq(SafetyProblemTracing::getSourceTypeCode, 2));
// 红码警示设备数
long equ = safetyProblemTracingMapper.selectCount(new LambdaQueryWrapper<SafetyProblemTracing>()
.eq(SafetyProblemTracing::getProblemStatusCode,0)
.eq(SafetyProblemTracing::getSourceTypeCode,3));
.eq(SafetyProblemTracing::getProblemStatusCode, 0)
.eq(SafetyProblemTracing::getSourceTypeCode, 3));
// 红码警示人员数
long peo = safetyProblemTracingMapper.selectCount(new LambdaQueryWrapper<SafetyProblemTracing>()
.eq(SafetyProblemTracing::getProblemStatusCode,0)
.eq(SafetyProblemTracing::getSourceTypeCode,1));
.eq(SafetyProblemTracing::getProblemStatusCode, 0)
.eq(SafetyProblemTracing::getSourceTypeCode, 1));
return JSONObject.parseObject(String.format(SERIOUS_VIOLATION_OF_LAW, comp, equ, peo));
}
// 异常名录 统计企业主体问题数量
if ("exceptionDirectory".equals(statisticalType)) {
// 问题企业数量
long comp = safetyProblemTracingMapper.selectList(new LambdaQueryWrapper<SafetyProblemTracing>()
.eq(SafetyProblemTracing::getProblemStatusCode,0)
.eq(SafetyProblemTracing::getSourceTypeCode,2)
.groupBy(SafetyProblemTracing::getPrincipalUnitCode))
.eq(SafetyProblemTracing::getProblemStatusCode, 0)
.eq(SafetyProblemTracing::getSourceTypeCode, 2)
.groupBy(SafetyProblemTracing::getPrincipalUnitCode))
.size();
// 非问题企业数量 (企业总数-问题企业数量)
long total = Privilege.companyClient.queryForCompanyList(null, null).getResult().size();
long other = (long) NumberUtil.sub(total,comp);
long other = (long) NumberUtil.sub(total, comp);
return JSONArray.parseArray(String.format(EXCEPTION_DIRECTORY, comp, other));
}
// 信用监管 统计绿、红、橙、灰码数量及占比
if ("creditSupervision".equals(statisticalType)) {
// 绿码
long greenCode = safetyProblemTracingMapper.selectCount(new LambdaQueryWrapper<SafetyProblemTracing>()
.eq(SafetyProblemTracing::getProblemStatusCode,1));
.eq(SafetyProblemTracing::getProblemStatusCode, 1));
// 红码
long redCode = safetyProblemTracingMapper.selectCount(new LambdaQueryWrapper<SafetyProblemTracing>()
.eq(SafetyProblemTracing::getProblemStatusCode,0));
.eq(SafetyProblemTracing::getProblemStatusCode, 0));
// 橙码
long orangeCode = 0L;
// 灰码
......@@ -336,4 +357,9 @@ public class CommonServiceImpl implements CommonService {
}
return null;
}
@Override
public Object analysisCityMapData(String firstMenuKey, String secondMenuKey) {
return new JSONObject().fluentPut("records", Collections.singletonList(jsonData.get(firstMenuKey).get(secondMenuKey)));
}
}
\ No newline at end of file
{
"底数清": {
"设备": {
"YULINNUM": "116256",
"YANANNUM": "61979",
"HANCHENGNUM": "21668",
"TONGCHUANNUM": "10538",
"WEINANNUM": "50877",
"XIANYANGNUM": "96436",
"BAOJINUM": "30731",
"YANGLINGNUM": "5870",
"XIANNUM": "185387",
"SHANGLUONUM": "7009",
"HANZHONGNUM": "36683",
"ANKANGNUM": "57340"
},
"高风险企业数": {
"YULINNUM": "1009",
"YANANNUM": "3482",
"HANCHENGNUM": "1003",
"TONGCHUANNUM": "3087",
"WEINANNUM": "980",
"XIANYANGNUM": "7265",
"BAOJINUM": "3854",
"YANGLINGNUM": "2398",
"XIANNUM": "8882",
"SHANGLUONUM": "981",
"HANZHONGNUM": "293",
"ANKANGNUM": "9211"
},
"人员": {
"YULINNUM": "451",
"YANANNUM": "221",
"HANCHENGNUM": "211",
"TONGCHUANNUM": "210",
"WEINANNUM": "129",
"XIANYANGNUM": "102",
"BAOJINUM": "200",
"YANGLINGNUM": "176",
"XIANNUM": "801",
"SHANGLUONUM": "129",
"HANZHONGNUM": "251",
"ANKANGNUM": "220"
}
},
"业务办理": {
"使用登记": {
"YULINNUM": "10091",
"YANANNUM": "39309",
"HANCHENGNUM": "93821",
"TONGCHUANNUM": "26209",
"WEINANNUM": "129029",
"XIANYANGNUM": "93837",
"BAOJINUM": "716321",
"YANGLINGNUM": "30193",
"XIANNUM": "38413",
"SHANGLUONUM": "74043",
"HANZHONGNUM": "40033",
"ANKANGNUM": "92239"
},
"安装改造修理单位": {
"YULINNUM": "30392",
"YANANNUM": "27211",
"HANCHENGNUM": "1202",
"TONGCHUANNUM": "29302",
"WEINANNUM": "20233",
"XIANYANGNUM": "3021",
"BAOJINUM": "29303",
"YANGLINGNUM": "20122",
"XIANNUM": "93011",
"SHANGLUONUM": "4122",
"HANZHONGNUM": "8332",
"ANKANGNUM": "18122"
},
"施工告知": {
"YULINNUM": "8291",
"YANANNUM": "2033",
"HANCHENGNUM": "4021",
"TONGCHUANNUM": "30399",
"WEINANNUM": "8282",
"XIANYANGNUM": "7233",
"BAOJINUM": "40022",
"YANGLINGNUM": "7333",
"XIANNUM": "7662",
"SHANGLUONUM": "8333",
"HANZHONGNUM": "7112",
"ANKANGNUM": "8221"
},
"检验": {
"YULINNUM": "123",
"YANANNUM": "362",
"HANCHENGNUM": "92",
"TONGCHUANNUM": "62",
"WEINANNUM": "72",
"XIANYANGNUM": "23",
"BAOJINUM": "45",
"YANGLINGNUM": "56",
"XIANNUM": "67",
"SHANGLUONUM": "67",
"HANZHONGNUM": "201",
"ANKANGNUM": "101"
}
},
"安全监管": {
"双重预防建设": {
"YULINNUM": "12",
"YANANNUM": "23",
"HANCHENGNUM": "363",
"TONGCHUANNUM": "932",
"WEINANNUM": "245",
"XIANYANGNUM": "498",
"BAOJINUM": "274",
"YANGLINGNUM": "228",
"XIANNUM": "531",
"SHANGLUONUM": "347",
"HANZHONGNUM": "890",
"ANKANGNUM": "125"
},
"两个清单": {
"YULINNUM": "346",
"YANANNUM": "789",
"HANCHENGNUM": "123",
"TONGCHUANNUM": "573",
"WEINANNUM": "982",
"XIANYANGNUM": "452",
"BAOJINUM": "127",
"YANGLINGNUM": "452",
"XIANNUM": "323",
"SHANGLUONUM": "356",
"HANZHONGNUM": "346",
"ANKANGNUM": "111"
},
"专项整治": {
"YULINNUM": "122",
"YANANNUM": "12",
"HANCHENGNUM": "78",
"TONGCHUANNUM": "56",
"WEINANNUM": "124",
"XIANYANGNUM": "17",
"BAOJINUM": "97",
"YANGLINGNUM": "43",
"XIANNUM": "87",
"SHANGLUONUM": "12",
"HANZHONGNUM": "87",
"ANKANGNUM": "98"
},
"监察": {
"YULINNUM": "123",
"YANANNUM": "76",
"HANCHENGNUM": "34",
"TONGCHUANNUM": "89",
"WEINANNUM": "998",
"XIANYANGNUM": "43",
"BAOJINUM": "33",
"YANGLINGNUM": "76",
"XIANNUM": "135",
"SHANGLUONUM": "974",
"HANZHONGNUM": "234",
"ANKANGNUM": "765"
},
"应急监管": {
"YULINNUM": "12",
"YANANNUM": "344",
"HANCHENGNUM": "654",
"TONGCHUANNUM": "345",
"WEINANNUM": "345",
"XIANYANGNUM": "754",
"BAOJINUM": "123",
"YANGLINGNUM": "76",
"XIANNUM": "98",
"SHANGLUONUM": "54",
"HANZHONGNUM": "12",
"ANKANGNUM": "87"
}
}
}
\ No newline at end of file
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