根据冀北专责需求调整我的待办内容

1、取消展示终端监测计划;
2、增加技术监督测试计划展示;
This commit is contained in:
2024-09-24 14:03:54 +08:00
parent 320a236582
commit 3280c29013
8 changed files with 98 additions and 64 deletions

View File

@@ -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<WarningLeafletMapper,
@Resource
private DeptFeignClient deptFeignClient;
@Lazy
@Resource
private SupervisionGeneralSurveyPlanPOService supervisionGeneralSurveyPlanPOService;
@Resource
private FileStorageUtil fileStorageUtil;

View File

@@ -2,6 +2,7 @@ package com.njcn.supervision.service.survey;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam;
import com.njcn.bpm.pojo.vo.TodoVO;
import com.njcn.bpm.service.IBpmService;
import com.njcn.supervision.pojo.param.leaflet.WarningAddParam;
import com.njcn.supervision.pojo.param.survey.SurveyTestParam;
@@ -35,4 +36,10 @@ public interface ISurveyTestService extends IBpmService<SurveyTest> {
void initiateWarningLeaflet(WarningAddParam warningAddParam);
Boolean deleteSurveyPlanTest(List<String> supervisionId);
/**
* 获取当前用户的待办业务
* @return 待办业务
*/
List<TodoVO> getTodoBusiness();
}

View File

@@ -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<SurveyTestMapper, SurveyT
@Override
public Page<SurveyTestVO> surveyTestPage(SurveyTestParam.SurveyTestQueryParam surveyTestQueryParam) {
QueryWrapper<SurveyTestVO> surveyTestVOQueryWrapper = new QueryWrapper<>();
List<String> deptIds = new ArrayList<>();;
List<String> deptIds = new ArrayList<>();
if (Objects.nonNull(surveyTestQueryParam)) {
//添加上时间范围
surveyTestVOQueryWrapper.and(wrapper ->
@@ -126,8 +126,6 @@ public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyT
surveyTestVOQueryWrapper.eq("supervision_survey_test.status", surveyTestQueryParam.getStatus());
}
surveyTestVOQueryWrapper.eq(StringUtils.isNotBlank(surveyTestQueryParam.getSupvType()),"supervision_survey_plan.supv_type",surveyTestQueryParam.getSupvType());
//获取当前用户部门所有同事的id查看该部门下所有的数据
surveyTestVOQueryWrapper
.eq("supervision_survey_test.state", DataStateEnum.ENABLE.getCode())
.orderByDesc("supervision_survey_test.Update_Time");
@@ -232,15 +230,14 @@ public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyT
}
surveyTest.setState(DataStateEnum.ENABLE.getCode());
surveyTest.setCreateBy(RequestUtil.getUserIndex());
// surveyTest.setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
this.updateById(surveyTest);
// 发起 BPM 流程
if(Objects.equals(surveyTestParam.getSaveOrCheckflag(),"2")) {
Map<String, Object> processInstanceVariables = new HashMap<>();
Map<String, Object> 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<SurveyTestMapper, SurveyT
//处理历史流程id列表
String historyInstanceIds = InstanceUtil.dealHistoryId(surveyTest.getProcessInstanceId(), surveyTest.getHistoryInstanceId());
// 发起 BPM 流程
Map<String, Object> processInstanceVariables = new HashMap<>();
Map<String, Object> 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<SurveyTestMapper, SurveyT
.in(SurveyTest::getId, supervisionId));
}
/**
* 组装谐波普测的问题
* 格式planCreateTime发起的planName普测计划由负责人leader测试后于planComplateTime完成其中subName在本次普测计划测试中存在电能质量问题详细请查看附件
*/
private String assembleIssueDetail(SurveyTestVO surveyTestVO) {
return "变电站:".concat(surveyTestVO.getSubstationName())
.concat("")
.concat(LocalDateTimeUtil.format(surveyTestVO.getCreateTime(), DatePattern.CHINESE_DATE_PATTERN))
.concat("发起的")
.concat(surveyTestVO.getPlanName())
.concat("普测计划,由负责人")
.concat(surveyTestVO.getCompleteBy())
.concat("测试后,于")
.concat(LocalDateTimeUtil.format(surveyTestVO.getCompleteTime(), DatePattern.CHINESE_DATE_PATTERN))
.concat("完成变电站电能质量测试,")
.concat("在本次普测计划测试中存在电能质量问题,详细请查看问题附件");
@Override
public List<TodoVO> getTodoBusiness() {
List<TodoVO> todoVOList = new ArrayList<>();
//如果用户为管理员则不查
UserVO userVO = userFeignClient.getUserById(RequestUtil.getUserIndex()).getData();
if(Objects.nonNull(userVO) && userVO.getType() == 1){
return todoVOList;
}
QueryWrapper<SurveyTestVO> queryWrapper = new QueryWrapper<>();
List<String> 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<SurveyTestVO> 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;
}
}