Преглед на файлове

周报告接口调整接口代码,携带项目id查询不需要时间条件

fuyuchuan преди 6 месеца
родител
ревизия
01a93adbed
променени са 1 файла, в които са добавени 24 реда и са изтрити 22 реда
  1. 24 22
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/PmWorkReportServiceImpl.java

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

@@ -112,9 +112,11 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
         }
         // 固定返回七条数据,没有内容也要设置时间给前端渲染
         LambdaQueryWrapper<PmWorkReport> queryWrapperR = Wrappers.lambdaQuery();
-        queryWrapperR.eq(PmWorkReport::getSubmitterId, SecurityUtils.getUserId())
-                .between(PmWorkReport::getReportDate, startDate1, endDate1)
-                .orderByAsc(PmWorkReport::getReportDate)
+        queryWrapperR.eq(PmWorkReport::getSubmitterId, SecurityUtils.getUserId());
+        if (reportId == 0) {
+            queryWrapperR.between(PmWorkReport::getReportDate, startDate1, endDate1);
+        }
+        queryWrapperR.orderByAsc(PmWorkReport::getReportDate)
                 .apply(reportId != 0, "id = " + reportId);
         List<PmWorkReport> reports = baseMapper.selectList(queryWrapperR);
         if (reports.isEmpty()) {
@@ -216,25 +218,25 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
         List<PmWorkContent> workContents = pmWorkReport.getWorkContents();
         if (workContents == null) {
             throw new BusinessException("报告内容不能为空,请检查!");
-        } else{
-           for (PmWorkContent workContent : workContents){
-               BigDecimal workTime = workContent.getWorkTime();
-               // 单个工时大于零
-               if (workTime == null){
-                   throw new BusinessException("工时不能为空,请检查!");
-               }
-               if (workTime.compareTo(BigDecimal.ZERO) <= 0){
-                   throw new BusinessException("工时必须大于零!");
-               }
-
-               String workContent1 = workContent.getWorkContent();
-               //工作内容不允许为空或空字符串
-               if (StringUtils.isBlank(workContent1)){
-                   throw new BusinessException("工作内容不能为空,请检查!");
-               }
-           }
+        } else {
+            for (PmWorkContent workContent : workContents) {
+                BigDecimal workTime = workContent.getWorkTime();
+                // 单个工时大于零
+                if (workTime == null) {
+                    throw new BusinessException("工时不能为空,请检查!");
+                }
+                if (workTime.compareTo(BigDecimal.ZERO) <= 0) {
+                    throw new BusinessException("工时必须大于零!");
+                }
+
+                String workContent1 = workContent.getWorkContent();
+                // 工作内容不允许为空或空字符串
+                if (StringUtils.isBlank(workContent1)) {
+                    throw new BusinessException("工作内容不能为空,请检查!");
+                }
+            }
         }
-            Set<Integer> projectIds2 = new HashSet<>();
+        Set<Integer> projectIds2 = new HashSet<>();
         for (PmWorkContent workContent : pmWorkReport.getWorkContents()) {
             if (!projectIds2.add(workContent.getProjectId())) {
                 throw new BusinessException("存在重复项目,请检查!");
@@ -596,7 +598,7 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
     @Transactional
     @Override
     public void deleteContent(Integer reportId) {
-        if (reportId == null || reportId < 0){
+        if (reportId == null || reportId < 0) {
             throw new BusinessException("报告id不正确,删除报告失败!");
         }