Commit eb27686f authored by caotao's avatar caotao

户用光伏数据采集代码提交

parent a2f19790
......@@ -59,7 +59,7 @@ public class HouseholdTestController {
// goLangDataAcquisitionService.collectorList();
//// goLangDataAcquisitionService.inverterList();
// goLangDataAcquisitionService.collectorDetail();
// goLangDataAcquisitionService.inverterDetail();
goLangDataAcquisitionService.inverAlramInfo();
goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo();
}
}
......@@ -30,4 +30,100 @@ public class InverterDetailDto {
private Double uAc1;
private Double uAc2;
private Double uAc3;
private Double iPv1;
private Double iPv2;
private Double iPv3;
private Double iPv4;
private Double iPv5;
private Double iPv6;
private Double iPv7;
private Double iPv8;
private Double iPv9;
private Double iPv10;
private Double iPv11;
private Double iPv12;
private Double iPv13;
private Double iPv14;
private Double iPv15;
private Double iPv16;
private Double iPv17;
private Double iPv18;
private Double iPv19;
private Double iPv20;
private Double iPv21;
private Double iPv22;
private Double iPv23;
private Double iPv24;
private Double iPv25;
private Double iPv26;
private Double iPv27;
private Double iPv28;
private Double iPv29;
private Double iPv30;
private Double iPv31;
private Double iPv32;
private Double uPv1;
private Double uPv2;
private Double uPv3;
private Double uPv4;
private Double uPv5;
private Double uPv6;
private Double uPv7;
private Double uPv8;
private Double uPv9;
private Double uPv10;
private Double uPv11;
private Double uPv12;
private Double uPv13;
private Double uPv14;
private Double uPv15;
private Double uPv16;
private Double uPv17;
private Double uPv18;
private Double uPv19;
private Double uPv20;
private Double uPv21;
private Double uPv22;
private Double uPv23;
private Double uPv24;
private Double uPv25;
private Double uPv26;
private Double uPv27;
private Double uPv28;
private Double uPv29;
private Double uPv30;
private Double uPv31;
private Double uPv32;
private Double pow1;
private Double pow2;
private Double pow3;
private Double pow4;
private Double pow5;
private Double pow6;
private Double pow7;
private Double pow8;
private Double pow9;
private Double pow10;
private Double pow11;
private Double pow12;
private Double pow13;
private Double pow14;
private Double pow15;
private Double pow16;
private Double pow17;
private Double pow18;
private Double pow19;
private Double pow20;
private Double pow21;
private Double pow22;
private Double pow23;
private Double pow24;
private Double pow25;
private Double pow26;
private Double pow27;
private Double pow28;
private Double pow29;
private Double pow30;
private Double pow31;
private Double pow32;
}
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.models.auth.In;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
......@@ -97,5 +98,4 @@ public class JpInverterElectricity implements Serializable {
*/
@TableField("third_code")
private String thirdCode;
}
......@@ -8,7 +8,7 @@ import java.util.Date;
@Data
@TableName(value = "golang_collector_detail", autoResultMap = true)
public class GolangCollectorDetail {
private Date createdTime;
private Long createdTime;
private Long id;
private String sn;
private Long stationid;
......
......@@ -8,7 +8,7 @@ import java.util.Date;
@Data
@TableName(value = "golang_collector_list", autoResultMap = true)
public class GolangCollectorList {
private Date createdTime;
private Long createdTime;
private Long id;
private String stationname;
private Long stationid;
......
......@@ -8,7 +8,7 @@ import java.util.Date;
@Data
@TableName(value = "golang_inveter_detail", autoResultMap = true)
public class GolangInverterDetail {
private Date createdTime;
private Long createdTime;
private String gridSellYearEnergy;
private String batteryAlarm;
private String storageBatteryVoltageStr;
......
......@@ -8,7 +8,7 @@ import java.util.Date;
@Data
@TableName(value = "golang_inveter_list", autoResultMap = true)
public class GolangInverterList {
private Date createdTime;
private Long createdTime;
private Long id;
private String sn;
private Long stationid;
......
......@@ -10,7 +10,7 @@ import java.util.Date;
@Data
@TableName(value = "golang_station_detail", autoResultMap = true)
public class GolangStationDetail implements Serializable {
private Date createdTime;
private Long createdTime;
private Long id;
private String stationname;
private String addr;
......
......@@ -7,7 +7,7 @@ import java.util.Date;
@Data
@TableName(value = "golang_station_list" ,autoResultMap = true)
public class GolangStationList implements Serializable {
private Date createdTime;
private Long createdTime;
private String id;
private String stationName;
private String addr;
......
......@@ -9,7 +9,7 @@ import java.util.Date;
@Data
@TableName(value = "td_hygf_jp_collector_history" ,autoResultMap = true)
public class HYGFJPCollectorHistory implements Serializable {
private Date createdTime;
private Long createdTime;
private String snCode;
private Long time;
private Double signalStrength;
......
......@@ -9,7 +9,7 @@ import java.util.Date;
@Data
@TableName(value = "td_hygf_jp_invertor_elec_history" ,autoResultMap = true)
public class HYGFJPInverterElecHistory implements Serializable {
private Date createdTime;
private Long createdTime;
private String snCode;
private Double uAcVoltage;
private Double vAcVoltage;
......
......@@ -10,7 +10,7 @@ import java.util.Date;
@Data
@TableName(value = "td_hygf_jp_inverter_history" ,autoResultMap = true)
public class HYGFJPInverterHistory implements Serializable {
private Timestamp createdTime;
private Long createdTime;
private String snCode;
private String date;
private Double powerGeneration;
......
......@@ -9,7 +9,7 @@ import java.util.Date;
@Data
@TableName(value = "td_hygf_jp_inverter_warn" ,autoResultMap = true)
public class HYGFJPInverterWarn implements Serializable {
private Date createdTime;
private Long createdTime;
private long time;
private String snCode;
private String content;
......
......@@ -9,7 +9,7 @@ import java.util.Date;
@Data
@TableName(value = "td_hygf_jp_invertor_elec_history" ,autoResultMap = true)
public class HYGFJPStationPowerHistory implements Serializable {
private Date createdTime;
private Long createdTime;
private Double power;
private long time;
private String thirdStationId;
......
......@@ -13,6 +13,7 @@ import com.yeejoin.amos.api.householdapi.face.dto.CollectorDetailDto;
import com.yeejoin.amos.api.householdapi.face.dto.InverterDetailDto;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpCollector;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverter;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverterElectricity;
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.JpCollectorMapper;
......@@ -34,6 +35,7 @@ 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;
@Service
......@@ -86,7 +88,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
);
for (int i = 0; i < result.size(); i++) {
GolangStationList golangStationList = result.get(i);
golangStationList.setCreatedTime(new Date());
golangStationList.setCreatedTime(System.currentTimeMillis());
golangStationMapper.insert(golangStationList);
}
}
......@@ -111,7 +113,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
);
for (int j = 0; j < result.size(); j++) {
GolangStationDetail golangStationDetail = result.get(j);
golangStationDetail.setCreatedTime(new Date());
golangStationDetail.setCreatedTime(System.currentTimeMillis());
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_code", PVProducerInfoEnum.JLY.getCode()).
eq("third_station_id", stationIds.get(i)));
......@@ -151,7 +153,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
}
HYGFJPStationPowerHistory hygfjpStationPowerHistory = new HYGFJPStationPowerHistory();
hygfjpStationPowerHistory = new HYGFJPStationPowerHistory();
hygfjpStationPowerHistory.setCreatedTime(new Date());
hygfjpStationPowerHistory.setCreatedTime(System.currentTimeMillis());
hygfjpStationPowerHistory.setThirdStationId(jpStation.getThirdStationId());
hygfjpStationPowerHistory.setPower(jpStation.getRealTimePower());
hygfjpStationPowerHistory.setThirdCode(jpStation.getThirdCode());
......@@ -184,7 +186,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
);
for (int j = 0; j < result.size(); j++) {
GolangCollectorList golangCollectorList = result.get(j);
golangCollectorList.setCreatedTime(new Date());
golangCollectorList.setCreatedTime(System.currentTimeMillis());
golangCollectorListMapper.insert(golangCollectorList);
}
}
......@@ -247,7 +249,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
// td-collector-history
HYGFJPCollectorHistory hygfjpCollectorHistory = new HYGFJPCollectorHistory();
hygfjpCollectorHistory.setTime(System.currentTimeMillis());
hygfjpCollectorHistory.setCreatedTime(new DateTime());
hygfjpCollectorHistory.setCreatedTime(System.currentTimeMillis());
hygfjpCollectorHistory.setSnCode(collectorDetailDto.getSn());
hygfjpCollectorHistory.setSignalStrength(Double.valueOf(collectorDetailDto.getRssiLevel()));
hygfjpCollectorHistory.setThirdStationId(collectorDetailDto.getStationId());
......@@ -279,7 +281,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
);
for (int j = 0; j < result.size(); j++) {
GolangInverterList golangInverterList = result.get(j);
golangInverterList.setCreatedTime(new Date());
golangInverterList.setCreatedTime(System.currentTimeMillis());
golangInverterListMapper.insert(golangInverterList);
}
}
......@@ -336,9 +338,56 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
} else {
jpInverterMapper.insert(jpInverter);
}
String jsonString =JSON.toJSONString(inverterDetailDto);
Map<String,Object> hanlderResult = JSON.parseObject(jsonString,Map.class);
for (int k = 1; k < 4; k++) {
JpInverterElectricity jpInverterElectricity=jpInverterElectricityMapper.selectOne(new QueryWrapper<JpInverterElectricity>().
eq("sn_code",inverterDetailDto.getSn()).
eq("type","交流").
eq("name","AC"+k)
);
if(ObjectUtils.isEmpty(jpInverterElectricity)){
jpInverterElectricity=new JpInverterElectricity();
}
jpInverterElectricity.setInverterId(inverterDetailDto.getId());
jpInverterElectricity.setSnCode(inverterDetailDto.getSn());
jpInverterElectricity.setThirdCode(PVProducerInfoEnum.JLY.getCode());
jpInverterElectricity.setType("交流");
jpInverterElectricity.setName("AC"+k);
jpInverterElectricity.setVoltage(Double.valueOf(hanlderResult.get("uAc"+k).toString()));
jpInverterElectricity.setCurrent(Double.valueOf(hanlderResult.get("iAc"+k).toString()));
if(ObjectUtils.isEmpty(jpInverterElectricity.getSequenceNbr())){
jpInverterElectricityMapper.insert(jpInverterElectricity);
}else {
jpInverterElectricityMapper.updateById(jpInverterElectricity);
}
}
for (int k1 = 1; k1 < 33; k1++) {
JpInverterElectricity jpInverterElectricity=jpInverterElectricityMapper.selectOne(new QueryWrapper<JpInverterElectricity>().
eq("sn_code",inverterDetailDto.getSn()).
eq("type","直流").
eq("name","PV"+k1)
);
if(ObjectUtils.isEmpty(jpInverterElectricity)){
jpInverterElectricity=new JpInverterElectricity();
}
jpInverterElectricity.setInverterId(inverterDetailDto.getId());
jpInverterElectricity.setSnCode(inverterDetailDto.getSn());
jpInverterElectricity.setThirdCode(PVProducerInfoEnum.JLY.getCode());
jpInverterElectricity.setType("直流");
jpInverterElectricity.setName("PV"+k1);
jpInverterElectricity.setVoltage(Double.valueOf(hanlderResult.get("uPv"+k1).toString()));
jpInverterElectricity.setCurrent(Double.valueOf(hanlderResult.get("iPv"+k1).toString()));
jpInverterElectricity.setPower(Double.valueOf(hanlderResult.get("pow"+k1).toString()));
if(ObjectUtils.isEmpty(jpInverterElectricity.getSequenceNbr())){
jpInverterElectricityMapper.insert(jpInverterElectricity);
}else {
jpInverterElectricityMapper.updateById(jpInverterElectricity);
}
}
HYGFJPInverterElecHistory hygfjpInverterElecHistory = new HYGFJPInverterElecHistory();
hygfjpInverterElecHistory.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
hygfjpInverterElecHistory.setCreatedTime(new Date());
hygfjpInverterElecHistory.setCreatedTime(System.currentTimeMillis());
hygfjpInverterElecHistory.setSnCode(inverterDetailDto.getSn());
hygfjpInverterElecHistory.setUAcCurrent(inverterDetailDto.getIAc1());
hygfjpInverterElecHistory.setVAcCurrent(inverterDetailDto.getIAc2());
......@@ -351,11 +400,10 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
hygfjpInverterElecHistoryMapper.insert(hygfjpInverterElecHistory);
// 逆变器历史
String today = DateUtil.today();
// HYGFJPInverterHistory hygfjpInverterHistory = hygfjpInverterHistoryMapper.selectOne(new QueryWrapper<HYGFJPInverterHistory>().eq("sn_code", inverterDetailDto.getSn()).eq("date",today));
// if (ObjectUtils.isEmpty(hygfjpInverterHistory)) {
// hygfjpInverterHistory = new HYGFJPInverterHistory();
// }
HYGFJPInverterHistory hygfjpInverterHistory =new HYGFJPInverterHistory();
HYGFJPInverterHistory hygfjpInverterHistory = hygfjpInverterHistoryMapper.selectOne(new QueryWrapper<HYGFJPInverterHistory>().eq("sn_code", inverterDetailDto.getSn()).eq("date",today));
if (ObjectUtils.isEmpty(hygfjpInverterHistory)) {
hygfjpInverterHistory = new HYGFJPInverterHistory();
}
hygfjpInverterHistory.setDate(today);
hygfjpInverterHistory.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
hygfjpInverterHistory.setInverterId(inverterDetailDto.getId());
......@@ -365,7 +413,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
hygfjpInverterHistory.setPowerGeneration(inverterDetailDto.getEToday());
SimpleDateFormat format = new SimpleDateFormat(GoLangConstant.datePattern);
if (ObjectUtils.isEmpty(hygfjpInverterHistory.getCreatedTime())) {
hygfjpInverterHistory.setCreatedTime(Timestamp.valueOf(format.format(System.currentTimeMillis())));
hygfjpInverterHistory.setCreatedTime(System.currentTimeMillis());
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
} else {
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
......@@ -399,7 +447,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
for (int j = 0; j < result.size(); j++) {
AlarmDto alarmDto = result.get(j);
HYGFJPInverterWarn hygfjpInverterWarn=new HYGFJPInverterWarn();
hygfjpInverterWarn.setCreatedTime(new Date());
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis());
hygfjpInverterWarn.setTime(System.currentTimeMillis());
hygfjpInverterWarn.setSnCode(alarmDto.getAlarmDeviceSn());
hygfjpInverterWarn.setThirdCode(String.valueOf(alarmDto.getStationId()));
......
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