refactor(meterRecord): 修正电表读数为零时的处理逻辑
This commit is contained in:
@@ -212,14 +212,6 @@ public class TbMeterRecordServiceImpl implements ITbMeterRecordService {
|
|||||||
record.setCurrentReading(BigDecimal.ZERO);
|
record.setCurrentReading(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (record.getCurrentReading().compareTo(BigDecimal.ZERO) == 0){
|
|
||||||
// 通信状态改为离线
|
|
||||||
TbMeterInfoBo bo = new TbMeterInfoBo();
|
|
||||||
bo.setId(info.getId());
|
|
||||||
bo.setCommunicationState(0L);
|
|
||||||
tbMeterInfoService.updateByBo(bo);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置上次读数
|
// 设置上次读数
|
||||||
if (hasOldRecords) {
|
if (hasOldRecords) {
|
||||||
TbMeterRecord oldRecord = oldRecordMap.get(info.getId());
|
TbMeterRecord oldRecord = oldRecordMap.get(info.getId());
|
||||||
@@ -229,6 +221,15 @@ public class TbMeterRecordServiceImpl implements ITbMeterRecordService {
|
|||||||
record.setPreviousReading(record.getCurrentReading());
|
record.setPreviousReading(record.getCurrentReading());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (record.getCurrentReading().compareTo(BigDecimal.ZERO) == 0){
|
||||||
|
// 通信状态改为离线
|
||||||
|
TbMeterInfoBo bo = new TbMeterInfoBo();
|
||||||
|
bo.setId(info.getId());
|
||||||
|
bo.setCommunicationState(0L);
|
||||||
|
tbMeterInfoService.updateByBo(bo);
|
||||||
|
record.setCurrentReading(record.getPreviousReading());
|
||||||
|
}
|
||||||
|
|
||||||
record.setReadingMethod(MeterRecordTypeEnum.AUTO_RECORD.getCode());
|
record.setReadingMethod(MeterRecordTypeEnum.AUTO_RECORD.getCode());
|
||||||
recordNew.add(record);
|
recordNew.add(record);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user