Commit 34cdfd81 authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://36.40.66.175:5000/moa/amos-boot-biz into developer

parents a522921b ff3dddf2
......@@ -38,7 +38,6 @@ import java.util.concurrent.TimeUnit;
@Service
public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionService {
//定时任务执行频率 当前为10分钟一次
//锦浪云请求工具封装
......@@ -149,7 +148,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpStation.setUserName(golangStationDetail.getUsername());
jpStation.setUserPhone(String.valueOf(golangStationDetail.getUsermobile()));
jpStation.setStationContact(String.valueOf(golangStationDetail.getMobile()).toLowerCase().replace("null", ""));
jpStation.setModuleCount(ObjectUtils.isEmpty(Math.toIntExact(golangStationDetail.getModule()))?0:Math.toIntExact(golangStationDetail.getModule()));
jpStation.setModuleCount(ObjectUtils.isEmpty(Math.toIntExact(golangStationDetail.getModule())) ? 0 : Math.toIntExact(golangStationDetail.getModule()));
//并网类型
jpStation.setState(GoLangConstant.stationStaus.get(String.valueOf(golangStationDetail.getState())));
jpStation.setThirdStationId(String.valueOf(golangStationDetail.getId()));
......@@ -509,7 +508,6 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
hygfjpInverterWarn = new HYGFJPInverterWarn();
}
hygfjpInverterWarn.setTime(System.currentTimeMillis());
hygfjpInverterWarn.setTimeLong(System.currentTimeMillis());
hygfjpInverterWarn.setSnCode(alarmDto.getAlarmDeviceSn());
hygfjpInverterWarn.setThirdStationId(String.valueOf(alarmDto.getStationId()));
hygfjpInverterWarn.setLevel(GoLangConstant.alarmLevel.get(alarmDto.getAlarmLevel()));
......@@ -517,7 +515,14 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
hygfjpInverterWarn.setThirdCode(PVProducerInfoEnum.JLY.getCode());
hygfjpInverterWarn.setTreatment(alarmDto.getAdvice());
hygfjpInverterWarn.setStartTime(alarmDto.getAlarmBeginTime());
hygfjpInverterWarn.setRecoverTime(alarmDto.getAlarmEndTime());
hygfjpInverterWarn.setRecoverTime(null);
if (!ObjectUtils.isEmpty(alarmDto.getAlarmEndTime())) {
hygfjpInverterWarn.setRecoverTime(alarmDto.getAlarmEndTime());
}
hygfjpInverterWarn.setTimeLong(null);
if (!ObjectUtils.isEmpty(alarmDto.getAlarmEndTime()) && !ObjectUtils.isEmpty(alarmDto.getAlarmEndTime())) {
hygfjpInverterWarn.setTimeLong(alarmDto.getAlarmEndTime() - alarmDto.getAlarmBeginTime());
}
hygfjpInverterWarn.setState(GoLangConstant.alarmstatus.get(alarmDto.getState()));
if (ObjectUtils.isEmpty(hygfjpInverterWarn.getCreatedTime())) {
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis());
......
......@@ -770,7 +770,6 @@ public class ImasterDataServiceImpl implements ImasterDataService {
hygfjpInverterWarn = new HYGFJPInverterWarn();
}
hygfjpInverterWarn.setTime(System.currentTimeMillis());
hygfjpInverterWarn.setTimeLong(System.currentTimeMillis());
hygfjpInverterWarn.setSnCode(alarmDto.getEsnCode());
hygfjpInverterWarn.setThirdStationId(String.valueOf(alarmDto.getStationCode()));
hygfjpInverterWarn.setLevel(ImasterConstant.alarmLevel.get(alarmDto.getLev().toString()));
......@@ -778,6 +777,8 @@ public class ImasterDataServiceImpl implements ImasterDataService {
hygfjpInverterWarn.setThirdCode(PVProducerInfoEnum.HUAWEI.getCode());
hygfjpInverterWarn.setTreatment(alarmDto.getDevName());
hygfjpInverterWarn.setStartTime(alarmDto.getRaiseTime());
hygfjpInverterWarn.setRecoverTime(null);
hygfjpInverterWarn.setTimeLong(null);
hygfjpInverterWarn.setState(ImasterConstant.alarmstatus.get(alarmDto.getStatus().toString()));
if (ObjectUtils.isEmpty(hygfjpInverterWarn.getCreatedTime())) {
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis());
......
package com.yeejoin.amos.api.householdapi.face.service.impl;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -1053,12 +1054,12 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
if (!CollectionUtils.isEmpty(result)) {
for (KsolarAlarmDto ksolarAlarmDto : result) {
if (!ObjectUtils.isEmpty(ksolarAlarmDto.getInverterId())) {
String startTime = ksolarAlarmDto.getSaveTime();
String recoverTime = ksolarAlarmDto.getRemoveTime();
String pattern = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
Date startTimeL = sdf.parse(startTime);
Date recoverTimeL = sdf.parse(recoverTime);
// String startTime = ksolarAlarmDto.getSaveTime();
// String recoverTime = ksolarAlarmDto.getRemoveTime();
// String pattern = "yyyy-MM-dd HH:mm:ss";
// SimpleDateFormat sdf = new SimpleDateFormat(pattern);
// Date startTimeL = sdf.parse(startTime);
// Date recoverTimeL = sdf.parse(recoverTime);
String snCode=null;
......@@ -1072,7 +1073,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
}
HYGFJPInverterWarn hygfjpInverterWarn = hygfjpInverterWarnMapper.selectOne(new QueryWrapper<HYGFJPInverterWarn>()
.eq("sn_code",snCode)
.eq("start_time", startTimeL.getTime())
.eq("start_time",DateUtil.parse(ksolarAlarmDto.getSaveTime(), DatePattern.NORM_DATETIME_PATTERN).getTime())
.eq("third_code", PVProducerInfoEnum.KSOLAR.getCode())
.eq("third_station_id", ksolarAlarmDto.getStationId())
);
......@@ -1081,16 +1082,22 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
}
hygfjpInverterWarn.setTime(System.currentTimeMillis());
hygfjpInverterWarn.setTimeLong(System.currentTimeMillis());
hygfjpInverterWarn.setSnCode(snCode);
hygfjpInverterWarn.setThirdStationId(ksolarAlarmDto.getStationId());
hygfjpInverterWarn.setLevel(KSolarConstant.alarmLevel.get(ksolarAlarmDto.getLevels()));
hygfjpInverterWarn.setContent(ksolarAlarmDto.getMessage());
hygfjpInverterWarn.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
hygfjpInverterWarn.setTreatment(ksolarAlarmDto.getSolution());
hygfjpInverterWarn.setStartTime(startTimeL.getTime());
hygfjpInverterWarn.setRecoverTime(recoverTimeL.getTime());
hygfjpInverterWarn.setStartTime(DateUtil.parse(ksolarAlarmDto.getSaveTime(), DatePattern.NORM_DATETIME_PATTERN).getTime());
hygfjpInverterWarn.setState(KSolarConstant.alarmstatus.get(ksolarAlarmDto.getStatus()));
hygfjpInverterWarn.setTimeLong(null);
hygfjpInverterWarn.setRecoverTime(null);
if(StringUtils.isNotBlank(ksolarAlarmDto.getRemoveTime())){
hygfjpInverterWarn.setRecoverTime(DateUtil.parse(ksolarAlarmDto.getRemoveTime(), DatePattern.NORM_DATETIME_PATTERN).getTime());
}
if(!ObjectUtils.isEmpty(ksolarAlarmDto.getSaveTime())&&!ObjectUtils.isEmpty(ksolarAlarmDto.getRemoveTime())){
hygfjpInverterWarn.setTimeLong(hygfjpInverterWarn.getRecoverTime()-hygfjpInverterWarn.getStartTime());
}
if (ObjectUtils.isEmpty(hygfjpInverterWarn.getCreatedTime())) {
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis());
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
......
package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
/**
* @description:
* @author: tw
* @createDate: 2023/11/8
*/
@Data
@Accessors(chain = true)
@TableName("td_hygf_all_generate")
public class AllGenerate {
@Id
private Long createdTime;
/**
* 第三方电站id
*/
@TableField("third_station_id")
private String thirdStationId;
/**
* 年
*/
@TableField("year_time")
private String yearTime;
/**
* 平均功率
*/
@TableField("year")
private String year;
/**
* 平均功率
*/
@TableField("generate")
private Double generate;
public AllGenerate(Long createdTime, String thirdStationId, String yearTime, String year, Double generate) {
this.createdTime = createdTime;
this.thirdStationId = thirdStationId;
this.yearTime = yearTime;
this.year = year;
this.generate = generate;
}
public AllGenerate() {
}
}
......@@ -24,19 +24,30 @@ public class DayGenerate {
private String thirdStationId;
/**
* 小时
*
*/
@TableField("hour_time")
private String hourTime;
@TableField("day_time")
private String dayTime;
/**
* 月份
*/
@TableField("month_day")
private String monthDay;
@TableField("year_month")
private String yearMonth;
/**
* 发电量
*/
@TableField("generate")
private Double generate;
public DayGenerate(Long createdTime, String thirdStationId, String dayTime, String yearMonth, Double generate) {
this.createdTime = createdTime;
this.thirdStationId = thirdStationId;
this.dayTime = dayTime;
this.yearMonth = yearMonth;
this.generate = generate;
}
public DayGenerate() {
}
}
......@@ -24,27 +24,28 @@ public class MonthGenerate {
private String thirdStationId;
/**
*
*
*/
@TableField("day_time")
private String dayTime;
@TableField("month_time")
private String monthTime;
/**
* 月份
* 平均功率
*/
@TableField("year_month")
private String yearMonth;
@TableField("year")
private String year;
/**
* 发电量
* 平均功率
*/
@TableField("generate")
private Double generate;
public MonthGenerate(Long createdTime, String thirdStationId, String dayTime, String yearMonth, Double generate) {
public MonthGenerate(Long createdTime, String thirdStationId, String monthTime, String year, Double generate) {
this.createdTime = createdTime;
this.thirdStationId = thirdStationId;
this.dayTime = dayTime;
this.yearMonth = yearMonth;
this.monthTime = monthTime;
this.year = year;
this.generate = generate;
}
......
......@@ -26,25 +26,24 @@ public class YearGenerate {
/**
* 年
*/
@TableField("month_time")
private String monthTime;
@TableField("year_time")
private String yearTime;
/**
* 平均功率
*
*/
@TableField("year")
private String year;
/**
* 平均功率
*
*/
@TableField("generate")
private Double generate;
public YearGenerate(Long createdTime, String thirdStationId, String monthTime, String year, Double generate) {
public YearGenerate(Long createdTime, String thirdStationId, String yearTime, String year, Double generate) {
this.createdTime = createdTime;
this.thirdStationId = thirdStationId;
this.monthTime = monthTime;
this.yearTime = yearTime;
this.year = year;
this.generate = generate;
}
......
package com.yeejoin.amos.boot.module.hygf.api.service;
/**
* @description:
* @author: tw
* @createDate: 2023/11/8
*/
public interface IAllGenerateService {
}
package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.AllGenerate;
public interface AllGenerateMapper extends BaseMapper<AllGenerate> {
}
......@@ -155,8 +155,7 @@
<select id="getJpStation" resultType="com.yeejoin.amos.boot.module.hygf.api.entity.JpStation">
select
`sequence_nbr` sequenceNbr,
third_station_id thirdStationId
*
from hygf_jp_station
<where>
......
......@@ -353,7 +353,7 @@ public class JpStationController extends BaseController {
public Object getPowerqx() {
return jpStationMapper.getJpStation();
return jpStationMapper.getJpStation(null);
}
}
......@@ -24,8 +24,8 @@ public class WindSpeedScheduled {
@Autowired
TdHygfJpInvertorElecHistoryServiceImpl tdHygfJpInvertorElecHistoryServiceImpl;
@Autowired
DayGenerateServiceImpl dayGenerateServiceImpl;
// @Autowired
// DayGenerateServiceImpl dayGenerateServiceImpl;
@Scheduled(cron = "${cheduled.crons}")
private void initData() {
......@@ -38,10 +38,10 @@ public class WindSpeedScheduled {
//发电量
@Scheduled(cron = "${generate.crons}")
private void initGenerateData() {
//发电量
dayGenerateServiceImpl.getGenerate();
}
// @Scheduled(cron = "${generate.crons}")
// private void initGenerateData() {
// //发电量
// dayGenerateServiceImpl.getGenerate();
// }
}
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.yeejoin.amos.boot.module.hygf.api.dto.AllGenerateDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.AllGenerate;
import com.yeejoin.amos.boot.module.hygf.api.service.IAllGenerateService;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.AllGenerateMapper;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
/**
* @description:
* @author: tw
* @createDate: 2023/11/8
*/
@Service
public class AllGenerateServiceImpl extends BaseService<AllGenerateDto, AllGenerate, AllGenerateMapper> implements IAllGenerateService {
}
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.module.hygf.api.dto.AllGenerateDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.DayGenerateDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IAllGenerateService;
import com.yeejoin.amos.boot.module.hygf.api.service.IDayGenerateService;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.AllGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.DayGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.MonthGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.YearGenerateMapper;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
/**
* @description:
* @author: tw
......@@ -30,106 +15,7 @@ import java.util.TimeZone;
*/
@Service
public class DayGenerateServiceImpl extends BaseService<DayGenerateDto, DayGenerate, DayGenerateMapper> implements IDayGenerateService {
@Autowired
JpStationMapper jpStationMapper;
@Autowired
MonthGenerateMapper monthGenerateMapper;
@Autowired
YearGenerateMapper yearGenerateMapper;
@Autowired
AllGenerateMapper allGenerateMapper;
@Autowired
AllGenerateServiceImpl allGenerateServiceImpl;
@Autowired
MonthGenerateServiceImpl monthGenerateServiceImpl;
@Autowired
YearGenerateServiceImpl yearGenerateServiceImpl;
public void getGenerate() {
LambdaQueryWrapper<JpStation> wrapper = new LambdaQueryWrapper<JpStation>();
Date dayTime=new Date();
SimpleDateFormat simpleDateFormatDay = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat simpleDateFormatMonth = new SimpleDateFormat("yyyy-MM");
SimpleDateFormat simpleDateFormatYear = new SimpleDateFormat("yyyy");
String formattedDateday =simpleDateFormatDay.format(dayTime);
String formattedDateMonth =simpleDateFormatMonth.format(dayTime);
String formattedDateYear =simpleDateFormatYear.format(dayTime);
long utcMillis = dayTime.getTime() ;
// 获取所有场站信息
List<JpStation> list=jpStationMapper.selectList(wrapper);
//查询当日日发电量
LambdaQueryWrapper<MonthGenerate> wrappermonth = new LambdaQueryWrapper<MonthGenerate>();
wrappermonth.eq(MonthGenerate::getDayTime,formattedDateday);
wrappermonth.eq(MonthGenerate::getYearMonth,formattedDateMonth);
List<MonthGenerate> listmonth= monthGenerateMapper.selectList(wrappermonth);
//查询当月月发电量
LambdaQueryWrapper<YearGenerate> wrapperyear = new LambdaQueryWrapper<YearGenerate>();
wrapperyear.eq(YearGenerate::getMonthTime,formattedDateMonth);
wrapperyear.eq(YearGenerate::getYear,formattedDateYear);
List<YearGenerate> listyear= yearGenerateMapper.selectList(wrapperyear);
//查询当年年发电量
LambdaQueryWrapper<AllGenerate> wrapperall = new LambdaQueryWrapper<AllGenerate>();
wrapperall.eq(AllGenerate::getYear,formattedDateYear);
List<AllGenerate> listall= allGenerateMapper.selectList(wrapperall);
List<MonthGenerate> mo=new ArrayList<>();
List<YearGenerate> ye=new ArrayList<>();
List<AllGenerate> al=new ArrayList<>();
//更新数据
if (list!=null&&!list.isEmpty()){
int nu=1;
for (JpStation jpStation : list) {
MonthGenerate monthGenerate=null;
YearGenerate yearGenerate=null;
AllGenerate allGenerate=null;
//更新日发电量
if(listmonth!=null&&!listmonth.isEmpty()){
monthGenerate =new MonthGenerate(utcMillis+nu, jpStation.getThirdStationId(), formattedDateday, formattedDateMonth, jpStation.getDayGenerate());
for (MonthGenerate generate : listmonth) {
if(generate.getYearMonth().equals(formattedDateMonth)&&generate.getThirdStationId().equals(jpStation.getThirdStationId())&&generate.getDayTime().equals(formattedDateday)){
monthGenerate =new MonthGenerate(generate.getCreatedTime(), jpStation.getThirdStationId(), formattedDateday, formattedDateMonth, jpStation.getDayGenerate());
break;
}
}
} else{
monthGenerate =new MonthGenerate(utcMillis+nu, jpStation.getThirdStationId(), formattedDateday, formattedDateMonth, jpStation.getDayGenerate());
}
//更新年发电量
if(listyear!=null&&!listyear.isEmpty()){
yearGenerate =new YearGenerate(utcMillis+nu, jpStation.getThirdStationId(), formattedDateMonth, formattedDateYear, jpStation.getDayGenerate());
for (YearGenerate yearGenera : listyear) {
if(yearGenera.getYear().equals(formattedDateYear)&&yearGenera.getThirdStationId().equals(jpStation.getThirdStationId())&&yearGenera.getMonthTime().equals(formattedDateMonth)){
yearGenerate =new YearGenerate(yearGenera.getCreatedTime(), jpStation.getThirdStationId(), formattedDateMonth, formattedDateYear, jpStation.getDayGenerate());
break;
}
}
} else{
yearGenerate =new YearGenerate(utcMillis+nu, jpStation.getThirdStationId(), formattedDateMonth, formattedDateYear, jpStation.getDayGenerate());
}
//更新年发电量
if(listall!=null&&!listall.isEmpty()){
allGenerate =new AllGenerate(utcMillis+nu, jpStation.getThirdStationId(), formattedDateYear, formattedDateYear, jpStation.getDayGenerate());
for (AllGenerate generate : listall) {
if(generate.getYear().equals(formattedDateYear)&&generate.getThirdStationId().equals(jpStation.getThirdStationId())){
allGenerate =new AllGenerate(generate.getCreatedTime(), jpStation.getThirdStationId(), formattedDateYear, formattedDateYear, jpStation.getDayGenerate());
break;
}
}
} else{
allGenerate =new AllGenerate(utcMillis+nu, jpStation.getThirdStationId(), formattedDateYear, formattedDateYear, jpStation.getDayGenerate());
}
mo.add(monthGenerate);
ye.add(yearGenerate);
al.add(allGenerate);
nu=nu+1;
}
//更新保存
allGenerateServiceImpl.saveBatch(al);
monthGenerateServiceImpl.saveBatch(mo);
yearGenerateServiceImpl.saveBatch(ye);
}
}
......
......@@ -373,41 +373,22 @@ public class TDBigScreenAnalyseController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "场站预警信息统计图 - 雷达图", httpMethod = "GET")
@GetMapping("/equipWarningRadarMap")
public ResponseModel<Map<String, Object>> assessIndexRadarMap(@RequestParam(required = false, value = "stationCode") String stationCode) {
public ResponseModel<List<Map<String, Object>>> assessIndexRadarMap(@RequestParam(required = false, value = "stationCode") String stationCode) {
if (CharSequenceUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getFanGatewayId();
}
List<Map<String, Object>> list = fanHealthIndexMapper.equipWarningRadarMapByTd(stationCode);
Map<String, Integer> warningNumMap = list.stream().collect(Collectors.toMap(t -> t.get("warningname").toString(), t -> Integer.parseInt(t.get("num").toString())));
List<String> warningList = Arrays.asList("危险", "注意", "警告");
List<Integer> data = new ArrayList<>();
List<List<Integer>> resultData = new ArrayList<>();
List<String> warningList = Arrays.asList("注意", "警告", "危险");
List<Map<String, Object>> resultList = new ArrayList<>();
warningList.forEach(item -> {
HashMap<String, Object> map = new HashMap<>();
map.put("text", item);
map.put("name", item);
map.put("value", warningNumMap.getOrDefault(item, 0));
resultList.add(map);
data.add(warningNumMap.getOrDefault(item, 0));
});
resultData.add(data);
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("radar", resultList);
resultMap.put("array", resultData);
return ResponseHelper.buildResponse(resultMap);
// HashMap<String, Object> resultMap = new HashMap<>();
// List<String> data = new ArrayList<>();
// list.forEach(item -> {
// HashMap<String, Object> map = new HashMap<>();
// map.put("text", item.get("warningName"));
// resultList.add(map);
// data.add(item.get("num").toString());
// });
//
return ResponseHelper.buildResponse(resultList);
}
......
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