|
|
@ -105,6 +105,7 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec |
|
|
|
//获取最新的巡查记录
|
|
|
|
QueryWrapper<StaffPatrolRecordEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(formDTO.getGridId()), "GRID", formDTO.getGridId()) |
|
|
|
.eq("STAFF_ID", tokenDto.getUserId()) |
|
|
|
.orderByDesc("PATROL_START_TIME") |
|
|
|
.last("limit 1"); |
|
|
|
StaffPatrolRecordEntity entity = baseDao.selectOne(wrapper); |
|
|
@ -168,13 +169,16 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec |
|
|
|
if (null == record) { |
|
|
|
throw new RenException("巡查记录不存在"); |
|
|
|
} |
|
|
|
if (PatrolConstant.END.equals(record.getStatus())) { |
|
|
|
throw new RenException("巡查已结束,请勿重复提交"); |
|
|
|
} |
|
|
|
|
|
|
|
record.setActrualEndTime(new Date()); |
|
|
|
record.setUpdatedTime(null); |
|
|
|
record.setPatrolEndTime(DateUtils.parse(formDTO.getPatrolEndTime(), DateUtils.DATE_TIME_PATTERN)); |
|
|
|
record.setTotalTime(DateUtils.calculateSecond(record.getPatrolStartTime(), record.getPatrolEndTime())); |
|
|
|
record.setStatus(PatrolConstant.END); |
|
|
|
|
|
|
|
baseDao.updateById(record); |
|
|
|
//保存记录明细
|
|
|
|
StaffPatrolDetailEntity detailEntity = new StaffPatrolDetailEntity(); |
|
|
|
detailEntity.setStaffPatrolRecId(record.getId()); |
|
|
|