Commit 77e1f451 authored by hezhuozhi's avatar hezhuozhi

Merge remote-tracking branch 'origin/developer' into developer

parents 145bae59 c35b4ebe
......@@ -2,9 +2,12 @@ package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptor;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.EnergyAccessServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
......@@ -20,10 +23,13 @@ public class EnergyAccessController extends BaseController {
@Autowired
EnergyAccessServiceImpl energyAccessServiceImpl;
private final Logger logger = LoggerFactory.getLogger(EnergyAccessController.class);
@RequestMapping(value = "/getInstalledCapacity", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取并网容量", notes = "获取并网容量")
public Page<Map<String, Object>> getInstalledCapacity(String current, String pageSize, String code,String sourceStationId,String tp) {
logger.info("获取并网容量接口入参:current ={},pageSize ={},code = {},sourceStationId = {},tp = {}",current,pageSize,code,sourceStationId,tp);
return energyAccessServiceImpl.getInstalledCapacity(current, pageSize, code,sourceStationId,tp);
}
......@@ -31,6 +37,7 @@ public class EnergyAccessController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取片区指标完成情况", notes = "获取片区指标完成情况")
public Page<Map<String, Object>> getQuotaCompleteInfo(String current, String pageSize, String code,String sourceStationId,String tp) {
logger.info("获取片区指标完成情况入参:current ={},pageSize ={},code = {},sourceStationId = {},tp = {}",current,pageSize,code,sourceStationId,tp);
return energyAccessServiceImpl.getQuotaCompleteInfo(current, pageSize, code,sourceStationId,tp);
}
}
......
package com.yeejoin.amos.boot.module.jxiop.biz.initdata;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MapRegion;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region;
......@@ -12,16 +24,6 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.QueryDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SjglZsjZsbtzMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class StationCacheDataInit implements CommandLineRunner {
......@@ -42,7 +44,7 @@ public class StationCacheDataInit implements CommandLineRunner {
public void run(String... args) throws Exception {
redisTemplate.delete("station_info_cache_bigscreen");
List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>();
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("\"LEVEL\"", 1));
List<Region> regionList = regionMapper.selectList(new LambdaQueryWrapper<Region>().eq(Region::getLevel_, 1));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
stationBasicList.forEach(stationBasic -> {
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.service.EnergyAccessService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -23,6 +23,8 @@ public class EnergyAccessServiceImpl implements EnergyAccessService {
@Autowired
private HttpRequestUtil httpRequestUtil;
private final Logger logger = LoggerFactory.getLogger(EnergyAccessServiceImpl.class);
@Override
public Page<Map<String, Object>> getInstalledCapacity(String current, String pageSize, String code, String sourceStationId, String tp) {
//改为部盾接口
......@@ -42,6 +44,7 @@ public class EnergyAccessServiceImpl implements EnergyAccessService {
Constants.resovleRule_data);
List returnList = data.getJSONArray("data");
logger.info("获取并网容量接口调用对端返回结果:{}",returnList.toString());
Page<Map<String, Object>> pageIPage;
int newCurrent = Integer.parseInt(current);
......@@ -63,6 +66,7 @@ public class EnergyAccessServiceImpl implements EnergyAccessService {
} else {
pageIPage.setRecords(returnList.subList(((newCurrent - 1) * newPageSize), returnList.size()));
}
logger.info("获取并网容量接口最终返回结果:{}",pageIPage.getRecords());
return pageIPage;
}
......@@ -89,6 +93,7 @@ public class EnergyAccessServiceImpl implements EnergyAccessService {
Constants.resovleRule_data);
List returnList = data.getJSONArray("data");
logger.info("获取片区指标完成情况调用对端返回结果:{}",returnList.toString());
//rate的值去掉百分号,名称字段名统一用name代替
Page<Map<String, Object>> pageIPage;
int newCurrent = Integer.parseInt(current);
......@@ -125,6 +130,7 @@ public class EnergyAccessServiceImpl implements EnergyAccessService {
} else {
pageIPage.setRecords(returnList.subList(((newCurrent - 1) * newPageSize), returnList.size()));
}
logger.info("获取片区指标完成情况最终返回结果:{}",pageIPage.getRecords());
return pageIPage;
}
}
......@@ -131,29 +131,26 @@ public class LargeScreenImpl {
// }
// }
//改为部盾接口
// 改为部盾接口
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);
if(data!=null)
{
//部盾每天十二点才填报,如果十二点前没有数据则获取前一天的数据
if(data.getDouble("sum_irradiance")==0)
{
// 计算昨天日期
LocalDate yesterday = currentDate.minusDays(1);
formattedDate = yesterday.format(formatter);
data = httpRequestUtil.getResPonse(requestUrl+"&reporting_data="+formattedDate, Constants.REQUEST_GET, "",
Constants.resovleRule_data);
}
mapdta.put("SS", data.getDouble("average_wind_speed"));
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);
if (data != null) {
// 部盾每天十二点才填报,如果十二点前没有数据则获取前一天的数据
if (data.getDouble("sum_irradiance") != null && data.getDouble("sum_irradiance") == 0) {
// 计算昨天日期
LocalDate yesterday = currentDate.minusDays(1);
formattedDate = yesterday.format(formatter);
data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate,
Constants.REQUEST_GET, "", Constants.resovleRule_data);
}
mapdta.put("SS", data.getDouble("average_wind_speed"));
mapdta.put("ZFS", data.getDouble("avg_irradiance"));
mapdta.put("ZFSLJ", data.getDouble("sum_irradiance"));
}
}
// //日发电量
// AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
......@@ -246,7 +243,7 @@ public class LargeScreenImpl {
}
@Scheduled(cron = "0/10 * * * * ?")
@PostConstruct
//@PostConstruct
private void sendQYYXZBMqtt() {
List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream()
......@@ -261,16 +258,16 @@ public class LargeScreenImpl {
/**
* 区域
**/
public Map<String, Double> getqy(List<StationCacheInfoDto> gatewayId, String s) {
Map<String, Double> mapdta = new HashMap<>();
mapdta.put("SS", 0d);
mapdta.put("ZFS", 0d);
mapdta.put("ZFSLJ", 0d);
mapdta.put("RSD", 0d);
mapdta.put("YFD", 0d);
mapdta.put("NFD", 0d);
mapdta.put("YJHWC", 0d);
mapdta.put("NJHWC", 0d);
public Map<String, String> getqy(List<StationCacheInfoDto> gatewayId, String s) {
Map<String, String> mapdta = new HashMap<>();
mapdta.put("SS", "0");
mapdta.put("ZFS", "0");
mapdta.put("ZFSLJ", "0");
mapdta.put("RSD", "0");
mapdta.put("YFD", "0");
mapdta.put("NFD", "0");
mapdta.put("YJHWC", "0");
mapdta.put("NJHWC", "0");
// // 平均数
// List<String> value = new ArrayList<>();
// List<String> ids = new ArrayList<>();
......@@ -404,35 +401,46 @@ public class LargeScreenImpl {
// Double ybfbn = sumValuen > 0 ? mapdta.get("NFD") / sumValuen * 100 : 0;
// ybfbn = new BigDecimal(ybfbn).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
// mapdta.put("NJHWC", ybfbn);
//改为部盾接口
// 改为部盾接口
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);
mapdta.put("Day", data.getDouble("day_generating_capacity"));
mapdta.put("Moon", data.getDouble("month_generating_capacity"));
mapdta.put("Year", data.getDouble("year_generating_capacity"));
mapdta.put("YJHWC", Double.valueOf(data.getString("month_quota_rate").replace("%", "")));
mapdta.put("NJHWC", Double.valueOf(data.getString("year_quota_rate").replace("%", "")));
//部盾每天十二点才填报,如果十二点前没有数据则获取前一天的数据
if(data.getDouble("sum_irradiance")==0)
{
// 计算昨天日期
LocalDate yesterday = currentDate.minusDays(1);
formattedDate = yesterday.format(formatter);
data = httpRequestUtil.getResPonse(requestUrl+"&reporting_data="+formattedDate, Constants.REQUEST_GET, "",
Constants.resovleRule_data);
}
mapdta.put("SS", data.getDouble("average_wind_speed"));
mapdta.put("ZFS", data.getDouble("avg_irradiance"));
mapdta.put("ZFSLJ", data.getDouble("sum_irradiance"));
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedDate = currentDate.format(formatter);
JSONObject data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate + "&code=" + s,
Constants.REQUEST_GET, "", Constants.resovleRule_data);
DecimalFormat df = new DecimalFormat("#.0000");
if (data.getDouble("day_generating_capacity") != null) {
mapdta.put("Day", df.format(Double.valueOf(data.getDouble("day_generating_capacity"))));
mapdta.put("RSD", df.format(Double.valueOf(data.getDouble("day_generating_capacity"))));
}
if (data.getDouble("month_generating_capacity") != null) {
mapdta.put("Moon", df.format(Double.valueOf(data.getDouble("month_generating_capacity"))));
mapdta.put("YFD", df.format(Double.valueOf(data.getDouble("day_generating_capacity"))));
}
if (data.getDouble("year_generating_capacity") != null) {
mapdta.put("Year", df.format(Double.valueOf(data.getDouble("year_generating_capacity"))));
mapdta.put("NFD", df.format(Double.valueOf(data.getDouble("day_generating_capacity"))));
}
if (data.getString("month_quota_rate") != null) {
mapdta.put("YJHWC", data.getString("month_quota_rate").replace("%", ""));
}
if (data.getString("year_quota_rate") != null) {
mapdta.put("NJHWC", data.getString("year_quota_rate").replace("%", ""));
}
// 部盾每天十二点才填报,如果十二点前没有数据则获取前一天的数据
if (data.getDouble("sum_irradiance") != null && data.getDouble("sum_irradiance") == 0) {
// 计算昨天日期
LocalDate yesterday = currentDate.minusDays(1);
formattedDate = yesterday.format(formatter);
data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate, Constants.REQUEST_GET,
"", Constants.resovleRule_data);
}
mapdta.put("SS", data.getString("average_wind_speed"));
mapdta.put("ZFS", data.getString("avg_irradiance"));
mapdta.put("ZFSLJ", data.getString("sum_irradiance"));
try {
System.out.println(JSON.toJSONString(mapdta));
emqKeeper.getMqttClient().publish("qyyxzb/" + s, JSON.toJSONString(mapdta).getBytes(), 1, true);
......
......@@ -28,6 +28,7 @@ import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
......@@ -1112,11 +1113,23 @@ public class MonitoringServiceImpl {
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("month_quota_rate").replace("%", ""));
resultMap.put("NJHWC", data.getString("year_quota_rate").replace("%", ""));
DecimalFormat df = new DecimalFormat("#.0000");
if (data.getDouble("day_generating_capacity") != null) {
resultMap.put("Day", df.format(Double.valueOf(data.getDouble("day_generating_capacity"))));
}
if (data.getDouble("month_generating_capacity") != null) {
resultMap.put("Moon", df.format(Double.valueOf(data.getDouble("month_generating_capacity"))));
}
if (data.getDouble("year_generating_capacity") != null) {
resultMap.put("Year", df.format(Double.valueOf(data.getDouble("year_generating_capacity"))));
}
if (data.getString("month_quota_rate") != null) {
resultMap.put("YJHWC", data.getString("month_quota_rate").replace("%", ""));
}
if (data.getString("year_quota_rate") != null) {
resultMap.put("NJHWC", data.getString("year_quota_rate").replace("%", ""));
}
try {
emqKeeper.getMqttClient().publish("bigscreen_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1,
true);
......
......@@ -148,4 +148,5 @@ pictureUrl=upload/jxiop/syz/
# Ԥ
idx.predict.serviceUrl=http://10.20.1.157:8095/jxdj/predict-data
forecast.url=
\ No newline at end of file
forecast.url=
logic=
\ 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