Commit e0da6229 authored by caotao's avatar caotao

户用光伏未入库数据补充

parent 2e21653c
...@@ -62,6 +62,21 @@ public class GolangRequestUtil { ...@@ -62,6 +62,21 @@ public class GolangRequestUtil {
return result; return result;
} }
// public JSONArray getResPonse(String apiurl,String requestMethod,String requestParmInfo,String ResultResolveRule) {
// String respone = "";
// String params = "";
// JSONArray jsonArray = null;
// HashMap<String, Object> producerInfo = getHeaderOfGolang();
// String baseurl = (String) producerInfo.get("apiurl");
// HashMap<String, String> headMap = (HashMap<String, String>) producerInfo.get("header");
// String orginalAuthorization = headMap.get("Authorization") + ":";
// String url = baseurl + apiurl;
// String appsecret = (String) producerInfo.get("appsecret");
// JLYHeaderMapHandler(params, headMap, orginalAuthorization, appsecret,apiurl);
// respone = sendRequest(requestMethod, url,requestParmInfo, headMap);
// jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone);
// return jsonArray;
// }
/** /**
* @param resultResovle 请求返回的解析规则 来源与数据库 * @param resultResovle 请求返回的解析规则 来源与数据库
* @param response 请求返回的字符串 * @param response 请求返回的字符串
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.api.householdapi.constant; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.api.householdapi.constant;
import org.apache.xmlbeans.impl.xb.xsdschema.Public; import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import java.time.format.DateTimeFormatter;
import java.util.HashMap; import java.util.HashMap;
public class GoLangConstant { public class GoLangConstant {
...@@ -22,6 +23,22 @@ public class GoLangConstant { ...@@ -22,6 +23,22 @@ public class GoLangConstant {
put("5", "外置电表"); put("5", "外置电表");
} }
}; };
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", "已处理");
put("2", "已恢复");
}
};
public static String baseurl = "https://api.ginlong.com:13333"; public static String baseurl = "https://api.ginlong.com:13333";
public static String tokenurl = ""; public static String tokenurl = "";
public static String prodcerappid = "1300386381676732593"; public static String prodcerappid = "1300386381676732593";
...@@ -32,7 +49,11 @@ public class GoLangConstant { ...@@ -32,7 +49,11 @@ public class GoLangConstant {
public static String collectorDetailUrl = "/v1/api/collectorDetail"; public static String collectorDetailUrl = "/v1/api/collectorDetail";
public static String inverterListUrl = "/v1/api/inverterList"; public static String inverterListUrl = "/v1/api/inverterList";
public static String inverterDetailUrl = "/v1/api/inverterDetail"; public static String inverterDetailUrl = "/v1/api/inverterDetail";
public static String alarmListUrl = "/v1/api/alarmList";
public static String resovleRule_data_page_records = "data,page,records"; public static String resovleRule_data_page_records = "data,page,records";
public static String resovleRule_data_records = "data,records";
public static String resovleRule_data = "data"; public static String resovleRule_data = "data";
public static String requestPost = "POST"; public static String requestPost = "POST";
public static String datePattern = "yyyy-MM-dd HH:mm:ss.SSS";
public static DateTimeFormatter formatter = DateTimeFormatter.ofPattern(datePattern);
} }
...@@ -57,6 +57,9 @@ public class HouseholdTestController { ...@@ -57,6 +57,9 @@ public class HouseholdTestController {
public void golangnew() throws IOException { public void golangnew() throws IOException {
// goLangDataAcquisitionService.stationList(); // goLangDataAcquisitionService.stationList();
// goLangDataAcquisitionService.collectorList(); // goLangDataAcquisitionService.collectorList();
goLangDataAcquisitionService.inverterList(); //// goLangDataAcquisitionService.inverterList();
// goLangDataAcquisitionService.collectorDetail();
// goLangDataAcquisitionService.inverterDetail();
goLangDataAcquisitionService.inverAlramInfo();
} }
} }
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
@Data
public class AlarmDto {
private Long stationId;
private String stationName;
private String alarmDeviceSn;
private String alarmCode;
private String alarmLevel;
private Long alarmBeginTime;
private Long alarmEndTime;
private String alarmMsg;
private String advice;
private String state;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
@Data
public class CollectorDetailDto {
private String sn;
private String state;
private Long factoryTime;
private Double dataUploadCycle;
private Long currentWorkingTime;
private Long totalWorkingTime;
private String stationId;
private String rssiLevel;
private String model;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
import java.awt.print.PrinterGraphics;
@Data
public class InverterDetailDto {
private Long id;
private String sn;
private Long stationId;
private String stationName;
private Long collectorId;
private String collectorsn;
private String currentState;
private Double pac;
private Double eToday;
private Double eMonth;
private Double eYear;
private String name;
private String productModel;
private String nationalStandards;
private String version;
private Double fullHour;
private Double power;
private Double eTotal;
private Double iAc1;
private Double iAc2;
private Double iAc3;
private Double uAc1;
private Double uAc2;
private Double uAc3;
}
...@@ -2,7 +2,6 @@ package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf; ...@@ -2,7 +2,6 @@ package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
......
...@@ -2,7 +2,6 @@ package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf; ...@@ -2,7 +2,6 @@ package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
...@@ -34,164 +33,146 @@ public class JpInverter implements Serializable { ...@@ -34,164 +33,146 @@ public class JpInverter implements Serializable {
protected String recUserName; protected String recUserName;
/** /**
* 是否删除
*/
@TableField(value = "is_delete")
public Boolean isDelete=false;
/**
* sn编码 * sn编码
*/ */
@TableField("sn_code") @TableField("sn_code")
private String snCode; private String snCode;
/** /**
* 状态 * 状态
*/ */
@TableField("state") @TableField("state")
private String state; private String state;
/** /**
* 额定功率 * 额定功率
*/ */
@TableField("rated_power") @TableField("rated_power")
private Double ratedPower; private Double ratedPower;
/** /**
* 采集器id * 采集器id
*/ */
@TableField("collector_id") @TableField("collector_id")
private Long collectorId; private Long collectorId;
/** /**
* 采集器sn编码 * 采集器sn编码
*/ */
@TableField("collector_sn_code") @TableField("collector_sn_code")
private String collectorSnCode; private String collectorSnCode;
/** /**
* 更新时间 * 更新时间
*/ */
@TableField("update_time") @TableField("update_time")
private Date updateTime; private Date updateTime;
/** /**
* 实时功率 * 实时功率
*/ */
@TableField("current_power") @TableField("current_power")
private Double currentPower; private Double currentPower;
/** /**
* 日发电量 * 日发电量
*/ */
@TableField("day_power_generation") @TableField("day_power_generation")
private Double dayPowerGeneration; private Double dayPowerGeneration;
/** /**
* 月发电量 * 月发电量
*/ */
@TableField("month_power_generation") @TableField("month_power_generation")
private Double monthPowerGeneration; private Double monthPowerGeneration;
/** /**
* 年发电量 * 年发电量
*/ */
@TableField("year_power_generation") @TableField("year_power_generation")
private Double yearPowerGeneration; private Double yearPowerGeneration;
/** /**
* 品牌 * 品牌
*/ */
@TableField("brand") @TableField("brand")
private String brand; private String brand;
/** /**
* 型号 * 型号
*/ */
@TableField("model") @TableField("model")
private String model; private String model;
/** /**
* 国标 * 国标
*/ */
@TableField("national_standard") @TableField("national_standard")
private String nationalStandard; private String nationalStandard;
/** /**
* 版本号 * 版本号
*/ */
@TableField("version") @TableField("version")
private String version; private String version;
/** /**
* 满发小时数 * 满发小时数
*/ */
@TableField("generation_hours") @TableField("generation_hours")
private String generationHours; private String generationHours;
/** /**
* 质保期 * 质保期
*/ */
@TableField("warranty_period") @TableField("warranty_period")
private String warrantyPeriod; private String warrantyPeriod;
/** /**
* IGBT温度 * IGBT温度
*/ */
@TableField("IGBT_temperature") @TableField("IGBT_temperature")
private String igbtTemperature; private String igbtTemperature;
/** /**
* AFCI方案 * AFCI方案
*/ */
@TableField("AFCI_programme") @TableField("AFCI_programme")
private String afciProgramme; private String afciProgramme;
/** /**
* AFCI版本 * AFCI版本
*/ */
@TableField("AFCI_version") @TableField("AFCI_version")
private String afciVersion; private String afciVersion;
/** /**
* ID * ID
*/ */
@TableField("ID") @TableField("ID")
private Long id; private Long id;
/** /**
* 第三方电站id * 第三方电站id
*/ */
@TableField("third_station_id") @TableField("third_station_id")
private String thirdStationId; private String thirdStationId;
/** /**
* 第三方电站id
*/
@TableField("third_code")
private String thirdCode;
/**
* 装机容量 * 装机容量
*/ */
@TableField("capacity") @TableField("capacity")
private Integer capacity; private Integer capacity;
/** /**
* 累计发电量 * 累计发电量
*/ */
@TableField("total_power_generation") @TableField("total_power_generation")
private Double totalPowerGeneration; private Double totalPowerGeneration;
/**
* 日用电量
*/
@TableField("day_power_use")
private Double dayPowerUse;
/**
* 月用电量
*/
@TableField("month_power_use")
private Double monthPowerUse;
/**
* 年用电量
*/
@TableField("year_power_use")
private Double yearPowerUse;
} }
...@@ -11,7 +11,7 @@ import java.util.Date; ...@@ -11,7 +11,7 @@ import java.util.Date;
public class HYGFJPCollectorHistory implements Serializable { public class HYGFJPCollectorHistory implements Serializable {
private Date createdTime; private Date createdTime;
private String snCode; private String snCode;
private Date time; private Long time;
private Double signalStrength; private Double signalStrength;
private String thirdStationId; private String thirdStationId;
private String thirdCode; private String thirdCode;
......
...@@ -4,12 +4,13 @@ import com.baomidou.mybatisplus.annotation.TableName; ...@@ -4,12 +4,13 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
@Data @Data
@TableName(value = "td_hygf_jp_inverter_history" ,autoResultMap = true) @TableName(value = "td_hygf_jp_inverter_history" ,autoResultMap = true)
public class HYGFJPInverterHistory implements Serializable { public class HYGFJPInverterHistory implements Serializable {
private Date createdTime; private Timestamp createdTime;
private String snCode; private String snCode;
private String date; private String date;
private Double powerGeneration; private Double powerGeneration;
......
...@@ -7,17 +7,18 @@ import java.io.Serializable; ...@@ -7,17 +7,18 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
@Data @Data
@TableName(value = "td_hygf_jp_inverter_history" ,autoResultMap = true) @TableName(value = "td_hygf_jp_inverter_warn" ,autoResultMap = true)
public class HYGFJPInverterWarn implements Serializable { public class HYGFJPInverterWarn implements Serializable {
private Date createdTime; private Date createdTime;
private long time; private long time;
private String snCode; private String snCode;
private String content; private String content;
private String level; private String level;
private Long time_long; private Long timeLong;
private Long start_time; private Long startTime;
private Long recover_time; private Long recoverTime;
private String treatment; private String treatment;
private String thirdStationId; private String thirdStationId;
private String thirdCode; private String thirdCode;
private String state;
} }
...@@ -9,4 +9,6 @@ import java.util.List; ...@@ -9,4 +9,6 @@ import java.util.List;
public interface GolangInverterListMapper extends BaseMapper<GolangInverterList> { public interface GolangInverterListMapper extends BaseMapper<GolangInverterList> {
@Select("select id from golang_inveter_list group by id") @Select("select id from golang_inveter_list group by id")
List<Long> getInverterIds(); List<Long> getInverterIds();
@Select("select sn from golang_inveter_list group by sn")
List<String> getInverterSns();
} }
package com.yeejoin.amos.api.householdapi.face.service;
public interface GoLangDataAcquisition {
}
...@@ -7,4 +7,5 @@ public interface GoLangDataAcquisitionService { ...@@ -7,4 +7,5 @@ public interface GoLangDataAcquisitionService {
void collectorDetail(); void collectorDetail();
void inverterList(); void inverterList();
void inverterDetail(); void inverterDetail();
void inverAlramInfo();
} }
package com.yeejoin.amos.api.householdapi.face.service.impl; package com.yeejoin.amos.api.householdapi.face.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.alibaba.druid.support.opds.udf.ExportSelectListColumns;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.Utils.GolangRequestUtil; import com.yeejoin.amos.api.householdapi.Utils.GolangRequestUtil;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant; import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
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.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.JpStation; 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.*;
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.tdengine.*; import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.*;
import com.yeejoin.amos.api.householdapi.face.service.GoLangDataAcquisitionService; import com.yeejoin.amos.api.householdapi.face.service.GoLangDataAcquisitionService;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper; import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
...@@ -14,6 +27,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -14,6 +27,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import javax.lang.model.util.ElementScanner6;
import java.rmi.AlreadyBoundException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -29,6 +46,12 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -29,6 +46,12 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
@Autowired @Autowired
private JpStationMapper jpStationMapper; private JpStationMapper jpStationMapper;
@Autowired @Autowired
private JpCollectorMapper jpCollectorMapper;
@Autowired
private JpInverterMapper jpInverterMapper;
@Autowired
private JpInverterElectricityMapper jpInverterElectricityMapper;
@Autowired
private GolangStationDetailMapper golangStationDetailMapper; private GolangStationDetailMapper golangStationDetailMapper;
@Autowired @Autowired
private GolangCollectorListMapper golangCollectorListMapper; private GolangCollectorListMapper golangCollectorListMapper;
...@@ -89,7 +112,9 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -89,7 +112,9 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
for (int j = 0; j < result.size(); j++) { for (int j = 0; j < result.size(); j++) {
GolangStationDetail golangStationDetail = result.get(j); GolangStationDetail golangStationDetail = result.get(j);
golangStationDetail.setCreatedTime(new Date()); golangStationDetail.setCreatedTime(new Date());
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().eq("third_code", PVProducerInfoEnum.JLY.getCode()).eq("third_station_id", stationIds.get(i))); JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_code", PVProducerInfoEnum.JLY.getCode()).
eq("third_station_id", stationIds.get(i)));
//给户用光伏存储的数据赋值 //给户用光伏存储的数据赋值
if (ObjectUtils.isEmpty(jpStation)) { if (ObjectUtils.isEmpty(jpStation)) {
jpStation = new JpStation(); jpStation = new JpStation();
...@@ -119,19 +144,20 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -119,19 +144,20 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpStation.setYearIncome(golangStationDetail.getYearincome()); jpStation.setYearIncome(golangStationDetail.getYearincome());
jpStation.setCumulativeIncome(golangStationDetail.getAllincome()); jpStation.setCumulativeIncome(golangStationDetail.getAllincome());
jpStation.setArea(golangStationDetail.getRegionstr()); jpStation.setArea(golangStationDetail.getRegionstr());
if (!ObjectUtils.isEmpty(jpStation.getSequenceNbr())) { if (!ObjectUtils.isEmpty(jpStation.getSequenceNbr())) {
jpStationMapper.updateById(jpStation); jpStationMapper.updateById(jpStation);
} else { } else {
jpStationMapper.insert(jpStation); jpStationMapper.insert(jpStation);
} }
HYGFJPStationPowerHistory hygfjpStationPowerHistory = new HYGFJPStationPowerHistory(); HYGFJPStationPowerHistory hygfjpStationPowerHistory = new HYGFJPStationPowerHistory();
hygfjpStationPowerHistory = new HYGFJPStationPowerHistory();
hygfjpStationPowerHistory.setCreatedTime(new Date()); hygfjpStationPowerHistory.setCreatedTime(new Date());
hygfjpStationPowerHistory.setThirdStationId(jpStation.getThirdStationId()); hygfjpStationPowerHistory.setThirdStationId(jpStation.getThirdStationId());
hygfjpStationPowerHistory.setPower(jpStation.getRealTimePower()); hygfjpStationPowerHistory.setPower(jpStation.getRealTimePower());
hygfjpStationPowerHistory.setThirdCode(jpStation.getThirdCode()); hygfjpStationPowerHistory.setThirdCode(jpStation.getThirdCode());
hygfjpStationPowerHistory.setTime(System.currentTimeMillis()); hygfjpStationPowerHistory.setTime(System.currentTimeMillis());
golangStationDetailMapper.insert(golangStationDetail); golangStationDetailMapper.updateById(golangStationDetail);
} }
} }
} }
...@@ -167,7 +193,68 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -167,7 +193,68 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
@Override @Override
public void collectorDetail() { public void collectorDetail() {
List<Long> collectorIds = golangCollectorListMapper.getCollectIds(); List<Long> collectorIds = golangCollectorListMapper.getCollectIds();
for (int i = 0; i < collectorIds.size(); i++) {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("id", Long.valueOf(collectorIds.get(i)));
String requestParaminfo = JSON.toJSONString(requestInfo);
List<CollectorDetailDto> result = golangRequestUtil.getResPonse(GoLangConstant.collectorDetailUrl,
GoLangConstant.requestPost,
requestParaminfo,
GoLangConstant.resovleRule_data,
CollectorDetailDto.class
);
for (int j = 0; j < result.size(); j++) {
CollectorDetailDto collectorDetailDto = result.get(j);
JpCollector jpCollector = jpCollectorMapper.selectOne(new QueryWrapper<JpCollector>().
eq("third_station_id", collectorDetailDto.getStationId()).
eq("third_code", PVProducerInfoEnum.JLY.getCode()).
eq("sn_code", collectorDetailDto.getSn()));
if (ObjectUtils.isEmpty(jpCollector)) {
jpCollector = new JpCollector();
}
//sn编码
jpCollector.setSnCode(collectorDetailDto.getSn());
//类型
jpCollector.setType(collectorDetailDto.getModel());
//更新时间
jpCollector.setUpdateTime(new Date());
//出场日期
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()));
//第三方电站id
jpCollector.setThirdStationId(collectorDetailDto.getStationId());
//第三方厂商标识
jpCollector.setThirdCode(PVProducerInfoEnum.JLY.getCode());
//第三方厂商标识
jpCollector.setState(GoLangConstant.stationStaus.get(collectorDetailDto.getState()));
if (ObjectUtils.isEmpty(jpCollector.getSequenceNbr())) {
jpCollectorMapper.insert(jpCollector);
} else {
jpCollectorMapper.updateById(jpCollector);
}
// td-collector-history
HYGFJPCollectorHistory hygfjpCollectorHistory = new HYGFJPCollectorHistory();
hygfjpCollectorHistory.setTime(System.currentTimeMillis());
hygfjpCollectorHistory.setCreatedTime(new DateTime());
hygfjpCollectorHistory.setSnCode(collectorDetailDto.getSn());
hygfjpCollectorHistory.setSignalStrength(Double.valueOf(collectorDetailDto.getRssiLevel()));
hygfjpCollectorHistory.setThirdStationId(collectorDetailDto.getStationId());
hygfjpCollectorHistory.setThirdCode(PVProducerInfoEnum.JLY.getCode());
hygfjpCollectorHistoryMapper.insert(hygfjpCollectorHistory);
}
}
} }
@Override @Override
...@@ -187,7 +274,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -187,7 +274,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
List<GolangInverterList> result = golangRequestUtil.getResPonse(GoLangConstant.inverterListUrl, List<GolangInverterList> result = golangRequestUtil.getResPonse(GoLangConstant.inverterListUrl,
GoLangConstant.requestPost, GoLangConstant.requestPost,
requestParaminfo, requestParaminfo,
GoLangConstant.resovleRule_data_page_records, GoLangConstant.resovleRule_data,
GolangInverterList.class GolangInverterList.class
); );
for (int j = 0; j < result.size(); j++) { for (int j = 0; j < result.size(); j++) {
...@@ -201,5 +288,131 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -201,5 +288,131 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
@Override @Override
public void inverterDetail() { public void inverterDetail() {
List<Long> inverterIds = golangInverterListMapper.getInverterIds(); List<Long> inverterIds = golangInverterListMapper.getInverterIds();
for (int i = 0; i < inverterIds.size(); i++) {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("id", Long.valueOf(inverterIds.get(i)));
String requestParaminfo = JSON.toJSONString(requestInfo);
List<InverterDetailDto> result = golangRequestUtil.getResPonse(GoLangConstant.inverterDetailUrl,
GoLangConstant.requestPost,
requestParaminfo,
GoLangConstant.resovleRule_data,
InverterDetailDto.class
);
for (int j = 0; j < result.size(); j++) {
InverterDetailDto inverterDetailDto = result.get(j);
JpInverter jpInverter = jpInverterMapper.selectOne(new QueryWrapper<JpInverter>().
eq("third_station_id", inverterDetailDto.getStationId()).
eq("third_code", PVProducerInfoEnum.JLY.getCode()).
eq("sn_code", inverterDetailDto.getSn()));
if (ObjectUtils.isEmpty(jpInverter)) {
jpInverter = new JpInverter();
}
jpInverter.setSnCode(inverterDetailDto.getSn());
jpInverter.setState(GoLangConstant.stationStaus.get(inverterDetailDto.getCurrentState()));
jpInverter.setCollectorId(inverterDetailDto.getCollectorId());
jpInverter.setCollectorSnCode(inverterDetailDto.getCollectorsn());
jpInverter.setUpdateTime(new Date());
jpInverter.setCurrentPower(inverterDetailDto.getPac());
jpInverter.setDayPowerGeneration(inverterDetailDto.getEToday());
jpInverter.setMonthPowerGeneration(inverterDetailDto.getEMonth());
jpInverter.setYearPowerGeneration(inverterDetailDto.getEYear());
jpInverter.setTotalPowerGeneration(inverterDetailDto.getETotal());
jpInverter.setBrand(inverterDetailDto.getName());
jpInverter.setModel(inverterDetailDto.getProductModel());
jpInverter.setNationalStandard(inverterDetailDto.getNationalStandards());
jpInverter.setVersion(inverterDetailDto.getVersion());
jpInverter.setGenerationHours(String.valueOf(inverterDetailDto.getFullHour()));
jpInverter.setId(inverterDetailDto.getId());
jpInverter.setCapacity(inverterDetailDto.getPower().intValue());
jpInverter.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
jpInverter.setThirdCode(PVProducerInfoEnum.JLY.getCode());
if (!ObjectUtils.isEmpty(jpInverter.getSequenceNbr())) {
jpInverterMapper.updateById(jpInverter);
} else {
jpInverterMapper.insert(jpInverter);
}
HYGFJPInverterElecHistory hygfjpInverterElecHistory = new HYGFJPInverterElecHistory();
hygfjpInverterElecHistory.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
hygfjpInverterElecHistory.setCreatedTime(new Date());
hygfjpInverterElecHistory.setSnCode(inverterDetailDto.getSn());
hygfjpInverterElecHistory.setUAcCurrent(inverterDetailDto.getIAc1());
hygfjpInverterElecHistory.setVAcCurrent(inverterDetailDto.getIAc2());
hygfjpInverterElecHistory.setWAcCurrent(inverterDetailDto.getIAc3());
hygfjpInverterElecHistory.setUAcVoltage(inverterDetailDto.getUAc1());
hygfjpInverterElecHistory.setVAcVoltage(inverterDetailDto.getUAc2());
hygfjpInverterElecHistory.setUAcVoltage(inverterDetailDto.getUAc3());
hygfjpInverterElecHistory.setThirdCode(PVProducerInfoEnum.JLY.getCode());
hygfjpInverterElecHistory.setTime(System.currentTimeMillis());
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.setDate(today);
hygfjpInverterHistory.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
hygfjpInverterHistory.setInverterId(inverterDetailDto.getId());
hygfjpInverterHistory.setSnCode(inverterDetailDto.getSn());
hygfjpInverterHistory.setThirdCode(PVProducerInfoEnum.JLY.getCode());
hygfjpInverterHistory.setGenerationHours(inverterDetailDto.getFullHour());
hygfjpInverterHistory.setPowerGeneration(inverterDetailDto.getEToday());
SimpleDateFormat format = new SimpleDateFormat(GoLangConstant.datePattern);
if (ObjectUtils.isEmpty(hygfjpInverterHistory.getCreatedTime())) {
hygfjpInverterHistory.setCreatedTime(Timestamp.valueOf(format.format(System.currentTimeMillis())));
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
} else {
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
}
}
}
} }
@Override
public void inverAlramInfo() {
List<String> inverterIds = golangInverterListMapper.getInverterSns();
for (int i = 0; i < inverterIds.size(); i++) {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("pageNo", 1);
requestInfo.put("pageSize", 100);
requestInfo.put("alarmDeviceSn", inverterIds.get(i));
requestInfo.put("alarmBeginTime",DateUtil.today());
requestInfo.put("alarmEndTime", DateUtil.today());
String requestParaminfo = JSON.toJSONString(requestInfo);
List<AlarmDto> result = golangRequestUtil.getResPonse(GoLangConstant.alarmListUrl,
GoLangConstant.requestPost,
requestParaminfo,
GoLangConstant.resovleRule_data_records,
AlarmDto.class
);
for (int j = 0; j < result.size(); j++) {
AlarmDto alarmDto = result.get(j);
HYGFJPInverterWarn hygfjpInverterWarn=new HYGFJPInverterWarn();
hygfjpInverterWarn.setCreatedTime(new Date());
hygfjpInverterWarn.setTime(System.currentTimeMillis());
hygfjpInverterWarn.setSnCode(alarmDto.getAlarmDeviceSn());
hygfjpInverterWarn.setThirdCode(String.valueOf(alarmDto.getStationId()));
hygfjpInverterWarn.setLevel(GoLangConstant.alarmLevel.get(alarmDto.getAlarmLevel()));
hygfjpInverterWarn.setContent(alarmDto.getAlarmMsg());
hygfjpInverterWarn.setThirdCode(PVProducerInfoEnum.JLY.getCode());
hygfjpInverterWarn.setTreatment(alarmDto.getAdvice());
hygfjpInverterWarn.setStartTime(alarmDto.getAlarmBeginTime());
hygfjpInverterWarn.setRecoverTime(alarmDto.getAlarmEndTime());
hygfjpInverterWarn.setState(GoLangConstant.alarmstatus.get(alarmDto.getState()));
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
}
}
}
} }
...@@ -17,7 +17,7 @@ spring.db2.datasource.password=Yeejoin@2020 ...@@ -17,7 +17,7 @@ spring.db2.datasource.password=Yeejoin@2020
spring.db2.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.db2.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
## db3-taosiData ## db3-taosiData
spring.db3.datasource.type: com.alibaba.druid.pool.DruidDataSource spring.db3.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db3.datasource.url=jdbc:TAOS-RS://139.9.170.47:6041/house_pv_data?user=root&password=taosdata&timezone=GMT%2B8&characterEncoding=utf8 spring.db3.datasource.url=jdbc:TAOS-RS://139.9.170.47:6041/house_pv_data?user=root&password=taosdata&characterEncoding=utf8
spring.db3.datasource.username=root spring.db3.datasource.username=root
spring.db3.datasource.password=taosdata spring.db3.datasource.password=taosdata
spring.db3.datasource.driver-class-name=com.taosdata.jdbc.rs.RestfulDriver spring.db3.datasource.driver-class-name=com.taosdata.jdbc.rs.RestfulDriver
......
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