Browse Source

#泵站、光伏发电量、用电量

zhongwei
yang_shj 2 years ago
parent
commit
30b7bd603e
  1. 7
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java
  2. 29
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/SoeParamVo.java
  3. 31
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/SoeReustVo.java
  4. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/GenerateEntity.java
  5. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/UseEntity.java
  6. 8
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/vo/QueryVo.java
  7. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/GenerationPowerVo.java
  8. 50
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicDeviceVo.java
  9. 1
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicTargetVo.java
  10. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/StationConstants.java
  11. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java
  12. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java
  13. 62
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
  14. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/GenerateMapper.java
  15. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/GenerateMapper.xml
  16. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/GenerateService.java
  17. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/PowerService.java
  18. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/UseService.java
  19. 40
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java
  20. 59
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/PowerServiceImpl.java
  21. 84
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/UseServiceImpl.java
  22. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HydropowerController.java
  23. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/WebHomeController.java
  24. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java
  25. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HydropowerService.java
  26. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IWaterService.java
  27. 90
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java
  28. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  29. 60
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java
  30. 282
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java
  31. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java
  32. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/ImsDeptServiceImpl.java

7
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java

@ -13,8 +13,13 @@ public interface AbnormalAlarmConstant {
/**通讯恢复*/
String ABNORMAL_STATUS = "1";
String TYPE_NAMES[] = {"默认", "系统", "告警", "故障", "用户操作", "遥测越限", "遥信变位", "注册信息", "信息提示", "设备巡检", "遥控操作", "遥测越限恢复","未定义","通讯中断","数据异常"};
String[] TYPE_NAMES = {"默认", "系统", "告警", "故障", "用户操作", "遥测越限", "遥信变位", "注册信息", "信息提示", "设备巡检", "遥控操作", "遥测越限恢复","未定义","通讯中断","数据异常"};
/**处理、延后、误报*/
List<Long> HANDLE_WAY = Arrays.asList(1L,2L,3L,4L);
/**
* 2-告警,3-故障,5-遥测越限,13-通讯异常,14-数据异常
*/
List<Integer> SOE_TYPE_LIST = Arrays.asList(2,3,5,13,14);
}

29
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/SoeParamVo.java

@ -0,0 +1,29 @@
package com.hnac.hzims.operational.alert.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
* @date 2023/03/23 13:34:37
* @version 4.0.0
*/
@Data
public class SoeParamVo {
@ApiModelProperty(value = "站点编码")
private String code;
@ApiModelProperty(value = "查询开始时间:yyyy-MM-dd HH:mm:ss")
private String date;
@ApiModelProperty(value = "2-告警,3-故障,5-遥测越限,13-通讯异常,14-数据异常")
private Integer type;
@ApiModelProperty(value = "当前页码")
private Integer current;
@ApiModelProperty(value = "每页条目")
private Integer size;
}

31
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/SoeReustVo.java

@ -0,0 +1,31 @@
package com.hnac.hzims.operational.alert.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
* @date 2023/03/23 13:34:37
* @version 4.0.0
*/
@Data
public class SoeReustVo {
@ApiModelProperty(value = "最新的时间")
private String date;
@ApiModelProperty(value = "告警数据")
private List<AlarmDataVo> soeList;
@ApiModelProperty(value = "数量统计")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer count;
@ApiModelProperty(value = "总条数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long total;
}

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

@ -26,7 +26,7 @@ public class GenerateEntity extends TenantEntity implements Serializable {
private String dataOrigin;
@ApiModelProperty("发电量")
private BigDecimal generate;
private Double generate;
@ApiModelProperty("填报月份")
private String fillDate;

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

@ -26,7 +26,7 @@ public class UseEntity extends TenantEntity implements Serializable {
private String dataOrigin;
@ApiModelProperty("发电量")
private BigDecimal use;
private Double employ;
@ApiModelProperty("填报月份")
private String fillDate;

8
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/vo/QueryVo.java

@ -5,6 +5,11 @@ import lombok.Data;
import java.util.Date;
/**
* @author ysj
* @date 2023/04/10 11:16:07
* @version 4.0.0
*/
@Data
public class QueryVo{
@ -19,4 +24,7 @@ public class QueryVo{
@ApiModelProperty("设备编号")
private String deviceCode;
@ApiModelProperty("站点接入类型")
private String dataOrigin;
}

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

@ -1,5 +1,7 @@
package com.hnac.hzims.operational.main.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -12,8 +14,10 @@ public class GenerationPowerVo {
private String date;
@ApiModelProperty(value = "发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Float generate;
@ApiModelProperty(value = "功率·")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Float load;
}

50
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicDeviceVo.java

@ -198,101 +198,103 @@ public class PhotovoltaicDeviceVo {
private Double dc_voltage_twelve;
@ApiModelProperty(value = "流电流1")
@ApiModelProperty(value = "流电流1")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_one;
@ApiModelProperty(value = "流电流2")
@ApiModelProperty(value = "流电流2")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_two;
@ApiModelProperty(value = "流电流3")
@ApiModelProperty(value = "流电流3")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_three;
@ApiModelProperty(value = "流电流4")
@ApiModelProperty(value = "流电流4")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_four;
@ApiModelProperty(value = "流电流5")
@ApiModelProperty(value = "流电流5")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_five;
@ApiModelProperty(value = "流电流6")
@ApiModelProperty(value = "流电流6")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_six;
@ApiModelProperty(value = "流电流7")
@ApiModelProperty(value = "流电流7")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_seven;
@ApiModelProperty(value = "流电流8")
@ApiModelProperty(value = "流电流8")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_eight;
@ApiModelProperty(value = "流电流9")
@ApiModelProperty(value = "流电流9")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_nine;
@ApiModelProperty(value = "流电流10")
@ApiModelProperty(value = "流电流10")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_ten;
@ApiModelProperty(value = "流电流11")
@ApiModelProperty(value = "流电流11")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_eleven;
@ApiModelProperty(value = "流电流12")
@ApiModelProperty(value = "流电流12")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_twelve;
@ApiModelProperty(value = "直流电压1")
@ApiModelProperty(value = "串流电压1")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_one;
@ApiModelProperty(value = "流电压2")
@ApiModelProperty(value = "流电压2")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_two;
@ApiModelProperty(value = "流电压3")
@ApiModelProperty(value = "流电压3")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_three;
@ApiModelProperty(value = "流电压4")
@ApiModelProperty(value = "流电压4")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_four;
@ApiModelProperty(value = "流电压5")
@ApiModelProperty(value = "流电压5")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_five;
@ApiModelProperty(value = "流电压6")
@ApiModelProperty(value = "流电压6")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_six;
@ApiModelProperty(value = "流电压7")
@ApiModelProperty(value = "流电压7")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_seven;
@ApiModelProperty(value = "流电压8")
@ApiModelProperty(value = "流电压8")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_eight;
@ApiModelProperty(value = "流电压9")
@ApiModelProperty(value = "流电压9")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_nine;
@ApiModelProperty(value = "流电压10")
@ApiModelProperty(value = "流电压10")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_ten;
@ApiModelProperty(value = "流电压11")
@ApiModelProperty(value = "流电压11")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_eleven;
@ApiModelProperty(value = "流电压12")
@ApiModelProperty(value = "流电压12")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_twelve;
}

1
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicTargetVo.java

@ -25,6 +25,7 @@ public class PhotovoltaicTargetVo {
private String deviceName;
@ApiModelProperty(value = "当日运行时长")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double runHours;
@ApiModelProperty(value = "年发电量: kWh")

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/StationConstants.java

@ -20,6 +20,8 @@ public interface StationConstants {
//自动添加或修改机构数据
String TASK_VALUE_IMS_DEPT_CREATE = "imsDeptCreate";
String DATA_ORIGIN_FILL = "1";
enum DeptCategoryEnum {
STATION(4,"站点")
;

16
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java

@ -7,6 +7,8 @@ import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.service.HistoryAbnormalAlarmService;
import com.hnac.hzims.operational.alert.vo.AlarmParamVo;
import com.hnac.hzims.operational.alert.vo.AlarmReustVo;
import com.hnac.hzims.operational.alert.vo.SoeParamVo;
import com.hnac.hzims.operational.alert.vo.SoeReustVo;
import com.hnac.hzims.operational.config.vo.*;
import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo;
import io.swagger.annotations.Api;
@ -112,7 +114,7 @@ public class AbnormalAlarmController extends BladeController {
*
*/
@ApiLog
@ApiOperation(value = "智能优化接口")
@ApiOperation(value = "原始告警接口")
@ApiOperationSupport(order = 7)
@RequestMapping(value = "/alarms", method = {RequestMethod.GET, RequestMethod.POST})
public R<AlarmReustVo> alarms(AlarmParamVo param){
@ -120,6 +122,18 @@ public class AbnormalAlarmController extends BladeController {
}
/**
*
*/
@ApiLog
@ApiOperation(value = "等级告警接口")
@ApiOperationSupport(order = 7)
@RequestMapping(value = "/terrace_alarms", method = {RequestMethod.GET, RequestMethod.POST})
public R<SoeReustVo> terrace_alarms(SoeParamVo param){
return R.data(service.terrace_alarms(param));
}
/**
* 智能告警数量: 时间范围当天
*/
@ApiLog

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.vo.AlarmParamVo;
import com.hnac.hzims.operational.alert.vo.AlarmReustVo;
import com.hnac.hzims.operational.alert.vo.SoeParamVo;
import com.hnac.hzims.operational.alert.vo.SoeReustVo;
import com.hnac.hzims.operational.config.vo.*;
import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo;
import org.springblade.core.mp.base.BaseService;
@ -33,4 +35,6 @@ public interface HistoryAbnormalAlarmService extends BaseService<HistoryAbnormal
IPage<AlarmVo> alarmData(AlarmDataPageVo page,Query query);
List<String> queryStationName();
SoeReustVo terrace_alarms(SoeParamVo param);
}

62
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java

@ -4,17 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fasterxml.jackson.core.type.TypeReference;
import com.hnac.hzims.operational.alert.constants.AbnormalAlarmConstant;
import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity;
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.mapper.HistoryAbnormalAlarmMapper;
import com.hnac.hzims.operational.alert.service.AlarmHandleService;
import com.hnac.hzims.operational.alert.service.HistoryAbnormalAlarmService;
import com.hnac.hzims.operational.alert.vo.AlarmDataVo;
import com.hnac.hzims.operational.alert.vo.AlarmParamVo;
import com.hnac.hzims.operational.alert.vo.AlarmReustVo;
import com.hnac.hzims.operational.config.vo.*;
import com.hnac.hzims.operational.alert.vo.*;
import com.hnac.hzims.operational.config.vo.AlarmDataPageVo;
import com.hnac.hzims.operational.config.vo.AlarmVo;
import com.hnac.hzims.operational.config.vo.IntelligentAlarmCountVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
@ -24,7 +23,9 @@ import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.core.utils.JsonUtil;
import com.hnac.hzinfo.sdk.v5.soe.SoeClient;
import com.hnac.hzinfo.sdk.v5.soe.dto.SoeDTO;
import com.hnac.hzinfo.sdk.v5.soe.vo.SoeVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils;
@ -60,6 +61,9 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
private final ISoeClient alarmClient;
private final SoeClient soeClient;
@Value("${hzims.operation.alarm.types}")
private String types;
@ -282,6 +286,49 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
/**
* 等级告警查询接口
* @param param
* @return
*/
@Override
public SoeReustVo terrace_alarms(SoeParamVo param) {
// 查询站点
LambdaQueryWrapper<StationEntity> wrapper = Wrappers.lambdaQuery();
if(StringUtils.isNotEmpty(param.getCode())){
wrapper.eq(StationEntity::getCode,param.getCode());
}
List<StationEntity> stations = stationService.list(wrapper);
if(CollectionUtil.isEmpty(stations)){
return new SoeReustVo();
}
// 参数设置
SoeDTO soe_params = new SoeDTO();
//soe_params.setProjectId();
String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00";
String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME) + " 00:00:00";
soe_params.setBeginTime(DateUtil.parse(start,DateUtil.PATTERN_DATETIME));
soe_params.setEndTime(DateUtil.parse(end,DateUtil.PATTERN_DATETIME));
soe_params.setNeedPage(true);
soe_params.setPage(param.getCurrent());
soe_params.setPageSize(param.getSize());
if(ObjectUtil.isEmpty(param.getType())){
soe_params.setTypes(AbnormalAlarmConstant.SOE_TYPE_LIST);
}else{
soe_params.setTypes(Collections.singletonList(param.getType()));
}
// 查询等级告警数据
Result<HzPage<SoeVO>> soes = soeClient.pageQuery(soe_params);
if(!soes.isSuccess() || ObjectUtil.isEmpty(soes.getData())){
return new SoeReustVo();
}
List<Long> handles = this.getAlarmHandleIds();
return null;
}
/**
* 获取处理数据ID集合
* @return
*/
@ -372,7 +419,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
alarm.setRealId(record.getRealId());
alarm.setTs(record.getTs());
alarm.setSoeStatus(record.getSoeStatus());
alarm.setSoeType(AbnormalAlarmConstant.TYPE_NAMES[Integer.valueOf(record.getSoeType())]);
alarm.setSoeType(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(record.getSoeType())]);
alarm.setOptionvals(record.getOptionvals());
alarm.setSoeStatus(record.getSoeStatus());
alarm.setStation(record.getStation());
@ -402,6 +449,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
}
private Boolean entityIsNull(Object object) {
if (null == object) {
return true;

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/GenerateMapper.java

@ -1,8 +1,11 @@
package com.hnac.hzims.operational.fill.mapper;
import com.hnac.hzims.operational.fill.entity.GenerateEntity;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List;
/**
* @author ysj
* @date 2023/04/10 11:22:14
@ -10,4 +13,5 @@ import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
*/
public interface GenerateMapper extends UserDataScopeBaseMapper<GenerateEntity> {
List<GenerateEntity> records(@Param("date") String date,@Param("station") String station);
}

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/GenerateMapper.xml

@ -1,4 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.operational.fill.mapper.GenerateMapper">
<select id="records" resultType="com.hnac.hzims.operational.fill.entity.GenerateEntity">
select * from hzims_fill_generate
where is_deleted = 0
and date = #{date}
and station_code = #{station}
</select>
</mapper>

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/GenerateService.java

@ -6,10 +6,13 @@ import com.hnac.hzims.operational.fill.entity.RainfallEntity;
import com.hnac.hzims.operational.fill.vo.GenerateVo;
import com.hnac.hzims.operational.fill.vo.QueryVo;
import com.hnac.hzims.operational.fill.vo.RainfallVo;
import com.hnac.hzims.operational.main.vo.PowerMonthVo;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import java.util.List;
/**
* @author ysj
* @date 2023/04/10 11:16:07
@ -22,4 +25,7 @@ public interface GenerateService extends BaseService<GenerateEntity> {
// 新增/修改发电量填报数据
boolean saveUpdate(GenerateEntity entity);
// 获取站点填报发电量
List<PowerMonthVo> generateThreeYear(String start, String end, String station);
}

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/PowerService.java

@ -3,10 +3,14 @@ package com.hnac.hzims.operational.fill.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.fill.entity.PowerEntity;
import com.hnac.hzims.operational.fill.vo.PowerVo;
import com.hnac.hzims.operational.main.vo.GenerationPowerVo;
import com.hnac.hzims.operational.main.vo.PowerMonthVo;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import java.util.List;
/**
* 其他填报接口
*/
@ -17,4 +21,8 @@ public interface PowerService extends BaseService<PowerEntity> {
R upd(PowerEntity entity);
R<IPage<PowerVo>> pageCondition(PowerVo vo, Query query);
Double generate(String date,Long station);
List<PowerMonthVo> generateThreeYear(String start,String end,Long station);
}

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/UseService.java

@ -4,10 +4,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.fill.entity.UseEntity;
import com.hnac.hzims.operational.fill.vo.QueryVo;
import com.hnac.hzims.operational.fill.vo.UseVo;
import com.hnac.hzims.operational.main.vo.UsrPowerVo;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import java.util.List;
import java.util.Map;
/**
* @author ysj
* @date 2023/04/10 11:16:07
@ -20,4 +24,12 @@ public interface UseService extends BaseService<UseEntity> {
// 新增/修改用电量填报数据
boolean saveUpdate(UseEntity entity);
// 查询填报用电量
Float use(String date,String station);
// 查询30天填报用电量
List<UsrPowerVo> use30Day(String day, String station);
Map<String, Float> generateThreeYear(String start, String end, String station);
}

40
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java

@ -3,12 +3,14 @@ package com.hnac.hzims.operational.fill.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.fill.entity.GenerateEntity;
import com.hnac.hzims.operational.fill.mapper.GenerateMapper;
import com.hnac.hzims.operational.fill.service.GenerateService;
import com.hnac.hzims.operational.fill.vo.GenerateVo;
import com.hnac.hzims.operational.fill.vo.QueryVo;
import com.hnac.hzims.operational.fill.wrapper.GenerateWrapper;
import com.hnac.hzims.operational.main.vo.PowerMonthVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
@ -16,11 +18,15 @@ import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author ysj
@ -50,6 +56,9 @@ public class GenerateServiceImpl extends BaseServiceImpl<GenerateMapper, Generat
if(!ObjectUtil.isEmpty(filter.getEndTime())){
le("FILL_DATE",filter.getEndTime());
}
if(!ObjectUtil.isEmpty(filter.getDataOrigin())){
eq("DATA_ORIGIN",filter.getDataOrigin());
}
orderByDesc("create_time");
}};
IPage pages = super.page(Condition.getPage(query), queryWrapper);
@ -78,4 +87,35 @@ public class GenerateServiceImpl extends BaseServiceImpl<GenerateMapper, Generat
return this.updateById(entity);
}
/**
*
* @param start 时间: - yyyy/ yyyy-mm/ yyyy-mm-dd
* @param end 时间: - yyyy/ yyyy-mm/ yyyy-mm-dd
* @param station 站点编码
* @return
*/
@Override
public List<PowerMonthVo> generateThreeYear(String start, String end, String station) {
List<GenerateEntity> records = this.list(Wrappers.<GenerateEntity>lambdaQuery()
.eq(GenerateEntity::getStationCode,station)
.between(GenerateEntity::getFillDate,start,end)
);
if(CollectionUtil.isEmpty(records)){
return new ArrayList<>();
}
// 返回结果
return records.stream().peek(
record-> record.setFillDate(DateUtil.format(DateUtil.parse(record.getFillDate(),"yyyy-MM"),"yyyy-MM") + "-01")
).collect(Collectors.toMap(GenerateEntity::getFillDate,GenerateEntity::getGenerate,Double::sum)).
entrySet().stream().map(entry->{
PowerMonthVo mon = new PowerMonthVo();
mon.setStrMonth(entry.getKey());
if(Math.abs(entry.getValue()) <= 0){
mon.setPower(0f);
}else{
mon.setPower(Float.parseFloat(entry.getValue().toString()));
}
return mon;
}).collect(Collectors.toList());
}
}

59
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/PowerServiceImpl.java

@ -1,12 +1,16 @@
package com.hnac.hzims.operational.fill.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.fill.entity.PowerEntity;
import com.hnac.hzims.operational.fill.mapper.PowerMapper;
import com.hnac.hzims.operational.fill.service.PowerService;
import com.hnac.hzims.operational.fill.vo.PowerVo;
import com.hnac.hzims.operational.fill.wrapper.PowerWrapper;
import com.hnac.hzims.operational.main.vo.GenerationPowerVo;
import com.hnac.hzims.operational.main.vo.PowerMonthVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
@ -14,12 +18,16 @@ import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@Slf4j
@ -97,4 +105,55 @@ public class PowerServiceImpl extends BaseServiceImpl<PowerMapper, PowerEntity>
return R.data(pages.setRecords(list));
}
/**
* 根据时间机构查询发电量
* @param date 时间: - yyyy/ yyyy-mm/ yyyy-mm-dd
* @param station 所属机构
* @return
*/
@Override
public Double generate(String date, Long station) {
List<PowerEntity> powers = this.list(Wrappers.<PowerEntity>lambdaQuery()
.likeRight(PowerEntity::getMon,date)
.eq(PowerEntity::getCreateDept,station)
// 类型: 光伏
.eq(PowerEntity::getType,1)
);
if(CollectionUtil.isEmpty(powers)){
return 0.0;
}
return powers.stream().mapToDouble(PowerEntity::getPowerMon).sum();
}
/**
*
* @param start 开始时间 : yyyy-mm
* @param end 结束时间 : yyyy-mm
* @param station 所属机构
* @return
*/
@Override
public List<PowerMonthVo> generateThreeYear(String start, String end, Long station) {
List<PowerEntity> fills = this.list(Wrappers.<PowerEntity>lambdaQuery()
.between(PowerEntity::getMon,start,end)
.eq(PowerEntity::getCreateDept,station)
// 类型: 光伏
.eq(PowerEntity::getType,1)
);
if(CollectionUtil.isEmpty(fills)){
return new ArrayList<>();
}
return fills.stream().map(fill->{
PowerMonthVo mon = new PowerMonthVo();
mon.setStrMonth(DateUtil.format(DateUtil.parse(fill.getMon(),"yyyy-MM"),DateUtil.PATTERN_DATE));
if(Math.abs(fill.getPowerMon()) <= 0){
mon.setPower(0f);
}else{
mon.setPower(Float.parseFloat(fill.getPowerMon().toString()));
}
return mon;
}).collect(Collectors.toList());
}
}

84
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/UseServiceImpl.java

@ -3,12 +3,17 @@ package com.hnac.hzims.operational.fill.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.fill.entity.GenerateEntity;
import com.hnac.hzims.operational.fill.entity.PowerEntity;
import com.hnac.hzims.operational.fill.entity.UseEntity;
import com.hnac.hzims.operational.fill.mapper.UseMapper;
import com.hnac.hzims.operational.fill.service.UseService;
import com.hnac.hzims.operational.fill.vo.QueryVo;
import com.hnac.hzims.operational.fill.vo.UseVo;
import com.hnac.hzims.operational.fill.wrapper.UseWrapper;
import com.hnac.hzims.operational.main.vo.PowerMonthVo;
import com.hnac.hzims.operational.main.vo.UsrPowerVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
@ -16,11 +21,14 @@ import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ysj
@ -50,6 +58,9 @@ public class UseServiceImpl extends BaseServiceImpl<UseMapper, UseEntity> implem
if(!ObjectUtil.isEmpty(filter.getEndTime())){
le("FILL_DATE",filter.getEndTime());
}
if(!ObjectUtil.isEmpty(filter.getDataOrigin())){
eq("DATA_ORIGIN",filter.getDataOrigin());
}
orderByDesc("create_time");
}};
IPage pages = super.page(Condition.getPage(query), queryWrapper);
@ -78,4 +89,75 @@ public class UseServiceImpl extends BaseServiceImpl<UseMapper, UseEntity> implem
return this.updateById(entity);
}
/**
* 根据时间机构查询用电量
* @param date 时间: - yyyy/ yyyy-mm/ yyyy-mm-dd
* @param station 所属机构
* @return
*/
@Override
public Float use(String date, String station) {
List<UseEntity> powers = this.list(Wrappers.<UseEntity>lambdaQuery()
.likeRight(UseEntity::getFillDate,date)
.eq(UseEntity::getStationCode,station)
);
if(CollectionUtil.isEmpty(powers)){
return 0f;
}
return (float) powers.stream().mapToDouble(UseEntity::getEmploy).sum();
}
/**
* 查询30天填报用电量
* @param day : 结束日期 yyyy-MM-dd
* @param station 站点编码
* @return
*/
@Override
public List<UsrPowerVo> use30Day(String day, String station) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(DateUtil.parse(day,DateUtil.PATTERN_DATE));
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
calendar.add(Calendar.DAY_OF_MONTH,-29);
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
List<UseEntity> records = this.list(Wrappers.<UseEntity>lambdaQuery()
.between(UseEntity::getFillDate,start,end)
.eq(UseEntity::getStationCode,station)
);
if(CollectionUtil.isEmpty(records)){
return new ArrayList<>();
}
return records.stream().map(record->{
UsrPowerVo use = new UsrPowerVo();
use.setDate(record.getFillDate());
if(Math.abs(record.getEmploy()) <= 0){
use.setUsrPower(0f);
}else{
use.setUsrPower(Float.parseFloat(record.getEmploy().toString()));
}
return use;
}).collect(Collectors.toList());
}
/**
* 查询近3年的填报用电量
* @param start
* @param end
* @param station
* @return
*/
@Override
public Map<String, Float> generateThreeYear(String start, String end, String station) {
List<UseEntity> records = this.list(Wrappers.<UseEntity>lambdaQuery()
.between(UseEntity::getFillDate,start,end)
.eq(UseEntity::getStationCode,station)
);
if(CollectionUtil.isEmpty(records)){
return new HashMap<>();
}
return records.stream().peek(record-> record.setFillDate(DateUtil.format(DateUtil.parse(record.getFillDate(),"yyyy-MM"),"yyyy-MM") + "-01")).
collect(Collectors.toMap(UseEntity::getFillDate, value->Float.parseFloat(value.getEmploy().toString()),Float::sum));
}
}

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HydropowerController.java

@ -88,7 +88,6 @@ public class HydropowerController extends BladeController {
@ApiLog
@ApiOperation("计划发电趋势")
@GetMapping("/planGenerationTrend")

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/WebHomeController.java

@ -1,7 +1,7 @@
package com.hnac.hzims.operational.main.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.main.service.IWebHomeService;
import com.hnac.hzims.operational.main.service.HydropowerService;
import com.hnac.hzims.operational.main.vo.HydropowerStationVo;
import com.hnac.hzims.operational.main.vo.HydropowerUnitVo;
import io.swagger.annotations.Api;
@ -23,7 +23,7 @@ import java.util.List;
@AllArgsConstructor
public class WebHomeController extends BladeController {
private final IWebHomeService service;
private final HydropowerService service;
@ApiLog
@ApiOperation("水电站站点统计")
@GetMapping("/webStation")

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java

@ -13,7 +13,6 @@ import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Arrays;
@ -44,7 +43,7 @@ public class ScheduledCreateTask {
@Autowired
private IAreaMonthReportService reportService;
@Autowired
private IWebHomeService webHomeService;
private HydropowerService hydropowerService;
@Autowired
private PhotovoltaicService photovoltaicService;
@Autowired
@ -169,10 +168,9 @@ public class ScheduledCreateTask {
* 获取站点近3年发电量数据
* @return ReturnT<String>
*/
//@XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> powerGenerationRecentYear() throws Exception {
String param = "";
@XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> powerGenerationRecentYear(String param) throws Exception {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
@ -274,7 +272,7 @@ public class ScheduledCreateTask {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
webHomeService.loadHydropowerReal(param);
hydropowerService.loadHydropowerReal(param);
return new ReturnT<>("SUCCESS");
}
@ -288,7 +286,7 @@ public class ScheduledCreateTask {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
webHomeService.loadHydropowerTarget(param);
hydropowerService.loadHydropowerTarget(param);
return new ReturnT<>("SUCCESS");
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IWebHomeService.java → hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HydropowerService.java

@ -2,14 +2,13 @@ package com.hnac.hzims.operational.main.service;
import com.hnac.hzims.operational.main.vo.HydropowerStationVo;
import com.hnac.hzims.operational.main.vo.HydropowerUnitVo;
import com.hnac.hzims.operational.main.vo.WaterStationVo;
import java.util.List;
/**
* WEB水电站首页接口
*/
public interface IWebHomeService {
public interface HydropowerService {
void loadHydropowerReal(String param);

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

@ -27,7 +27,7 @@ public interface IWaterService {
List<WaterYearDataVo> waterYearRain(Long deptId);
Dept getTitleDetp(List<Dept> authList, Long deptId);
Dept getTitleDetp(Long deptId);
WaterStationVo waterStationPage(Long deptId);

90
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java

@ -65,22 +65,40 @@ import java.util.stream.Collectors;
@Slf4j
public class HomePageServiceImpl implements IHomePageService {
private final IAnalyseDataService analyseDataService;
private final IPlanGenertionClient planGenertionClient;
private final IMainSystemMonitoringService maintenanceTaskService;
private final IMainTaskStatisticService mainTaskStatisticService;
private final IStationService stationService;
private final PowerService powerService;
private final OverService overService;
private final OverDetailsService overDetailsService;
private final SolveService solveService;
private final OtherService otherService;
private final OverDetailsService overDetailsService;
private final IAnalyseDataService analyseDataService;
private final PowerService photovoltaicService;
private final GenerateService hydropowerService;
private final IMainSystemMonitoringService maintenanceTaskService;
private final IMainTaskStatisticService mainTaskStatisticService;
private final ISysClient sysClient;
private final ISoeClient soeClient;
private final IPlanGenertionClient planGenertionClient;
private final ITicketInfoAllClient ticketInfoAllClient;
private final RedisTemplate redisTemplate;
private final IAnalyseInstanceClient analyseInstanceClient;
private final RedisTemplate redisTemplate;
private final static String KEY_INDICATORS_INFO = "hzims:operation:key:indicators:info";
private final static String RECENT_YEAR_POWER_DATA = "hzims:operation:key:power:data";
@ -154,6 +172,8 @@ public class HomePageServiceImpl implements IHomePageService {
// 充电桩
case 7:
break;
default:
break;
}
});
redisTemplate.opsForValue().set(KEY_INDICATORS_INFO, keyIndicatorsVo);
@ -237,10 +257,7 @@ public class HomePageServiceImpl implements IHomePageService {
stationList.forEach(station -> {
// 站点设备集合
List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(stationDevices)){
return;
}
Map<String, Float> generateMap = this.getGenerateYear(stationDevices,start,end);
Map<String, Float> generateMap = this.getGenerateYear(station,stationDevices,start,end);
if(MapUtils.isEmpty(generateMap)){
return;
}
@ -256,26 +273,47 @@ public class HomePageServiceImpl implements IHomePageService {
* @param end
* @return
*/
private Map<String, Float> getGenerateYear(List<EminfoAndEmParamVo> devices, String start, String end) {
private Map<String, Float> getGenerateYear(StationEntity station,List<EminfoAndEmParamVo> devices, String start, String end) {
List<PowerMonthVo> datas = new ArrayList<>();
devices.forEach(device->{
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
if(CollectionUtil.isEmpty(records)){
return;
}
datas.addAll(records.stream().map(record -> {
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.valueOf(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount());
return generate;
}).collect(Collectors.toList()));
});
// 设备采集发电量
if(CollectionUtil.isNotEmpty(devices)){
devices.forEach(device->{
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
if(CollectionUtil.isEmpty(records)){
return;
}
datas.addAll(records.stream().map(record -> {
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());
return generate;
}).collect(Collectors.toList()));
});
}
// 补充填报数据
datas.addAll(this.generateFill(station,start,end));
if(CollectionUtil.isEmpty(datas)){
return null;
}
return datas.stream().collect(Collectors.groupingBy(PowerMonthVo::getStrMonth, Collectors.collectingAndThen(
Collectors.mapping(PowerMonthVo::getPower, Collectors.reducing(Float::sum)),Optional::get)));
return datas.stream().collect(Collectors.toMap(PowerMonthVo::getStrMonth, PowerMonthVo::getPower, Float::sum));
}
/**
* 补充填报数据
* @param station
* @param start
* @param end
*/
private List<PowerMonthVo> generateFill(StationEntity station, String start, String end) {
start = DateUtil.format(DateUtil.parse(start,DateUtil.PATTERN_DATETIME),"yyyy-MM");
end = DateUtil.format(DateUtil.parse(end,DateUtil.PATTERN_DATETIME),"yyyy-MM");
// 光伏
if(HomePageConstant.PHOTOVOLTAIC.equals(station.getType())){
return photovoltaicService.generateThreeYear(start,end,station.getRefDept());
// 水电
}
return hydropowerService.generateThreeYear(start,end,station.getCode());
}
/**

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WebHomeServiceImpl.java → hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -30,7 +30,6 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
@ -43,7 +42,7 @@ import java.util.stream.Collectors;
*/
@Service
@RequiredArgsConstructor
public class WebHomeServiceImpl implements IWebHomeService {
public class HydropowerServiceImpl implements HydropowerService {
private final IAnalyseDataService analyseDataService;

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

@ -7,6 +7,7 @@ import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse;
import com.hnac.hzims.operational.fill.service.PowerService;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.*;
import com.hnac.hzims.operational.main.vo.*;
@ -68,10 +69,12 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
private final IAnalyseDataService analyseDataService;
private final IHistoryDataSearchClient historySearchClient;
private final IMainTaskStatisticService taskService;
private final PowerService generateService;
private final IHistoryDataSearchClient historySearchClient;
private final ISysClient sysClient;
private final ITicketInfoClient ticketInfoClient;
@ -243,6 +246,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
return;
}
List<PhotovoltaicTargetVo> list = new ArrayList<>();
// 接入站点设备统计
devices.forEach(device -> {
PhotovoltaicTargetVo target = new PhotovoltaicTargetVo();
target.setDeptId(device.getCreateDept());
@ -273,9 +277,18 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
target.setGenerationPowerVoList(this.getGenerateByMon(device));
list.add(target);
});
// 补充站点填报发电量
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getType, HomePageConstant.PHOTOVOLTAIC)
.eq(StationEntity::getServeType, HomePageConstant.HYDROPOWER_SERVETYPE)
);
if(CollectionUtil.isNotEmpty(stations)){
list.addAll(this.generateFill(stations));
}
redisTemplate.opsForValue().set(load_photovoltaic_target_key, list);
}
/**
* 当天有功功率
*
@ -325,6 +338,45 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
}).sorted(Comparator.comparing(GenerationPowerVo::getDate)).collect(Collectors.toList());
}
/**
* 获取光伏站点填报数据
* @param stations
* @return
*/
private List<PhotovoltaicTargetVo> generateFill(List<StationEntity> stations) {
Calendar calendar = Calendar.getInstance();
//String day = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
String mon = DateUtil.format(calendar.getTime(),"yyyy-MM");
String year = String.valueOf(calendar.get(Calendar.YEAR));
//calendar.add(Calendar.DAY_OF_MONTH,-1);
//String yesterday = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
return stations.stream().map(station ->{
PhotovoltaicTargetVo target = new PhotovoltaicTargetVo();
target.setDeptId(station.getRefDept());
target.setDeptName(station.getName());
// 当日运行时长
target.setRunHours(0.0);
// 日发电量
target.setGenerationDay(0.0);
// 昨日发电量
target.setGenerationYesterday(0.0);
// 收益
target.setIncome(0.0);
// 日发电量
// 月发电量
target.setGenerationMon(generateService.generate(mon,station.getRefDept()));
// 节约标准煤
target.setTec(target.getGenerationMon() * 0.0001229);
// 二氧化碳减排
target.setCo2(target.getGenerationMon() * 0.000997);
// 减少森林砍伐
target.setDeforest(target.getGenerationMon() * 0.000553);
// 年发电量
target.setGenerationYear(generateService.generate(year,station.getRefDept()));
// 30天发电量
return target;
}).collect(Collectors.toList());
}
/**
* 根据事件查询数据值
@ -1462,7 +1514,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
}
// 功率
photovoltaic.setActivePowerVoList(
devices.stream().map(PhotovoltaicDeviceVo::getActivePowerVoList).flatMap(Collection::stream).collect(Collectors.groupingBy(PhotovoltaicPowerVo::getHour)).entrySet().stream().map(entry -> {
devices.stream().map(PhotovoltaicDeviceVo::getActivePowerVoList).filter(ObjectUtil::isNotEmpty).flatMap(Collection::stream).collect(Collectors.groupingBy(PhotovoltaicPowerVo::getHour)).entrySet().stream().map(entry -> {
PhotovoltaicPowerVo load = new PhotovoltaicPowerVo();
load.setHour(entry.getKey());
load.setActivePower(String.valueOf(entry.getValue().stream().mapToDouble(o -> Double.parseDouble(o.getActivePower())).sum()));
@ -1471,7 +1523,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
);
// 发电量
photovoltaic.setGenerationPowerVoList(
devices.stream().map(PhotovoltaicDeviceVo::getGenerationPowerVoList).flatMap(Collection::stream).collect(Collectors.groupingBy(GenerationPowerVo::getDate)).entrySet().stream().map(entry -> {
devices.stream().map(PhotovoltaicDeviceVo::getGenerationPowerVoList).filter(ObjectUtil::isNotEmpty).flatMap(Collection::stream).collect(Collectors.groupingBy(GenerationPowerVo::getDate)).entrySet().stream().map(entry -> {
GenerationPowerVo generate = new GenerationPowerVo();
generate.setDate(entry.getKey());
generate.setGenerate((float) entry.getValue().stream().mapToDouble(o -> Double.valueOf(o.getGenerate())).sum());

282
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java

@ -3,15 +3,18 @@ package com.hnac.hzims.operational.main.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse;
import com.hnac.hzims.hzimsweather.vo.RainFallCountByMonthVo;
import com.hnac.hzims.operational.fill.service.UseService;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.*;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.StationConstants;
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IHzimsAnalyzeModelStationService;
@ -44,8 +47,6 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
@ -60,26 +61,28 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class WaterServiceImpl implements IWaterService {
private final IAnalyseDataService analyseDataService;
private final UseService useService;
private final IHomePageService homePageService;
private final IStationService stationService;
private final IWeatherService weatherService;
private final IAnalyseDataService analyseDataService;
private final ISideHustleService sideHustleService;
private final IMainSystemMonitoringService maintenanceTaskService;
private final IHzimsAnalyzeModelStationService modelStationService;
private final IAnalyseDataSearchClient analyseDataSearchClient;
private final ISysClient sysClient;
private final IWeatherService weatherService;
private final IAnalyseDataSearchClient analyseDataSearchClient;
private final IHistoryDataSearchClient historyDataSearchClient;
private final ISysClient sysClient;
private final RedisTemplate redisTemplate;
@Value("${hzims.operation.realIdKey}")
@ -91,13 +94,6 @@ public class WaterServiceImpl implements IWaterService {
private final static String loadwater_level_key = "hzims:operation:loadwater:level:key";
// 日期格式化yyyy-mm-dd
private final SimpleDateFormat df = new SimpleDateFormat(DateUtil.PATTERN_DATE);
// 日期格式化yyyy-mm-dd
private final SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.PATTERN_DATETIME);
// 时间格式化yyyy-MM-dd HH:mm:ss"
private final DateTimeFormatter dtf = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME);
/**
* 水利-泵组实时加载
* @param param
@ -149,43 +145,50 @@ public class WaterServiceImpl implements IWaterService {
@Override
public void loadWaterPumpTarget(String param) {
List<EminfoAndEmParamVo> valid = this.getValidDeviceList();
if(CollectionUtil.isEmpty(valid)){
return;
}
List<WaterPumpTargetVo> list = new ArrayList<>();
valid.forEach(device->{
WaterPumpTargetVo waterPumpTargetVo = new WaterPumpTargetVo();
waterPumpTargetVo.setDeptId(device.getCreateDept());
waterPumpTargetVo.setDeviceCode(device.getEmCode());
waterPumpTargetVo.setDeptName(device.getName());
// 当年用电量
float usrPowerYear = this.getUsrPowerYear(device);
waterPumpTargetVo.setUsrPowerYear(usrPowerYear);
// 当月用电量
float usrPowerMon = this.getUsrPowerMon(device);
waterPumpTargetVo.setUsrPowerMon(usrPowerMon);
// 当日用电量
float usrPowerDay = this.getUsrPowerDay(device);
waterPumpTargetVo.setUsrPowerDay(usrPowerDay);
// 月运行次数、时长
WaterRunVo runMon = this.getRunData(device,1);
waterPumpTargetVo.setRunCountMon(runMon.getCount());
waterPumpTargetVo.setRunDurationMon(runMon.getHour());
// 年运行次数、时长
WaterRunVo runYear = this.getRunData(device,0);
waterPumpTargetVo.setRunCountYear(runYear.getCount());
waterPumpTargetVo.setRunDurationYear(runYear.getHour());
// 当日机组有功功率
List<ActivePowerVo> activePowerVoList = this.getActivePowerVoList(device);
waterPumpTargetVo.setActivePowerVoList(activePowerVoList);
// 近30天用电量
List<UsrPowerVo> usrPowerVoList = this.getUsrPowerVoList(device);
waterPumpTargetVo.setUsrPowerVoList(usrPowerVoList);
// 近3年用电量
Map<String,Float> usrYearMap = this.getUsrYearMap(device);
waterPumpTargetVo.setUsrYearMap(usrYearMap);
list.add(waterPumpTargetVo);
});
if(CollectionUtil.isNotEmpty(valid)){
valid.forEach(device->{
WaterPumpTargetVo waterPumpTargetVo = new WaterPumpTargetVo();
waterPumpTargetVo.setDeptId(device.getCreateDept());
waterPumpTargetVo.setDeviceCode(device.getEmCode());
waterPumpTargetVo.setDeptName(device.getName());
// 当年用电量
float usrPowerYear = this.getUsrPowerYear(device);
waterPumpTargetVo.setUsrPowerYear(usrPowerYear);
// 当月用电量
float usrPowerMon = this.getUsrPowerMon(device);
waterPumpTargetVo.setUsrPowerMon(usrPowerMon);
// 当日用电量
float usrPowerDay = this.getUsrPowerDay(device);
waterPumpTargetVo.setUsrPowerDay(usrPowerDay);
// 月运行次数、时长
WaterRunVo runMon = this.getRunData(device,1);
waterPumpTargetVo.setRunCountMon(runMon.getCount());
waterPumpTargetVo.setRunDurationMon(runMon.getHour());
// 年运行次数、时长
WaterRunVo runYear = this.getRunData(device,0);
waterPumpTargetVo.setRunCountYear(runYear.getCount());
waterPumpTargetVo.setRunDurationYear(runYear.getHour());
// 当日机组有功功率
List<ActivePowerVo> activePowerVoList = this.getActivePowerVoList(device);
waterPumpTargetVo.setActivePowerVoList(activePowerVoList);
// 近30天用电量
List<UsrPowerVo> usrPowerVoList = this.getUsrPowerVoList(device);
waterPumpTargetVo.setUsrPowerVoList(usrPowerVoList);
// 近3年用电量
Map<String,Float> usrYearMap = this.getUsrYearMap(device);
waterPumpTargetVo.setUsrYearMap(usrYearMap);
list.add(waterPumpTargetVo);
});
}
// 补充站点填报发电量
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.in(StationEntity::getType, HomePageConstant.waterList)
.eq(StationEntity::getServeType, HomePageConstant.HYDROPOWER_SERVETYPE)
);
if(CollectionUtil.isNotEmpty(stations)){
list.addAll(this.useFill(stations));
}
redisTemplate.opsForValue().set(loadwaterpump_target_key,list);
}
@ -279,12 +282,8 @@ public class WaterServiceImpl implements IWaterService {
if(StringUtil.isBlank(time)){
return 0.0;
}
try{
Date date = sdf.parse(time);
if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){
return 0.0;
}
}catch (ParseException e){
Date date = DateUtil.parse(time,DateUtil.DATETIME_FORMAT);
if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){
return 0.0;
}
return Double.parseDouble(R.getData().get(0).getValue());
@ -297,7 +296,7 @@ public class WaterServiceImpl implements IWaterService {
* @return
*/
private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) {
LocalDateTime beginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"), dtf);
LocalDateTime beginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"), DateUtil.DATETIME_FORMATTER);
LocalDateTime endTime = LocalDateTime.now();
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
@ -573,11 +572,11 @@ public class WaterServiceImpl implements IWaterService {
*/
private float getUsrPowerYear(EminfoAndEmParamVo device) {
Calendar calendar = Calendar.getInstance();
String end = sdf.format(calendar.getTime());
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.setTime(new Date());
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
String start = df.format(calendar.getTime());
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
// 当年用电量
return analyseDataService.periodTargetFloat(start,end,6,5,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION);
}
@ -801,36 +800,82 @@ public class WaterServiceImpl implements IWaterService {
/**
* 获取填报用电量
* @param stations
* @return
*/
private List<WaterPumpTargetVo> useFill(List<StationEntity> stations) {
Calendar calendar = Calendar.getInstance();
String day = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
String mon = DateUtil.format(calendar.getTime(),"yyyy-MM");
String year = String.valueOf(calendar.get(Calendar.YEAR));
//calendar.add(Calendar.DAY_OF_MONTH,-1);
//String yesterday = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
return stations.stream().map(station ->{
WaterPumpTargetVo target = new WaterPumpTargetVo();
target.setDeptId(station.getRefDept());
target.setDeptName(station.getName());
// 月运行次数、时长
target.setRunCountMon(0);
target.setRunDurationMon(0.0);
// 年运行次数、时长
target.setRunCountYear(0);
target.setRunDurationYear(0.0);
// 当年用电量
target.setUsrPowerYear(useService.use(year,station.getCode()));
// 当月用电量
target.setUsrPowerMon(useService.use(mon,station.getCode()));
// 当日用电量
target.setUsrPowerDay(useService.use(day,station.getCode()));
if(StationConstants.DATA_ORIGIN_FILL.equals(station.getDataOrigin())){
// 30天用电量
target.setUsrPowerVoList(useService.use30Day(day,station.getCode()));
}
// 近3年用电量
target.setUsrYearMap(this.useThreeYear(station.getCode()));
return target;
}).collect(Collectors.toList());
}
/**
* 填报近3年发电量
* @param station
* @return
*/
private Map<String, Float> useThreeYear(String station) {
// 开始时间
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH) + 12);
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
String end = DateUtil.format(calendar.getTime(),"yyyy-MM");
// 结束日期
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 3);
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
return useService.generateThreeYear(start,end,station);
}
/**
* 水利首页-指标数据
* @param deptId
* @return
*/
@Override
public WaterConservancyVo waterConservancy(Long deptId) {
//根据用户权限获取机构
R<List<Dept>> R = sysClient.getDeptByCurrentUser();
if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) {
return null;
}
// 获取水利站点
List<StationEntity> stationList = stationService.getStationList(R.getData(),deptId,HomePageConstant.waterList,HomePageConstant.HYDROPOWER_SERVETYPE);
if(CollectionUtil.isEmpty(stationList)){
return null;
}
// 站点归属机构集合
List<Long> deptList = stationList.stream().map(StationEntity::getRefDept).collect(Collectors.toList());
if(CollectionUtil.isEmpty(deptList)){
return null;
// 查询水利站点
List<StationEntity> stations = stationService.getHomeStationList(deptId, HomePageConstant.waterList, HomePageConstant.HYDROPOWER_SERVETYPE);
if (CollectionUtil.isEmpty(stations)) {
return new WaterConservancyVo();
}
WaterConservancyVo response = new WaterConservancyVo();
// 查询指标标题机构
Dept title = this.getTitleDetp(R.getData(),deptId);
Dept title = this.getTitleDetp(deptId);
if(ObjectUtil.isNotEmpty(title)){
response.setDepartId(title.getId());
response.setDepartName(title.getDeptName());
}
response.setWaterStationCount((int) stationList.stream().filter(o->HomePageConstant.PUMPING.equals(o.getType())).count());
response.setSluiceGateCount((int) stationList.stream().filter(o->HomePageConstant.GATE.equals(o.getType())).count());
response.setWaterStationCount((int) stations.stream().filter(o->HomePageConstant.PUMPING.equals(o.getType())).count());
response.setSluiceGateCount((int) stations.stream().filter(o->HomePageConstant.GATE.equals(o.getType())).count());
response.setWaterInstall(0.0);
response.setWaterPower(0.0);
response.setKWhYear(0f);
@ -838,39 +883,35 @@ public class WaterServiceImpl implements IWaterService {
response.setKWhDay(0f);
// 获取设备实时数据
List<WaterPumpRealVo> list = (List<WaterPumpRealVo>) redisTemplate.opsForValue().get(loadwaterpump_real_key);
if(CollectionUtil.isEmpty(list)){
return response;
}
// 获取站点机构有效设备
List<WaterPumpRealVo> valid = list.stream().filter(o->deptList.contains(o.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(valid)){
return response;
if(CollectionUtil.isNotEmpty(list)){
// 获取站点机构有效设备
List<WaterPumpRealVo> valid = list.stream().filter(o->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(o.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(valid)){
// 装机容量
double waterInstall = valid.stream().mapToDouble(WaterPumpRealVo::getInstalledCapacity).sum();
response.setWaterInstall(waterInstall);
// 有功功率
double waterPower = valid.stream().mapToDouble(WaterPumpRealVo::getActivePower).sum();
response.setWaterPower(waterPower);
}
}
// 装机容量
double waterInstall = valid.stream().mapToDouble(WaterPumpRealVo::getInstalledCapacity).sum();
response.setWaterInstall(waterInstall);
// 有功功率
double waterPower = valid.stream().mapToDouble(WaterPumpRealVo::getActivePower).sum();
response.setWaterPower(waterPower);
// 获取设备指标数据
List<WaterPumpTargetVo> targetList = (List<WaterPumpTargetVo>) redisTemplate.opsForValue().get(loadwaterpump_target_key);
if(CollectionUtil.isEmpty(targetList)){
return response;
}
// 获取站点机构有效设备
List<WaterPumpTargetVo> validTarget = targetList.stream().filter(o->deptList.contains(o.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(valid)){
return response;
if(CollectionUtil.isNotEmpty(targetList)){
// 获取站点机构有效设备
List<WaterPumpTargetVo> validTarget = targetList.stream().filter(o->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(o.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(validTarget)){
// 年用电量
double kwhYear = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerYear).sum();
response.setKWhYear((float) kwhYear);
// 月用电量
double kwhMon = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerMon).sum();
response.setKWhMon((float) kwhMon);
// 日用电量
double kwhDay = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerDay).sum();
response.setKWhDay((float) kwhDay);
}
}
// 年用电量
double kwhYear = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerYear).sum();
response.setKWhYear((float) kwhYear);
// 月用电量
double kwhMon = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerMon).sum();
response.setKWhMon((float) kwhMon);
// 日用电量
double kwhDay = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerDay).sum();
response.setKWhDay((float) kwhDay);
return response;
}
@ -1154,16 +1195,17 @@ public class WaterServiceImpl implements IWaterService {
* @return
*/
@Override
public Dept getTitleDetp(List<Dept> authList, Long deptId) {
public Dept getTitleDetp(Long deptId) {
R<List<Dept>> depts = sysClient.getDeptByCurrentUser();
if(null == deptId){
// 最小类型机构
Dept dept = authList.stream().min(Comparator.comparing(Dept::getDeptCategory)).orElse(null);
Dept dept = depts.getData().stream().min(Comparator.comparing(Dept::getDeptCategory)).orElse(null);
if(ObjectUtil.isEmpty(dept)){
return null;
}
return dept;
}
List<Dept> list = authList.stream().filter(o->deptId.equals(o.getId())).collect(Collectors.toList());
List<Dept> list = depts.getData().stream().filter(o->deptId.equals(o.getId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(list)){
return null;
}
@ -1496,26 +1538,6 @@ public class WaterServiceImpl implements IWaterService {
}
/**
* 获取近30天集合
* @return
*/
private List<String> getRecent30Day() {
List<String> list = new ArrayList<>();
// 开始日期
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
list.add(df.format(calendar.getTime()));
// 获取日期之间的月
int i = 0;
while (i < 30) {
calendar.add(Calendar.DATE, - 1);
list.add(df.format(calendar.getTime()));
i++;
}
return list.stream().sorted(Comparator.comparing(String::valueOf)).collect(Collectors.toList());
}
/**
* 闸门列表
* @param deptId
* @return
@ -1536,7 +1558,7 @@ public class WaterServiceImpl implements IWaterService {
if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) {
return null;
}
Dept title = this.getTitleDetp(R.getData(),deptId);
Dept title = this.getTitleDetp(deptId);
if(ObjectUtil.isEmpty(title)){
return null;
}

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java

@ -3,16 +3,13 @@ package com.hnac.hzims.operational.maintenance.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.vo.RegularWorkVO;
import com.hnac.hzims.operational.report.vo.MaintenanceReportVO;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.operational.maintenance.vo.RegularWorkVO;
import com.hnac.hzims.operational.report.vo.MaintenanceReportVO;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskWithAreaVo;
import com.hnac.hzims.vo.SafeCheckStatisticVO;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskListQuery;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskVo;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
@ -20,7 +17,6 @@ import org.springblade.flow.core.vo.ComleteTask;
import org.springframework.web.bind.annotation.RequestParam;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/ImsDeptServiceImpl.java

@ -319,7 +319,7 @@ public class ImsDeptServiceImpl extends ServiceImpl<ImsDeptMapper, ImsDeptEntity
if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){
return null;
}
Dept dept = waterService.getTitleDetp(R.getData(),deptId);
Dept dept = waterService.getTitleDetp(deptId);
if(ObjectUtil.isEmpty(dept)){
return null;
}

Loading…
Cancel
Save