Commit b33d7b8b authored by tangwei's avatar tangwei

解决冲突

parents 3920d3a3 b8847919
...@@ -11,7 +11,10 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.*; ...@@ -11,7 +11,10 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.*;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments; import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans; import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*; import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil; import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import org.apache.velocity.runtime.directive.contrib.For;
import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -69,7 +72,8 @@ public class MonitoringServiceImpl { ...@@ -69,7 +72,8 @@ public class MonitoringServiceImpl {
EmqKeeper emqKeeper; EmqKeeper emqKeeper;
@Autowired @Autowired
InfluxdbUtil influxdbUtil; InfluxdbUtil influxdbUtil;
@Autowired
IndicatorDataMapper indicatorDataMapper;
/** /**
* 根据场站编号获取该场站的装机容量 * 根据场站编号获取该场站的装机容量
...@@ -270,11 +274,11 @@ public class MonitoringServiceImpl { ...@@ -270,11 +274,11 @@ public class MonitoringServiceImpl {
//年利用小时数 //年利用小时数
int year = Calendar.getInstance().get(Calendar.YEAR); int year = Calendar.getInstance().get(Calendar.YEAR);
List<String> fdz = stationBasicList.stream().map(StationCacheInfoDto::getStationId).collect(Collectors.toList()); List<String> fdz = stationBasicList.stream().map(StationCacheInfoDto::getStationId).collect(Collectors.toList());
LambdaQueryWrapper<StationPlan> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StationPlan> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StationPlan::getYear,String.valueOf(year)); queryWrapper.eq(StationPlan::getYear, String.valueOf(year));
queryWrapper.in(StationPlan::getStationBasicId,fdz); queryWrapper.in(StationPlan::getStationBasicId, fdz);
List<StationPlan> fdzPlans = stationPlanMapper.selectList(queryWrapper); List<StationPlan> fdzPlans = stationPlanMapper.selectList(queryWrapper);
double value = fdzPlans.stream().mapToDouble(StationPlan::getValue).sum(); double value = fdzPlans.stream().mapToDouble(StationPlan::getValue).sum();
AtomicReference<Double> useHours = new AtomicReference<>(0.0); AtomicReference<Double> useHours = new AtomicReference<>(0.0);
AtomicReference<Double> installCapacity = new AtomicReference<>(0.0); AtomicReference<Double> installCapacity = new AtomicReference<>(0.0);
...@@ -303,7 +307,7 @@ public class MonitoringServiceImpl { ...@@ -303,7 +307,7 @@ public class MonitoringServiceImpl {
} }
installCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity())); installCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
}); });
completionRatio = String.format("%.2f",(annualPower.get()*100) / value); completionRatio = String.format("%.2f", (annualPower.get() * 100) / value);
SocialContributionDto dailyPowerdto = new SocialContributionDto(); SocialContributionDto dailyPowerdto = new SocialContributionDto();
dailyPowerdto.setTitle(String.format(CommonConstans.Twodecimalplaces, dailyPower.get())); dailyPowerdto.setTitle(String.format(CommonConstans.Twodecimalplaces, dailyPower.get()));
dailyPowerdto.setUnit("万kWh"); dailyPowerdto.setUnit("万kWh");
...@@ -994,7 +998,7 @@ public class MonitoringServiceImpl { ...@@ -994,7 +998,7 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
Map<String, String> shouldQueryCondtion = new HashMap<>(); Map<String, String> shouldQueryCondtion = new HashMap<>();
shouldQueryCondtion.put(CommonConstans.QueryStringFrontMoudle, "逆变器"); shouldQueryCondtion.put(CommonConstans.QueryStringFrontMoudle, "逆变器");
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class,shouldQueryCondtion); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, shouldQueryCondtion);
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量") * CommonConstans.pvGenPoweActor)); stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量") * CommonConstans.pvGenPoweActor));
} }
}); });
...@@ -1059,9 +1063,15 @@ public class MonitoringServiceImpl { ...@@ -1059,9 +1063,15 @@ public class MonitoringServiceImpl {
// }; // };
public HashMap<String, Object> getTheStationPowerCurve(String stationId, String date) { public HashMap<String, Object> getTheStationPowerCurve(String stationId, String date) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
HashMap<String, Object> result = new HashMap<>(); HashMap<String, Object> result = new HashMap<>();
List<HashMap<String, Object>> hashMapList = new ArrayList<>(); List<HashMap<String, Object>> hashMapList = new ArrayList<>();
StationBasic stationBasic = stationBasicMapper.selectById(stationId); List<IndicatorData> indicatorDataList = new ArrayList<>();
if(stationBasic.getStationType().equals("FDZ")){
indicatorDataList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值",date+" 00:00:00",date +" 23:59:59",stationBasic.getBoosterGatewayId());
}else {
indicatorDataList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime("南瑞光差保护_313P-9705TA有功功率一次值",date+" 00:00:00",date +" 23:59:59",stationBasic.getBoosterGatewayId());
}
//x轴数据 //x轴数据
List<String> xdata = new ArrayList<>(); List<String> xdata = new ArrayList<>();
//实时有功功率 //实时有功功率
...@@ -1070,12 +1080,21 @@ public class MonitoringServiceImpl { ...@@ -1070,12 +1080,21 @@ public class MonitoringServiceImpl {
List<String> shortPowerYdata = new ArrayList<>(); List<String> shortPowerYdata = new ArrayList<>();
//超短期功率预测 //超短期功率预测
List<String> superPowerShortYdata = new ArrayList<>(); List<String> superPowerShortYdata = new ArrayList<>();
for (int i = 0; i < 25; i++) { if (ObjectUtils.isEmpty(indicatorDataList)) {
xdata.add(String.format("%02d", i) + ":00"); for (int i = 0; i < 25; i++) {
Random random = new Random(); xdata.add(String.format("%02d", i) + ":00");
currentPowerYdata.add(String.format(CommonConstans.Twodecimalplaces, random.nextDouble() * 30)); currentPowerYdata.add("0.00");
shortPowerYdata.add(String.format(CommonConstans.Twodecimalplaces, random.nextDouble() * 40)); shortPowerYdata.add("0.00");
superPowerShortYdata.add(String.format(CommonConstans.Twodecimalplaces, random.nextDouble() * 50)); superPowerShortYdata.add("0.00");
}
}else{
for (int i = 0; i < indicatorDataList.size() ; i++) {
IndicatorData indicatorData = indicatorDataList.get(i);
xdata.add(DateUtil.format(indicatorData.getCreatedTime(), "HH:mm"));
currentPowerYdata.add(String.format(CommonConstans.Twodecimalplaces,indicatorData.getValueF()));
shortPowerYdata.add("0.00");
superPowerShortYdata.add("0.00");
}
} }
result.put("xData", xdata); result.put("xData", xdata);
HashMap<String, Object> currentPowerHashMap = new HashMap<>(); HashMap<String, Object> currentPowerHashMap = new HashMap<>();
......
...@@ -19,4 +19,9 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> { ...@@ -19,4 +19,9 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {
@Select("select last(`value_f`) as `value_f`,created_time from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and gateway_id=#{gatewayId} ") @Select("select last(`value_f`) as `value_f`,created_time from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and gateway_id=#{gatewayId} ")
IndicatorData selectLastDataOfPower(@Param("equipmentIndexName") String equipmentIndexName, @Param("gatewayId") String gatewayId); IndicatorData selectLastDataOfPower(@Param("equipmentIndexName") String equipmentIndexName, @Param("gatewayId") String gatewayId);
@Select("select `value`, created_time, `value_f` as valueF from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and ts >= #{startTime} and ts <= #{endTime} and gateway_id =#{gatewayId}")
List<IndicatorData> selectDataByequipmentIndexNameAndtime(@Param("equipmentIndexName") String equipmentIndexName, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayId") String gatewayId);
} }
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