手机端-任务统计-获取待办任务总数接口开发。

This commit is contained in:
wangzhijiang
2023-06-08 11:24:56 +08:00
parent 3cfd409afd
commit d861ec99fe
3 changed files with 133 additions and 0 deletions
@@ -0,0 +1,29 @@
package com.jero.modules.phone.controller;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.modules.phone.service.ITaskStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@Api(tags = "手机端-任务统计")
@RestController
@RequestMapping("/phone/taskStatistics")
public class TaskStatisticsController {
@Autowired
private ITaskStatisticsService taskStatisticsService;
@AutoLog(value = "手机端-任务统计-获取待办任务总数")
@ApiOperation(value = "手机端-任务统计-获取待办任务总数", notes = "手机端-任务统计-获取待办任务总数")
@GetMapping(value = "/getRegulatoryCertificationProcessDataCount")
public Result<Map<String, Object>> getRegulatoryCertificationProcessDataCount() {
return this.taskStatisticsService.getRegulatoryCertificationProcessDataCount();
}
}
@@ -0,0 +1,9 @@
package com.jero.modules.phone.service;
import com.jero.common.api.vo.Result;
import java.util.Map;
public interface ITaskStatisticsService {
Result<Map<String, Object>> getRegulatoryCertificationProcessDataCount();
}
@@ -0,0 +1,95 @@
package com.jero.modules.phone.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.api.vo.Result;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.phone.service.ITaskStatisticsService;
import com.jero.modules.project.enums.TaskStatusEnum;
import com.jero.modules.system.util.StringUtils;
import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO;
import com.jero.modules.todoCenter.entity.ProcessInfoEO;
import com.jero.modules.todoCenter.service.IProcessInfoDetailEOService;
import com.jero.modules.todoCenter.service.IProcessInfoEOService;
import com.jero.modules.wkflow.enums.FlowTypeEnum;
import org.apache.commons.collections.CollectionUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class TaskStatisticsServiceImpl implements ITaskStatisticsService {
@Autowired
private IProcessInfoEOService processInfoEOService;
@Autowired
private IProcessInfoDetailEOService processInfoDetailEOService;
@Override
public Result<Map<String, Object>> getRegulatoryCertificationProcessDataCount() {
Map<String, Object> result = new HashMap<>();
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
QueryWrapper<ProcessInfoDetailEO> pidQueryWrap = new QueryWrapper<>();
pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getUserId, currentUser.getId());
pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getStatus, TaskStatusEnum.NOT_DONE.getValue());
List<ProcessInfoDetailEO> pidEoList = this.processInfoDetailEOService.list(pidQueryWrap);
int publishingCount = 0;
int designCount = 0;
int verifyCount = 0;
int preHomoCount = 0;
int technologyEvaluationCount = 0;
int opinionCollectionCount = 0;
if (CollectionUtils.isNotEmpty(pidEoList)) {
List<String> processInfoIdList = pidEoList.stream().map(ProcessInfoDetailEO::getProcessInfoId).distinct().collect(Collectors.toList());
QueryWrapper<ProcessInfoEO> piQueryWrap = new QueryWrapper<>();
piQueryWrap.lambda().in(ProcessInfoEO::getId, processInfoIdList);
List<ProcessInfoEO> piEoList = this.processInfoEOService.list(piQueryWrap);
if (CollectionUtils.isNotEmpty(piEoList)) {
List<ProcessInfoEO> publishingList = piEoList.stream().filter(piEo -> {
return StringUtils.equals(piEo.getFlowType(), FlowTypeEnum.QDQR.getValue());
}).collect(Collectors.toList());
publishingCount = publishingList.size();
List<ProcessInfoEO> designList = piEoList.stream().filter(piEo -> {
return StringUtils.equals(piEo.getFlowType(), FlowTypeEnum.SJFHXSHLC.getValue());
}).collect(Collectors.toList());
designCount = designList.size();
List<ProcessInfoEO> verifyList = piEoList.stream().filter(piEo -> {
return StringUtils.equals(piEo.getFlowType(), FlowTypeEnum.YZFHXSCLC.getValue());
}).collect(Collectors.toList());
verifyCount = verifyList.size();
List<ProcessInfoEO> preHomoList = piEoList.stream().filter(piEo -> {
return StringUtils.equals(piEo.getFlowType(), FlowTypeEnum.CERTIFICATION_LC.getValue());
}).collect(Collectors.toList());
preHomoCount = preHomoList.size();
List<ProcessInfoEO> technologyEvaluationList = piEoList.stream().filter(piEo -> {
return StringUtils.equals(piEo.getFlowType(), FlowTypeEnum.FGJSPG.getValue());
}).collect(Collectors.toList());
technologyEvaluationCount = technologyEvaluationList.size();
List<ProcessInfoEO> opinionCollectionList = piEoList.stream().filter(piEo -> {
return StringUtils.equals(piEo.getFlowType(), FlowTypeEnum.FGYJSJLC.getValue());
}).collect(Collectors.toList());
opinionCollectionCount = opinionCollectionList.size();
}
}
result.put("publishingCount", publishingCount);
result.put("designCount", designCount);
result.put("verifyCount", verifyCount);
result.put("preHomoCount", preHomoCount);
result.put("technologyEvaluationCount", technologyEvaluationCount);
result.put("opinionCollectionCount", opinionCollectionCount);
return Result.OK(result);
}
}