Commit cee77e2f authored by xixinzhao's avatar xixinzhao

科士达数据接入

parent a1578464
......@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
import com.yeejoin.amos.api.householdapi.constant.KSolarConstant;
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.jcajce.provider.symmetric.AES;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -20,7 +21,8 @@ import java.util.List;
@Component
public class KSolarRequestUtil {
@Slf4j
public class KsolarRequestUtil {
/**
* @return HashMap<String, Object> 发送请求前的准备 准备header信息
......@@ -66,6 +68,7 @@ public class KSolarRequestUtil {
String url = KSolarConstant.baseurl + apiurl;
respone = sendRequest(requestMethod, url, requestParmInfo, headMap);
jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone);
log.info("原始数据:{}", jsonArray);
if (!ObjectUtils.isEmpty(jsonArray)) {
result = JSONArray.parseArray(jsonArray.toJSONString(), tClass);
}
......@@ -82,24 +85,29 @@ public class KSolarRequestUtil {
* @desc 根据解析规则解析请求返回数据
*/
public JSONArray handlerResponseByResultResolverule(String resultResovle, String response) {
JSONObject jsonObject = JSONObject.parseObject(response);
JSONArray jsonArray = new JSONArray();
if (ObjectUtil.isNotEmpty(resultResovle)) {
String[] rules = resultResovle.split(",");
if (rules.length > 0) {
for (int i = 0; i < rules.length; i++) {
try {
jsonObject = (JSONObject) jsonObject.get(rules[i]);
if (jsonObject == null) {
if ("arr".equals(resultResovle)) {
jsonArray = JSONArray.parseArray(response);
} else {
JSONObject jsonObject = JSONObject.parseObject(response);
if (ObjectUtil.isNotEmpty(resultResovle)) {
String[] rules = resultResovle.split(",");
if (rules.length > 0) {
for (int i = 0; i < rules.length; i++) {
try {
jsonObject = (JSONObject) jsonObject.get(rules[i]);
if (jsonObject == null) {
jsonArray = (JSONArray) jsonObject.get(rules[i]);
}
} catch (Exception exception) {
jsonArray = (JSONArray) jsonObject.get(rules[i]);
}
} catch (Exception exception) {
jsonArray = (JSONArray) jsonObject.get(rules[i]);
}
}
}
if (jsonArray.size() == 0) {
jsonArray.add(jsonObject);
if (jsonArray.size() == 0) {
jsonArray.add(jsonObject);
}
}
}
return jsonArray;
......
package com.yeejoin.amos.api.householdapi.constant;
import java.util.HashMap;
public class KSolarConstant {
public static String baseurl ="http://111.230.136.62:8092";
public static String account ="三一硅能";
......@@ -11,6 +13,47 @@ public class KSolarConstant {
public static String requestPOST="POST";
public static String requestGET="GET";
public static String stationListUrl="/station/list/info";
public static String stationInfoByIdUrl="/station/list/info/by/id";
public static String stationEarnUrl="/station/detail/earn";
public static String stationEarnChartUrl="/protocol/station/statistic/elec/chart";
public static String stationCollectListUrl="/station/detail/collect/list";
public static String stationCollectDataUrl="/station/detail/get/realdata/by/collectid";
public static String stationCollectAlarmUrl="/alarm/bi/list";
public static String resovle_rows="rows";
public static String resovle_data="data";
public static String resovle_arr="arr";
public static Double kwhToMwh = 0.0001;
public static final HashMap<String, String> stationStaus = new HashMap<String, String>() {
{
put("1", "在线");
put("0", "离线");
put("2", "报警");
}
};
public static final HashMap<String, String> collectStaus = new HashMap<String, String>() {
{
put("0", "在线");
put("1", "离线");
put("2", "报警");
}
};
public static final HashMap<String, String> alarmLevel = new HashMap<String, String>() {
{
put("1", "低级");
put("2", "中级");
put("3", "高级");
}
};
public static final HashMap<String, String> alarmstatus = new HashMap<String, String>() {
{
put("0", "未恢复");
put("1", "已恢复");
}
};
}
package com.yeejoin.amos.api.householdapi.controller;
import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
import com.yeejoin.amos.api.householdapi.Utils.KSolarRequestUtil;
import com.yeejoin.amos.api.householdapi.face.service.GoLangDataAcquisitionService;
import com.yeejoin.amos.api.householdapi.face.service.KSolarDataAcquisitionService;
import fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -15,7 +13,6 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.io.IOException;
import java.util.HashMap;
/**
......@@ -111,9 +108,11 @@ public class HouseholdTestController {
@PostMapping(value = "/ksolarnew")
@ApiOperation(httpMethod = "POST", value = "科士达", notes = "科士达")
public void ksolarnew() throws IOException {
// kSolarDataAcquisitionService.stationList();
kSolarDataAcquisitionService.stationDetail();
kSolarDataAcquisitionService.stationList();
// goLangDataAcquisitionService.stationDetail();
// goLangDataAcquisitionService.collectorList();
kSolarDataAcquisitionService.collectorList();
kSolarDataAcquisitionService.collectorDetail();
//// goLangDataAcquisitionService.inverterList();
// goLangDataAcquisitionService.collectorDetail();
// goLangDataAcquisitionService.inverterDetail();
......
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
/**
* @author DELL
*/
@Data
public class KsolarAlarmDto {
private String alarmId;
private String attribId;
private String collectName;
private String deviceId;
private String inverterId;
private String levels;
private String message;
private String removeTime;
private String saveTime;
private String solution;
private String stationId;
private String stationName;
private String status;
}
......@@ -54,7 +54,7 @@ public class JpInverter implements Serializable {
* 采集器id
*/
@TableField("collector_id")
private Long collectorId;
private String collectorId;
/**
* 采集器sn编码
......
......@@ -43,7 +43,7 @@ public class JpInverterElectricity implements Serializable {
* 逆变器id
*/
@TableField("inverter_id")
private Long inverterId;
private String inverterId;
/**
* sn编码
......
......@@ -17,437 +17,437 @@ public class GolangInverterDetail {
private String sirRealtime;
private String uPv24Str;
private String state;
private String pow25Str;
private String batteryPowerZheng;
private String uPv1Str;
private String backupTotalEnergyStr;
private String uPv7;
private String uPv8;
private String powerPec;
private String pow26Str;
private String homeLoadEnergy;
private String pow13Str;
private String eTotal;
private String pow1Str;
private String bypassLoadPower;
private String temp;
private String pow14Str;
private String gridPurchasedEnergyStr;
private String uPv3;
private String uPv4;
private String homeGridMonthEnergy;
private String pEpm;
private String gridPurchasedYearEnergyStr;
private String socChargingSet;
private String uPv28;
private String uPv27;
private String uPv20;
private String pow9Str;
private String bypassAcOnoffSet;
private String daylight;
private String dcInputtype;
private String dcBusHalfStr;
private String pow7Str;
private String gridSellYesterdayEnergyStr;
private String porwerPercent;
private String uAc2Str;
private String pReactiveLimitSet;
private String uPv18;
private String uPv17;
private String uPv10;
private String batteryFcvSet;
private String pow28Str;
private String pow30;
private String batteryPowerFu;
private String timeZoneStr;
private String fac;
private String homeGridTotalEnergyStr;
private String iPv29;
private String iPv26;
private String iPv21;
private String iPv27Str;
private String batteryTotalChargeEnergyStr;
private String meter1Type;
private String batteryDischargeLimitingStr;
private String homeGridYesterdayEnergy;
private String pow2Str;
private String uAc3Str;
private String collectorsn;
private String batteryFailureInformation01;
private String iPv18Str;
private String uPv30Str;
private String uInitGndStr;
private String eYearStr;
private String gridSellEnergyStr;
private String batteryDischargeEnergyStr;
private String familyLoadPercent;
private String batteryCapacitySoc;
private String batteryTodayChargeEnergyStr;
private String pEpmSetStr;
private String iPv21Str;
private String pLimitSet;
private String iPv5Str;
private String iPv1Str;
private String iPv26Str;
private String homeLoadTotalEnergy;
private String batteryType;
private String iPv14Str;
private String homeGridYesterdayEnergyStr;
private String backupTotalEnergy;
private String iAc3Str;
private String gridSellTotalEnergyStr;
private String uPv29;
private String uPv26;
private String uPv21;
private String uPv12Str;
private String gridPurchasedEnergy;
private String pow2;
private String timeStr;
private String pow5;
private String iPv19;
private String iPv16;
private String iPv11;
private String dcBus;
private String pow32Str;
private String familyLoadPower;
private String meter2SiteHigh;
private String inverterMeterModel;
private String iPv32Str;
private String familyLoadPowerStr;
private String batteryYearDischargeEnergyStr;
private String iPv24Str;
private String currentState;
private String iPv25;
private String iPv22;
private String iPv3Str;
private String pow4Str;
private String gridPurchasedYesterdayEnergy;
private String energyStorageControl;
private String homeLoadTodayEnergyStr;
private String batteryPowerStr;
private String meter2TypeLow;
private String pow27Str;
private String homeGridMonthEnergyStr;
private String iPv23Str;
private String eYear;
private String acInType;
private String batteryVoltage;
private String reactivePowerStr;
private String iPv12Str;
private String pow19Str;
private String timeZone;
private String eMonthStr;
private String simFlowState;
private String bstteryCurrentStr;
private String uPv16Str;
private String uPv3Str;
private String gridSellTotalEnergy;
private String powTotal;
private String pow22;
private String pow25;
private String familyLoadPowerPec;
private String oneSelf;
private String uPv19;
private String uPv16;
private String uPv11;
private String batteryDischargeEnergy;
private String pow13;
private String pow14;
private String psumCalStr;
private String fullHourStr;
private String iPv3;
private String iPv4;
private String batteryPowerBms;
private String eTotalStr;
private String uPv11Str;
private String pow10;
private String pow17;
private String pow18;
private String pow6Str;
private String uPv30;
private String iPv19Str;
private String pow8Str;
private String batteryAcvSet;
private String userId;
private String uPv25;
private String uPv22;
private String power;
private String bypassAcVoltageB;
private String id;
private String uPv13Str;
private String iPv17Str;
private String pow18Str;
private String pow23;
private String pow24;
private String uPv4Str;
private String backupYearEnergyStr;
private String ipvTotal;
private String uPv10Str;
private String batteryChargeEnergy;
private String contractTime;
private String batteryTodayDischargeEnergy;
private String batteryYearDischargeEnergy;
private String batteryYesterdayChargeEnergyStr;
private String iAc2Str;
private String warningInfoData;
private String eTodayStr;
private String productModel;
private String pow31Str;
private String iPv25Str;
private String iPv8Str;
private String parallelPhase;
private String dispersionRate;
private String batteryYearChargeEnergy;
private String pow3Str;
private String backupMonthEnergy;
private String gridSellMonthEnergy;
private String gridPurchasedTotalEnergyStr;
private String pow11;
private String pow16;
private String pow19;
private String batteryCDISet;
private String backupYesterdayEnergyStr;
private String gridSellYearEnergyStr;
private String model;
private String pow3;
private String pow4;
private String backupYearEnergy;
private String parallelStatus;
private String iPv24;
private String iPv23;
private String iPv6Str;
private String pFactorLimitSet;
private String uPv14Str;
private String pow12Str;
private String pow23Str;
private String batteryDMaxiSet;
private String iPv7;
private String iPv8;
private String apparentPowerStr;
private String stationId;
private String powerStr;
private String bypassAcCurrentB;
private String iPv15;
private String iPv12;
private String batteryChargingCurrentStr;
private String uPv18Str;
private String gridPurchasedTodayEnergy;
private String uAc1;
private String uPv9Str;
private String pow17Str;
private String batteryPower;
private String nationalStandardstr;
private String offGridDDepth;
private String homeGridTodayEnergy;
private String uAc3;
private String iPv30Str;
private String uPv14;
private String uPv13;
private String iPv10Str;
private String uPv32;
private String batteryVoltageStr;
private String psumStr;
private String pow30Str;
private String backupMonthEnergyStr;
private String uPv31;
private String uPv23Str;
private String bypassAcVoltageC;
private String uPv20Str;
private String iPv14;
private String iPv13;
private String stateExceptionFlag;
private String daylightSwitch;
private String bypassAcCurrent;
private String uPv15Str;
private String homeLoadYesterdayEnergy;
private String uPv32Str;
private String batteryOvpSet;
private String ctrlCommand;
private String iAc2;
private String pow20Str;
private String iPv31;
private String batteryPowerBmsStr;
private String inverterTemperature;
private String storageBatteryCurrent;
private String homeLoadYesterdayEnergyStr;
private String collectorId;
private String uPv25Str;
private String reactivePower;
private String iAc3;
private String upvTotal;
private String batteryMonthDischargeEnergyStr;
private String insulationResistance;
private String batteryTotalDischargeEnergyStr;
private String ipvTotalStr;
private String bypassAcCurrentC;
private String uAc1Str;
private String psum;
private String epsSwitchTime;
private String gridPurchasedTodayEnergyStr;
private String homeGridYearEnergyStr;
private String psumCal;
private String gridSellTodayEnergyStr;
private String iPv29Str;
private String pacPec;
private String bstteryCurrent;
private String rs485ComAddr;
private String uInitGnd;
private String pow24Str;
private String batteryYearChargeEnergyStr;
private String epmFailSafe;
private String pow21;
private String pow26;
private String pow29;
private String gridSellEnergy;
private String meter1TypeLow;
private String homeLoadTotalEnergyStr;
private String pow15Str;
private String uPv28Str;
private String uPv26Str;
private String backupTodayEnergy;
private String batteryCMaxiSet;
private String iPv31Str;
private String uPv22Str;
private String batteryYesterdayChargeEnergy;
private String batteryOlvEnableSet;
private String uPv19Str;
private String batteryTotalDischargeEnergy;
private String inverterTemperatureUnit;
private String batteryYesterdayDischargeEnergy;
private String gridSellTodayEnergy;
private String sno;
private String uPv17Str;
private String batteryFailureInformation02;
private String pow7;
private String pow8;
private String uPv15;
private String uPv12;
private String stationName;
private String iPv2;
private String iPv5;
private String upvTotalStr;
private String uPv7Str;
private String iPv9Str;
private String internalBatteryI;
private String iPv2Str;
private String iPv20Str;
private String iPv11Str;
private String totalLoadPower;
private String dcPacStr;
private String powerFactor;
private String iPv7Str;
private String pow10Str;
private String uPv27Str;
private String sn;
private String uAc2;
private String eToday;
private String storageBatteryCurrentStr;
private String dcBusHalf;
private String pow5Str;
private String dcBusStr;
private String uPv1;
private String uPv6;
private String uPv9;
private String batteryMonthChargeEnergy;
private String gridPurchasedYesterdayEnergyStr;
private String pEpmSet;
private String bypassAcVoltageSet;
private String batteryYesterdayDischargeEnergyStr;
private String homeGridTodayEnergyStr;
private String socDischargeSet;
private String gridPurchasedMonthEnergyStr;
private String batteryLaTemp;
private String dataTimestamp;
private String batteryChargingCurrent;
private String batteryMonthChargeEnergyStr;
private String uPv5Str;
private String pow11Str;
private String uPv2;
private String uPv5;
private String homeLoadTodayEnergy;
private String bypassAcCurrentSet;
private String bypassLoadPowerStr;
private String iPv1;
private String iPv6;
private String iPv9;
private String batteryTodayChargeEnergy;
private String batteryUvpSet;
private String pow31;
private String iPv4Str;
private String iPv32;
private String epsDDepth;
private String pow21Str;
private String totalLoadPowerStr;
private String facStr;
private String homeGridTotalEnergy;
private String iPv15Str;
private String iAc1Str;
private String backupYesterdayEnergy;
private String uPv31Str;
private String uPv29Str;
private String psumCalPec;
private String homeLoadEnergyStr;
private String gridSellMonthEnergyStr;
private String pEpmStr;
private String pow32;
private String pow16Str;
private String iPv30;
private String meter2Type;
private String pac;
private String batteryCDSet;
private String batteryDischargeLimiting;
private String iPv22Str;
private String iPv28Str;
private String batteryCDEnableSet;
private String pow29Str;
private String pacStr;
private String gridPurchasedMonthEnergy;
private String iLeakLimt;
private String bypassAcVoltage;
private String parallelBattery;
private String version;
private String batteryPowerPec;
private String batteryMonthDischargeEnergy;
private String gridSellYesterdayEnergy;
private String gridPurchasedYearEnergy;
private String apparentPower;
private String iPv16Str;
private String batteryChargeEnergyStr;
private String backupTodayEnergyStr;
private String homeGridYearEnergy;
private String iPv13Str;
private String pow12;
private String pow15;
private String pow1;
private String dcPac;
private String pow6;
private String pow9;
private String epmSafe;
private String batteryHealthSoh;
private String iPv18;
private String iPv17;
private String iPv10;
private String iPv28;
private String iPv27;
private String iPv20;
private String pow20;
private String pow27;
private String pow28;
private String storageBatteryVoltage;
private String uPv21Str;
private String uPv24;
private String uPv23;
private String powTotalStr;
private String uPv8Str;
private String parallelAddr;
private String pow22Str;
private String batteryTotalChargeEnergy;
private String meter1SiteHigh;
private String uPv6Str;
private String iAc1;
private String fullHour;
private String batteryTodayDischargeEnergyStr;
private String tempName;
private String uPv2Str;
private String gridPurchasedTotalEnergy;
// private String pow25Str;
// private String batteryPowerZheng;
// private String uPv1Str;
// private String backupTotalEnergyStr;
// private String uPv7;
// private String uPv8;
// private String powerPec;
// private String pow26Str;
// private String homeLoadEnergy;
// private String pow13Str;
// private String eTotal;
// private String pow1Str;
// private String bypassLoadPower;
// private String temp;
// private String pow14Str;
// private String gridPurchasedEnergyStr;
// private String uPv3;
// private String uPv4;
// private String homeGridMonthEnergy;
// private String pEpm;
// private String gridPurchasedYearEnergyStr;
// private String socChargingSet;
// private String uPv28;
// private String uPv27;
// private String uPv20;
// private String pow9Str;
// private String bypassAcOnoffSet;
// private String daylight;
// private String dcInputtype;
// private String dcBusHalfStr;
// private String pow7Str;
// private String gridSellYesterdayEnergyStr;
// private String porwerPercent;
// private String uAc2Str;
// private String pReactiveLimitSet;
// private String uPv18;
// private String uPv17;
// private String uPv10;
// private String batteryFcvSet;
// private String pow28Str;
// private String pow30;
// private String batteryPowerFu;
// private String timeZoneStr;
// private String fac;
// private String homeGridTotalEnergyStr;
// private String iPv29;
// private String iPv26;
// private String iPv21;
// private String iPv27Str;
// private String batteryTotalChargeEnergyStr;
// private String meter1Type;
// private String batteryDischargeLimitingStr;
// private String homeGridYesterdayEnergy;
// private String pow2Str;
// private String uAc3Str;
// private String collectorsn;
// private String batteryFailureInformation01;
// private String iPv18Str;
// private String uPv30Str;
// private String uInitGndStr;
// private String eYearStr;
// private String gridSellEnergyStr;
// private String batteryDischargeEnergyStr;
// private String familyLoadPercent;
// private String batteryCapacitySoc;
// private String batteryTodayChargeEnergyStr;
// private String pEpmSetStr;
// private String iPv21Str;
// private String pLimitSet;
// private String iPv5Str;
// private String iPv1Str;
// private String iPv26Str;
// private String homeLoadTotalEnergy;
// private String batteryType;
// private String iPv14Str;
// private String homeGridYesterdayEnergyStr;
// private String backupTotalEnergy;
// private String iAc3Str;
// private String gridSellTotalEnergyStr;
// private String uPv29;
// private String uPv26;
// private String uPv21;
// private String uPv12Str;
// private String gridPurchasedEnergy;
// private String pow2;
// private String timeStr;
// private String pow5;
// private String iPv19;
// private String iPv16;
// private String iPv11;
// private String dcBus;
// private String pow32Str;
// private String familyLoadPower;
// private String meter2SiteHigh;
// private String inverterMeterModel;
// private String iPv32Str;
// private String familyLoadPowerStr;
// private String batteryYearDischargeEnergyStr;
// private String iPv24Str;
// private String currentState;
// private String iPv25;
// private String iPv22;
// private String iPv3Str;
// private String pow4Str;
// private String gridPurchasedYesterdayEnergy;
// private String energyStorageControl;
// private String homeLoadTodayEnergyStr;
// private String batteryPowerStr;
// private String meter2TypeLow;
// private String pow27Str;
// private String homeGridMonthEnergyStr;
// private String iPv23Str;
// private String eYear;
// private String acInType;
// private String batteryVoltage;
// private String reactivePowerStr;
// private String iPv12Str;
// private String pow19Str;
// private String timeZone;
// private String eMonthStr;
// private String simFlowState;
// private String bstteryCurrentStr;
// private String uPv16Str;
// private String uPv3Str;
// private String gridSellTotalEnergy;
// private String powTotal;
// private String pow22;
// private String pow25;
// private String familyLoadPowerPec;
// private String oneSelf;
// private String uPv19;
// private String uPv16;
// private String uPv11;
// private String batteryDischargeEnergy;
// private String pow13;
// private String pow14;
// private String psumCalStr;
// private String fullHourStr;
// private String iPv3;
// private String iPv4;
// private String batteryPowerBms;
// private String eTotalStr;
// private String uPv11Str;
// private String pow10;
// private String pow17;
// private String pow18;
// private String pow6Str;
// private String uPv30;
// private String iPv19Str;
// private String pow8Str;
// private String batteryAcvSet;
// private String userId;
// private String uPv25;
// private String uPv22;
// private String power;
// private String bypassAcVoltageB;
// private String id;
// private String uPv13Str;
// private String iPv17Str;
// private String pow18Str;
// private String pow23;
// private String pow24;
// private String uPv4Str;
// private String backupYearEnergyStr;
// private String ipvTotal;
// private String uPv10Str;
// private String batteryChargeEnergy;
// private String contractTime;
// private String batteryTodayDischargeEnergy;
// private String batteryYearDischargeEnergy;
// private String batteryYesterdayChargeEnergyStr;
// private String iAc2Str;
// private String warningInfoData;
// private String eTodayStr;
// private String productModel;
// private String pow31Str;
// private String iPv25Str;
// private String iPv8Str;
// private String parallelPhase;
// private String dispersionRate;
// private String batteryYearChargeEnergy;
// private String pow3Str;
// private String backupMonthEnergy;
// private String gridSellMonthEnergy;
// private String gridPurchasedTotalEnergyStr;
// private String pow11;
// private String pow16;
// private String pow19;
// private String batteryCDISet;
// private String backupYesterdayEnergyStr;
// private String gridSellYearEnergyStr;
// private String model;
// private String pow3;
// private String pow4;
// private String backupYearEnergy;
// private String parallelStatus;
// private String iPv24;
// private String iPv23;
// private String iPv6Str;
// private String pFactorLimitSet;
// private String uPv14Str;
// private String pow12Str;
// private String pow23Str;
// private String batteryDMaxiSet;
// private String iPv7;
// private String iPv8;
// private String apparentPowerStr;
// private String stationId;
// private String powerStr;
// private String bypassAcCurrentB;
// private String iPv15;
// private String iPv12;
// private String batteryChargingCurrentStr;
// private String uPv18Str;
// private String gridPurchasedTodayEnergy;
// private String uAc1;
// private String uPv9Str;
// private String pow17Str;
// private String batteryPower;
// private String nationalStandardstr;
// private String offGridDDepth;
// private String homeGridTodayEnergy;
// private String uAc3;
// private String iPv30Str;
// private String uPv14;
// private String uPv13;
// private String iPv10Str;
// private String uPv32;
// private String batteryVoltageStr;
// private String psumStr;
// private String pow30Str;
// private String backupMonthEnergyStr;
// private String uPv31;
// private String uPv23Str;
// private String bypassAcVoltageC;
// private String uPv20Str;
// private String iPv14;
// private String iPv13;
// private String stateExceptionFlag;
// private String daylightSwitch;
// private String bypassAcCurrent;
// private String uPv15Str;
// private String homeLoadYesterdayEnergy;
// private String uPv32Str;
// private String batteryOvpSet;
// private String ctrlCommand;
// private String iAc2;
// private String pow20Str;
// private String iPv31;
// private String batteryPowerBmsStr;
// private String inverterTemperature;
// private String storageBatteryCurrent;
// private String homeLoadYesterdayEnergyStr;
// private String collectorId;
// private String uPv25Str;
// private String reactivePower;
// private String iAc3;
// private String upvTotal;
// private String batteryMonthDischargeEnergyStr;
// private String insulationResistance;
// private String batteryTotalDischargeEnergyStr;
// private String ipvTotalStr;
// private String bypassAcCurrentC;
// private String uAc1Str;
// private String psum;
// private String epsSwitchTime;
// private String gridPurchasedTodayEnergyStr;
// private String homeGridYearEnergyStr;
// private String psumCal;
// private String gridSellTodayEnergyStr;
// private String iPv29Str;
// private String pacPec;
// private String bstteryCurrent;
// private String rs485ComAddr;
// private String uInitGnd;
// private String pow24Str;
// private String batteryYearChargeEnergyStr;
// private String epmFailSafe;
// private String pow21;
// private String pow26;
// private String pow29;
// private String gridSellEnergy;
// private String meter1TypeLow;
// private String homeLoadTotalEnergyStr;
// private String pow15Str;
// private String uPv28Str;
// private String uPv26Str;
// private String backupTodayEnergy;
// private String batteryCMaxiSet;
// private String iPv31Str;
// private String uPv22Str;
// private String batteryYesterdayChargeEnergy;
// private String batteryOlvEnableSet;
// private String uPv19Str;
// private String batteryTotalDischargeEnergy;
// private String inverterTemperatureUnit;
// private String batteryYesterdayDischargeEnergy;
// private String gridSellTodayEnergy;
// private String sno;
// private String uPv17Str;
// private String batteryFailureInformation02;
// private String pow7;
// private String pow8;
// private String uPv15;
// private String uPv12;
// private String stationName;
// private String iPv2;
// private String iPv5;
// private String upvTotalStr;
// private String uPv7Str;
// private String iPv9Str;
// private String internalBatteryI;
// private String iPv2Str;
// private String iPv20Str;
// private String iPv11Str;
// private String totalLoadPower;
// private String dcPacStr;
// private String powerFactor;
// private String iPv7Str;
// private String pow10Str;
// private String uPv27Str;
// private String sn;
// private String uAc2;
// private String eToday;
// private String storageBatteryCurrentStr;
// private String dcBusHalf;
// private String pow5Str;
// private String dcBusStr;
// private String uPv1;
// private String uPv6;
// private String uPv9;
// private String batteryMonthChargeEnergy;
// private String gridPurchasedYesterdayEnergyStr;
// private String pEpmSet;
// private String bypassAcVoltageSet;
// private String batteryYesterdayDischargeEnergyStr;
// private String homeGridTodayEnergyStr;
// private String socDischargeSet;
// private String gridPurchasedMonthEnergyStr;
// private String batteryLaTemp;
// private String dataTimestamp;
// private String batteryChargingCurrent;
// private String batteryMonthChargeEnergyStr;
// private String uPv5Str;
// private String pow11Str;
// private String uPv2;
// private String uPv5;
// private String homeLoadTodayEnergy;
// private String bypassAcCurrentSet;
// private String bypassLoadPowerStr;
// private String iPv1;
// private String iPv6;
// private String iPv9;
// private String batteryTodayChargeEnergy;
// private String batteryUvpSet;
// private String pow31;
// private String iPv4Str;
// private String iPv32;
// private String epsDDepth;
// private String pow21Str;
// private String totalLoadPowerStr;
// private String facStr;
// private String homeGridTotalEnergy;
// private String iPv15Str;
// private String iAc1Str;
// private String backupYesterdayEnergy;
// private String uPv31Str;
// private String uPv29Str;
// private String psumCalPec;
// private String homeLoadEnergyStr;
// private String gridSellMonthEnergyStr;
// private String pEpmStr;
// private String pow32;
// private String pow16Str;
// private String iPv30;
// private String meter2Type;
// private String pac;
// private String batteryCDSet;
// private String batteryDischargeLimiting;
// private String iPv22Str;
// private String iPv28Str;
// private String batteryCDEnableSet;
// private String pow29Str;
// private String pacStr;
// private String gridPurchasedMonthEnergy;
// private String iLeakLimt;
// private String bypassAcVoltage;
// private String parallelBattery;
// private String version;
// private String batteryPowerPec;
// private String batteryMonthDischargeEnergy;
// private String gridSellYesterdayEnergy;
// private String gridPurchasedYearEnergy;
// private String apparentPower;
// private String iPv16Str;
// private String batteryChargeEnergyStr;
// private String backupTodayEnergyStr;
// private String homeGridYearEnergy;
// private String iPv13Str;
// private String pow12;
// private String pow15;
// private String pow1;
// private String dcPac;
// private String pow6;
// private String pow9;
// private String epmSafe;
// private String batteryHealthSoh;
// private String iPv18;
// private String iPv17;
// private String iPv10;
// private String iPv28;
// private String iPv27;
// private String iPv20;
// private String pow20;
// private String pow27;
// private String pow28;
// private String storageBatteryVoltage;
// private String uPv21Str;
// private String uPv24;
// private String uPv23;
// private String powTotalStr;
// private String uPv8Str;
// private String parallelAddr;
// private String pow22Str;
// private String batteryTotalChargeEnergy;
// private String meter1SiteHigh;
// private String uPv6Str;
// private String iAc1;
// private String fullHour;
// private String batteryTodayDischargeEnergyStr;
// private String tempName;
// private String uPv2Str;
// private String gridPurchasedTotalEnergy;
}
......@@ -16,7 +16,7 @@ public class HYGFJPInverterHistory implements Serializable {
private Double powerGeneration;
private Double dailyReturn;
private Double generationHours;
private Long inverterId;
private String inverterId;
private String thirdStationId;
private String thirdCode;
}
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import lombok.Data;
import java.io.Serializable;
/**
* @author DELL
*/
@Data
public class KsolarStationCollectData implements Serializable {
private Long createdTime;
private String inverterId;
private String status;
private String deviceModel;
private String version;
private Double powerApparent;
private Double dayGeneration;
private Double monthGeneration;
private Double yearGeneration;
private Double totalGeneration;
private Double currentPv1;
private Double currentPv2;
private Double currentPv3;
private Double currentPv4;
private Double currentPv5;
private Double currentPv6;
private Double currentPv7;
private Double currentPv8;
private Double currentPv9;
private Double currentPv10;
private Double currentPv11;
private Double currentPv12;
private Double currentR;
private Double currents;
private Double currentT;
private Double voltagePv1;
private Double voltagePv2;
private Double voltagePv3;
private Double voltagePv4;
private Double voltagePv5;
private Double voltagePv6;
private Double voltagePv7;
private Double voltagePv8;
private Double voltagePv9;
private Double voltagePv10;
private Double voltagePv11;
private Double voltagePv12;
private Double voltagePbus;
private Double voltagelbus;
private Double voltageRs;
private Double voltageSt;
private Double voltageTr;
private Double powerPv1;
private Double powerPv2;
private Double powerPv3;
private Double powerPv4;
private Double powerPv5;
private Double powerPv6;
private Double powerPv7;
private Double powerPv8;
private Double powerPv9;
private Double powerPv10;
private Double powerPv11;
private Double powerPv12;
private Double frequencyRs;
private Double frequencySt;
private Double frequencyTr;
}
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* @author DELL
*/
@Data
@TableName(value = "ksolar_collector_list" ,autoResultMap = true)
public class KsolarStationCollectList implements Serializable {
private Long createdTime;
private String address;
private String armVersion;
private String bstVersion;
private String collectId;
private String collectName;
private String collectVersion;
private String dayGeneration;
private String deviceModel;
private String dspVersion;
private String inverterId;
private String trafficType;
private Integer interfaceType;
private Integer modelId;
private Integer phaseStandard;
private String stationName;
private Integer phaseType;
private Double signal;
private String status;
private Double powerInter;
private Double totalGeneration;
private String thirdStationId;
}
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* @author DELL
*/
@Data
@TableName(value = "ksolar_station_detail" ,autoResultMap = true)
public class KsolarStationDetails implements Serializable {
private Long createdTime;
private String area;
private Double installCapacity;
private Double elecPrice;
private String city;
private String elecUnit;
private Integer stationType;
private String latitude;
private String timeZone;
private String countries;
private String userCode;
private String stationAddressDetail;
private String province;
private String stationName;
private String longitude;
}
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* @author DELL
*/
@Data
@TableName(value = "ksolar_station_earn" ,autoResultMap = true)
public class KsolarStationEarn implements Serializable {
private Long createdTime;
private Double co2;
private Double coal;
private Double dayEarn;
private Double dayGeneration;
private Double forest;
private Double monthGeneration;
private Double realPower;
private Double totalEarn;
private Double totalGeneration;
private Double totalPower;
private Double yearGeneration;
}
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName(value = "ksolar_station_earn_chart" ,autoResultMap = true)
public class KsolarStationEarnChart {
private Long createdTime;
private String attribValue;
private String earnValue;
private String saveTime;
}
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.models.auth.In;
import lombok.Data;
import java.io.Serializable;
/**
* @author DELL
*/
@Data
public class KSolarStationList {
@TableName(value = "ksolar_station_list" ,autoResultMap = true)
public class KsolarStationList implements Serializable {
private Long createdTime;
private String stationId;
private String stationName;
private Integer stationType;
......
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.GolangCollectorList;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.KsolarStationCollectList;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface KsolarStationCollectListMapper extends BaseMapper<KsolarStationCollectList> {
@Select("select collect_id from ksolar_collector_list group by collect_id")
List<String> getCollectIds();
}
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.KsolarStationDetails;
/**
* @author DELL
*/
public interface KsolarStationDetailsMapper extends BaseMapper<KsolarStationDetails> {
}
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.KsolarStationEarn;
/**
* @author DELL
*/
public interface KsolarStationEarnMapper extends BaseMapper<KsolarStationEarn> {
}
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.KsolarStationList;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* @author DELL
*/
public interface KsolarStationMapper extends BaseMapper<KsolarStationList> {
@Select("select station_id from ksolar_station_list group by station_id")
List<String> getStationIds();
}
......@@ -25,8 +25,5 @@ public interface KSolarDataAcquisitionService {
* @descrption 逆变器详情数据入库
*/
void inverterDetail();
/**
* @descrption 采集器告警列表数据入库
*/
void inverAlramInfo();
}
......@@ -364,7 +364,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
}
jpInverter.setSnCode(inverterDetailDto.getSn());
jpInverter.setState(GoLangConstant.stationStaus.get(inverterDetailDto.getCurrentState()));
jpInverter.setCollectorId(inverterDetailDto.getCollectorId());
jpInverter.setCollectorId(String.valueOf(inverterDetailDto.getCollectorId()));
jpInverter.setCollectorSnCode(inverterDetailDto.getCollectorsn());
jpInverter.setUpdateTime(new Date());
jpInverter.setCurrentPower(inverterDetailDto.getPac());
......@@ -398,7 +398,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
if (ObjectUtils.isEmpty(jpInverterElectricity)) {
jpInverterElectricity = new JpInverterElectricity();
}
jpInverterElectricity.setInverterId(inverterDetailDto.getId());
jpInverterElectricity.setInverterId(String.valueOf(inverterDetailDto.getId()));
jpInverterElectricity.setSnCode(inverterDetailDto.getSn());
jpInverterElectricity.setThirdCode(PVProducerInfoEnum.JLY.getCode());
jpInverterElectricity.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
......@@ -421,7 +421,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
if (ObjectUtils.isEmpty(jpInverterElectricity)) {
jpInverterElectricity = new JpInverterElectricity();
}
jpInverterElectricity.setInverterId(inverterDetailDto.getId());
jpInverterElectricity.setInverterId(String.valueOf(inverterDetailDto.getId()));
jpInverterElectricity.setSnCode(inverterDetailDto.getSn());
jpInverterElectricity.setThirdCode(PVProducerInfoEnum.JLY.getCode());
jpInverterElectricity.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
......@@ -457,7 +457,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
}
hygfjpInverterHistory.setDate(today);
hygfjpInverterHistory.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
hygfjpInverterHistory.setInverterId(inverterDetailDto.getId());
hygfjpInverterHistory.setInverterId(String.valueOf(inverterDetailDto.getId()));
hygfjpInverterHistory.setSnCode(inverterDetailDto.getSn());
hygfjpInverterHistory.setThirdCode(PVProducerInfoEnum.JLY.getCode());
hygfjpInverterHistory.setGenerationHours(inverterDetailDto.getFullHour());
......
package com.yeejoin.amos.api.householdapi.face.service.impl;
import com.yeejoin.amos.api.householdapi.Utils.KSolarRequestUtil;
import com.yeejoin.amos.api.householdapi.constant.KSolarConstant;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.KSolarStationList;
import com.yeejoin.amos.api.householdapi.face.service.KSolarDataAcquisitionService;
import fastjson.JSON;
import jdk.nashorn.internal.ir.RuntimeNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
@Service
public class KSolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionService {
@Autowired
KSolarRequestUtil kSolarRequestUtil;
@Override
public void stationList() {
HashMap<String, Object> requestInfo = new HashMap<>();
String requestParaminfo = JSON.toJSONString(requestInfo);
List<KSolarStationList> kSolarStationListList = kSolarRequestUtil.getResPonse(
KSolarConstant.stationListUrl,
KSolarConstant.requestGET,
requestParaminfo,
KSolarConstant.resovle_rows,
KSolarStationList.class);
for (int i = 0; i < kSolarStationListList.size(); i++) {
KSolarStationList kSolarStationList = kSolarStationListList.get(i);
kSolarStationList.getStationId();
}
}
@Override
public void stationDetail() {
}
@Override
public void collectorList() {
}
@Override
public void collectorDetail() {
}
@Override
public void inverterList() {
}
@Override
public void inverterDetail() {
}
@Override
public void inverAlramInfo() {
}
}
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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.Utils.KsolarRequestUtil;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
import com.yeejoin.amos.api.householdapi.constant.KSolarConstant;
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.KsolarAlarmDto;
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;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.*;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.KsolarStationCollectList;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpCollectorMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpInverterElectricityMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpInverterMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.*;
import com.yeejoin.amos.api.householdapi.face.service.KSolarDataAcquisitionService;
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
/**
* @author DELL
*/
@Service
public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionService {
//定时任务执行频率 当前为10分钟一次
private final String dataRequstScheduled = "0 0/60 * * * *";
@Autowired
KsolarRequestUtil kSolarRequestUtil;
@Autowired
KsolarStationMapper kSolarStationMapper;
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private HYGFJPStationPowerHistoryMapper hygfjpStationPowerHistoryMapper;
@Autowired
private HYGFJPInverterHistoryMapper hygfjpInverterHistoryMapper;
@Autowired
private HYGFJPCollectorHistoryMapper hygfjpCollectorHistoryMapper;
@Autowired
private HYGFJPInverterWarnMapper hygfjpInverterWarnMapper;
@Autowired
private HYGFJPInverterElecHistoryMapper hygfjpInverterElecHistoryMapper;
@Autowired
private HYGFJPDayPowerMapper hygfjpDayPowerMapper;
@Autowired
private KsolarStationDetailsMapper ksolarStationDetailsMapper;
@Autowired
private KsolarStationEarnMapper ksolarStationEarnMapper;
@Autowired
private KsolarStationCollectListMapper ksolarStationCollectListMapper;
@Autowired
private JpCollectorMapper jpCollectorMapper;
@Autowired
private JpInverterMapper jpInverterMapper;
//监盘逆变器电量mapper
@Autowired
private JpInverterElectricityMapper jpInverterElectricityMapper;
@Scheduled(cron = dataRequstScheduled)
@Override
public void stationList() {
HashMap<String, Object> requestInfo = new HashMap<>();
String requestParaminfo = JSON.toJSONString(requestInfo);
List<KsolarStationList> kSolarStationListList = kSolarRequestUtil.getResPonse(
KSolarConstant.stationListUrl,
KSolarConstant.requestGET,
requestParaminfo,
KSolarConstant.resovle_rows,
KsolarStationList.class);
for (KsolarStationList kSolarStation : kSolarStationListList) {
kSolarStation.setCreatedTime(System.currentTimeMillis());
kSolarStationMapper.insert(kSolarStation);
}
}
@Scheduled(cron = dataRequstScheduled)
@Override
public void stationDetail() {
List<String> stationIds = kSolarStationMapper.getStationIds();
String today = DateUtil.today();
String hour = new Date().getHours() + ":00";
for (String stationId : stationIds) {
LambdaQueryWrapper<KsolarStationList> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(KsolarStationList::getStationId, stationId);
List<KsolarStationList> ksolarStationLists = kSolarStationMapper.selectList(wrapper);
if (!CollectionUtils.isEmpty(ksolarStationLists)) {
KsolarStationList ksolarStation = ksolarStationLists.get(0);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
HashMap<String, Object> requestInfo = new HashMap<>(1);
String requestParaminfo = JSON.toJSONString(requestInfo);
String url = KSolarConstant.stationInfoByIdUrl + "?stationId=" + ksolarStation.getStationId();
// 获取电站详情
List<KsolarStationDetails> ksolarStationDetailsList = kSolarRequestUtil.getResPonse(
url,
KSolarConstant.requestPOST,
requestParaminfo,
KSolarConstant.resovle_data,
KsolarStationDetails.class);
// 获取单个电站的发电量和收益
KsolarStationEarn stationEarn = getStationEarn(ksolarStation.getStationId());
// 获取单个电站月收益
Map<String, Double> monthEarn = getStationMonthEarn(ksolarStation.getStationId(), "month");
// 获取单个电站年收益
Map<String, Double> yearEarn = getStationMonthEarn(ksolarStation.getStationId(), "year");
for (KsolarStationDetails ksolarStationDetail : ksolarStationDetailsList) {
ksolarStationDetail.setCreatedTime(System.currentTimeMillis());
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_code", PVProducerInfoEnum.KSOLAR.getCode()).
eq("third_station_id", ksolarStation.getStationId()));
// 给户用光伏存储的数据赋值
if (ObjectUtils.isEmpty(jpStation)) {
jpStation = new JpStation();
}
jpStation.setThirdStationId(ksolarStation.getStationId());
jpStation.setCapacity(ksolarStationDetail.getInstallCapacity());
jpStation.setName(ksolarStationDetail.getStationName());
jpStation.setPrice(ksolarStationDetail.getElecPrice());
jpStation.setAddress(ksolarStationDetail.getStationAddressDetail());
jpStation.setLongitude(ksolarStationDetail.getLongitude());
jpStation.setLatitude(ksolarStationDetail.getLatitude());
jpStation.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
// 业主姓名
jpStation.setUserName(ksolarStation.getUserName());
jpStation.setState(KSolarConstant.stationStaus.get(String.valueOf(ksolarStation.getStatus())));
jpStation.setRealTimePower(ksolarStation.getPowerInter());
jpStation.setDayGenerate(ksolarStation.getDayGeneration());
jpStation.setAccumulatedPower(ksolarStation.getTotalGeneration());
jpStation.setArea(ksolarStation.getAddress());
// 日收益
jpStation.setDayIncome(stationEarn.getDayEarn() * KSolarConstant.kwhToMwh);
// 月发电量
jpStation.setMonthGenerate(stationEarn.getMonthGeneration() * KSolarConstant.kwhToMwh);
// 年发电量
jpStation.setYearGenerate(stationEarn.getYearGeneration() * KSolarConstant.kwhToMwh);
// 月收益
jpStation.setMonthIncome(monthEarn.get("monthEarn"));
// 年收益
jpStation.setYearIncome(yearEarn.get("yearEarn"));
// 累计收益
jpStation.setCumulativeIncome(stationEarn.getTotalEarn());
// 并网类型
// jpStation.setOnGridType(GoLangConstant.intoNetWorkStatus.get(String.valueOf(golangStationDetail.getStationtypenew())));
// // 邮箱
// jpStation.setEmail(golangStationDetail.getUseremail());
// // 并网时间
// jpStation.setOnGridTime(new Date(golangStationDetail.getFispowertime()));
// // 接入平台时间
// jpStation.setAccessTime(new Date(golangStationDetail.getFisgeneratetime()));
// // 创建时间
// jpStation.setCreateTime(new Date(golangStationDetail.getCreatedate()));
// // 额定功率
// jpStation.setRatedPower(Double.valueOf(golangStationDetail.getInverterpower()));
// 第三方电站id
// jpStation.setThirdStationId(String.valueOf(golangStationDetail.getId()));
// 第三方厂商标识
// jpStation.setThirdCode(PVProducerInfoEnum.JLY.getCode());
// 业主电话
// jpStation.setUserPhone(String.valueOf(golangStationDetail.getUsermobile()));
// 电站联系人
// jpStation.setStationContact(String.valueOf(golangStationDetail.getMobile()).toLowerCase().replace("null", ""));
// 组件数量
// jpStation.setModuleCount(ObjectUtils.isEmpty(Math.toIntExact(golangStationDetail.getModule()))?0:Math.toIntExact(golangStationDetail.getModule()));
if (!ObjectUtils.isEmpty(jpStation.getSequenceNbr())) {
jpStationMapper.updateById(jpStation);
} else {
jpStationMapper.insert(jpStation);
}
HYGFJPStationPowerHistory hygfjpStationPowerHistory = new HYGFJPStationPowerHistory();
hygfjpStationPowerHistory.setCreatedTime(System.currentTimeMillis());
hygfjpStationPowerHistory.setThirdStationId(jpStation.getThirdStationId());
hygfjpStationPowerHistory.setPower(ksolarStation.getPowerInter());
hygfjpStationPowerHistory.setThirdCode(jpStation.getThirdCode());
hygfjpStationPowerHistory.setTime(System.currentTimeMillis());
hygfjpStationPowerHistoryMapper.insert(hygfjpStationPowerHistory);
HYGFJPDayPower hygfjpDayPower = hygfjpDayPowerMapper.selectOne(
new QueryWrapper<HYGFJPDayPower>().
eq("tation_id", ksolarStation.getStationId()).
eq("year_month_day", today).
eq("hour", hour)
);
if (ObjectUtils.isEmpty(hygfjpDayPower)) {
hygfjpDayPower = new HYGFJPDayPower();
}
hygfjpDayPower.setTationId(ksolarStation.getStationId());
hygfjpDayPower.setHour(hour);
hygfjpDayPower.setYearMonthDay(today);
hygfjpDayPower.setPower(ksolarStation.getPowerInter());
if (ObjectUtils.isEmpty(hygfjpDayPower.getCreatedTime())) {
hygfjpDayPower.setCreatedTime(System.currentTimeMillis());
hygfjpDayPowerMapper.insert(hygfjpDayPower);
} else {
hygfjpDayPowerMapper.insert(hygfjpDayPower);
}
ksolarStationDetail.setCreatedTime(System.currentTimeMillis());
ksolarStationDetailsMapper.insert(ksolarStationDetail);
}
}
}
}
/**
* 获取单个站的发电量
* @param stationId 站id
* @return 发电量实体
*/
private KsolarStationEarn getStationEarn (String stationId) {
KsolarStationEarn ksolarStationEarn = new KsolarStationEarn();
// 获取单个电站的发电量和收益
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
HashMap<String, Object> requestInfo = new HashMap<>(1);
String requestParaminfo = JSON.toJSONString(requestInfo);
String url = KSolarConstant.stationEarnUrl + "?stationId=" + stationId;
List<KsolarStationEarn> ksolarStationEarns = kSolarRequestUtil.getResPonse(
url,
KSolarConstant.requestGET,
requestParaminfo,
KSolarConstant.resovle_data,
KsolarStationEarn.class);
if (!CollectionUtils.isEmpty(ksolarStationEarns)) {
ksolarStationEarn = ksolarStationEarns.get(0);
ksolarStationEarn.setCreatedTime(System.currentTimeMillis());
ksolarStationEarnMapper.insert(ksolarStationEarn);
}
return ksolarStationEarn;
}
Map<String, Double> getStationMonthEarn (String stationId, String type) {
Map<String, Double> map = new HashMap<>(1);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
HashMap<String, Object> requestInfo = new HashMap<>(1);
String requestParaminfo = JSON.toJSONString(requestInfo);
// 获取当前日期
Date currentDate = new Date();
// 创建SimpleDateFormat实例,指定日期格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
// 格式化日期为字符串
String formattedDate = sdf.format(currentDate);
// 从格式化后的字符串中提取年份和月份
String year = formattedDate.substring(0, 4);
String month = formattedDate;
String attribId = "201";
String stime = month;
if ("year".equals(type)) {
attribId = "202";
stime = year;
}
String url = KSolarConstant.stationEarnChartUrl + "?stationId=" + stationId + "&attribId="+ attribId + "&stime=" + stime;
List<KsolarStationEarnChart> ksolarStationEarnCharts = kSolarRequestUtil.getResPonse(
url,
KSolarConstant.requestGET,
requestParaminfo,
KSolarConstant.resovle_arr,
KsolarStationEarnChart.class);
double earnValues = 0;
if (!CollectionUtils.isEmpty(ksolarStationEarnCharts)) {
earnValues += ksolarStationEarnCharts.stream().mapToDouble(ksolarStationEarnChart -> Double.parseDouble(ksolarStationEarnChart.getEarnValue())).sum();
}
if ("year".equals(type)) {
map.put("yearEarn", earnValues);
} else {
map.put("monthEarn", earnValues);
}
return map;
}
@Scheduled(cron = dataRequstScheduled)
@Override
public void collectorList() {
List<String> stationIds = kSolarStationMapper.getStationIds();
for (String stationId : stationIds) {
LambdaQueryWrapper<KsolarStationList> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(KsolarStationList::getStationId, stationId);
List<KsolarStationList> ksolarStationLists = kSolarStationMapper.selectList(wrapper);
if (!CollectionUtils.isEmpty(ksolarStationLists)) {
KsolarStationList ksolarStationList = ksolarStationLists.get(0);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
HashMap<String, Object> requestInfo = new HashMap<>(1);
String requestParaminfo = JSON.toJSONString(requestInfo);
String url = KSolarConstant.stationCollectListUrl + "?stationId=" + ksolarStationList.getStationId() + "&pageNumber=1&pageSize=200";
List<KsolarStationCollectList> result = kSolarRequestUtil.getResPonse(
url,
KSolarConstant.requestGET,
requestParaminfo,
KSolarConstant.resovle_rows,
KsolarStationCollectList.class
);
for (KsolarStationCollectList ksolarStationCollectList : result) {
ksolarStationCollectList.setCreatedTime(System.currentTimeMillis());
ksolarStationCollectList.setThirdStationId(ksolarStationList.getStationId());
ksolarStationCollectListMapper.insert(ksolarStationCollectList);
JpCollector jpCollector = jpCollectorMapper.selectOne(new QueryWrapper<JpCollector>().
eq("third_station_id", ksolarStationCollectList.getThirdStationId()).
eq("sn_code", ksolarStationCollectList.getCollectId()).
eq("third_code", PVProducerInfoEnum.KSOLAR.getCode()));
if (ObjectUtils.isEmpty(jpCollector)) {
jpCollector = new JpCollector();
}
// //出场日期
// jpCollector.setDischargeDate(new Date(collectorDetailDto.getFactoryTime()));
// //生产日期
// jpCollector.setProductDate(new Date(collectorDetailDto.getFactoryTime()));
// //数据上传间隔
// jpCollector.setDataPeriod(collectorDetailDto.getDataUploadCycle());
// //本次上电时间
// jpCollector.setThisWorkTime(new DateTime(collectorDetailDto.getCurrentWorkingTime()));
// //累计工作时间
// jpCollector.setTotalWorkTime(new DateTime(collectorDetailDto.getTotalWorkingTime()));
// sn编码
jpCollector.setSnCode(ksolarStationCollectList.getCollectId());
// 更新时间
jpCollector.setUpdateTime(new Date());
// 第三方电站id
jpCollector.setThirdStationId(ksolarStationCollectList.getThirdStationId());
// 第三方厂商标识
jpCollector.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
//第三方厂商标识
jpCollector.setState(KSolarConstant.collectStaus.get(ksolarStationCollectList.getStatus()));
jpCollector.setStationName(ksolarStationCollectList.getStationName());
jpCollector.setAddr(ksolarStationCollectList.getAddress());
jpCollector.setName(ksolarStationCollectList.getCollectName());
jpCollector.setVersion(ksolarStationCollectList.getCollectVersion());
jpCollector.setType(ksolarStationCollectList.getDeviceModel());
if (ObjectUtils.isEmpty(jpCollector.getSequenceNbr())) {
jpCollectorMapper.insert(jpCollector);
} else {
jpCollectorMapper.updateById(jpCollector);
}
HYGFJPCollectorHistory hygfjpCollectorHistory = new HYGFJPCollectorHistory();
hygfjpCollectorHistory.setTime(System.currentTimeMillis());
hygfjpCollectorHistory.setCreatedTime(System.currentTimeMillis());
hygfjpCollectorHistory.setSnCode(ksolarStationCollectList.getCollectId());
hygfjpCollectorHistory.setSignalStrength(ksolarStationCollectList.getSignal());
hygfjpCollectorHistory.setThirdStationId(ksolarStationCollectList.getThirdStationId());
hygfjpCollectorHistory.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
hygfjpCollectorHistoryMapper.insert(hygfjpCollectorHistory);
}
}
}
}
@Scheduled(cron = dataRequstScheduled)
@Override
public void collectorDetail() {
List<String> collectIds = ksolarStationCollectListMapper.getCollectIds();
if (!CollectionUtils.isEmpty(collectIds)) {
collectIds.forEach(collectId -> {
LambdaQueryWrapper<KsolarStationCollectList> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(KsolarStationCollectList::getCollectId, collectId);
List<KsolarStationCollectList> ksolarStationCollectLists = ksolarStationCollectListMapper.selectList(wrapper);
if (!CollectionUtils.isEmpty(ksolarStationCollectLists)) {
KsolarStationCollectList ksolarStationCollectList = ksolarStationCollectLists.get(0);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
HashMap<String, Object> requestInfo = new HashMap<>(1);
String requestParaminfo = JSON.toJSONString(requestInfo);
String url = KSolarConstant.stationCollectDataUrl + "?collectId=" + ksolarStationCollectList.getCollectId();
List<KsolarStationCollectData> result = kSolarRequestUtil.getResPonse(
url,
KSolarConstant.requestGET,
requestParaminfo,
KSolarConstant.resovle_data,
KsolarStationCollectData.class
);
if (!CollectionUtils.isEmpty(result)) {
result.forEach(ksolarStationCollectData -> {
JpInverter jpInverter = jpInverterMapper.selectOne(new QueryWrapper<JpInverter>().
eq("third_station_id", ksolarStationCollectList.getThirdStationId()).
eq("third_code", PVProducerInfoEnum.KSOLAR.getCode()).
eq("sn_code", ksolarStationCollectData.getInverterId()));
if (ObjectUtils.isEmpty(jpInverter)) {
jpInverter = new JpInverter();
}
// 品牌
// jpInverter.setBrand(inverterDetailDto.getName());
// 国标
// jpInverter.setNationalStandard(inverterDetailDto.getNationalStandards());
// 满发小时数
// jpInverter.setGenerationHours(String.valueOf(inverterDetailDto.getFullHour()));
// 装机容量
// jpInverter.setCapacity(inverterDetailDto.getPower().intValue());
jpInverter.setSnCode(ksolarStationCollectData.getInverterId());
jpInverter.setState(KSolarConstant.collectStaus.get(ksolarStationCollectData.getStatus()));
jpInverter.setCollectorId(ksolarStationCollectList.getCollectId());
jpInverter.setCollectorSnCode(ksolarStationCollectList.getCollectId());
jpInverter.setUpdateTime(new Date());
jpInverter.setCurrentPower(ksolarStationCollectData.getPowerApparent());
jpInverter.setDayPowerGeneration(ksolarStationCollectData.getDayGeneration());
jpInverter.setMonthPowerGeneration(ksolarStationCollectData.getMonthGeneration() * KSolarConstant.kwhToMwh);
jpInverter.setYearPowerGeneration(ksolarStationCollectData.getYearGeneration() * KSolarConstant.kwhToMwh);
jpInverter.setTotalPowerGeneration(ksolarStationCollectData.getTotalGeneration() * KSolarConstant.kwhToMwh);
jpInverter.setModel(ksolarStationCollectData.getDeviceModel());
jpInverter.setVersion(ksolarStationCollectData.getVersion());
jpInverter.setThirdStationId(ksolarStationCollectList.getThirdStationId());
jpInverter.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
jpInverter.setStationName(ksolarStationCollectList.getStationName());
if (!ObjectUtils.isEmpty(jpInverter.getSequenceNbr())) {
jpInverterMapper.updateById(jpInverter);
} else {
jpInverterMapper.insert(jpInverter);
}
String jsonString = JSON.toJSONString(ksolarStationCollectData);
Map<String, Object> hanlderResult = JSON.parseObject(jsonString, Map.class);
for (int k1 = 1; k1 < 13; k1++) {
JpInverterElectricity jpInverterElectricity = jpInverterElectricityMapper.selectOne(new QueryWrapper<JpInverterElectricity>().
eq("sn_code", ksolarStationCollectData.getInverterId()).
eq("type", "直流").
eq("name", "PV" + k1)
);
if (ObjectUtils.isEmpty(jpInverterElectricity)) {
jpInverterElectricity = new JpInverterElectricity();
}
jpInverterElectricity.setInverterId(ksolarStationCollectData.getInverterId());
jpInverterElectricity.setSnCode(ksolarStationCollectData.getInverterId());
jpInverterElectricity.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
jpInverterElectricity.setThirdStationId(ksolarStationCollectList.getThirdStationId());
jpInverterElectricity.setType("直流");
jpInverterElectricity.setName("PV" + k1);
jpInverterElectricity.setVoltage(Double.valueOf(hanlderResult.get("voltagePv" + k1).toString()));
jpInverterElectricity.setCurrent(Double.valueOf(hanlderResult.get("currentPv" + k1).toString()));
jpInverterElectricity.setPower(Double.valueOf(hanlderResult.get("powerPv" + k1).toString()));
if (ObjectUtils.isEmpty(jpInverterElectricity.getSequenceNbr())) {
jpInverterElectricityMapper.insert(jpInverterElectricity);
} else {
jpInverterElectricityMapper.updateById(jpInverterElectricity);
}
}
JpInverterElectricity jpInverterElectricityR = jpInverterElectricityMapper.selectOne(new QueryWrapper<JpInverterElectricity>().
eq("sn_code", ksolarStationCollectData.getInverterId()).
eq("type", "交流").
eq("name", "RS")
);
if (ObjectUtils.isEmpty(jpInverterElectricityR)) {
jpInverterElectricityR = new JpInverterElectricity();
}
jpInverterElectricityR.setInverterId(ksolarStationCollectData.getInverterId());
jpInverterElectricityR.setSnCode(ksolarStationCollectData.getInverterId());
jpInverterElectricityR.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
jpInverterElectricityR.setThirdStationId(ksolarStationCollectList.getThirdStationId());
jpInverterElectricityR.setType("交流");
jpInverterElectricityR.setName("RS");
jpInverterElectricityR.setVoltage(ksolarStationCollectData.getVoltageRs());
jpInverterElectricityR.setCurrent(ksolarStationCollectData.getCurrentR());
if (ObjectUtils.isEmpty(jpInverterElectricityR.getSequenceNbr())) {
jpInverterElectricityMapper.insert(jpInverterElectricityR);
} else {
jpInverterElectricityMapper.updateById(jpInverterElectricityR);
}
JpInverterElectricity jpInverterElectricityS = jpInverterElectricityMapper.selectOne(new QueryWrapper<JpInverterElectricity>().
eq("sn_code", ksolarStationCollectData.getInverterId()).
eq("type", "交流").
eq("name", "ST")
);
if (ObjectUtils.isEmpty(jpInverterElectricityS)) {
jpInverterElectricityS = new JpInverterElectricity();
}
jpInverterElectricityS.setInverterId(ksolarStationCollectData.getInverterId());
jpInverterElectricityS.setSnCode(ksolarStationCollectData.getInverterId());
jpInverterElectricityS.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
jpInverterElectricityS.setThirdStationId(ksolarStationCollectList.getThirdStationId());
jpInverterElectricityS.setType("交流");
jpInverterElectricityS.setName("ST");
jpInverterElectricityS.setVoltage(ksolarStationCollectData.getVoltageSt());
jpInverterElectricityS.setCurrent(ksolarStationCollectData.getCurrents());
if (ObjectUtils.isEmpty(jpInverterElectricityS.getSequenceNbr())) {
jpInverterElectricityMapper.insert(jpInverterElectricityS);
} else {
jpInverterElectricityMapper.updateById(jpInverterElectricityS);
}
JpInverterElectricity jpInverterElectricityT = jpInverterElectricityMapper.selectOne(new QueryWrapper<JpInverterElectricity>().
eq("sn_code", ksolarStationCollectData.getInverterId()).
eq("type", "交流").
eq("name", "TR")
);
if (ObjectUtils.isEmpty(jpInverterElectricityT)) {
jpInverterElectricityT = new JpInverterElectricity();
}
jpInverterElectricityT.setInverterId(ksolarStationCollectData.getInverterId());
jpInverterElectricityT.setSnCode(ksolarStationCollectData.getInverterId());
jpInverterElectricityT.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
jpInverterElectricityT.setThirdStationId(ksolarStationCollectList.getThirdStationId());
jpInverterElectricityT.setType("交流");
jpInverterElectricityT.setName("TR");
jpInverterElectricityT.setVoltage(ksolarStationCollectData.getVoltageTr());
jpInverterElectricityT.setCurrent(ksolarStationCollectData.getCurrentT());
if (ObjectUtils.isEmpty(jpInverterElectricityT.getSequenceNbr())) {
jpInverterElectricityMapper.insert(jpInverterElectricityT);
} else {
jpInverterElectricityMapper.updateById(jpInverterElectricityT);
}
//
HYGFJPInverterElecHistory hygfjpInverterElecHistory = new HYGFJPInverterElecHistory();
hygfjpInverterElecHistory.setThirdStationId(ksolarStationCollectList.getThirdStationId());
hygfjpInverterElecHistory.setCreatedTime(System.currentTimeMillis());
hygfjpInverterElecHistory.setSnCode(ksolarStationCollectData.getInverterId());
hygfjpInverterElecHistory.setUAcCurrent(ksolarStationCollectData.getCurrentR());
hygfjpInverterElecHistory.setVAcCurrent(ksolarStationCollectData.getCurrents());
hygfjpInverterElecHistory.setWAcCurrent(ksolarStationCollectData.getCurrentT());
hygfjpInverterElecHistory.setUAcVoltage(ksolarStationCollectData.getVoltageRs());
hygfjpInverterElecHistory.setVAcVoltage(ksolarStationCollectData.getVoltageSt());
hygfjpInverterElecHistory.setWAcVoltage(ksolarStationCollectData.getVoltageTr());
hygfjpInverterElecHistory.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
hygfjpInverterElecHistory.setTime(System.currentTimeMillis());
hygfjpInverterElecHistoryMapper.insert(hygfjpInverterElecHistory);
// 逆变器历史
String today = DateUtil.today();
HYGFJPInverterHistory hygfjpInverterHistory = hygfjpInverterHistoryMapper.selectOne(
new QueryWrapper<HYGFJPInverterHistory>().eq("sn_code", ksolarStationCollectData.getInverterId()).eq("date", today));
if (ObjectUtils.isEmpty(hygfjpInverterHistory)) {
hygfjpInverterHistory = new HYGFJPInverterHistory();
}
// 满发小时数
// hygfjpInverterHistory.setGenerationHours(inverterDetailDto.getFullHour());
hygfjpInverterHistory.setDate(today);
hygfjpInverterHistory.setThirdStationId(ksolarStationCollectList.getThirdStationId());
hygfjpInverterHistory.setInverterId(ksolarStationCollectData.getInverterId());
hygfjpInverterHistory.setSnCode(ksolarStationCollectData.getInverterId());
hygfjpInverterHistory.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
hygfjpInverterHistory.setPowerGeneration(ksolarStationCollectData.getTotalGeneration());
if (ObjectUtils.isEmpty(hygfjpInverterHistory.getCreatedTime())) {
hygfjpInverterHistory.setCreatedTime(System.currentTimeMillis());
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
} else {
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
}
});
}
}
});
}
// 实时告警
try {
inverAlramInfo();
} catch (ParseException e) {
e.printStackTrace();
}
}
@Override
public void inverterList() {
}
@Override
public void inverterDetail() {
}
private void inverAlramInfo() throws ParseException {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
HashMap<String, Object> requestInfo = new HashMap<>(1);
String requestParaminfo = JSON.toJSONString(requestInfo);
String url = KSolarConstant.stationCollectAlarmUrl + "?pageNumber=1&pageSize=200";
List<KsolarAlarmDto> result = kSolarRequestUtil.getResPonse(
url,
KSolarConstant.requestGET,
requestParaminfo,
KSolarConstant.resovle_rows,
KsolarAlarmDto.class
);
if (!CollectionUtils.isEmpty(result)) {
for (KsolarAlarmDto ksolarAlarmDto : result) {
if (!ObjectUtils.isEmpty(ksolarAlarmDto.getInverterId())) {
String startTime = ksolarAlarmDto.getSaveTime();
String recoverTime = ksolarAlarmDto.getRemoveTime();
String pattern = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
Date startTimeL = sdf.parse(startTime);
Date recoverTimeL = sdf.parse(recoverTime);
HYGFJPInverterWarn hygfjpInverterWarn = hygfjpInverterWarnMapper.selectOne(new QueryWrapper<HYGFJPInverterWarn>()
.eq("sn_code", ksolarAlarmDto.getAlarmId())
.eq("start_time", startTimeL.getTime())
.eq("third_code", PVProducerInfoEnum.KSOLAR.getCode())
.eq("third_station_id", ksolarAlarmDto.getStationId())
);
if (ObjectUtils.isEmpty(hygfjpInverterWarn)) {
hygfjpInverterWarn = new HYGFJPInverterWarn();
}
hygfjpInverterWarn.setTime(System.currentTimeMillis());
hygfjpInverterWarn.setTimeLong(System.currentTimeMillis());
hygfjpInverterWarn.setSnCode(ksolarAlarmDto.getAlarmId());
hygfjpInverterWarn.setThirdStationId(ksolarAlarmDto.getStationId());
hygfjpInverterWarn.setLevel(KSolarConstant.alarmLevel.get(ksolarAlarmDto.getLevels()));
hygfjpInverterWarn.setContent(ksolarAlarmDto.getMessage());
hygfjpInverterWarn.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
hygfjpInverterWarn.setTreatment(ksolarAlarmDto.getSolution());
hygfjpInverterWarn.setStartTime(startTimeL.getTime());
hygfjpInverterWarn.setRecoverTime(recoverTimeL.getTime());
hygfjpInverterWarn.setState(KSolarConstant.alarmstatus.get(ksolarAlarmDto.getStatus()));
if (ObjectUtils.isEmpty(hygfjpInverterWarn.getCreatedTime())) {
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis());
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
} else {
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
}
}
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/jpush.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="org.mybatis" level="DEBUG" />
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="ERROR">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ 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