|
@@ -1,7 +1,9 @@
|
|
|
package org.jeecg.modules.summary.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import org.jeecg.common.util.DateUtils;
|
|
|
import org.jeecg.modules.base.mapper.InterlockBaseMapper;
|
|
|
import org.jeecg.modules.base.service.IInterlockBaseService;
|
|
|
import org.jeecg.modules.detail.convert.InterlockDetailConvert;
|
|
@@ -9,6 +11,8 @@ import org.jeecg.modules.detail.dto.InterlockDetailAddDTO;
|
|
|
import org.jeecg.modules.detail.entity.InterlockDetail;
|
|
|
import org.jeecg.modules.detail.mapper.InterlockDetailMapper;
|
|
|
import org.jeecg.modules.detail.vo.InterlockDetailEditQueryVO;
|
|
|
+import org.jeecg.modules.iotedgeCollectData.entity.IotedgeCollectData;
|
|
|
+import org.jeecg.modules.iotedgeCollectData.service.IIotedgeCollectDataService;
|
|
|
import org.jeecg.modules.summary.constants.InterlockConstants;
|
|
|
import org.jeecg.modules.summary.convert.InterlockSummaryConvert;
|
|
|
import org.jeecg.modules.summary.dto.InterlockAddDTO;
|
|
@@ -27,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.time.Duration;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
@@ -63,6 +68,9 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
|
|
|
@Autowired
|
|
|
@SuppressWarnings("all")
|
|
|
private IInterlockTagService interlockTagService;
|
|
|
+ @Autowired
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ private IIotedgeCollectDataService iotedgeCollectDataService;
|
|
|
|
|
|
|
|
|
* 根据联锁总表id批量删除联锁及详细信息、点位
|
|
@@ -196,7 +204,33 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
|
|
|
if(ysmnlValue.compareTo(lowerLimit) == 1 && ysmnlValue.compareTo(upperLimit) == 1) dto.setInstrumentStatus("0");
|
|
|
else dto.setInstrumentStatus("1");
|
|
|
} else if("2".equals(dto.getInstrumentStatusJuge())){
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ String yz = dto.getThresholdValue();
|
|
|
+ String time = dto.getThresholdTime();
|
|
|
+ String dw = dto.getThresholdTimeUnit();
|
|
|
+ if ("s".equals(dw)){
|
|
|
+ BigDecimal ysmnlValue = new BigDecimal(dto.getYsmnlValue());
|
|
|
+
|
|
|
+ String endDate = DateUtils.getDate("yyyy-MM-dd HH:mm:ss");
|
|
|
+ LocalDateTime endDateTime = LocalDateTime.parse(endDate, formatter);
|
|
|
+ LocalDateTime beginDateTime = endDateTime.minus(Duration.ofSeconds(2));
|
|
|
+ String beginDate = beginDateTime.format(formatter);
|
|
|
+
|
|
|
+ IotedgeCollectData iotedgeData = iotedgeCollectDataService.getOneInfo(dto.getYsmnlDeviceId(),dto.getYsmnlModuleName(),dto.getYsmnlTag(),beginDate);
|
|
|
+ BigDecimal beginValue = BigDecimal.valueOf(Integer.parseInt(iotedgeData.getValue()));
|
|
|
+ BigDecimal num = BigDecimal.valueOf(Integer.parseInt(dto.getYsmnlValue())).subtract(beginValue);
|
|
|
+
|
|
|
+ if ((num.divide(beginValue).compareTo(BigDecimal.valueOf(Integer.parseInt(yz)))) > 0){
|
|
|
+ dto.setInstrumentStatus("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
if(dto.getInstrumentStatus().equals("1")) instrumentStatus = "1";
|
|
|
}
|
|
@@ -287,7 +321,33 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
|
|
|
if(ysmnlValue.compareTo(lowerLimit) == 1 && ysmnlValue.compareTo(upperLimit) == 1) dto.setInstrumentStatus("0");
|
|
|
else dto.setInstrumentStatus("1");
|
|
|
} else if("2".equals(dto.getInstrumentStatusJuge())){
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ String yz = dto.getThresholdValue();
|
|
|
+ String time = dto.getThresholdTime();
|
|
|
+ String dw = dto.getThresholdTimeUnit();
|
|
|
+ if ("s".equals(dw)){
|
|
|
+ BigDecimal ysmnlValue = new BigDecimal(dto.getYsmnlValue());
|
|
|
+
|
|
|
+ String endDate = DateUtils.getDate("yyyy-MM-dd HH:mm:ss");
|
|
|
+ LocalDateTime endDateTime = LocalDateTime.parse(endDate, formatter);
|
|
|
+ LocalDateTime beginDateTime = endDateTime.minus(Duration.ofSeconds(2));
|
|
|
+ String beginDate = beginDateTime.format(formatter);
|
|
|
+
|
|
|
+ IotedgeCollectData iotedgeData = iotedgeCollectDataService.getOneInfo(dto.getYsmnlDeviceId(),dto.getYsmnlModuleName(),dto.getYsmnlTag(),beginDate);
|
|
|
+ BigDecimal beginValue = BigDecimal.valueOf(Integer.parseInt(iotedgeData.getValue()));
|
|
|
+ BigDecimal num = BigDecimal.valueOf(Integer.parseInt(dto.getYsmnlValue())).subtract(beginValue);
|
|
|
+
|
|
|
+ if ((num.divide(beginValue).compareTo(BigDecimal.valueOf(Integer.parseInt(yz)))) > 0){
|
|
|
+ dto.setInstrumentStatus("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
if(dto.getInstrumentStatus().equals("1")) instrumentStatus = "1";
|
|
|
}
|