diff --git a/pqs-bpm/bpm-api/src/main/java/com/njcn/bpm/enums/BpmProcessInstanceStatusEnum.java b/pqs-bpm/bpm-api/src/main/java/com/njcn/bpm/enums/BpmProcessInstanceStatusEnum.java index e87592808..cd854d2a6 100644 --- a/pqs-bpm/bpm-api/src/main/java/com/njcn/bpm/enums/BpmProcessInstanceStatusEnum.java +++ b/pqs-bpm/bpm-api/src/main/java/com/njcn/bpm/enums/BpmProcessInstanceStatusEnum.java @@ -14,6 +14,7 @@ import java.util.Arrays; @AllArgsConstructor public enum BpmProcessInstanceStatusEnum implements IntArrayValuable { + AWAIT(0, "待提交审批"), RUNNING(1, "审批中"), APPROVE(2, "审批通过"), REJECT(3, "审批不通过"), diff --git a/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/controller/BpmTaskController.java b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/controller/BpmTaskController.java index d76e067ea..c0bb49984 100644 --- a/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/controller/BpmTaskController.java +++ b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/controller/BpmTaskController.java @@ -49,10 +49,7 @@ import org.springframework.web.bind.annotation.*; import org.flowable.task.api.history.HistoricTaskInstance; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -151,23 +148,21 @@ public class BpmTaskController extends BaseController { public HttpResult> allTodoList() { String methodDescribe = getMethodDescribe("allTodoList"); List result = new ArrayList<>(); - // 获取当前用户所有不通过的工作流程 List rejectProcessInstanceList = getRejectProcessInstanceList(); if(CollectionUtil.isNotEmpty(rejectProcessInstanceList)){ // 转为统一的todoVO3 result.addAll(TodoVOConvert.convertByBpmProcessInstance(rejectProcessInstanceList)); } - // 获取当前用户所有待办工作流程 HttpResult> todoAllList = this.todoAllList(); if(CollectionUtil.isNotEmpty(todoAllList.getData())){ // 转为统一的todoVO3 result.addAll(TodoVOConvert.convertByBpmTaskVO(todoAllList.getData())); } - // 获取没有流程的一些待办信息 result.addAll(businessCommonFeignClient.getTodoBusiness().getData()); + result = result.stream().sorted(Comparator.comparing(TodoVO::getTaskCreateTime).reversed()).collect(Collectors.toList()); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); } diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/BusinessCommonController.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/BusinessCommonController.java index 45ab9a643..e084797ed 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/BusinessCommonController.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/BusinessCommonController.java @@ -1,5 +1,6 @@ package com.njcn.supervision.controller; +import cn.hutool.core.text.StrPool; import cn.hutool.extra.spring.SpringUtil; import com.njcn.bpm.pojo.dto.BpmInstanceInfo; import com.njcn.bpm.pojo.vo.TodoVO; @@ -12,8 +13,8 @@ import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.utils.HttpResultUtil; import com.njcn.supervision.enums.SupervisionKeyEnum; import com.njcn.supervision.enums.SupervisionResponseEnum; -import com.njcn.supervision.service.device.ICheckDeviceService; import com.njcn.supervision.service.leaflet.IWarningLeafletService; +import com.njcn.supervision.service.survey.ISurveyTestService; import com.njcn.web.controller.BaseController; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -43,7 +44,7 @@ public class BusinessCommonController extends BaseController { private IWarningLeafletService warningLeafletService; @Resource - private ICheckDeviceService checkDeviceService; + private ISurveyTestService surveyTestService; @ApiIgnore @@ -106,7 +107,7 @@ public class BusinessCommonController extends BaseController { List todoVOList = new ArrayList<>(); //可能需要判断当前用户是否需要处理这些待办,比如专职下发的预告警单,应该由负责单位去处理 todoVOList.addAll(warningLeafletService.getTodoBusiness()); - todoVOList.addAll(checkDeviceService.getTodoBusiness()); + todoVOList.addAll(surveyTestService.getTodoBusiness()); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, todoVOList, methodDescribe); } @@ -119,7 +120,8 @@ public class BusinessCommonController extends BaseController { private void getBpmServiceByBusinessStatusKey(String processKey, String businessId, String reason, Integer status) { String fullServicePath = SupervisionKeyEnum.getFullServicePathByKey(processKey); try { - if ("SupervisionTempLineRunTestServiceImpl".equals(fullServicePath.substring(fullServicePath.lastIndexOf(".") + 1))) { + assert fullServicePath != null; + if ("SupervisionTempLineRunTestServiceImpl".equals(fullServicePath.substring(fullServicePath.lastIndexOf(StrPool.DOT) + 1))) { IBpmReasonService iBpmService = (IBpmReasonService) SpringUtil.getBean(Class.forName(fullServicePath)); iBpmService.updateProcessStatus(businessId, reason, status); } else { @@ -142,7 +144,8 @@ public class BusinessCommonController extends BaseController { String fullServicePath = SupervisionKeyEnum.getFullServicePathByKey(processKey); BpmInstanceInfo instanceInfo; try { - if ("SupervisionTempLineRunTestServiceImpl".equals(fullServicePath.substring(fullServicePath.lastIndexOf(".") + 1))) { + assert fullServicePath != null; + if ("SupervisionTempLineRunTestServiceImpl".equals(fullServicePath.substring(fullServicePath.lastIndexOf(StrPool.DOT) + 1))) { IBpmReasonService iBpmService = (IBpmReasonService) SpringUtil.getBean(Class.forName(fullServicePath)); instanceInfo = iBpmService.getInstanceInfo(businessId); } else { @@ -155,21 +158,4 @@ public class BusinessCommonController extends BaseController { return instanceInfo; } - - /** - * 根据业务流key获取实现类对象 - * - * @param processKey 业务流key - */ - private IBpmService getBpmServiceByBusinessKey(String processKey) { - String fullServicePath = SupervisionKeyEnum.getFullServicePathByKey(processKey); - IBpmService executor; - try { - executor = (IBpmService) SpringUtil.getBean(Class.forName(fullServicePath)); - } catch (ClassNotFoundException e) { - throw new BusinessException(SupervisionResponseEnum.SUPERVISION_SERVICE_NOT_FOUND); - } - return executor; - } - } diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/survey/SurveyTestMapper.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/survey/SurveyTestMapper.java index 6a85f4d1b..d4bf6bb1b 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/survey/SurveyTestMapper.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/survey/SurveyTestMapper.java @@ -7,6 +7,8 @@ import com.njcn.supervision.pojo.po.survey.SurveyTest; import com.njcn.supervision.pojo.vo.survey.SurveyTestVO; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** *

* 普测测试的管理表 Mapper 接口 @@ -18,4 +20,11 @@ import org.apache.ibatis.annotations.Param; public interface SurveyTestMapper extends BaseMapper { Page surveyTestPage(Page objectPage, @Param("ew")QueryWrapper surveyTestVOQueryWrapper); + + /** + * 根据条件查询待测试的计划 + * @param queryWrapper 查询条件 + * @return 待测试的计划 + */ + List getTodoBusiness(@Param("ew")QueryWrapper queryWrapper); } diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/survey/mapping/SurveyTestMapper.xml b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/survey/mapping/SurveyTestMapper.xml index a3f5e7617..b49a0bc29 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/survey/mapping/SurveyTestMapper.xml +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/survey/mapping/SurveyTestMapper.xml @@ -17,4 +17,21 @@ WHERE ${ew.sqlSegment} + + diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/leaflet/impl/WarningLeafletServiceImpl.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/leaflet/impl/WarningLeafletServiceImpl.java index 6a3f20c4f..0d03cdefd 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/leaflet/impl/WarningLeafletServiceImpl.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/leaflet/impl/WarningLeafletServiceImpl.java @@ -6,7 +6,6 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.LocalDateTimeUtil; -import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -27,16 +26,12 @@ import com.njcn.oss.utils.FileStorageUtil; import com.njcn.supervision.enums.*; import com.njcn.supervision.mapper.leaflet.WarningLeafletMapper; import com.njcn.supervision.pojo.param.leaflet.WarningLeafletParam; -import com.njcn.supervision.pojo.po.device.CheckDevice; -import com.njcn.supervision.pojo.po.device.SupervisionTempLineDebugPO; -import com.njcn.supervision.pojo.po.device.SupervisionTempLineRunTestPO; import com.njcn.supervision.pojo.po.device.TempLineRunTestWarning; import com.njcn.supervision.pojo.po.leaflet.WarningLeaflet; import com.njcn.supervision.pojo.vo.leaflet.WarningLeafletVO; import com.njcn.supervision.service.device.TempLineRunTestWarningService; import com.njcn.supervision.service.leaflet.IWarningLeafletService; import com.njcn.supervision.service.survey.ISurveyTestService; -import com.njcn.supervision.service.survey.SupervisionGeneralSurveyPlanPOService; import com.njcn.supervision.utils.InstanceUtil; import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.enums.DicDataTypeEnum; @@ -79,9 +74,6 @@ public class WarningLeafletServiceImpl extends ServiceImpl { void initiateWarningLeaflet(WarningAddParam warningAddParam); Boolean deleteSurveyPlanTest(List supervisionId); + + /** + * 获取当前用户的待办业务 + * @return 待办业务 + */ + List getTodoBusiness(); } diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/survey/impl/SurveyTestServiceImpl.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/survey/impl/SurveyTestServiceImpl.java index 64f9d8ef4..be85b4a97 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/survey/impl/SurveyTestServiceImpl.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/survey/impl/SurveyTestServiceImpl.java @@ -20,19 +20,18 @@ import com.njcn.bpm.enums.BpmTaskStatusEnum; import com.njcn.bpm.pojo.dto.BpmInstanceInfo; import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO; import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam; +import com.njcn.bpm.pojo.vo.TodoVO; import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.exception.BusinessException; -import com.njcn.device.pms.pojo.po.PmsNewEnergy; import com.njcn.device.pq.api.LineFeignClient; import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO; import com.njcn.supervision.enums.*; import com.njcn.supervision.mapper.survey.SurveyTestMapper; import com.njcn.supervision.pojo.param.leaflet.WarningAddParam; import com.njcn.supervision.pojo.param.survey.SurveyTestParam; -import com.njcn.supervision.pojo.po.device.CheckDevice; -import com.njcn.supervision.pojo.po.leaflet.WarningLeaflet; import com.njcn.supervision.pojo.po.survey.SurveyPlan; import com.njcn.supervision.pojo.po.survey.SurveyTest; +import com.njcn.supervision.pojo.vo.leaflet.WarningLeafletVO; import com.njcn.supervision.pojo.vo.survey.SurveyTestVO; import com.njcn.supervision.service.leaflet.IWarningLeafletService; import com.njcn.supervision.service.survey.ISurveyPlanService; @@ -42,6 +41,7 @@ import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.pojo.po.DictData; import com.njcn.user.api.DeptFeignClient; import com.njcn.user.api.UserFeignClient; +import com.njcn.user.pojo.vo.UserVO; import com.njcn.web.factory.PageFactory; import com.njcn.web.utils.RequestUtil; import org.apache.commons.lang.StringUtils; @@ -88,7 +88,7 @@ public class SurveyTestServiceImpl extends ServiceImpl surveyTestPage(SurveyTestParam.SurveyTestQueryParam surveyTestQueryParam) { QueryWrapper surveyTestVOQueryWrapper = new QueryWrapper<>(); - List deptIds = new ArrayList<>();; + List deptIds = new ArrayList<>(); if (Objects.nonNull(surveyTestQueryParam)) { //添加上时间范围 surveyTestVOQueryWrapper.and(wrapper -> @@ -126,8 +126,6 @@ public class SurveyTestServiceImpl extends ServiceImpl processInstanceVariables = new HashMap<>(); + Map processInstanceVariables = new HashMap<>(16); BpmProcessInstanceCreateReqDTO bpmProcessInstanceCreateReqDTO = new BpmProcessInstanceCreateReqDTO(); bpmProcessInstanceCreateReqDTO.setProcessDefinitionKey(SupervisionKeyEnum.SURVEY_TEST.getKey()); bpmProcessInstanceCreateReqDTO.setBusinessKey(surveyTest.getId()); - bpmProcessInstanceCreateReqDTO.setStartUserSelectAssignees(new HashMap<>()); + bpmProcessInstanceCreateReqDTO.setStartUserSelectAssignees(new HashMap<>(8)); bpmProcessInstanceCreateReqDTO.setVariables(processInstanceVariables); String processInstanceId = bpmProcessFeignClient.createProcessInstance(surveyTest.getCreateBy(), bpmProcessInstanceCreateReqDTO).getData(); // 将工作流的编号,更新到流程单中 @@ -264,11 +261,11 @@ public class SurveyTestServiceImpl extends ServiceImpl processInstanceVariables = new HashMap<>(); + Map processInstanceVariables = new HashMap<>(16); BpmProcessInstanceCreateReqDTO bpmProcessInstanceCreateReqDTO = new BpmProcessInstanceCreateReqDTO(); bpmProcessInstanceCreateReqDTO.setProcessDefinitionKey(SupervisionKeyEnum.SURVEY_TEST.getKey()); bpmProcessInstanceCreateReqDTO.setBusinessKey(surveyTest.getId()); - bpmProcessInstanceCreateReqDTO.setStartUserSelectAssignees(new HashMap<>()); + bpmProcessInstanceCreateReqDTO.setStartUserSelectAssignees(new HashMap<>(8)); bpmProcessInstanceCreateReqDTO.setVariables(processInstanceVariables); String processInstanceId = bpmProcessFeignClient.createProcessInstance(RequestUtil.getUserIndex(), bpmProcessInstanceCreateReqDTO).getData(); // 将工作流的编号,更新到流程单中 @@ -422,21 +419,51 @@ public class SurveyTestServiceImpl extends ServiceImpl getTodoBusiness() { + List todoVOList = new ArrayList<>(); + //如果用户为管理员则不查 + UserVO userVO = userFeignClient.getUserById(RequestUtil.getUserIndex()).getData(); + if(Objects.nonNull(userVO) && userVO.getType() == 1){ + return todoVOList; + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + List deptIds = deptFeignClient.getDepSonIdtByDeptId(RequestUtil.getDeptIndex()).getData(); + if(CollectionUtil.isEmpty(deptIds)){ + return todoVOList; + } + queryWrapper.in("supervision_survey_test.dept_id", deptIds) + .eq("supervision_survey_test.state", DataStateEnum.ENABLE.getCode()) + .eq("supervision_survey_test.status", BpmProcessInstanceStatusEnum.AWAIT.getStatus()) + .orderByDesc("supervision_survey_test.Update_Time"); + List surveyTestVOList = this.baseMapper.getTodoBusiness(queryWrapper); + if(CollectionUtil.isNotEmpty(surveyTestVOList)){ + todoVOList = surveyTestVOList.stream().map(item -> { + + if (item.getCustomSubstationFlag() == 0) { + //关联台账内的变电站名称 + String substation = item.getSubstation(); + if(StringUtils.isNotEmpty(substation)){ + item.setSubstationName(lineFeignClient.getSubstationInfo(substation).getData().getName()); + } + } else { + item.setSubstationName(item.getSubstation()); + } + TodoVO todoVO = new TodoVO(); + todoVO.setTaskName("技术监督测试"); + todoVO.setTaskContent(item.getSubstationName()); + todoVO.setStartUser(item.getCreateBy()); + todoVO.setId(item.getId()); + todoVO.setTaskCreateTime(item.getCreateTime()); + todoVO.setSource(3); + todoVO.setRoutePath("supervision/harmonicmanagement"); + todoVO.setTabValue(2); + return todoVO; + + }).collect(Collectors.toList()); + } + return todoVOList; } + + }