Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 7 months ago
parent
commit
93e1b7e4bf
  1. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/ActivePowerVo.java
  2. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordDetailVO.java
  3. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/alarm/AlarmDefaulConfigMapper.java
  4. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmDefaulConfigService.java
  5. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmDefaulConfigServiceImpl.java
  6. 55
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java
  7. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  8. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/alarm/AlarmDefaulConfigMapper.xml
  9. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.xml
  10. BIN
      hzims-service/safeproduct/src/main/resources/template/卫生自查表.docx

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

@ -12,6 +12,9 @@ import lombok.Data;
@ApiModel(value = "当日机组有功功率") @ApiModel(value = "当日机组有功功率")
public class ActivePowerVo { public class ActivePowerVo {
@ApiModelProperty(value = "字符串时间")
private String strHour;
@ApiModelProperty(value = "小时") @ApiModelProperty(value = "小时")
private Integer hour; private Integer hour;

3
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordDetailVO.java

@ -18,6 +18,9 @@ public class HygieneRecordDetailVO {
@ApiModelProperty("编码") @ApiModelProperty("编码")
private String code; private String code;
@ApiModelProperty("单位")
private String unit;
@ApiModelProperty("实际结束时间") @ApiModelProperty("实际结束时间")
private Date actualEndTime; private Date actualEndTime;

11
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/alarm/AlarmDefaulConfigMapper.java

@ -0,0 +1,11 @@
package com.hnac.hzims.scheduled.mapper.alarm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.alarm.config.entity.AlarmDefaultConfigEntity;
/**
* @author ysj
*/
public interface AlarmDefaulConfigMapper extends BaseMapper<AlarmDefaultConfigEntity> {
}

11
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmDefaulConfigService.java

@ -0,0 +1,11 @@
package com.hnac.hzims.scheduled.service.alarm;
import com.hnac.hzims.alarm.config.entity.AlarmDefaultConfigEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @author ysj
*/
public interface AlarmDefaulConfigService extends BaseService<AlarmDefaultConfigEntity> {
}

21
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmDefaulConfigServiceImpl.java

@ -0,0 +1,21 @@
package com.hnac.hzims.scheduled.service.alarm.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hnac.hzims.alarm.config.entity.AlarmDefaultConfigEntity;
import com.hnac.hzims.scheduled.mapper.alarm.AlarmDefaulConfigMapper;
import com.hnac.hzims.scheduled.service.alarm.AlarmDefaulConfigService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author ysj
*/
@AllArgsConstructor
@Service
@Slf4j
@DS("alarm")
public class AlarmDefaulConfigServiceImpl extends BaseServiceImpl<AlarmDefaulConfigMapper, AlarmDefaultConfigEntity> implements AlarmDefaulConfigService {
}

55
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java

@ -3,12 +3,14 @@ package com.hnac.hzims.scheduled.service.alarm.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.alarm.config.constants.AlarmConstants; import com.hnac.hzims.alarm.config.constants.AlarmConstants;
import com.hnac.hzims.alarm.config.entity.AlarmDefaultConfigEntity;
import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.business.interruption.constants.InterruptionConstants; import com.hnac.hzims.business.interruption.constants.InterruptionConstants;
import com.hnac.hzims.business.interruption.entity.InterruptionEntity; import com.hnac.hzims.business.interruption.entity.InterruptionEntity;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.vo.HydropowerUnitRealVo; import com.hnac.hzims.operational.main.vo.HydropowerUnitRealVo;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.service.alarm.AlarmDefaulConfigService;
import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService; import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService;
import com.hnac.hzims.scheduled.service.alarm.AlarmService; import com.hnac.hzims.scheduled.service.alarm.AlarmService;
import com.hnac.hzims.scheduled.service.operation.station.StationService; import com.hnac.hzims.scheduled.service.operation.station.StationService;
@ -42,6 +44,8 @@ public class AlarmServiceImpl implements AlarmService {
private final AlarmQueryService alarmQueryService; private final AlarmQueryService alarmQueryService;
private final AlarmDefaulConfigService defaulConfigService;
private final InterruptionAlarmServiceImpl interruptionAlarmService; private final InterruptionAlarmServiceImpl interruptionAlarmService;
private final ISoeClient soeClient; private final ISoeClient soeClient;
@ -68,13 +72,20 @@ public class AlarmServiceImpl implements AlarmService {
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return; return;
} }
// 查询开关机默认告警配置
AlarmDefaultConfigEntity start = defaulConfigService.getOne(Wrappers.<AlarmDefaultConfigEntity>lambdaQuery()
.eq(AlarmDefaultConfigEntity::getSource,5)
.eq(AlarmDefaultConfigEntity::getAlarmChiledType,50)
);
AlarmDefaultConfigEntity stop = defaulConfigService.getOne(Wrappers.<AlarmDefaultConfigEntity>lambdaQuery()
.eq(AlarmDefaultConfigEntity::getSource,5)
.eq(AlarmDefaultConfigEntity::getAlarmChiledType,51)
);
// 获取站点设备实时数据 // 获取站点设备实时数据
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
if(CollectionUtil.isEmpty(reals)){ if(CollectionUtil.isEmpty(reals)){
return; return;
} }
Map<String,Integer> refresh = new HashMap<>(); Map<String,Integer> refresh = new HashMap<>();
// 实时设备遍历 // 实时设备遍历
reals.forEach(real->{ reals.forEach(real->{
@ -96,24 +107,25 @@ public class AlarmServiceImpl implements AlarmService {
return; return;
} }
// 比对开机状态 // 比对开机状态
if(Math.abs(real.getActivePower()) > 0){ if(real.getActivePower() > 0){
if(startStopMap.get(real.getDeviceCode()) == 0){ if(startStopMap.get(real.getDeviceCode()) == 0){
refresh.put(real.getDeviceCode(),1); refresh.put(real.getDeviceCode(),1);
// 记录开机告警 // 记录开机告警
this.saveStartStopAlarm(station,real,1); this.saveStartStopAlarm(station,real,start,1);
}else{ }else{
refresh.put(real.getDeviceCode(),0); refresh.put(real.getDeviceCode(),1);
} }
}else{ }else{
if(startStopMap.get(real.getDeviceCode()) == 1){ if(startStopMap.get(real.getDeviceCode()) == 1){
refresh.put(real.getDeviceCode(),0); refresh.put(real.getDeviceCode(),0);
// 记录关机告警 // 记录关机告警
this.saveStartStopAlarm(station,real,0); this.saveStartStopAlarm(station,real,stop,0);
}else{ }else{
refresh.put(real.getDeviceCode(),1); refresh.put(real.getDeviceCode(),0);
} }
} }
}); });
log.error("start_stop_alarm : {}",refresh);
redisTemplate.opsForValue().set(start_stop_cache_final,refresh); redisTemplate.opsForValue().set(start_stop_cache_final,refresh);
} }
@ -132,7 +144,7 @@ public class AlarmServiceImpl implements AlarmService {
* @param real * @param real
* @param state * @param state
*/ */
private void saveStartStopAlarm(StationEntity station, HydropowerUnitRealVo real, int state) { private void saveStartStopAlarm(StationEntity station, HydropowerUnitRealVo real,AlarmDefaultConfigEntity defaultConfig, int state) {
AlarmEntity alarm = new AlarmEntity(); AlarmEntity alarm = new AlarmEntity();
alarm.setStationId(station.getCode()); alarm.setStationId(station.getCode());
alarm.setStationName(station.getName()); alarm.setStationName(station.getName());
@ -148,14 +160,25 @@ public class AlarmServiceImpl implements AlarmService {
} }
alarm.setStatus(0); alarm.setStatus(0);
alarm.setAlarmTime(new Date()); alarm.setAlarmTime(new Date());
alarm.setIsRightTabulation(0); if(ObjectUtil.isEmpty(defaultConfig)){
alarm.setIsShowAlert(1); alarm.setIsRightTabulation(0);
alarm.setIsSmallBell(1); alarm.setIsShowAlert(1);
alarm.setIsMask(1); alarm.setIsSmallBell(1);
alarm.setIsBroadcast(1); alarm.setIsMask(1);
alarm.setIsPlatformMessage(1); alarm.setIsBroadcast(1);
alarm.setIsShortMessage(1); alarm.setIsPlatformMessage(1);
alarm.setIsWxMessage(1); alarm.setIsShortMessage(1);
alarm.setIsWxMessage(1);
}else{
alarm.setIsRightTabulation(defaultConfig.getIsRightTabulation());
alarm.setIsShowAlert(defaultConfig.getIsShowAlert());
alarm.setIsSmallBell(defaultConfig.getIsSmallBell());
alarm.setIsMask(defaultConfig.getIsMask());
alarm.setIsBroadcast(defaultConfig.getIsBroadcast());
alarm.setIsPlatformMessage(defaultConfig.getIsPlatformMessage());
alarm.setIsShortMessage(defaultConfig.getIsShortMessage());
alarm.setIsWxMessage(defaultConfig.getIsWxMessage());
}
alarm.setTenantId(station.getTenantId()); alarm.setTenantId(station.getTenantId());
alarm.setCreateDept(station.getRefDept()); alarm.setCreateDept(station.getRefDept());
alarm.setCreateUser(station.getCreateUser()); alarm.setCreateUser(station.getCreateUser());

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

@ -1379,8 +1379,12 @@ public class RealTargetServiceImpl implements RealTargetService {
* @return * @return
*/ */
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 end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); Calendar calendar = Calendar.getInstance();
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
// 开始日期
calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - 24);
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD); List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) { if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>(); return new ArrayList<>();
@ -1388,10 +1392,11 @@ public class RealTargetServiceImpl implements RealTargetService {
return records.stream().map(record -> { return records.stream().map(record -> {
ActivePowerVo load = new ActivePowerVo(); ActivePowerVo load = new ActivePowerVo();
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");
load.setStrHour(DateUtil.format(time,"yyyy-MM-dd HH"));
load.setHour(time.getHours()); load.setHour(time.getHours());
load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0"));
return load; return load;
}).sorted(Comparator.comparing(ActivePowerVo::getHour)).collect(Collectors.toList()); }).sorted(Comparator.comparing(ActivePowerVo::getStrHour)).sorted(Comparator.comparing(ActivePowerVo::getHour)).collect(Collectors.toList());
} }
/** /**

5
hzims-service/hzims-scheduled/src/main/resources/mapper/alarm/AlarmDefaulConfigMapper.xml

@ -0,0 +1,5 @@
<?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.scheduled.mapper.alarm.AlarmDefaulConfigMapper">
</mapper>

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.xml

@ -4,7 +4,7 @@
<select id="getRecordDetail" resultType="com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO"> <select id="getRecordDetail" resultType="com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO">
SELECT SELECT
code, actual_end_time, check_user, hygiene_zone_ids, check_result,comprehensive_score, week_num, code, actual_end_time, check_user, hygiene_zone_ids, check_result,comprehensive_score, week_num,
img_path, hygiene_plan_id, check_time img_path, hygiene_plan_id, check_time, unit
FROM FROM
hzims_hygiene_record hzims_hygiene_record
WHERE WHERE

BIN
hzims-service/safeproduct/src/main/resources/template/卫生自查表.docx

Binary file not shown.
Loading…
Cancel
Save