Commit a9691c08 authored by wujiang's avatar wujiang

修改部盾接口

parent 5d169bb4
......@@ -81,6 +81,9 @@ public class Constants {
public static final String get_generated_quota_trend="method=scene_screen.data_interface.get_generated_quota_trend";
public static final String get_province_station_item="method=scene_screen.data_interface.get_province_station_item";
public static final String get_day_generation_trend="method=scene_screen.data_interface.get_day_generation_trend";
public static final String get_quota_info="method=scene_screen.large_screen.get_quota_info";
public static final String get_station_actual_installed_capacity="method=scene_screen.large_screen.get_station_actual_installed_capacity";
public static final String get_quota_complate_info="method=scene_screen.large_screen.get_quota_complate_info";
public static final String resovleRule_data = "data";
public static final String areaChinese="区域";
}
......
......@@ -66,4 +66,18 @@ public class HttpRequestUtil {
}
return result;
}
public JSONObject getResPonse(String apiurl, String requestMethod, String requestParmInfo, String ResultResolveRule) {
String response = "";
String params = "";
JSONObject jsonObject = null;
try {
response = sendRequest(requestMethod, apiurl, requestParmInfo, null);
jsonObject = JSONObject.parseObject(response);
jsonObject = jsonObject.getJSONObject(ResultResolveRule);
} catch (Exception exception) {
return jsonObject;
}
return jsonObject;
}
}
......@@ -3,11 +3,14 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.entity.*;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.*;
import com.yeejoin.amos.boot.module.jxiop.api.util.Constants;
import com.yeejoin.amos.boot.module.jxiop.api.util.HttpRequestUtil;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
......@@ -26,6 +29,8 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
......@@ -75,6 +80,9 @@ public class MonitoringServiceImpl {
// @Autowired
// InfluxdbUtil influxdbUtil;
@Autowired
private HttpRequestUtil httpRequestUtil;
/**
* 根据场站编号获取该场站的装机容量
*
......@@ -1054,27 +1062,23 @@ public class MonitoringServiceImpl {
stringHashMap9.put("title",
String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get()));
HashMap<String, String> resultMap = new HashMap<>();
resultMap.put("Day", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get()));
//resultMap.put("Day", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get()));
list2.add(stringHashMap9);
HashMap<String, String> stringHashMap10 = new HashMap<>();
stringHashMap10.put("title",
String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get()));
resultMap.put("Moon",
String.format(CommonConstans.Fourdecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get()));
resultMap.put("YJHWC", String.format(CommonConstans.Twodecimalplaces,
(powerOfMonthFD.get() + powerOfMonthGF.get()) / moonValue * 100));
//resultMap.put("Moon",String.format(CommonConstans.Fourdecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get()));
//resultMap.put("YJHWC", String.format(CommonConstans.Twodecimalplaces,(powerOfMonthFD.get() + powerOfMonthGF.get()) / moonValue * 100));
list2.add(stringHashMap10);
HashMap<String, String> stringHashMap11 = new HashMap<>();
stringHashMap11.put("title",
String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get()));
resultMap.put("Year",
String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get()));
//resultMap.put("Year",String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get()));
list2.add(stringHashMap11);
HashMap<String, String> stringHashMap12 = new HashMap<>();
stringHashMap12.put("title", String.format(CommonConstans.Twodecimalplaces,
(powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100));
resultMap.put("NJHWC", String.format(CommonConstans.Twodecimalplaces,
(powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100));
//resultMap.put("NJHWC", String.format(CommonConstans.Twodecimalplaces,(powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100));
list2.add(stringHashMap12);
page2.setRecords(list2);
Double totalAnnual = (powerOfAnnualFD.get() + powerOfAnnualGF.get());
......@@ -1099,6 +1103,20 @@ public class MonitoringServiceImpl {
stringHashMap16.put("unit", "二氧化硫减排量(t)");
list3.add(stringHashMap16);
page3.setRecords(list3);
//改为部盾接口
String requestUrl = Constants.BASE_URL + "?" + Constants.get_quota_info;
LocalDate currentDate = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedDate = currentDate.format(formatter);
JSONObject data = httpRequestUtil.getResPonse(requestUrl+"&reporting_data="+formattedDate, Constants.REQUEST_GET, "",
Constants.resovleRule_data);
resultMap.put("Day", data.getString("day_generating_capacity"));
resultMap.put("Moon", data.getString("month_generating_capacity"));
resultMap.put("Year", data.getString("year_generating_capacity"));
resultMap.put("YJHWC", data.getString("year_quota_rate").replace("%", ""));
resultMap.put("NJHWC", data.getString("month_quota_rate").replace("%", ""));
try {
emqKeeper.getMqttClient().publish("bigscreen_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1,
true);
......
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