1 년 전
부모
커밋
1bfc537316

+ 1 - 1
platform-rest/src/main/java/com/platform/rest/config/security/TokenEndpointAspect.java

@@ -239,4 +239,4 @@ public class TokenEndpointAspect {
     }
 
 
-}
+}

+ 23 - 0
platform-rest/src/main/java/com/platform/rest/controller/mobile/IgnoreController.java

@@ -132,6 +132,29 @@ public class IgnoreController {
                 .setRepairTask(repairTask));
     }
 
+    /**
+     * 统计设备相关的任务
+     * 保养任务
+     * 维修任务
+     *
+     * @return R
+     */
+    @GetMapping("/sb/task2/{sbId}")
+    public R getSbTaskUser2(@PathVariable("sbId") String sbId) {
+        // 保养任务:根据类型查询,1:设备的、设备使用人的,未完成的,已过期的
+        int lubricationTask = checkJobService.countTask2(sbId, null, CheckStandardTypeEnum.POLLING.getValue(), 1);
+        int lubricationTaskWeek = checkJobService.countTask2(sbId, null, CheckStandardTypeEnum.POLLING.getValue(), 2);
+        int lubricationTaskMonth = checkJobService.countTask2(sbId, null, CheckStandardTypeEnum.POLLING.getValue(), 3);
+
+        // 维修任务:所有的未完成的
+        int repairTask = repairApplicationFormService.countTask(sbId, null,  1);
+        return R.success(new GatherTaskVO()
+                .setLubricationTask(lubricationTask)
+                .setLubricationTaskWeek(lubricationTaskWeek)
+                .setLubricationTaskMonth(lubricationTaskMonth)
+                .setRepairTask(repairTask));
+    }
+
     /**
      * 新增记录
      *

+ 8 - 0
platform-service/src/main/java/com/platform/service/check/CheckJobService.java

@@ -1,8 +1,12 @@
 package com.platform.service.check;
 
 import com.platform.common.bean.AbstractPageResultBean;
+import com.platform.common.util.DateUtils;
+import com.platform.common.util.ListUtils;
+import com.platform.common.util.StringUtils;
 import com.platform.dao.dto.check.CheckJobDTO;
 import com.platform.dao.entity.check.CheckJob;
+import com.platform.dao.enums.CheckJobStatusEnum;
 import com.platform.dao.vo.query.check.CheckJobScreenVO;
 import com.platform.dao.vo.query.check.CheckJobVO;
 import com.platform.dao.vo.report.CheckJobReportVO;
@@ -10,6 +14,8 @@ import com.platform.dao.vo.report.CheckJobReportWeekHoursVO;
 import com.platform.dao.vo.tuicalendar.TuiCalendar;
 import com.platform.service.base.IBaseService;
 import org.springframework.web.multipart.MultipartFile;
+import tk.mybatis.mapper.weekend.Weekend;
+import tk.mybatis.mapper.weekend.WeekendCriteria;
 
 import java.time.LocalDate;
 import java.util.List;
@@ -21,6 +27,7 @@ import java.util.List;
  * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
  */
 public interface CheckJobService extends IBaseService<CheckJob, CheckJobDTO> {
+
     CheckJobVO getCheckJobVODetail(CheckJobDTO checkJobDTO);
 
 
@@ -133,6 +140,7 @@ public interface CheckJobService extends IBaseService<CheckJob, CheckJobDTO> {
     TuiCalendar getTuiCalendar(CheckJobDTO checkJobDTO);
 
     int countTask(String sbId, String userId, Integer type, Integer searchType);
+    int countTask2(String sbId, String userId, Integer type, Integer searchType);
     int countSbUserTask(String sbId, String userId, Integer type);
     List<CheckJobReportVO> getMonthReport(CheckJobDTO checkJobDTO, Integer month, LocalDate startMonth, LocalDate endMonth);
 

+ 43 - 1
platform-service/src/main/java/com/platform/service/check/impl/CheckJobServiceImpl.java

@@ -1354,7 +1354,7 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
                 if (searchType == 1) {
 //                    weekendCriteria.andLessThan(CheckJob::getStartTime, DateUtils.getTodayEndTime());
 //                    weekendCriteria.andBetween(CheckJob::getStartTime,DateUtils.getTodayStartTime(),DateUtils.getTodayEndTime());
-                    weekendCriteria.andLessThan(CheckJob::getStartTime,LocalDate.now());
+                    weekendCriteria.andLessThan(CheckJob::getStartTime,DateUtils.getTodayEndTime());
                 } else if (searchType == 2) {
                     // 查询当周的任务数
                     weekendCriteria.andLessThan(CheckJob::getStartTime, DateUtils.getSundayOfThisWeek());
@@ -1372,6 +1372,48 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
         return mapper.selectCountByExample(weekend);
     }
 
+    @Override
+    public int countTask2(String sbId, String userId, Integer type, Integer searchType) {
+        Weekend<CheckJob> weekend = new Weekend<>(CheckJob.class);
+        WeekendCriteria<CheckJob, Object> weekendCriteria = weekend.weekendCriteria();
+        if(StringUtils.isNotBlank(sbId)){
+            weekendCriteria.andEqualTo(CheckJob::getSbId, sbId);
+//            SbInfo sbInfo = sbInfoService.getModelById(sbId);
+////            weekendCriteria.andLessThan(CheckJob::getStartTime, DateUtils.getTodayEndTime());
+//            // 查找人员
+//            if(searchType != null) {
+//                if (searchType == 1) {
+//                    weekendCriteria.andEqualTo(CheckJob::getCheckUserId, sbInfo.getSaveUser());
+//                } else if (searchType == 2) {
+//                    weekendCriteria.andEqualTo(CheckJob::getCheckUserId, sbInfo.getRepairUser());
+//                }
+//            }
+        }
+//        if(StringUtils.isNotBlank(userId)){
+//            weekendCriteria.andEqualTo(CheckJob::getCheckUserId, userId);
+        if(searchType != null) {
+            // 查询当日的任务数
+            if (searchType == 1) {
+//                    weekendCriteria.andLessThan(CheckJob::getStartTime, DateUtils.getTodayEndTime());
+//                    weekendCriteria.andBetween(CheckJob::getStartTime,DateUtils.getTodayStartTime(),DateUtils.getTodayEndTime());
+                weekendCriteria.andLessThan(CheckJob::getStartTime, DateUtils.getTodayEndTime());
+            } else if (searchType == 2) {
+                // 查询当周的任务数
+                weekendCriteria.andLessThan(CheckJob::getStartTime, DateUtils.getSundayOfThisWeek());
+            } else if (searchType == 3) {
+                // 查询当月的任务数
+                weekendCriteria.andLessThan(CheckJob::getStartTime, DateUtils.getLastDayOfThisMonth());
+            }
+        }
+//        }
+        weekendCriteria.andEqualTo(CheckJob::getType, type);
+
+        List<Integer> statusList = ListUtils.newArrayList(CheckJobStatusEnum.NOT_EXECUTE.getValue(),
+                CheckJobStatusEnum.EXECUTING.getValue());
+        weekendCriteria.andIn(CheckJob::getStatus, statusList);
+        return mapper.selectCountByExample(weekend);
+    }
+
     /**
      * 查询任务
      * 未登录查询当日任务