Commit b33d7b8b authored by tangwei's avatar tangwei

解决冲突

parents 3920d3a3 b8847919
......@@ -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.constants.CommonConstans;
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 org.apache.velocity.runtime.directive.contrib.For;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -69,7 +72,8 @@ public class MonitoringServiceImpl {
EmqKeeper emqKeeper;
@Autowired
InfluxdbUtil influxdbUtil;
@Autowired
IndicatorDataMapper indicatorDataMapper;
/**
* 根据场站编号获取该场站的装机容量
......@@ -271,8 +275,8 @@ public class MonitoringServiceImpl {
int year = Calendar.getInstance().get(Calendar.YEAR);
List<String> fdz = stationBasicList.stream().map(StationCacheInfoDto::getStationId).collect(Collectors.toList());
LambdaQueryWrapper<StationPlan> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StationPlan::getYear,String.valueOf(year));
queryWrapper.in(StationPlan::getStationBasicId,fdz);
queryWrapper.eq(StationPlan::getYear, String.valueOf(year));
queryWrapper.in(StationPlan::getStationBasicId, fdz);
List<StationPlan> fdzPlans = stationPlanMapper.selectList(queryWrapper);
double value = fdzPlans.stream().mapToDouble(StationPlan::getValue).sum();
......@@ -303,7 +307,7 @@ public class MonitoringServiceImpl {
}
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();
dailyPowerdto.setTitle(String.format(CommonConstans.Twodecimalplaces, dailyPower.get()));
dailyPowerdto.setUnit("万kWh");
......@@ -994,7 +998,7 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
Map<String, String> shouldQueryCondtion = new HashMap<>();
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));
}
});
......@@ -1059,9 +1063,15 @@ public class MonitoringServiceImpl {
// };
public HashMap<String, Object> getTheStationPowerCurve(String stationId, String date) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
HashMap<String, Object> result = new HashMap<>();
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轴数据
List<String> xdata = new ArrayList<>();
//实时有功功率
......@@ -1070,12 +1080,21 @@ public class MonitoringServiceImpl {
List<String> shortPowerYdata = new ArrayList<>();
//超短期功率预测
List<String> superPowerShortYdata = new ArrayList<>();
if (ObjectUtils.isEmpty(indicatorDataList)) {
for (int i = 0; i < 25; i++) {
xdata.add(String.format("%02d", i) + ":00");
Random random = new Random();
currentPowerYdata.add(String.format(CommonConstans.Twodecimalplaces, random.nextDouble() * 30));
shortPowerYdata.add(String.format(CommonConstans.Twodecimalplaces, random.nextDouble() * 40));
superPowerShortYdata.add(String.format(CommonConstans.Twodecimalplaces, random.nextDouble() * 50));
currentPowerYdata.add("0.00");
shortPowerYdata.add("0.00");
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);
HashMap<String, Object> currentPowerHashMap = new HashMap<>();
......
......@@ -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} ")
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