Commit 8b915684 authored by chenzhao's avatar chenzhao

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

parents e79c0dc8 c8da2863
......@@ -127,4 +127,5 @@ public class InverterDetailDto {
private Double pow30;
private Double pow31;
private Double pow32;
private Double inverterTemperature;
}
......@@ -92,6 +92,22 @@ public class TdHYGFInverterDayGenerate implements Serializable {
*/
private Double acc4;
/**
* 直流电流1
*/
private Double pv1;
/**
* 直流电流2
*/
private Double pv2;
/**
* 直流电流3
*/
private Double pv3;
/**
* 直流电流4
*/
private Double pv4;
/**
* 总功率
*/
private Double totalPower;
......@@ -122,6 +138,9 @@ public class TdHYGFInverterDayGenerate implements Serializable {
/**
* IGBT温度
*/
private Double igbtTmep;
private Double igbtTemp;
private Double income;
private Double fullhour;
}
......@@ -24,13 +24,13 @@ public class TdHYGFInverterMonthGenerate implements Serializable {
*/
private String snCode;
/**
*日 yyyy-MM
*日 yyyy-MM-dd
*/
private String monthTime;
private String dayTime;
/**
*月 yyyy
*/
private String year;
private String yearMonth;
/**
* 发电量
*/
......@@ -39,5 +39,6 @@ public class TdHYGFInverterMonthGenerate implements Serializable {
* 满发小时数
*/
private Double fullhour;
private Double income;
}
package com.yeejoin.amos.boot.module.hygf.api.dto;
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.springframework.data.annotation.Id;
import java.io.Serializable;
/**
* @description:
* @author: tw
* @createDate: 2023/11/8
* @author DELL
*/
@Data
public class AllGenerateDto {
@TableName(value = "td_hygf_inverter_total_generate" ,autoResultMap = true)
public class TdHYGFInverterTotalGenerate implements Serializable {
/**
* 创建时间
*/
private Long createdTime;
/**
* 第三方站id
* 第三方站id
*/
private String thirdStationId;
/**
* 年
* sncode
*/
private String snCode;
/**
*日 yyyy-MM
*/
private String yearTime;
/**
* 平均功率
*月 yyyy
*/
private String year;
/**
* 平均功率
* 发电量
*/
private Double generate;
/**
* 满发小时数
*/
private Double fullhour;
private Double income;
}
......@@ -26,7 +26,7 @@ public class TdHYGFInverterYearGenerate implements Serializable {
/**
*日 yyyy-MM
*/
private String yearTime;
private String monthTime;
/**
*月 yyyy
*/
......@@ -39,5 +39,6 @@ public class TdHYGFInverterYearGenerate implements Serializable {
* 满发小时数
*/
private Double fullhour;
private Double income;
}
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.TdHYGFInverterTotalGenerate;
public interface TdHYGFInverterTotalGenerateMapper extends BaseMapper<TdHYGFInverterTotalGenerate> {
}
......@@ -100,6 +100,9 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
@Autowired
private TdHYGFStationYearGenerateMapper tdHYGFStationYearGenerateMapper;
@Autowired
private TdHYGFInverterTotalGenerateMapper tdHYGFInverterTotalGenerateMapper;
@Scheduled(cron = "${dataRequstScheduled.jinlangyun}")
@Override
public void stationList() {
......@@ -525,7 +528,9 @@ 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));
HYGFJPInverterHistory hygfjpInverterHistory = hygfjpInverterHistoryMapper.selectOne(new QueryWrapper<HYGFJPInverterHistory>()
.eq("sn_code", inverterDetailDto.getSn())
.eq("date", today));
if (ObjectUtils.isEmpty(hygfjpInverterHistory)) {
hygfjpInverterHistory = new HYGFJPInverterHistory();
}
......@@ -568,6 +573,12 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
tdHYGFInverterDayGenerate.setAcc2(inverterDetailDto.getIPv2());
tdHYGFInverterDayGenerate.setAcc3(inverterDetailDto.getIPv3());
tdHYGFInverterDayGenerate.setAcc4(inverterDetailDto.getIPv4());
//功率
tdHYGFInverterDayGenerate.setPv1(inverterDetailDto.getPow1());
tdHYGFInverterDayGenerate.setPv2(inverterDetailDto.getPow2());
tdHYGFInverterDayGenerate.setPv3(inverterDetailDto.getPow3());
tdHYGFInverterDayGenerate.setPv4(inverterDetailDto.getPow4());
tdHYGFInverterDayGenerate.setTotalPower(inverterDetailDto.getPower());
tdHYGFInverterDayGenerate.setFrequency(String.valueOf(inverterDetailDto.getPac()));
tdHYGFInverterDayGenerate.setPowerFactor(inverterDetailDto.getPowerFactor());
......@@ -575,22 +586,26 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
tdHYGFInverterDayGenerate.setMonthGen(inverterDetailDto.getEMonth());
tdHYGFInverterDayGenerate.setYearGen(inverterDetailDto.getEMonth());
tdHYGFInverterDayGenerate.setTotalGen(inverterDetailDto.getETotal());
tdHYGFInverterDayGenerate.setIgbtTemp(inverterDetailDto.getInverterTemperature());
tdHYGFInverterDayGenerate.setIncome(null);
tdHYGFInverterDayGenerate.setFullhour(jpInverter.getDayPowerGeneration()/jpInverter.getCapacity());
tdHYGFInverterDayGenerateMapper.insert(tdHYGFInverterDayGenerate);
//户用场站月发电量
Date today1 = new Date();
TdHYGFInverterMonthGenerate tdHYGFInverterMonthGenerate = tdHYGFInverterMonthGenerateMapper.selectOne(new QueryWrapper<TdHYGFInverterMonthGenerate>()
.eq("third_station_id",inverterDetailDto.getStationId())
.eq("month_time",DateUtil.format(today1, "yyyy-MM"))
.eq("year",DateUtil.format(today1, "yyyy")));
.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(ObjectUtils.isEmpty(tdHYGFInverterMonthGenerate)){
tdHYGFInverterMonthGenerate=new TdHYGFInverterMonthGenerate();
}
tdHYGFInverterMonthGenerate.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
tdHYGFInverterMonthGenerate.setSnCode(String.valueOf(inverterDetailDto.getSn()));
tdHYGFInverterMonthGenerate.setMonthTime(DateUtil.format(today1, "yyyy-MM"));
tdHYGFInverterMonthGenerate.setYear(DateUtil.format(today1, "yyyy"));
tdHYGFInverterMonthGenerate.setGenerate(inverterDetailDto.getEMonth());
tdHYGFInverterMonthGenerate.setFullhour(inverterDetailDto.getEMonth()/inverterDetailDto.getPower());
tdHYGFInverterMonthGenerate.setThirdStationId(jpInverter.getThirdStationId());
tdHYGFInverterMonthGenerate.setSnCode(String.valueOf(jpInverter.getSnCode()));
tdHYGFInverterMonthGenerate.setDayTime(DateUtil.format(today1, "yyyy-MM-dd"));
tdHYGFInverterMonthGenerate.setYearMonth(DateUtil.format(today1, "yyyy-MM"));
tdHYGFInverterMonthGenerate.setGenerate(jpInverter.getDayPowerGeneration());
tdHYGFInverterMonthGenerate.setFullhour(jpInverter.getDayPowerGeneration()/jpInverter.getCapacity());
if(ObjectUtils.isEmpty(tdHYGFInverterMonthGenerate.getCreatedTime())){
tdHYGFInverterMonthGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFInverterMonthGenerateMapper.insert(tdHYGFInverterMonthGenerate);
......@@ -599,24 +614,46 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
}
//户用场站年发电量
TdHYGFInverterYearGenerate tdHYGFInverterYearGenerate = tdHYGFInverterYearGenerateMapper.selectOne(new QueryWrapper<TdHYGFInverterYearGenerate>()
.eq("third_station_id",inverterDetailDto.getStationId())
.eq("year_time",DateUtil.format(today1, "yyyy"))
.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(ObjectUtils.isEmpty(tdHYGFInverterYearGenerate)){
tdHYGFInverterYearGenerate = new TdHYGFInverterYearGenerate();
}
tdHYGFInverterYearGenerate.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
tdHYGFInverterYearGenerate.setSnCode(inverterDetailDto.getSn());
tdHYGFInverterYearGenerate.setYearTime(DateUtil.format(today1, "yyyy"));
tdHYGFInverterYearGenerate.setThirdStationId(jpInverter.getThirdStationId());
tdHYGFInverterYearGenerate.setSnCode(jpInverter.getSnCode());
tdHYGFInverterYearGenerate.setMonthTime(DateUtil.format(today1, "yyyy-MM"));
tdHYGFInverterYearGenerate.setYear(DateUtil.format(today1, "yyyy"));
tdHYGFInverterYearGenerate.setGenerate(inverterDetailDto.getEYear());
tdHYGFInverterYearGenerate.setFullhour(inverterDetailDto.getEYear()/inverterDetailDto.getPower());
tdHYGFInverterYearGenerate.setGenerate(jpInverter.getMonthPowerGeneration());
tdHYGFInverterYearGenerate.setFullhour(jpInverter.getMonthPowerGeneration()/jpInverter.getCapacity());
if(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(ObjectUtils.isEmpty(tdHYGFInverterTotalGenerate)){
tdHYGFInverterTotalGenerate = new TdHYGFInverterTotalGenerate();
}
tdHYGFInverterTotalGenerate.setThirdStationId(jpInverter.getThirdStationId());
tdHYGFInverterTotalGenerate.setSnCode(jpInverter.getSnCode());
tdHYGFInverterTotalGenerate.setYearTime(DateUtil.format(today1, "yyyy"));
tdHYGFInverterTotalGenerate.setYear(DateUtil.format(today1, "yyyy"));
tdHYGFInverterTotalGenerate.setGenerate(jpInverter.getYearPowerGeneration());
tdHYGFInverterTotalGenerate.setFullhour(jpInverter.getYearPowerGeneration()/jpInverter.getCapacity());
if(ObjectUtils.isEmpty(tdHYGFInverterTotalGenerate.getCreatedTime())){
tdHYGFInverterTotalGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFInverterTotalGenerateMapper.insert(tdHYGFInverterTotalGenerate);
}else {
tdHYGFInverterTotalGenerateMapper.insert(tdHYGFInverterTotalGenerate);
}
}
}
}
......
......@@ -40,50 +40,39 @@ import java.util.stream.Collectors;
public class ImasterDataServiceImpl implements ImasterDataService {
//户用光伏日发电量
@Autowired
JpInverterElectricityMapper jpInverterElectricityMapper;
//北向请求工具封装
@Autowired
private ImasterUtils imasterUtils;
//北向mapper
@Autowired
private ImasterStationMapper imasterStationMapper;
//北向mapper
@Autowired
private ImasterCollectorListMapper imasterCollectorListMapper;
//北向mapper
@Autowired
private ImasterInverterListMapper imasterInverterListMapper;
//北向mapper
@Autowired
private ImasterInverterListDetailsMapper imasterInverterListDetailsMapper;
//北向mapper
@Autowired
private ImasterStationDetailsMapper imasterStationDetailsMapper;
//北向mapper
@Autowired
private ImasterInverterMonthMapper imasterInverterMonthMapper;
//北向mapper
@Autowired
private ImasterInverterYearMapper imasterInverterYearMapper;
//北向mapper
@Autowired
private ImasterStationMonthMapper imasterStationMonthMapper;
//北向mapper
@Autowired
private ImasterStationYearMapper imasterStationYearMapper;
//监盘场站mapper
@Autowired
private JpStationMapper jpStationMapper;
......@@ -93,7 +82,6 @@ public class ImasterDataServiceImpl implements ImasterDataService {
//监盘逆变器mapper
@Autowired
private JpInverterMapper jpInverterMapper;
//户用光伏场站历史mapper
@Autowired
private HYGFJPStationPowerHistoryMapper hygfjpStationPowerHistoryMapper;
......@@ -112,12 +100,6 @@ public class ImasterDataServiceImpl implements ImasterDataService {
//户用光伏日发电量
@Autowired
private HYGFJPDayPowerMapper hygfjpDayPowerMapper;
//户用光伏日发电量
@Autowired
JpInverterElectricityMapper jpInverterElectricityMapper;
@Autowired
private TdHYGFInverterDayGenerateMapper tdHYGFInverterDayGenerateMapper;
@Autowired
......@@ -130,6 +112,8 @@ public class ImasterDataServiceImpl implements ImasterDataService {
private TdHYGFStationMonthGenerateMapper tdHYGFStationMonthGenerateMapper;
@Autowired
private TdHYGFStationYearGenerateMapper tdHYGFStationYearGenerateMapper;
@Autowired
private TdHYGFInverterTotalGenerateMapper tdHYGFInverterTotalGenerateMapper;
@Scheduled(cron = "${dataRequstScheduled.huawei}")
......@@ -245,8 +229,8 @@ public class ImasterDataServiceImpl implements ImasterDataService {
jpStation.setThirdCode(PVProducerInfoEnum.HUAWEI.getCode());
// jpStation.setRealTimePower(imasterStationDetail.getPower());
// jpStation.setOnGridType(GoLangConstant.intoNetWorkStatus.get(String.valueOf(imasterStationDetail.getStationtypenew())));
jpStation.setDayGenerate(imasterStationDetail.getDay_power() );
jpStation.setMonthGenerate(imasterStationDetail.getMonth_power() );
jpStation.setDayGenerate(imasterStationDetail.getDay_power());
jpStation.setMonthGenerate(imasterStationDetail.getMonth_power());
// jpStation.setMonthGenerate(imasterStationDetail.getMonthPower());
// jpStation.setYearGenerate(imasterStationDetail.getYearenergy());
......@@ -258,7 +242,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
// 获取年发电量 年收益
for (ImasterStationDetailsYear imasterStationDetailsYear : result3
) {
if(imasterStationDetailsYear.getCollectTime().equals(String.valueOf(yearStart))) {
if (imasterStationDetailsYear.getCollectTime().equals(String.valueOf(yearStart))) {
jpStation.setYearGenerate(imasterStationDetailsYear.getInverter_power());
jpStation.setYearIncome(imasterStationDetailsYear.getPower_profit());
imasterStationDetailsYear.setStationCode(imasterStationList.getPlantCode());
......@@ -270,9 +254,9 @@ public class ImasterDataServiceImpl implements ImasterDataService {
// 获取月收益
for (ImasterStationDetailsMonth imasterStationDetailsMonth: result2
for (ImasterStationDetailsMonth imasterStationDetailsMonth : result2
) {
if(imasterStationDetailsMonth.getCollectTime().equals(String.valueOf(monthStart))) {
if (imasterStationDetailsMonth.getCollectTime().equals(String.valueOf(monthStart))) {
jpStation.setMonthIncome(imasterStationDetailsMonth.getPower_profit());
imasterStationDetailsMonth.setStationCode(imasterStationList.getPlantCode());
imasterStationDetailsMonth.setCreatedTime(System.currentTimeMillis());
......@@ -281,16 +265,16 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
//实时功率
Double active_power=0.0;
Double active_power = 0.0;
for (ImasterInverterListDetails imasterInverterListDetails : result4) {
active_power=active_power+ (imasterInverterListDetails.getActive_power()!=null?imasterInverterListDetails.getActive_power():0.0);
active_power = active_power + (imasterInverterListDetails.getActive_power() != null ? imasterInverterListDetails.getActive_power() : 0.0);
}
jpStation.setRealTimePower(active_power);
jpStation.setAccumulatedPower(imasterStationDetail.getTotal_power());
jpStation.setCumulativeIncome(imasterStationDetail.getTotal_power()!=null?imasterStationDetail.getTotal_power()*0.45:0.0);
jpStation.setCumulativeIncome(imasterStationDetail.getTotal_power() != null ? imasterStationDetail.getTotal_power() * 0.45 : 0.0);
jpStation.setDayIncome(imasterStationDetail.getDay_income());
......@@ -342,59 +326,59 @@ public class ImasterDataServiceImpl implements ImasterDataService {
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(ObjectUtils.isEmpty(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 (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(jpStation.getDayGenerate()/jpStation.getCapacity());
if(ObjectUtils.isEmpty(tdHYGFStationDayGenerate.getCreatedTime())){
tdHYGFStationDayGenerate.setFullhour(jpStation.getDayGenerate() / jpStation.getCapacity());
if (ObjectUtils.isEmpty(tdHYGFStationDayGenerate.getCreatedTime())) {
tdHYGFStationDayGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFStationDayGenerateMapper.insert(tdHYGFStationDayGenerate);
}else {
} 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(ObjectUtils.isEmpty(tdHYGFStationMonthGenerate)){
tdHYGFStationMonthGenerate=new TdHYGFStationMonthGenerate();
.eq("third_station_id", jpStation.getThirdStationId())
.eq("month_time", DateUtil.format(today1, "yyyy-MM"))
.eq("year", DateUtil.format(today1, "yyyy")));
if (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());
tdHYGFStationMonthGenerate.setFullhour(jpStation.getMonthGenerate()/jpStation.getCapacity());
if(ObjectUtils.isEmpty(tdHYGFStationMonthGenerate.getCreatedTime())){
tdHYGFStationMonthGenerate.setFullhour(jpStation.getMonthGenerate() / jpStation.getCapacity());
if (ObjectUtils.isEmpty(tdHYGFStationMonthGenerate.getCreatedTime())) {
tdHYGFStationMonthGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFStationMonthGenerateMapper.insert(tdHYGFStationMonthGenerate);
}else {
} 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(ObjectUtils.isEmpty(tdHYGFStationYearGenerate)){
.eq("third_station_id", jpStation.getThirdStationId())
.eq("year_time", DateUtil.format(today1, "yyyy"))
.eq("year", DateUtil.format(today1, "yyyy")));
if (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());
if(ObjectUtils.isEmpty(tdHYGFStationYearGenerate.getCreatedTime())){
tdHYGFStationYearGenerate.setFullhour(jpStation.getYearGenerate() / jpStation.getCapacity());
if (ObjectUtils.isEmpty(tdHYGFStationYearGenerate.getCreatedTime())) {
tdHYGFStationYearGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFStationYearGenerateMapper.insert(tdHYGFStationYearGenerate);
}else {
} else {
tdHYGFStationYearGenerateMapper.insert(tdHYGFStationYearGenerate);
}
}
......@@ -431,7 +415,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
imasterCollectorList.setStationName(imasterStationList.getPlantName());
imasterCollectorList.setCreatedTime(System.currentTimeMillis());
if(imasterCollectorList.getDevTypeId() == ImasterConstant.devTypeC) {
if (imasterCollectorList.getDevTypeId() == ImasterConstant.devTypeC) {
imasterCollectorListMapper.insert(imasterCollectorList);
JpCollector jpCollector = jpCollectorMapper.selectOne(new QueryWrapper<JpCollector>().
......@@ -525,12 +509,12 @@ public class ImasterDataServiceImpl implements ImasterDataService {
ImasterCollectorList da = result.get(j);
ImasterInverterList imasterInverterList=new ImasterInverterList();
ImasterInverterList imasterInverterList = new ImasterInverterList();
BeanUtils.copyProperties(da, imasterInverterList);
imasterInverterList.setStationName(imasterStationList.getPlantName());
imasterInverterList.setAddr(imasterStationList.getPlantAddress());
imasterInverterList.setCreatedTime(System.currentTimeMillis());
if(imasterInverterList.getDevTypeId() == ImasterConstant.devTypeI) {
if (imasterInverterList.getDevTypeId() == ImasterConstant.devTypeI) {
imasterInverterListMapper.insert(imasterInverterList);
}
}
......@@ -538,9 +522,9 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
// @Scheduled(cron = "${dataRequstScheduled.huawei}")
// @Scheduled(cron = "${dataRequstScheduled.huawei}")
@Override
public void inverterDetail( List<ImasterInverterListDetails> result) {
public void inverterDetail(List<ImasterInverterListDetails> result) {
List<String> inverterSns = imasterInverterListMapper.getCollectIds();
// try {
//// TimeUnit.SECONDS.sleep(1);
......@@ -573,13 +557,13 @@ public class ImasterDataServiceImpl implements ImasterDataService {
ImasterConstant.resovleRule_data_page_records,
ImasterInverterYear.class
);
Double active_power=0.0;
String third_station_id=null;
Double active_power = 0.0;
String third_station_id = null;
for (int j = 0; j < result.size(); j++) {
ImasterInverterListDetails inverterDetailDto = result.get(j);
active_power=active_power+ (inverterDetailDto.getActive_power()!=null?inverterDetailDto.getActive_power():0.0);
active_power = active_power + (inverterDetailDto.getActive_power() != null ? inverterDetailDto.getActive_power() : 0.0);
//获取所有逆变器实时功率总和
inverterDetailDto.setCreatedTime((System.currentTimeMillis()));
......@@ -590,7 +574,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
queryWrapper.orderByDesc("created_time");
List<ImasterInverterList> imasterInverterLists = imasterInverterListMapper.selectList(queryWrapper);
ImasterInverterList imasterInverterList = imasterInverterLists.get(0);
third_station_id=imasterInverterList.getStationCode();
third_station_id = imasterInverterList.getStationCode();
QueryWrapper<ImasterCollectorList> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.eq("dev_name", imasterInverterList.getDevName());
queryWrapper1.orderByDesc("created_time");
......@@ -608,7 +592,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
jpInverter.setAddr(imasterInverterList.getAddr());
jpInverter.setCollectorSnCode(collectorList.getEsnCode());
jpInverter.setCollectorId(String.valueOf(collectorList.getId()));
jpInverter.setDayPowerGeneration(inverterDetailDto.getDay_cap() );
jpInverter.setDayPowerGeneration(inverterDetailDto.getDay_cap());
jpInverter.setState(ImasterConstant.inverterStaus.get(String.valueOf(inverterDetailDto.getRun_state())));
jpInverter.setTotalPowerGeneration(inverterDetailDto.getTotal_cap());
jpInverter.setCurrentPower(inverterDetailDto.getActive_power());
......@@ -622,7 +606,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
// 获取年发电量
for (ImasterInverterYear imasterInverterYear : result3
) {
if(imasterInverterYear.getCollectTime().equals(String.valueOf(yearStart)) && inverterDetailDto.getInverterId().equals(imasterInverterYear.getInverterId())) {
if (imasterInverterYear.getCollectTime().equals(String.valueOf(yearStart)) && inverterDetailDto.getInverterId().equals(imasterInverterYear.getInverterId())) {
jpInverter.setYearPowerGeneration(imasterInverterYear.getProduct_power());
imasterInverterYear.setCreatedTime(System.currentTimeMillis());
imasterInverterYearMapper.insert(imasterInverterYear);
......@@ -632,9 +616,9 @@ public class ImasterDataServiceImpl implements ImasterDataService {
// 获取月发电量
for (ImasterInverterMonth imasterInverterMonth: result2
for (ImasterInverterMonth imasterInverterMonth : result2
) {
if(imasterInverterMonth.getCollectTime().equals(String.valueOf(monthStart)) && inverterDetailDto.getInverterId().equals(imasterInverterMonth.getInverterId())) {
if (imasterInverterMonth.getCollectTime().equals(String.valueOf(monthStart)) && inverterDetailDto.getInverterId().equals(imasterInverterMonth.getInverterId())) {
jpInverter.setMonthPowerGeneration(imasterInverterMonth.getProduct_power());
imasterInverterMonth.setCreatedTime(System.currentTimeMillis());
imasterInverterMonthMapper.insert(imasterInverterMonth);
......@@ -642,7 +626,6 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
// jpInverter.setCollectorId(inverterDetailDto.getCollectorId());
// jpInverter.setCollectorSnCode(inverterDetailDto.getCollectorsn());
jpInverter.setUpdateTime(new Date());
......@@ -792,6 +775,116 @@ public class ImasterDataServiceImpl implements ImasterDataService {
} else {
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
}
//-----------------------户用光伏日报表----------------------
TdHYGFInverterDayGenerate tdHYGFInverterDayGenerate = new TdHYGFInverterDayGenerate();
tdHYGFInverterDayGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFInverterDayGenerate.setThirdStationId(jpInverter.getThirdStationId());
tdHYGFInverterDayGenerate.setSnCode(jpInverter.getSnCode());
tdHYGFInverterDayGenerate.setWorkStatus(jpInverter.getState());
//交流电压
tdHYGFInverterDayGenerate.setDcv1(jpInverterElectricityR.getVoltage());
tdHYGFInverterDayGenerate.setDcv2(jpInverterElectricityB.getVoltage());
tdHYGFInverterDayGenerate.setDcv3(jpInverterElectricityC.getVoltage());
//交流电流
// tdHYGFInverterDayGenerate.setDcv4(inverterDetailDto.getUAc4());
tdHYGFInverterDayGenerate.setDcc1(jpInverterElectricityR.getCurrent());
tdHYGFInverterDayGenerate.setDcc2(jpInverterElectricityB.getCurrent());
tdHYGFInverterDayGenerate.setDcc3(jpInverterElectricityC.getCurrent());
// tdHYGFInverterDayGenerate.setDcc4(inverterDetailDto.getIAc4());
//直流电压
tdHYGFInverterDayGenerate.setAcv1(Double.valueOf(hanlderResult.get("pv1_u").toString()));
tdHYGFInverterDayGenerate.setAcv2(Double.valueOf(hanlderResult.get("pv2_u").toString()));
tdHYGFInverterDayGenerate.setAcv3(Double.valueOf(hanlderResult.get("pv3_u").toString()));
tdHYGFInverterDayGenerate.setAcv4(Double.valueOf(hanlderResult.get("pv4_u").toString()));
//直流电流
tdHYGFInverterDayGenerate.setAcc1(Double.valueOf(hanlderResult.get("pv1_i").toString()));
tdHYGFInverterDayGenerate.setAcc2(Double.valueOf(hanlderResult.get("pv2_i").toString()));
tdHYGFInverterDayGenerate.setAcc3(Double.valueOf(hanlderResult.get("pv3_i").toString()));
tdHYGFInverterDayGenerate.setAcc4(Double.valueOf(hanlderResult.get("pv4_i").toString()));
tdHYGFInverterDayGenerate.setPv1(null);
tdHYGFInverterDayGenerate.setPv2(null);
tdHYGFInverterDayGenerate.setPv3(null);
tdHYGFInverterDayGenerate.setPv4(null);
//功率
tdHYGFInverterDayGenerate.setTotalPower(jpInverter.getCurrentPower());
//频率
tdHYGFInverterDayGenerate.setFrequency(String.valueOf(inverterDetailDto.getElec_freq()));
//功率因数
tdHYGFInverterDayGenerate.setPowerFactor(inverterDetailDto.getPower_factor());
tdHYGFInverterDayGenerate.setDayGen(jpInverter.getDayPowerGeneration());
tdHYGFInverterDayGenerate.setMonthGen(jpInverter.getMonthPowerGeneration());
tdHYGFInverterDayGenerate.setYearGen(jpInverter.getYearPowerGeneration());
tdHYGFInverterDayGenerate.setTotalGen(jpInverter.getTotalPowerGeneration());
tdHYGFInverterDayGenerate.setIgbtTemp(inverterDetailDto.getTemperature());
tdHYGFInverterDayGenerate.setIncome(null);
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(ObjectUtils.isEmpty(tdHYGFInverterMonthGenerate)){
tdHYGFInverterMonthGenerate=new TdHYGFInverterMonthGenerate();
}
tdHYGFInverterMonthGenerate.setThirdStationId(jpInverter.getThirdStationId());
tdHYGFInverterMonthGenerate.setSnCode(String.valueOf(jpInverter.getSnCode()));
tdHYGFInverterMonthGenerate.setDayTime(DateUtil.format(today1, "yyyy-MM-dd"));
tdHYGFInverterMonthGenerate.setYearMonth(DateUtil.format(today1, "yyyy-MM"));
tdHYGFInverterMonthGenerate.setGenerate(jpInverter.getDayPowerGeneration());
tdHYGFInverterMonthGenerate.setFullhour(jpInverter.getDayPowerGeneration()/jpInverter.getCapacity());
if(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(ObjectUtils.isEmpty(tdHYGFInverterYearGenerate)){
tdHYGFInverterYearGenerate = new TdHYGFInverterYearGenerate();
}
tdHYGFInverterYearGenerate.setThirdStationId(jpInverter.getThirdStationId());
tdHYGFInverterYearGenerate.setSnCode(jpInverter.getSnCode());
tdHYGFInverterYearGenerate.setMonthTime(DateUtil.format(today1, "yyyy-MM"));
tdHYGFInverterYearGenerate.setYear(DateUtil.format(today1, "yyyy"));
tdHYGFInverterYearGenerate.setGenerate(jpInverter.getMonthPowerGeneration());
tdHYGFInverterYearGenerate.setFullhour(jpInverter.getMonthPowerGeneration()/jpInverter.getCapacity());
if(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(ObjectUtils.isEmpty(tdHYGFInverterTotalGenerate)){
tdHYGFInverterTotalGenerate = new TdHYGFInverterTotalGenerate();
}
tdHYGFInverterTotalGenerate.setThirdStationId(jpInverter.getThirdStationId());
tdHYGFInverterTotalGenerate.setSnCode(jpInverter.getSnCode());
tdHYGFInverterTotalGenerate.setYearTime(DateUtil.format(today1, "yyyy"));
tdHYGFInverterTotalGenerate.setYear(DateUtil.format(today1, "yyyy"));
tdHYGFInverterTotalGenerate.setGenerate(jpInverter.getYearPowerGeneration());
tdHYGFInverterTotalGenerate.setFullhour(jpInverter.getYearPowerGeneration()/jpInverter.getCapacity());
if(ObjectUtils.isEmpty(tdHYGFInverterTotalGenerate.getCreatedTime())){
tdHYGFInverterTotalGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFInverterTotalGenerateMapper.insert(tdHYGFInverterTotalGenerate);
}else {
tdHYGFInverterTotalGenerateMapper.insert(tdHYGFInverterTotalGenerate);
}
}
// JpStation jpStation1 = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
// eq("third_code", PVProducerInfoEnum.HUAWEI.getCode()).
......
......@@ -106,6 +106,8 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
private TdHYGFStationMonthGenerateMapper tdHYGFStationMonthGenerateMapper;
@Autowired
private TdHYGFStationYearGenerateMapper tdHYGFStationYearGenerateMapper;
@Autowired
private TdHYGFInverterTotalGenerateMapper tdHYGFInverterTotalGenerateMapper;
@Scheduled(cron = "${dataRequstScheduled.keshida}")
@Override
......@@ -884,9 +886,120 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
} else {
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
}
//-----------------------户用光伏日报表----------------------
TdHYGFInverterDayGenerate tdHYGFInverterDayGenerate = new TdHYGFInverterDayGenerate();
tdHYGFInverterDayGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFInverterDayGenerate.setThirdStationId(jpInverter.getThirdStationId());
tdHYGFInverterDayGenerate.setSnCode(jpInverter.getSnCode());
tdHYGFInverterDayGenerate.setWorkStatus(jpInverter.getState());
//交流电压
tdHYGFInverterDayGenerate.setDcv1(jpInverterElectricityR.getVoltage());
tdHYGFInverterDayGenerate.setDcv2(jpInverterElectricityS.getVoltage());
tdHYGFInverterDayGenerate.setDcv3(jpInverterElectricityT.getVoltage());
//交流电流
// tdHYGFInverterDayGenerate.setDcv4(inverterDetailDto.getUAc4());
tdHYGFInverterDayGenerate.setDcc1(jpInverterElectricityR.getCurrent());
tdHYGFInverterDayGenerate.setDcc2(jpInverterElectricityS.getCurrent());
tdHYGFInverterDayGenerate.setDcc3(jpInverterElectricityT.getCurrent());
// tdHYGFInverterDayGenerate.setDcc4(inverterDetailDto.getIAc4());
//直流电压
tdHYGFInverterDayGenerate.setAcv1(Double.valueOf(hanlderResult.get("voltagePv1").toString()));
tdHYGFInverterDayGenerate.setAcv2(Double.valueOf(hanlderResult.get("voltagePv2").toString()));
tdHYGFInverterDayGenerate.setAcv3(Double.valueOf(hanlderResult.get("voltagePv3").toString()));
tdHYGFInverterDayGenerate.setAcv4(Double.valueOf(hanlderResult.get("voltagePv4").toString()));
//直流电流
tdHYGFInverterDayGenerate.setAcc1(Double.valueOf(hanlderResult.get("currentPv1").toString()));
tdHYGFInverterDayGenerate.setAcc2(Double.valueOf(hanlderResult.get("currentPv2").toString()));
tdHYGFInverterDayGenerate.setAcc3(Double.valueOf(hanlderResult.get("currentPv3").toString()));
tdHYGFInverterDayGenerate.setAcc4(Double.valueOf(hanlderResult.get("currentPv4").toString()));
tdHYGFInverterDayGenerate.setPv1(Double.valueOf(hanlderResult.get("powerPv1").toString()));
tdHYGFInverterDayGenerate.setPv2(Double.valueOf(hanlderResult.get("powerPv2").toString()));
tdHYGFInverterDayGenerate.setPv3(Double.valueOf(hanlderResult.get("powerPv3").toString()));
tdHYGFInverterDayGenerate.setPv4(Double.valueOf(hanlderResult.get("powerPv4").toString()));
//功率
tdHYGFInverterDayGenerate.setTotalPower(jpInverter.getCurrentPower());
// //频率
tdHYGFInverterDayGenerate.setFrequency(String.valueOf(jpInverterElectricityR.getFrequency()));
// //功率因数
tdHYGFInverterDayGenerate.setPowerFactor(1.0);
tdHYGFInverterDayGenerate.setDayGen(jpInverter.getDayPowerGeneration());
tdHYGFInverterDayGenerate.setMonthGen(jpInverter.getMonthPowerGeneration());
tdHYGFInverterDayGenerate.setYearGen(jpInverter.getYearPowerGeneration());
tdHYGFInverterDayGenerate.setTotalGen(jpInverter.getTotalPowerGeneration());
tdHYGFInverterDayGenerate.setIgbtTemp(ObjectUtils.isEmpty(jpInverter.getIgbtTemperature())?null:Double.valueOf(jpInverter.getIgbtTemperature()));
tdHYGFInverterDayGenerate.setIncome(null);
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(ObjectUtils.isEmpty(tdHYGFInverterMonthGenerate)){
tdHYGFInverterMonthGenerate=new TdHYGFInverterMonthGenerate();
}
tdHYGFInverterMonthGenerate.setThirdStationId(jpInverter.getThirdStationId());
tdHYGFInverterMonthGenerate.setSnCode(String.valueOf(jpInverter.getSnCode()));
tdHYGFInverterMonthGenerate.setDayTime(DateUtil.format(today1, "yyyy-MM-dd"));
tdHYGFInverterMonthGenerate.setYearMonth(DateUtil.format(today1, "yyyy-MM"));
tdHYGFInverterMonthGenerate.setGenerate(jpInverter.getDayPowerGeneration());
tdHYGFInverterMonthGenerate.setFullhour(jpInverter.getDayPowerGeneration()/jpInverter.getCapacity());
if(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(ObjectUtils.isEmpty(tdHYGFInverterYearGenerate)){
tdHYGFInverterYearGenerate = new TdHYGFInverterYearGenerate();
}
tdHYGFInverterYearGenerate.setThirdStationId(jpInverter.getThirdStationId());
tdHYGFInverterYearGenerate.setSnCode(jpInverter.getSnCode());
tdHYGFInverterYearGenerate.setMonthTime(DateUtil.format(today1, "yyyy-MM"));
tdHYGFInverterYearGenerate.setYear(DateUtil.format(today1, "yyyy"));
tdHYGFInverterYearGenerate.setGenerate(jpInverter.getMonthPowerGeneration());
tdHYGFInverterYearGenerate.setFullhour(jpInverter.getMonthPowerGeneration()/jpInverter.getCapacity());
if(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(ObjectUtils.isEmpty(tdHYGFInverterTotalGenerate)){
tdHYGFInverterTotalGenerate = new TdHYGFInverterTotalGenerate();
}
tdHYGFInverterTotalGenerate.setThirdStationId(jpInverter.getThirdStationId());
tdHYGFInverterTotalGenerate.setSnCode(jpInverter.getSnCode());
tdHYGFInverterTotalGenerate.setYearTime(DateUtil.format(today1, "yyyy"));
tdHYGFInverterTotalGenerate.setYear(DateUtil.format(today1, "yyyy"));
tdHYGFInverterTotalGenerate.setGenerate(jpInverter.getYearPowerGeneration());
tdHYGFInverterTotalGenerate.setFullhour(jpInverter.getYearPowerGeneration()/jpInverter.getCapacity());
if(ObjectUtils.isEmpty(tdHYGFInverterTotalGenerate.getCreatedTime())){
tdHYGFInverterTotalGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFInverterTotalGenerateMapper.insert(tdHYGFInverterTotalGenerate);
}else {
tdHYGFInverterTotalGenerateMapper.insert(tdHYGFInverterTotalGenerate);
}
});
}
}
......@@ -1143,14 +1256,15 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
}
}
}
HYGFJPInverterWarn hygfjpInverterWarn = hygfjpInverterWarnMapper.selectOne(new QueryWrapper<HYGFJPInverterWarn>()
List<HYGFJPInverterWarn> list= hygfjpInverterWarnMapper.selectList(new QueryWrapper<HYGFJPInverterWarn>()
.eq("sn_code",snCode)
.eq("start_time",DateUtil.parse(ksolarAlarmDto.getSaveTime(), DatePattern.NORM_DATETIME_PATTERN).getTime())
.eq("third_code", PVProducerInfoEnum.KSOLAR.getCode())
.eq("third_station_id", ksolarAlarmDto.getStationId())
);
if (ObjectUtils.isEmpty(hygfjpInverterWarn)) {
hygfjpInverterWarn = new HYGFJPInverterWarn();
HYGFJPInverterWarn hygfjpInverterWarn = new HYGFJPInverterWarn();
if (!ObjectUtils.isEmpty(list)) {
hygfjpInverterWarn = list.get(0);
}
hygfjpInverterWarn.setTime(System.currentTimeMillis());
......
......@@ -12,27 +12,29 @@ import org.springframework.data.annotation.Id;
@Data
public class DayGenerateDto {
private Long createdTime;
/**
* 第三方电站id
*/
private String thirdStationId;
/**
* 小时
*
*/
private String hourTime;
private String dayTime;
/**
* 月份
*/
private String monthDay;
private String yearMonth;
/**
* 发电量
*/
private Double generate;
/**
* 满发小时数
*
* */
private Double fullhour;
}
......@@ -12,6 +12,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 第三方场站
......@@ -146,4 +147,22 @@ public class JpStationDto extends BaseDto {
private String regionalCompaniesCode;
private String amosCompanyCode;
//场站id
private List<String> thirdStationIds;
String timeDate;
/**
* 满发小时数
*
* */
private Double fullhour;
/**
*
* 实时功率比/
* **/
List<Map<String,Object>> powerRatio;
}
......@@ -18,16 +18,23 @@ public class MonthGenerateDto {
private String thirdStationId;
/**
*
*
*/
private String dayTime;
private String monthTime;
/**
* 月份
* 平均功率
*/
private String yearMonth;
private String year;
/**
* 发电量
* 发电量
*/
private Double generate;
/**
* 满发小时数
*
* */
private Double fullhour;
}
......@@ -16,24 +16,25 @@ public class YearGenerateDto {
/**
* 第三方电站id
*/
private String thirdStationId;
/**
* 年
*/
private String monthTime;
private String yearTime;
/**
* 平均功率
*时间
*/
private String year;
/**
* 平均功率
*年发电量
*/
private Double generate;
/**
* 满发小时数
*
* */
private Double fullhour;
}
......@@ -13,7 +13,7 @@ import org.springframework.data.annotation.Id;
*/
@Data
@Accessors(chain = true)
@TableName("td_hygf_day_generate")
@TableName("td_hygf_station_day_generate")
public class DayGenerate {
@Id
private Long createdTime;
......@@ -39,15 +39,11 @@ public class DayGenerate {
*/
@TableField("generate")
private Double generate;
/**
* 满发小时数
*
* */
@TableField("fullhour")
private Double fullhour;
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() {
}
}
......@@ -216,4 +216,5 @@ public class JpStation extends BaseEntity {
@TableField("amos_company_code")
private String amosCompanyCode;
}
......@@ -13,7 +13,7 @@ import org.springframework.data.annotation.Id;
*/
@Data
@Accessors(chain = true)
@TableName("td_hygf_month_generate")
@TableName("td_hygf_station_month_generate")
public class MonthGenerate {
@Id
private Long createdTime;
......@@ -36,19 +36,15 @@ public class MonthGenerate {
private String year;
/**
* 平均功率
* 月发电量
*/
@TableField("generate")
private Double generate;
public MonthGenerate(Long createdTime, String thirdStationId, String monthTime, String year, Double generate) {
this.createdTime = createdTime;
this.thirdStationId = thirdStationId;
this.monthTime = monthTime;
this.year = year;
this.generate = generate;
}
public MonthGenerate() {
}
/**
* 满发小时数
*
* */
@TableField("fullhour")
private Double fullhour;
}
......@@ -13,7 +13,7 @@ import org.springframework.data.annotation.Id;
*/
@Data
@Accessors(chain = true)
@TableName("td_hygf_year_generate")
@TableName("td_hygf_station_year_generate")
public class YearGenerate {
@Id
private Long createdTime;
......@@ -30,24 +30,20 @@ public class YearGenerate {
private String yearTime;
/**
*
*时间
*/
@TableField("year")
private String year;
/**
*
*年发电量
*/
@TableField("generate")
private Double generate;
public YearGenerate(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 YearGenerate() {
}
/**
* 满发小时数
*
* */
@TableField("fullhour")
private Double fullhour;
}
......@@ -33,7 +33,7 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
List<DropDown> getDealer(@Param("regionalCompaniesCode") String regionalCompaniesCode);
@UserEmpower(field ={"regional_companies_code","amos_company_code"} ,fieldConditions ={"in","in"} ,relationship="and")
JpStation getCountJpStationdata(@Param("dto") JpStationDto reviewDto);
JpStationDto getCountJpStationdata(@Param("dto") JpStationDto reviewDto);
@UserEmpower(field ={"regional_companies_code","amos_company_code"} ,fieldConditions ={"in","in"} ,relationship="and")
List<Map<String,Object>> getcountState(@Param("dto") JpStationDto reviewDto);
......@@ -49,4 +49,7 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
@UserEmpower(field ={"regional_companies_code","amos_company_code"} ,fieldConditions ={"in","in"} ,relationship="and")
Map<String,Object> getcount( JpStationDto reviewDto);
@UserEmpower(field ={"regional_companies_code","amos_company_code"} ,fieldConditions ={"in","in"} ,relationship="and")
List<JpStationDto> queryForDealerReviewPagenew(@Param("dto") JpStationDto reviewDto);
}
package com.yeejoin.amos.boot.module.hygf.api.service;
import com.yeejoin.amos.boot.module.hygf.api.entity.DayGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2023/11/8
*/
public interface IDayGenerateService {
List<DayGenerate> getDayGenerateph( List<JpStation> dto, String sort,String dateTime);
}
......@@ -31,6 +31,10 @@ public interface IJpStationService {
//接入中电站数
Map<String,Object>getcountStatejr( JpStationDto reviewDto);
List<JpStation> getJpStation( JpStationDto reviewDto);
Map<String, List<Object>> getGenerateqx(String date, String type, JpStationDto reviewDto);
Map<String, List<Object>> getPowerqxnew(String date, JpStationDto reviewDto);
}
package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.DayGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
import com.yeejoin.amos.boot.module.hygf.api.entity.MonthGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.YearGenerate;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @description:
......@@ -9,4 +16,20 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.DayGenerate;
* @createDate: 2023/11/8
*/
public interface DayGenerateMapper extends BaseMapper<DayGenerate> {
//日发电量排行
// desc 前十名
// asc 后十名
List<DayGenerate> getDayGenerateph(@Param("dto") List<JpStation> dto, @Param("sort")String sort,@Param("dateTime")String dateTime);
List<PowerCurveDto> getDayGeneratqx(@Param("date") String month, @Param("dto")List<String> statioId);
List<PowerCurveDto> getMonthGenerateqx(@Param("date") String month, @Param("dto")List<String> statioId);
List<PowerCurveDto> getYearGenerateqx(@Param("date") String month, @Param("dto")List<String> statioId);
}
......@@ -172,9 +172,9 @@
<if test="dto.area!=null">
and hygf_jp_station.area like concat(concat("%",#{dto.area}),"%")
</if>
<if test="dto.statioId!=null">
<if test="dto.thirdStationIds!=null">
and hygf_jp_station.third_station_id in
<foreach collection="dto.statioId" item="item" index="index" open="(" separator="," close=")">
<foreach collection="dto.thirdStationIds" item="item" index="index" open="(" separator="," close=")">
#{item.stationId}
</foreach>
</if>
......@@ -187,6 +187,9 @@
<if test="dto.amosCompanyCode!=null">
and hygf_jp_station.amos_company_code =#{dto.amosCompanyCode}
</if>
<if test="dto.state!=null">
and hygf_jp_station.`state` =#{dto.state}
</if>
</where>
</select>
......@@ -212,7 +215,7 @@
<select id="getCountJpStationdata" resultType="com.yeejoin.amos.boot.module.hygf.api.entity.JpStation">
<select id="getCountJpStationdata" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto">
select
......@@ -452,5 +455,85 @@
</where>
</select>
<select id="queryForDealerReviewPagenew" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto">
select
`sequence_nbr` sequenceNbr,
`rec_date` recDate,
`rec_user_id` recUserId,
`rec_user_name` recUserName,
`sn_code` snCode,
`capacity` capacity,
`name` ,
`code` ,
`system_code` systemCode,
`access_time` accessTime,
`create_time` createTime,
`address` ,
`longitude` ,
`latitude` ,
`price` ,
`user_name` userName,
`user_phone` userPhone,
`station_contact` stationContact,
`module_count` moduleCount,
`on_grid_type` onGridType,
`on_grid_time` onGridTime,
`third_station_id` thirdStationId,
`third_code` thirdCode,
`station_id` stationId,
`day_power_use` dayPowerUse,
`month_power_use` monthPowerUse,
`year_power_use` yearPowerUse,
ROUND(`real_time_power`,3) realTimePower,
ROUND(`accumulated_power`/1000,3) accumulatedPower,
`state` ,
`type`,
`organizational_code` organizationalCode,
`is_delete` isDelete,
ROUND(`day_generate`,3) dayGenerate,
`month_generate` monthGenerate,
`year_generate` yearGenerate,
`day_income` dayIncome,
`month_income` monthIncome,
`year_income` yearIncome,
`area` ,
`cumulative_income` cumulativeIncome,
`email`,
rated_power ratedPower
from hygf_jp_station
<where>
<if test="dto.name!=null">
and hygf_jp_station.name like concat(concat("%",#{dto.name}),"%")
</if>
<if test="dto.userName!=null">
and hygf_jp_station.user_name like concat(concat("%",#{dto.userName}),"%")
</if>
<if test="dto.address!=null">
and hygf_jp_station.address like concat(concat("%",#{dto.address}),"%")
</if>
<if test="dto.area!=null">
and hygf_jp_station.area like concat(concat("%",#{dto.area}),"%")
</if>
<if test="dto.statioId!=null">
and hygf_jp_station.third_station_id in
<foreach collection="dto.statioId" item="item" index="index" open="(" separator="," close=")">
#{item.stationId}
</foreach>
</if>
<if test="dto.thirdStationId!=null">
and hygf_jp_station.third_station_id =#{dto.thirdStationId}
</if>
<if test="dto.regionalCompaniesCode!=null">
and hygf_jp_station.regional_companies_code =#{dto.regionalCompaniesCode}
</if>
<if test="dto.amosCompanyCode!=null">
and hygf_jp_station.amos_company_code =#{dto.amosCompanyCode}
</if>
</where>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.DayPowerMapper">
<select id="getDayGenerateph" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.DayPowerDto">
SELECT
*
FROM house_pv_data.td_hygf_station_day_generate
<where>
<if test="dto!=null">
third_station_id in
<foreach collection="dto" item="item" index="index" open="(" separator="," close=")">
#{item.thirdStationId}
</foreach>
</if>
<if test="dateTime!=null">
day_time = #{dateTime}
</if>
</where>
ORDER by fullhour #{sort} limit 10
</select>
<select id="getDayGeneratqx" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto">
SELECT
sum(generate)num,
`day_time` date
FROM house_pv_data.td_hygf_station_day_generate where third_station_id in
<foreach collection="dto" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and year_month = #{date}
GROUP BY `day_time`
</select>
<select id="getMonthGenerateqx" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto">
SELECT
sum(generate)num,
`month_time` date
FROM house_pv_data.td_hygf_station_month_generate where third_station_id in
<foreach collection="dto" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and year = #{date}
GROUP BY `month_time`
</select>
<select id="getYearGenerateqx" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto">
SELECT
sum(generate)num,
`year_time` date
FROM house_pv_data.td_hygf_station_year_generate where third_station_id in
<foreach collection="dto" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and year = #{date}
GROUP BY `hour`
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.MonthGenerateMapper">
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.YearGenerateMapper">
</mapper>
\ No newline at end of file
......@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.JpCollectorMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpInverterMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpPersonStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpStationMapper;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.DayGenerateServiceImpl;
import com.yeejoin.amos.boot.module.standard.api.entity.PublicAgencyUser;
import org.omg.CORBA.OBJ_ADAPTER;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -53,11 +54,17 @@ public class JpStationController extends BaseController {
@Autowired
JpInverterMapper jpInverterMapper;
@Autowired
DayGenerateServiceImpl dayGenerateServiceImpl;
private static Double CARBON=0.997*0.001;
private static Double SULFUR=0.03*0.001;
private static Double DUST=0.272*0.001;
private static Double COAL=0.4*0.001;
private static String ZX="在线";
private static String LX="离线";
private static String BJ="报警";
/**
* 新增第三方场站
......@@ -381,9 +388,14 @@ public class JpStationController extends BaseController {
@ApiOperation(httpMethod = "GET",value = "电站发电量统计", notes = "电站发电量统计")
@GetMapping(value = "/getCountJpStationdata")
@UserLimits
public ResponseModel< List<JpStation>> getCountJpStationdata(JpStationDto reviewDto) {
JpStation jpStation= jpStationMapper.getCountJpStationdata(reviewDto);
List<JpStation> list=new ArrayList<>();
public ResponseModel< List<JpStationDto>> getCountJpStationdata(JpStationDto reviewDto) {
JpStationDto jpStation= jpStationMapper.getCountJpStationdata(reviewDto);
List<Map<String,Object>> powerRatio=new ArrayList<>();
Map<String,Object> map=new HashMap<>();
map.put("value",String.format("%.2f",jpStation.getRealTimePower()/jpStation.getRatedPower()));
powerRatio.add(map);
jpStation.setPowerRatio(powerRatio);
List<JpStationDto> list=new ArrayList<>();
list.add(jpStation);
return ResponseHelper.buildResponse(list);
}
......@@ -405,7 +417,7 @@ public class JpStationController extends BaseController {
@GetMapping(value = "/getEnergyConservation")
@UserLimits
public ResponseModel< Map<String,Object>> getEnergyConservation(JpStationDto reviewDto) {
JpStation jpStation= jpStationMapper.getCountJpStationdata(reviewDto);
JpStationDto jpStation= jpStationMapper.getCountJpStationdata(reviewDto);
Map<String,Object> map=new HashMap<>();
DecimalFormat format2 = new DecimalFormat("#.00");
//炭
......@@ -432,11 +444,11 @@ public class JpStationController extends BaseController {
List<Map<String,Object>> list= jpStationServiceImpl.getcountState(reviewDto);
if(list!=null&&!list.isEmpty()){
for (Map<String, Object> map : list) {
if("在线".equals(map.get("state").toString())){
if(ZX.equals(map.get("state").toString())){
collector.put("zx",Integer.valueOf(map.get("num").toString()));
}else if("离线".equals(map.get("state").toString())){
}else if(LX.equals(map.get("state").toString())){
collector.put("lx",Integer.valueOf(map.get("num").toString()));
}else if("报警".equals(map.get("state").toString())){
}else if(BJ.equals(map.get("state").toString())){
collector.put("bj",Integer.valueOf(map.get("num").toString()));
}
}
......@@ -453,9 +465,90 @@ public class JpStationController extends BaseController {
return ResponseHelper.buildResponse(collector);
}
//日满发小时排行
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "节能减排", notes = "节能减排")
@GetMapping(value = "/getDayGenerateph")
public ResponseModel< List<Map<String,Object>>> getDayGenerateph(JpStationDto reviewDto,String type,String dateTime ) {
List<JpStation> list= jpStationServiceImpl.getJpStation(reviewDto);
List<Map<String,Object>> li=new ArrayList<>();
List<DayGenerate> date= dayGenerateServiceImpl.getDayGenerateph(list,type,dateTime);
if(date!=null&&!list.isEmpty()){
for (DayGenerate dayGenerate : date) {
Map<String,Object> map =new HashMap<>();
for (JpStation jpStation : list) {
if(dayGenerate.getThirdStationId().equals(jpStation.getThirdStationId())){
map.put("sequenceNbr",jpStation.getSequenceNbr());
map.put("name",jpStation.getName());
map.put("address",jpStation.getName());
map.put("fullhour",dayGenerate.getFullhour());
break;
}
}
if(!map.isEmpty()){
li.add(map);
}
}
}
return ResponseHelper.buildResponse(li);
}
@TycloudOperation(needAuth = false,ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "发电量曲线", notes = "发电量曲线")
@GetMapping(value = "/getGenerateqx")
public ResponseModel< Map<String, List<Object>>> getGenerateqx(JpStationDto reviewDto,String date, String type) {
Map<String, List<Object>> map= jpStationServiceImpl.getGenerateqx( date, type,reviewDto);
return ResponseHelper.buildResponse(map);
}
@TycloudOperation(needAuth = false,ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "工率曲线", notes = "电站监控电量收益")
@GetMapping(value = "/getPowerqxnew")
public ResponseModel< Map<String, List<Object>>> getPowerqxnew(JpStationDto reviewDto,String date) {
Map<String, List<Object>> map= jpStationServiceImpl.getPowerqxnew( date,reviewDto);
return ResponseHelper.buildResponse(map);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryPagenew")
@ApiOperation(httpMethod = "GET",value = "场站列表", notes = "场站列表")
public ResponseModel<Page<JpStationDto>> queryPagenew(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size, JpStationDto reviewDto) {
Page<JpStationDto> page=jpStationServiceImpl.queryForJpStationPage(current,size,reviewDto);
return ResponseHelper.buildResponse(page);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryReport")
@ApiOperation(httpMethod = "GET",value = "场站报表", notes = "场站报表")
public ResponseModel<Page<JpStationDto>> queryReport(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size, JpStationDto reviewDto,String type) {
Page<JpStationDto> page=jpStationServiceImpl.queryReport(current,size,reviewDto,type);
return ResponseHelper.buildResponse(page);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "登录人场站", notes = "登录人场站")
@GetMapping(value = "/getuserJpStation")
public ResponseModel< List<JpStation>> getuserJpStation(JpStationDto reviewDto) {
List<JpStation> list = jpStationServiceImpl.getJpStation(reviewDto);
return ResponseHelper.buildResponse(list);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -5,9 +5,12 @@ 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.service.IDayGenerateService;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.DayGenerateMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
/**
* @description:
* @author: tw
......@@ -15,8 +18,10 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
*/
@Service
public class DayGenerateServiceImpl extends BaseService<DayGenerateDto, DayGenerate, DayGenerateMapper> implements IDayGenerateService {
@Autowired
DayGenerateMapper dayGenerateMapper;
@Override
public List<DayGenerate> getDayGenerateph(List<JpStation> dto, String sort,String dateTime) {
return dayGenerateMapper.getDayGenerateph(dto,sort,dateTime);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.ReviewDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
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.IJpStationService;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
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.MonthPowerMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.YearGenerateMapper;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
......@@ -40,6 +45,15 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
MonthPowerMapper monthPowerMapper;
@Autowired
MonthPowerServiceImpl monthPowerServiceImpl;
@Autowired
DayGenerateMapper dayGenerateMapper;
@Autowired
MonthGenerateMapper monthGenerateMapper;
@Autowired
YearGenerateMapper yearGenerateMapper;
/**
* 分页查询
*/
......@@ -60,7 +74,21 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
}
/**
* 分页查询
*/
@UserLimits
public Page<JpStationDto> queryForJpStationPagenew(int pageNum, int pageSize, JpStationDto reviewDto) {
PageHelper.startPage(pageNum, pageSize);
List<JpStationDto> list = jpStationMapper.queryForDealerReviewPagenew(reviewDto);
PageInfo<JpStationDto> page = new PageInfo(list);
com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto> pagenew = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto>();
pagenew.setCurrent(pageNum);
pagenew.setTotal(page.getTotal());
pagenew.setSize(pageSize);
pagenew.setRecords(page.getList());
return pagenew;
}
@Override
public Map<String, List<Object>> getPowerqx(String date, String type,List<String> statioId) {
......@@ -148,6 +176,100 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
return jpStationMapper.getcountStatejr(reviewDto);
}
@Override
@UserLimits
public List<JpStation> getJpStation(JpStationDto reviewDto) {
return jpStationMapper.getJpStation(reviewDto);
}
@Override
public Map<String, List<Object>> getGenerateqx(String date, String type, JpStationDto reviewDto) {
List<String> statioId=new ArrayList();
List<JpStation> dataJpStation= this.getJpStation(reviewDto);
for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId());
}
List<PowerCurveDto> data=null;
List<Object> listx =new ArrayList<>();
List<Object> listy =new ArrayList<>();
Map<String, List<Object>> map =new HashMap<>();
try {
if(type.equals("month")){
map= getDayListOfMonth(date);
data= dayGenerateMapper.getDayGeneratqx(date, statioId);
}else if(type.equals("year")){
map= getyearListOfMonth(date);
data= dayGenerateMapper.getMonthGenerateqx(date,statioId);
}else{
map= getyearList();
data= dayGenerateMapper.getYearGenerateqx(date, statioId);
}
listx =map.get("x");
listy =map.get("y");
if(data!=null&&!data.isEmpty()){
for (PowerCurveDto datum : data) {
for (int i = 0; i < listx.size(); i++) {
if(datum.getDate().equals(listx.get(i).toString())){
listy.remove(i);
String format = datum.getNum()!=null?new DecimalFormat("#.000").format(datum.getNum()):null;
listy.add(i,format);
break;
}
}
}
}
if(type.equals("month")||type.equals("year")){
listx= listx.stream().map(e-> String.valueOf(e).substring(String.valueOf(e).length()-2)).collect(Collectors.toList());
}
map.put("x",listx);
map.put("y",listy);
} catch (Exception e) {
e.printStackTrace();
throw new BadRequest("系统异常!");
}
return map;
}
@Override
public Map<String, List<Object>> getPowerqxnew(String date,JpStationDto reviewDto) {
List<String> statioId=new ArrayList();
List<JpStation> dataJpStation= this.getJpStation(reviewDto);
for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId());
}
List<PowerCurveDto> data=null;
List<Object> listx =new ArrayList<>();
List<Object> listy =new ArrayList<>();
Map<String, List<Object>> map =new HashMap<>();
map= gethourList();
data =monthPowerMapper.getDayPowercount(date, statioId);
listx =map.get("x");
listy =map.get("y");
if(data!=null&&!data.isEmpty()){
for (PowerCurveDto datum : data) {
for (int i = 0; i < listx.size(); i++) {
if(datum.getDate().equals(listx.get(i).toString())){
listy.remove(i);
String format = datum.getNum()!=null?new DecimalFormat("#.000").format(datum.getNum()):null;
listy.add(i,format);
break;
}
}
}
}
map.put("x",listx);
map.put("y",listy);
return map;
}
public static Map<String, List<Object>> getDayListOfMonth(String date) {
Map<String, List<Object>> map =new HashMap<>();
......@@ -235,6 +357,154 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
map.put("y",listy);
return map;
}
public Page<JpStationDto> queryReport(int pageNum, int pageSize, JpStationDto reviewDto,String type) {
//权限
List<String> statioId=new ArrayList();
List<JpStation> dataJpStation= this.getJpStation(reviewDto);
for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId());
}
reviewDto.setThirdStationIds(statioId);
PageHelper.startPage(pageNum, pageSize);
List<JpStationDto> list = null;
switch (type){
case"day":
LambdaQueryWrapper<DayGenerate> wapper = new LambdaQueryWrapper<DayGenerate>();
wapper.in(reviewDto.getThirdStationIds()!=null,DayGenerate::getThirdStationId,reviewDto.getThirdStationIds());
wapper.eq(DayGenerate::getDayTime,reviewDto.getTimeDate());
List<DayGenerate> listday= dayGenerateMapper.selectList(wapper);
list = getJpStationDtoday( dataJpStation, listday);
break;
case"month":
LambdaQueryWrapper<MonthGenerate> wapper1 = new LambdaQueryWrapper<MonthGenerate>();
wapper1.in(reviewDto.getThirdStationIds()!=null,MonthGenerate::getThirdStationId,reviewDto.getThirdStationIds());
wapper1.eq(MonthGenerate::getMonthTime,reviewDto.getTimeDate());
List<MonthGenerate> listmonth= monthGenerateMapper.selectList(wapper1);
list = getJpStationDtomonth( dataJpStation, listmonth);
break;
case"year":
LambdaQueryWrapper<YearGenerate> wapper2 = new LambdaQueryWrapper<YearGenerate>();
wapper2.in(reviewDto.getThirdStationIds()!=null,YearGenerate::getThirdStationId,reviewDto.getThirdStationIds());
wapper2.eq(YearGenerate::getYear,reviewDto.getTimeDate());
List<YearGenerate> listyear= yearGenerateMapper.selectList(wapper2);
list = getJpStationDtoyear( dataJpStation, listyear);
break;
default:
list = getJpStationDtoAll(dataJpStation);
}
PageInfo<JpStationDto> page = new PageInfo(list);
com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto> pagenew = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto>();
pagenew.setCurrent(pageNum);
pagenew.setTotal(page.getTotal());
pagenew.setSize(pageSize);
pagenew.setRecords(page.getList());
return pagenew;
}
public List<JpStationDto> getJpStationDtoAll( List<JpStation> da){
List<JpStationDto> ld=new ArrayList<>();
for (JpStation jpStation : da) {
JpStationDto hd=new JpStationDto();
hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower());
hd.setFullhour(Double.valueOf(String.format("%.2f", jpStation.getAccumulatedPower()/jpStation.getCapacity())));
hd.setAccumulatedPower(jpStation.getAccumulatedPower());
hd.setDayIncome(null);
ld.add(hd);
}
return ld;
}
public List<JpStationDto> getJpStationDtoday( List<JpStation> da, List<DayGenerate> listday){
List<JpStationDto> ld=new ArrayList<>();
for (DayGenerate dayGenerate : listday) {
JpStationDto hd=new JpStationDto();
for (JpStation jpStation : da) {
if(jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())){
hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower());
hd.setFullhour(dayGenerate.getFullhour());
hd.setDayGenerate(dayGenerate.getGenerate());
hd.setTimeDate(dayGenerate.getDayTime());
hd.setDayIncome(null);
break;
}
}
ld.add(hd);
}
return ld;
}
public List<JpStationDto> getJpStationDtomonth( List<JpStation> da, List<MonthGenerate> listmonth){
List<JpStationDto> ld=new ArrayList<>();
for (MonthGenerate dayGenerate : listmonth) {
JpStationDto hd=new JpStationDto();
for (JpStation jpStation : da) {
if(jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())){
hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower());
hd.setMonthIncome(dayGenerate.getGenerate());
hd.setTimeDate(dayGenerate.getMonthTime());
hd.setFullhour(dayGenerate.getFullhour());
hd.setMonthGenerate(null);
break;
}
}
ld.add(hd);
}
return ld;
}
public List<JpStationDto> getJpStationDtoyear( List<JpStation> da,List<YearGenerate> listyear){
List<JpStationDto> ld=new ArrayList<>();
for (YearGenerate dayGenerate : listyear) {
JpStationDto hd=new JpStationDto();
for (JpStation jpStation : da) {
if(jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())){
hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower());
hd.setFullhour(dayGenerate.getFullhour());
hd.setYearGenerate(dayGenerate.getGenerate());
hd.setYearIncome(null);
hd.setTimeDate(dayGenerate.getYearTime());
break;
}
}
ld.add(hd);
}
return ld;
}
}
\ No newline at end of file
......@@ -370,8 +370,8 @@ public class IdxBizFanWarningRecordController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectEquipWarningTotal")
@ApiOperation(httpMethod = "GET", value = "预警信息统计富文本", notes = "预警信息统计富文本")
public ResponseModel<List<Map<String,Object>>> selectEquipWarningTotal(@RequestParam String STATION,@RequestParam String EQUIPMENTNAME) {
List<Map<String, Object>> maps = fanWaringRecordMapper.selectEquipWarningTotal(STATION,EQUIPMENTNAME);
public ResponseModel<Map<String,Object>> selectEquipWarningTotal(@RequestParam String STATION,@RequestParam String EQUIPMENTNAME) {
Map<String, Object> maps = fanWaringRecordMapper.selectEquipWarningTotal(STATION,EQUIPMENTNAME);
return ResponseHelper.buildResponse(maps);
}
......
......@@ -507,7 +507,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectWarningPoint")
@ApiOperation(httpMethod = "GET", value = "预警监测设备右侧预警重复列表", notes = "预警监测设备右侧预警重复列表")
public ResponseModel<Page<PvWarningRecord>> selectFanWarningNum(@RequestParam String STATION,@RequestParam String EQUIPMENTNAME,@RequestParam String SUBARRAY,Integer current,Integer size) {
public ResponseModel<Page<PvWarningRecord>> selectFanWarningNum(@RequestParam String STATION,@RequestParam String EQUIPMENTNAME,@RequestParam(required = false) String SUBARRAY,Integer current,Integer size) {
Page<PvWarningRecord> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
......@@ -522,10 +522,10 @@ public class IdxBizPvHealthIndexController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectEquipWarningTotal")
@ApiOperation(httpMethod = "GET", value = "预警信息统计富文本", notes = "预警信息统计富文本")
public ResponseModel<List<Map<String,Object>>> selectEquipWarningTotal(@RequestParam String STATION,@RequestParam String EQUIPMENTNAME,@RequestParam String SUBARRAY) {
List<Map<String, Object>> maps = pvWaringRecordMapper.selectEquipWarningTotal(STATION,EQUIPMENTNAME,SUBARRAY);
public ResponseModel<Map<String,Object>> selectEquipWarningTotal(@RequestParam String STATION,@RequestParam String EQUIPMENTNAME,@RequestParam(required = false) String SUBARRAY) {
Map<String, Object> map = pvWaringRecordMapper.selectEquipWarningTotal(STATION,EQUIPMENTNAME,SUBARRAY);
return ResponseHelper.buildResponse(maps);
return ResponseHelper.buildResponse(map);
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
......
......@@ -22,7 +22,7 @@ public interface FanWaringRecordMapper extends BaseMapper<FanWarningRecord> {
public List<FanWarningRecord> selectWarningPoint(String STATION,String EQUIPMENTNAME,Integer current,Integer size);
public int selectWarningPointTotal(String STATION,String EQUIPMENTNAME);
public List<Map<String,Object>> selectEquipWarningTotal(String STATION,String EQUIPMENTNAME);
public Map<String,Object> selectEquipWarningTotal(String STATION,String EQUIPMENTNAME);
int saveBatchWarningRecords(@Param("list") List<FanWarningRecord> list);
......
......@@ -11,7 +11,7 @@ import java.util.Map;
public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex,`health_index` AS `value`, rec_date AS recDate, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"SELECT `health_index` AS healthIndex,`health_index` AS `value`, rec_date AS recDate, analysis_time,station,equipment_name AS equipmentName, point_name as pointName, index_address as indexAddress, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
" FROM analysis_data.pv_health_index_day WHERE analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
......
......@@ -20,7 +20,7 @@ public interface PvWaringRecordMapper extends BaseMapper<PvWarningRecord> {
List<PvWarningRecord> selectWarningPoint(String STATION, String EQUIPMENTNAME, String SUBARRAY,Integer current,Integer size);
int selectWarningPointTotal(String STATION, String EQUIPMENTNAME, String SUBARRAY);
List<Map<String, Object>> selectEquipWarningTotal(String STATION, String EQUIPMENTNAME, String SUBARRAY);
Map<String, Object> selectEquipWarningTotal(String STATION, String EQUIPMENTNAME, String SUBARRAY);
List<PvWarningRecord> getInfoByPage(@Param("dto") FanHealthIndexDto dto);
......
......@@ -224,6 +224,7 @@
GROUP BY
`b`.`STATION`,
`b`.`EQUIPMENT_NAME`
limit 1
</select>
<select id="getInfoByPage" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvWarningRecord">
......
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