Commit 556d9ab3 authored by tangwei's avatar tangwei

增加接口

parent 0e9616bc
package com.yeejoin.amos.boot.module.jxiop.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "station_plan",autoResultMap = true)
public class StationPlan extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 场站名称
*/
@TableField("station_name")
private String stationName;
/**
* 场站编号
*/
@TableField("station_basic_id")
private String stationBasicId;
/**
* 月份
*/
@TableField("monthly")
private String monthly;
/**
* 计划值kw.h
*
* */
@TableField("value")
private Double value;
}
package com.yeejoin.amos.boot.module.jxiop.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonAccount;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationPlan;
/**
* @description:
* @author: tw
* @createDate: 2023/8/10
*/
public interface StationPlanMapper extends BaseMapper<StationPlan> {
}
package com.yeejoin.amos.boot.module.jxiop.api.service;
/**
* @description:
* @author: tw
* @createDate: 2023/8/10
*/
public interface IStationPlanService {
}
\ No newline at end of file
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator; import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic; import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper;
...@@ -31,10 +32,16 @@ import org.elasticsearch.index.query.MatchQueryBuilder; ...@@ -31,10 +32,16 @@ import org.elasticsearch.index.query.MatchQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.TermsQueryBuilder; import org.elasticsearch.index.query.TermsQueryBuilder;
import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.AggregationBuilder; import org.elasticsearch.search.aggregations.AggregationBuilder;
import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
import org.elasticsearch.search.aggregations.metrics.AvgAggregationBuilder; import org.elasticsearch.search.aggregations.metrics.AvgAggregationBuilder;
import org.elasticsearch.search.aggregations.metrics.ParsedAvg;
import org.elasticsearch.search.aggregations.metrics.ParsedSum;
import org.elasticsearch.search.aggregations.metrics.SumAggregationBuilder; import org.elasticsearch.search.aggregations.metrics.SumAggregationBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -53,6 +60,9 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -53,6 +60,9 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -86,6 +96,19 @@ public class DemoController extends BaseController { ...@@ -86,6 +96,19 @@ public class DemoController extends BaseController {
@Autowired @Autowired
CommonServiceImpl commonServiceImpl; CommonServiceImpl commonServiceImpl;
private final String ss= "瞬时风速";
private final String zfs= "WTX-801_25_WTX-801_总辐射";
private final String zfslj= "WTX-801_25_WTX-801_总辐射累计";
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "demo测试prodcutcion 库") @ApiOperation(value = "demo测试prodcutcion 库")
@GetMapping("/test") @GetMapping("/test")
...@@ -389,4 +412,78 @@ public class DemoController extends BaseController { ...@@ -389,4 +412,78 @@ public class DemoController extends BaseController {
public List<StationCacheInfoDto> demoTest12() { public List<StationCacheInfoDto> demoTest12() {
return commonServiceImpl.getListStationCacheInfoDto(); return commonServiceImpl.getListStationCacheInfoDto();
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "分组平均数")
@GetMapping("/test13")
public Map demoTest13() {
List<String> value=new ArrayList<>();
value.add(ss);
value.add(zfs);
value.add(zfslj);
Map<String,List<String>> map=new HashMap<>();
map.put("equipmentIndexName.keyword",value);
// List<String> value1=new ArrayList<>();
// value1.add("1668801435891929089");
// map.put("gatewayId.keyword",value1);
List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupavg(map,"valueDouble" ,"equipmentIndexName.keyword",ESEquipments.class);
Map<String,Object> mapdta=new HashMap<>();
DecimalFormat format2 = new DecimalFormat("#.0000");
for (Terms.Bucket bucket : lidate) {
Aggregations aggregation= bucket.getAggregations();
List<Aggregation> listdata= Objects.nonNull(aggregation)?aggregation.asList():null;
for (Aggregation agg : listdata) {
ParsedAvg parsedAvg =(ParsedAvg)agg;
mapdta.put(bucket.getKeyAsString(), format2.format(parsedAvg.getValue()));
}
}
return mapdta;
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "分组求和数")
@GetMapping("/test14")
public Map demoTest14() {
List<String> value=new ArrayList<>();
value.add(ss);
value.add(zfs);
value.add(zfslj);
Map<String,List<String>> map=new HashMap<>();
map.put("equipmentIndexName.keyword",value);
// List<String> value1=new ArrayList<>();
// value1.add("1668801435891929089");
// map.put("gatewayId.keyword",value1);
List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupsum(map,"valueDouble" ,"equipmentIndexName.keyword",ESEquipments.class);
Map<String,Object> mapdta=new HashMap<>();
DecimalFormat format2 = new DecimalFormat("#.0000");
for (Terms.Bucket bucket : lidate) {
Aggregations aggregation= bucket.getAggregations();
List<Aggregation> listdata= Objects.nonNull(aggregation)?aggregation.asList():null;
for (Aggregation agg : listdata) {
ParsedSum parsedSum =(ParsedSum)agg;
mapdta.put(bucket.getKeyAsString(), format2.format(parsedSum.getValue()));
}
}
return mapdta;
}
} }
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.scheduled; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.scheduled;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESDailyPowerGeneration; import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESDailyPowerGeneration;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESMoonPowerGeneration; import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESMoonPowerGeneration;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.PowerGenerationImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.PowerGenerationImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
...@@ -24,6 +25,8 @@ public class PowerGeneration { ...@@ -24,6 +25,8 @@ public class PowerGeneration {
@Autowired @Autowired
PowerGenerationImpl powerGenerationImpl; PowerGenerationImpl powerGenerationImpl;
@Autowired
CommonServiceImpl commonServiceImpl;
private final String dayvalue="日发电量"; private final String dayvalue="日发电量";
private final String moonValue="月发电量"; private final String moonValue="月发电量";
...@@ -41,7 +44,7 @@ public class PowerGeneration { ...@@ -41,7 +44,7 @@ public class PowerGeneration {
//定时更新日发电量 //定时更新日发电量
// @Scheduled(cron = "${daily.power.generation.cron}") // @Scheduled(cron = "${daily.power.generation.cron}")
public void addESDailyPowerGeneration(){ public void addESDailyPowerGeneration(){
List<StationCacheInfoDto> list =new ArrayList<>(); List<StationCacheInfoDto> list =commonServiceImpl.getListStationCacheInfoDto();
for (StationCacheInfoDto stationCacheInfoDto : list) { for (StationCacheInfoDto stationCacheInfoDto : list) {
//风机 //风机
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), dayvalue, dayDateFormat, dayType); powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), dayvalue, dayDateFormat, dayType);
...@@ -54,32 +57,24 @@ public class PowerGeneration { ...@@ -54,32 +57,24 @@ public class PowerGeneration {
//定时更新月发电量 //定时更新月发电量
// @Scheduled(cron = "${moon.power.generation.cron}") // @Scheduled(cron = "${moon.power.generation.cron}")
public void addESMoonPowerGeneration(){ public void addESMoonPowerGeneration(){
List<StationCacheInfoDto> list =commonServiceImpl.getListStationCacheInfoDto();
List<StationCacheInfoDto> list =new ArrayList<>();
for (StationCacheInfoDto stationCacheInfoDto : list) { for (StationCacheInfoDto stationCacheInfoDto : list) {
//风机 //风机
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), moonValue, moonDateFormat, moonType); powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), moonValue, moonDateFormat, moonType);
//光伏 //光伏
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getBoosterGatewayId(), moonValue, moonDateFormat, moonType); powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getBoosterGatewayId(), moonValue, moonDateFormat, moonType);
} }
} }
//定时更新年发电量 //定时更新年发电量
//@Scheduled(cron = "${year.power.generation.cron}") //@Scheduled(cron = "${year.power.generation.cron}")
public void addESYearPowerGeneration(){ public void addESYearPowerGeneration(){
List<StationCacheInfoDto> list =commonServiceImpl.getListStationCacheInfoDto();
List<StationCacheInfoDto> list =new ArrayList<>();
for (StationCacheInfoDto stationCacheInfoDto : list) { for (StationCacheInfoDto stationCacheInfoDto : list) {
//风机 //风机
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), yearValue, yearDateFormat, yearType); powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), yearValue, yearDateFormat, yearType);
//光伏 //光伏
powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getBoosterGatewayId(), yearValue, yearDateFormat, yearType); powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getBoosterGatewayId(), yearValue, yearDateFormat, yearType);
} }
} }
......
...@@ -19,8 +19,13 @@ import org.apache.poi.ss.formula.functions.T; ...@@ -19,8 +19,13 @@ import org.apache.poi.ss.formula.functions.T;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.Aggregations; import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms;
import org.elasticsearch.search.aggregations.bucket.terms.ParsedTerms;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
import org.elasticsearch.search.aggregations.metrics.*; import org.elasticsearch.search.aggregations.metrics.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
...@@ -88,6 +93,74 @@ public class CommonServiceImpl { ...@@ -88,6 +93,74 @@ public class CommonServiceImpl {
} }
/*
*分组平均值
**/
public List<? extends Terms.Bucket> getgroupavg(Map<String,List<String>> value,String keyavg,String groupKey,Class clas){
List<? extends Terms.Bucket> listdata=null;
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
for(String key:value.keySet()){
List<String> va= value.get(key);
queryBuilder.must( QueryBuilders.termsQuery(key, va));
}
TermsAggregationBuilder tb1 = AggregationBuilders.terms("groupKey").field(groupKey);
AvgAggregationBuilder buyCountAvg = AggregationBuilders.avg("buyCountAvg").field(keyavg);
tb1.subAggregation(buyCountAvg); // 通过typeId字段分组统计总数
Query query = new NativeSearchQueryBuilder()
.withQuery(queryBuilder)
.addAggregation(tb1)
.withPageable(PageRequest.of(0, 1))
.build();
query.setTrackTotalHits(true);
SearchHits search = elasticsearchTemplate.search(query, ESEquipments.class);
if (search.hasAggregations()) {
Aggregations aggregations = search.getAggregations();
if (Objects.nonNull(aggregations)) {
List<Aggregation> list= aggregations.asList();
listdata= list!=null&&!list.isEmpty()?((ParsedStringTerms) list.get(0)).getBuckets():null;
}
}
return listdata;
}
/*
*分组求和
**/
public List<? extends Terms.Bucket> getgroupsum(Map<String,List<String>> value,String keyavg,String groupKey,Class clas){
List<? extends Terms.Bucket> listdata=null;
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
for(String key:value.keySet()){
List<String> va= value.get(key);
queryBuilder.must( QueryBuilders.termsQuery(key, va));
}
TermsAggregationBuilder tb1 = AggregationBuilders.terms("groupKey").field(groupKey);
SumAggregationBuilder buyCountSum = AggregationBuilders.sum("buyCountSum").field(keyavg);
tb1.subAggregation(buyCountSum); // 通过typeId字段分组统计总数
Query query = new NativeSearchQueryBuilder()
.withQuery(queryBuilder)
.addAggregation(tb1)
.withPageable(PageRequest.of(0, 1))
.build();
query.setTrackTotalHits(true);
SearchHits search = elasticsearchTemplate.search(query, ESEquipments.class);
if (search.hasAggregations()) {
Aggregations aggregations = search.getAggregations();
if (Objects.nonNull(aggregations)) {
List<Aggregation> list= aggregations.asList();
listdata= list!=null&&!list.isEmpty()?((ParsedStringTerms) list.get(0)).getBuckets():null;
}
}
return listdata;
}
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @description:
* @author: tw
* @createDate: 2023/8/10
*/
@Service
public class IargeScreenImpl {
@Autowired
CommonServiceImpl commonServiceImpl;
private final String ss= "瞬时风速";
private final String zfs= "WTX-801_25_WTX-801_总辐射";
private final String zfslj= "WTX-801_25_WTX-801_总辐射累计";
private final String ss= "瞬时风速";
private final String zfs= "WTX-801_25_WTX-801_总辐射";
private final String zfslj= "WTX-801_25_WTX-801_总辐射累计";
/**
*
* 全国
*
* */
public Map<String,Object> getqg(){
}
/**
*
* 区域
*
* **/
public Map<String,Object> getqy(){}
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESDailyPowerGeneration;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESMoonPowerGeneration;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESYearPowerGeneration;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
import com.yeejoin.amos.boot.module.jxiop.biz.repository.ESDailyPowerGenerationRepository;
import com.yeejoin.amos.boot.module.jxiop.biz.repository.ESEquipmentsRepository;
import com.yeejoin.amos.boot.module.jxiop.biz.repository.ESMoonPowerGenerationRepository;
import com.yeejoin.amos.boot.module.jxiop.biz.repository.ESYearPowerGenerationRepository;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;
/**
* @description:
* @author: tw
* @createDate: 2023/8/9
*/
@Service
public class PowerGenerationImpl {
@Autowired
InfluxDButils influxDButils;
@Autowired
private ElasticsearchRestTemplate elasticsearchTemplate;
@Autowired
ESYearPowerGenerationRepository yearPowerGenerationRepository;
@Autowired
ESMoonPowerGenerationRepository moonPowerGenerationRepository;
@Autowired
ESDailyPowerGenerationRepository dailyPowerGenerationRepository;
//获取指定指标,当天最后一条数据
public List<IndexDto> getlast(String gatewayId, String value){
IndexDto indexDto=null;
//获取时间天字符串
SimpleDateFormat myFmt2=new SimpleDateFormat("yyyy-MM-dd");
Date now=new Date();
String daty= myFmt2.format(now);
String querySql = " SELECT * FROM iot_data_%s WHERE equipmentIndexName='%s' and time >='%sT23:55:00Z' AND time < '%sT23:59:59Z' group by address order by time desc LIMIT 1";
querySql = String.format(querySql, gatewayId, value,daty,daty);
List<IndexDto> queryList = influxDButils.getListData(querySql,IndexDto.class);
return queryList;
}
//更新es 数据
@Async("jxiopAsyncExecutor")
public void addPowerGeneration(StationCacheInfoDto stationCacheInfoDto,String gatewayId, String value, String dateFormat, String type){
//获取指标值
List<IndexDto> indexDto= this.getlast(gatewayId,value);
SimpleDateFormat myFmt2=new SimpleDateFormat(dateFormat);
Date now=new Date();
String daty= myFmt2.format(now);
this.PowerGeneration(stationCacheInfoDto,indexDto,daty,type);
}
//更新es
public void PowerGeneration(StationCacheInfoDto stationCacheInfoDto,List<IndexDto> indexDto,String daty,String type){
switch (type) {
case "day":
List<ESDailyPowerGeneration> listd= this.getESDailyPowerGeneration(stationCacheInfoDto,indexDto,type);
dailyPowerGenerationRepository.saveAll(listd);
break;
case "moon":
List<ESMoonPowerGeneration> listm= this.getESMoonPowerGeneration(stationCacheInfoDto,indexDto,type);
moonPowerGenerationRepository.saveAll(listm);
break;
case "year":
List<ESYearPowerGeneration> listy= this.getESYearPowerGeneration(stationCacheInfoDto,indexDto,type);
yearPowerGenerationRepository.saveAll(listy);
break;
default:
break;
}
}
// 组装数据
public List<ESDailyPowerGeneration> getESDailyPowerGeneration(StationCacheInfoDto stationCacheInfoDto,List<IndexDto> indexDto,String daty){
List<ESDailyPowerGeneration> list=new ArrayList<>();
if(indexDto!=null&&!indexDto.isEmpty()){
for (IndexDto dto : indexDto) {
ESDailyPowerGeneration dailyPowerGeneration=new ESDailyPowerGeneration(
daty+"_"+dto.getAddress(),
stationCacheInfoDto.getStationId(),
stationCacheInfoDto.getStationName(),
stationCacheInfoDto.getStationType(),
stationCacheInfoDto.getBelongProvince(),
stationCacheInfoDto.getBelongArea(),
daty,
dto.getGatewayId(),
new Date(),
dto.getValue()!=null?Double.valueOf(dto.getValue()):null,
dto.getEquipmentIndexName(),
dto.getEquipmentNumber(),
dto.getAddress()
);
list.add(dailyPowerGeneration);
}
}
return list;
}
public List<ESMoonPowerGeneration> getESMoonPowerGeneration(StationCacheInfoDto stationCacheInfoDto,List<IndexDto> indexDto,String daty){
List<ESMoonPowerGeneration> list=new ArrayList<>();
if(indexDto!=null&&!indexDto.isEmpty()){
for (IndexDto dto : indexDto) {
ESMoonPowerGeneration moonPowerGeneration=new ESMoonPowerGeneration(
daty+"_"+dto.getAddress(),
stationCacheInfoDto.getStationId(),
stationCacheInfoDto.getStationName(),
stationCacheInfoDto.getStationType(),
stationCacheInfoDto.getBelongProvince(),
stationCacheInfoDto.getBelongArea(),
daty,
dto.getGatewayId(),
new Date(),
dto.getValue()!=null?Double.valueOf(dto.getValue()):null,
dto.getEquipmentIndexName(),
dto.getEquipmentNumber(),
dto.getAddress()
);
list.add(moonPowerGeneration);
}
}
return list;
}
public List<ESYearPowerGeneration> getESYearPowerGeneration(StationCacheInfoDto stationCacheInfoDto,List<IndexDto> indexDto,String daty){
List<ESYearPowerGeneration> list=new ArrayList<>();
if(indexDto!=null&&!indexDto.isEmpty()){
for (IndexDto dto : indexDto) {
ESYearPowerGeneration yearPowerGeneration=new ESYearPowerGeneration(
daty+"_"+dto.getAddress(),
stationCacheInfoDto.getStationId(),
stationCacheInfoDto.getStationName(),
stationCacheInfoDto.getStationType(),
stationCacheInfoDto.getBelongProvince(),
stationCacheInfoDto.getBelongArea(),
daty,
dto.getGatewayId(),
new Date(),
dto.getValue()!=null?Double.valueOf(dto.getValue()):null,
dto.getEquipmentIndexName(),
dto.getEquipmentNumber(),
dto.getAddress()
);
list.add(yearPowerGeneration);
}
}
return list;
}
}
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