|
|
|
@ -5,10 +5,7 @@ import HslCommunication.Profinet.Melsec.MelsecMcNet; |
|
|
|
import HslCommunication.Profinet.Siemens.SiemensPLCS; |
|
|
|
import HslCommunication.Profinet.Siemens.SiemensS7Net; |
|
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|
|
|
import com.spring.modules.cdc.entity.Collect; |
|
|
|
import com.spring.modules.cdc.entity.CollectDetail; |
|
|
|
import com.spring.modules.cdc.entity.CollectRecord; |
|
|
|
import com.spring.modules.cdc.entity.Device; |
|
|
|
import com.spring.modules.cdc.entity.*; |
|
|
|
import com.spring.modules.cdc.service.*; |
|
|
|
import com.spring.modules.cdc.utils.CollectUtils; |
|
|
|
import com.spring.modules.cdc.vo.DeviceVo; |
|
|
|
@ -60,6 +57,10 @@ public class GatherDataTask { |
|
|
|
@Autowired |
|
|
|
private ICollectRecordService collectRecordService; |
|
|
|
@Autowired |
|
|
|
private ICollectService collectService; |
|
|
|
@Autowired |
|
|
|
private ICDCBaseDataService baseDataService; |
|
|
|
@Autowired |
|
|
|
private IMailConfigService mailConfigService; |
|
|
|
@Autowired |
|
|
|
private IMobileService mobileService; |
|
|
|
@ -101,6 +102,24 @@ public class GatherDataTask { |
|
|
|
} |
|
|
|
log.info("数据采集完成:总条数{}",deviceVos.size()); |
|
|
|
collectRecordService.batchUpdateCollectRecord(deviceVos); |
|
|
|
// // 获取 所有 Collect 记录 |
|
|
|
// List<Collect> collectList = collectService.lambdaQuery().list(); |
|
|
|
// // 获取base日期 |
|
|
|
// CdcBaseData baseData = baseDataService.lambdaQuery().eq(CdcBaseData::getBaseNo, "last_send_time").one(); |
|
|
|
// BigDecimal time = baseData.getNumValue();// 默认为秒 |
|
|
|
// |
|
|
|
// Map<String, List<DeviceVo>> collectMap = deviceVos.stream().collect(Collectors.groupingBy(DeviceVo::getCollectId)); |
|
|
|
// for (String s : collectMap.keySet()) { |
|
|
|
// List<DeviceVo> deviceVoList = collectMap.get(s); |
|
|
|
// Optional<Collect> optional = collectList.stream().filter(c -> c.getCollectId().equals(s)).findFirst(); |
|
|
|
// Collect collect = optional.get(); |
|
|
|
// Date lastSendTime = collect.getLastSendTime(); |
|
|
|
// // 如果没有发送过数据 或者 距离上次发送时间大于设定的时间间隔 |
|
|
|
// if (Objects.isNull(lastSendTime) || lastSendTime.before(new Date(System.currentTimeMillis() - time.multiply(new BigDecimal(1000)).longValue()))){ |
|
|
|
// // 可以发送短信 |
|
|
|
// // 数据校验 需要发送短信的设备 |
|
|
|
// } |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
// public void execute() { |
|
|
|
|