|
@@ -114,13 +114,15 @@ public class TwinCalcStopServiceImpl implements ITwinCalcStopService {
|
|
|
* 停机数据治理,从停机记录表到停机统计表中
|
|
|
*
|
|
|
* @param startTime 开始时间
|
|
|
+ * @param endTime 结束时间
|
|
|
* @param deviceList 设备列表
|
|
|
*/
|
|
|
@Override
|
|
|
- public void process(LocalDateTime startTime, List<TwinDevice> deviceList) {
|
|
|
+ public void process(LocalDateTime startTime, LocalDateTime endTime, List<TwinDevice> deviceList) {
|
|
|
String config = configService.selectConfigByKey("data.legal.time");
|
|
|
int legalTime = Integer.parseInt(config) * 1000;
|
|
|
Date date = Date.from(startTime.toLocalDate().atStartOfDay(ZoneOffset.of("+8")).toInstant());
|
|
|
+ Date endDate = Date.from(endTime.toLocalDate().atStartOfDay(ZoneOffset.of("+8")).toInstant());
|
|
|
List<TwinCalcStop> insertList = new ArrayList<>();
|
|
|
List<TwinCalcStop> updateList = new ArrayList<>();
|
|
|
String oldStr = "old";
|
|
@@ -147,10 +149,12 @@ public class TwinCalcStopServiceImpl implements ITwinCalcStopService {
|
|
|
List<TwinRecordStop> list = new ArrayList<>();
|
|
|
if (oldMap.get(device.getDeviceId()) != null) {
|
|
|
oldMap.get(device.getDeviceId()).forEach(old -> {
|
|
|
- TwinRecordStop stop = new TwinRecordStop();
|
|
|
- BeanUtils.copyProperties(old, stop);
|
|
|
- stop.setRemark(oldStr);
|
|
|
- list.add(stop);
|
|
|
+ if (old.getEndTime().before(endDate)) {
|
|
|
+ TwinRecordStop stop = new TwinRecordStop();
|
|
|
+ BeanUtils.copyProperties(old, stop);
|
|
|
+ stop.setRemark(oldStr);
|
|
|
+ list.add(stop);
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
//再处理本次数据,2次结合
|