xiongchao 3 년 전
부모
커밋
a3ecafe0e7

+ 6 - 3
platform-dao/src/main/java/com/platform/dao/vo/index/GatherTaskVO.java

@@ -27,11 +27,14 @@ public class GatherTaskVO extends BaseVO implements Serializable {
      * 现场保养任务
      */
     private Integer lubricationTask;
-
     /**
-     * weixiu人员保养任务
+     * 维修人员保养任务:当日
+     */
+    private Integer lubricationTaskMyDay;
+    /**
+     * 所有保养任务:当日
      */
-    private Integer lubricationTask2;
+    private Integer lubricationTaskAllDay;
     /**
      * 本周保养任务
      */

+ 35 - 2
platform-rest/src/main/java/com/platform/rest/controller/index/IndexController.java

@@ -17,6 +17,7 @@ import com.platform.service.wechat.model.request.template.WechatTemplateRequest;
 import com.platform.service.wechat.service.WeChatConnectService;
 import lombok.AllArgsConstructor;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -42,13 +43,15 @@ public class IndexController {
 
     /**
      * 统计用户的任务
+     * 当日的任务(截止到当前日期未完成的)
+     * 1周的任务
+     * 1个月的任务
      *
      * @return R
      */
     @GetMapping("/gather/task/user")
     public R gatherTaskUser() {
         UserInfo userInfo = SecurityUtils.getUserInfo();
-        // 根据登录用户的角色来设置周期,使用人员:1周的任务,维修人员1个月的任务
         List<String> roleCodes = userInfo.getRoleCodes();
         boolean isOperator = false;
         for(String roleCode:roleCodes){
@@ -69,10 +72,40 @@ public class IndexController {
         // 维修验收任务
         int repairCheckTask = repairApplicationFormService.countTask(null, userInfo.getUserId(), 3);
         return R.success(new GatherTaskVO()
-                .setLubricationTask2(lubricationTask)
+                .setLubricationTask(lubricationTask)
                 .setLubricationTaskWeek(lubricationTaskWeek)
                 .setLubricationTaskMonth(lubricationTaskMonth)
                 .setRepairTask(repairTask).setRepairCheckTask(repairCheckTask));
     }
 
+    /**
+     * 根据身份统计任务:当日(一直到当天未完成的)
+     * 1:维修人员:自己的任务,关于某一台设备
+     * 2:管理人员:设备所有的任务
+     *
+     * @return R
+     */
+    @GetMapping("/gather/task/role/{sbId}")
+    public R gatherTaskRole(@PathVariable(value = "sbId", required = false) String sbId) {
+        UserInfo userInfo = SecurityUtils.getUserInfo();
+        List<String> roleCodes = userInfo.getRoleCodes();
+        boolean isMM = false;
+        for(String roleCode:roleCodes){
+            System.out.println("roleCode: " + roleCode);
+            if(roleCode.equals(SysRoleCodeEnum.MM.name())){
+                isMM = true;
+                break;
+            }
+        }
+        // 当日,本周,本月待保养任务
+        int lubricationTaskMyDay = checkJobService.countSbUserTask(sbId, userInfo.getUserId(), CheckStandardTypeEnum.POLLING.getValue());
+        int lubricationTaskAllDay = 0;
+        if(isMM){
+            lubricationTaskAllDay = checkJobService.countSbUserTask(sbId, null, CheckStandardTypeEnum.POLLING.getValue());
+        }
+        return R.success(new GatherTaskVO()
+                .setLubricationTaskMyDay(lubricationTaskMyDay).setLubricationTaskAllDay(lubricationTaskAllDay));
+
+    }
+
 }

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

@@ -119,7 +119,7 @@ public class IgnoreController {
 
         // 维修任务:所有的未完成的
         int repairTask = repairApplicationFormService.countTask(sbId, null,  1);
-        return R.success(new GatherTaskVO().setLubricationTask(lubricationTask).setLubricationTask2(lubricationTask2).setRepairTask(repairTask));
+        return R.success(new GatherTaskVO().setLubricationTask(lubricationTask).setRepairTask(repairTask));
     }
 
     /**

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

@@ -104,6 +104,6 @@ public interface CheckJobService extends IBaseService<CheckJob, CheckJobDTO> {
     TuiCalendar getTuiCalendar(CheckJobDTO checkJobDTO);
 
     int countTask(String sbId, String userId, Integer type, Integer searchType);
-
+    int countSbUserTask(String sbId, String userId, Integer type);
     CheckJobReportVO getMonthReport(CheckJobDTO checkJobDTO, Integer month);
 }

+ 27 - 0
platform-service/src/main/java/com/platform/service/check/impl/CheckJobServiceImpl.java

@@ -896,6 +896,33 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
         return mapper.selectCountByExample(weekend);
     }
 
+    /**
+     * 查询任务
+     * 未登录查询当日任务
+     * 登录根据角色查询当日或者当月任务数量
+     *
+     * @param sbId:设备id
+     * @param userId:用户id
+     * @param type:类型
+     * @return
+     */
+    @Override
+    public int countSbUserTask(String sbId, String userId, Integer type ) {
+        Weekend<CheckJob> weekend = new Weekend<>(CheckJob.class);
+        WeekendCriteria<CheckJob, Object> weekendCriteria = weekend.weekendCriteria();
+        weekendCriteria.andEqualTo(CheckJob::getSbId, sbId);
+        weekendCriteria.andLessThan(CheckJob::getStartTime, DateUtils.getTodayEndTime());
+        if(StringUtils.isNotBlank(userId)){
+            weekendCriteria.andEqualTo(CheckJob::getCheckUserId, userId);
+        }
+        weekendCriteria.andEqualTo(CheckJob::getType, type);
+
+        List<Integer> statusList = ListUtils.newArrayList(CheckJobStatusEnum.NOT_EXECUTE.getValue(),
+                CheckJobStatusEnum.EXECUTING.getValue(), CheckJobStatusEnum.OUT_OF_DATE.getValue());
+        weekendCriteria.andIn(CheckJob::getStatus, statusList);
+        return mapper.selectCountByExample(weekend);
+    }
+
     private void saveFile(CheckJobDTO model) {
         List<SysFile> repairFileList = model.getImgList();
         List<SysFile> list = ListUtils.newArrayList();