|
@@ -1,5 +1,7 @@
|
|
|
package org.jeecg.modules.leanEventWarn.service.impl;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.modules.common.enums.EDeviceInformationType;
|
|
|
import org.jeecg.modules.events.entity.LeanEventsHost;
|
|
|
import org.jeecg.modules.gatherData.entity.FpgStatiscsModelMongodb;
|
|
@@ -23,6 +25,7 @@ import org.springframework.data.mongodb.core.query.Query;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
@@ -44,6 +47,7 @@ import java.util.stream.Collectors;
|
|
|
* @Date: 2024-10-29
|
|
|
* @Version: V1.0
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoMapper, LeanEventWarnInfo> implements ILeanEventWarnInfoService {
|
|
|
|
|
@@ -60,6 +64,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
|
|
|
ISystemVariableService systemVariableService;
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void openDeviceTriggerWarnInfo(FpgGatherData fpgGatherData) {
|
|
|
LeanEventWarnInfo leanEventWarnInfo = new LeanEventWarnInfo();
|
|
|
leanEventWarnInfo.setDeviceRegionId(fpgGatherData.getDeviceRegionId());
|
|
@@ -73,6 +78,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
|
|
|
queryWrapper.eq("status", 0);
|
|
|
SystemVariable systemVariable = systemVariableService.getOne(queryWrapper);
|
|
|
if (systemVariable == null){
|
|
|
+ log.info("{}{}", "host_open系统变量未配置正常状态的运行电流限制!", JSON.toJSON(fpgGatherData));
|
|
|
return;
|
|
|
}
|
|
|
BigDecimal limitCurrent = new BigDecimal(systemVariable.getDefaultValue());
|
|
@@ -88,6 +94,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void stopDeviceTriggerWarnInfo(FpgGatherData fpgGatherData) {
|
|
|
LeanEventWarnInfo leanEventWarnInfo = new LeanEventWarnInfo();
|
|
|
leanEventWarnInfo.setDeviceRegionId(fpgGatherData.getDeviceRegionId());
|
|
@@ -100,6 +107,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
|
|
|
queryWrapper.eq("status", 0);
|
|
|
SystemVariable systemVariable = systemVariableService.getOne(queryWrapper);
|
|
|
if (systemVariable == null){
|
|
|
+ log.info("{}{}", "host_stop系统变量未配置正常状态的运行电流限制!", JSON.toJSON(fpgGatherData));
|
|
|
return;
|
|
|
}
|
|
|
BigDecimal limitCurrent = new BigDecimal(systemVariable.getDefaultValue());
|
|
@@ -114,6 +122,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void openFpgTriggerWarnInfo(FpgGatherData fpgGatherData) {
|
|
|
LeanEventWarnInfo leanEventWarnInfo = new LeanEventWarnInfo();
|
|
|
leanEventWarnInfo.setDeviceRegionId(fpgGatherData.getDeviceRegionId());
|
|
@@ -135,6 +144,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
|
|
|
queryWrapper.eq("status", 0);
|
|
|
SystemVariable systemVariable = systemVariableService.getOne(queryWrapper);
|
|
|
if (systemVariable == null){
|
|
|
+ log.info("{}{}", "fpg_open系统变量未配置正常状态的运行电流限制!", JSON.toJSON(fpgGatherData));
|
|
|
return;
|
|
|
}
|
|
|
BigDecimal limitCurrent = new BigDecimal(systemVariable.getDefaultValue());
|
|
@@ -202,6 +212,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void closeFpgTriggerWarnInfo(FpgGatherData fpgGatherData) {
|
|
|
LeanEventWarnInfo leanEventWarnInfo = new LeanEventWarnInfo();
|
|
|
leanEventWarnInfo.setDeviceRegionId(fpgGatherData.getDeviceRegionId());
|
|
@@ -225,6 +236,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
|
|
|
queryWrapper.eq("status", 0);
|
|
|
SystemVariable systemVariable = systemVariableService.getOne(queryWrapper);
|
|
|
if (systemVariable == null){
|
|
|
+ log.info("{}{}", "fpg_close系统变量未配置正常状态的运行电流限制!", JSON.toJSON(fpgGatherData));
|
|
|
return;
|
|
|
}
|
|
|
BigDecimal limitCurrent = new BigDecimal(systemVariable.getDefaultValue());
|
|
@@ -270,6 +282,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void runTimeTriggerWarnInfo(FpgGatherData fpgGatherData, LeanEventsHost leanEventsHost) {
|
|
|
LeanEventWarnInfo leanEventWarnInfo = new LeanEventWarnInfo();
|
|
|
leanEventWarnInfo.setDeviceRegionId(fpgGatherData.getDeviceRegionId());
|
|
@@ -283,6 +296,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
|
|
|
.eq(LeanEventsHostConfig::getEventsId, leanEventsHost.getEventsId()).eq(LeanEventsHostConfig::getLimitType, "0");
|
|
|
LeanEventsHostConfig leanEventsHostConfig = leanEventsHostConfigService.list(queryWrapper).stream().findFirst().orElse(null);
|
|
|
if (leanEventsHostConfig == null){
|
|
|
+ log.info("{}{}", "fpg_ing_time精益事件配置关联表查询为空!", "设备ID:" +fpgGatherData.getDeviceInformationId() + "事件ID:" + leanEventsHost.getEventsId());
|
|
|
return;
|
|
|
}
|
|
|
// 获取峰平谷配置的时段
|
|
@@ -301,6 +315,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
|
|
|
// 根据类型、采集点ID、设备ID、区域ID、峰平谷配置时间范围查询mongoDB
|
|
|
List<FpgStatiscsModelMongodb> fpgStatiscsModelDataList = queryByTimeRanges(mongoTemplate, timeRanges, fpgGatherData.getDevicePointId(), fpgGatherData.getDeviceInformationId(), fpgGatherData.getDeviceRegionId());
|
|
|
if (oConvertUtils.listIsEmpty(fpgStatiscsModelDataList) ){
|
|
|
+ log.info("{}{}", "fpg_ing_time峰平谷数据采集FpgStatiscsModelMongodb查询为空!", "设备ID:" +fpgGatherData.getDeviceInformationId() + "采集点ID:" + fpgGatherData.getDevicePointId()+ "区域ID:" + fpgGatherData.getDevicePointId());
|
|
|
return;
|
|
|
}
|
|
|
// 判断MongoDB中的累加运行时长是否大于 LeanEventsHostConfig中的尖峰平谷运行限制时长
|
|
@@ -353,6 +368,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void powerLimitTriggerWarnInfo(FpgGatherData fpgGatherData, LeanEventsHost leanEventsHost) {
|
|
|
LeanEventWarnInfo leanEventWarnInfo = new LeanEventWarnInfo();
|
|
|
leanEventWarnInfo.setDeviceRegionId(fpgGatherData.getDeviceRegionId());
|
|
@@ -366,6 +382,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
|
|
|
.eq(LeanEventsHostConfig::getEventsId, leanEventsHost.getEventsId()).eq(LeanEventsHostConfig::getLimitType, "1");
|
|
|
LeanEventsHostConfig leanEventsHostConfig = leanEventsHostConfigService.list(queryWrapper).stream().findFirst().orElse(null);
|
|
|
if (leanEventsHostConfig == null){
|
|
|
+ log.info("{}{}", "fpg_power_limit精益事件配置关联表查询为空!", "设备ID:" +fpgGatherData.getDeviceInformationId() + "事件ID:" + leanEventsHost.getEventsId());
|
|
|
return;
|
|
|
}
|
|
|
// 获取峰平谷配置的时段
|
|
@@ -384,6 +401,7 @@ public class LeanEventWarnInfoServiceImpl extends ServiceImpl<LeanEventWarnInfoM
|
|
|
// 根据类型、采集点ID、设备ID、区域ID、峰平谷配置时间范围查询mongoDB
|
|
|
List<FpgStatiscsModelMongodb> fpgStatiscsModelDataList = queryByTimeRanges(mongoTemplate, timeRanges, fpgGatherData.getDevicePointId(), fpgGatherData.getDeviceInformationId(), fpgGatherData.getDeviceRegionId());
|
|
|
if (oConvertUtils.listIsEmpty(fpgStatiscsModelDataList) ){
|
|
|
+ log.info("{}{}", "fpg_power_limit峰平谷数据采集FpgStatiscsModelMongodb查询为空!", "设备ID:" +fpgGatherData.getDeviceInformationId() + "采集点ID:" + fpgGatherData.getDevicePointId()+ "区域ID:" + fpgGatherData.getDevicePointId());
|
|
|
return;
|
|
|
}
|
|
|
// 判断MongoDB中的累加运行时长是否大于 LeanEventsHostConfig中的尖峰平谷运行限制时长
|