Commit 7b2de331 authored by wujiang's avatar wujiang

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

parents 506eaa65 98722217
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName(value = "td_hygf_day_power" ,autoResultMap = true)
public class HYGFJPDayPower {
private Long createdTime;
private String tationId;
private String hour;
private String yearMonthDay;
private Double power;
}
...@@ -7,7 +7,7 @@ import java.io.Serializable; ...@@ -7,7 +7,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
@Data @Data
@TableName(value = "td_hygf_jp_invertor_elec_history" ,autoResultMap = true) @TableName(value = "td_hygf_jp_station_power_history" ,autoResultMap = true)
public class HYGFJPStationPowerHistory implements Serializable { public class HYGFJPStationPowerHistory implements Serializable {
private Long createdTime; private Long createdTime;
private Double power; private Double power;
......
package com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPDayPower;
public interface HYGFJPDayPowerMapper extends BaseMapper<HYGFJPDayPower> {
}
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.api.householdapi.face.service.impl; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.api.householdapi.face.service.impl;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
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;
...@@ -21,6 +22,7 @@ import com.yeejoin.amos.api.householdapi.face.service.GoLangDataAcquisitionServi ...@@ -21,6 +22,7 @@ import com.yeejoin.amos.api.householdapi.face.service.GoLangDataAcquisitionServi
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper; import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum; import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import fastjson.JSON; import fastjson.JSON;
import org.bouncycastle.crypto.engines.AESLightEngine;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
...@@ -38,6 +40,7 @@ import java.util.concurrent.TimeUnit; ...@@ -38,6 +40,7 @@ import java.util.concurrent.TimeUnit;
@Service @Service
public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionService { public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionService {
private final String dataRequstScheduled = "0 0/10 * * * *"; private final String dataRequstScheduled = "0 0/10 * * * *";
private final String stationPowerScheduled = "0 0 * * * *";
@Autowired @Autowired
private GolangRequestUtil golangRequestUtil; private GolangRequestUtil golangRequestUtil;
@Autowired @Autowired
...@@ -68,9 +71,10 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -68,9 +71,10 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
private HYGFJPInverterWarnMapper hygfjpInverterWarnMapper; private HYGFJPInverterWarnMapper hygfjpInverterWarnMapper;
@Autowired @Autowired
private HYGFJPInverterElecHistoryMapper hygfjpInverterElecHistoryMapper; private HYGFJPInverterElecHistoryMapper hygfjpInverterElecHistoryMapper;
@Autowired
private HYGFJPDayPowerMapper hygfjpDayPowerMapper;
@Scheduled(cron = dataRequstScheduled)
@Scheduled(cron =dataRequstScheduled )
@Override @Override
public void stationList() { public void stationList() {
HashMap<String, Object> requestInfo = new HashMap<>(); HashMap<String, Object> requestInfo = new HashMap<>();
...@@ -89,10 +93,13 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -89,10 +93,13 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
golangStationMapper.insert(golangStationList); golangStationMapper.insert(golangStationList);
} }
} }
@Scheduled(cron =dataRequstScheduled )
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void stationDetail() { public void stationDetail() {
List<String> stationIds = golangStationMapper.getStationIds(); List<String> stationIds = golangStationMapper.getStationIds();
String today = DateUtil.today();
String hour = new Date().getHours() + ":00";
for (int i = 0; i < stationIds.size(); i++) { for (int i = 0; i < stationIds.size(); i++) {
try { try {
TimeUnit.SECONDS.sleep(1); TimeUnit.SECONDS.sleep(1);
...@@ -127,7 +134,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -127,7 +134,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpStation.setLatitude(golangStationDetail.getLatitude()); jpStation.setLatitude(golangStationDetail.getLatitude());
jpStation.setUserName(golangStationDetail.getUsername()); jpStation.setUserName(golangStationDetail.getUsername());
jpStation.setUserPhone(String.valueOf(golangStationDetail.getUsermobile())); jpStation.setUserPhone(String.valueOf(golangStationDetail.getUsermobile()));
jpStation.setStationContact(String.valueOf(golangStationDetail.getMobile())); jpStation.setStationContact(StrUtil.nullToDefault(String.valueOf(golangStationDetail.getMobile()), ""));
jpStation.setModuleCount(Math.toIntExact(golangStationDetail.getModule())); jpStation.setModuleCount(Math.toIntExact(golangStationDetail.getModule()));
//并网类型 //并网类型
jpStation.setOnGridType(GoLangConstant.stationStaus.get(String.valueOf(golangStationDetail.getState()))); jpStation.setOnGridType(GoLangConstant.stationStaus.get(String.valueOf(golangStationDetail.getState())));
...@@ -149,18 +156,37 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -149,18 +156,37 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpStationMapper.insert(jpStation); jpStationMapper.insert(jpStation);
} }
HYGFJPStationPowerHistory hygfjpStationPowerHistory = new HYGFJPStationPowerHistory(); HYGFJPStationPowerHistory hygfjpStationPowerHistory = new HYGFJPStationPowerHistory();
hygfjpStationPowerHistory = new HYGFJPStationPowerHistory();
hygfjpStationPowerHistory.setCreatedTime(System.currentTimeMillis()); hygfjpStationPowerHistory.setCreatedTime(System.currentTimeMillis());
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.updateById(golangStationDetail); hygfjpStationPowerHistoryMapper.insert(hygfjpStationPowerHistory);
HYGFJPDayPower hygfjpDayPower = hygfjpDayPowerMapper.selectOne(new QueryWrapper<HYGFJPDayPower>().
eq("tation_id", String.valueOf(golangStationDetail.getId())).
eq("year_month_day", today).
eq("hour", hour)
);
if (ObjectUtils.isEmpty(hygfjpDayPower)) {
hygfjpDayPower = new HYGFJPDayPower();
}
hygfjpDayPower = new HYGFJPDayPower();
hygfjpDayPower.setTationId(String.valueOf(golangStationDetail.getId()));
hygfjpDayPower.setHour(hour);
hygfjpDayPower.setYearMonthDay(today);
hygfjpDayPower.setPower(golangStationDetail.getPower());
if (ObjectUtils.isEmpty(hygfjpDayPower.getCreatedTime())) {
hygfjpDayPower.setCreatedTime(System.currentTimeMillis());
hygfjpDayPowerMapper.insert(hygfjpDayPower);
} else {
hygfjpDayPowerMapper.insert(hygfjpDayPower);
}
} }
} }
} }
@Scheduled(cron =dataRequstScheduled )
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void collectorList() { public void collectorList() {
List<String> stationIds = golangStationMapper.getStationIds(); List<String> stationIds = golangStationMapper.getStationIds();
...@@ -188,7 +214,8 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -188,7 +214,8 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
} }
} }
} }
@Scheduled(cron =dataRequstScheduled )
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void collectorDetail() { public void collectorDetail() {
List<Long> collectorIds = golangCollectorListMapper.getCollectIds(); List<Long> collectorIds = golangCollectorListMapper.getCollectIds();
...@@ -255,7 +282,8 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -255,7 +282,8 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
} }
} }
} }
@Scheduled(cron =dataRequstScheduled )
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void inverterList() { public void inverterList() {
List<String> stationIds = golangStationMapper.getStationIds(); List<String> stationIds = golangStationMapper.getStationIds();
...@@ -283,7 +311,8 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -283,7 +311,8 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
} }
} }
} }
@Scheduled(cron =dataRequstScheduled )
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void inverterDetail() { public void inverterDetail() {
List<Long> inverterIds = golangInverterListMapper.getInverterIds(); List<Long> inverterIds = golangInverterListMapper.getInverterIds();
...@@ -418,7 +447,8 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -418,7 +447,8 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
} }
} }
} }
@Scheduled(cron =dataRequstScheduled )
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void inverAlramInfo() { public void inverAlramInfo() {
List<String> inverterIds = golangInverterListMapper.getInverterSns(); List<String> inverterIds = golangInverterListMapper.getInverterSns();
...@@ -443,12 +473,19 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -443,12 +473,19 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
); );
for (int j = 0; j < result.size(); j++) { for (int j = 0; j < result.size(); j++) {
AlarmDto alarmDto = result.get(j); AlarmDto alarmDto = result.get(j);
HYGFJPInverterWarn hygfjpInverterWarn = new HYGFJPInverterWarn(); if (!ObjectUtils.isEmpty(alarmDto.getAlarmDeviceSn())) {
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis()); HYGFJPInverterWarn hygfjpInverterWarn = hygfjpInverterWarnMapper.selectOne(new QueryWrapper<HYGFJPInverterWarn>()
.eq("sn_code", alarmDto.getAlarmDeviceSn())
.eq("start_time", alarmDto.getAlarmBeginTime())
.eq("third_station_id", String.valueOf(alarmDto.getStationId()))
);
if (ObjectUtils.isEmpty(hygfjpInverterWarn)) {
hygfjpInverterWarn = new HYGFJPInverterWarn();
}
hygfjpInverterWarn.setTime(System.currentTimeMillis()); hygfjpInverterWarn.setTime(System.currentTimeMillis());
hygfjpInverterWarn.setTimeLong(System.currentTimeMillis()); hygfjpInverterWarn.setTimeLong(System.currentTimeMillis());
hygfjpInverterWarn.setSnCode(alarmDto.getAlarmDeviceSn()); hygfjpInverterWarn.setSnCode(alarmDto.getAlarmDeviceSn());
hygfjpInverterWarn.setThirdCode(String.valueOf(alarmDto.getStationId())); hygfjpInverterWarn.setThirdStationId(String.valueOf(alarmDto.getStationId()));
hygfjpInverterWarn.setLevel(GoLangConstant.alarmLevel.get(alarmDto.getAlarmLevel())); hygfjpInverterWarn.setLevel(GoLangConstant.alarmLevel.get(alarmDto.getAlarmLevel()));
hygfjpInverterWarn.setContent(alarmDto.getAlarmMsg()); hygfjpInverterWarn.setContent(alarmDto.getAlarmMsg());
hygfjpInverterWarn.setThirdCode(PVProducerInfoEnum.JLY.getCode()); hygfjpInverterWarn.setThirdCode(PVProducerInfoEnum.JLY.getCode());
...@@ -456,9 +493,15 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -456,9 +493,15 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
hygfjpInverterWarn.setStartTime(alarmDto.getAlarmBeginTime()); hygfjpInverterWarn.setStartTime(alarmDto.getAlarmBeginTime());
hygfjpInverterWarn.setRecoverTime(alarmDto.getAlarmEndTime()); hygfjpInverterWarn.setRecoverTime(alarmDto.getAlarmEndTime());
hygfjpInverterWarn.setState(GoLangConstant.alarmstatus.get(alarmDto.getState())); hygfjpInverterWarn.setState(GoLangConstant.alarmstatus.get(alarmDto.getState()));
if (ObjectUtils.isEmpty(hygfjpInverterWarn.getCreatedTime())) {
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis());
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
} else {
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn); hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
} }
} }
} }
}
}
} }
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