Commit 5df79d19 authored by tangwei's avatar tangwei

解决冲突

parents b20197e3 78b6a712
package com.yeejoin.amos.api.householdapi.constant;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
/**
* 固德威常量
......@@ -16,6 +18,151 @@ public class GoodWeConstant {
put("2", "停机");
}
};
public static final HashMap<String, String> warningStaus = new HashMap<String, String>() {
{
put("0", "未处理");
put("1", "已处理");
}
};
public static final HashMap<String, String> taskStaus = new HashMap<String, String>() {
{
put("1", "已派送");
put("2", "未派送");
}
};
public static final HashMap<String, List<String>> errorCodeMap = new HashMap<String, List<String>>() {
{
put("E0", Arrays.asList("漏电流自检异常",
"1.受外部因素(如受 磁场影响等)引起的暂时性现象|2.机器内部元器件出现故障",
"1.尝试重启机器,看机器是否仍然报错, 如果机器恢复正常,说明该报错只是偶然性事件,不会影响系统正常运行|2. 如果重启机器无法恢复正常,请联系售后服务"));
put("E1", Arrays.asList("交流电流自检异常",
"1.受外部因素(如受 磁场影响等)引起的暂时性现象|2.机器内部元器件出现故障",
"1.尝试重启机器,看机器是否仍然报错, 如果机器恢复正常,说明该报错只是偶然性事件,不会影响系统正常运行|2. 如果重启机器无法恢复正常,请联系售后服务"));
put("E2", Arrays.asList("采样基准电压异常",
"1.受外部因素(如受 磁场影响等)引起的暂时性现象|2.控制板有问题",
"1.尝试重启机器,看机器是否仍然报错, 如果机器恢复正常,说明该报错只是偶然性事件,不会影响系统正常运行|2. 如果重启机器无法恢复正常,请联系售后服务"));
put("E3", Arrays.asList("直流分量校验异常",
"1.受外部因素(如受 磁场影响等)引起的暂时性现象|2.控制板有问题",
"1.尝试重启机器,看机器是否仍然报错, 如果机器恢复正常,说明该报错只是偶然性事件,不会影响系统正常运行|2. 如果重启机器无法恢复正常,请联系售后服务"));
put("E4", Arrays.asList("漏电流校验异常",
"1.受外部因素(如受 磁场影响等)引起的暂时性现象|2.机器内部元器件出现故障",
"1.尝试重启机器,看机器是否仍然报错, 如果机器恢复正常,说明该报错只是偶然性事件,不会影响系统正常运行|2. 如果重启机器无法恢复正常,请联系售后服务"));
put("E5", Arrays.asList("未知类型",
"1.请联系售后",
"1.请联系售后"));
put("E6", Arrays.asList("漏电流传感器故障",
"1.受外部因素(如受 磁场影响等)引起的暂时性现象|2.控制板有问题",
"1.尝试重启机器,看机器是否仍然报错, 如果机器恢复正常,说明该报错只是偶然性事件,不会影响系统正常运行|2. 如果重启机器无法恢复正常,请联系售后服务"));
put("E7", Arrays.asList("继电器故障",
"1.受外部因素(如受 磁场影响等)引起的暂时性现象|2.控制板有问题",
"1.尝试重启机器,看机器是否仍然报错, 如果机器恢复正常,说明该报错只是偶然性事件,不会影响系统正常运行|2. 如果重启机器无法恢复正常,请联系售后服务"));
put("E8", Arrays.asList("交流传感器故障",
"1.受外部因素(如受 磁场影响等)引起的暂时性现象|2.控制板有问题",
"1.尝试重启机器,看机器是否仍然报错, 如果机器恢复正常,说明该报错只是偶然性事件,不会影响系统正常运行|2. 如果重启机器无法恢复正常,请联系售后服务"));
put("E9", Arrays.asList("电网丢失故障",
"1.电网停电 |2.机器 AC 端接线异常|3.AC 开关连接异常或开关损坏|4.AC 端未连接",
"1.确定电网是否停电|2.利用万用表测量机器AC 端是否有电压|3.检查 AC 开关是否损坏|4.确认AC 端接线是否有误 (零火线是否接反)|5.确认电网连接正常,确保 AC 开关闭合|6.尝试g关闭机器DC/AC 端,5 分钟之后重新连接 DC/AC 端"));
put("E10", Arrays.asList("漏电流高故障",
"1.交流测零地线接 线有误|2.报错发生在早晚或阴雨天气,空气湿度相对较高,也有可能引起报错",
"用万用变测量机器外壳对地是否有电压,若有电压说明 AC 端地线接线有问题"));
put("E11", Arrays.asList("直流母线过高故障",
"1.光伏组串电压超过机器最大直流输入电压|2.机器控制板有问题",
"1.用万用表测量DC 端实际电压,看是否超过机器正常电压范围|2.如果 DC 电压超高,建议减少每个组串组件的数量,确保组串电压在机器最大直流输入电压范围内"));
put("E12", Arrays.asList("内部风扇故障",
"1.外部风扇设备被异物阻塞|2.风扇内部接线有异常",
"1.尝试重启机器,看机器是否仍然报错, 如果机器恢复正常,说明该报错只是偶然性事件,不会影响系统正常运行|2. 如果重启机器无法恢复正常,请联系售后服务"));
put("E13", Arrays.asList("机器温度过高故障",
"1.机器长时间在高温环境下运行|2.机器安装环境不利于机器散热(如比较封闭的环境等)",
"1. 设法降低机器周围的温度|2.检查机器安装是否满足产品用户手册要求|3. 尝试关闭机器,15 分钟后再重新打开"));
put("E14", Arrays.asList("漏电流自检超时",
"机器自检时GFCI 值偏高导致",
"1.尝试重新启动机器,查看是否正常|2.可能需要升级机器软件版本解决问题"));
put("E15", Arrays.asList("面板电压过高故障",
"PV 组串电压(开路电压)超出逆变器最大直流输入电压",
"1.用万用表测量DC 端实际电压,看是否超过机器正常电压范围|2.如果 DC 电压超高,建议减少每个组串组件的数量,确保组串电压在机器最大直流输入电压范围内"));
put("E16", Arrays.asList("外部风扇故障",
"1.外部风扇设备被异物阻塞|2.风扇内部接线有异常",
"请检查风扇内部是否有异物阻塞"));
put("E17", Arrays.asList("电网电压异常",
"1.安规设置错误|2.市电电压不稳定|3.交流线线径小,或者交流线较长导致交流线阻值较高,压降较高|4.交流线接线有误,导致交流端电压异常",
"1.检查机器安规设置是否正确,如不正确,请关闭交流电,更改安规后再连接交流电|2. 如果安规设置正确,请用万用表测量交流测每项火线对零线的电压值是否超出正常范围|3.确认机器安装地区市电电压是否有不稳定情况"));
put("E18", Arrays.asList("面板绝缘阻抗低故障",
"1. 光伏面板接地线未连接或连接有误|2.直流线破损|3.交流端零、地线接线有误|4.报错发生在早晚或阴雨天气,空气湿度相对较高,易引发ISO 报错",
"1.依次插拔每串组件,确定引发报错的组串|2.检查直流线是否有破|3. 利用万用表测量AC 端零地线之间的电压是否过高(一般不超过 10V), 如超过 10V, 则说明零地线接线异常|4.检查组件接地线是否有异常,确保每串组件接地线能够接触到大地"));
put("E19", Arrays.asList("输出直流分量过高",
"机器检测到内部直流输入分量超出正常范围",
"请联系售后服务"));
put("E20", Arrays.asList("LCD 通讯故障",
"1.内部LCD 数据线松动.",
"请联系售后服务"));
put("E21", Arrays.asList("组串过流",
"某一组串电流过大",
"请检查组串连接情况"));
put("E22", Arrays.asList("主从频率校验异常",
"1.受外部因素(如受 磁场影响等)引起的暂时性现象|2.控制板有问题",
"1.尝试重启机器,看机器是否仍然报错, 如果机器恢复正常,说明该报错只是偶然性事件,不会影响系统正常运行|2. 如果重启机器无法恢复正常,请联系售后服务"));
put("E23", Arrays.asList("主从电压校验异常",
"1.受外部因素(如受 磁场影响等)引起的暂时性现象|2.控制板有问题",
"1.尝试重启机器,看机器是否仍然报错, 如果机器恢复正常,说明该报错只是偶然性事件,不会影响系统正常运行|2. 如果重启机器无法恢复正常,请联系售后服务"));
put("E24", Arrays.asList("未知类型",
"请联系售后",
"请联系售后服务"));
put("E25", Arrays.asList("继电器自检异常",
"1.三相机控制板和功率版之间的排线松动|2.交流端零、地线接线有误|3.机器控制板问题",
"1.利用万用表测量AC 端零地线之间的电压是否过高(一般不超过10V),如超过 10V, 则说明零地线接线异常|2. 尝试重启机器,看是否机器可回复正常工作"));
put("E26", Arrays.asList("电池授权错误",
"连接该逆变器的电池功能未激活",
"请先购买电池激活码并在 PV Master 中激活电池功能,然后连接电池使用该功能"));
put("E27", Arrays.asList("未知类型",
"1.请联系售后",
"1.请联系售后服务"));
put("E28", Arrays.asList("未知类型",
"1.请联系售后",
"1.请联系售后服务"));
put("E29", Arrays.asList("电网频率异常",
"1.安规设置错误|2.电网频率不稳定",
"1.检查机器安规设置是否正确,如不正确,请关闭交流电,更改安规后再连接交流电 |2.如果机器安规设置正确,请在机器页面查看是否电网频率(Fac)超出正常范围|3.如果“电网频率限”报错只是偶尔出现,并很快恢复正常,则说明报错是因为电网频率偶尔的不稳定造成的, 对系统正常运行不会影响"));
put("E30", Arrays.asList("内部存储故障",
"1.受外部因素(如受 磁场影响等)引起的暂时性现象|2.机器内部元器件损",
"1.尝试重启机器,看机器是否仍然报错, 如果机器恢复正常,说明该报错只是偶然性事件,不会影响系统正常运行|2. 如果重启机器无法恢复正常,请联系售后服务"));
put("E31", Arrays.asList("内部通讯故障",
"1.受外部因素(如受 磁场影响等)引起的暂时性现象|2.控制板有问题",
"1.尝试重启机器,看机器是否仍然报错, 如果机器恢复正常,说明该报错只是偶然性事件,不会影响系统正常运行|2. 如果重启机器无法恢复正常,请联系售后服务"));
}
};
public static String baseurl = "http://openapi.sems.com.cn";
public static String account = "18679135705";
......@@ -25,11 +172,14 @@ public class GoodWeConstant {
public static String stationListUrl = "/api/OpenApi/GetUserPowerStation";
public static String stationListStatusUrl = "/api/OpenApi/QueryPowerStationMonitor";
public static String stationDetailUrl = "/api/OpenApi/GetPowerStationMonitorDetail";
public static String stationGenUrl = "/api/OpenApi/GetPowerStationPower";
public static String collectorListUrl = "/v1/api/collectorList";
public static String collectorDetailUrl = "/v1/api/collectorDetail";
public static String inverterListUrl = "/v1/api/inverterList";
public static String queryInventerUrl = "/api/OpenApi/QueryInventers";
public static String getInventersDatas = "/api/OpenApi/GetInventersDatas";
public static String getinverterGenURl = "/api/OpenApi/GetInverterPower";
public static String inverterDetailUrl = "/v1/api/inverterDetail";
public static String alarmListUrl = "/v1/api/alarmList";
public static String alarmListUrl = "/api/OpenApi/GetPowerStationWariningInfoByMultiCondition";
public static String stationDayGenUrl ="/v1/api/stationDayEnergyList";
public static String stationMonthEnergyList ="/v1/api/stationDayEnergyList";
public static String stationYearEnergyList ="/v1/api/stationDayEnergyList";
......@@ -46,4 +196,5 @@ public class GoodWeConstant {
public static DateTimeFormatter formatter = DateTimeFormatter.ofPattern(datePattern);
public static Double kwhToMwh = 0.0001;
public static Double mwhTokwh = 1000.0;
public static Double wToKw = 0.001;
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.api.householdapi.controller;
import com.yeejoin.amos.api.householdapi.Utils.GoodWeRequestUtil;
import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
import com.yeejoin.amos.api.householdapi.face.dto.GoodWEGenStation;
import com.yeejoin.amos.api.householdapi.face.service.*;
import com.yeejoin.amos.api.householdapi.face.service.impl.ImasterDataServiceImpl;
import com.yeejoin.amos.api.householdapi.face.service.impl.SofarDataAcquisitionServiceImpl;
......@@ -52,7 +53,15 @@ public class HouseholdTestController {
@ApiOperation(httpMethod = "POST", value = "固德威示例", notes = "固德威示例")
public void goodweDemo() throws IOException {
// goodWeDataAcquisitionService.stationList();
goodWeDataAcquisitionService.stationDetail();
// goodWeDataAcquisitionService.stationDetail();
// goodWeDataAcquisitionService.inverAlramInfo();
// goodWeDataAcquisitionService.inverterList();
// goodWeDataAcquisitionService.inverterDetail();
// goodWeDataAcquisitionService.stationMonthGen();
// goodWeDataAcquisitionService.stationYearGen();
// goodWeDataAcquisitionService.inverterDetail();
goodWeDataAcquisitionService.inverterMonthGen();
goodWeDataAcquisitionService.inverterYearGen();
}
/**
......
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
// 固德威实时数据
@Data
public class D {
public double vpv3;
public double vpv2;
public double vpv1;
public double fac3;
public double fac2;
public double fac1;
public double vpv4;
public double ipv2;
public double pac;
public double ipv1;
public double ipv4;
public double ipv3;
public double eDay;
public double vac3;
public String creationDate;
public double istr9;
public double vac2;
public double istr8;
public double vac1;
public double istr5;
public double istr10;
public double istr4;
public double eTotal;
public double istr7;
public double istr6;
public double istr1;
public double iac2;
public double istr3;
public double iac1;
public double hTotal;
public double istr2;
public double iac3;
public double istr16;
public double istr15;
public double istr14;
public double istr13;
public double istr12;
public double istr11;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
@Data
public class GoodWEGenStation {
private String date;
private String power;
private String income;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
import org.joda.time.DateTime;
@Data
public class GoodWeAlarmDto {
// stationId string 电站 ID
// adcode string 区域编码
// stationname string 电站名称
// devicesn string 设备 SN
// warningid string 告警 id
// warningname string 告警名称
// status int 状态 1:已处理 0:未处理
// happentime Datetime? 发生时间
// recoverytime Datetime? 恢复时间
// is_add_task Int 是否派送 1:已派送 2:未派送
// error_code string 错误编码-详细参考 3.3 告警错误
private String stationId;
private String adcode;
private String stationname;
private String devicesn;
private String warningid;
private String warningname;
private Integer status;
private DateTime happentime;
private DateTime recoverytime;
private Integer is_add_task;
private String error_code;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
@Data
public class GoodWeINverterDetailDto {
private String id;
private String pw_id;
private String it_name;
private String it_sn;
private String it_type;
private Double it_capacity;
private Double it_checkcode;
private String conn_date;
private Boolean it_change_flag;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
@Data
public class GoodWeInverterCurrentDataDto {
public int error_original;
public D d;
public double out_pac;
public String type;
public double etotal;
public double capacity;
public double tempperature;
public String turnon_time;
public String check_code;
public String name;
public double eday;
public boolean it_change_flag;
public String sn;
public double in_pac;
public int status;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
@Data
public class GoodWeStationMonitorDto {
private String powerstation_id;
private String stationname;
private String first_letter;
private String adcode;
private String location;
private Integer status;
private Double pac;
private Double capacity;
private Double eday;
private Double emonth;
private Double eday_income;
private Double etotal;
private Double etotal_income;
private String powerstation_type;
private String pre_org_id;
private String org_id;
private String longitude;
private String latitude;
private Double pac_kw;
private Double to_hour;
private String currency;
private Double yield_rate;
}
......@@ -35,7 +35,15 @@ public class GoodWeStationDetail {
private Double pac;
@TableField("eday")
private Double eday;
@TableField(exist = false)
private Double emonth;
@TableField(exist = false)
private Double eday_income;
@TableField("etotal")
private Double etotal;
@TableField(exist = false)
private Double etotal_income;
@TableField(exist = false)
private Double yield_rate;
}
......@@ -25,8 +25,14 @@ public class GoodWeStationMonitorList {
private Double capacity;
@TableField("eday")
private Double eday;
@TableField(exist = false)
private Double eday_income;
@TableField("etotal")
private Double etotal;
@TableField(exist = false)
private Double emonth;
@TableField(exist = false)
private Double etotal_income;
@TableField("powerstation_type")
private String powerstation_type;
@TableField("longitude")
......@@ -37,4 +43,17 @@ public class GoodWeStationMonitorList {
private Double pac_kw;
@TableField("to_hour")
private Double to_hour;
@TableField(exist = false)
private Double currency;
@TableField(exist = false)
private Double yield_rate;
@TableField("address")
private String address;
@TableField("owner_name")
private String owner_name;
@TableField("owner_phone")
private String owner_phone;
@TableField("turnon_time")
private String turnon_time;
}
......@@ -4,7 +4,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverter;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface JpInverterMapper extends BaseMapper<JpInverter> {
@Select("SELECT sum(current_power) FROM hygf_jp_inverter WHERE third_code='HW'")
Double getHuaWeiStationCurrentPower();
@Select("select sn_code from hygf_jp_inverter where third_code='GOODWE'")
List<String> getGoodWeSnCodes();
}
......@@ -9,6 +9,9 @@ public interface GoodWeDataAcquisitionService {
* @descrption 场站详情数据入库
*/
void stationDetail();
void stationMonthGen();
void stationYearGen();
/**
* @descrption 采集器列表数据入库
*/
......@@ -25,6 +28,10 @@ public interface GoodWeDataAcquisitionService {
* @descrption 逆变器详情数据入库
*/
void inverterDetail();
void inverterMonthGen();
void inverterYearGen();
/**
* @descrption 采集器告警列表数据入库
*/
......
package com.yeejoin.amos.api.householdapi.face.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.google.common.collect.Lists;
import com.qiniu.util.Json;
import com.yeejoin.amos.api.householdapi.Utils.GoodWeRequestUtil;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
import com.yeejoin.amos.api.householdapi.constant.GoodWeConstant;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.GoodWeStationDetail;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.GoodWeStationMonitorList;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.GoodWeStationDetailMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.GoodWeStationMonitorListMapper;
import com.yeejoin.amos.api.householdapi.face.dto.*;
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.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.GoodWeDataAcquisitionService;
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.server.Jsp;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionService {
@Autowired
......@@ -21,6 +41,45 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
GoodWeStationMonitorListMapper goodWeStationMonitorListMapper;
@Autowired
GoodWeStationDetailMapper goodWeStationDetailMapper;
@Autowired
JpStationMapper jpStationMapper;
@Autowired
private JpInverterMapper jpInverterMapper;
@Autowired
private HYGFJPStationPowerHistoryMapper hygfjpStationPowerHistoryMapper;
//户用光伏逆变器历史mapper
@Autowired
private HYGFJPInverterHistoryMapper hygfjpInverterHistoryMapper;
//户用光伏采集器历史mapper
@Autowired
private HYGFJPCollectorHistoryMapper hygfjpCollectorHistoryMapper;
//户用光伏逆变器告警
@Autowired
private HYGFJPInverterWarnMapper hygfjpInverterWarnMapper;
//户用光伏逆变器历史mapper
@Autowired
private HYGFJPInverterElecHistoryMapper hygfjpInverterElecHistoryMapper;
//户用光伏日发电量
@Autowired
private JpInverterElectricityMapper jpInverterElectricityMapper;
@Autowired
private TdHYGFInverterDayGenerateMapper tdHYGFInverterDayGenerateMapper;
@Autowired
private TdHYGFInverterMonthGenerateMapper tdHYGFInverterMonthGenerateMapper;
@Autowired
private TdHYGFInverterYearGenerateMapper tdHYGFInverterYearGenerateMapper;
@Autowired
private HYGFJPDayPowerMapper hygfjpDayPowerMapper;
@Autowired
private TdHYGFStationDayGenerateMapper tdHYGFStationDayGenerateMapper;
@Autowired
private TdHYGFStationMonthGenerateMapper tdHYGFStationMonthGenerateMapper;
@Autowired
private TdHYGFStationYearGenerateMapper tdHYGFStationYearGenerateMapper;
@Autowired
private TdHYGFInverterTotalGenerateMapper tdHYGFInverterTotalGenerateMapper;
@Override
public void stationList() {
......@@ -28,11 +87,137 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
requestInfo.put("page_index", 1);
requestInfo.put("page_size", 200);
String requstParam = JSON.toJSONString(requestInfo);
List<GoodWeStationMonitorList> goodWeStationLists =goodWeRequestUtil.getResPonse(GoodWeConstant.stationListStatusUrl, GoodWeConstant.requestPost, requstParam, GoodWeConstant.resovleRule_data_list, GoodWeStationMonitorList.class);
if(goodWeStationLists.size()>0){
goodWeStationLists.forEach(goodWeStationList -> {
String today = DateUtil.today();
String hour = new Date().getHours() + ":00";
List<GoodWeStationMonitorDto> goodWeStationLists = goodWeRequestUtil.getResPonse(GoodWeConstant.stationListStatusUrl, GoodWeConstant.requestPost, requstParam, GoodWeConstant.resovleRule_data_list, GoodWeStationMonitorDto.class);
if (goodWeStationLists.size() > 0) {
goodWeStationLists.forEach(goodWeStationMonitorDto -> {
GoodWeStationMonitorList goodWeStationList = new GoodWeStationMonitorList();
BeanUtil.copyProperties(goodWeStationMonitorDto, goodWeStationList);
goodWeStationList.setCreatedTime(System.currentTimeMillis());
goodWeStationMonitorListMapper.insert(goodWeStationList);
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().eq("third_code", PVProducerInfoEnum.GDW.getCode()).eq("third_station_id", goodWeStationList.getPowerstation_id()));
if (ObjectUtils.isEmpty(jpStation)) {
jpStation = new JpStation();
}
jpStation.setThirdStationId(goodWeStationList.getPowerstation_id());
jpStation.setThirdCode(PVProducerInfoEnum.GDW.getCode());
jpStation.setSnCode(goodWeStationList.getPowerstation_id());
jpStation.setCapacity(goodWeStationList.getCapacity());
jpStation.setName(goodWeStationList.getStationname());
jpStation.setPrice(0.42);
jpStation.setAddress(goodWeStationList.getAddress());
jpStation.setLatitude(goodWeStationList.getLatitude());
jpStation.setLongitude(goodWeStationList.getLongitude());
jpStation.setUserName(goodWeStationList.getOwner_name());
jpStation.setUserPhone(goodWeStationList.getOwner_phone());
jpStation.setStationContact(goodWeStationList.getOwner_name());
jpStation.setModuleCount(0);
jpStation.setRealTimePower(goodWeStationList.getPac() * GoodWeConstant.wToKw);
jpStation.setState(GoodWeConstant.stationStaus.get(goodWeStationList.getStatus()));
jpStation.setDayGenerate(goodWeStationList.getEday());
jpStation.setDayIncome(goodWeStationList.getEday_income());
jpStation.setAccumulatedPower(goodWeStationList.getEtotal());
jpStation.setCumulativeIncome(goodWeStationList.getEtotal_income());
if (ObjectUtils.isEmpty(jpStation.getSequenceNbr())) {
jpStation.setCreateTime(new Date(goodWeStationList.getCreatedTime()));
if (ObjectUtils.isNotEmpty(goodWeStationList.getTurnon_time())) {
jpStation.setAccessTime(new Date(goodWeStationList.getTurnon_time()));
}
jpStationMapper.insert(jpStation);
} else {
jpStationMapper.updateById(jpStation);
}
HYGFJPStationPowerHistory hygfjpStationPowerHistory = new HYGFJPStationPowerHistory();
hygfjpStationPowerHistory.setCreatedTime(System.currentTimeMillis());
hygfjpStationPowerHistory.setThirdStationId(jpStation.getThirdStationId());
hygfjpStationPowerHistory.setPower(jpStation.getRealTimePower());
hygfjpStationPowerHistory.setThirdCode(jpStation.getThirdCode());
hygfjpStationPowerHistory.setTime(System.currentTimeMillis());
hygfjpStationPowerHistoryMapper.insert(hygfjpStationPowerHistory);
HYGFJPDayPower hygfjpDayPower = hygfjpDayPowerMapper.selectOne(
new QueryWrapper<HYGFJPDayPower>().
eq("tation_id", jpStation.getThirdStationId()).
eq("year_month_day", today).
eq("hour", hour)
);
if (org.springframework.util.ObjectUtils.isEmpty(hygfjpDayPower)) {
hygfjpDayPower = new HYGFJPDayPower();
}
hygfjpDayPower.setTationId(goodWeStationList.getPowerstation_id());
hygfjpDayPower.setHour(hour);
hygfjpDayPower.setYearMonthDay(today);
hygfjpDayPower.setPower(jpStation.getRealTimePower());
if (org.springframework.util.ObjectUtils.isEmpty(hygfjpDayPower.getCreatedTime())) {
hygfjpDayPower.setCreatedTime(System.currentTimeMillis());
hygfjpDayPowerMapper.insert(hygfjpDayPower);
} else {
hygfjpDayPowerMapper.insert(hygfjpDayPower);
}
Date today1 = new Date();
//户用场站日发电量
TdHYGFStationDayGenerate tdHYGFStationDayGenerate = tdHYGFStationDayGenerateMapper.selectOne(new QueryWrapper<TdHYGFStationDayGenerate>()
.eq("third_station_id", jpStation.getThirdStationId())
.eq("day_time", DateUtil.format(today1, "yyyy-MM-dd"))
.eq("year_month", DateUtil.format(today1, "yyyy-MM")));
if (org.springframework.util.ObjectUtils.isEmpty(tdHYGFStationDayGenerate)) {
tdHYGFStationDayGenerate = new TdHYGFStationDayGenerate();
}
tdHYGFStationDayGenerate.setThirdStationId(jpStation.getThirdStationId());
tdHYGFStationDayGenerate.setDayTime(DateUtil.format(today1, "yyyy-MM-dd"));
tdHYGFStationDayGenerate.setYearMonth(DateUtil.format(today1, "yyyy-MM"));
tdHYGFStationDayGenerate.setGenerate(jpStation.getDayGenerate());
tdHYGFStationDayGenerate.setFullhour(goodWeStationList.getTo_hour());
tdHYGFStationDayGenerate.setIncome(jpStation.getDayIncome());
if (org.springframework.util.ObjectUtils.isEmpty(tdHYGFStationDayGenerate.getCreatedTime())) {
tdHYGFStationDayGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFStationDayGenerateMapper.insert(tdHYGFStationDayGenerate);
} else {
tdHYGFStationDayGenerateMapper.insert(tdHYGFStationDayGenerate);
}
//户用场站月发电量
TdHYGFStationMonthGenerate tdHYGFStationMonthGenerate = tdHYGFStationMonthGenerateMapper.selectOne(new QueryWrapper<TdHYGFStationMonthGenerate>()
.eq("third_station_id", jpStation.getThirdStationId())
.eq("month_time", DateUtil.format(today1, "yyyy-MM"))
.eq("year", DateUtil.format(today1, "yyyy")));
if (org.springframework.util.ObjectUtils.isEmpty(tdHYGFStationMonthGenerate)) {
tdHYGFStationMonthGenerate = new TdHYGFStationMonthGenerate();
}
tdHYGFStationMonthGenerate.setThirdStationId(jpStation.getThirdStationId());
tdHYGFStationMonthGenerate.setMonthTime(DateUtil.format(today1, "yyyy-MM"));
tdHYGFStationMonthGenerate.setYear(DateUtil.format(today1, "yyyy"));
tdHYGFStationMonthGenerate.setGenerate(jpStation.getMonthGenerate());
if (ObjectUtils.isNotEmpty(jpStation.getMonthGenerate())) {
tdHYGFStationMonthGenerate.setFullhour(jpStation.getMonthGenerate() / jpStation.getCapacity());
}
tdHYGFStationMonthGenerate.setIncome(jpStation.getMonthIncome());
if (org.springframework.util.ObjectUtils.isEmpty(tdHYGFStationMonthGenerate.getCreatedTime())) {
tdHYGFStationMonthGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFStationMonthGenerateMapper.insert(tdHYGFStationMonthGenerate);
} else {
tdHYGFStationMonthGenerateMapper.insert(tdHYGFStationMonthGenerate);
}
//户用场站年发电量
TdHYGFStationYearGenerate tdHYGFStationYearGenerate = tdHYGFStationYearGenerateMapper.selectOne(new QueryWrapper<TdHYGFStationYearGenerate>()
.eq("third_station_id", jpStation.getThirdStationId())
.eq("year_time", DateUtil.format(today1, "yyyy"))
.eq("year", DateUtil.format(today1, "yyyy")));
if (org.springframework.util.ObjectUtils.isEmpty(tdHYGFStationYearGenerate)) {
tdHYGFStationYearGenerate = new TdHYGFStationYearGenerate();
}
tdHYGFStationYearGenerate.setThirdStationId(jpStation.getThirdStationId());
tdHYGFStationYearGenerate.setYearTime(DateUtil.format(today1, "yyyy"));
tdHYGFStationYearGenerate.setYear(DateUtil.format(today1, "yyyy"));
tdHYGFStationYearGenerate.setGenerate(jpStation.getYearGenerate());
tdHYGFStationYearGenerate.setFullhour(jpStation.getYearGenerate() / jpStation.getCapacity());
tdHYGFStationYearGenerate.setIncome(jpStation.getYearIncome());
if (org.springframework.util.ObjectUtils.isEmpty(tdHYGFStationYearGenerate.getCreatedTime())) {
tdHYGFStationYearGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFStationYearGenerateMapper.insert(tdHYGFStationYearGenerate);
} else {
tdHYGFStationYearGenerateMapper.insert(tdHYGFStationYearGenerate);
}
});
}
}
......@@ -40,23 +225,81 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
@Override
public void stationDetail() {
List<String> stationIds = goodWeStationMonitorListMapper.getStationIds();
stationIds.forEach(stationId ->{
stationIds.forEach(stationId -> {
HashMap<String, Object> requestInfo = new HashMap<>();
String requstParam = JSON.toJSONString(requestInfo);
String apiurl = GoodWeConstant.stationDetailUrl+"?id="+stationId;
List<GoodWeStationDetail> goodWeStationDetails =goodWeRequestUtil.getResPonse(apiurl, GoodWeConstant.requestGet, requstParam, GoodWeConstant.resovleRule_data, GoodWeStationDetail.class);
if(goodWeStationDetails.size()>0){
String apiurl = GoodWeConstant.stationDetailUrl + "?id=" + stationId;
List<GoodWeStationDetail> goodWeStationDetails = goodWeRequestUtil.getResPonse(apiurl, GoodWeConstant.requestGet, requstParam, GoodWeConstant.resovleRule_data, GoodWeStationDetail.class);
if (goodWeStationDetails.size() > 0) {
goodWeStationDetails.forEach(goodWeStationDetail -> {
goodWeStationDetail.setCreatedTime(System.currentTimeMillis());
goodWeStationDetailMapper.insert(goodWeStationDetail);
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().eq("third_code", PVProducerInfoEnum.GDW.getCode()).eq("third_station_id", goodWeStationDetail.getPowerstation_id()));
if (ObjectUtils.isEmpty(jpStation)) {
jpStation = new JpStation();
}
jpStation.setUserName(goodWeStationDetail.getOwner_name());
jpStation.setUserPhone(goodWeStationDetail.getOwner_phone());
jpStation.setStationContact(goodWeStationDetail.getOwner_name());
jpStation.setAccessTime(DateUtil.parse(goodWeStationDetail.getTurnon_time(), DatePattern.NORM_DATETIME_PATTERN));
if (!ObjectUtils.isEmpty(jpStation.getSequenceNbr())) {
jpStationMapper.updateById(jpStation);
}
});
}
});
}
@Override
public void stationMonthGen() {
List<String> stationIds = goodWeStationMonitorListMapper.getStationIds();
stationIds.forEach(stationId -> {
String currentMonth = DateUtil.format(new Date(), "yyyyMM");
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("id", stationId);
requestInfo.put("date", DateUtil.today());
requestInfo.put("count", 0);
requestInfo.put("type", 1);
String requstParam = JSON.toJSONString(requestInfo);
List<GoodWEGenStation> goodWEGenStations = goodWeRequestUtil.getResPonse(GoodWeConstant.stationGenUrl, GoodWeConstant.requestPost, requstParam, GoodWeConstant.resovleRule_data, GoodWEGenStation.class);
List<GoodWEGenStation> currentMonthGenStations = goodWEGenStations.stream().filter(goodWEGenStation -> goodWEGenStation.getDate().equals(currentMonth)).collect(Collectors.toList());
currentMonthGenStations.forEach(goodWEGenStation -> {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().eq("third_code", PVProducerInfoEnum.GDW.getCode()).eq("third_station_id", stationId));
if (ObjectUtils.isNotEmpty(jpStation)) {
jpStation.setMonthGenerate(Double.parseDouble(goodWEGenStation.getPower()));
jpStation.setMonthIncome(jpStation.getMonthGenerate() * 0.42);
jpStationMapper.updateById(jpStation);
}
});
});
}
@Override
public void stationYearGen() {
List<String> stationIds = goodWeStationMonitorListMapper.getStationIds();
stationIds.forEach(stationId -> {
String currentYear = DateUtil.format(new Date(), "yyyy");
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("id", stationId);
requestInfo.put("date", DateUtil.today());
requestInfo.put("count", 0);
requestInfo.put("type", 2);
String requstParam = JSON.toJSONString(requestInfo);
List<GoodWEGenStation> goodWEGenStations = goodWeRequestUtil.getResPonse(GoodWeConstant.stationGenUrl, GoodWeConstant.requestPost, requstParam, GoodWeConstant.resovleRule_data, GoodWEGenStation.class);
List<GoodWEGenStation> currentMonthGenStations = goodWEGenStations.stream().filter(goodWEGenStation -> goodWEGenStation.getDate().equals(currentYear)).collect(Collectors.toList());
currentMonthGenStations.forEach(goodWEGenStation -> {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().eq("third_code", PVProducerInfoEnum.GDW.getCode()).eq("third_station_id", stationId));
if (ObjectUtils.isNotEmpty(jpStation)) {
jpStation.setYearGenerate(Double.parseDouble(goodWEGenStation.getPower()));
jpStation.setYearIncome(jpStation.getYearGenerate() * 0.42);
jpStationMapper.updateById(jpStation);
}
});
});
}
@Override
public void collectorList() {
......@@ -69,16 +312,364 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
@Override
public void inverterList() {
List<String> stationIds = goodWeStationMonitorListMapper.getStationIds();
stationIds.stream().forEach(stationId -> {
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("page_index", 1);
requestInfo.put("page_size", 100);
requestInfo.put("pw_id", stationId);
String requstParam = JSON.toJSONString(requestInfo);
List<GoodWeINverterDetailDto> inverterDetailDtoList = goodWeRequestUtil.getResPonse(GoodWeConstant.queryInventerUrl
, GoodWeConstant.requestPost, requstParam, GoodWeConstant.resovleRule_data_list, GoodWeINverterDetailDto.class);
inverterDetailDtoList.forEach(goodWeINverterDetailDto -> {
// System.out.println(goodWeINverterDetailDto.getIt_sn());
JpInverter jpInverter = jpInverterMapper.selectOne(new QueryWrapper<JpInverter>().
eq("third_station_id", goodWeINverterDetailDto.getPw_id()).
eq("third_code", PVProducerInfoEnum.GDW.getCode()).
eq("sn_code", goodWeINverterDetailDto.getIt_sn()));
if (org.springframework.util.ObjectUtils.isEmpty(jpInverter)) {
jpInverter = new JpInverter();
}
jpInverter.setName(goodWeINverterDetailDto.getIt_name());
jpInverter.setSnCode(goodWeINverterDetailDto.getIt_sn());
jpInverter.setUpdateTime(new Date());
jpInverter.setId(String.valueOf(goodWeINverterDetailDto.getId()));
jpInverter.setCapacity(goodWeINverterDetailDto.getIt_capacity());
jpInverter.setThirdStationId(goodWeINverterDetailDto.getPw_id());
jpInverter.setThirdCode(PVProducerInfoEnum.GDW.getCode());
jpInverter.setStationName(goodWeINverterDetailDto.getIt_name());
jpInverter.setRecDate(new Date());
if (!org.springframework.util.ObjectUtils.isEmpty(jpInverter.getSequenceNbr())) {
jpInverterMapper.updateById(jpInverter);
} else {
jpInverterMapper.insert(jpInverter);
}
});
});
}
@Override
public void inverterDetail() {
List<String> goodweSnList = jpInverterMapper.getGoodWeSnCodes();
List<List<String>> splitList = Lists.partition(goodweSnList, 50);
HashMap<String, Object> requestInfo = new HashMap<>();
String requstParam = JSON.toJSONString(requestInfo);
for (int i = 0; i < splitList.size(); i++) {
String requestSns = splitList.get(i).stream().map(s -> "sns=" + s).collect(Collectors.joining("&"));
String apiUrl = GoodWeConstant.getInventersDatas + "?" + requestSns;
List<GoodWeInverterCurrentDataDto> list = goodWeRequestUtil.getResPonse(apiUrl, GoodWeConstant.requestGet, requstParam, GoodWeConstant.resovleRule_data_list, GoodWeInverterCurrentDataDto.class);
list.forEach(goodWeInverterCurrentDataDto -> {
JpInverter jpInverter = jpInverterMapper.selectOne(new QueryWrapper<JpInverter>().
eq("third_code", PVProducerInfoEnum.GDW.getCode()).
eq("sn_code", goodWeInverterCurrentDataDto.getSn()));
jpInverter.setIgbtTemperature(String.valueOf(goodWeInverterCurrentDataDto.getTempperature()));
jpInverter.setDayPowerGeneration(goodWeInverterCurrentDataDto.getEday());
jpInverter.setCapacity(goodWeInverterCurrentDataDto.getCapacity());
jpInverterMapper.updateById(jpInverter);
JSONObject hanlderResult = JSONObject.parseObject(JSON.toJSONString(goodWeInverterCurrentDataDto.getD()));
for (int k = 1; k < 3; k++) {
JpInverterElectricity jpInverterElectricity = jpInverterElectricityMapper.selectOne(new QueryWrapper<JpInverterElectricity>().
eq("sn_code", goodWeInverterCurrentDataDto.getSn()).
eq("type", "交流").
eq("name", "AC" + k)
);
if (org.springframework.util.ObjectUtils.isEmpty(jpInverterElectricity)) {
jpInverterElectricity = new JpInverterElectricity();
}
jpInverterElectricity.setInverterId(jpInverter.getId());
jpInverterElectricity.setSnCode(goodWeInverterCurrentDataDto.getSn());
jpInverterElectricity.setThirdCode(PVProducerInfoEnum.GDW.getCode());
jpInverterElectricity.setThirdStationId(jpInverter.getThirdStationId());
jpInverterElectricity.setType("交流");
jpInverterElectricity.setName("AC" + k);
jpInverterElectricity.setVoltage(Double.valueOf(hanlderResult.get("vac" + k).toString()));
jpInverterElectricity.setCurrent(Double.valueOf(hanlderResult.get("iac" + k).toString()));
if (org.springframework.util.ObjectUtils.isEmpty(jpInverterElectricity.getSequenceNbr())) {
jpInverterElectricityMapper.insert(jpInverterElectricity);
} else {
jpInverterElectricityMapper.updateById(jpInverterElectricity);
}
}
for (int k1 = 1; k1 < 4; k1++) {
JpInverterElectricity jpInverterElectricity = jpInverterElectricityMapper.selectOne(new QueryWrapper<JpInverterElectricity>().
eq("sn_code", goodWeInverterCurrentDataDto.getSn()).
eq("type", "直流").
eq("name", "PV" + k1)
);
if (org.springframework.util.ObjectUtils.isEmpty(jpInverterElectricity)) {
jpInverterElectricity = new JpInverterElectricity();
}
jpInverterElectricity.setInverterId(jpInverter.getId());
jpInverterElectricity.setSnCode(goodWeInverterCurrentDataDto.getSn());
jpInverterElectricity.setThirdCode(PVProducerInfoEnum.GDW.getCode());
jpInverterElectricity.setThirdStationId(jpInverter.getThirdStationId());
jpInverterElectricity.setType("直流");
jpInverterElectricity.setName("PV" + k1);
jpInverterElectricity.setVoltage(Double.valueOf(hanlderResult.get("vpv" + k1).toString()));
jpInverterElectricity.setCurrent(Double.valueOf(hanlderResult.get("ipv" + k1).toString()));
// jpInverterElectricity.setPower(Double.valueOf(hanlderResult.get("pow" + k1).toString()));
if (org.springframework.util.ObjectUtils.isEmpty(jpInverterElectricity.getSequenceNbr())) {
jpInverterElectricityMapper.insert(jpInverterElectricity);
} else {
jpInverterElectricityMapper.updateById(jpInverterElectricity);
}
}
HYGFJPInverterElecHistory hygfjpInverterElecHistory = new HYGFJPInverterElecHistory();
hygfjpInverterElecHistory.setThirdStationId(jpInverter.getThirdStationId());
hygfjpInverterElecHistory.setCreatedTime(System.currentTimeMillis());
hygfjpInverterElecHistory.setSnCode(goodWeInverterCurrentDataDto.getSn());
hygfjpInverterElecHistory.setUAcCurrent(goodWeInverterCurrentDataDto.getD().getIac1());
hygfjpInverterElecHistory.setVAcCurrent(goodWeInverterCurrentDataDto.getD().getIac2());
hygfjpInverterElecHistory.setWAcCurrent(goodWeInverterCurrentDataDto.getD().getIac3());
hygfjpInverterElecHistory.setUAcVoltage(goodWeInverterCurrentDataDto.getD().getVac1());
hygfjpInverterElecHistory.setVAcVoltage(goodWeInverterCurrentDataDto.getD().getVac2());
hygfjpInverterElecHistory.setWAcVoltage(goodWeInverterCurrentDataDto.getD().getVac3());
hygfjpInverterElecHistory.setThirdCode(PVProducerInfoEnum.GDW.getCode());
hygfjpInverterElecHistory.setTime(System.currentTimeMillis());
hygfjpInverterElecHistoryMapper.insert(hygfjpInverterElecHistory);
// 逆变器历史
String today = DateUtil.today();
HYGFJPInverterHistory hygfjpInverterHistory = hygfjpInverterHistoryMapper.selectOne(new QueryWrapper<HYGFJPInverterHistory>()
.eq("sn_code", goodWeInverterCurrentDataDto.getSn())
.eq("date", today));
if (org.springframework.util.ObjectUtils.isEmpty(hygfjpInverterHistory)) {
hygfjpInverterHistory = new HYGFJPInverterHistory();
}
hygfjpInverterHistory.setDate(today);
hygfjpInverterHistory.setThirdStationId(jpInverter.getThirdStationId());
hygfjpInverterHistory.setInverterId(jpInverter.getId());
hygfjpInverterHistory.setSnCode(goodWeInverterCurrentDataDto.getSn());
hygfjpInverterHistory.setThirdCode(PVProducerInfoEnum.GDW.getCode());
if(ObjectUtils.isNotEmpty(jpInverter.getCapacity())&&ObjectUtils.isNotEmpty(jpInverter.getDayPowerGeneration())){
hygfjpInverterHistory.setGenerationHours(jpInverter.getDayPowerGeneration()/jpInverter.getCapacity());
}
hygfjpInverterHistory.setPowerGeneration(goodWeInverterCurrentDataDto.getEday());
if (org.springframework.util.ObjectUtils.isEmpty(hygfjpInverterHistory.getCreatedTime())) {
hygfjpInverterHistory.setCreatedTime(System.currentTimeMillis());
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
} else {
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
}
//-----------------------户用光伏日报表----------------------
TdHYGFInverterDayGenerate tdHYGFInverterDayGenerate = new TdHYGFInverterDayGenerate();
tdHYGFInverterDayGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFInverterDayGenerate.setName(jpInverter.getName());
tdHYGFInverterDayGenerate.setThirdStationId(String.valueOf(jpInverter.getThirdStationId()));
tdHYGFInverterDayGenerate.setSnCode(jpInverter.getSnCode().trim());
tdHYGFInverterDayGenerate.setWorkStatus(jpInverter.getState());
D d = goodWeInverterCurrentDataDto.getD();
//交流电压
tdHYGFInverterDayGenerate.setDcv1(d.getVac1());
tdHYGFInverterDayGenerate.setDcv2(d.getVac2());
tdHYGFInverterDayGenerate.setDcv3(d.getVac3());
//交流电流
// tdHYGFInverterDayGenerate.setDcv4(inverterDetailDto.getUAc4());
tdHYGFInverterDayGenerate.setDcc1(d.getIac1());
tdHYGFInverterDayGenerate.setDcc2(d.getIac2());
tdHYGFInverterDayGenerate.setDcc3(d.getIac3());
// tdHYGFInverterDayGenerate.setDcc4(inverterDetailDto.getIAc4());
//直流电压
tdHYGFInverterDayGenerate.setAcv1(d.getVpv1());
tdHYGFInverterDayGenerate.setAcv2(d.getVpv2());
tdHYGFInverterDayGenerate.setAcv3(d.getVpv3());
tdHYGFInverterDayGenerate.setAcv4(d.getVpv4());
//直流电流
tdHYGFInverterDayGenerate.setAcc1(d.getIpv1());
tdHYGFInverterDayGenerate.setAcc2(d.getIpv2());
tdHYGFInverterDayGenerate.setAcc3(d.getIpv3());
tdHYGFInverterDayGenerate.setAcc4(d.getIpv4());
//功率
// tdHYGFInverterDayGenerate.setPv1(inverterDetailDto.getPow1());
// tdHYGFInverterDayGenerate.setPv2(inverterDetailDto.getPow2());
// tdHYGFInverterDayGenerate.setPv3(inverterDetailDto.getPow3());
// tdHYGFInverterDayGenerate.setPv4(inverterDetailDto.getPow4());
// tdHYGFInverterDayGenerate.setTotalPower(inverterDetailDto.getPac());
// tdHYGFInverterDayGenerate.setFrequency(String.valueOf(inverterDetailDto.getFac()));
// tdHYGFInverterDayGenerate.setPowerFactor(inverterDetailDto.getPowerFactor());
tdHYGFInverterDayGenerate.setDayGen(jpInverter.getDayPowerGeneration());
tdHYGFInverterDayGenerate.setMonthGen(jpInverter.getMonthPowerGeneration());
tdHYGFInverterDayGenerate.setYearGen(jpInverter.getYearPowerGeneration());
tdHYGFInverterDayGenerate.setTotalGen(jpInverter.getTotalPowerGeneration());
tdHYGFInverterDayGenerate.setIgbtTemp(goodWeInverterCurrentDataDto.getTempperature());
tdHYGFInverterDayGenerate.setIncome(null);
if(ObjectUtils.isNotEmpty(jpInverter.getCapacity())&&ObjectUtils.isNotEmpty(jpInverter.getDayPowerGeneration())){
tdHYGFInverterDayGenerate.setFullhour(jpInverter.getDayPowerGeneration() / jpInverter.getCapacity());}
tdHYGFInverterDayGenerateMapper.insert(tdHYGFInverterDayGenerate);
//户用场站月发电量
Date today1 = new Date();
TdHYGFInverterMonthGenerate tdHYGFInverterMonthGenerate = tdHYGFInverterMonthGenerateMapper.selectOne(new QueryWrapper<TdHYGFInverterMonthGenerate>()
.eq("third_station_id", jpInverter.getThirdStationId())
.eq("sn_code", jpInverter.getSnCode())
.eq("day_time", DateUtil.format(today1, "yyyy-MM-dd"))
.eq("year_month", DateUtil.format(today1, "yyyy-MM")));
if (org.springframework.util.ObjectUtils.isEmpty(tdHYGFInverterMonthGenerate)) {
tdHYGFInverterMonthGenerate = new TdHYGFInverterMonthGenerate();
}
tdHYGFInverterMonthGenerate.setThirdStationId(jpInverter.getThirdStationId());
tdHYGFInverterMonthGenerate.setSnCode(jpInverter.getSnCode().trim());
tdHYGFInverterMonthGenerate.setName(jpInverter.getName());
tdHYGFInverterMonthGenerate.setDayTime(DateUtil.format(today1, "yyyy-MM-dd"));
tdHYGFInverterMonthGenerate.setYearMonth(DateUtil.format(today1, "yyyy-MM"));
tdHYGFInverterMonthGenerate.setGenerate(jpInverter.getDayPowerGeneration());
if(ObjectUtils.isNotEmpty(jpInverter.getCapacity())&&ObjectUtils.isNotEmpty(jpInverter.getDayPowerGeneration())){
tdHYGFInverterMonthGenerate.setFullhour(jpInverter.getDayPowerGeneration() / jpInverter.getCapacity());}
if (org.springframework.util.ObjectUtils.isEmpty(tdHYGFInverterMonthGenerate.getCreatedTime())) {
tdHYGFInverterMonthGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFInverterMonthGenerateMapper.insert(tdHYGFInverterMonthGenerate);
} else {
tdHYGFInverterMonthGenerateMapper.insert(tdHYGFInverterMonthGenerate);
}
//户用场站年发电量
TdHYGFInverterYearGenerate tdHYGFInverterYearGenerate = tdHYGFInverterYearGenerateMapper.selectOne(new QueryWrapper<TdHYGFInverterYearGenerate>()
.eq("third_station_id", jpInverter.getThirdStationId())
.eq("sn_code", jpInverter.getSnCode())
.eq("month_time", DateUtil.format(today1, "yyyy-MM"))
.eq("year", DateUtil.format(today1, "yyyy")));
if (org.springframework.util.ObjectUtils.isEmpty(tdHYGFInverterYearGenerate)) {
tdHYGFInverterYearGenerate = new TdHYGFInverterYearGenerate();
}
tdHYGFInverterYearGenerate.setThirdStationId(jpInverter.getThirdStationId());
tdHYGFInverterYearGenerate.setSnCode(jpInverter.getSnCode().trim());
tdHYGFInverterYearGenerate.setMonthTime(DateUtil.format(today1, "yyyy-MM"));
tdHYGFInverterYearGenerate.setYear(DateUtil.format(today1, "yyyy"));
tdHYGFInverterYearGenerate.setGenerate(jpInverter.getMonthPowerGeneration());
if(ObjectUtils.isNotEmpty(jpInverter.getCapacity())&&ObjectUtils.isNotEmpty(jpInverter.getMonthPowerGeneration())){
tdHYGFInverterYearGenerate.setFullhour(jpInverter.getMonthPowerGeneration() / jpInverter.getCapacity());
}
tdHYGFInverterYearGenerate.setName(jpInverter.getName());
if (org.springframework.util.ObjectUtils.isEmpty(tdHYGFInverterYearGenerate.getCreatedTime())) {
tdHYGFInverterYearGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFInverterYearGenerateMapper.insert(tdHYGFInverterYearGenerate);
} else {
tdHYGFInverterYearGenerateMapper.insert(tdHYGFInverterYearGenerate);
}
//户用场站年发电量
TdHYGFInverterTotalGenerate tdHYGFInverterTotalGenerate = tdHYGFInverterTotalGenerateMapper.selectOne(new QueryWrapper<TdHYGFInverterTotalGenerate>()
.eq("third_station_id", jpInverter.getThirdStationId())
.eq("sn_code", jpInverter.getSnCode())
.eq("year_time", DateUtil.format(today1, "yyyy"))
.eq("year", DateUtil.format(today1, "yyyy")));
if (org.springframework.util.ObjectUtils.isEmpty(tdHYGFInverterTotalGenerate)) {
tdHYGFInverterTotalGenerate = new TdHYGFInverterTotalGenerate();
}
tdHYGFInverterTotalGenerate.setThirdStationId(jpInverter.getThirdStationId());
tdHYGFInverterTotalGenerate.setName(null == jpInverter.getName() ? null : jpInverter.getName());
tdHYGFInverterTotalGenerate.setSnCode(jpInverter.getSnCode().trim());
tdHYGFInverterTotalGenerate.setYearTime(DateUtil.format(today1, "yyyy"));
tdHYGFInverterTotalGenerate.setYear(DateUtil.format(today1, "yyyy"));
tdHYGFInverterTotalGenerate.setGenerate(jpInverter.getYearPowerGeneration());
if(ObjectUtils.isNotEmpty(jpInverter.getCapacity())&&ObjectUtils.isNotEmpty(jpInverter.getYearPowerGeneration())) {
tdHYGFInverterTotalGenerate.setFullhour(jpInverter.getYearPowerGeneration() / jpInverter.getCapacity());
}
if (org.springframework.util.ObjectUtils.isEmpty(tdHYGFInverterTotalGenerate.getCreatedTime())) {
tdHYGFInverterTotalGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFInverterTotalGenerateMapper.insert(tdHYGFInverterTotalGenerate);
} else {
tdHYGFInverterTotalGenerateMapper.insert(tdHYGFInverterTotalGenerate);
}
});
}
}
@Override
public void inverAlramInfo() {
public void inverterMonthGen() {
List<String> sns =jpInverterMapper.getGoodWeSnCodes() ;
String currentMonth = DateUtil.format(new Date(), "yyyyMM");
sns.forEach(sn -> {
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("sn", sn);
requestInfo.put("date", DateUtil.today());
requestInfo.put("count", 0);
requestInfo.put("type", 1);
String requstParam = JSON.toJSONString(requestInfo);
String apiUrl = GoodWeConstant.getinverterGenURl+"?sn="+sn+"&date="+DateUtil.today()+"&count=0&type=1";
List<GoodWEGenStation> goodWEGenStations = goodWeRequestUtil.getResPonse(apiUrl, GoodWeConstant.requestGet, requstParam, GoodWeConstant.resovleRule_data, GoodWEGenStation.class);
List<GoodWEGenStation> currentMonthGenStations = goodWEGenStations.stream().filter(goodWEGenStation -> goodWEGenStation.getDate().equals(currentMonth)).collect(Collectors.toList());
currentMonthGenStations.forEach(goodWEGenStation -> {
JpInverter jpInverter = jpInverterMapper.selectOne(new QueryWrapper<JpInverter>().eq("third_code", PVProducerInfoEnum.GDW.getCode()).eq("sn_code", sn));
if (ObjectUtils.isNotEmpty(jpInverter)) {
jpInverter.setMonthPowerGeneration(Double.parseDouble(goodWEGenStation.getPower()));
jpInverterMapper.updateById(jpInverter);
}
});
});
}
@Override
public void inverterYearGen() {
String currentYear = DateUtil.format(new Date(), "yyyy");
List<String> sns =jpInverterMapper.getGoodWeSnCodes() ;
sns.forEach(sn -> {
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("sn", sn);
requestInfo.put("date", DateUtil.today());
requestInfo.put("count", 0);
requestInfo.put("type", 2);
String requstParam = JSON.toJSONString(requestInfo);
String apiUrl = GoodWeConstant.getinverterGenURl+"?sn="+sn+"&date="+DateUtil.today()+"&count=0&type=2";
List<GoodWEGenStation> goodWEGenStations = goodWeRequestUtil.getResPonse(apiUrl, GoodWeConstant.requestGet, requstParam, GoodWeConstant.resovleRule_data, GoodWEGenStation.class);
List<GoodWEGenStation> currentMonthGenStations = goodWEGenStations.stream().filter(goodWEGenStation -> goodWEGenStation.getDate().equals(currentYear)).collect(Collectors.toList());
currentMonthGenStations.forEach(goodWEGenStation -> {
JpInverter jpInverter = jpInverterMapper.selectOne(new QueryWrapper<JpInverter>().eq("third_code", PVProducerInfoEnum.GDW.getCode()).eq("sn_code", sn));
if (ObjectUtils.isNotEmpty(jpInverter)) {
jpInverter.setYearPowerGeneration(Double.parseDouble(goodWEGenStation.getPower()));
jpInverterMapper.updateById(jpInverter);
}
});
});
}
@Override
public void inverAlramInfo() {
HashMap<String, Object> requestInfo = new HashMap<>();
String today = DateUtil.today();
requestInfo.put("page_index", 1);
requestInfo.put("page_size", 1000);
requestInfo.put("starttime", today + " 00:00:00");
requestInfo.put("endtime", today + " 23:59:59");
requestInfo.put("status", 2);
String requstParam = JSON.toJSONString(requestInfo);
List<GoodWeAlarmDto> alarmList = goodWeRequestUtil.getResPonse(GoodWeConstant.alarmListUrl, GoodWeConstant.requestPost, requstParam, GoodWeConstant.resovleRule_data_list, GoodWeAlarmDto.class);
alarmList.forEach(goodWeAlarmDto -> {
if (!ObjectUtils.isEmpty(goodWeAlarmDto.getDevicesn())) {
HYGFJPInverterWarn hygfjpInverterWarn = hygfjpInverterWarnMapper.selectOne(new QueryWrapper<HYGFJPInverterWarn>()
.eq("sn_code", goodWeAlarmDto.getDevicesn())
.eq("start_time", goodWeAlarmDto.getHappentime().getMillis())
.eq("third_station_id", String.valueOf(goodWeAlarmDto.getStationId()))
);
if (ObjectUtils.isEmpty(hygfjpInverterWarn)) {
hygfjpInverterWarn = new HYGFJPInverterWarn();
}
hygfjpInverterWarn.setTime(System.currentTimeMillis());
hygfjpInverterWarn.setSnCode(goodWeAlarmDto.getDevicesn());
hygfjpInverterWarn.setThirdStationId(goodWeAlarmDto.getStationId());
// hygfjpInverterWarn.setLevel(GoLangConstant.alarmLevel.get(alarmDto.getAlarmLevel()));
hygfjpInverterWarn.setContent(goodWeAlarmDto.getWarningname());
hygfjpInverterWarn.setThirdCode(PVProducerInfoEnum.GDW.getCode());
hygfjpInverterWarn.setTreatment(GoodWeConstant.errorCodeMap.get(goodWeAlarmDto.getError_code()).get(2));
hygfjpInverterWarn.setStartTime(goodWeAlarmDto.getHappentime().getMillis());
hygfjpInverterWarn.setRecoverTime(null);
if (!ObjectUtils.isEmpty(goodWeAlarmDto.getRecoverytime())) {
hygfjpInverterWarn.setRecoverTime(goodWeAlarmDto.getRecoverytime().getMillis());
}
hygfjpInverterWarn.setTimeLong(null);
if ((!ObjectUtils.isEmpty(goodWeAlarmDto.getHappentime())) && (!ObjectUtils.isEmpty(goodWeAlarmDto.getRecoverytime()))) {
hygfjpInverterWarn.setTimeLong(goodWeAlarmDto.getRecoverytime().getMillis() - goodWeAlarmDto.getHappentime().getMillis());
}
hygfjpInverterWarn.setState(GoodWeConstant.warningStaus.get(goodWeAlarmDto.getStatus().toString()));
if (org.springframework.util.ObjectUtils.isEmpty(hygfjpInverterWarn.getCreatedTime())) {
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis());
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
} else {
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
}
}
});
}
}
......@@ -4,7 +4,7 @@ package com.yeejoin.amos.openapi.enums;
public enum PVProducerInfoEnum {
GDW("固德威","GDW"),
GDW("固德威","GOODWE"),
SH("首航","SH"),
JLY("锦浪云","JLY"),
KSOLAR("科士达","KSD"),
......
......@@ -391,6 +391,9 @@ public class IdxBizFanHealthIndexController extends BaseController {
startTimeTop = formatter.format(startDate);
}
List<String> gatewayIds = this.getGatewayIds();
if(this.getGatewayIds().size()==0){
gatewayIds= Arrays.asList("qweqweqweqweqweqwe");
}
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, gatewayIds);
fanHealthIndexDays.forEach(item -> {
......@@ -568,8 +571,10 @@ public class IdxBizFanHealthIndexController extends BaseController {
@RequestParam(value = "subSystem",required = false) String subSystem,
@RequestParam(value = "current",required = false) Integer current,
@RequestParam(value = "size",required = false) Integer size){
List<String> gatewayIds = this.getGatewayIds();
if(this.getGatewayIds().size()==0){
gatewayIds= Arrays.asList("qweqweqweqweqweqwe");
}
if (requiredType.equals("按天")){
// if (null != type && type.equals("0")){
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
......@@ -583,7 +588,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate);
// }
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, null);
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, gatewayIds);
fanHealthIndexDays.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
});
......@@ -608,7 +613,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate);
// }
List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, null);
List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, gatewayIds);
fanHealthIndexHours.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
});
......@@ -632,7 +637,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate);
// }
List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, null);
List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, gatewayIds);
fanHealthIndexMoments.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
});
......
......@@ -265,6 +265,9 @@ public class IdxBizPvHealthIndexController extends BaseController {
List<String> gatewayIds = this.getGatewayIds();
if(gatewayIds.size()==0){
gatewayIds = Arrays.asList("qweqweqweqeqwqweqw");
}
if (requiredType.equals("按天")){
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -9);
......
......@@ -101,7 +101,7 @@ public class IPermissionServiceImpl implements IPermissionService {
@Override
public String getCurrentUserPersmissions() {
String rootNodeName = "all";
String rootNodeName = "";
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
......@@ -112,7 +112,7 @@ public class IPermissionServiceImpl implements IPermissionService {
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.get("level").toString();
if (companyLevel.equals("categroy_leve2")) {
return rootNodeName;
return "all";
}
if (companyLevel.equals("area")) {
List<StationBasic> stationBasics = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("project_org_code", permissionOrgCode));
......
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