|
@@ -8,15 +8,11 @@ import com.project.common.enums.BusinessType;
|
|
|
import com.project.common.enums.EmployeeTypeEnum;
|
|
|
import com.project.common.utils.StringUtils;
|
|
|
import com.project.common.utils.http.HttpUtils;
|
|
|
-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.domain.unit.LargeBuilding;
|
|
|
import com.project.zcustom.mapper.unit.PlatBuildingMapper;
|
|
|
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;
|
|
@@ -28,7 +24,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.time.LocalDate;
|
|
|
-import java.util.*;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -58,10 +55,6 @@ public class DataTools {
|
|
|
IPlatAccessService iPlatAccessService;
|
|
|
@Resource
|
|
|
IPlatApiRecordService iPlatApiRecordService;
|
|
|
- @Resource
|
|
|
- IPlatBuildYearTrendService iPlatBuildYearTrendService;
|
|
|
- @Resource
|
|
|
- IPlatBuildParamsService iPlatBuildParamsService;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -145,14 +138,14 @@ public class DataTools {
|
|
|
String result = null;
|
|
|
if (!StringUtils.isEmpty(params)){
|
|
|
String res = HttpUtils.sendGet(url, params);
|
|
|
- if (!StringUtils.isEmpty(res)){
|
|
|
+ if (StringUtils.isNotBlank(res)){
|
|
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
result = jsonObject.getString("data");
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
String res = HttpUtils.sendGet(url);
|
|
|
- if (!StringUtils.isEmpty(res)){
|
|
|
+ if (StringUtils.isNotBlank(res)){
|
|
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
result = jsonObject.getString("data");
|
|
|
}
|
|
@@ -160,230 +153,4 @@ public class DataTools {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 数据中心机房信息接口
|
|
|
- */
|
|
|
- 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("");
|
|
|
- iPlatApiRecordService.save(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);
|
|
|
- iPlatApiRecordService.save(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);
|
|
|
- iPlatApiRecordService.save(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);
|
|
|
- iPlatApiRecordService.save(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);
|
|
|
- iPlatApiRecordService.save(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);
|
|
|
- iPlatApiRecordService.save(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("");
|
|
|
- iPlatApiRecordService.save(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,"");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
}
|