|
|
@ -7,6 +7,7 @@ import com.spring.modules.cdc.entity.Device; |
|
|
import com.spring.modules.cdc.mapper.CollectRecordMapper; |
|
|
import com.spring.modules.cdc.mapper.CollectRecordMapper; |
|
|
import com.spring.modules.cdc.service.ICollectRecordService; |
|
|
import com.spring.modules.cdc.service.ICollectRecordService; |
|
|
import com.spring.modules.cdc.service.ICollectService; |
|
|
import com.spring.modules.cdc.service.ICollectService; |
|
|
|
|
|
import com.spring.modules.cdc.vo.CollectRecordVo; |
|
|
import com.spring.modules.cdc.vo.DeviceVo; |
|
|
import com.spring.modules.cdc.vo.DeviceVo; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
@ -76,23 +77,25 @@ public class CollectRecordServiceImpl extends ServiceImpl<CollectRecordMapper,Co |
|
|
Map<String, List<DeviceVo>> map = deviceVoList.stream().collect(Collectors.groupingBy(DeviceVo::getCollectId)); |
|
|
Map<String, List<DeviceVo>> map = deviceVoList.stream().collect(Collectors.groupingBy(DeviceVo::getCollectId)); |
|
|
|
|
|
|
|
|
Map<String, List<Collect>> collect = collectService.lambdaQuery().in(Collect::getCollectId, map.keySet()).list().stream().collect(Collectors.groupingBy(Collect::getCollectId)); |
|
|
Map<String, List<Collect>> collect = collectService.lambdaQuery().in(Collect::getCollectId, map.keySet()).list().stream().collect(Collectors.groupingBy(Collect::getCollectId)); |
|
|
|
|
|
|
|
|
// 设备信息集合 |
|
|
|
|
|
List<CollectRecord> list = new ArrayList<>(); |
|
|
|
|
|
for (String collectId : map.keySet()) { |
|
|
for (String collectId : map.keySet()) { |
|
|
List<DeviceVo> deviceVos = map.get(collectId); |
|
|
List<DeviceVo> deviceVos = map.get(collectId); |
|
|
List<Collect> collects = collect.get(collectId); |
|
|
List<Collect> collects = collect.get(collectId); |
|
|
|
|
|
// 设备信息集合 |
|
|
|
|
|
List<CollectRecordVo> list = new ArrayList<>(); |
|
|
for (DeviceVo deviceVo : deviceVos) { |
|
|
for (DeviceVo deviceVo : deviceVos) { |
|
|
CollectRecord collectRecord = getCollectRecord(deviceVo, collects, deviceVo.getValue()); |
|
|
|
|
|
|
|
|
CollectRecordVo collectRecord = getCollectRecord(deviceVo, collects, deviceVo.getValue()); |
|
|
list.add(collectRecord); |
|
|
list.add(collectRecord); |
|
|
updateCollectCurrentValue(collectRecord); |
|
|
updateCollectCurrentValue(collectRecord); |
|
|
save(collectRecord); |
|
|
save(collectRecord); |
|
|
} |
|
|
} |
|
|
|
|
|
// 处理 短信 |
|
|
|
|
|
|
|
|
|
|
|
// 处理 邮件 |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private static CollectRecord getCollectRecord(DeviceVo device, List<Collect> c1, BigDecimal i) { |
|
|
|
|
|
CollectRecord collectRecord = new CollectRecord(); |
|
|
|
|
|
|
|
|
private static CollectRecordVo getCollectRecord(DeviceVo device, List<Collect> c1, BigDecimal i) { |
|
|
|
|
|
CollectRecordVo collectRecord = new CollectRecordVo(); |
|
|
collectRecord.setDeviceNo(device.getDeviceNo()); |
|
|
collectRecord.setDeviceNo(device.getDeviceNo()); |
|
|
collectRecord.setCollectId(c1.get(0).getCollectId()); |
|
|
collectRecord.setCollectId(c1.get(0).getCollectId()); |
|
|
collectRecord.setItemValue(i); |
|
|
collectRecord.setItemValue(i); |
|
|
@ -100,6 +103,7 @@ public class CollectRecordServiceImpl extends ServiceImpl<CollectRecordMapper,Co |
|
|
collectRecord.setMinValue(c1.get(0).getMinValue()); |
|
|
collectRecord.setMinValue(c1.get(0).getMinValue()); |
|
|
collectRecord.setSite(device.getSite()); |
|
|
collectRecord.setSite(device.getSite()); |
|
|
collectRecord.setCreateTime(new Date()); |
|
|
collectRecord.setCreateTime(new Date()); |
|
|
|
|
|
collectRecord.setDeviceDesc(device.getDeviceDesc()); |
|
|
if (c1.get(0).getMaxValue().compareTo(i) < 0){ |
|
|
if (c1.get(0).getMaxValue().compareTo(i) < 0){ |
|
|
collectRecord.setWarnFlag("Y"); |
|
|
collectRecord.setWarnFlag("Y"); |
|
|
} |
|
|
} |
|
|
|