ソースを参照

Merge branch 'fu-normal-push' of uskycloud/usky-modules into master

fuyuchuan 2 ヶ月 前
コミット
cc99199774

+ 11 - 11
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/PmWorkReportServiceImpl.java

@@ -256,16 +256,17 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
             throw new BusinessException("总工时超过24小时,请检查后提交!");
         }
 
-        LambdaQueryWrapper<PmWorkReport> wrapper = Wrappers.lambdaQuery();
-        wrapper.eq(PmWorkReport::getReportDate, pmWorkReport.getReportDate())
-                .eq(PmWorkReport::getSubmitterId, userId)
-                .eq(PmWorkReport::getTenantId, tenantId);
-        if (!pmWorkReportMapper.selectList(wrapper).isEmpty()) {
-            throw new BusinessException("今天已提交工作报告,请勿重复提交!");
-        }
-
         // 判断是否携带reportId,不写带则为新增报告,携带则为编辑(更新)报告
         if (rid == null) {
+            // 判断是否今天已提交过
+            LambdaQueryWrapper<PmWorkReport> wrapper = Wrappers.lambdaQuery();
+            wrapper.eq(PmWorkReport::getReportDate, pmWorkReport.getReportDate())
+                    .eq(PmWorkReport::getSubmitterId, userId)
+                    .eq(PmWorkReport::getTenantId, tenantId);
+            if (!pmWorkReportMapper.selectList(wrapper).isEmpty()) {
+                throw new BusinessException("今天已提交工作报告,请勿重复提交!");
+            }
+
             PmWorkReport newReport = new PmWorkReport();
             newReport.setReportDate(pmWorkReport.getReportDate());
             newReport.setSubmitterId(userId);
@@ -295,8 +296,7 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
                 pmWorkReportMapper.insert(newReport);
 
             } catch (Exception e) {
-                e.printStackTrace();
-                throw new BusinessException("新增报告异常!请联系管理员");
+                throw new BusinessException("新增报告异常!请联系管理员" + e);
             }
 
             // 获取报告中所有项目id
@@ -549,7 +549,7 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
             LocalDate firstMondayOfYear = firstDayOfYear.with(TemporalAdjusters.nextOrSame(DayOfWeek.MONDAY));
 
             DayOfWeek dayOfWeek = firstDayOfYear.getDayOfWeek();
-            if (dayOfWeek != DayOfWeek.MONDAY){
+            if (dayOfWeek != DayOfWeek.MONDAY) {
                 dateNum -= 1;
             }