Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

Zimo 1 dzień temu
rodzic
commit
3bd9d778cd

+ 3 - 3
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotrydailyreport/IotRyDailyReportMapper.java

@@ -264,8 +264,8 @@ public interface IotRyDailyReportMapper extends BaseMapperX<IotRyDailyReportDO>
         List<IotRyDailyReportDO> list = selectList(new LambdaQueryWrapperX<IotRyDailyReportDO>()
                 .eq(ObjUtil.isNotNull(deptId), IotRyDailyReportDO::getDeptId, deptId)
                 .lt(IotRyDailyReportDO::getCreateTime, reportDate)
-                .apply("YEAR(construction_start_date) = {0}", year)
-                .apply("MONTH(construction_start_date) = {0}", month));
+                .apply("YEAR(create_time) = {0}", year)
+                .apply("MONTH(create_time) = {0}", month));
 
         return list.stream()
                 .map(IotRyDailyReportDO::getDailyFootage)
@@ -315,7 +315,7 @@ public interface IotRyDailyReportMapper extends BaseMapperX<IotRyDailyReportDO>
         List<IotRyDailyReportDO> list = selectList(new LambdaQueryWrapperX<IotRyDailyReportDO>()
                 .eq(ObjUtil.isNotNull(deptId), IotRyDailyReportDO::getDeptId, deptId)
                 .lt(IotRyDailyReportDO::getCreateTime, reportDate)
-                .apply("YEAR(construction_start_date) = {0}", year));
+                .apply("YEAR(create_time) = {0}", year));
 
         return list.stream()
                 .map(IotRyDailyReportDO::getDailyFootage)

+ 19 - 4
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrhdailyreport/IotRhDailyReportServiceImpl.java

@@ -295,15 +295,30 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
         AtomicBoolean noDeviceTeam = new AtomicBoolean(false);
 
         if (ObjUtil.isEmpty(existReport)) {
-
             // 新增日报记录 如果是 无施工设备的队伍 status auditStatus 需要单独处理
             if (CollUtil.isNotEmpty(teamStatusL)) {
-                iotRhDailyReport.setStatus(0);
-                iotRhDailyReport.setAuditStatus(0);
+                // 自动生成的日报 设置 填报完成 审批通过
+                iotRhDailyReport.setStatus(1);
+                iotRhDailyReport.setAuditStatus(20);
                 // 如果是自动生成的日报 需要根据规则设备 非生产时间
                 // 设备状态为 "动迁" 时,系统生成的日报里面,非生产时间内的 "生产组织"(rectification_time) 时间为24小时;
                 // 设备状态为 "完工" 时,系统生成的日报里面,非生产时间内的 "待命"(winter_break_time) 时间为24小时
-
+                Set<String> dqStatuses = new HashSet<>();
+                Set<String> wgStatuses = new HashSet<>();
+                teamStatusL.forEach(status -> {
+                    String deviceStatus = status.getDeviceStatus();
+                    if ("dq".equals(deviceStatus)) {
+                        dqStatuses.add(deviceStatus);
+                    } else if ("wg".equals(deviceStatus)) {
+                        wgStatuses.add(deviceStatus);
+                    }
+                });
+                if (CollUtil.isNotEmpty(dqStatuses)) {
+                    iotRhDailyReport.setRectificationTime(BigDecimal.valueOf(24));
+                }
+                if (CollUtil.isNotEmpty(wgStatuses)) {
+                    iotRhDailyReport.setWinterBreakTime(BigDecimal.valueOf(24));
+                }
             }
 
             // 今天下午4点