Commit 9e4cf658 authored by chenzhao's avatar chenzhao

批量将valueDouble 修改成 valueF

parent 50a037b2
......@@ -3,7 +3,6 @@ package com.yeejoin.amos.boot.module.jxiop.biz.ESDto;
import io.github.classgraph.json.Id;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
......@@ -43,7 +42,7 @@ public class ESEquipments {
@Field(type = FieldType.Text, index = false)
private String value;
@Field(type = FieldType.Float, index = false)
private Float valueDouble;
private Float valueF;
@Field(type = FieldType.Text , index = false)
private String valueLabel;
@Field(type = FieldType.Text , index = false)
......@@ -62,9 +61,9 @@ public class ESEquipments {
private String displayName;
public ESEquipments(Float valueDouble,String id, String address, String dataType, String equipmentSpecificName, String gatewayId, String isAlarm, Date createdTime, String unit, String value, String valueLabel, String traceId, String equipmentIndexName, String equipmentNumber, String frontModule, String systemType, String pictureName, String displayName) {
public ESEquipments(Float valueF, String id, String address, String dataType, String equipmentSpecificName, String gatewayId, String isAlarm, Date createdTime, String unit, String value, String valueLabel, String traceId, String equipmentIndexName, String equipmentNumber, String frontModule, String systemType, String pictureName, String displayName) {
this.valueDouble = valueDouble;
this.valueF = valueF;
this.id = id;
this.address = address;
this.dataType = dataType;
......
......@@ -23,23 +23,16 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.io.IOUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.metrics.ParsedSum;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.SearchHit;
import org.springframework.data.elasticsearch.core.SearchHits;
......@@ -1047,12 +1040,12 @@ public class MonitorFanIdxController extends BaseController {
map.put("name",key);
for (ESEquipments equip : resultMap.get(key)) {
if (!stationBasic.getStationType().equals("FDZ")){
float value = equip.getValueDouble();
float value = equip.getValueF();
float v = CommonConstans.pvGenPoweActor.floatValue();
equip.setValueDouble(value * v);
equip.setValueF(value * v);
}
String value = String.format("%.4f", equip.getValueDouble());
String value = String.format("%.4f", equip.getValueF());
switch(equip.getEquipmentIndexName()){
case "日发电量":
map.put("dayNum",value);
......
......@@ -9,7 +9,6 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.MapRegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IndicatorsDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.QueryDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.SocialContributionDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
......@@ -284,7 +283,7 @@ public class CommonServiceImpl {
public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).mapToDouble(ESEquipments::getValueDouble).sum();
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).mapToDouble(ESEquipments::getValueF).sum();
return result;
}
......
......@@ -10,12 +10,10 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.api.Enum.ElectricQuantity;
import com.yeejoin.amos.boot.module.jxiop.api.Enum.KGName;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.TreeDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper;
......@@ -35,16 +33,11 @@ import com.yeejoin.amos.component.robot.BadRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.runtime.directive.Break;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.elasticsearch.common.recycler.Recycler;
import org.elasticsearch.index.Index;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
......@@ -616,7 +609,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值", "南瑞光差保护_313P"));
List<ESEquipments> indicatorsDtoList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
double sum = indicatorsDtoList.stream().mapToDouble(t -> Double.parseDouble(t.getValueDouble().toString())).sum();
double sum = indicatorsDtoList.stream().mapToDouble(t -> Double.parseDouble(t.getValueF().toString())).sum();
Double format = Double.parseDouble(String.format("%.2f", sum / installedCapacity));
List<Map<String, Object>> list = temporaryDataMapper.timingTemporarysSorageData(gatewayId);
Map<String,Object> map = new HashMap<>();
......
......@@ -40,7 +40,7 @@ public class ESEquipments {
@Field(type = FieldType.Text)
private String value;
@Field(type = FieldType.Float, index = false)
private Float valueDouble;
private Float valueF;
@Field(type = FieldType.Text)
private String valueLabel;
@Field(type = FieldType.Text , index = false)
......@@ -59,9 +59,9 @@ public class ESEquipments {
private String displayName;
public ESEquipments(Float valueDouble,String id, String address, String dataType, String equipmentSpecificName, String gatewayId, String isAlarm, Date createdTime, String unit, String value, String valueLabel, String traceId, String equipmentIndexName, String equipmentNumber, String frontModule, String systemType, String pictureName, String displayName) {
public ESEquipments(Float valueF, String id, String address, String dataType, String equipmentSpecificName, String gatewayId, String isAlarm, Date createdTime, String unit, String value, String valueLabel, String traceId, String equipmentIndexName, String equipmentNumber, String frontModule, String systemType, String pictureName, String displayName) {
this.valueDouble = valueDouble;
this.valueF = valueF;
this.id = id;
this.address = address;
this.dataType = dataType;
......
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import cn.hutool.extra.pinyin.PinyinUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.jxiop.api.Enum.GeneratingCapacity;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.TreeDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
......@@ -225,7 +223,7 @@ public class MonitorFanIdxController extends BaseController {
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result1 = commonService.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
columnMap.put("有功功率", String.format("%.2f",result1.get(0).getValueDouble()));
columnMap.put("有功功率", String.format("%.2f",result1.get(0).getValueF()));
String num = monitorFanIndicator.getEquipCount(gatewayId,"FDZ");
columnMap.put("风机台数",num);
......@@ -617,7 +615,7 @@ public class MonitorFanIdxController extends BaseController {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result1 = commonService.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
columnMap.put("有功功率", String.format("%.2f",result1.get(0).getValueDouble()));
columnMap.put("有功功率", String.format("%.2f",result1.get(0).getValueF()));
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and(equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' or equipmentIndexName='有功功率')");
//日-月-年-发电量需要保留四位小数问题修改
......
......@@ -15,7 +15,7 @@ public class ESEquipmentsDTO {
private Date createdTime;
private String unit;
private String value;
private Float valueDouble;
private Float valueF;
private String valueLabel;
private String traceId;
private String equipmentIndexName;
......
......@@ -40,7 +40,6 @@ import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import javax.sql.rowset.serial.SerialJavaObject;
import java.util.*;
import java.util.stream.Collectors;
......@@ -226,7 +225,7 @@ public class CommonServiceImpl {
List<ESEquipments> result = getListDataByCondtions(queryCondtion, null, ESEquipments.class);
Double totalvalue = 0.00;
try {
totalvalue = result.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.getValueDouble())).mapToDouble(l -> Double.parseDouble(l.getValueDouble().toString())).sum();
totalvalue = result.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.getValueF())).mapToDouble(l -> Double.parseDouble(l.getValueF().toString())).sum();
} catch (Exception e) {
return totalvalue;
}
......@@ -244,7 +243,7 @@ public class CommonServiceImpl {
List<ESEquipments> result = getListDataByCondtions(queryCondtion, null, ESEquipments.class,likeQuerCondtion);
Double totalvalue = 0.00;
try {
totalvalue = result.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.getValueDouble())).mapToDouble(l -> Double.parseDouble(l.getValueDouble().toString())).sum();
totalvalue = result.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.getValueF())).mapToDouble(l -> Double.parseDouble(l.getValueF().toString())).sum();
} catch (Exception e) {
return totalvalue;
}
......@@ -574,13 +573,13 @@ public class CommonServiceImpl {
}
public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).mapToDouble(ESEquipments::getValueDouble).average().getAsDouble();
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).mapToDouble(ESEquipments::getValueF).average().getAsDouble();
return result;
}
public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).mapToDouble(ESEquipments::getValueDouble).sum();
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).mapToDouble(ESEquipments::getValueF).sum();
return result;
}
......
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