|
@@ -1,702 +0,0 @@
|
|
-package com.project.zcustom.tools;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-import com.alibaba.fastjson2.JSONArray;
|
|
|
|
-import com.alibaba.fastjson2.JSONObject;
|
|
|
|
-import com.project.zcustom.controller.core.HttpUtils;
|
|
|
|
-import com.project.zcustom.controller.core.StringUtils;
|
|
|
|
-import com.project.zcustom.domain.build.PlatBuildParams;
|
|
|
|
-import com.project.zcustom.domain.build.PlatBuildYearTrend;
|
|
|
|
-import com.project.zcustom.domain.plat.PlatApiRecord;
|
|
|
|
-import com.project.zcustom.mapper.plat.PlatApiRecordMapper;
|
|
|
|
-import com.project.zcustom.service.access.IPlatAccessService;
|
|
|
|
-import com.project.zcustom.service.basics.IPlatBasicsService;
|
|
|
|
-import com.project.zcustom.service.build.IPlatBuildParamsService;
|
|
|
|
-import com.project.zcustom.service.build.IPlatBuildYearTrendService;
|
|
|
|
-import com.project.zcustom.service.employee.IPlatEmployeeHealthService;
|
|
|
|
-import com.project.zcustom.service.employee.IPlatEmployeeTypeService;
|
|
|
|
-import com.project.zcustom.service.plat.IPlatApiRecordService;
|
|
|
|
-import com.project.zcustom.service.post.IPlatPostStationService;
|
|
|
|
-import com.project.zcustom.service.property.IPlatPropertyService;
|
|
|
|
-import com.project.zcustom.service.smart.IPlatGreenSmartOtherService;
|
|
|
|
-import org.slf4j.Logger;
|
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
|
-
|
|
|
|
-import javax.annotation.Resource;
|
|
|
|
-import java.util.Arrays;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.Objects;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * 数据获取
|
|
|
|
- *
|
|
|
|
- * @author change
|
|
|
|
- * @date 2024-10-21
|
|
|
|
- */
|
|
|
|
-@Service
|
|
|
|
-public class DataTools {
|
|
|
|
- private static final Logger log = LoggerFactory.getLogger(DataTools.class);
|
|
|
|
-
|
|
|
|
- @Resource
|
|
|
|
- IPlatEmployeeTypeService platEmployeeTypeService;
|
|
|
|
- @Resource
|
|
|
|
- IPlatEmployeeHealthService platEmployeeHealthService;
|
|
|
|
- @Resource
|
|
|
|
- IPlatBasicsService platBasicsService;
|
|
|
|
- @Resource
|
|
|
|
- IPlatPostStationService postStationService;
|
|
|
|
- @Resource
|
|
|
|
- IPlatPropertyService platPropertyService;
|
|
|
|
- @Resource
|
|
|
|
- IPlatGreenSmartOtherService iPlatGreenSmartOtherService;
|
|
|
|
- @Resource
|
|
|
|
- IPlatAccessService iPlatAccessService;
|
|
|
|
- @Resource
|
|
|
|
- IPlatApiRecordService iPlatApiRecordService;
|
|
|
|
- @Resource
|
|
|
|
- IPlatBuildYearTrendService iPlatBuildYearTrendService;
|
|
|
|
- @Resource
|
|
|
|
- IPlatBuildParamsService iPlatBuildParamsService;
|
|
|
|
- @Resource
|
|
|
|
- PlatApiRecordMapper platApiRecordMapper;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 获取服务保障中心的数据
|
|
|
|
- */
|
|
|
|
- public void getServiceData(String appOrg, String appName) {
|
|
|
|
- String url = ApiUrlConfig.getServiceUrl();
|
|
|
|
- System.out.printf("------------服务保障中心:%s", url);
|
|
|
|
- JSONObject params = new JSONObject();
|
|
|
|
- params.put("appOrg", appOrg);
|
|
|
|
- String result = HttpUtils.sendPost(url, params.toJSONString());
|
|
|
|
- log.info("result======================{}",result);
|
|
|
|
- log.info("url======================{}",url);
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
-
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg(appOrg);
|
|
|
|
- log.info("platApiRecord======================{}",platApiRecord);
|
|
|
|
- log.info("start++++++++++++++++++++++++++++++++");
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
- log.info("end++++++++++++++++++++++++++++++++");
|
|
|
|
-
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("entity")) {
|
|
|
|
- JSONArray data = JSONArray.parseArray(resultMap.get("entity").toString());
|
|
|
|
- for (Object o : data) {
|
|
|
|
- Map<String, Object> temp = JSONObject.parseObject(o.toString(), Map.class);
|
|
|
|
- if (temp.containsKey("dataType")) {
|
|
|
|
- if (temp.containsKey("dataResult")) {
|
|
|
|
- Map<String, Object> dataResult = JSONObject.parseObject(temp.get("dataResult").toString(), Map.class);
|
|
|
|
- if (Objects.equals(temp.get("dataType").toString(), "employeeType")) {
|
|
|
|
- platEmployeeTypeService.addPlatEmployeeType(appOrg, dataResult);
|
|
|
|
- } else if (Objects.equals(temp.get("dataType").toString(), "employeeHealth")) {
|
|
|
|
- platEmployeeHealthService.addPlatEmployeeHealth(appOrg, dataResult);
|
|
|
|
- } else if (Objects.equals(temp.get("dataType").toString(), "greenSmart")) {
|
|
|
|
- iPlatGreenSmartOtherService.addPlatGreenSmartOther(appOrg, dataResult);
|
|
|
|
- } else if (Objects.equals(temp.get("dataType").toString(), "postStation")) {
|
|
|
|
- postStationService.addPlatPostStation(appOrg, dataResult);
|
|
|
|
- } else if (Objects.equals(temp.get("dataType").toString(), "property")) {
|
|
|
|
- platPropertyService.addPlatProperty(appOrg, dataResult);
|
|
|
|
- } else if (Objects.equals(temp.get("dataType").toString(), "basics")) {
|
|
|
|
- platBasicsService.addPlatBasics(appOrg, appName, dataResult);
|
|
|
|
- } else if (Objects.equals(temp.get("dataType").toString(), "access")) {
|
|
|
|
- iPlatAccessService.addPlatAccess(appOrg, dataResult);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- throw new RuntimeException("接口返回失败:" + result);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- throw new RuntimeException("接口请求失败:" + result);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 碳排放量月度变化趋势图接口
|
|
|
|
- */
|
|
|
|
- public void getCarbonData(String appOrg) {
|
|
|
|
- String url = ApiUrlConfig.getBuildCarbonEmissionStatistics();
|
|
|
|
-// String params = "startTime=''&endTime=''";
|
|
|
|
- String params = "";
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg(appOrg);
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
-
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- List<Map<String, Object>> dataList = StringUtils.getListMap(resultMap.get("data").toString());
|
|
|
|
- if (!dataList.isEmpty()) {
|
|
|
|
- List<String> keyList = Arrays.asList("key", "value", "value1", "title", "title1");
|
|
|
|
- for (Map<String, Object> map : dataList) {
|
|
|
|
- PlatBuildYearTrend platBuildYearTrend = new PlatBuildYearTrend();
|
|
|
|
- iPlatBuildYearTrendService.setBuildYearTrendData(platBuildYearTrend,keyList,map,0,"");
|
|
|
|
- iPlatBuildYearTrendService.addPlatBuildYearTrend(platBuildYearTrend,"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 年度累计综合能耗
|
|
|
|
- */
|
|
|
|
- public void getEnergyData() {
|
|
|
|
- String url = ApiUrlConfig.getBuildEnergyForYear();
|
|
|
|
- String params = "";
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg("");
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
-
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- Map<String, Object> mapData = JSONObject.parseObject(resultMap.get("data").toString(), Map.class);
|
|
|
|
- PlatBuildParams platBuildParams = new PlatBuildParams();
|
|
|
|
- List<String> keyList = Arrays.asList("name","key","value","value1","value2","value3");
|
|
|
|
- iPlatBuildParamsService.setBuildParamsData(platBuildParams,keyList,mapData,0,"");
|
|
|
|
- iPlatBuildParamsService.addPlatBuildParams(platBuildParams,"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 年度综合能耗趋势接口
|
|
|
|
- */
|
|
|
|
- public void getEnergyStatisticsData() {
|
|
|
|
- String url = ApiUrlConfig.getBuildEnergyStatistics();
|
|
|
|
- // String params = "startTime=''&endTime=''";
|
|
|
|
- String params = "";
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg("");
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- List<Map<String, Object>> dataList = StringUtils.getListMap(resultMap.get("data").toString());
|
|
|
|
- if (!dataList.isEmpty()) {
|
|
|
|
- List<String> keyList = Arrays.asList("key", "value", "value1", "title", "title1");
|
|
|
|
- for (Map<String, Object> map : dataList) {
|
|
|
|
- PlatBuildYearTrend platBuildYearTrend = new PlatBuildYearTrend();
|
|
|
|
- iPlatBuildYearTrendService.setBuildYearTrendData(platBuildYearTrend,keyList,map,1,"");
|
|
|
|
- iPlatBuildYearTrendService.addPlatBuildYearTrend(platBuildYearTrend,"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 年度累计电耗接口
|
|
|
|
- */
|
|
|
|
- public void getPowerStatisticsData() {
|
|
|
|
- String url = ApiUrlConfig.getBuildPowerForYear();
|
|
|
|
- String params = "";
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg("");
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
-
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- List<Map<String, Object>> dataList = StringUtils.getListMap(resultMap.get("data").toString());
|
|
|
|
- if (!dataList.isEmpty()) {
|
|
|
|
- List<String> keyList = Arrays.asList("name","key","value","value1","value2","value3");
|
|
|
|
- for (Map<String, Object> map : dataList) {
|
|
|
|
- PlatBuildParams platBuildParams = new PlatBuildParams();
|
|
|
|
- iPlatBuildParamsService.setBuildParamsData(platBuildParams,keyList,map,1,"");
|
|
|
|
- iPlatBuildParamsService.addPlatBuildParams(platBuildParams,"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 年度电耗趋势接口
|
|
|
|
- */
|
|
|
|
- public void getElectricityStatisticsData() {
|
|
|
|
- String url = ApiUrlConfig.getBuildElectricityStatistics();
|
|
|
|
- // String params = "startTime=''&endTime=''";
|
|
|
|
- String params = "";
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg("");
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
-
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- List<Map<String, Object>> dataList = StringUtils.getListMap(resultMap.get("data").toString());
|
|
|
|
- if (!dataList.isEmpty()) {
|
|
|
|
- List<String> keyList = Arrays.asList("key", "value", "value1", "title", "title1");
|
|
|
|
- for (Map<String, Object> map : dataList) {
|
|
|
|
- PlatBuildYearTrend platBuildYearTrend = new PlatBuildYearTrend();
|
|
|
|
- iPlatBuildYearTrendService.setBuildYearTrendData(platBuildYearTrend,keyList,map,2,"");
|
|
|
|
- iPlatBuildYearTrendService.addPlatBuildYearTrend(platBuildYearTrend,"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 年度累计水耗接口
|
|
|
|
- */
|
|
|
|
- public void getWaterData() {
|
|
|
|
- String url = ApiUrlConfig.getBuildWaterForYear();
|
|
|
|
- String params = "";
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg("");
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
-
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- Map<String, Object> mapData = JSONObject.parseObject(resultMap.get("data").toString(), Map.class);
|
|
|
|
- PlatBuildParams platBuildParams = new PlatBuildParams();
|
|
|
|
- List<String> keyList = Arrays.asList("name","key","value","value1","value2","value3");
|
|
|
|
- iPlatBuildParamsService.setBuildParamsData(platBuildParams,keyList,mapData,2,"");
|
|
|
|
- iPlatBuildParamsService.addPlatBuildParams(platBuildParams,"");
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 年度水耗趋势接口
|
|
|
|
- */
|
|
|
|
- public void getWaterStatisticsData() {
|
|
|
|
- String url = ApiUrlConfig.getBuildWaterStatistics();
|
|
|
|
- // String params = "startTime=''&endTime=''";
|
|
|
|
- String params = "";
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg("");
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
-
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- List<Map<String, Object>> dataList = StringUtils.getListMap(resultMap.get("data").toString());
|
|
|
|
- if (!dataList.isEmpty()) {
|
|
|
|
- List<String> keyList = Arrays.asList("key", "value", "value1", "title", "title1");
|
|
|
|
- for (Map<String, Object> map : dataList) {
|
|
|
|
- PlatBuildYearTrend platBuildYearTrend = new PlatBuildYearTrend();
|
|
|
|
- iPlatBuildYearTrendService.setBuildYearTrendData(platBuildYearTrend,keyList,map,3,"");
|
|
|
|
- iPlatBuildYearTrendService.addPlatBuildYearTrend(platBuildYearTrend,"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 年度累计非供暖能耗接口
|
|
|
|
- */
|
|
|
|
- public void getNonHeatingData(String appOrg) {
|
|
|
|
- String url = ApiUrlConfig.getBuildNonHeatingEnergyForYear();
|
|
|
|
- String params = "appOrg=" + appOrg;
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg(appOrg);
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
-
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- Map<String, Object> mapData = JSONObject.parseObject(resultMap.get("data").toString(), Map.class);
|
|
|
|
- PlatBuildParams platBuildParams = new PlatBuildParams();
|
|
|
|
- List<String> keyList = Arrays.asList("name","key","num","value1","value2","value3");
|
|
|
|
- iPlatBuildParamsService.setBuildParamsData(platBuildParams,keyList,mapData,0,"");
|
|
|
|
- iPlatBuildParamsService.addPlatBuildParams(platBuildParams,"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 年度非供暖能耗趋势接口
|
|
|
|
- */
|
|
|
|
- public void getUsePowerStatistics(String appOrg) {
|
|
|
|
- String url = ApiUrlConfig.getBuildUsePowerStatistics();
|
|
|
|
- String params = "appOrg=" + appOrg;
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg(appOrg);
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
-
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- List<Map<String, Object>> dataList = StringUtils.getListMap(resultMap.get("data").toString());
|
|
|
|
- if (!dataList.isEmpty()) {
|
|
|
|
- List<String> keyList = Arrays.asList("key", "value", "value1", "title", "title1");
|
|
|
|
- for (Map<String, Object> map : dataList) {
|
|
|
|
- PlatBuildYearTrend platBuildYearTrend = new PlatBuildYearTrend();
|
|
|
|
- iPlatBuildYearTrendService.setBuildYearTrendData(platBuildYearTrend,keyList,map,4,"");
|
|
|
|
- iPlatBuildYearTrendService.addPlatBuildYearTrend(platBuildYearTrend,"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 月用电量信息接口
|
|
|
|
- */
|
|
|
|
- public void getPowerForMonth() {
|
|
|
|
- String url = ApiUrlConfig.getBuildPowerForMonth();
|
|
|
|
- String params = "";
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg("");
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- List<Map<String, Object>> dataList = StringUtils.getListMap(resultMap.get("data").toString());
|
|
|
|
- if (!dataList.isEmpty()) {
|
|
|
|
- List<String> keyList = Arrays.asList("name","key","value","value1","value2","value3");
|
|
|
|
- for (Map<String, Object> map : dataList) {
|
|
|
|
- PlatBuildParams platBuildParams = new PlatBuildParams();
|
|
|
|
- iPlatBuildParamsService.setBuildParamsData(platBuildParams,keyList,map,4,"");
|
|
|
|
- iPlatBuildParamsService.addPlatBuildParams(platBuildParams,"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 楼宇月用水电热信息接口
|
|
|
|
- */
|
|
|
|
- public void getUseHeatGas() {
|
|
|
|
- String url = ApiUrlConfig.getBuildUseHeatGas();
|
|
|
|
- String params = "";
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg("");
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
-
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- List<Map<String, Object>> dataList = StringUtils.getListMap(resultMap.get("data").toString());
|
|
|
|
- if (!dataList.isEmpty()) {
|
|
|
|
- List<String> keyList = Arrays.asList("name","key","num","value1","value2","value3");
|
|
|
|
- for (Map<String, Object> map : dataList) {
|
|
|
|
- PlatBuildParams platBuildParams = new PlatBuildParams();
|
|
|
|
- iPlatBuildParamsService.setBuildParamsData(platBuildParams,keyList,map,5,"");
|
|
|
|
- iPlatBuildParamsService.addPlatBuildParams(platBuildParams,"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 数据中心机房信息接口
|
|
|
|
- */
|
|
|
|
- public void getDataCenterRoom() {
|
|
|
|
- String url = ApiUrlConfig.getBuildDataCenterRoom();
|
|
|
|
- String params = "";
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg("");
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
-
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- List<Map<String, Object>> dataList = StringUtils.getListMap(resultMap.get("data").toString());
|
|
|
|
- if (!dataList.isEmpty()) {
|
|
|
|
- List<String> keyList = Arrays.asList("name","key","num","value1","value2","value3");
|
|
|
|
- for (Map<String, Object> map : dataList) {
|
|
|
|
- PlatBuildParams platBuildParams = new PlatBuildParams();
|
|
|
|
- iPlatBuildParamsService.setBuildParamsData(platBuildParams,keyList,map,6,"");
|
|
|
|
- iPlatBuildParamsService.addPlatBuildParams(platBuildParams,"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 供暖能耗信息接口
|
|
|
|
- */
|
|
|
|
- public void getHeatingEnergy(String appOrg) {
|
|
|
|
- String url = ApiUrlConfig.getBuildHeatingEnergy();
|
|
|
|
- String params = "appOrg=" + appOrg;
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg(appOrg);
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- List<Map<String, Object>> dataList = StringUtils.getListMap(resultMap.get("data").toString());
|
|
|
|
- if (!dataList.isEmpty()) {
|
|
|
|
- List<String> keyList = Arrays.asList("name","key","num","value1","value2","value3");
|
|
|
|
- for (Map<String, Object> map : dataList) {
|
|
|
|
- PlatBuildParams platBuildParams = new PlatBuildParams();
|
|
|
|
- iPlatBuildParamsService.setBuildParamsData(platBuildParams,keyList,map,7,"");
|
|
|
|
- iPlatBuildParamsService.addPlatBuildParams(platBuildParams,"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 燃气用量信息接口
|
|
|
|
- */
|
|
|
|
- public void getGasInfo(String appOrg) {
|
|
|
|
- String url = ApiUrlConfig.getBuildGasInfo();
|
|
|
|
- String params = "appOrg=" + appOrg;
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg(appOrg);
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- List<Map<String, Object>> dataList = StringUtils.getListMap(resultMap.get("data").toString());
|
|
|
|
- if (!dataList.isEmpty()) {
|
|
|
|
- List<String> keyList = Arrays.asList("name","key","num","value1","value2","value3");
|
|
|
|
- for (Map<String, Object> map : dataList) {
|
|
|
|
- PlatBuildParams platBuildParams = new PlatBuildParams();
|
|
|
|
- iPlatBuildParamsService.setBuildParamsData(platBuildParams,keyList,map,8,"");
|
|
|
|
- iPlatBuildParamsService.addPlatBuildParams(platBuildParams,"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 资源信息接口
|
|
|
|
- */
|
|
|
|
- public void getResourceInfo(String appOrg) {
|
|
|
|
- String url = ApiUrlConfig.getBuildResourceInfo();
|
|
|
|
- String params = "appOrg=" + appOrg;
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg(appOrg);
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- List<Map<String, Object>> dataList = StringUtils.getListMap(resultMap.get("data").toString());
|
|
|
|
- if (!dataList.isEmpty()) {
|
|
|
|
- List<String> keyList = Arrays.asList("name","key","num","value1","value2","value3");
|
|
|
|
- for (Map<String, Object> map : dataList) {
|
|
|
|
- PlatBuildParams platBuildParams = new PlatBuildParams();
|
|
|
|
- iPlatBuildParamsService.setBuildParamsData(platBuildParams,keyList,map,9,"");
|
|
|
|
- iPlatBuildParamsService.addPlatBuildParams(platBuildParams,"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 可再生电力信息接口
|
|
|
|
- */
|
|
|
|
- public void getGreenPowerInfo(String appOrg) {
|
|
|
|
- String url = ApiUrlConfig.getBuildGreenPowerInfo();
|
|
|
|
- String params = "appOrg=" + appOrg;
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg(appOrg);
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- List<Map<String, Object>> dataList = StringUtils.getListMap(resultMap.get("data").toString());
|
|
|
|
- if (!dataList.isEmpty()) {
|
|
|
|
- List<String> keyList = Arrays.asList("name","key","num","value1","value2","value3");
|
|
|
|
- for (Map<String, Object> map : dataList) {
|
|
|
|
- PlatBuildParams platBuildParams = new PlatBuildParams();
|
|
|
|
- iPlatBuildParamsService.setBuildParamsData(platBuildParams,keyList,map,10,"");
|
|
|
|
- iPlatBuildParamsService.addPlatBuildParams(platBuildParams,"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 办公碳排放情况
|
|
|
|
- */
|
|
|
|
- public void getOfficeCarbonForYear(String appOrg) {
|
|
|
|
- String url = ApiUrlConfig.getBuildOfficeCarbonForYear();
|
|
|
|
- String params = "";
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg(appOrg);
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- Map<String, Object> mapData = JSONObject.parseObject(resultMap.get("data").toString(), Map.class);
|
|
|
|
- PlatBuildParams platBuildParams = new PlatBuildParams();
|
|
|
|
- List<String> keyList = Arrays.asList("name","key","value","value1","value2","value3");
|
|
|
|
- iPlatBuildParamsService.setBuildParamsData(platBuildParams,keyList,mapData,11,"");
|
|
|
|
- iPlatBuildParamsService.addPlatBuildParams(platBuildParams,"");
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 各单位年度累计办公碳排放量统计接口
|
|
|
|
- */
|
|
|
|
- public void getOfficeCarbon() {
|
|
|
|
- String url = ApiUrlConfig.getBuildOfficeCarbonForFloor();
|
|
|
|
- String params = "";
|
|
|
|
- String result = HttpUtils.sendGet(url, params);
|
|
|
|
-
|
|
|
|
- // 添加接口请求记录
|
|
|
|
- PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
|
- platApiRecord.setApiUrl(url);
|
|
|
|
- platApiRecord.setApiResult(result);
|
|
|
|
- platApiRecord.setAppOrg("");
|
|
|
|
- platApiRecordMapper.insertPlatApiRecord(platApiRecord);
|
|
|
|
- System.out.printf("------------接口返回:%s", result);
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotBlank(result)) {
|
|
|
|
- Map<String, Object> resultMap = JSONObject.parseObject(result, Map.class);
|
|
|
|
- if (Objects.equals(resultMap.get("code").toString(), "200") && resultMap.containsKey("data")) {
|
|
|
|
- List<Map<String, Object>> dataList = StringUtils.getListMap(resultMap.get("data").toString());
|
|
|
|
- if (!dataList.isEmpty()) {
|
|
|
|
- List<String> keyList = Arrays.asList("name","key","num","value1","value2","value3");
|
|
|
|
- for (Map<String, Object> map : dataList) {
|
|
|
|
- PlatBuildParams platBuildParams = new PlatBuildParams();
|
|
|
|
- iPlatBuildParamsService.setBuildParamsData(platBuildParams,keyList,map,12,"");
|
|
|
|
- iPlatBuildParamsService.addPlatBuildParams(platBuildParams,"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-}
|
|
|