fuyuhchuan 9 ماه پیش
والد
کامیت
79d3358e32

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

@@ -208,6 +208,11 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
         } else if (totalWorkTime == null || totalWorkTime.equals(BigDecimal.ZERO) || totalWorkTime.compareTo(BigDecimal.ZERO) < 0) {
             throw new BusinessException("工时不能为空!");
         }
+        LambdaQueryWrapper<PmWorkReport> reportWrapper = Wrappers.lambdaQuery();
+        reportWrapper.select(PmWorkReport::getId)
+                .eq(PmWorkReport::getReportDate, pmWorkReport.getReportDate())
+                .last("LIMIT 1");
+        List<PmWorkReport> repeat = this.list(reportWrapper);
         //判断是否携带reportId,不写带则为新增报告,携带则为编辑(更新)项目
         if (pmWorkReport.getId() == null) {
             PmWorkReport newReport = new PmWorkReport();
@@ -272,7 +277,7 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
                 newContent.setTenantId(SecurityUtils.getTenantId());
                 pmWorkContentMapper.insert(newContent);
             }
-        } else {
+        } else if (repeat.size() > 0) {
             PmWorkReport rp = new PmWorkReport();
             rp.setId(pmWorkReport.getId());
             rp.setReportDate(pmWorkReport.getReportDate());