Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
Jone 2 years ago
parent
commit
6abf7574dc
  1. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/CompleteDefectVo.java
  2. 5
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/CompleteGenerationVo.java
  3. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/CompleteOtherVo.java
  4. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/ElectricGenerationVo.java
  5. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/ExamineCardVo.java
  6. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/HydropowerTargetVo.java
  7. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/InstalledCapacityVo.java
  8. 5
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/WaterTargetVo.java
  9. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/NotInsertUseEntity.java
  10. 21
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java
  11. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/HistoryAbnormalAlarmMapper.java
  12. 19
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/HistoryAbnormalAlarmMapper.xml
  13. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java
  14. 99
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
  15. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java
  16. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/HistoryAbnormalAlarmVo.java

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/CompleteDefectVo.java

@ -1,5 +1,7 @@
package com.hnac.hzims.operational.census.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -21,5 +23,6 @@ public class CompleteDefectVo {
private Integer completeCount;
@ApiModelProperty("消缺率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double completeRate;
}

5
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/CompleteGenerationVo.java

@ -1,5 +1,7 @@
package com.hnac.hzims.operational.census.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -15,11 +17,14 @@ public class CompleteGenerationVo {
private String stationName;
@ApiModelProperty("计划发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double planGeneration;
@ApiModelProperty("实际发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double realityGeneration;
@ApiModelProperty("完成率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double completeRate;
}

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

@ -1,5 +1,7 @@
package com.hnac.hzims.operational.census.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -15,8 +17,10 @@ public class CompleteOtherVo {
private String stationName;
@ApiModelProperty("设备在线率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double onlineRate;
@ApiModelProperty("Fa投入条数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double faCount;
}

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/ElectricGenerationVo.java

@ -1,5 +1,7 @@
package com.hnac.hzims.operational.census.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -15,6 +17,7 @@ public class ElectricGenerationVo {
private String stationName;
@ApiModelProperty("发容量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double electricGeneration;
@ApiModelProperty("详情")

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

@ -1,5 +1,7 @@
package com.hnac.hzims.operational.census.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -17,8 +19,10 @@ public class ExamineCardVo {
private String stationName;
@ApiModelProperty("检修卡数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer cardCount;
@ApiModelProperty("检修卡总额")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double cardTotal;
}

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

@ -1,5 +1,7 @@
package com.hnac.hzims.operational.census.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -15,8 +17,10 @@ public class HydropowerTargetVo {
private String stationName;
@ApiModelProperty("发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double electric;
@ApiModelProperty("功率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double power;
}

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/InstalledCapacityVo.java

@ -1,5 +1,7 @@
package com.hnac.hzims.operational.census.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -15,6 +17,7 @@ public class InstalledCapacityVo {
private String stationName;
@ApiModelProperty("装机容量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double installedCapacity;
@ApiModelProperty("详情")

5
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/WaterTargetVo.java

@ -1,5 +1,8 @@
package com.hnac.hzims.operational.census.vo;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -15,8 +18,10 @@ public class WaterTargetVo {
private String stationName;
@ApiModelProperty("用电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double use;
@ApiModelProperty("功率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double load;
}

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

@ -26,7 +26,7 @@ public class NotInsertUseEntity extends TenantEntity implements Serializable {
private String stationName;
@ApiModelProperty("用电量")
private BigDecimal use;
private BigDecimal usefulness;
@ApiModelProperty("填报日期")
private Date fillDate;

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

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.service.HistoryAbnormalAlarmService;
import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -25,7 +26,27 @@ import javax.validation.Valid;
public class AbnormalAlarmController extends BladeController {
private final HistoryAbnormalAlarmService service;
/**
* 统计通讯中断时间
*/
@GetMapping("/statisticsTime")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "统计通讯中断时间", notes = "传入imsDutyMainEntity")
public R<IPage<HistoryAbnormalAlarmVo>> statisticsTime(HistoryAbnormalAlarmEntity entity, Query query) {
IPage<HistoryAbnormalAlarmVo> pages = service.getAlarmTime(query,entity);
return R.data(pages);
}
/**
* 统计通讯中断二级目录查询
*/
@GetMapping("/queryByEntity")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "统计通讯中断二级目录查询", notes = "传入imsDutyMainEntity")
public R<IPage<HistoryAbnormalAlarmEntity>> queryByEntity(HistoryAbnormalAlarmEntity entity, Query query) {
IPage<HistoryAbnormalAlarmEntity> pages = service.queryByEntity(entity,query);
return R.data(pages);
}
/**
* 详情

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/HistoryAbnormalAlarmMapper.java

@ -19,4 +19,6 @@ public interface HistoryAbnormalAlarmMapper extends UserDataScopeBaseMapper<Hist
HistoryAbnormalAlarmEntity getHistoryAbnormalAlarm(@Param("stationId") String stationId,@Param("type") String type,@Param("startTime") Date ts);
List<HistoryAbnormalAlarmVo> selectPageList(IPage<HistoryAbnormalAlarmVo> page, String type, List<String> stations);
List<HistoryAbnormalAlarmVo> getAlarmEntity(@Param("type") String type,@Param("stationName") String stationName,@Param("startTime") Date startTime,@Param("endTime") Date endTime);
}

19
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/mapper/HistoryAbnormalAlarmMapper.xml

@ -11,7 +11,7 @@
<select id="selectPageList" resultType="com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo">
select * from hzims_history_abnormal_alarm
where is_deleted = 0
where status = 0
<if test="type != null and type != ''">
and type = #{type}
</if>
@ -22,4 +22,21 @@
</foreach>
</if>
</select>
<select id="getAlarmEntity" resultType="com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo">
select * from hzims_history_abnormal_alarm
where is_deleted = 0
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="stationName != null and stationName != ''">
and station_name = #{stationName}
</if>
<if test="startTime != null and startTime != ''">
and start_time = #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and end_time = #{endTime}
</if>
</select>
</mapper>

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

@ -18,4 +18,8 @@ public interface HistoryAbnormalAlarmService extends BaseService<HistoryAbnormal
HistoryAbnormalAlarmEntity getAbnormalAlarm(String station, String soeType, Date ts);
IPage<HistoryAbnormalAlarmVo> list(IPage<HistoryAbnormalAlarmVo> page, String type);
IPage<HistoryAbnormalAlarmVo> getAlarmTime(Query query, HistoryAbnormalAlarmEntity entity);
IPage<HistoryAbnormalAlarmEntity> queryByEntity(HistoryAbnormalAlarmEntity entity,Query query);
}

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

@ -1,5 +1,7 @@
package com.hnac.hzims.operational.alert.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.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.mapper.HistoryAbnormalAlarmMapper;
@ -10,12 +12,18 @@ import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils;
import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
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.utils.CollectionUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -56,4 +64,91 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
page.setRecords(result);
return page;
}
/**
* 统计告警时长
* @param query
* @param entity
* @return
*/
@Override
public IPage<HistoryAbnormalAlarmVo> getAlarmTime(Query query, HistoryAbnormalAlarmEntity entity) {
List<HistoryAbnormalAlarmVo> historyAbnormalAlarmVos= this.baseMapper.getAlarmEntity(entity.getType(),entity.getStationName(),entity.getStartTime(),entity.getEndTime());
if (historyAbnormalAlarmVos==null){
return null;
}
//赋值空的endTime
if(ObjectUtils.isNotEmpty(entity.getEndTime())){
historyAbnormalAlarmVos.stream().filter(s->s.getEndTime()==null).forEach(s->s.setEndTime(entity.getEndTime()));
}else {
historyAbnormalAlarmVos.stream().filter(s -> s.getEndTime() == null).forEach(s -> s.setEndTime(new Date()));
}
List<HistoryAbnormalAlarmVo> voList = historyAbnormalAlarmVos.parallelStream().map(s -> {
s.setTimes((s.getEndTime().getTime() - s.getStartTime().getTime()));
return s;
}).collect(Collectors.toList());
//次数统计
Map<String, Long> timesList = voList.stream().collect(Collectors.groupingBy(HistoryAbnormalAlarmEntity::getStationName,
Collectors.counting()));
//时间统计
Map<String, Long> durationList = voList.stream().collect(Collectors.groupingBy(HistoryAbnormalAlarmEntity::getStationName,
Collectors.summingLong(HistoryAbnormalAlarmVo::getTimes)));
List<HistoryAbnormalAlarmVo> res=new ArrayList<>();
for (Map.Entry<String, Long> entry : durationList.entrySet()) {
//累计时长
double v = BigDecimal.valueOf(entry.getValue() / (1000 * 60 * 60.00)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
HistoryAbnormalAlarmVo historyAbnormalAlarmVo = new HistoryAbnormalAlarmVo();
historyAbnormalAlarmVo.setDuration(v);
String key = entry.getKey();
historyAbnormalAlarmVo.setStationName(key);
historyAbnormalAlarmVo.setTimes(timesList.get(key));
if(StringUtils.isNotEmpty(entity.getType())){
historyAbnormalAlarmVo.setType(entity.getType());
}
res.add(historyAbnormalAlarmVo);
}
//根据电站名字排序
res=res.stream().
sorted(Comparator.comparing(HistoryAbnormalAlarmVo::getStationName))
.collect(Collectors.toList());
IPage<HistoryAbnormalAlarmVo> page = Condition.getPage(query);
page.setTotal(res.size());
if (query==null){
page.setRecords(res);
}else {
if (res.size()>query.getCurrent()* query.getSize()) {
page.setRecords(res.subList((query.getCurrent() - 1) * query.getSize(), query.getCurrent() * query.getSize()));
}else {
page.setRecords(res.subList((query.getCurrent() - 1) * query.getSize(), res.size()));
}
}
return page;
}
private QueryWrapper<HistoryAbnormalAlarmEntity> getAlarmEntityQueryWrapper(HistoryAbnormalAlarmEntity entity) {
QueryWrapper<HistoryAbnormalAlarmEntity> queryWrapper = new QueryWrapper<>();
if (entity.getStationName()!=null) {
queryWrapper.lambda().eq(HistoryAbnormalAlarmEntity::getStationName, entity.getStationName());
}
if (entity.getType()!=null) {
queryWrapper.lambda().eq(HistoryAbnormalAlarmEntity::getType, entity.getType());
}
if (entity.getStartTime()!=null) {
queryWrapper.lambda().le(HistoryAbnormalAlarmEntity::getStartTime, entity.getStartTime());
}
if (entity.getEndTime()!=null) {
queryWrapper.lambda().ge(HistoryAbnormalAlarmEntity::getStartTime, entity.getEndTime());
}
return queryWrapper;
}
@Override
public IPage<HistoryAbnormalAlarmEntity> queryByEntity(HistoryAbnormalAlarmEntity entity,Query query) {
QueryWrapper<HistoryAbnormalAlarmEntity> alarmEntityQueryWrapper = getAlarmEntityQueryWrapper(entity);
IPage<HistoryAbnormalAlarmEntity> historyAbnormalAlarmEntityIPage = this.baseMapper.selectPage(Condition.getPage(query), alarmEntityQueryWrapper);
return historyAbnormalAlarmEntityIPage;
}
}

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

@ -718,7 +718,7 @@ public class TargetServiceImpl implements TargetService {
return hydropowerTarget;
}
Double power = activePowerMap.get(station.getCode());
hydropowerTarget.setPower(power);
hydropowerTarget.setPower(Optional.ofNullable(power).orElse(0.0));
return hydropowerTarget;
}).sorted(Comparator.comparing(HydropowerTargetVo::getPower)).collect(Collectors.toList());
}
@ -786,7 +786,8 @@ public class TargetServiceImpl implements TargetService {
water.setUse(0.0);
return water;
}
water.setUse(pumps.stream().filter(o->o.getDeptId().equals(station.getRefDept())).mapToDouble(WaterPumpRealVo::getActivePower).sum());
Double use = pumps.stream().filter(o->o.getDeptId().equals(station.getRefDept())).mapToDouble(WaterPumpRealVo::getActivePower).sum();
water.setUse(Optional.ofNullable(use).orElse(0.0));
return water;
}).sorted(Comparator.comparing(WaterTargetVo::getLoad)).collect(Collectors.toList());
}

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/vo/HistoryAbnormalAlarmVo.java

@ -1,9 +1,17 @@
package com.hnac.hzims.operational.station.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class HistoryAbnormalAlarmVo extends HistoryAbnormalAlarmEntity{
@TableField(exist=false)
@ApiModelProperty("告警次数")
private Long times;
@TableField(exist=false)
@ApiModelProperty("告警时长")
private Double duration;
}

Loading…
Cancel
Save