Browse Source

#新版监控系统水位统计修改

zhongwei
yang_shj 3 months ago
parent
commit
4b2cf6eee1
  1. 7
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/ws/alart/vo/AlartParamVo.java
  2. 2
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java
  3. 3
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java
  4. 19
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricLoadVo.java
  5. 25
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricLoadWaterVo.java
  6. 11
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricStationVo.java
  7. 19
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricWaterVo.java
  8. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java
  9. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WaterLevelVo.java
  10. 5
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java
  11. 6
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java
  12. 3
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java
  13. 83
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java
  14. 12
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmHandler.java
  15. 1
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmSessionManager.java
  16. 4
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmSocketConfig.java
  17. 14
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/GenerationScheduledTask.java
  18. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java
  19. 28
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java
  20. 77
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  21. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java
  22. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/controller/HydroelectricController.java
  23. 105
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java
  24. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  25. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java

7
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/business/ws/alart/vo/AlartParamVo.java

@ -13,9 +13,6 @@ import java.util.List;
@ApiModel(value = "告警websocket参数", description = "")
public class AlartParamVo {
@ApiModelProperty("站点类型: 2-云服务 1-代运维")
private Integer serveType;
@ApiModelProperty("用户权限机构集合")
private List<Long> depts;
@ApiModelProperty("站点集合")
private List<String> codes;
}

2
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java

@ -174,7 +174,7 @@ public interface IEmInfoClient {
List<EmInfoEntity> deviceByPath(@RequestParam("emCode") String emCode);
@GetMapping (EM_INFO_LIST)
R<List<EmInfoEntity>> emInfoList(@RequestParam("req")EmInfoEntity req);
R<List<EmInfoEntity>> emInfoList(@RequestParam("deptId") Long deptId);
@GetMapping(RIDE_DEVICES)
List<RideDeviceVo> rideDevices(@RequestParam("deptIds") List<Long> deptIds);

3
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java

@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.system.vo.CreateTableVO;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.ArrayList;
import java.util.List;
@ -112,7 +113,7 @@ public class IEmInfoClientBack implements IEmInfoClient {
}
@Override
public R<List<EmInfoEntity>> emInfoList(EmInfoEntity req) {
public R<List<EmInfoEntity>> emInfoList(Long deptId) {
return R.fail("远程调用失败");
}

19
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricLoadVo.java

@ -0,0 +1,19 @@
package com.hnac.hzims.operational.homePage.hydroelectric.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
@ApiModel(value = "站点首页-最近24小时总有功")
public class HydroelectricLoadVo {
@ApiModelProperty(value = "字符串时间")
private String time;
@ApiModelProperty(value = "有功功率")
private String load;
}

25
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricLoadWaterVo.java

@ -0,0 +1,25 @@
package com.hnac.hzims.operational.homePage.hydroelectric.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
@ApiModel(value = "站点首页-最近24小时总有功/水位")
public class HydroelectricLoadWaterVo {
@ApiModelProperty(value = "日期")
private String time;
@ApiModelProperty(value = "小时")
private Integer hour;
@ApiModelProperty(value = "功率")
private Double load;
@ApiModelProperty(value = "水位")
private Double water;
}

11
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricStationVo.java

@ -6,7 +6,6 @@ import com.hnac.hzims.hzimsweather.response.weather.Daily;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Tolerate;
import java.util.List;
@ -68,14 +67,20 @@ public class HydroelectricStationVo {
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerYesterDay;
@ApiModelProperty(value = "站点水位")
private Double water;
@ApiModelProperty(value = "七日内天气")
private List<Daily> weather;
@ApiModelProperty(value = "设备集合")
private List<HydroelectricDeviceVo> devices;
@ApiModelProperty(value = "降雨曲线")
private List<HydroelectricPowerRainVo> powerRains;
/*@ApiModelProperty(value = "降雨曲线")
private List<HydroelectricPowerRainVo> powerRains;*/
@ApiModelProperty(value = "总有功/水位曲线")
private List<HydroelectricLoadWaterVo> loadWaters;
@ApiModelProperty(value = "发电量曲线")
private List<HydroelectricGenerateMonVo> generateMons;

19
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricWaterVo.java

@ -0,0 +1,19 @@
package com.hnac.hzims.operational.homePage.hydroelectric.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
@ApiModel(value = "站点首页-最近24小时水位")
public class HydroelectricWaterVo {
@ApiModelProperty(value = "字符串时间")
private String time;
@ApiModelProperty(value = "水位")
private String water;
}

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java

@ -186,7 +186,8 @@ public interface HomePageConstant {
// 单位设置
String CONCAT_P = "-P"; // 有功功率单位拼接值
String CONCAT_Q = "-Q"; // 有功功率单位拼接值
String CONCAT_Q = "-Q";
// 有功功率单位拼接值
String CONCAT_UAB = "-UAB"; // 有功功率单位拼接值
String CONCAT_IA = "-IA"; // 有功功率单位拼接值

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

@ -23,8 +23,8 @@ public class WaterLevelVo {
private Double dischargeFlow;
@ApiModelProperty(value = "前水位曲线数据")
private Map<Integer,String> frontCurveMap;
private Map<String,String> frontCurveMap;
@ApiModelProperty(value = "后水位曲线数据")
private Map<Integer,String> rearCurveMap;
private Map<String,String> rearCurveMap;
}

5
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java

@ -151,8 +151,9 @@ public class EmInfoClient implements IEmInfoClient {
@Override
@GetMapping(EM_INFO_LIST)
public R<List<EmInfoEntity>> emInfoList(@RequestParam("req") EmInfoEntity req) {
LambdaQueryWrapper<EmInfoEntity> queryWrapper = Condition.getQueryWrapper(EmInfoEntity.class, req);
public R<List<EmInfoEntity>> emInfoList(@RequestParam("deptId") Long deptId) {
LambdaQueryWrapper<EmInfoEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(EmInfoEntity::getCreateDept,deptId);
return R.data(service.list(queryWrapper));
}

6
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java

@ -182,6 +182,12 @@ public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
*/
@Override
public List<HistoryDataVo> historyCurve(HistoryDataParamVo param) {
if(StringUtil.isEmpty(param.getFirstAttrId()) && StringUtil.isEmpty(param.getSecondAttrId())
&& StringUtil.isEmpty(param.getThirdlyAttrId()) && StringUtil.isEmpty(param.getFourthAttrId())
&& StringUtil.isEmpty(param.getFifthAttrName())){
return new ArrayList<>();
}
// 计算查询数据维度 : 0-10秒 、 1-1分钟 、2-5分钟 .....
Integer intervalType = this.computeInterval(param.getStartTime(),param.getEndTime());
// 查询数据

3
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java

@ -8,7 +8,6 @@ import com.hnac.hzims.alarm.config.vo.AlarmHistoryVo;
import com.hnac.hzims.alarm.show.vo.AlarmHistoryParamVo;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo;
import com.hnac.hzims.alarm.show.vo.ShowQueryVo;
import com.hnac.hzims.business.ws.alart.vo.AlartParamVo;
import org.springframework.web.socket.TextMessage;
import java.util.List;
@ -24,7 +23,7 @@ public interface AlarmService extends IService<AlarmEntity> {
List<AlarmEntity> broadcast(String startTime, String endTime,Integer serveType);
TextMessage majorAlarm(AlartParamVo param);
TextMessage majorAlarm(List<String> stations);
List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId,Integer alarmType);

83
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java

@ -18,7 +18,6 @@ import com.hnac.hzims.alarm.show.vo.AlarmHistoryParamVo;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo;
import com.hnac.hzims.alarm.show.vo.ShowQueryVo;
import com.hnac.hzims.alarm.source.service.MessageService;
import com.hnac.hzims.business.ws.alart.vo.AlartParamVo;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.EmVideoBandingEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
@ -36,14 +35,12 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
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.springblade.message.dto.MailMessageDTO;
import org.springblade.message.fegin.IMessageClient;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -111,6 +108,9 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, AlarmEntity> impl
if(!StringUtil.isEmpty(showQuery.getAlarmType())){
wrapper.eq("ALARM_TYPE",showQuery.getAlarmType());
}
if(!StringUtil.isEmpty(showQuery.getContent())){
wrapper.like("alarmContext",showQuery.getContent());
}
// 处理告警过滤 :当天处理告警
List<String> handles = alarmHandleService.handles();
@ -140,6 +140,18 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, AlarmEntity> impl
}
/**
* 获取权限站点
* @return
*/
private List<StationEntity> stationsByCodes(List<String> stations) {
R<List<StationEntity>> result = stationClient.querySatationByCodes(stations);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new ArrayList<>();
}
return result.getData();
}
/**
* 查询告警数量
* @return
*/
@ -191,6 +203,9 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, AlarmEntity> impl
}).collect(Collectors.toList());
}
/**
* 播报告警
* @param startTime
@ -218,26 +233,25 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, AlarmEntity> impl
/**
* 弹框告警
* @param param
* @param codes
* @return
*/
@Override
public TextMessage majorAlarm(AlartParamVo param) {
public TextMessage majorAlarm(List<String> codes) {
// 站点查询
List<StationEntity> stations = this.stations(param.getServeType());
if(CollectionUtil.isEmpty(stations) || CollectionUtil.isEmpty(param.getDepts())){
return new TextMessage(new ArrayList().toString());
}
List<String> effectives = stations.stream().filter(station->param.getDepts().contains(station.getRefDept())).map(StationEntity::getCode).collect(Collectors.toList());
if(CollectionUtil.isEmpty(effectives)){
List<StationEntity> stations = this.stationsByCodes(codes);
if(CollectionUtil.isEmpty(stations)){
return new TextMessage(new ArrayList().toString());
}
// 条件过滤
QueryWrapper<AlarmEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(AlarmEntity::getStationId,effectives);
queryWrapper.lambda().in(AlarmEntity::getAlarmType, Arrays.asList(AlarmConstants.FAULT,AlarmConstants.EARLY));
queryWrapper.lambda().eq(AlarmEntity::getIsShowAlert,0);
queryWrapper.lambda().eq(AlarmEntity::getStatus,0);
queryWrapper.lambda().in(AlarmEntity::getStationId,stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
queryWrapper.lambda().in(AlarmEntity::getAlarmType, AlarmConstants.WHOLE_ALARM_TYPE);
queryWrapper.lambda().eq(AlarmEntity::getIsRightTabulation,0);
queryWrapper.lambda().ge(AlarmEntity::getAlarmTime, DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00");
queryWrapper.lambda().le(AlarmEntity::getAlarmTime,DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME));
queryWrapper.lambda().orderByDesc(AlarmEntity::getAlarmTime);
//queryWrapper.lambda().eq(AlarmEntity::getStatus,0);
// 处理告警过滤 :当天处理告警
List<String> handles = alarmHandleService.handles();
if(!CollectionUtil.isEmpty(handles)){
@ -247,10 +261,9 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, AlarmEntity> impl
if(CollectionUtil.isEmpty(alarms)){
return new TextMessage(new ArrayList().toString());
}
return new TextMessage(JSONObject.toJSONString(alarms.stream().sorted(Comparator.comparing(AlarmEntity::getAlarmTime).reversed()).collect(Collectors.toList())));
return new TextMessage(JSONObject.toJSONString(alarms.stream().skip(0).limit(1000).collect(Collectors.toList())));
}
/**
* 验证设备编号是否绑定视频
* @param emInfo 设备信息
@ -374,35 +387,6 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, AlarmEntity> impl
}
/**
* websocket断联发送邮件
* @return
*/
public void sendMailByNum(Integer num,Integer maxConnent,String name) {
if (num>=maxConnent){
MailMessageDTO mailMessageDTO = new MailMessageDTO();
mailMessageDTO.setDeptId(200000L);
mailMessageDTO.setDeptName("华自科技");
mailMessageDTO.setBusinessClassify("system");
mailMessageDTO.setBusinessKey("Mail");
mailMessageDTO.setSubject("邮件发送");
mailMessageDTO.setContent(name+"websocket链接失败;"+"链接失败次数:"+num);
R<List<User>> res = userClient.userListByRoleAlias("200000", "sendMail");
if (!res.isSuccess()||CollectionUtil.isEmpty(res.getData())){
log.error("消息发送失败:无对应用户");
}
String userIds = res.getData().stream().map(s -> s.getId().toString()).collect(Collectors.joining(","));
mailMessageDTO.setUserIds(userIds);
mailMessageDTO.setIsHtml(false);
R<Boolean> booleanR = messageClient.sendMailMsgByUsers(mailMessageDTO);
if (!booleanR.isSuccess()){
log.error("消息发送失败:"+mailMessageDTO.getUserIds()+"--->"+booleanR.getMsg());
}
}
}
/**
* 获取告警视频信息
* @param stationCode
* @param deviceCode
@ -435,6 +419,7 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, AlarmEntity> impl
throw new ServiceException("未查询到告警视频信息!");
}
/**
*查询站点绑定视频信息
* @param stationCode
@ -530,10 +515,8 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, AlarmEntity> impl
if(!station.isSuccess() || ObjectUtil.isEmpty(station)){
throw new ServiceException("未查询到告警采集点绑定视频信息!");
}
EmInfoEntity param = new EmInfoEntity();
param.setDepartment(station.getData().getRefDept());
// 查询设备
R<List<EmInfoEntity>> devices = emInfoClient.emInfoList(param);
R<List<EmInfoEntity>> devices = emInfoClient.emInfoList(station.getData().getRefDept());
if(!devices.isSuccess() || CollectionUtil.isEmpty(devices.getData())){
throw new ServiceException("未查询到告警采集点绑定视频信息!");
}

12
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmHandler.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.alarm.show.service.AlarmService;
import com.hnac.hzims.business.ws.alart.vo.AlartParamVo;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
@ -31,13 +32,11 @@ public class AlarmHandler extends TextWebSocketHandler {
session.getAttributes().put("userId", uid);
log.info("sessionId: " + session.getId());
log.info("session connection successful!");
AlarmSocketPool.pool.put(session.getId(), this);
}
@Override
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) {
AlarmSessionManager.removeAndClose(session.getId());
AlarmSocketPool.pool.remove(session.getId());
log.info("sessionId: " + session.getId());
log.info("uri: " + session.getUri());
log.info("session closed successful!");
@ -46,7 +45,6 @@ public class AlarmHandler extends TextWebSocketHandler {
@Override
public void handleTransportError(WebSocketSession session, Throwable exception) {
AlarmSessionManager.removeAndClose(session.getId());
AlarmSocketPool.pool.remove(session.getId());
}
@Override
@ -56,11 +54,13 @@ public class AlarmHandler extends TextWebSocketHandler {
if(StringUtil.isBlank(message)){
return;
}
AlartParamVo param = JSONObject.parseObject(message,AlartParamVo.class);
if(ObjectUtil.isEmpty(param)){
AlartParamVo param = JSONObject.parseObject(textMessage.getPayload(), AlartParamVo.class);
if(ObjectUtil.isEmpty(param) || CollectionUtil.isEmpty(param.getCodes())){
return;
}
TextMessage sendMessage = alarmService.majorAlarm(param);
session.getAttributes().put("codes", param.getCodes());
AlarmSessionManager.SESSION_POOL.put(userId,session);
TextMessage sendMessage = alarmService.majorAlarm(param.getCodes());
session.sendMessage(sendMessage);
}
}

1
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmSessionManager.java

@ -55,7 +55,6 @@ public class AlarmSessionManager {
throw new RuntimeException("关闭ws会话失败!", ex);
}
}
SESSION_POOL.remove(uid);
}

4
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmSocketConfig.java

@ -18,11 +18,11 @@ public class AlarmSocketConfig implements WebSocketConfigurer{
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
// 集中监控弹框处理器
registry.addHandler(monitorHandler(), "/alarm/alart/{uid}").setAllowedOrigins("*");
registry.addHandler(alarmHandler(), "/alarm/alart/{uid}").setAllowedOrigins("*");
}
@Bean
public WebSocketHandler monitorHandler() {
public WebSocketHandler alarmHandler() {
return new AlarmHandler();
}

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

@ -63,9 +63,10 @@ public class GenerationScheduledTask {
* @param param
* @return
*/
@XxlJob(THIS_DAY_POWER_GENERATION)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> thisDayPowerGeneration(String param) {
//@XxlJob(THIS_DAY_POWER_GENERATION)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> thisDayPowerGeneration() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
@ -78,9 +79,10 @@ public class GenerationScheduledTask {
* @param param
* @return
*/
@XxlJob(LOAD_THREE_YEAR_POWER_GENERATION)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadThreeYearPowerGeneration(String param) {
//@XxlJob(LOAD_THREE_YEAR_POWER_GENERATION)
@Scheduled(cron = "0 0 1 * * ? ")
public ReturnT<String> loadThreeYearPowerGeneration() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}

21
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java

@ -29,9 +29,10 @@ public class MonitorScheduledTask {
/**
* realId刷新
*/
@XxlJob(REAL_ID_DATA)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadRealId(String param) {
//@XxlJob(REAL_ID_DATA)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadRealId() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
@ -43,9 +44,10 @@ public class MonitorScheduledTask {
* 实时数据刷新
* @return ReturnT<String>
*/
@XxlJob(REAL_TIME_DATA)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadRealData(String param) {
//@XxlJob(REAL_TIME_DATA)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadRealData() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
@ -57,9 +59,10 @@ public class MonitorScheduledTask {
* 集中监控数据处理
* @return ReturnT<String>
*/
@XxlJob(CENTRALIZED_MONITORING)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadMonitoring(String param) {
//@XxlJob(CENTRALIZED_MONITORING)
@Scheduled(cron = "0/4 * * * * ? ")
public ReturnT<String> loadMonitoring() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}

28
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java

@ -33,9 +33,10 @@ public class RealTargetScheduledTask {
* @return
* @throws Exception
*/
@XxlJob(LOAD_EM_INFO)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadEmInfo(String param) {
//@XxlJob(LOAD_EM_INFO)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadEmInfo() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
@ -46,9 +47,10 @@ public class RealTargetScheduledTask {
/**
* 水电站-机组实时加载
*/
@XxlJob(LOAD_HYDROPOWER_UNIT_REAL)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerReal(String param) {
//@XxlJob(LOAD_HYDROPOWER_UNIT_REAL)
@Scheduled(cron = "0/5 * * * * ? ")
public ReturnT<String> loadHydropowerReal() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
@ -59,9 +61,10 @@ public class RealTargetScheduledTask {
/**
* 水电站-机组指标加载
*/
@XxlJob(LOAD_HYDROPOWER_UNIT_TARGET)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerTarget(String param) {
//@XxlJob(LOAD_HYDROPOWER_UNIT_TARGET)
@Scheduled(cron = "0 0/2 * * * ? ")
public ReturnT<String> loadHydropowerTarget() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
@ -110,9 +113,10 @@ public class RealTargetScheduledTask {
/**
* 水利-站点水位数据
*/
@XxlJob(LOAD_WATER_LEVEL)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadWaterLevel(String param) {
//@XxlJob(LOAD_WATER_LEVEL)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadWaterLevel() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}

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

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.entity.EmParamEntity;
import com.hnac.hzims.equipment.entity.StartStopDurationEntity;
import com.hnac.hzims.equipment.entity.ThirtyGenerationEntity;
import com.hnac.hzims.equipment.entity.ThreeGenerationEntity;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
@ -19,10 +20,7 @@ import com.hnac.hzims.operational.main.vo.*;
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.scheduled.service.equipment.DeviceParamService;
import com.hnac.hzims.scheduled.service.equipment.DeviceService;
import com.hnac.hzims.scheduled.service.equipment.ThirtyGenerateService;
import com.hnac.hzims.scheduled.service.equipment.ThreeGenerateService;
import com.hnac.hzims.scheduled.service.equipment.*;
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;
@ -42,7 +40,6 @@ import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient;
import com.xxl.job.core.log.XxlJobLogger;
import io.undertow.util.CopyOnWriteMap;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
@ -58,7 +55,9 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.*;
@ -102,6 +101,8 @@ public class RealTargetServiceImpl implements RealTargetService {
private final ThirtyGenerateService thirtyGenerateService;
private final StartStopDurationService startStopDurationService;
private final RedisTemplate redisTemplate;
private final IHeWeatherWeatherClient heWeatherWeatherClient;
@ -293,6 +294,9 @@ public class RealTargetServiceImpl implements RealTargetService {
List<HydropowerUnitTargetVo> targets = this.generteFill(stations);
// 水电站设备
List<EminfoAndEmParamVo> devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()));
// 今年已经过去多少个小时了
double hoursPassed = this.hoursPassed();
Random random = new Random();
if(CollectionUtil.isNotEmpty(devices)){
CountDownLatch countDownLatch = new CountDownLatch(devices.size());
@ -319,16 +323,29 @@ public class RealTargetServiceImpl implements RealTargetService {
target.setActivePowerVoList(this.getLoadsByDay(device));
// 30天发电量
target.setGenerationPowerVoList(this.getGenerationPowerList(generations,device));
if(station.isPresent()){
// 查询设备当年开停机数据
List<StartStopDurationEntity> durations = startStopDurationService.list(Wrappers.<StartStopDurationEntity>lambdaQuery()
.eq(StartStopDurationEntity::getStationId,station.get().getCode())
.eq(StartStopDurationEntity::getDeviceCode,device.getEmCode())
);
if(CollectionUtil.isEmpty(durations)){
target.setStartupDurationYear(0.0);
target.setShutDownDurationYear(hoursPassed);
}else{
target.setStartupDurationYear(durations.stream().mapToDouble(StartStopDurationEntity::getStartDuration).sum());
target.setShutDownDurationYear(durations.stream().mapToDouble(StartStopDurationEntity::getStopDuration).sum());
}
}else{
target.setStartupDurationYear(0.0);
target.setShutDownDurationYear(hoursPassed);
}
// FIXME 本次开机/停机时间
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MINUTE,random.nextInt(1440));
target.setStartDownTime(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME));
// FIXME 本次开/停机时长
target.setStartupDownDuration(random.nextDouble() * 24);
// FIXME 今年开机时长
target.setStartupDurationYear(random.nextDouble() * 5024);
// FIXME 今年停机时长
target.setShutDownDurationYear(5024 - target.getStartupDurationYear());
targets.add(target);
countDownLatch.countDown();
}catch (Exception exception){
@ -347,7 +364,6 @@ public class RealTargetServiceImpl implements RealTargetService {
if(CollectionUtil.isEmpty(targets)){
return;
}
redisTemplate.opsForValue().set(load_hydropower_unit_target_key,targets);
}
@ -421,6 +437,20 @@ public class RealTargetServiceImpl implements RealTargetService {
}
/**
* 今年过去多少个小时
* @return
*/
private double hoursPassed() {
LocalDateTime now = LocalDateTime.now();
// 获取当前年份的第一个小时
LocalDateTime startOfYear = LocalDateTime.of(now.getYear(), 1, 1, 0, 0);
// 计算持续时间
Duration duration = Duration.between(startOfYear, now);
// 输出过了多少个小时
return Double.parseDouble(String.valueOf(duration.toHours()));
}
/**
* 水利-泵组实时加载
* @param param
*/
@ -667,10 +697,10 @@ public class RealTargetServiceImpl implements RealTargetService {
double dischargeFlow=this.getWaterLevel(item.getInstanceCode(),HomePageConstant.DISCHARGE_FLOW);
waterLevelVo.setDischargeFlow(dischargeFlow);
// 前水位当日曲线
Map<Integer, String> frontCurveMap=this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL);
Map<String, String> frontCurveMap=this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL);
waterLevelVo.setFrontCurveMap(frontCurveMap);
// 后水位当日曲线
Map<Integer, String> rearCurveMap=this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL);
Map<String, String> rearCurveMap=this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL);
waterLevelVo.setRearCurveMap(rearCurveMap);
list.add(waterLevelVo);
}
@ -1262,11 +1292,14 @@ public class RealTargetServiceImpl implements RealTargetService {
* @param signage
* @return
*/
private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) {
// 开始日期
String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00";
// 结束日期
String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 23:59:59";
private Map<String, String> getWaterLevelMap(String instanceCode, String signage) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
// 结束时间
String end = DateUtil.format(calendar.getTime(),"yyyy-MM-dd HH:") + "59:59";
calendar.add(Calendar.HOUR_OF_DAY,-23);
// 开始时间
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
List<AnalyseDataTaosVO> datas = dataService.periodTargetData(start, end,6, 2,instanceCode,signage);
if(CollectionUtil.isEmpty(datas)){
return new HashMap<>();
@ -1275,14 +1308,14 @@ public class RealTargetServiceImpl implements RealTargetService {
key-> {
if(key.getTs().contains(".0")){
Date dateTime = DateUtil.parse(key.getTs(), "yyyy-MM-dd HH:mm:ss.s");
return dateTime.getHours();
return DateUtil.format(dateTime,DateUtil.PATTERN_DATETIME);
}
Date dateTime = DateUtil.parse(key.getTs() + ".0", "yyyy-MM-dd HH:mm:ss.s");
return dateTime.getHours();
return DateUtil.format(dateTime,DateUtil.PATTERN_DATETIME);
},
value -> {
if(StringUtil.isEmpty(value.getVal())){
return "";
return "0.0";
}
return value.getVal();
})
@ -1626,13 +1659,13 @@ public class RealTargetServiceImpl implements RealTargetService {
target.setDeptName(station.getName());
// 当年发电量
target.setPowerYear(generateService.generate(year,station.getCode()));
// FIXME 去年发电量
// 去年发电量
target.setPowerYesterYear(0f);
// 当月发电量
target.setPowerMon(generateService.generate(mon,station.getCode()));
// 当日发电量
target.setPowerDay(generateService.generate(day,station.getCode()));
// FIXME 昨日发电量
// 昨日发电量
target.setPowerYesterDay(0f);
// 30天发电量
target.setGenerationPowerVoList(generateService.generate30Day(day,station.getCode()));

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

@ -1,6 +1,5 @@
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;
@ -10,7 +9,6 @@ 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;
@ -26,15 +24,12 @@ import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.log.exception.ServiceException;
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.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
@ -695,7 +690,9 @@ public class HzimsDataServiceImpl implements HzimsDataService {
WaterLevelVo level = validList.get(0);
// 前池水位、当日水位曲线
response.setFrontWaterLevel(level.getFrontWaterLevel());
response.setFrontCurveMap(level.getFrontCurveMap());
response.setFrontCurveMap(level.getFrontCurveMap().entrySet().stream().collect(Collectors.toMap(
entry-> DateUtil.parse(entry.getKey(),DateUtil.PATTERN_DATETIME).getHours(),
Map.Entry::getValue)));
}
/**

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

@ -47,4 +47,5 @@ public class HydroelectricController extends BladeController {
public R<HydroelectricGroupVo> group() {
return R.data(hydroelectricService.group());
}
}

105
hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java

@ -17,8 +17,10 @@ import com.hnac.hzims.operational.homePage.hydroelectric.constant.HydroelectricC
import com.hnac.hzims.operational.homePage.hydroelectric.vo.*;
import com.hnac.hzims.operational.homePage.service.HydroelectricService;
import com.hnac.hzims.operational.main.service.IWeatherService;
import com.hnac.hzims.operational.main.vo.ActivePowerVo;
import com.hnac.hzims.operational.main.vo.HydropowerUnitRealVo;
import com.hnac.hzims.operational.main.vo.HydropowerUnitTargetVo;
import com.hnac.hzims.operational.main.vo.WaterLevelVo;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import lombok.RequiredArgsConstructor;
@ -62,6 +64,7 @@ public class HydroelectricServiceImpl implements HydroelectricService {
private final RedisTemplate redisTemplate;
private final static String LOADWATER_LEVEL_KEY = "hzims:operation:loadwater:level:key";
private final static String RECENT_YEAR_POWER_DATA = "hzims:operation:key:power:data";
private final static String LOAD_HYDROPOWER_REAL_KEY = "hzims:operation:loadhydropowerunit:real:key";
private final static String LOAD_HYDROPOWER_TARGET_KEY = "hzims:operation:loadhydropowerunit:target:key";
@ -87,13 +90,15 @@ public class HydroelectricServiceImpl implements HydroelectricService {
// 指标数据
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(LOAD_HYDROPOWER_TARGET_KEY);
// 降雨数据
List<Map<String, Object>> rains = this.nearThirtyRains(station.getCode());
//List<Map<String, Object>> rains = this.nearThirtyRains(station.getCode());
// 七日天气
Map<String, HeWeatherWeatherDailyResponse> weathers = this.weekWeather(Collections.singletonList(station.getCode()));
// 近3年发电量
Map<String, Map<String, Float>> map = (Map<String, Map<String, Float>>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA);
// 计划发电量
List<PlanPowerYearVo> plans = planClient.getPlanPowerByYear(station.getCode(), Integer.parseInt(DateUtil.format(new Date(),"yyyy")));
// 水位数据
List<WaterLevelVo> waterLevels = (List<WaterLevelVo>) redisTemplate.opsForValue().get(LOADWATER_LEVEL_KEY);
// 步骤3.数据处理、赋值
HydroelectricStationVo result = new HydroelectricStationVo();
@ -196,8 +201,12 @@ public class HydroelectricServiceImpl implements HydroelectricService {
result.setPowerDay(result.getDevices().stream().mapToDouble(HydroelectricDeviceVo::getPowerDay).sum());
result.setPowerYesterDay(result.getDevices().stream().mapToDouble(HydroelectricDeviceVo::getPowerYesterDay).sum());
}
// 站点水位
result.setWater(this.water(waterLevels,station.getCode()));
// 近30日降雨量/发电量
result.setPowerRains(this.stationPowerRains(result.getDevices(),rains));
//result.setPowerRains(this.stationPowerRains(result.getDevices(),rains));
// 近24小时总有功率/水位
result.setLoadWaters(this.stationLoadWaters(targets,waterLevels,station));
// 电站月发电/计划发电
result.setGenerateMons(this.stationGenerateMons(plans,map.get(station.getCode())));
return result;
@ -732,6 +741,23 @@ public class HydroelectricServiceImpl implements HydroelectricService {
}
/**
* 站点水位
* @param waterLevels
* @param code
* @return
*/
private Double water(List<WaterLevelVo> waterLevels, String code) {
if(CollectionUtil.isEmpty(waterLevels)){
return 0.0;
}
Optional<WaterLevelVo> optional = waterLevels.stream().filter(o->code.equals(o.getStationCode())).findFirst();
if(optional.isPresent() && ObjectUtil.isNotEmpty(optional.get().getFrontWaterLevel())){
return optional.get().getFrontWaterLevel();
}
return 0.0;
}
/**
* 站点近30天降雨量/发电量
* @param devices
* @return
@ -788,6 +814,81 @@ public class HydroelectricServiceImpl implements HydroelectricService {
return powerRains;
}
/**
* 站点近24小时总有功率/水位
* @param targets
* @param waterLevels
* @param station
* @return
*/
private List<HydroelectricLoadWaterVo> stationLoadWaters(List<HydropowerUnitTargetVo> targets, List<WaterLevelVo> waterLevels, StationEntity station) {
// 功率
List<HydroelectricLoadVo> loads = new ArrayList<>();
if(CollectionUtil.isNotEmpty(targets)){
List<HydropowerUnitTargetVo> devices = targets.stream().filter(o->station.getRefDept().equals(o.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(devices)){
for(HydropowerUnitTargetVo device : devices){
if(CollectionUtil.isNotEmpty(device.getActivePowerVoList())){
loads.addAll(device.getActivePowerVoList().stream().map(o->{
HydroelectricLoadVo load = new HydroelectricLoadVo();
load.setTime(o.getStrHour());
load.setLoad(o.getActivePower());
return load;
}).collect(Collectors.toList()));
}
}
}
}
// 水位
List<HydroelectricWaterVo> waters = new ArrayList<>();
if(CollectionUtil.isNotEmpty(waterLevels)){
List<WaterLevelVo> devices = waterLevels.stream().filter(o->station.getCode().equals(o.getStationCode())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(devices)){
for(WaterLevelVo device : devices){
if(CollectionUtil.isNotEmpty(device.getFrontCurveMap())){
waters.addAll(device.getFrontCurveMap().entrySet().stream().map(entry -> {
HydroelectricWaterVo water = new HydroelectricWaterVo();
Date time = DateUtil.parse(entry.getKey(),DateUtil.PATTERN_DATETIME);
water.setTime(entry.getKey());
water.setWater(entry.getValue());
return water;
}).collect(Collectors.toList()));
}
}
}
}
List<HydroelectricLoadWaterVo> loadWaters = new ArrayList<>();
// 时间遍历
Calendar calendar = Calendar.getInstance();
Date end = calendar.getTime();
calendar.add(Calendar.HOUR_OF_DAY,-23);
Date start = calendar.getTime();
while (start.compareTo(end) <= 0){
HydroelectricLoadWaterVo loadWater = new HydroelectricLoadWaterVo();
loadWater.setTime(DateUtil.format(start,"yyyy-MM-dd HH"));
loadWater.setHour(start.getHours());
// 功率
if(CollectionUtil.isEmpty(loads)){
loadWater.setLoad(0.0);
}else{
loadWater.setLoad(loads.stream().filter(load->load.getTime().contains(loadWater.getTime())).mapToDouble(o->Double.parseDouble(o.getLoad())).sum());
}
// 水位
if(CollectionUtil.isEmpty(waters)){
loadWater.setWater(0.0);
}else{
loadWater.setWater(waters.stream().filter(water->water.getTime().contains(loadWater.getTime())).mapToDouble(o->Double.parseDouble(o.getWater())).sum());
}
loadWaters.add(loadWater);
calendar.add(Calendar.HOUR_OF_DAY,1);
start = calendar.getTime();
}
return loadWaters;
}
/**
* 站点电站月发电/计划发电
* @param plans

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

@ -569,7 +569,9 @@ public class HydropowerServiceImpl implements HydropowerService {
WaterLevelVo level = validList.get(0);
// 前池水位、当日水位曲线
response.setFrontWaterLevel(level.getFrontWaterLevel());
response.setFrontCurveMap(level.getFrontCurveMap());
response.setFrontCurveMap(level.getFrontCurveMap().entrySet().stream().collect(Collectors.toMap(
entry-> DateUtil.parse(entry.getKey(),DateUtil.PATTERN_DATETIME).getHours(),
Map.Entry::getValue)));
}
/**

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

@ -654,9 +654,13 @@ public class WaterServiceImpl implements IWaterService {
// 获取全年水位map
Map<Integer,String> map;
if(flag == 0){
map = list.get(0).getFrontCurveMap();
map = list.get(0).getFrontCurveMap().entrySet().stream().collect(Collectors.toMap(
entry-> DateUtil.parse(entry.getKey(),DateUtil.PATTERN_DATETIME).getHours(),
Map.Entry::getValue));
} else {
map = list.get(0).getRearCurveMap();
map = list.get(0).getRearCurveMap().entrySet().stream().collect(Collectors.toMap(
entry-> DateUtil.parse(entry.getKey(),DateUtil.PATTERN_DATETIME).getHours(),
Map.Entry::getValue));
}
if(MapUtils.isEmpty(map)){
return null;

Loading…
Cancel
Save