|
|
|
@ -48,15 +48,19 @@ public class SpecialDeviceInspectionServiceImpl extends ServiceImpl<SpecialDevic
|
|
|
|
|
specialDeviceInspectionEntity.setNextInspectionTime(nextInspectDate); |
|
|
|
|
specialDeviceEntity.setInspectionNextTime(nextInspectDate); |
|
|
|
|
// 获取上一次检验时间
|
|
|
|
|
QueryWrapper<SpecialDeviceInspectionEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.lambda().eq(SpecialDeviceInspectionEntity::getDeviceId, deviceId) |
|
|
|
|
.orderByDesc(SpecialDeviceInspectionEntity::getInspectionTime); |
|
|
|
|
List<SpecialDeviceInspectionEntity> list = this.list(queryWrapper); |
|
|
|
|
if (CollectionUtil.isNotEmpty(list)) { |
|
|
|
|
SpecialDeviceInspectionEntity lastDeviceInspection = list.get(0); |
|
|
|
|
Date lastInspectionTime = lastDeviceInspection.getInspectionTime(); |
|
|
|
|
specialDeviceInspectionEntity.setLastInspectionTime(lastInspectionTime); |
|
|
|
|
specialDeviceEntity.setInspectionLastTime(lastInspectionTime); |
|
|
|
|
if (specialDeviceInspectionEntity.getLastInspectionTime() != null) { |
|
|
|
|
specialDeviceEntity.setInspectionLastTime(specialDeviceInspectionEntity.getLastInspectionTime()); |
|
|
|
|
} else { |
|
|
|
|
QueryWrapper<SpecialDeviceInspectionEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.lambda().eq(SpecialDeviceInspectionEntity::getDeviceId, deviceId) |
|
|
|
|
.orderByDesc(SpecialDeviceInspectionEntity::getInspectionTime); |
|
|
|
|
List<SpecialDeviceInspectionEntity> list = this.list(queryWrapper); |
|
|
|
|
if (CollectionUtil.isNotEmpty(list)) { |
|
|
|
|
SpecialDeviceInspectionEntity lastDeviceInspection = list.get(0); |
|
|
|
|
Date lastInspectionTime = lastDeviceInspection.getInspectionTime(); |
|
|
|
|
specialDeviceInspectionEntity.setLastInspectionTime(lastInspectionTime); |
|
|
|
|
specialDeviceEntity.setInspectionLastTime(lastInspectionTime); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 本次检验时间
|
|
|
|
|
specialDeviceEntity.setInspectionCurrentTime(specialDeviceInspectionEntity.getInspectionTime()); |
|
|
|
|