|
@@ -69,6 +69,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
// 根据日报的 施工队伍 deptId 查询队伍所在的 项目 任务
|
|
|
// 根据日报的施工状态 更新 对应任务的 状态
|
|
|
if (ObjUtil.isNotEmpty(createReqVO.getDeptId())) {
|
|
|
+ Long taskId = Long.MIN_VALUE;
|
|
|
Set<Long> deviceIds = new HashSet<>();
|
|
|
IotProjectTaskPageReqVO reqVO = new IotProjectTaskPageReqVO();
|
|
|
reqVO.setDeptId(createReqVO.getDeptId());
|
|
@@ -79,6 +80,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
// 暂时只考虑1个施工队伍只属于1个任务
|
|
|
iotRhDailyReport.setProjectId(task.getProjectId());
|
|
|
iotRhDailyReport.setTaskId(task.getId());
|
|
|
+ taskId = task.getId();
|
|
|
// 根据日报状态 查新 日报所属任务的状态
|
|
|
if (ObjUtil.isNotEmpty(createReqVO.getConstructionStatus())) {
|
|
|
task.setStatus(createReqVO.getConstructionStatus());
|
|
@@ -127,7 +129,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 根据当日注气量 计算累计注气量
|
|
|
+ // todo 根据当日注气量 计算累计注气量
|
|
|
|
|
|
// 查询当前日报所属任务关联的设备
|
|
|
if (CollUtil.isNotEmpty(deviceIds)) {
|
|
@@ -168,19 +170,28 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 当天如果已经有此小队的记录 新增 当天如果没有此小队的日报记录 修改
|
|
|
+ // deptId - taskId - createTime(yyyy-MM-dd) 确定唯一一条记录
|
|
|
+ IotRhDailyReportDO existReport = iotRhDailyReportMapper.selectExistReport(createReqVO.getDeptId(), taskId, LocalDateTime.now());
|
|
|
+ if (ObjUtil.isEmpty(existReport)) {
|
|
|
+ // 设置任务时间范围 昨天下午4点到今天下午4点
|
|
|
+ // 设置任务时间范围 昨天下午4点到今天下午4点
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ // 今天下午4点
|
|
|
+ LocalDateTime today4pm = now.withHour(16).withMinute(0).withSecond(0).withNano(0);
|
|
|
+ // 昨天下午4点
|
|
|
+ LocalDateTime yesterday4pm = today4pm.minusDays(1);
|
|
|
+ iotRhDailyReport.setConstructionStartDate(yesterday4pm);
|
|
|
+ iotRhDailyReport.setConstructionEndDate(today4pm);
|
|
|
+
|
|
|
+ iotRhDailyReportMapper.insert(iotRhDailyReport);
|
|
|
+ } else {
|
|
|
+ // 修改现有记录
|
|
|
+ iotRhDailyReport.setId(existReport.getId());
|
|
|
+ iotRhDailyReportMapper.updateById(iotRhDailyReport);
|
|
|
+ }
|
|
|
}
|
|
|
- // 设置任务时间范围 昨天下午4点到今天下午4点
|
|
|
- // 设置任务时间范围 昨天下午4点到今天下午4点
|
|
|
- LocalDateTime now = LocalDateTime.now();
|
|
|
- // 今天下午4点
|
|
|
- LocalDateTime today4pm = now.withHour(16).withMinute(0).withSecond(0).withNano(0);
|
|
|
- // 昨天下午4点
|
|
|
- LocalDateTime yesterday4pm = today4pm.minusDays(1);
|
|
|
- iotRhDailyReport.setConstructionStartDate(yesterday4pm);
|
|
|
- iotRhDailyReport.setConstructionEndDate(today4pm);
|
|
|
- iotRhDailyReportMapper.insert(iotRhDailyReport);
|
|
|
- // 当天如果已经有此小队的记录 新增
|
|
|
- // 当天如果没有此小队的日报记录 修改
|
|
|
|
|
|
// 返回
|
|
|
return iotRhDailyReport.getId();
|