Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 2 years ago
parent
commit
a60b9f92e4
  1. 42
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/HistoryAlarmVo.java
  2. 51
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java
  3. 17
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java
  4. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java
  5. 18
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java
  6. 17
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
  7. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
  8. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  9. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java
  10. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java

42
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/HistoryAlarmVo.java

@ -0,0 +1,42 @@
package com.hnac.hzims.operational.alert.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.mp.base.BaseEntity;
import java.util.Date;
import java.util.List;
@Data
public class HistoryAlarmVo extends BaseEntity {
@ApiModelProperty("ID")
private Long id;
@ApiModelProperty("站点编码")
private String stationId;
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("告警编码")
private Long alarmId;
@ApiModelProperty("检查点")
private String realId;
@ApiModelProperty("告警开始时间")
private Date startTime;
@ApiModelProperty("告警结束时间")
private Date endTime;
@ApiModelProperty("告警类型")
private List<String> type;
@ApiModelProperty("状态")
private Integer status;
@ApiModelProperty("告警原因")
private String soeExplain;
}

51
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.api.client.util.Sleeper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.equipment.EquipmentContants; import com.hnac.hzims.equipment.EquipmentContants;
import com.hnac.hzims.equipment.entity.*; import com.hnac.hzims.equipment.entity.*;
@ -21,6 +22,7 @@ import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO; import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
@ -38,6 +40,7 @@ import org.springframework.util.Assert;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* 服务实现类 * 服务实现类
@ -45,6 +48,7 @@ import java.util.stream.Collectors;
* @author Chill * @author Chill
*/ */
@Service @Service
@Slf4j
public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntity> implements IEmInfoService { public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntity> implements IEmInfoService {
@Autowired @Autowired
private IEmParamService paramService; private IEmParamService paramService;
@ -77,6 +81,11 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
@Value("${hzims.equipment.emInfo.code-prefix}") @Value("${hzims.equipment.emInfo.code-prefix}")
public String emInfoCodePrefix; public String emInfoCodePrefix;
/**
* 10站点为一组数据
*/
private static final Integer MAX_SEND = 3;
@Override @Override
public R<EmInfoEntity> getEmInfoByCode(String emCode) { public R<EmInfoEntity> getEmInfoByCode(String emCode) {
EmInfoNoScopeMapper mapper = SpringUtil.getBean("emInfoNoScopeMapper"); EmInfoNoScopeMapper mapper = SpringUtil.getBean("emInfoNoScopeMapper");
@ -417,29 +426,38 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
@Override @Override
public void loadEmInfo() { public void loadEmInfo() {
// 查询所有首页展示/状态非删除设备 // 查询所有首页展示/状态非删除设备
List<EminfoAndEmParamVo> list = this.baseMapper.selectEminfoAndEmParamVoList(); List<EminfoAndEmParamVo> devices = this.baseMapper.selectEminfoAndEmParamVoList();
// 查询所有设备(ct、pt、installedCapacity)配置参数 // 查询所有设备(ct、pt、installedCapacity)配置参数
List<EmParamEntity> paramList = this.paramService.getParamByParamNameGenerate(); List<EmParamEntity> paramList = this.paramService.getParamByParamNameGenerate();
// 获取设备监测点
// 获取设备监测点位:未配置监测点位不进行统计设备 // 获取设备监测点位:未配置监测点位不进行统计设备
List<MultiAnalyzeCodePO> multiAnalyzeCodePOList = list.stream().map(o->{ List<MultiAnalyzeCodePO> multiAnalyzeCodePOList = devices.stream().map(o->{
MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO(); MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO();
multiAnalyzeCodePO.setDeviceCode(o.getEmCode()); multiAnalyzeCodePO.setDeviceCode(o.getEmCode());
multiAnalyzeCodePO.setSignages(HomePageConstant.SIGNAGES); multiAnalyzeCodePO.setSignages(HomePageConstant.SIGNAGES);
return multiAnalyzeCodePO; return multiAnalyzeCodePO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
R<List<AnalyzeCodeBySignagesVO>> result = searchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList); // 切割
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ int limit = countStep(multiAnalyzeCodePOList.size());
return; List<List<MultiAnalyzeCodePO>> lists = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> multiAnalyzeCodePOList.stream().skip((long) a * MAX_SEND).limit(MAX_SEND).parallel().collect(Collectors.toList())).collect(Collectors.toList());
} // 接收数据
List<AnalyzeCodeBySignagesVO> analys = new ArrayList<>();
lists.forEach(list->{
R<List<AnalyzeCodeBySignagesVO>> result = searchClient.getAnalyzeCodeBySignages(list);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return;
}
analys.addAll(result.getData());
});
// 设备遍历 // 设备遍历
list.forEach(item->{ devices.forEach(item->{
item.setRideCount(1); item.setRideCount(1);
item.setInstalledCapacity(0.0); item.setInstalledCapacity(0.0);
List<AnalyzeCodeBySignagesVO> signages = analys.stream().filter(o-> item.getEmCode().equals(o.getDeviceCode()) && !StringUtil.isEmpty(o.getSignage()) && !StringUtil.isEmpty(o.getRealId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(signages)){
return;
}
// list -> map // list -> map
item.setPoint(result.getData().stream().filter(o-> item.getEmCode().equals(o.getDeviceCode()) && StringUtil.isNotBlank(o.getSignage()) && StringUtil.isNotBlank(o.getRealId())). item.setPoint(signages.stream().collect(Collectors.toMap(AnalyzeCodeBySignagesVO::getSignage,AnalyzeCodeBySignagesVO::getRealId)));
collect(Collectors.toMap(AnalyzeCodeBySignagesVO::getSignage,AnalyzeCodeBySignagesVO::getRealId)));
// 寻找设备配置参数 // 寻找设备配置参数
List<EmParamEntity> itemParamList = paramList.stream().filter(o->item.getId().equals(o.getInfoId())).collect(Collectors.toList()); List<EmParamEntity> itemParamList = paramList.stream().filter(o->item.getId().equals(o.getInfoId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(itemParamList)){ if(CollectionUtil.isNotEmpty(itemParamList)){
@ -456,6 +474,8 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
case "installedCapacity": case "installedCapacity":
item.setInstalledCapacity(Double.valueOf(param.getParamValue())); item.setInstalledCapacity(Double.valueOf(param.getParamValue()));
break; break;
default:
break;
} }
} }
// 设置ct * pt // 设置ct * pt
@ -465,7 +485,14 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
} }
}); });
// 设置缓存 // 设置缓存
redisTemplate.opsForValue().set(em_info_list_path, JSONObject.toJSONString(list.stream().filter(o-> Math.abs(o.getInstalledCapacity()) > 0 || MapUtils.isNotEmpty(o.getPoint())).collect(Collectors.toList()))); redisTemplate.opsForValue().set(em_info_list_path, JSONObject.toJSONString(devices.stream().filter(o-> Math.abs(o.getInstalledCapacity()) > 0 || MapUtils.isNotEmpty(o.getPoint())).collect(Collectors.toList())));
}
/**
* 计算切分次数
*/
private static Integer countStep(Integer size) {
return (size + MAX_SEND - 1) / MAX_SEND;
} }
private void validEmInfo(EmInfoAddVo em_info) { private void validEmInfo(EmInfoAddVo em_info) {

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

@ -7,9 +7,10 @@ import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.service.HistoryAbnormalAlarmService; import com.hnac.hzims.operational.alert.service.HistoryAbnormalAlarmService;
import com.hnac.hzims.operational.alert.vo.AlarmParamVo; import com.hnac.hzims.operational.alert.vo.AlarmParamVo;
import com.hnac.hzims.operational.alert.vo.AlarmReustVo; import com.hnac.hzims.operational.alert.vo.AlarmReustVo;
import com.hnac.hzims.operational.alert.vo.SoeParamVo; import com.hnac.hzims.operational.alert.vo.HistoryAlarmVo;
import com.hnac.hzims.operational.alert.vo.SoeReustVo; import com.hnac.hzims.operational.config.vo.AlarmDataPageVo;
import com.hnac.hzims.operational.config.vo.*; import com.hnac.hzims.operational.config.vo.AlarmVo;
import com.hnac.hzims.operational.config.vo.IntelligentAlarmCountVo;
import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo; import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -40,10 +41,10 @@ public class AbnormalAlarmController extends BladeController {
* 统计通讯中断时间 * 统计通讯中断时间
*/ */
@ApiLog @ApiLog
@GetMapping("/statisticsTime") @RequestMapping(value = "/statisticsTime", method = {RequestMethod.GET, RequestMethod.POST})
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "统计通讯中断时间", notes = "传入imsDutyMainEntity") @ApiOperation(value = "统计通讯中断时间", notes = "传入imsDutyMainEntity")
public R<IPage<HistoryAbnormalAlarmVo>> statisticsTime(HistoryAbnormalAlarmEntity entity, Query query) { public R<IPage<HistoryAbnormalAlarmVo>> statisticsTime(HistoryAlarmVo entity, Query query) {
IPage<HistoryAbnormalAlarmVo> pages = service.getAlarmTime(query,entity); IPage<HistoryAbnormalAlarmVo> pages = service.getAlarmTime(query,entity);
return R.data(pages); return R.data(pages);
} }
@ -52,10 +53,10 @@ public class AbnormalAlarmController extends BladeController {
* 统计通讯中断二级目录查询 * 统计通讯中断二级目录查询
*/ */
@ApiLog @ApiLog
@GetMapping("/queryByEntity") @RequestMapping(value = "/queryByEntity", method = {RequestMethod.GET, RequestMethod.POST})
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "统计通讯中断二级目录查询", notes = "传入imsDutyMainEntity") @ApiOperation(value = "统计通讯中断二级目录查询", notes = "传入imsDutyMainEntity")
public R<IPage<HistoryAbnormalAlarmVo>> queryByEntity(HistoryAbnormalAlarmEntity entity, Query query) { public R<IPage<HistoryAbnormalAlarmVo>> queryByEntity(HistoryAlarmVo entity, Query query) {
IPage<HistoryAbnormalAlarmVo> pages = service.queryByEntity(entity,query); IPage<HistoryAbnormalAlarmVo> pages = service.queryByEntity(entity,query);
return R.data(pages); return R.data(pages);
} }
@ -72,7 +73,7 @@ public class AbnormalAlarmController extends BladeController {
* 详情 * 详情
*/ */
@ApiLog @ApiLog
@GetMapping("/detail") @RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST})
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
@ApiOperation(value = "详情", notes = "传入HistoryAbnormalAlarmEntity") @ApiOperation(value = "详情", notes = "传入HistoryAbnormalAlarmEntity")
public R<HistoryAbnormalAlarmEntity> detail(HistoryAbnormalAlarmEntity entity) { public R<HistoryAbnormalAlarmEntity> detail(HistoryAbnormalAlarmEntity entity) {

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

@ -4,9 +4,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity; import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.vo.AlarmParamVo; import com.hnac.hzims.operational.alert.vo.AlarmParamVo;
import com.hnac.hzims.operational.alert.vo.AlarmReustVo; import com.hnac.hzims.operational.alert.vo.AlarmReustVo;
import com.hnac.hzims.operational.alert.vo.SoeParamVo; import com.hnac.hzims.operational.alert.vo.HistoryAlarmVo;
import com.hnac.hzims.operational.alert.vo.SoeReustVo; import com.hnac.hzims.operational.config.vo.AlarmDataPageVo;
import com.hnac.hzims.operational.config.vo.*; import com.hnac.hzims.operational.config.vo.AlarmVo;
import com.hnac.hzims.operational.config.vo.IntelligentAlarmCountVo;
import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo; import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
@ -23,9 +24,9 @@ public interface HistoryAbnormalAlarmService extends BaseService<HistoryAbnormal
IPage<HistoryAbnormalAlarmVo> list(IPage<HistoryAbnormalAlarmVo> page, String type); IPage<HistoryAbnormalAlarmVo> list(IPage<HistoryAbnormalAlarmVo> page, String type);
IPage<HistoryAbnormalAlarmVo> getAlarmTime(Query query, HistoryAbnormalAlarmEntity entity); IPage<HistoryAbnormalAlarmVo> getAlarmTime(Query query, HistoryAlarmVo entity);
IPage<HistoryAbnormalAlarmVo> queryByEntity(HistoryAbnormalAlarmEntity entity,Query query); IPage<HistoryAbnormalAlarmVo> queryByEntity(HistoryAlarmVo entity,Query query);
AlarmReustVo alarms(AlarmParamVo param); AlarmReustVo alarms(AlarmParamVo param);

18
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java

@ -71,14 +71,13 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl<AbnormalAlarmMappe
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return; return;
} }
DateTimeFormatter df = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME);
SoeQueryConditionByStation query = new SoeQueryConditionByStation(); SoeQueryConditionByStation query = new SoeQueryConditionByStation();
query.setTypes(AbnormalAlarmConstant.TYPE_LIST); query.setTypes(AbnormalAlarmConstant.SEND_MESSSAGE_TYPE_LIST);
query.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); query.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
query.setEndTime(LocalDateTime.parse(/*DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME)*/"2023-02-27 00:00:00", df)); query.setEndTime(LocalDateTime.parse(DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER));
calendar.add(Calendar.MINUTE,-2); calendar.add(Calendar.MINUTE,-2);
query.setBeginTime(LocalDateTime.parse(/*DateUtil.format(calendar.getTime() , DateUtil.PATTERN_DATETIME)*/"2023-02-01 00:00:00", df)); query.setBeginTime(LocalDateTime.parse(DateUtil.format(calendar.getTime() , DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER));
query.setNeedPage(false); query.setNeedPage(false);
log.error("alarm_data_handle_param : {}",query); log.error("alarm_data_handle_param : {}",query);
Result<HzPage<SoeData>> result = soeClient.getByStationsAndTime(query); Result<HzPage<SoeData>> result = soeClient.getByStationsAndTime(query);
@ -88,8 +87,8 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl<AbnormalAlarmMappe
} }
log.error("alarm_data_handle_begin_result : {}",result.getData().getRecords()); log.error("alarm_data_handle_begin_result : {}",result.getData().getRecords());
// 遍历告警信息 // 遍历告警信息
List<SoeData> list = result.getData().getRecords().stream().sorted(Comparator.comparing(SoeData::getTs).reversed()) List<SoeData> list = new ArrayList<>(result.getData().getRecords().stream().sorted(Comparator.comparing(SoeData::getTs).reversed())
.collect(Collectors.toMap(o->o.getStation()+o.getSoeType(),Function.identity(),(o1, o2) -> o1)).entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList()); .collect(Collectors.toMap(o -> o.getStation() + o.getSoeType(), Function.identity(), (o1, o2) -> o1)).values());
log.error("alarm_data_handle_end_result : {}",list); log.error("alarm_data_handle_end_result : {}",list);
list.forEach(item -> { list.forEach(item -> {
AbnormalAlarmEntity queryEntity = this.baseMapper.getAbnormalAlarm(item.getStation(),item.getSoeType()); AbnormalAlarmEntity queryEntity = this.baseMapper.getAbnormalAlarm(item.getStation(),item.getSoeType());
@ -160,6 +159,7 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl<AbnormalAlarmMappe
String stationName = Optional.ofNullable(stations.stream().filter(o-> o.getCode().equals(item.getStation())).collect(Collectors.toList())).map(o->o.get(0).getName()).orElse(null); String stationName = Optional.ofNullable(stations.stream().filter(o-> o.getCode().equals(item.getStation())).collect(Collectors.toList())).map(o->o.get(0).getName()).orElse(null);
if(ObjectUtil.isEmpty(queryEntity) || !flag){ if(ObjectUtil.isEmpty(queryEntity) || !flag){
HistoryAbnormalAlarmEntity entity = new HistoryAbnormalAlarmEntity(); HistoryAbnormalAlarmEntity entity = new HistoryAbnormalAlarmEntity();
entity.setAlarmId(item.getId());
entity.setStationId(item.getStation()); entity.setStationId(item.getStation());
entity.setStationName(stationName); entity.setStationName(stationName);
entity.setRealId(item.getRealId()); entity.setRealId(item.getRealId());
@ -172,13 +172,9 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl<AbnormalAlarmMappe
this.sendAlarmMessage(Collections.singletonList(entity),stations); this.sendAlarmMessage(Collections.singletonList(entity),stations);
return; return;
} }
Random random = new Random();
Calendar calendar = Calendar.getInstance();
calendar.setTime(item.getTs());
calendar.add(Calendar.MINUTE,random.nextInt(1000) + 50);
queryEntity.setSoeExplain(item.getSoeExplain()); queryEntity.setSoeExplain(item.getSoeExplain());
queryEntity.setUpdateTime(new Date()); queryEntity.setUpdateTime(new Date());
queryEntity.setEndTime(calendar.getTime()); queryEntity.setEndTime(ts);
queryEntity.setStatus(1); queryEntity.setStatus(1);
this.historyAbnormalAlarmService.updateById(queryEntity); this.historyAbnormalAlarmService.updateById(queryEntity);
}); });

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

@ -102,7 +102,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
* @return * @return
*/ */
@Override @Override
public IPage<HistoryAbnormalAlarmVo> getAlarmTime(Query query, HistoryAbnormalAlarmEntity entity) { public IPage<HistoryAbnormalAlarmVo> getAlarmTime(Query query, HistoryAlarmVo entity) {
QueryWrapper<HistoryAbnormalAlarmEntity> alarmEntityQueryWrapper = getAlarmEntityQueryWrapper(entity); QueryWrapper<HistoryAbnormalAlarmEntity> alarmEntityQueryWrapper = getAlarmEntityQueryWrapper(entity);
List<HistoryAbnormalAlarmEntity> historyAbnormalAlarmEntity = this.baseMapper.selectList(alarmEntityQueryWrapper); List<HistoryAbnormalAlarmEntity> historyAbnormalAlarmEntity = this.baseMapper.selectList(alarmEntityQueryWrapper);
if (historyAbnormalAlarmEntity == null) { if (historyAbnormalAlarmEntity == null) {
@ -131,8 +131,11 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
String key = entry.getKey(); String key = entry.getKey();
historyAbnormalAlarmVo.setStationName(key); historyAbnormalAlarmVo.setStationName(key);
historyAbnormalAlarmVo.setTimes(timesList.get(key)); historyAbnormalAlarmVo.setTimes(timesList.get(key));
if (StringUtils.isNotEmpty(entity.getType())) { if (CollectionUtil.isNotEmpty(entity.getType())) {
historyAbnormalAlarmVo.setType(entity.getType()); //只有告警类型唯一,前端才根据这个字段进行渲染
if (entity.getType().size()==1) {
historyAbnormalAlarmVo.setType(entity.getType().get(0));
}
} }
res.add(historyAbnormalAlarmVo); res.add(historyAbnormalAlarmVo);
} }
@ -155,14 +158,14 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
} }
private QueryWrapper<HistoryAbnormalAlarmEntity> getAlarmEntityQueryWrapper(HistoryAbnormalAlarmEntity entity) { private QueryWrapper<HistoryAbnormalAlarmEntity> getAlarmEntityQueryWrapper(HistoryAlarmVo entity) {
QueryWrapper<HistoryAbnormalAlarmEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<HistoryAbnormalAlarmEntity> queryWrapper = new QueryWrapper<>();
if (entity.getStationName() != null) { if (entity.getStationName() != null) {
String[] list = entity.getStationName().split(","); String[] list = entity.getStationName().split(",");
queryWrapper.lambda().in(HistoryAbnormalAlarmEntity::getStationName, Arrays.stream(list).collect(Collectors.toList())); queryWrapper.lambda().in(HistoryAbnormalAlarmEntity::getStationName, Arrays.stream(list).collect(Collectors.toList()));
} }
if (entity.getType() != null) { if (entity.getType() != null) {
queryWrapper.lambda().eq(HistoryAbnormalAlarmEntity::getType, entity.getType()); queryWrapper.lambda().in(HistoryAbnormalAlarmEntity::getType, entity.getType());
} }
if (entity.getStartTime() != null) { if (entity.getStartTime() != null) {
queryWrapper.lambda().ge(HistoryAbnormalAlarmEntity::getStartTime, entity.getStartTime()); queryWrapper.lambda().ge(HistoryAbnormalAlarmEntity::getStartTime, entity.getStartTime());
@ -174,7 +177,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
} }
@Override @Override
public IPage<HistoryAbnormalAlarmVo> queryByEntity(HistoryAbnormalAlarmEntity entity, Query query) { public IPage<HistoryAbnormalAlarmVo> queryByEntity(HistoryAlarmVo entity, Query query) {
QueryWrapper<HistoryAbnormalAlarmEntity> alarmEntityQueryWrapper = getAlarmEntityQueryWrapper(entity); QueryWrapper<HistoryAbnormalAlarmEntity> alarmEntityQueryWrapper = getAlarmEntityQueryWrapper(entity);
IPage<HistoryAbnormalAlarmEntity> historyAbnormalAlarmEntityIPage = this.baseMapper.selectPage(Condition.getPage(query), alarmEntityQueryWrapper); IPage<HistoryAbnormalAlarmEntity> historyAbnormalAlarmEntityIPage = this.baseMapper.selectPage(Condition.getPage(query), alarmEntityQueryWrapper);
List<HistoryAbnormalAlarmEntity> records = historyAbnormalAlarmEntityIPage.getRecords(); List<HistoryAbnormalAlarmEntity> records = historyAbnormalAlarmEntityIPage.getRecords();
@ -208,6 +211,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
public AlarmReustVo alarms(AlarmParamVo param) { public AlarmReustVo alarms(AlarmParamVo param) {
// 查询站点 // 查询站点
LambdaQueryWrapper<StationEntity> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<StationEntity> wrapper = Wrappers.lambdaQuery();
wrapper.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE);
if(StringUtils.isNotEmpty(param.getCode())){ if(StringUtils.isNotEmpty(param.getCode())){
wrapper.eq(StationEntity::getCode,param.getCode()); wrapper.eq(StationEntity::getCode,param.getCode());
} }
@ -215,7 +219,6 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return new AlarmReustVo(); return new AlarmReustVo();
} }
// 查询告警数据 // 查询告警数据
SoeQueryConditionByStation condition = new SoeQueryConditionByStation(); SoeQueryConditionByStation condition = new SoeQueryConditionByStation();
condition.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00", DateUtil.DATETIME_FORMATTER)); condition.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00", DateUtil.DATETIME_FORMATTER));

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java

@ -1669,6 +1669,9 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
@Override @Override
public DutyMainInfoVo getNextDutyDataV2(Long parentId) { public DutyMainInfoVo getNextDutyDataV2(Long parentId) {
DutyMainInfoVo dutyMainInfoVo = this.baseMapper.selectDutyMainInfoSignV2(parentId); DutyMainInfoVo dutyMainInfoVo = this.baseMapper.selectDutyMainInfoSignV2(parentId);
if(ObjectUtil.isEmpty(dutyMainInfoVo)){
return new DutyMainInfoVo();
}
if (null == dutyMainInfoVo.getDutyGroupId()) { if (null == dutyMainInfoVo.getDutyGroupId()) {
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, dutyMainInfoVo.getId()); eq(ImsDutyMainPersonEntity::getDutyMainId, dutyMainInfoVo.getId());

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

@ -285,7 +285,7 @@ public class HydropowerServiceImpl implements HydropowerService {
private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) { private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) {
String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00";
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD); List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) { if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>(); return new ArrayList<>();
} }
@ -526,7 +526,7 @@ public class HydropowerServiceImpl implements HydropowerService {
GenerationPowerVo generate = new GenerationPowerVo(); GenerationPowerVo generate = new GenerationPowerVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
generate.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE)); generate.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE));
generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); generate.setGenerate(Float.parseFloat(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount());
return generate; return generate;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }

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

@ -487,7 +487,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
return "0"; return "0";
} }
String value = map.get(realId); String value = map.get(realId);
if (StringUtil.isEmpty(realId)) { if (StringUtil.isEmpty(value)) {
return "0"; return "0";
} }
// 获取value // 获取value

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

@ -521,7 +521,7 @@ public class WaterServiceImpl implements IWaterService {
return "0"; return "0";
} }
String value = map.get(realId); String value = map.get(realId);
if(StringUtil.isBlank(realId)){ if(StringUtil.isBlank(value)){
return "0"; return "0";
} }
// 获取value // 获取value

Loading…
Cancel
Save