Browse Source

Merge remote-tracking branch 'origin/prod'

# Conflicts:
#	hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/emParam/entity/ParamBackupsDetailEntity.java
#	hzims-service/equipment/src/main/resources/db/1.0.1.sql
#	hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/WindMapper.java
#	hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/WindService.java
#	hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/impl/WindServiceImpl.java
#	hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
#	hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/DataService.java
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlarmHandleServiceImpl.java
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/controller/HzimsDataController.java
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/HzimsDataService.java
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/wrapper/OperDefectStatisticsWrapper.java
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java
#	hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java
#	pom.xml
zhongwei
yang_shj 7 months ago
parent
commit
7e29255efa
  1. 6
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/vo/EminfoAndEmParamVo.java
  2. 17
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/data/vo/ConverElectricityVo.java
  3. 20
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/data/vo/LoadWaterLevelVo.java
  4. 22
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/data/vo/PowerConvertVo.java
  5. 19
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/data/vo/StationNumberVo.java
  6. 20
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/data/vo/WeatherRainVo.java
  7. 26
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/data/vo/WeatherWaterVo.java
  8. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/entity/UserDeptEntity.java
  9. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerStationVo.java
  10. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerStationVo.java
  11. 1
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/WindService.java
  12. 40
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  13. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java
  14. 1
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/DataService.java
  15. 7
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/impl/DataServiceImpl.java
  16. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/TicketServiceImpl.java
  17. 56
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java
  18. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java
  19. 34
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/controller/HzimsDataController.java
  20. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/HzimsDataService.java
  21. 398
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java
  22. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyChangeServiceImpl.java
  23. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyGroupServiceImpl.java
  24. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecQRRecordServiceImpl.java
  25. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAnalyseDataService.java
  26. 39
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java
  27. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java
  28. 41
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  29. 38
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java
  30. 13
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java
  31. 19
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

6
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/vo/EminfoAndEmParamVo.java

@ -16,15 +16,15 @@ public class EminfoAndEmParamVo extends EmInfoExtendVo {
@ApiModelProperty(value = "ct")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer ct;
private Double ct;
@ApiModelProperty(value = "pt")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer pt;
private Double pt;
@ApiModelProperty(value = "ct * pt")
@JsonSerialize(nullsUsing = NullSerializer.class)
private int rideCount;
private Double rideCount;
@ApiModelProperty(value = "经度")
@JsonSerialize(nullsUsing = NullSerializer.class)

17
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/data/vo/ConverElectricityVo.java

@ -0,0 +1,17 @@
package com.hnac.hzims.operational.data.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class ConverElectricityVo {
@ApiModelProperty("时间")
private String time;
@ApiModelProperty("电量")
private Double electricity;
}

20
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/data/vo/LoadWaterLevelVo.java

@ -0,0 +1,20 @@
package com.hnac.hzims.operational.data.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class LoadWaterLevelVo {
@ApiModelProperty("时间")
private String time;
@ApiModelProperty("水位")
private Double water;
@ApiModelProperty("功率")
private Double load;
}

22
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/data/vo/PowerConvertVo.java

@ -0,0 +1,22 @@
package com.hnac.hzims.operational.data.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
public class PowerConvertVo {
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("功率/水位")
private List<LoadWaterLevelVo> loadWaters;
@ApiModelProperty("发电量")
private List<ConverElectricityVo> electricitys;
}

19
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/data/vo/StationNumberVo.java

@ -0,0 +1,19 @@
package com.hnac.hzims.operational.data.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
@ApiModel(value = "水利站点首页对象")
public class StationNumberVo {
@ApiModelProperty(value = "站点类型")
private Integer type;
@ApiModelProperty(value = "站点数量")
private Integer count;
}

20
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/data/vo/WeatherRainVo.java

@ -0,0 +1,20 @@
package com.hnac.hzims.operational.data.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class WeatherRainVo {
@ApiModelProperty("时间")
private String time;
@ApiModelProperty("水位")
private Double water;
@ApiModelProperty("降雨量")
private Double rain;
}

26
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/data/vo/WeatherWaterVo.java

@ -0,0 +1,26 @@
package com.hnac.hzims.operational.data.vo;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
public class WeatherWaterVo {
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("限制水位")
private Double limitWater;
@ApiModelProperty("天气")
private List<Daily> dailys;
@ApiModelProperty("发电量")
private List<WeatherRainVo> weatherRains;
}

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/entity/UserDeptEntity.java

@ -28,6 +28,4 @@ public class UserDeptEntity extends TenantEntity implements Serializable {
@ApiModelProperty("机构Id")
private Long deptId;
}

4
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerStationVo.java

@ -2,7 +2,6 @@ package com.hnac.hzims.operational.main.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -48,6 +47,9 @@ public class AppHydropowerStationVo {
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double output;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "运行天数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer runDay;

6
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerStationVo.java

@ -54,6 +54,9 @@ public class HydropowerStationVo {
@ApiModelProperty(value = "月发电量")
private Float powerMon;
@ApiModelProperty(value = "月发电量完成率")
private Double powerRateMon;
@ApiModelProperty(value = "年发电量")
private Float powerYear;
@ -72,6 +75,9 @@ public class HydropowerStationVo {
@ApiModelProperty(value = "年发电量完成百分比")
private List<PowerMonthVo> powerYearMap;
@ApiModelProperty(value = "24小时机组有功功率")
private List<ActivePowerVo> activePowerVoList;
@ApiModelProperty(value = "设备信息")
private List<HydropowerUnitVo> deviceList;
}

1
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/WindService.java

@ -10,6 +10,7 @@ import java.util.List;
* @author ysj
*/
public interface WindService extends BaseService<WindEntity> {
List<PowerMonthVo> generateThreeYear(String start, String end, Long station);
}

40
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java

@ -22,6 +22,12 @@ import com.hnac.hzims.scheduled.service.operation.fill.*;
import com.hnac.hzims.scheduled.service.operation.home.ModelStationService;
import com.hnac.hzims.scheduled.service.operation.home.RealTargetService;
import com.hnac.hzims.scheduled.service.operation.plate.DataService;
import com.hnac.hzims.scheduled.service.operation.fill.GenerateService;
import com.hnac.hzims.scheduled.service.operation.fill.PowerService;
import com.hnac.hzims.scheduled.service.operation.fill.UseService;
import com.hnac.hzims.scheduled.service.operation.home.ModelStationService;
import com.hnac.hzims.scheduled.service.operation.home.RealTargetService;
import com.hnac.hzims.scheduled.service.operation.plate.DataService;
import com.hnac.hzims.scheduled.service.operation.station.StationAttributeService;
import com.hnac.hzims.scheduled.service.operation.station.StationService;
import com.hnac.hzinfo.datasearch.PointData;
@ -69,8 +75,6 @@ public class RealTargetServiceImpl implements RealTargetService {
private final DataService dataService;
private final WindService windService;
private final PowerService powerService;
private final DeviceService deviceService;
@ -108,7 +112,6 @@ public class RealTargetServiceImpl implements RealTargetService {
private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key";
private final static String loadwaterpump_target_key = "hzims:operation:loadwaterpump:target:key";
private final static String loadwaterpump_real_key = "hzims:operation:loadwaterpump:real:key";
private final static String loadwaterpump_rain_key = "hzims:operation:loadwaterpump:rain:key";
private final static String loadwater_level_key = "hzims:operation:loadwater:level:key";
private final static String load_photovoltaic_real_key = "hzims:operation:photovoltaic:real:key";
private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key";
@ -143,7 +146,7 @@ public class RealTargetServiceImpl implements RealTargetService {
});
// 设备遍历
devices.forEach(item->{
item.setRideCount(1);
item.setRideCount(1.0);
item.setInstalledCapacity(0.0);
// 站点设置
if(CollectionUtil.isNotEmpty(stations)){
@ -166,10 +169,10 @@ public class RealTargetServiceImpl implements RealTargetService {
String param_name = paramEntity.getParamName();
switch (param_name){
case "ct":
item.setCt(Integer.valueOf(paramEntity.getParamValue()));
item.setCt(Double.valueOf(param.getParamValue()));
break;
case "pt":
item.setPt(Integer.valueOf(paramEntity.getParamValue()));
item.setPt(Double.valueOf(param.getParamValue()));
break;
case "installedCapacity":
item.setInstalledCapacity(Double.valueOf(paramEntity.getParamValue()));
@ -1138,7 +1141,7 @@ public class RealTargetServiceImpl implements RealTargetService {
private List<HzimsAnalyzeModelStationEntity> getModelStationList() {
// 水利站点(All)
List<StationEntity> stations = stationService.list(new LambdaQueryWrapper<StationEntity>() {{
eq(StationEntity::getDataOrigin, HomePageConstant.DATA_ORIGIN);
eq(StationEntity::getDataOrigin, "0");
}});
if(CollectionUtil.isEmpty(stations)){
return new ArrayList<>();
@ -1329,7 +1332,11 @@ public class RealTargetServiceImpl implements RealTargetService {
PowerMonthVo generate = new PowerMonthVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE));
generate.setPower(Float.parseFloat(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount());
if(StringUtil.isEmpty(record.getVal())){
generate.setPower(0f);
}else{
generate.setPower(Float.parseFloat(String.valueOf(Double.parseDouble(record.getVal()) * device.getRideCount())));
}
return generate;
}).collect(Collectors.toList()));
});
@ -1507,7 +1514,7 @@ public class RealTargetServiceImpl implements RealTargetService {
* @param type
* @return
*/
private float sumValueByTime(String deviceCode, int rideCount, String type) {
private float sumValueByTime(String deviceCode, Double rideCount, String type) {
Calendar calendar = Calendar.getInstance();
String start, end;
int cycleType = 3;
@ -1784,8 +1791,13 @@ public class RealTargetServiceImpl implements RealTargetService {
* @return
*/
private List<GenerationPowerVo> getGenerationPowerList(EminfoAndEmParamVo device) {
String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00";
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
Calendar calendar = Calendar.getInstance();
String end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.DAY_OF_MONTH,-29);
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME);
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
if(CollectionUtil.isEmpty(records)){
return new ArrayList<>();
@ -1794,7 +1806,11 @@ public class RealTargetServiceImpl implements RealTargetService {
GenerationPowerVo generate = new GenerationPowerVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
generate.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE));
generate.setGenerate(Float.parseFloat(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount());
if(StringUtil.isEmpty(record.getVal())){
generate.setGenerate(0f);
}else{
generate.setGenerate(Float.parseFloat(String.valueOf(Double.parseDouble(record.getVal()) * device.getRideCount())));
}
return generate;
}).collect(Collectors.toList());
}

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java

@ -34,6 +34,7 @@ import com.hnac.hzims.scheduled.service.operation.plate.DataService;
import com.hnac.hzims.scheduled.service.operation.station.StationService;
import com.hnac.hzims.scheduled.service.ticket.TicketService;
import com.hnac.hzims.scheduled.service.ticket.WorkTicketService;
import com.hnac.hzims.ticket.allTicket.dto.TicketStatisticDTO;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO;
import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketStatisticVO;
@ -79,6 +80,7 @@ public class ShowServiceImpl implements ShowService {
private final TaskService taskService;
private final OverService overService;
private final PlanService planService;
private final WindService windService;
private final PowerService powerService;
private final WindService windService;
private final SolveService solveService;

1
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/DataService.java

@ -3,7 +3,6 @@ package com.hnac.hzims.scheduled.service.operation.plate;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import org.springblade.core.tool.api.R;

7
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/impl/DataServiceImpl.java

@ -163,7 +163,7 @@ public class DataServiceImpl implements DataService {
* @return
*/
@Override
public Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode,Integer ride,String signages) {
public Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode,Double ride,String signages) {
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO();
@ -199,7 +199,10 @@ public class DataServiceImpl implements DataService {
if (ObjectUtil.isEmpty(analyseDataTaosVO) || StringUtil.isBlank(analyseDataTaosVO.getVal())) {
return 0f;
}
return Float.parseFloat(Optional.ofNullable(analyseDataTaosVO.getVal()).orElse("0")) * ride;
if(StringUtil.isEmpty(analyseDataTaosVO.getVal())){
return 0f;
}
return Float.parseFloat(String.valueOf(Double.parseDouble(analyseDataTaosVO.getVal()) * ride));
}

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/TicketServiceImpl.java

@ -139,7 +139,7 @@ public class TicketServiceImpl extends BaseServiceImpl<TicketMapper, StandardTic
eq(TicketInfoEvaluateEntity::getStatus, TicketConstants.TicketQualifiedEnum.Qualified.getCode());
}});
if (CollectionUtil.isEmpty(operateQualifyList)) {
ticket.setOperateQualify(0);
ticket.setWorkQualify(0);
}else{
ticket.setWorkQualify(operateQualifyList.size());
}

56
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java

@ -77,6 +77,8 @@ public class TargetServiceImpl implements TargetService {
private final OverService overService;
private final WindService windService;
private final PowerService powerService;
private final SolveService solveService;
@ -209,7 +211,7 @@ public class TargetServiceImpl implements TargetService {
double sum = targets.stream().filter(target->target.getDeptId().equals(station.getRefDept())).mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum();
item.setElectricGeneration(sum);
// 发电量详情
List<String> details = targets.stream().filter(target->target.getDeptId().equals(station.getRefDept())).map(target-> "[" + Optional.ofNullable(target.getDeviceCode()).orElse("填报电量") + " " + target.getPowerYear() +"kWh]").collect(Collectors.toList());
List<String> details = targets.stream().filter(target->target.getDeptId().equals(station.getRefDept())).map(target-> "[" + Optional.ofNullable(target.getDeviceName()).orElse("填报电量") + " " + target.getPowerYear() +"kWh]").collect(Collectors.toList());
item.setDetail(String.join("|",details));
return item;
}).filter(generate->Math.abs(generate.getElectricGeneration()) > 0).collect(Collectors.toList());
@ -231,26 +233,26 @@ public class TargetServiceImpl implements TargetService {
double sum = targets.stream().filter(target -> target.getDeptId().equals(station.getRefDept())).mapToDouble(PhotovoltaicTargetVo::getGenerationYear).sum();
item.setElectricGeneration(sum);
// 发电量详情
List<String> details = targets.stream().filter(target -> target.getDeptId().equals(station.getRefDept())).map(target -> "[" + Optional.ofNullable(target.getDeviceCode()).orElse("填报电量") + " " + target.getGenerationYear() + "kWh]").collect(Collectors.toList());
List<String> details = targets.stream().filter(target -> target.getDeptId().equals(station.getRefDept())).map(target -> "[" + Optional.ofNullable(target.getDeviceName()).orElse("填报电量") + " " + target.getGenerationYear() + "kWh]").collect(Collectors.toList());
item.setDetail(String.join("|", details));
return item;
}).filter(generate -> Math.abs(generate.getElectricGeneration()) > 0).collect(Collectors.toList());
}else{
// 查询填报数据
String mon = DateUtil.format(new Date(),"yyyy");
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery()
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(PowerEntity::getMon, mon + "-01")
List<WindEntity> powers = windService.list(Wrappers.<WindEntity>lambdaQuery()
.in(WindEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(WindEntity::getFillDate, mon + "-01")
);
electrics = stations.stream().map(station -> {
ElectricGenerationVo item = new ElectricGenerationVo();
item.setStationName(station.getName());
// 发电量
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
List<WindEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationPowers)){
item.setElectricGeneration(0.0);
}else{
item.setElectricGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerYear());
item.setElectricGeneration(stationPowers.stream().sorted(Comparator.comparing(WindEntity::getFillDate).reversed()).collect(Collectors.toList()).get(0).getPower());
}
item.setDetail("站点为填报数据,暂无设备装机发电量信息!");
return item;
@ -362,24 +364,32 @@ public class TargetServiceImpl implements TargetService {
return item;
}).filter(complete->Math.abs(complete.getPlanGeneration()) > 0 || Math.abs(complete.getRealityGeneration()) > 0).collect(Collectors.toList());
}else{
// 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy"));
String mon = DateUtil.format(new Date(),"yyyy");
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery()
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(PowerEntity::getMon, mon + "-01")
List<WindEntity> powers = windService.list(Wrappers.<WindEntity>lambdaQuery()
.in(WindEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(WindEntity::getFillDate, mon + "-01")
);
generations = stations.stream().map(station -> {
CompleteGenerationVo item = new CompleteGenerationVo();
item.setStationName(station.getName());
if(CollectionUtil.isEmpty(plans)){
item.setPlanGeneration(0.0);
}else{
item.setPlanGeneration(plans.stream().filter(plan->plan.getStationId().equals(station.getCode())).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum());
}
// 发电量
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
List<WindEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationPowers)){
item.setPlanGeneration(0.0);
item.setRealityGeneration(0.0);
item.setCompleteRate(0.0);
}else{
item.setPlanGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPlannedPowerYear());
item.setRealityGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerYear());
item.setCompleteRate(Double.valueOf(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerRateYear()));
item.setRealityGeneration(stationPowers.stream().mapToDouble(WindEntity::getPower).sum());
}
if(Math.abs(item.getPlanGeneration()) <= 0 || Math.abs(item.getRealityGeneration()) <= 0){
item.setCompleteRate(100.0);
}else{
item.setCompleteRate(BigDecimal.valueOf(item.getRealityGeneration() / item.getPlanGeneration() * 100).setScale(1, RoundingMode.HALF_UP).doubleValue());
}
return item;
}).collect(Collectors.toList());
@ -395,13 +405,6 @@ public class TargetServiceImpl implements TargetService {
*/
@Override
public IPage<CompleteTicketVo> completeTicket(IPage<CompleteTicketVo> page,String areaName,Integer type) {
// 光伏/风电双票填报数据
if(HomePageConstant.WIND_POWER.equals(type) || HomePageConstant.PHOTOVOLTAIC.equals(type)){
List<CompleteTicketVo> completes = this.getcompleteFillTicket(areaName,type);
page.setTotal(completes.size());
page.setRecords(completes.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
// 平台业务数据
List<Integer> types;
if(HomePageConstant.WATER_CONSERVANCY.equals(type)){
@ -872,7 +875,12 @@ public class TargetServiceImpl implements TargetService {
if(CollectionUtil.isEmpty(reals)){
hydropower.setPower(0.0);
}else{
hydropower.setPower(reals.stream().filter(real->real.getDeptId().equals(station.getRefDept())).mapToDouble(HydropowerUnitRealVo::getActivePower).sum());
hydropower.setPower(reals.stream().filter(real->real.getDeptId().equals(station.getRefDept())).mapToDouble(real->{
if("MW".equalsIgnoreCase(real.getPowerUnit())){
return real.getActivePower() * 1000;
}
return real.getActivePower();
}).sum());
}
return hydropower;
})/*.filter(hydropower -> Math.abs(hydropower.getPower()) > 0)*/.sorted(Comparator.comparing(HydropowerTargetVo::getPower).reversed()).collect(Collectors.toList());

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java

@ -1,5 +1,7 @@
package com.hnac.hzims.operational.config.service.impl;
import cn.hutool.core.lang.TypeReference;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -75,10 +77,11 @@ public class CentralMonitorServiceImpl implements CentralMonitorService {
if (CollectionUtil.isEmpty(codeList)) {
return null;
}
List<RealStationVo> result = (List<RealStationVo>) redisTemplate.opsForValue().get(moniter_station_key);
if (StringUtil.isEmpty(result)) {
Object json = redisTemplate.opsForValue().get(moniter_station_key);
if (StringUtil.isEmpty(json)) {
return null;
}
List<RealStationVo> result = JSONObject.parseObject(json.toString(), new TypeReference<List<RealStationVo>>() {});
return result.stream().filter(o -> codeList.contains(o.getStationCode())).collect(Collectors.toList());
}

34
hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/controller/HzimsDataController.java

@ -26,9 +26,6 @@ public class HzimsDataController {
private final HzimsDataService service;
/**
* 获取区域列表数据
*/
@ApiLog
@GetMapping("/saveArea")
@ApiOperationSupport(order = 1)
@ -37,22 +34,35 @@ public class HzimsDataController {
return R.data(service.saveArea());
}
/**
* 获取区域列表数据
*/
@ApiLog
@GetMapping("/saveStation")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "获取站点统计数据", notes = "无需传入参数")
public R saveStation() {
return R.data(service.saveStation());
@GetMapping("/stationNumber")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "站点数量", notes = "无需传入参数")
public R stationNumber() {
return R.data(service.stationNumber());
}
@ApiLog
@GetMapping("/station")
@ApiOperationSupport(order = 1)
@ApiOperationSupport(order = 3)
@ApiOperation(value = "站点数据获取", notes = "传入站点code")
public R station(@RequestParam("stationCode") String stationCode) {
return R.data(service.station(stationCode));
}
@ApiLog
@GetMapping("/weather")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "站点天气、降雨、水位", notes = "传入站点code")
public R weather(@RequestParam("stationCode") String stationCode) {
return R.data(service.weather(stationCode));
}
@ApiLog
@GetMapping("/power")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "站点功率换算电量", notes = "传入站点code")
public R power(@RequestParam("stationCode") String stationCode) {
return R.data(service.power(stationCode));
}
}

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/HzimsDataService.java

@ -1,10 +1,14 @@
package com.hnac.hzims.operational.data.service;
import com.hnac.hzims.operational.data.vo.PowerConvertVo;
import com.hnac.hzims.operational.data.vo.StationNumberVo;
import com.hnac.hzims.operational.data.vo.WeatherWaterVo;
import com.hnac.hzims.operational.main.vo.HydropowerStationVo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* @author ysj
@ -17,7 +21,11 @@ public interface HzimsDataService {
*/
boolean saveArea();
boolean saveStation();
List<StationNumberVo> stationNumber();
HydropowerStationVo station(String stationCode);
WeatherWaterVo weather(String stationCode);
PowerConvertVo power(String stationCode);
}

398
hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java

@ -3,17 +3,26 @@ package com.hnac.hzims.operational.data.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.hzimsweather.feign.IRainfallClient;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.operational.data.service.HzimsDataService;
import com.hnac.hzims.operational.data.vo.AreaVo;
import com.hnac.hzims.operational.data.vo.*;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.AreaService;
import com.hnac.hzims.operational.main.service.IAnalyseDataService;
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService;
import com.hnac.hzims.operational.main.service.IWeatherService;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IHzimsAnalyzeModelStationService;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.station.vo.HzimsStationCountVo;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
@ -40,6 +49,7 @@ import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@ -57,10 +67,20 @@ public class HzimsDataServiceImpl implements HzimsDataService {
private final IStationService stationService;
private final IWeatherService weatherService;
private final IAnalyseDataService dataService;
private final IHzimsAnalyzeModelStationService modelStationService;
private final IMainSystemMonitoringService maintenanceTaskService;
private final ISysClient sysClient;
private final IEmInfoClient deviceClient;
private final IRainfallClient rainfallClient;
private final IPlanGenertionClient planGenertionClient;
private final RedisTemplate redisTemplate;
@ -70,6 +90,13 @@ public class HzimsDataServiceImpl implements HzimsDataService {
@Value("${hzims.operation.save.station.url}")
public String STATION_URL;
private final static String charge = "hzims:operation:key:charge";
private final static String conver_power_key = "hzims:operation:conver:power:";
private final static String conver_weather_key = "hzims:operation:conver:weather:";
private final static String recent_year_power_data = "hzims:operation:key:power:data";
private final static String loadwater_level_key = "hzims:operation:loadwater:level:key";
@ -114,17 +141,33 @@ public class HzimsDataServiceImpl implements HzimsDataService {
return this.sendMessage(JSONObject.toJSONBytes(list),AREA_URL);
}
/**
* 获取站点统计数据
* 站点数量统计
* @return
*/
@Override
public boolean saveStation() {
List<HzimsStationCountVo> list = this.stationService.getStationCount();
if(CollectionUtil.isEmpty(list)){
return false;
public List<StationNumberVo> stationNumber() {
List<StationNumberVo> numbers = new ArrayList<>();
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery().
in(StationEntity::getType,Arrays.asList(0,1,5,8))
);
if(!CollectionUtil.isEmpty(stations)){
stations.stream().collect(Collectors.groupingBy(StationEntity::getType)).forEach((key, value) -> {
StationNumberVo number = new StationNumberVo();
number.setType(key);
number.setCount(value.size());
numbers.add(number);
});
}
return this.sendMessage(JSONObject.toJSONBytes(list),STATION_URL);
TargetVo target = (TargetVo) redisTemplate.opsForValue().get(charge);
if(!ObjectUtil.isEmpty(target)){
StationNumberVo number = new StationNumberVo();
number.setType(7);
number.setCount(target.getCharge());
numbers.add(number);
}
return numbers;
}
@ -213,10 +256,341 @@ public class HzimsDataServiceImpl implements HzimsDataService {
this.handleWaterLeve(station.getCode(),response);
// 年发电量完成百分比
response.setPowerYearMap(this.handlePowerFinish(Collections.singletonList(station),map));
// 功率曲线
response.setActivePowerVoList(this.activePowers(station.getRefDept(),targetList));
return response;
}
/**
* 24小时功率曲线
* @param refDept
* @param targetList
* @return
*/
private List<ActivePowerVo> activePowers(Long refDept, List<HydropowerUnitTargetVo> targetList) {
if(CollectionUtil.isEmpty(targetList)){
return new ArrayList<>();
}
List<ActivePowerVo> actives = new ArrayList<>();
targetList.stream().filter(o-> CollectionUtil.isNotEmpty(o.getActivePowerVoList()) && ObjectUtil.isNotEmpty(o.getDeptId()) && o.getDeptId().equals(refDept)).map(HydropowerUnitTargetVo::getActivePowerVoList).collect(Collectors.toList()).forEach(actives::addAll);
if(CollectionUtil.isEmpty(actives)){
return new ArrayList<>();
}
Map<Integer,List<ActivePowerVo>> maps = actives.stream().collect(Collectors.groupingBy(ActivePowerVo::getHour));
return maps.entrySet().stream().map(entry->{
ActivePowerVo activePower = new ActivePowerVo();
activePower.setHour(entry.getKey());
activePower.setActivePower(String.valueOf(entry.getValue().stream().mapToDouble(o->Double.parseDouble(o.getActivePower())).sum()));
return activePower;
}).sorted(Comparator.comparing(ActivePowerVo::getHour)).collect(Collectors.toList());
}
/**
* 站点天气降雨水位
* @param stationCode
* @return
*/
@Override
public WeatherWaterVo weather(String stationCode) {
WeatherWaterVo redisCache = (WeatherWaterVo) redisTemplate.opsForValue().get(conver_weather_key + stationCode);
if(!ObjectUtil.isEmpty(redisCache)){
return redisCache;
}
WeatherWaterVo weatherWater = new WeatherWaterVo();
// 查询站点
StationEntity station = stationService.getOne(Wrappers.<StationEntity>lambdaQuery().
eq(StationEntity::getCode,stationCode)
);
if(ObjectUtil.isEmpty(station)){
return new WeatherWaterVo();
}
weatherWater.setLimitWater(station.getLimitWaterLevel());
weatherWater.setStationName(station.getName());
// 七天天气
Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.getWeekWeather(Collections.singletonList(station.getCode()));
if(!MapUtils.isEmpty(weekWeather)){
HeWeatherWeatherDailyResponse week = weekWeather.get(stationCode);
if(!ObjectUtil.isEmpty(week)){
weatherWater.setDailys(week.getDaily());
}
}
// 水位、降雨
weatherWater.setWeatherRains(this.waterRain(stationCode));
redisTemplate.opsForValue().set(conver_weather_key + stationCode,weatherWater);
redisTemplate.expire(conver_weather_key + stationCode,30, TimeUnit.MINUTES);
return weatherWater;
}
/**
* 站点功率换算电量
* @param stationCode
* @return
*/
@Override
public PowerConvertVo power(String stationCode) {
PowerConvertVo redisCache = (PowerConvertVo) redisTemplate.opsForValue().get(conver_power_key + stationCode);
if(!ObjectUtil.isEmpty(redisCache)){
return redisCache;
}
// 查询站点
StationEntity station = stationService.getOne(Wrappers.<StationEntity>lambdaQuery().
eq(StationEntity::getCode,stationCode)
);
if(ObjectUtil.isEmpty(station)){
return new PowerConvertVo();
}
PowerConvertVo convert = new PowerConvertVo();
convert.setStationName(station.getName());
// 查询近30天发电量
convert.setElectricitys(this.poweyBy30Day(station.getRefDept()));
// 查询24小时水位、功率
convert.setLoadWaters(this.loadWaterBy24Hour(station.getRefDept(),station.getCode()));
redisTemplate.opsForValue().set(conver_power_key + stationCode,convert);
redisTemplate.expire(conver_power_key + stationCode,30, TimeUnit.MINUTES);
return convert;
}
/**
* 获取七天天气
* @param codes
*/
private Map<String, HeWeatherWeatherDailyResponse> getWeekWeather(List codes) {
if(CollectionUtil.isEmpty(codes)){
return null;
}
// 实时天气
return this.weatherService.getWeekWeather(codes);
}
/**
* 30天水位降雨量
* @param stationCode
* @return
*/
private List<WeatherRainVo> waterRain(String stationCode) {
Calendar calendar = Calendar.getInstance();
String endTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
String rainEnd = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
calendar.add(Calendar.DAY_OF_MONTH,-29);
String startTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
String rainStart = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
// 查询水位数据
List<AnalyseDataTaosVO> waters = this.water(startTime,endTime,stationCode,3);
// 查询降雨数据
R<List<Map<String, Object>>> rains = rainfallClient.getDurationRainFall(stationCode,rainStart,rainEnd);
// 近30天水位、降雨量
List<String> days = this.get30Day();
return days.stream().map(day->{
WeatherRainVo weatherRain = new WeatherRainVo();
weatherRain.setTime(day);
// 水位
if(CollectionUtil.isEmpty(waters)){
weatherRain.setWater(0.0);
}else{
weatherRain.setWater(waters.stream().filter(o->o.getTs().contains(day)).mapToDouble(water->{
if(StringUtil.isEmpty(water.getVal())){
return 0.0;
}else{
return Double.parseDouble(water.getVal());
}
}).sum());
}
// 降雨
if(!rains.isSuccess() || CollectionUtil.isEmpty(rains.getData())){
weatherRain.setRain(0.0);
}else{
weatherRain.setRain(rains.getData().stream().mapToDouble(map->{
if (map.get("fx_date").equals(day)) {
Object object = map.get("precip");
if(ObjectUtil.isEmpty(object)){
return 0.0;
}else{
return Double.parseDouble(object.toString());
}
}
return 0.0;
}).sum());
}
return weatherRain;
}).collect(Collectors.toList());
}
/**
* 查询近30天发电量
* @param deptId
* @return
*/
private List<ConverElectricityVo> poweyBy30Day(Long deptId) {
// 查询设备
R<List<String>> result = deviceClient.getEmCodeByDeptId(deptId);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new ArrayList<>();
}
Calendar calendar = Calendar.getInstance();
String endTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
calendar.add(Calendar.DAY_OF_MONTH,-30);
String startTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
// 功率查询
List<AnalyseDataTaosVO> datas = dataService.periodTargetDatas(startTime,endTime,3,2,result.getData(),HomePageConstant.ACTIVE_POWER);
if(CollectionUtil.isEmpty(datas)){
return new ArrayList<>();
}
List<ConverElectricityVo> electricitys = new ArrayList<>();
// 数据累计
datas.forEach(item->{
if(CollectionUtil.isEmpty(datas)){
return;
}
datas.forEach(data->{
ConverElectricityVo electricity = new ConverElectricityVo();
Date date = DateUtil.parse(data.getTs(), "yyyy-MM-dd HH:mm:ss.s");
electricity.setTime(DateUtil.format(date,DateUtil.PATTERN_DATE));
if(StringUtil.isEmpty(data.getVal())){
electricity.setElectricity(0.0);
}else{
electricity.setElectricity(Double.parseDouble(data.getVal()));
}
electricitys.add(electricity);
});
});
if(CollectionUtil.isEmpty(electricitys)){
return new ArrayList<>();
}
// 进行time分组
return electricitys.stream().collect(Collectors.groupingBy(ConverElectricityVo::getTime)).entrySet().stream().map(entry->{
ConverElectricityVo electricity = new ConverElectricityVo();
electricity.setTime(entry.getKey());
electricity.setElectricity(entry.getValue().stream().mapToDouble(ConverElectricityVo::getElectricity).sum());
return electricity;
}).sorted(Comparator.comparing(ConverElectricityVo::getTime)).collect(Collectors.toList());
}
/**
* 查询24小时水位功率
* @param stationCode
* @return
*/
private List<LoadWaterLevelVo> loadWaterBy24Hour(Long deptId,String stationCode) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.HOUR_OF_DAY,-3);
String endTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.HOUR_OF_DAY,-24);
String startTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
List<String> hours = this.get24Hours();
// 查询功率数据
List<AnalyseDataTaosVO> loads = this.loads(startTime,endTime,deptId);
// 查询水位数据
List<AnalyseDataTaosVO> waters = this.water(startTime,endTime,stationCode,2);
return hours.stream().map(hour ->{
LoadWaterLevelVo loadWater = new LoadWaterLevelVo();
Date time = DateUtil.parse(hour,"yyyy-MM-dd HH");
loadWater.setTime(String.valueOf(time.getHours()));
if(CollectionUtil.isEmpty(loads)){
loadWater.setLoad(0.0);
}else{
loadWater.setLoad(loads.stream().filter(o->o.getTs().contains(hour)).mapToDouble(load->{
if(StringUtil.isEmpty(load.getVal())){
return 0.0;
}
return Double.parseDouble(load.getVal());
}).sum());
}
if(CollectionUtil.isEmpty(waters)){
loadWater.setWater(0.0);
}else{
loadWater.setWater(waters.stream().filter(o->o.getTs().contains(hour)).mapToDouble(load->{
if(StringUtil.isEmpty(load.getVal())){
return 0.0;
}
return Double.parseDouble(load.getVal());
}).sum());
}
return loadWater;
}).collect(Collectors.toList());
}
/**
* 查询水位数据
* @param startTime
* @param endTime
* @param stationCode
* @return
*/
private List<AnalyseDataTaosVO> water(String startTime, String endTime, String stationCode,Integer cycleType) {
// 查询模型站点
HzimsAnalyzeModelStationEntity model = modelStationService.getOne(Wrappers.<HzimsAnalyzeModelStationEntity>lambdaQuery()
.eq(HzimsAnalyzeModelStationEntity::getStationId,stationCode)
);
if(ObjectUtil.isEmpty(model)){
return new ArrayList<>();
}
// 水位查询
return dataService.periodTargetData(startTime,endTime,3,cycleType,model.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL);
}
/**
* 获取24小时功率
* @param refDept
*/
private List<AnalyseDataTaosVO> loads(String start,String end,Long refDept) {
List<AnalyseDataTaosVO> datas = new ArrayList<>();
R<List<String>> result = deviceClient.getEmCodeByDeptId(refDept);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return datas;
}
return dataService.periodTargetDatas(start,end,3,2,result.getData(),HomePageConstant.ACTIVE_POWER);
}
/**
* 获取30天
* @return
*/
private List<String> get30Day() {
List<String> times = new ArrayList<>();
Calendar calendar = Calendar.getInstance();
Date end = calendar.getTime();
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
calendar.add(Calendar.DAY_OF_MONTH,-29);
Date start = calendar.getTime();
while (start.compareTo(end) < 0) {
times.add(DateUtil.format(calendar.getTime(),"yyyy-MM-dd"));
calendar.add(Calendar.DAY_OF_MONTH,1);
start = calendar.getTime();
}
return times;
}
/**
* 获取24小时
* @return
*/
private List<String> get24Hours() {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.HOUR_OF_DAY,-3);
Date end = calendar.getTime();
calendar.add(Calendar.HOUR_OF_DAY,-24);
Date start = calendar.getTime();
List<String> times = new ArrayList<>();
while (start.compareTo(end) < 0) {
times.add(DateUtil.format(calendar.getTime(),"yyyy-MM-dd HH"));
calendar.add(Calendar.HOUR_OF_DAY,1);
start = calendar.getTime();
}
return times;
}
/**
* 获取站点运行天数
* @param station
* @return
@ -308,6 +682,14 @@ public class HzimsDataServiceImpl implements HzimsDataService {
// 月发电量
float powerMont = (float) targetList.stream().filter(o-> deptId.equals(o.getDeptId())).mapToDouble(HydropowerUnitTargetVo::getPowerMon).sum();
response.setPowerMon(powerMont);
// 月发电完成率
float planPowerMon = response.getPlanPowerMon();
if(Math.abs(planPowerMon) <= 0){
response.setPowerRateMon(0.0);
} else {
double powerRateYear = BigDecimal.valueOf(powerMont / (double) planPowerMon * 100).setScale(2, RoundingMode.HALF_UP).doubleValue();
response.setPowerRateMon(powerRateYear);
}
// 年发电量
float powerYear = (float) targetList.stream().filter(o-> deptId.equals(o.getDeptId())).mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum();
response.setPowerYear(powerYear);
@ -316,7 +698,7 @@ public class HzimsDataServiceImpl implements HzimsDataService {
if(Math.abs(planPowerYear) <= 0){
response.setPowerRateYear(0.0);
} else {
double powerRateYear = BigDecimal.valueOf(powerYear / planPowerYear * 100).setScale(2, RoundingMode.HALF_UP).doubleValue();
double powerRateYear = BigDecimal.valueOf(powerYear / (double) planPowerYear * 100).setScale(2, RoundingMode.HALF_UP).doubleValue();
response.setPowerRateYear(powerRateYear);
}
}

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyChangeServiceImpl.java

@ -139,7 +139,7 @@ public class ImsDutyChangeServiceImpl extends BaseServiceImpl<ImsDutyChangeMappe
List<ImsDutyChangeTowVo> imsDutyChangeTowVos = this.baseMapper.selectListDetails(page);
for (ImsDutyChangeTowVo imsDutyChangeTowVo : imsDutyChangeTowVos) {
if (Func.isNotBlank(imsDutyChangeTowVo.getManager() + "")) {
imsDutyChangeTowVo.setManagerName(userClient.userInfoById(imsDutyChangeTowVo.getManager()).getData().getName());
imsDutyChangeTowVo.setManagerName(userClient.userInfoById(imsDutyChangeTowVo.getManager()).getData().getRealName());
}
}
return page.setRecords(imsDutyChangeTowVos);
@ -147,8 +147,8 @@ public class ImsDutyChangeServiceImpl extends BaseServiceImpl<ImsDutyChangeMappe
@Override
public void setUserNmae(ImsDutyChangeVO vo) {
vo.setApplyPersonName(userClient.userInfoById(vo.getApplyPersonId()).getData().getName());//申请人
vo.setAcceptPersonName(userClient.userInfoById(vo.getAcceptPersonId()).getData().getName());//调班人
vo.setApplyPersonName(userClient.userInfoById(vo.getApplyPersonId()).getData().getRealName());//申请人
vo.setAcceptPersonName(userClient.userInfoById(vo.getAcceptPersonId()).getData().getRealName());//调班人
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyGroupServiceImpl.java

@ -343,7 +343,7 @@ public class ImsDutyGroupServiceImpl extends BaseServiceImpl<ImsDutyGroupMapper,
if (managerId!=null) {
R<User> userR = userClient.userInfoById(managerId);
if (userR.isSuccess() && ObjectUtil.isNotEmpty(userR.getData())) {
userName = userR.getData().getName();
userName = userR.getData().getRealName();
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecQRRecordServiceImpl.java

@ -45,7 +45,7 @@ public class ImsDutyRecQRRecordServiceImpl extends BaseServiceImpl<ImsDutyRecQRR
for (ImsDutyRecQRRecordVo imsDutyRecQRRecordVo : imsDutyRecQRRecordVoIPage) {
User data = userClient.userInfoById(imsDutyRecQRRecordVo.getPersonId()).getData();
if(ObjectUtil.isNotEmpty(data)){
imsDutyRecQRRecordVo.setUserName(data.getName());
imsDutyRecQRRecordVo.setUserName(data.getRealName());
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAnalyseDataService.java

@ -18,5 +18,7 @@ public interface IAnalyseDataService {
List<AnalyseDataTaosVO> periodTargetData(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages);
List<AnalyseDataTaosVO> periodTargetDatas(String startTime, String endTime, Integer accessRules, Integer cycleType, List<String> deviceCodes, String signages);
Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Integer ride ,String signages);
}

39
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java

@ -89,6 +89,45 @@ public class AnalyseDataServiceImpl implements IAnalyseDataService {
* @param endTime 结束时间
* @param accessRules 取数规则 : 0=最早值 1=最大值 2=最小值 3=平均值 4=和值 5=差值 6=最新值
* @param cycleType 间隔周期 : 0-> 1-> 2-> 小时 3-> 4-> 5-> 6->
* @param deviceCodes 设备编号集合
* @param signages 指标
* @return
*/
@Override
public List<AnalyseDataTaosVO> periodTargetDatas(String startTime, String endTime, Integer accessRules, Integer cycleType, List<String> deviceCodes, String signages) {
List<AnalyseDataTaosVO> dataTaos = new ArrayList<>();
deviceCodes.forEach(deviceCode->{
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
po.setDeviceCode(deviceCode);
AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO();
analyzeDataConditionPO.setFull(1);
analyzeDataConditionPO.setSignages(signages);
analyzeDataConditionPO.setKeepFigures(2);
analyzeDataConditionPO.setAccessRules(accessRules);
analyzeDataConditionPO.setSaveTimeType(cycleType);
// 间隔
analyzeDataConditionPO.setTimeInterval(1);
analyzeDataConditionPO.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(), startTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
analyzeDataConditionPO.setEndTime(LocalDateTime.parse(DateUtil.format(new Date(), endTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
po.setSignboardConditions(Collections.singletonList(analyzeDataConditionPO));
log.error("period_target_data_request {}",po);
R<List<AnalyzeDataConditionVO>> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po);
if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) {
return;
}
log.error("period_target_data_resp {}",result);
dataTaos.addAll(result.getData().get(0).getList());
});
return dataTaos;
}
/***
* 指标数据列表查询
* @param startTime 开始时间
* @param endTime 结束时间
* @param accessRules 取数规则 : 0=最早值 1=最大值 2=最小值 3=平均值 4=和值 5=差值 6=最新值
* @param cycleType 间隔周期 : 0-> 1-> 2-> 小时 3-> 4-> 5-> 6->
* @param deviceCode 设备编号
* @param ride 配电比
* @param signages 指标

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java

@ -154,13 +154,15 @@ public class HomeServiceImpl implements HomeService {
count.setServeType(serve);
if(HomePageConstant.CHARGE.equals(type) && "2".equals(serve)){
TargetVo target = (TargetVo) redisTemplate.opsForValue().get(charge);
if(ObjectUtil.isNotEmpty(target)){
if(ObjectUtil.isEmpty(target)){
TargetVo charge = this.chargeTarget();
if(ObjectUtil.isNotEmpty(charge)){
count.setCount(Long.valueOf(charge.getCharge()));
}else{
count.setCount(92L);
count.setCount(113L);
}
}else{
count.setCount(Long.valueOf(target.getCharge()));
}
}else if(HomePageConstant.WATER_CONSERVANCY.equals(type) && "2".equals(serve)){
count.setCount(stations.stream().filter(station->serve.equals(station.getServeType()) && HomePageConstant.waterList.contains(station.getType())).count());

41
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -1554,14 +1554,6 @@ public class HydropowerServiceImpl implements HydropowerService {
}
// 装机容量
hydropower.setCapacity(reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept()) && !ObjectUtil.isEmpty(real.getInstalledCapacity())).mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum());
// 负荷
hydropower.setLoad(reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept()) && !ObjectUtil.isEmpty(real.getActivePower())).mapToDouble(HydropowerUnitRealVo::getActivePower).sum());
// 出力
if(Math.abs(hydropower.getCapacity()) > 0){
hydropower.setOutput(BigDecimal.valueOf(hydropower.getLoad() / hydropower.getCapacity() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
}else{
hydropower.setOutput(0.0);
}
// 运行天数
hydropower.setRunDay(this.getRunDay(station));
// 告警
@ -1572,8 +1564,9 @@ public class HydropowerServiceImpl implements HydropowerService {
// 站点设备
List<HydropowerUnitRealVo> devices = reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(devices)){
// 设备
hydropower.setDevices(devices.stream().map(real->{
List<AppHydropowerDeviceVo> hydropowerDevices = new ArrayList<>();
Double loadSum = 0.0;
for(HydropowerUnitRealVo real : devices){
AppHydropowerDeviceVo device = new AppHydropowerDeviceVo();
device.setOrd(real.getOrd());
device.setDeviceCode(real.getDeviceCode());
@ -1581,14 +1574,32 @@ public class HydropowerServiceImpl implements HydropowerService {
device.setOrd(real.getOrd());
device.setState(real.getState());
device.setLoadUnit(Optional.ofNullable(real.getPowerUnit()).orElse("kW"));
if("MW".equalsIgnoreCase(device.getLoadUnit())){
loadSum += (real.getActivePower() * 1000);
}else{
loadSum += real.getActivePower();
}
device.setCapacity(real.getInstalledCapacity());
device.setLoad(real.getActivePower());
return device;
}).sorted(Comparator.comparing(AppHydropowerDeviceVo::getOrd)).collect(Collectors.toList()));
hydropower.setLoadUnit(hydropower.getDevices().get(0).getLoadUnit());
hydropowerDevices.add(device);
};
// 设备
hydropower.setDevices(hydropowerDevices.stream().sorted(Comparator.comparing(AppHydropowerDeviceVo::getOrd)).collect(Collectors.toList()));
// 负荷
hydropower.setLoad(loadSum);
}else{
hydropower.setLoad(0.0);
}
// 出力
if(Math.abs(hydropower.getLoad()) > 0 && Math.abs(hydropower.getCapacity()) > 0){
hydropower.setOutput(BigDecimal.valueOf(hydropower.getLoad() / hydropower.getCapacity() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
}else{
hydropower.setOutput(0.0);
}
// 负荷单位
hydropower.setLoadUnit("kW");
return hydropower;
}).collect(Collectors.toList());
}).sorted(Comparator.comparing(AppHydropowerStationVo::getSort)).collect(Collectors.toList());
}
/**
@ -1768,7 +1779,7 @@ public class HydropowerServiceImpl implements HydropowerService {
* @param end
* @param deptList
*/
private void getMaintenanceTask(AppAreaDutyVo item, String start, String end, List<Long> deptList) {
private void getMaintenanceTask(AppAreaDutyVo item, String start, String end, List<Long> deptList) {
item.setMaintenanceTaskCount(0);
item.setMaintenanceTaskFinishCount(0);
item.setNotMaintenanceTaskCount(0);

38
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java

@ -699,7 +699,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
// 容量
kpi.setInstalledCapacity(reals.stream().mapToDouble(PhotovoltaicRealVo::getCapacity).sum());
// 负荷
kpi.setLoad(reals.stream().mapToDouble(PhotovoltaicRealVo::getLoad).sum());
kpi.setLoad(reals.stream().filter(o-> !ObjectUtil.isEmpty(o.getLoad())).mapToDouble(PhotovoltaicRealVo::getLoad).sum());
}
}
// 指标数据
@ -946,7 +946,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
subordinate.setStationCount((long) entry.getValue().size());
subordinate.setStationUseCount(reals.stream().filter(device -> device.getState() == 1).map(PhotovoltaicRealVo::getDeptId).distinct().count());
subordinate.setCapacity(reals.stream().mapToDouble(PhotovoltaicRealVo::getCapacity).sum());
subordinate.setLoad(reals.stream().mapToDouble(PhotovoltaicRealVo::getLoad).sum());
subordinate.setLoad(reals.stream().filter(o-> !ObjectUtil.isEmpty(o.getLoad())).mapToDouble(PhotovoltaicRealVo::getLoad).sum());
}
// 区域/站点 设备指标数据
if (deviceTargets != null) {
@ -1515,31 +1515,35 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
return;
}
// 容量
photovoltaic.setCapacity(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getCapacity).sum());
photovoltaic.setCapacity(photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getCapacity())).mapToDouble(PhotovoltaicDeviceVo::getCapacity).sum());
// 总发电量
photovoltaic.setGenerate(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerate).sum());
// 收益
photovoltaic.setIncome(photovoltaic.getGenerate() * 0.34);
photovoltaic.setGenerate(photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getGenerate())).mapToDouble(PhotovoltaicDeviceVo::getGenerate).sum());
// // 收益
if(ObjectUtil.isEmpty(photovoltaic.getGenerate())){
photovoltaic.setIncome(0.0);
}else{
photovoltaic.setIncome(photovoltaic.getGenerate() * 0.34);
}
// 年发电量
photovoltaic.setGenerateYear(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerateYear).sum());
photovoltaic.setGenerateYear(photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getGenerateYear())).mapToDouble(PhotovoltaicDeviceVo::getGenerateYear).sum());
// 月发电量
photovoltaic.setGenerateMon(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerateMon).sum());
photovoltaic.setGenerateMon(photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getGenerateMon())).mapToDouble(PhotovoltaicDeviceVo::getGenerateMon).sum());
// 日发电量
photovoltaic.setGenerateDay(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerateDay).sum());
photovoltaic.setGenerateDay(photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getGenerateDay())).mapToDouble(PhotovoltaicDeviceVo::getGenerateDay).sum());
// 功率
photovoltaic.setLoad(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getLoad).sum());
double generationDay = photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerateDay).sum();
double generationYesterday = photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerationYesterday).sum();
photovoltaic.setLoad(photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getLoad())).mapToDouble(PhotovoltaicDeviceVo::getLoad).sum());
double generationDay = photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getGenerateDay())).mapToDouble(PhotovoltaicDeviceVo::getGenerateDay).sum();
double generationYesterday = photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getGenerationYesterday())).mapToDouble(PhotovoltaicDeviceVo::getGenerationYesterday).sum();
// 环比发电量
if (Math.abs(generationDay) <= 0 || Math.abs(generationYesterday) <= 0) {
if (ObjectUtil.isEmpty(generationDay) || ObjectUtil.isEmpty(generationYesterday) || Math.abs(generationDay) <= 0 || Math.abs(generationYesterday) <= 0) {
photovoltaic.setGenerateDayRatio(0.0);
} else {
photovoltaic.setGenerateDayRatio(BigDecimal.valueOf((generationDay - generationYesterday) / generationYesterday * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
}
double load = photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getLoad).sum();
double lastLoad = photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getLastLoad).sum();
double load = photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getLoad())).mapToDouble(PhotovoltaicDeviceVo::getLoad).sum();
double lastLoad = photovoltaic.getDevices().stream().filter(o->!ObjectUtil.isEmpty(o.getLastLoad())).mapToDouble(PhotovoltaicDeviceVo::getLastLoad).sum();
// 环比功率
if (Math.abs(load) <= 0 || Math.abs(lastLoad) <= 0) {
if (ObjectUtil.isEmpty(load) || ObjectUtil.isEmpty(lastLoad) || Math.abs(load) <= 0 || Math.abs(lastLoad) <= 0) {
photovoltaic.setLoadRatio(0.0);
} else {
photovoltaic.setLoadRatio(BigDecimal.valueOf((load - lastLoad) / lastLoad * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
@ -1710,7 +1714,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
// 串流电压12
item.setSe_voltage_twelve(mateReals.get(0).getSe_voltage_twelve());
// 环比功率
if (Math.abs(mateReals.get(0).getLoad()) <= 0 || mateReals.get(0).getLastLoad() <= 0) {
if (ObjectUtil.isEmpty(mateReals.get(0).getLoad()) || ObjectUtil.isEmpty(mateReals.get(0).getLastLoad()) || Math.abs(mateReals.get(0).getLoad()) <= 0 || mateReals.get(0).getLastLoad() <= 0) {
item.setLoadRatio(0.0);
} else {
item.setLoadRatio(BigDecimal.valueOf((mateReals.get(0).getLoad() - mateReals.get(0).getLastLoad()) / mateReals.get(0).getLastLoad() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());

13
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java

@ -1,6 +1,5 @@
package com.hnac.hzims.operational.station.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.main.vo.StationCountVo;
@ -39,8 +38,6 @@ public interface IStationService extends BaseService<StationEntity> {
*/
boolean instanceProject(StationEntity req);
boolean instanceFdpStation(StationEntity req);
/**
* 删除站点
* @param id 站点ID按逗号分隔
@ -131,6 +128,16 @@ public interface IStationService extends BaseService<StationEntity> {
@Override
boolean updateById(StationEntity req);
@Override
boolean save(StationEntity entity);
/**
* 批量更新站点排序
* @param req 站点列表
* @return 更新是否成功
*/
boolean updateBatchSort(List<StationEntity> req);
List<StationEntity> accessHydropower();
@Override

19
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -679,7 +679,9 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
request.setDeptName(stationEntity.getName());
request.setParentId(Func.isNotEmpty(stationEntity.getHigherDept()) ? stationEntity.getHigherDept() : request.getParentId());
request.setDeptCategory(StationConstants.DeptCategoryEnum.STATION.getValue());
request.setSort(1);
if(Func.isEmpty(request.getSort())) {
request.setSort(1);
}
R<Void> buildResult = deptClient.createOrUpdateDept(request);
if (buildResult.isSuccess()) {
// 所属机构回传
@ -911,4 +913,19 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
}
return this.updateBatchById(stations);
}
/**
* 批量更新站点排序
*/
@Override
public boolean updateBatchSort(List<StationEntity> req) {
List<StationEntity> stations = new ArrayList<>();
for (StationEntity stationEntity : req) {
// 获取当前的站点信息
StationEntity station = this.getById(stationEntity.getId());
station.setSort(stationEntity.getSort());
stations.add(station);
}
return this.updateBatchById(stations);
}
}

Loading…
Cancel
Save