Commit 717cac69 authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents f5726225 9ed22b01
package com.yeejoin.amos.api.householdapi.Utils;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Calendar;
import java.util.TimeZone;
public class CalendarAdjust {
/**
* 获取指定某一天的开始时间戳
*
* @param timeStamp 毫秒级时间戳
* @param timeZone 如 GMT+8:00
* @return
*/
public static Long getDailyStartTime(Long timeStamp, String timeZone) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeZone(TimeZone.getTimeZone(timeZone));
calendar.setTimeInMillis(timeStamp);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTimeInMillis();
}
/**
* 获取指定某一天的结束时间戳
*
* @param timeStamp 毫秒级时间戳
* @param timeZone 如 GMT+8:00
* @return
*/
public static Long getDailyEndTime(Long timeStamp, String timeZone) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeZone(TimeZone.getTimeZone(timeZone));
calendar.setTimeInMillis(timeStamp);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
calendar.set(Calendar.MILLISECOND, 999);
return calendar.getTimeInMillis();
}
/**
* 获取当月开始时间戳
*
* @param timeStamp 毫秒级时间戳
* @param timeZone 如 GMT+8:00
* @return
*/
public static Long getMonthStartTime(Long timeStamp, String timeZone) {
Calendar calendar = Calendar.getInstance();// 获取当前日期
calendar.setTimeZone(TimeZone.getTimeZone(timeZone));
calendar.setTimeInMillis(timeStamp);
calendar.add(Calendar.YEAR, 0);
calendar.add(Calendar.MONTH, 0);
calendar.set(Calendar.DAY_OF_MONTH, 1);// 设置为1号,当前日期既为本月第一天
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTimeInMillis();
}
/**
* 获取当月的结束时间戳
*
* @param timeStamp 毫秒级时间戳
* @param timeZone 如 GMT+8:00
* @return
*/
public static Long getMonthEndTime(Long timeStamp, String timeZone) {
Calendar calendar = Calendar.getInstance();// 获取当前日期
calendar.setTimeZone(TimeZone.getTimeZone(timeZone));
calendar.setTimeInMillis(timeStamp);
calendar.add(Calendar.YEAR, 0);
calendar.add(Calendar.MONTH, 0);
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));// 获取当前月最后一天
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
calendar.set(Calendar.MILLISECOND, 999);
return calendar.getTimeInMillis();
}
/**
* 获取当年的开始时间戳
*
* @param timeStamp 毫秒级时间戳
* @param timeZone 如 GMT+8:00
* @return
*/
public static Long getYearStartTime(Long timeStamp, String timeZone) {
Calendar calendar = Calendar.getInstance();// 获取当前日期
calendar.setTimeZone(TimeZone.getTimeZone(timeZone));
calendar.setTimeInMillis(timeStamp);
calendar.add(Calendar.YEAR, 0);
calendar.add(Calendar.DATE, 0);
calendar.add(Calendar.MONTH, 0);
calendar.set(Calendar.DAY_OF_YEAR, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTimeInMillis();
}
/**
* 获取当年的最后时间戳
*
* @param timeStamp 毫秒级时间戳
* @param timeZone 如 GMT+8:00
* @return
*/
public static Long getYearEndTime(Long timeStamp, String timeZone) {
Calendar calendar = Calendar.getInstance();// 获取当前日期
calendar.setTimeZone(TimeZone.getTimeZone(timeZone));
calendar.setTimeInMillis(timeStamp);
int year = calendar.get(Calendar.YEAR);
calendar.clear();
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
calendar.set(Calendar.MILLISECOND, 999);
calendar.roll(Calendar.DAY_OF_YEAR, -1);
return calendar.getTimeInMillis();
}
/**
* 时间戳转字符串
*
* @param timestamp 毫秒级时间戳
* @param zoneId 如 GMT+8或UTC+08:00
* @return
*/
public static String timestampToStr(long timestamp, String zoneId) {
ZoneId timezone = ZoneId.of(zoneId);
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), timezone);
return localDateTime.toString();
}
public static void main(String[] args) {
Long currentTime = System.currentTimeMillis();
System.out.println("Current Time : " + currentTime + " = " + timestampToStr(currentTime, "GMT+8"));
Long dailyStart = getDailyStartTime(currentTime, "GMT+8:00");
Long dailyEnd = getDailyEndTime(currentTime, "GMT+8:00");
Long monthStart = getMonthStartTime(currentTime, "GMT+8:00");
Long monthEnd = getMonthEndTime(currentTime, "GMT+8:00");
Long yearStart = getYearStartTime(currentTime, "GMT+8:00");
Long yearEnd = getYearEndTime(currentTime, "GMT+8:00");
System.out.println("Daily Start : " + dailyStart + " = " + timestampToStr(dailyStart, "GMT+8") + " Daily End : " + dailyEnd + " = " + timestampToStr(dailyEnd, "GMT+8"));
System.out.println("Month Start : " + monthStart + " = " + timestampToStr(monthStart, "GMT+8") + " Month End : " + monthEnd + " = " + timestampToStr(monthEnd, "GMT+8"));
System.out.println("Year Start : " + yearStart + " = " + timestampToStr(yearStart, "GMT+8") + " Year End : " + yearEnd + " = " + timestampToStr(yearEnd, "GMT+8"));
}
}
\ No newline at end of file
......@@ -207,15 +207,20 @@ public class ImasterUtils {
if (jsonArray.size() != 0) {
for( int i=0; i<jsonArray.size();i++ ) {
JSONObject jsonObject1 = (JSONObject) jsonArray.get(i);
JSONObject jsonObject2 = (JSONObject)jsonObject1.get("dataItemMap");
if(jsonObject1.get("sn") != null) {
jsonObject2.put("inverterId", jsonObject1.get("sn").toString());
}
if(jsonObject1.get("stationCode") != null) {
jsonObject2.put("stationCode", jsonObject1.get("stationCode").toString());
}
if(jsonObject1.get("dataItemMap") != null) {
JSONObject jsonObject2 = (JSONObject)jsonObject1.get("dataItemMap");
if(jsonObject1.get("sn") != null) {
jsonObject2.put("inverterId", jsonObject1.get("sn").toString());
}
if(jsonObject1.get("stationCode") != null) {
jsonObject2.put("stationCode", jsonObject1.get("stationCode").toString());
}
if(jsonObject1.get("collectTime") != null) {
jsonObject2.put("collectTime", jsonObject1.get("collectTime").toString());
}
jsonArrayRet.add(jsonObject2);
jsonArrayRet.add(jsonObject2);
}
}
}
}
......
......@@ -15,6 +15,13 @@ public class ImasterConstant {
}
};
public static final HashMap<String, String> inverterStaus = new HashMap<String, String>() {
{
put("0", "离线");
put("1", "在线");
}
};
public static final HashMap<String, String> alarmstatus = new HashMap<String, String>() {
{
put("1", "未处理");
......@@ -41,12 +48,17 @@ public class ImasterConstant {
public static String requestGET="GET";
public static String stationListUrl="/thirdData/stations";
public static String stationDetailUrl = "/thirdData/getStationRealKpi";
public static String stationDetailMonthUrl = "/thirdData/getKpiStationMonth";
public static String stationDetailYearUrl = "/thirdData/getKpiStationYear";
public static String collectorListUrl = "/thirdData/getDevList";
public static String collectorDetailUrl = "/thirdData/getDevRealKpi";
public static String collectorDetailMonthUrl = "/thirdData/getDevKpiMonth";
public static String collectorDetailYearUrl = "/thirdData/getDevKpiYear";
public static String alarmListUrl = "/thirdData/getAlarmList";
public static String resovleRule_data_page_records = "data";
public static String resovle_rows="rows";
public static int devTypeC=62;
public static int devTypeI=1;
public static Double kwhToMwh = 0.0001;
}
......@@ -135,16 +135,10 @@ public class HouseholdTestController {
@PostMapping(value = "/imasterNew")
@ApiOperation(httpMethod = "POST", value = "北向", notes = "北向")
public void imasterNew() throws IOException {
// imasterDataService.stationList();
// imasterDataService.stationDetail();
// imasterDataService.collectorList();
// imasterDataService.inverterList();
imasterDataService.stationList();
imasterDataService.stationDetail();
imasterDataService.collectorList();
imasterDataService.inverterList();
imasterDataService.inverterDetail();
// goLangDataAcquisitionService.collectorList();
//// goLangDataAcquisitionService.inverterList();
// goLangDataAcquisitionService.collectorDetail();
// goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo();
}
}
......@@ -42,7 +42,7 @@ public class ImasterInverterListDetails {
Double pv11_u ;
Double mppt_power ;
Double pv13_u ;
Double run_state ;
int run_state ;
Double close_time ;
Double pv19_i ;
Double mppt_7_cap ;
......
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName(value = "imaster_inverter_details_month" ,autoResultMap = true)
public class ImasterInverterMonth {
private Long createdTime;
private String stationCode ;
private Double installed_capacity ; // 装机容量
private Double product_power; // 发电量
private Double power_profit ; // 发电收益
private String collectTime;
private String inverterId;
}
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName(value = "imaster_inverter_details_year" ,autoResultMap = true)
public class ImasterInverterYear {
private Long createdTime;
private String stationCode ;
private Double installed_capacity ; // 装机容量
private Double product_power; // 发电量
private Double power_profit ; // 发电收益
private String collectTime;
private String inverterId;
}
......@@ -9,16 +9,11 @@ public class ImasterStationDetailsMonth {
private Long createdTime;
private String stationCode ;
private Double installedCapacity ;
private Double radiationIntensity;
private Double theoryPower ;
private Double performanceRatio ;
private Double inverterPower ;
private Double ongridPower ;
private Double usePower ;
private Double powerProfit ;
private Double perpowerRatio;
private Double reductionTotalCo2 ;
private Double reductionTotalCoal ;
private Double reductionTotalTree;
private Double installed_capacity ; // 装机容量
private Double inverter_power; // 逆变器发电量
private Double power_profit ; // 发电收益
private Double reduction_total_coal ; // 标准煤节省量
private Double perpower_ratio ; /// 等效利用小时数
private Double reduction_total_co2 ; // 二氧化碳减排量
private String collectTime;
}
......@@ -9,17 +9,12 @@ public class ImasterStationDetailsYear {
private Long createdTime;
private String stationCode ;
private Double installedCapacity ;
private Double radiationIntensity;
private Double theoryPower ;
private Double performanceRatio ;
private Double inverterPower ;
private Double ongridPower ;
private Double usePower ;
private Double powerProfit ;
private Double perpowerRatio;
private Double reductionTotalCo2 ;
private Double reductionTotalCoal ;
private Double reductionTotalTree;
private Double installed_capacity ;
private Double inverter_power;
private Double power_profit ;
private Double reduction_total_coal ;
private Double perpower_ratio ;
private Double reduction_total_co2 ;
private String collectTime;
}
package com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.ImasterInverterMonth;
public interface ImasterInverterMonthMapper extends BaseMapper<ImasterInverterMonth> {
}
package com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.ImasterInverterYear;
public interface ImasterInverterYearMapper extends BaseMapper<ImasterInverterYear> {
}
package com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.ImasterStationDetailsMonth;
public interface ImasterStationMonthMapper extends BaseMapper<ImasterStationDetailsMonth> {
}
package com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.ImasterStationDetailsYear;
public interface ImasterStationYearMapper extends BaseMapper<ImasterStationDetailsYear> {
}
package com.yeejoin.amos.api.householdapi.face.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.Utils.CalendarAdjust;
import com.yeejoin.amos.api.householdapi.Utils.ImasterUtils;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
import com.yeejoin.amos.api.householdapi.constant.ImasterConstant;
import com.yeejoin.amos.api.householdapi.face.dto.AlarmDto;
import com.yeejoin.amos.api.householdapi.face.dto.CollectorDetailDto;
import com.yeejoin.amos.api.householdapi.face.dto.ImasterAlarmDto;
import com.yeejoin.amos.api.householdapi.face.dto.InverterDetailDto;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpCollector;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverter;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverterElectricity;
......@@ -23,8 +21,7 @@ import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.*;
import com.yeejoin.amos.api.householdapi.face.service.ImasterDataService;
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import fastjson.JSON;
import org.apache.commons.lang.time.DateUtils;
import org.joda.time.DateTimeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
......@@ -64,6 +61,25 @@ public class ImasterDataServiceImpl implements ImasterDataService {
@Autowired
private ImasterStationDetailsMapper imasterStationDetailsMapper;
//北向mapper
@Autowired
private ImasterInverterMonthMapper imasterInverterMonthMapper;
//北向mapper
@Autowired
private ImasterInverterYearMapper imasterInverterYearMapper;
//北向mapper
@Autowired
private ImasterStationMonthMapper imasterStationMonthMapper;
//北向mapper
@Autowired
private ImasterStationYearMapper imasterStationYearMapper;
//定时任务执行频率 当前为10分钟一次
private final String dataRequstScheduled = "0 0/60 * * * *";
......@@ -103,6 +119,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
@Autowired
JpInverterElectricityMapper jpInverterElectricityMapper;
@Scheduled(cron = dataRequstScheduled)
@Override
public void stationList() {
......@@ -122,6 +139,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
}
@Scheduled(cron = dataRequstScheduled)
@Override
public void stationDetail() {
......@@ -136,6 +154,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("stationCodes", stationList.stream().collect(Collectors.joining(",")));
requestInfo.put("collectTime", System.currentTimeMillis());
String requestParaminfo = JSON.toJSONString(requestInfo);
List<ImasterStationDetail> result = imasterUtils.getResPonseOther(ImasterConstant.stationDetailUrl,
GoLangConstant.requestPost,
......@@ -143,24 +162,21 @@ public class ImasterDataServiceImpl implements ImasterDataService {
ImasterConstant.resovleRule_data_page_records,
ImasterStationDetail.class
);
// List<ImasterStationDetail> result1 = imasterUtils.getResPonse(ImasterConstant.stationDetailUrl,
// GoLangConstant.requestPost,
// requestParaminfo,
// ImasterConstant.resovleRule_data_page_records,
// ImasterStationDetail.class
// );
// List<ImasterStationDetail> result2 = imasterUtils.getResPonse(ImasterConstant.stationDetailUrl,
// GoLangConstant.requestPost,
// requestParaminfo,
// ImasterConstant.resovleRule_data_page_records,
// ImasterStationDetail.class
// );
// List<ImasterStationDetail> result3 = imasterUtils.getResPonse(ImasterConstant.stationDetailUrl,
// GoLangConstant.requestPost,
// requestParaminfo,
// ImasterConstant.resovleRule_data_page_records,
// ImasterStationDetail.class
// );
List<ImasterStationDetailsMonth> result2 = imasterUtils.getResPonseOther(ImasterConstant.stationDetailMonthUrl,
GoLangConstant.requestPost,
requestParaminfo,
ImasterConstant.resovleRule_data_page_records,
ImasterStationDetailsMonth.class
);
List<ImasterStationDetailsYear> result3 = imasterUtils.getResPonseOther(ImasterConstant.stationDetailYearUrl,
GoLangConstant.requestPost,
requestParaminfo,
ImasterConstant.resovleRule_data_page_records,
ImasterStationDetailsYear.class
);
for (int j = 0; j < result.size(); j++) {
QueryWrapper<ImasterStationList> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("plant_code", result.get(j).getStationCode());
......@@ -195,11 +211,42 @@ public class ImasterDataServiceImpl implements ImasterDataService {
jpStation.setThirdCode(PVProducerInfoEnum.HUAWEI.getCode());
// jpStation.setRealTimePower(imasterStationDetail.getPower());
// jpStation.setOnGridType(GoLangConstant.intoNetWorkStatus.get(String.valueOf(imasterStationDetail.getStationtypenew())));
jpStation.setDayGenerate(imasterStationDetail.getDay_power());
jpStation.setMonthGenerate(imasterStationDetail.getMonth_power());
jpStation.setDayGenerate(imasterStationDetail.getDay_power() * ImasterConstant.kwhToMwh);
jpStation.setMonthGenerate(imasterStationDetail.getMonth_power() * ImasterConstant.kwhToMwh);
// jpStation.setMonthGenerate(imasterStationDetail.getMonthPower());
// jpStation.setYearGenerate(imasterStationDetail.getYearenergy());
jpStation.setAccumulatedPower(imasterStationDetail.getTotal_power());
Long currentTime = System.currentTimeMillis();
Long monthStart = CalendarAdjust.getMonthStartTime(currentTime, "GMT+8:00");
Long yearStart = CalendarAdjust.getYearStartTime(currentTime, "GMT+8:00");
// 获取年发电量 年收益
for (ImasterStationDetailsYear imasterStationDetailsYear : result3
) {
if(imasterStationDetailsYear.getCollectTime().equals(String.valueOf(yearStart))) {
jpStation.setYearGenerate(imasterStationDetailsYear.getInverter_power() * ImasterConstant.kwhToMwh);
jpStation.setYearIncome(imasterStationDetailsYear.getPower_profit());
imasterStationDetailsYear.setStationCode(imasterStationList.getPlantCode());
imasterStationDetailsYear.setCreatedTime(System.currentTimeMillis());
imasterStationYearMapper.insert(imasterStationDetailsYear);
}
}
// 获取月收益
for (ImasterStationDetailsMonth imasterStationDetailsMonth: result2
) {
if(imasterStationDetailsMonth.getCollectTime().equals(String.valueOf(monthStart))) {
jpStation.setMonthIncome(imasterStationDetailsMonth.getPower_profit());
imasterStationDetailsMonth.setStationCode(imasterStationList.getPlantCode());
imasterStationDetailsMonth.setCreatedTime(System.currentTimeMillis());
imasterStationMonthMapper.insert(imasterStationDetailsMonth);
}
}
jpStation.setAccumulatedPower(imasterStationDetail.getTotal_power() * ImasterConstant.kwhToMwh);
jpStation.setDayIncome(imasterStationDetail.getDay_income());
jpStation.setCumulativeIncome(imasterStationDetail.getTotal_income());
jpStation.setState(ImasterConstant.stationStaus.get(String.valueOf(imasterStationDetail.getReal_health_state())));
......@@ -247,6 +294,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
}
@Scheduled(cron = dataRequstScheduled)
@Override
public void collectorList() {
......@@ -288,6 +336,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
//sn编码
jpCollector.setSnCode(imasterCollectorList.getEsnCode());
jpCollector.setName(imasterCollectorList.getDevName());
//类型
// jpCollector.setType(collectorDetailDto.getModel());
//更新时间
......@@ -307,7 +356,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
//第三方厂商标识
jpCollector.setThirdCode(PVProducerInfoEnum.HUAWEI.getCode());
//第三方厂商标识
// jpCollector.setState(GoLangConstant.stationStaus.get(collectorDetailDto.getState()));
jpCollector.setState(ImasterConstant.inverterStaus.get("1"));
jpCollector.setStationName(imasterStationList.getPlantName());
jpCollector.setVersion(imasterCollectorList.getSoftwareVersion());
......@@ -336,6 +385,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
@Scheduled(cron = dataRequstScheduled)
@Override
public void inverterList() {
......@@ -372,6 +422,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
}
@Scheduled(cron = dataRequstScheduled)
@Override
public void inverterDetail() {
......@@ -385,6 +436,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
String collect = inverterSns.stream().collect(Collectors.joining(","));
requestInfo.put("sns", collect);
requestInfo.put("devTypeId", 1);
requestInfo.put("collectTime", System.currentTimeMillis());
String requestParaminfo = JSON.toJSONString(requestInfo);
List<ImasterInverterListDetails> result = imasterUtils.getResPonseOther(ImasterConstant.collectorDetailUrl,
......@@ -393,6 +445,20 @@ public class ImasterDataServiceImpl implements ImasterDataService {
ImasterConstant.resovleRule_data_page_records,
ImasterInverterListDetails.class
);
List<ImasterInverterMonth> result2 = imasterUtils.getResPonseOther(ImasterConstant.collectorDetailMonthUrl,
GoLangConstant.requestPost,
requestParaminfo,
ImasterConstant.resovleRule_data_page_records,
ImasterInverterMonth.class
);
List<ImasterInverterYear> result3 = imasterUtils.getResPonseOther(ImasterConstant.collectorDetailYearUrl,
GoLangConstant.requestPost,
requestParaminfo,
ImasterConstant.resovleRule_data_page_records,
ImasterInverterYear.class
);
for (int j = 0; j < result.size(); j++) {
ImasterInverterListDetails inverterDetailDto = result.get(j);
inverterDetailDto.setCreatedTime((System.currentTimeMillis()));
......@@ -420,8 +486,39 @@ public class ImasterDataServiceImpl implements ImasterDataService {
jpInverter.setSnCode(imasterInverterList.getEsnCode());
jpInverter.setCollectorSnCode(collectorList.getEsnCode());
jpInverter.setCollectorId(String.valueOf(collectorList.getId()));
jpInverter.setDayPowerGeneration(inverterDetailDto.getDay_cap());
// jpInverter.setState(GoLangConstant.stationStaus.get(inverterDetailDto.getCurrentState()));
jpInverter.setDayPowerGeneration(inverterDetailDto.getDay_cap() * ImasterConstant.kwhToMwh);
jpInverter.setState(ImasterConstant.inverterStaus.get(String.valueOf(inverterDetailDto.getRun_state())));
jpInverter.setTotalPowerGeneration(inverterDetailDto.getTotal_cap() * ImasterConstant.kwhToMwh);
Long currentTime = System.currentTimeMillis();
Long monthStart = CalendarAdjust.getMonthStartTime(currentTime, "GMT+8:00");
Long yearStart = CalendarAdjust.getYearStartTime(currentTime, "GMT+8:00");
// 获取年发电量
for (ImasterInverterYear imasterInverterYear : result3
) {
if(imasterInverterYear.getCollectTime().equals(String.valueOf(yearStart)) && inverterDetailDto.getInverterId().equals(imasterInverterYear.getInverterId())) {
jpInverter.setYearPowerGeneration(imasterInverterYear.getProduct_power() * ImasterConstant.kwhToMwh);
imasterInverterYear.setCreatedTime(System.currentTimeMillis());
imasterInverterYearMapper.insert(imasterInverterYear);
}
}
// 获取月发电量
for (ImasterInverterMonth imasterInverterMonth: result2
) {
if(imasterInverterMonth.getCollectTime().equals(String.valueOf(monthStart)) && inverterDetailDto.getInverterId().equals(imasterInverterMonth.getInverterId())) {
jpInverter.setMonthPowerGeneration(imasterInverterMonth.getProduct_power() * ImasterConstant.kwhToMwh);
imasterInverterMonth.setCreatedTime(System.currentTimeMillis());
imasterInverterMonthMapper.insert(imasterInverterMonth);
}
}
// jpInverter.setCollectorId(inverterDetailDto.getCollectorId());
// jpInverter.setCollectorSnCode(inverterDetailDto.getCollectorsn());
jpInverter.setUpdateTime(new Date());
......@@ -564,7 +661,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
hygfjpInverterHistory.setSnCode(imasterInverterList.getEsnCode());
hygfjpInverterHistory.setThirdCode(PVProducerInfoEnum.HUAWEI.getCode());
// hygfjpInverterHistory.setGenerationHours(inverterDetailDto.getFullHour());
// hygfjpInverterHistory.setPowerGeneration(inverterDetailDto.getEToday());
hygfjpInverterHistory.setPowerGeneration(inverterDetailDto.getDay_cap());
if (ObjectUtils.isEmpty(hygfjpInverterHistory.getCreatedTime())) {
hygfjpInverterHistory.setCreatedTime(System.currentTimeMillis());
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
......@@ -574,6 +671,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
}
@Scheduled(cron = dataRequstScheduled)
@Override
public void inverAlramInfo() {
......
......@@ -168,7 +168,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
jpStation.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
// 业主姓名
jpStation.setUserName(ksolarStation.getUserName());
jpStation.setState(KSolarConstant.stationStaus.get(String.valueOf(ksolarStation.getStatus())));
jpStation.setState(KSolarConstant.collectStaus.get(String.valueOf(ksolarStation.getStatus())));
jpStation.setRealTimePower(ksolarStation.getPowerInter());
jpStation.setDayGenerate(ksolarStation.getDayGeneration() * KSolarConstant.kwhToMwh);
......
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