|
@@ -194,38 +194,37 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
|
|
|
AtomicReference<LocalDateTime> moveDate = new AtomicReference<>();
|
|
AtomicReference<LocalDateTime> moveDate = new AtomicReference<>();
|
|
AtomicReference<LocalDateTime> commencementDate = new AtomicReference<>();
|
|
AtomicReference<LocalDateTime> commencementDate = new AtomicReference<>();
|
|
-
|
|
|
|
|
|
+ LocalDateTime reportDate = createReqVO.getFillOrderCreateTime();
|
|
// 当天如果已经有此小队的记录 新增 当天如果没有此小队的日报记录 修改
|
|
// 当天如果已经有此小队的记录 新增 当天如果没有此小队的日报记录 修改
|
|
- // deptId - taskId - createTime(yyyy-MM-dd) 确定唯一一条记录 不能使用 LocalDateTime.now() 来查询,应该使用 运行记录工单的日期查询
|
|
|
|
- IotRhDailyReportDO existReport = iotRhDailyReportMapper.selectExistReport(createReqVO.getDeptId(), taskId, LocalDateTime.now());
|
|
|
|
|
|
+ // deptId - taskId - createTime(yyyy-MM-dd) 确定唯一一条记录 不能使用 LocalDateTime.now() 来查询,应该使用 运行记录工单的创建日期查询
|
|
|
|
+ IotRhDailyReportDO existReport = iotRhDailyReportMapper.selectExistReport(createReqVO.getDeptId(), taskId, reportDate);
|
|
if (ObjUtil.isEmpty(existReport)) {
|
|
if (ObjUtil.isEmpty(existReport)) {
|
|
// 设置任务时间范围 昨天下午4点到今天下午4点
|
|
// 设置任务时间范围 昨天下午4点到今天下午4点
|
|
- // 设置任务时间范围 昨天下午4点到今天下午4点
|
|
|
|
- LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
|
+ // LocalDateTime now = LocalDateTime.now();
|
|
// 今天下午4点
|
|
// 今天下午4点
|
|
- LocalDateTime today4pm = now.withHour(16).withMinute(0).withSecond(0).withNano(0);
|
|
|
|
|
|
+ LocalDateTime today4pm = reportDate.withHour(16).withMinute(0).withSecond(0).withNano(0);
|
|
// 昨天下午4点
|
|
// 昨天下午4点
|
|
LocalDateTime yesterday4pm = today4pm.minusDays(1);
|
|
LocalDateTime yesterday4pm = today4pm.minusDays(1);
|
|
iotRhDailyReport.setConstructionStartDate(yesterday4pm);
|
|
iotRhDailyReport.setConstructionStartDate(yesterday4pm);
|
|
iotRhDailyReport.setConstructionEndDate(today4pm);
|
|
iotRhDailyReport.setConstructionEndDate(today4pm);
|
|
// 查询当前日报状态 是否是 施工 或 搬迁
|
|
// 查询当前日报状态 是否是 施工 或 搬迁
|
|
- if (3 == iotRhDailyReport.getConstructionStatus()) {
|
|
|
|
|
|
+ /* if (3 == iotRhDailyReport.getConstructionStatus()) {
|
|
commencementDate.set(yesterday4pm);
|
|
commencementDate.set(yesterday4pm);
|
|
}
|
|
}
|
|
if (1 == iotRhDailyReport.getConstructionStatus()) {
|
|
if (1 == iotRhDailyReport.getConstructionStatus()) {
|
|
moveDate.set(yesterday4pm);
|
|
moveDate.set(yesterday4pm);
|
|
- }
|
|
|
|
|
|
+ } */
|
|
// 历史日报数据
|
|
// 历史日报数据
|
|
// 根据历史当前小队历史的日报 计算 搬迁安装天数 (开工日期 - 搬迁日期)
|
|
// 根据历史当前小队历史的日报 计算 搬迁安装天数 (开工日期 - 搬迁日期)
|
|
// 暂时无法通过列表计算搬迁安装天数(因为需要按照任务分组同时查询当前分页所有日报的 开工日期 搬迁日期)
|
|
// 暂时无法通过列表计算搬迁安装天数(因为需要按照任务分组同时查询当前分页所有日报的 开工日期 搬迁日期)
|
|
- IotRhDailyReportPageReqVO reportReqVO = new IotRhDailyReportPageReqVO();
|
|
|
|
|
|
+ /* IotRhDailyReportPageReqVO reportReqVO = new IotRhDailyReportPageReqVO();
|
|
reportReqVO.setTaskId(taskId);
|
|
reportReqVO.setTaskId(taskId);
|
|
- List<IotRhDailyReportDO> groupedReports = iotRhDailyReportMapper.selectListGrouped(reportReqVO);
|
|
|
|
|
|
+ List<IotRhDailyReportDO> groupedReports = iotRhDailyReportMapper.selectListGrouped(reportReqVO); */
|
|
// 将当前日报也添加到 集合groupedReports中 共同筛选开工日期 搬迁日期
|
|
// 将当前日报也添加到 集合groupedReports中 共同筛选开工日期 搬迁日期
|
|
// AtomicReference<LocalDateTime> moveDate = new AtomicReference<>();
|
|
// AtomicReference<LocalDateTime> moveDate = new AtomicReference<>();
|
|
// AtomicReference<LocalDateTime> commencementDate = new AtomicReference<>();
|
|
// AtomicReference<LocalDateTime> commencementDate = new AtomicReference<>();
|
|
// 先当前更新的日报的 施工状态
|
|
// 先当前更新的日报的 施工状态
|
|
- if (CollUtil.isNotEmpty(groupedReports)) {
|
|
|
|
|
|
+ /* if (CollUtil.isNotEmpty(groupedReports)) {
|
|
groupedReports.forEach(report -> {
|
|
groupedReports.forEach(report -> {
|
|
// 施工状态 数据字典 constructionStatus 施工3 动迁1
|
|
// 施工状态 数据字典 constructionStatus 施工3 动迁1
|
|
if (3 == report.getConstructionStatus()) {
|
|
if (3 == report.getConstructionStatus()) {
|
|
@@ -235,9 +234,9 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
moveDate.set(report.getConstructionStartDate());
|
|
moveDate.set(report.getConstructionStartDate());
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- }
|
|
|
|
|
|
+ } */
|
|
// 开工日期 搬迁日期 都存在 才能计算 搬迁安装天数
|
|
// 开工日期 搬迁日期 都存在 才能计算 搬迁安装天数
|
|
- if (ObjUtil.isNotEmpty(commencementDate.get()) && ObjUtil.isNotEmpty(moveDate.get())) {
|
|
|
|
|
|
+ /* if (ObjUtil.isNotEmpty(commencementDate.get()) && ObjUtil.isNotEmpty(moveDate.get())) {
|
|
LocalDateTime start = moveDate.get(); // 搬迁日期
|
|
LocalDateTime start = moveDate.get(); // 搬迁日期
|
|
LocalDateTime end = commencementDate.get(); // 开工日期(晚于搬迁日期)
|
|
LocalDateTime end = commencementDate.get(); // 开工日期(晚于搬迁日期)
|
|
// 计算时间差(Duration.between 接受 start 和 end 参数)
|
|
// 计算时间差(Duration.between 接受 start 和 end 参数)
|
|
@@ -247,7 +246,9 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
// 计算总天数(包括小数部分):总秒数除以一天的秒数(24 * 3600)
|
|
// 计算总天数(包括小数部分):总秒数除以一天的秒数(24 * 3600)
|
|
double totalDays = totalSeconds / (24.0 * 3600.0);
|
|
double totalDays = totalSeconds / (24.0 * 3600.0);
|
|
iotRhDailyReport.setRelocationDays(new BigDecimal(totalDays));
|
|
iotRhDailyReport.setRelocationDays(new BigDecimal(totalDays));
|
|
- }
|
|
|
|
|
|
+ } */
|
|
|
|
+ iotRhDailyReport.setCreateTime(reportDate);
|
|
|
|
+ iotRhDailyReport.setUpdateTime(reportDate);
|
|
iotRhDailyReportMapper.insert(iotRhDailyReport);
|
|
iotRhDailyReportMapper.insert(iotRhDailyReport);
|
|
} else {
|
|
} else {
|
|
// 修改现有记录
|
|
// 修改现有记录
|
|
@@ -294,7 +295,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
} */
|
|
} */
|
|
iotRhDailyReportMapper.updateById(iotRhDailyReport);
|
|
iotRhDailyReportMapper.updateById(iotRhDailyReport);
|
|
// 更新后再查询就是最新的值
|
|
// 更新后再查询就是最新的值
|
|
- IotRhDailyReportPageReqVO reportReqVO = new IotRhDailyReportPageReqVO();
|
|
|
|
|
|
+ /* IotRhDailyReportPageReqVO reportReqVO = new IotRhDailyReportPageReqVO();
|
|
reportReqVO.setTaskId(taskId);
|
|
reportReqVO.setTaskId(taskId);
|
|
List<IotRhDailyReportDO> groupedReports = iotRhDailyReportMapper.selectListGrouped(reportReqVO);
|
|
List<IotRhDailyReportDO> groupedReports = iotRhDailyReportMapper.selectListGrouped(reportReqVO);
|
|
if (CollUtil.isNotEmpty(groupedReports)) {
|
|
if (CollUtil.isNotEmpty(groupedReports)) {
|
|
@@ -320,7 +321,7 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
double totalDays = totalSeconds / (24.0 * 3600.0);
|
|
double totalDays = totalSeconds / (24.0 * 3600.0);
|
|
iotRhDailyReport.setRelocationDays(new BigDecimal(totalDays));
|
|
iotRhDailyReport.setRelocationDays(new BigDecimal(totalDays));
|
|
}
|
|
}
|
|
- iotRhDailyReportMapper.updateById(iotRhDailyReport);
|
|
|
|
|
|
+ iotRhDailyReportMapper.updateById(iotRhDailyReport); */
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -364,6 +365,8 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
return capacity.get();
|
|
return capacity.get();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public PageResult<IotRhDailyReportDO> dailyReportSummary(IotRhDailyReportPageReqVO pageReqVO) {
|
|
public PageResult<IotRhDailyReportDO> dailyReportSummary(IotRhDailyReportPageReqVO pageReqVO) {
|
|
// 查询 瑞恒兴域 下所有项目部级别的部门
|
|
// 查询 瑞恒兴域 下所有项目部级别的部门
|
|
@@ -440,4 +443,9 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
return dailyReports;
|
|
return dailyReports;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public List<IotRhDailyReportDO> relocationDays(IotRhDailyReportPageReqVO reqVO) {
|
|
|
|
+ return iotRhDailyReportMapper.relocationDays(reqVO);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|