工作流程审核不通过、预告警单处理、终端周期检测等需求

1、提交了主pom,因为需要引入达梦数据量;
2、提交了gateway的配置文件,因为部分接口没有添加到权限中,待后续增加后再注释
This commit is contained in:
2024-09-13 20:31:32 +08:00
parent 06493c07c3
commit ba6762587f
50 changed files with 1144 additions and 110 deletions

View File

@@ -2,6 +2,7 @@ package com.njcn.supervision.controller;
import cn.hutool.extra.spring.SpringUtil;
import com.njcn.bpm.pojo.dto.BpmInstanceInfo;
import com.njcn.bpm.pojo.vo.TodoVO;
import com.njcn.bpm.service.IBpmReasonService;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
@@ -11,6 +12,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.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -22,6 +25,12 @@ import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import com.njcn.bpm.service.IBpmService;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@Slf4j
@RestController
@RequestMapping("/supervision")
@@ -30,6 +39,12 @@ import com.njcn.bpm.service.IBpmService;
@ApiIgnore
public class BusinessCommonController extends BaseController {
@Resource
private IWarningLeafletService warningLeafletService;
@Resource
private ICheckDeviceService checkDeviceService;
@ApiIgnore
@GetMapping("/updateProcessStatus")
@@ -47,10 +62,55 @@ public class BusinessCommonController extends BaseController {
@ApiOperation("获取业务数据")
public HttpResult<BpmInstanceInfo> getInstanceInfo(String processKey, String businessId) {
String methodDescribe = getMethodDescribe("getInstanceInfo");
BpmInstanceInfo instanceInfo = getBpmServiceByBusinessKey(processKey,businessId);
BpmInstanceInfo instanceInfo = getBpmServiceByBusinessKey(processKey, businessId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, instanceInfo, methodDescribe);
}
@ApiIgnore
@GetMapping("/getAllRejectInstanceId")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("获取当前用户所有不通过的流程实例ID")
public HttpResult<Set<String>> getAllRejectInstanceId() {
String methodDescribe = getMethodDescribe("getAllRejectInstanceId");
Set<String> instanceIdList = new HashSet<>();
List<String> fullServicePathList = SupervisionKeyEnum.getAllFullServicePath();
for (String fullServicePath : fullServicePathList) {
IBpmService executor;
IBpmReasonService executorReason;
try {
if(fullServicePath.contains("SupervisionTempLineRunTestServiceImpl")){
executorReason = (IBpmReasonService) SpringUtil.getBean(Class.forName(fullServicePath));
instanceIdList.addAll(executorReason.getAllRejectInstanceIds());
}else{
executor = (IBpmService) SpringUtil.getBean(Class.forName(fullServicePath));
instanceIdList.addAll(executor.getAllRejectInstanceIds());
}
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, instanceIdList, methodDescribe);
}
/**
* 目前不涉及流程的待办工作有
* 1.预告警单
* 2.终端周期到期待检测
*/
@ApiIgnore
@GetMapping("/getTodoBusiness")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("获取当前用户待办的业务")
public HttpResult<List<TodoVO>> getTodoBusiness() {
String methodDescribe = getMethodDescribe("getTodoBusiness");
List<TodoVO> todoVOList = new ArrayList<>();
//可能需要判断当前用户是否需要处理这些待办,比如专职下发的预告警单,应该由负责单位去处理
todoVOList.addAll(warningLeafletService.getTodoBusiness());
todoVOList.addAll(checkDeviceService.getTodoBusiness());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, todoVOList, methodDescribe);
}
/**
* 根据业务流key获取实现类对象
*
@@ -59,7 +119,7 @@ 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))) {
if ("SupervisionTempLineRunTestServiceImpl".equals(fullServicePath.substring(fullServicePath.lastIndexOf(".") + 1))) {
IBpmReasonService iBpmService = (IBpmReasonService) SpringUtil.getBean(Class.forName(fullServicePath));
iBpmService.updateProcessStatus(businessId, reason, status);
} else {
@@ -73,7 +133,6 @@ public class BusinessCommonController extends BaseController {
}
/**
* 根据业务流key获取实现类对象
*
@@ -81,9 +140,9 @@ public class BusinessCommonController extends BaseController {
*/
private BpmInstanceInfo getBpmServiceByBusinessKey(String processKey, String businessId) {
String fullServicePath = SupervisionKeyEnum.getFullServicePathByKey(processKey);
BpmInstanceInfo instanceInfo ;
BpmInstanceInfo instanceInfo;
try {
if ("SupervisionTempLineRunTestServiceImpl".equals(fullServicePath.substring(fullServicePath.lastIndexOf(".")+1))) {
if ("SupervisionTempLineRunTestServiceImpl".equals(fullServicePath.substring(fullServicePath.lastIndexOf(".") + 1))) {
IBpmReasonService iBpmService = (IBpmReasonService) SpringUtil.getBean(Class.forName(fullServicePath));
instanceInfo = iBpmService.getInstanceInfo(businessId);
} else {
@@ -97,9 +156,6 @@ public class BusinessCommonController extends BaseController {
}
/**
* 根据业务流key获取实现类对象
*

View File

@@ -96,6 +96,7 @@ public class SurveyPlanController extends BaseController {
public HttpResult<SurveyPlanVO> getById(String id) {
String methodDescribe = getMethodDescribe("getById");
SurveyPlanVO surveyPlanVO = surveyPlanService.getVOById(id);
System.out.println(surveyPlanVO);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, surveyPlanVO, methodDescribe);
}

View File

@@ -10,6 +10,7 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.supervision.pojo.param.user.UserReportParam;
import com.njcn.supervision.pojo.vo.user.UserReportVO;
import com.njcn.supervision.service.user.IUserReportNormalService;
import com.njcn.supervision.service.user.UserReportPOService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
@@ -43,6 +44,8 @@ public class UserReportManageController extends BaseController {
private final UserReportPOService userReportPOService;
private final IUserReportNormalService userReportNormalService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@PostMapping("/add")
@ApiOperation("新增干扰源用户")
@@ -84,6 +87,16 @@ public class UserReportManageController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe);
}
@GetMapping("/getUserReportById")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("根据id获取用户档案录入数据")
public HttpResult<UserReportVO> getUserReportById(String id) {
String methodDescribe = getMethodDescribe("getUserReportById");
UserReportVO userReportVO = userReportPOService.getUserReportById(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportVO, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/removeUserReport")
@ApiOperation("删除干扰源用户记录")
@@ -102,6 +115,17 @@ public class UserReportManageController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportVO, methodDescribe);
}
@GetMapping("/getUserReportByFangAnId")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("根据id获取用户档案录入的详细数据")
public HttpResult<UserReportVO.UserReportListVO> getUserReportByFangAnId(String id) {
String methodDescribe = getMethodDescribe("getUserReportByFangAnId");
UserReportVO.UserReportListVO userReportVO = userReportNormalService.getUserReportByFangAnId(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportVO, methodDescribe);
}
@GetMapping("/updateUserReportStatus")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)

View File

@@ -7,6 +7,8 @@ import com.njcn.supervision.pojo.po.device.CheckDevice;
import com.njcn.supervision.pojo.vo.device.CheckDeviceVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 终端周期检测表 Mapper 接口
@@ -21,4 +23,5 @@ public interface CheckDeviceMapper extends MppBaseMapper<CheckDevice> {
CheckDeviceVo getInfo(@Param("id") String id);
List<CheckDeviceVo> selectVOList(@Param("ew")QueryWrapper<CheckDeviceVo> queryWrapper);
}

View File

@@ -35,4 +35,24 @@
where A.Id = #{id}
</select>
<select id="selectVOList" resultType="CheckDeviceVo">
select
A.*,
B.Name deviceName,
B1.Name substation,
B2.Name dept,
C.This_Time_Check thisTimeCheck,
C.Next_Time_Check nextTimeCheck
from
supervision_check_device A
left join pq_line B on A.device_id = B.Id
left join pq_line B1 on B.Pid = B1.Id
left join pq_line B2 on B1.Pid = B2.Id
left join pq_device C on A.device_id = C.Id
<where>
and ${ew.sqlSegment}
</where>
</select>
</mapper>

View File

@@ -7,6 +7,8 @@ import com.njcn.supervision.pojo.po.leaflet.WarningLeaflet;
import com.njcn.supervision.pojo.vo.leaflet.WarningLeafletVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 预告警单表 Mapper 接口
@@ -20,4 +22,6 @@ public interface WarningLeafletMapper extends BaseMapper<WarningLeaflet> {
Page<WarningLeafletVO> warningPageData(Page<Object> objectPage, @Param("ew") QueryWrapper<WarningLeafletVO> warningLeafletVOQueryWrapper);
Page<WarningLeafletVO> alarmPageData(Page<Object> objectPage, @Param("ew") QueryWrapper<WarningLeafletVO> warningLeafletVOQueryWrapper);
List<WarningLeafletVO> getTodoBusiness(@Param("ew")QueryWrapper<WarningLeafletVO> queryWrapper);
}

View File

@@ -55,4 +55,30 @@
WHERE ${ew.sqlSegment}
</select>
<select id="getTodoBusiness" resultType="WarningLeafletVO">
SELECT
supervision_warning_leaflet.leaflet_name,
supervision_warning_leaflet.leaflet_no,
supervision_warning_leaflet.problem_type,
supervision_warning_leaflet.problem_id,
supervision_warning_leaflet.dept_id as duty_Org_Id,
supervision_warning_leaflet.leaflet_type,
supervision_warning_leaflet.STATUS,
supervision_warning_leaflet.id,
supervision_warning_leaflet.process_instance_id,
supervision_warning_leaflet.history_instance_id,
supervision_warning_leaflet.issue_detail,
supervision_warning_leaflet.reform_advice,
supervision_warning_leaflet.take_step,
supervision_warning_leaflet.report_path,
supervision_warning_leaflet.state,
supervision_warning_leaflet.create_by,
supervision_warning_leaflet.create_time,
supervision_warning_leaflet.update_by,
supervision_warning_leaflet.update_time,
supervision_warning_leaflet.file_path
FROM supervision_warning_leaflet supervision_warning_leaflet
WHERE ${ew.sqlSegment}
</select>
</mapper>

View File

@@ -19,4 +19,6 @@ public interface UserReportPOMapper extends BaseMapper<UserReportPO> {
Page<UserReportVO> page(@Param("page")Page<Object> objectPage, @Param("ew") QueryWrapper<UserReportVO> userReportVOQueryWrapper);
Page<UserReportVO> pageUpdate(@Param("page")Page<Object> objectPage, @Param("ew") QueryWrapper<UserReportVO> userReportVOQueryWrapper);
UserReportVO getUserReportById(@Param("ew")QueryWrapper<UserReportVO> userReportVOQueryWrapper);
}

View File

@@ -86,4 +86,32 @@
LEFT JOIN supervision_user_report_renewal r ON supervision_user_report.id=r.id
WHERE ${ew.sqlSegment}
</select>
<!--获取流程表单分页列表-->
<select id="getUserReportById" resultType="UserReportVO">
SELECT
supervision_user_report.id,
supervision_user_report.report_date,
supervision_user_report.org_id,
supervision_user_report.expected_production_date,
supervision_user_report.user_type,
supervision_user_report.city,
supervision_user_report.responsible_department,
supervision_user_report.user_status,
supervision_user_report.substation,
supervision_user_report.voltage_level,
supervision_user_report.project_name,
supervision_user_report.evaluation_dept,
supervision_user_report.data_type,
supervision_user_report.evaluation_conclusion,
supervision_user_report.process_instance_id,
supervision_user_report.history_instance_id,
supervision_user_report.create_time,
supervision_user_report.create_by,
supervision_user_report.status,
supervision_user_report.dev_id,
supervision_user_report.line_id
FROM supervision_user_report supervision_user_report
WHERE ${ew.sqlSegment}
</select>
</mapper>

View File

@@ -3,11 +3,14 @@ package com.njcn.supervision.service.device;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
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.device.CheckDeviceParam;
import com.njcn.supervision.pojo.po.device.CheckDevice;
import com.njcn.supervision.pojo.vo.device.CheckDeviceVo;
import java.util.List;
/**
* <p>
* 终端周期检测表 服务类
@@ -41,4 +44,6 @@ public interface ICheckDeviceService extends IBpmService<CheckDevice> {
* 取消
*/
String cancel(BpmProcessInstanceCancelParam cancelReqVO);
List<TodoVO> getTodoBusiness();
}

View File

@@ -1,11 +1,14 @@
package com.njcn.supervision.service.device.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.ObjUtil;
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;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
@@ -15,6 +18,8 @@ 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.db.constant.DbConstant;
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
@@ -40,10 +45,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -121,12 +123,12 @@ public class CheckDeviceServiceImpl extends MppServiceImpl<CheckDeviceMapper, Ch
queryWrapper.orderBy(true, param.getOrderBy().equalsIgnoreCase(DbConstant.ASC), StrUtil.toUnderlineCase(param.getSortBy()));
} else {
//默认根据逾期天数排序
queryWrapper.orderBy(true, false, "A.overdue_day");
queryWrapper.orderBy(true, false, "A.overdue_day").orderBy(true, false, "A.status");
}
queryWrapper.and(wrapper ->
wrapper.isNull("A.status")
.or()
.eq(ObjUtil.isNotNull(param.getStatus()),"A.status", param.getStatus())
.eq(ObjUtil.isNotNull(param.getStatus()), "A.status", param.getStatus())
);
if (!Objects.isNull(param.getState())) {
queryWrapper.eq("A.state", param.getState());
@@ -156,6 +158,7 @@ public class CheckDeviceServiceImpl extends MppServiceImpl<CheckDeviceMapper, Ch
bpmProcessInstanceCreateReqDTO.setVariables(processInstanceVariables);
String processInstanceId = bpmProcessFeignClient.createProcessInstance(RequestUtil.getUserIndex(), bpmProcessInstanceCreateReqDTO).getData();
// 将工作流的编号,更新到流程单中
checkDevice.setState(1);
checkDevice.setProcessInstanceId(processInstanceId);
checkDevice.setDescription(param.getDescription());
checkDevice.setCreateBy(RequestUtil.getUserIndex());
@@ -200,25 +203,69 @@ public class CheckDeviceServiceImpl extends MppServiceImpl<CheckDeviceMapper, Ch
return checkDevice.getId();
}
@Override
public List<TodoVO> getTodoBusiness() {
List<TodoVO> todoVOList = new ArrayList<>();
QueryWrapper<CheckDeviceVo> queryWrapper = new QueryWrapper<>();
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
deptGetLineParam.setDeptId(RequestUtil.getDeptIndex());
List<String> devList = commTerminalGeneralClient.deptGetDevice(deptGetLineParam)
.getData()
.stream()
.flatMap(item -> item.getDeviceList().stream())
.map(LineDevGetDTO::getDevId)
.distinct()
.collect(Collectors.toList());
if (CollUtil.isNotEmpty(devList)) {
queryWrapper.in("A.device_id", devList);
}else{
return new ArrayList<>();
}
//查询出今天之前要待检的终端
queryWrapper.le("A.check_time", LocalDate.now())
.eq("A.state", 0);
List<CheckDeviceVo> checkDeviceVoList = this.baseMapper.selectVOList(queryWrapper);
if (CollUtil.isNotEmpty(checkDeviceVoList)) {
todoVOList = checkDeviceVoList.stream().map(item -> {
TodoVO todoVO = new TodoVO();
todoVO.setId(item.getId());
todoVO.setTaskName("终端周期定检");
todoVO.setTaskContent("变电站:".concat(item.getSubstation())
.concat(",装置:").concat(item.getDeviceName())
.concat(",本次定检时间为:").concat(LocalDateTimeUtil.format(item.getThisTimeCheck(),DatePattern.NORM_DATE_PATTERN))
.concat(",逾期:").concat(String.valueOf(item.getOverdueDay()))
.concat("")
);
todoVO.setStartUser("系统扫描");
todoVO.setTaskCreateTime(item.getCreateTime());
todoVO.setSource(3);
todoVO.setRoutePath("");
return todoVO;
}).collect(Collectors.toList());
}
return todoVOList;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateProcessStatus(String businessId, Integer status) {
//流程状态整改
CheckDevice checkDevice = this.baseMapper.selectById(businessId);
checkDevice.setStatus(status);
checkDevice.setState(1);
checkDevice.setState(2);
this.updateById(checkDevice);
//修改pq_device定检时间和下次定检时间 5年
String nowCheckTime = checkDevice.getNowCheckTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
String nextCheckTime = checkDevice.getNowCheckTime().plusYears(5).format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
deviceFeignClient.updateDevCheckTime(checkDevice.getDeviceId(),nowCheckTime,nextCheckTime);
deviceFeignClient.updateDevCheckTime(checkDevice.getDeviceId(), nowCheckTime, nextCheckTime);
}
@Override
public BpmInstanceInfo getInstanceInfo(String businessId) {
BpmInstanceInfo bpmInstanceInfo= null;
BpmInstanceInfo bpmInstanceInfo = null;
CheckDeviceVo checkDevice = this.getInfoById(businessId);
if(ObjUtil.isNotNull(checkDevice)) {
if (ObjUtil.isNotNull(checkDevice)) {
bpmInstanceInfo = new BpmInstanceInfo();
bpmInstanceInfo.setHistoryInstanceId(checkDevice.getHistoryInstanceId());
String sign = checkDevice.getDept()
@@ -230,4 +277,20 @@ public class CheckDeviceServiceImpl extends MppServiceImpl<CheckDeviceMapper, Ch
}
return bpmInstanceInfo;
}
@Override
public Set<String> getAllRejectInstanceIds() {
Set<String> rejectInstanceIds = new HashSet<>();
// 查询所有走了流程但是流程状态为不通过的流程实例id
LambdaQueryWrapper<CheckDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(CheckDevice::getCreateBy, RequestUtil.getUserIndex())
.eq(CheckDevice::getStatus, BpmProcessInstanceStatusEnum.REJECT.getStatus())
.select(CheckDevice::getProcessInstanceId);
List<CheckDevice> checkDevices = this.baseMapper.selectList(lambdaQueryWrapper);
List<String> result = checkDevices.stream().map(CheckDevice::getProcessInstanceId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(result)){
rejectInstanceIds.addAll(result);
}
return rejectInstanceIds;
}
}

View File

@@ -266,6 +266,23 @@ public class QuitRunningDeviceServiceImpl extends ServiceImpl<QuitRunningDeviceM
return bpmInstanceInfo;
}
@Override
public Set<String> getAllRejectInstanceIds() {
Set<String> rejectInstanceIds = new HashSet<>();
//查询当前用户创建的createBy的流程审核不通过的
LambdaQueryWrapper<QuitRunningDevice> deviceLambdaQueryWrapper = new LambdaQueryWrapper<>();
deviceLambdaQueryWrapper.eq(QuitRunningDevice::getCreateBy, RequestUtil.getUserIndex())
.eq(QuitRunningDevice::getStatus, BpmProcessInstanceStatusEnum.REJECT.getStatus())
.eq(QuitRunningDevice::getState, DataStateEnum.ENABLE.getCode())
.select(QuitRunningDevice::getProcessInstanceId);
List<QuitRunningDevice> quitRunningDevices = this.baseMapper.selectList(deviceLambdaQueryWrapper);
if (CollectionUtil.isNotEmpty(quitRunningDevices)) {
List<String> result = quitRunningDevices.stream().map(QuitRunningDevice::getProcessInstanceId).collect(Collectors.toList());
rejectInstanceIds.addAll(result);
}
return rejectInstanceIds;
}
@Override
public QuitRunningDeviceVO getVOById(String id) {
QuitRunningDevice quitRunningDevice = this.baseMapper.selectById(id);

View File

@@ -40,6 +40,7 @@ import com.njcn.supervision.mapper.device.SupervisionDevMainReportPOMapper;
import com.njcn.supervision.pojo.dto.SupervisionDevMainReportExcel;
import com.njcn.supervision.pojo.param.device.SupervisionDevMainReportParam;
import com.njcn.supervision.pojo.param.device.SupervisionTempDeviceReportParam;
import com.njcn.supervision.pojo.po.device.QuitRunningDevice;
import com.njcn.supervision.pojo.po.device.SupervisionDevMainReportPO;
import com.njcn.supervision.pojo.po.device.SupervisionTempDeviceReport;
import com.njcn.supervision.pojo.po.user.UserReportPO;
@@ -265,6 +266,23 @@ public class SupervisionDevMainReportPOServiceImpl extends ServiceImpl<Supervisi
return bpmInstanceInfo;
}
@Override
public Set<String> getAllRejectInstanceIds() {
Set<String> rejectInstanceIds = new HashSet<>();
//查询当前用户创建的createBy的流程审核不通过的
LambdaQueryWrapper<SupervisionDevMainReportPO> supervisionDevMainReportPOLambdaQueryWrapper = new LambdaQueryWrapper<>();
supervisionDevMainReportPOLambdaQueryWrapper.eq(SupervisionDevMainReportPO::getCreateBy, RequestUtil.getUserIndex())
.eq(SupervisionDevMainReportPO::getStatus, BpmProcessInstanceStatusEnum.REJECT.getStatus())
.eq(SupervisionDevMainReportPO::getState, DataStateEnum.ENABLE.getCode())
.select(SupervisionDevMainReportPO::getProcessInstanceId);
List<SupervisionDevMainReportPO> supervisionDevMainReportPOS = this.baseMapper.selectList(supervisionDevMainReportPOLambdaQueryWrapper);
if (CollectionUtil.isNotEmpty(supervisionDevMainReportPOS)) {
List<String> result = supervisionDevMainReportPOS.stream().map(SupervisionDevMainReportPO::getProcessInstanceId).collect(Collectors.toList());
rejectInstanceIds.addAll(result);
}
return rejectInstanceIds;
}
@Override
public String cancelDevMainReport(BpmProcessInstanceCancelParam cancelReqVO) {
//准备取消该流程,需要远程调用接口

View File

@@ -32,6 +32,7 @@ import com.njcn.supervision.enums.UserNatureEnum;
import com.njcn.supervision.mapper.device.SupervisionTempLineDebugPOMapper;
import com.njcn.supervision.mapper.user.UserReportNormalMapper;
import com.njcn.supervision.pojo.param.device.SupervisionTempLineDebugParam;
import com.njcn.supervision.pojo.po.device.SupervisionDevMainReportPO;
import com.njcn.supervision.pojo.po.device.SupervisionTempDeviceReport;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineDebugPO;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineReport;
@@ -329,6 +330,22 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
return bpmInstanceInfo;
}
@Override
public Set<String> getAllRejectInstanceIds() {
Set<String> rejectInstanceIds = new HashSet<>();
LambdaQueryWrapper<SupervisionTempLineDebugPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupervisionTempLineDebugPO::getCreateBy, RequestUtil.getUserIndex())
.eq(SupervisionTempLineDebugPO::getStatus, BpmProcessInstanceStatusEnum.REJECT.getStatus())
.eq(SupervisionTempLineDebugPO::getState, DataStateEnum.ENABLE.getCode())
.select(SupervisionTempLineDebugPO::getProcessInstanceId);
List<SupervisionTempLineDebugPO> supervisionTempLineDebugPOS = this.baseMapper.selectList(lambdaQueryWrapper);
if (CollectionUtil.isNotEmpty(supervisionTempLineDebugPOS)) {
List<String> result = supervisionTempLineDebugPOS.stream().map(SupervisionTempLineDebugPO::getProcessInstanceId).collect(Collectors.toList());
rejectInstanceIds.addAll(result);
}
return rejectInstanceIds;
}
/**
* @Description: 临时表台账数据同步到实际表中
* @Param:

View File

@@ -231,6 +231,23 @@ public class SupervisionTempLineReportServiceImpl extends ServiceImpl<Supervisio
return bpmInstanceInfo;
}
@Override
public Set<String> getAllRejectInstanceIds() {
Set<String> rejectInstanceIds = new HashSet<>();
//查询当前用户创建的createBy的流程审核不通过的
LambdaQueryWrapper<SupervisionTempLineReport> supervisionTempLineReportLambdaQueryWrapper = new LambdaQueryWrapper<>();
supervisionTempLineReportLambdaQueryWrapper.eq(SupervisionTempLineReport::getCreateBy, RequestUtil.getUserIndex())
.eq(SupervisionTempLineReport::getStatus, BpmProcessInstanceStatusEnum.REJECT.getStatus())
.eq(SupervisionTempLineReport::getState, DataStateEnum.ENABLE.getCode())
.select(SupervisionTempLineReport::getProcessInstanceId);
List<SupervisionTempLineReport> supervisionTempLineReports = this.baseMapper.selectList(supervisionTempLineReportLambdaQueryWrapper);
if (CollectionUtil.isNotEmpty(supervisionTempLineReports)) {
List<String> result = supervisionTempLineReports.stream().map(SupervisionTempLineReport::getProcessInstanceId).collect(Collectors.toList());
rejectInstanceIds.addAll(result);
}
return rejectInstanceIds;
}
@Override
public String cancelTempLineReport(BpmProcessInstanceCancelParam cancelReqVO) {
//准备取消该流程,需要远程调用接口

View File

@@ -37,6 +37,7 @@ import com.njcn.supervision.enums.SupervisionUserStatusEnum;
import com.njcn.supervision.mapper.device.SupervisionTempLineReportMapper;
import com.njcn.supervision.mapper.device.SupervisionTempLineRunTestMapper;
import com.njcn.supervision.pojo.param.device.SupervisionTempLineRunTestParam;
import com.njcn.supervision.pojo.po.device.CheckDevice;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineReport;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineRunTestPO;
import com.njcn.supervision.pojo.po.device.TempLineRunTestWarning;
@@ -360,6 +361,23 @@ public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl<Supervisi
return bpmInstanceInfo;
}
@Override
public Set<String> getAllRejectInstanceIds() {
Set<String> rejectInstanceIds = new HashSet<>();
// 查询所有走了流程但是流程状态为不通过的流程实例id
LambdaQueryWrapper<SupervisionTempLineRunTestPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupervisionTempLineRunTestPO::getCreateBy, RequestUtil.getUserIndex())
.eq(SupervisionTempLineRunTestPO::getStatus, BpmProcessInstanceStatusEnum.REJECT.getStatus())
.eq(SupervisionTempLineRunTestPO::getState, DataStateEnum.ENABLE.getCode())
.select(SupervisionTempLineRunTestPO::getProcessInstanceId);
List<SupervisionTempLineRunTestPO> supervisionTempLineRunTestPOList = this.baseMapper.selectList(lambdaQueryWrapper);
List<String> result = supervisionTempLineRunTestPOList.stream().map(SupervisionTempLineRunTestPO::getProcessInstanceId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(result)){
rejectInstanceIds.addAll(result);
}
return rejectInstanceIds;
}
@Override
public SupervisionTempLineRunTestVO getRunTestById(String id) {
return this.baseMapper.getRunTestInfo(id);
@@ -406,4 +424,5 @@ public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl<Supervisi
return builder.toString();
}
}

View File

@@ -2,6 +2,7 @@ package com.njcn.supervision.service.leaflet;
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.harmonic.pojo.dto.RMpPartHarmonicDetailDTO;
import com.njcn.supervision.pojo.param.leaflet.WarningLeafletParam;
@@ -58,4 +59,5 @@ public interface IWarningLeafletService extends IBpmService<WarningLeaflet> {
Boolean deleteWarningLeaflet(List<String> supervisionId);
List<TodoVO> getTodoBusiness();
}

View File

@@ -8,6 +8,7 @@ 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;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -18,6 +19,7 @@ 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.harmonic.pojo.dto.RMpPartHarmonicDetailDTO;
@@ -25,6 +27,7 @@ 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;
@@ -89,7 +92,7 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
* 不创建工作流,只是创建一个告警单,需要待用户反馈后才会进入流程
*/
@Override
public String createLeaflet(String name, String deptId, String code, String id, Integer problemType, Integer leaflet, String issueDetail,String reformAdvice,String filePath) {
public String createLeaflet(String name, String deptId, String code, String id, Integer problemType, Integer leaflet, String issueDetail, String reformAdvice, String filePath) {
WarningLeaflet warningLeaflet = new WarningLeaflet();
warningLeaflet.setLeafletName(name);
warningLeaflet.setDeptId(deptId);
@@ -141,7 +144,7 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
if (deptMap.containsKey(x.getDutyOrgId())) {
x.setDutyOrgName(deptMap.get(x.getDutyOrgId()));
}
if (!Objects.isNull(x.getFilePath())){
if (!Objects.isNull(x.getFilePath())) {
x.setFilePath(fileStorageUtil.getFileUrl(x.getFilePath()));
}
});
@@ -157,14 +160,14 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
warningLeaflet.setTakeStep(warningLeafletUpdateParam.getTakeStep());
warningLeaflet.setReportPath(warningLeafletUpdateParam.getReportPath());
//设置状态
if(Objects.equals(warningLeafletUpdateParam.getSaveOrCheckflag(),"1")){
if (Objects.equals(warningLeafletUpdateParam.getSaveOrCheckflag(), "1")) {
warningLeaflet.setStatus(BpmTaskStatusEnum.WAIT.getStatus());
}else {
} else {
warningLeaflet.setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
}
if(Objects.equals(warningLeafletUpdateParam.getSaveOrCheckflag(),"2")) {
if (Objects.equals(warningLeafletUpdateParam.getSaveOrCheckflag(), "2")) {
// 发起 BPM 流程
Map<String, Object> processInstanceVariables = new HashMap<>();
BpmProcessInstanceCreateReqDTO bpmProcessInstanceCreateReqDTO = new BpmProcessInstanceCreateReqDTO();
@@ -176,7 +179,7 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
// 将工作流的编号,更新到流程单中
warningLeaflet.setProcessInstanceId(processInstanceId);
}
warningLeaflet.setCreateBy(RequestUtil.getUserIndex());
this.baseMapper.updateById(warningLeaflet);
}
@@ -206,6 +209,7 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
warningLeaflet.setProcessInstanceId(processInstanceId);
//保存历史流程id列表
warningLeaflet.setHistoryInstanceId(historyInstanceIds);
warningLeaflet.setCreateBy(RequestUtil.getUserIndex());
this.baseMapper.updateById(warningLeaflet);
return warningLeaflet.getId();
}
@@ -214,7 +218,7 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
public WarningLeafletVO getVOById(String id) {
WarningLeaflet warningLeaflet = this.getById(id);
WarningLeafletVO warningLeafletVO = new WarningLeafletVO();
if (!Objects.isNull(warningLeaflet)){
if (!Objects.isNull(warningLeaflet)) {
BeanUtil.copyProperties(warningLeaflet, warningLeafletVO);
if (StrUtil.isNotBlank(warningLeaflet.getDeptId())) {
Dept dept = deptFeignClient.getDeptById(warningLeaflet.getDeptId()).getData();
@@ -227,7 +231,7 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
//查询谐波普测,获取该普测计划上传的文件
//查询到现场测试超标附件地址
TempLineRunTestWarning byId = lineRunTestWarningService.getById(problemId);
if(Objects.nonNull(byId)){
if (Objects.nonNull(byId)) {
warningLeafletVO.setProblemPath(byId.getTestRunReport());
}
}
@@ -247,12 +251,12 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
if (Objects.nonNull(warningLeafletVO.getId())) {
bpmInstanceInfo.setHistoryInstanceId(warningLeafletVO.getHistoryInstanceId());
String type = "告警单";
if(warningLeafletVO.getLeafletType() == 1){
if (warningLeafletVO.getLeafletType() == 1) {
type = "预警单";
}
String sign = "问题来源于".concat(ProblemTypeEnum.getNameByCode(warningLeafletVO.getProblemType()))
.concat(",由单位")
.concat(StrUtil.isBlank(warningLeafletVO.getDeptName())?"":warningLeafletVO.getDeptName())
.concat(StrUtil.isBlank(warningLeafletVO.getDeptName()) ? "" : warningLeafletVO.getDeptName())
.concat("负责的")
.concat(warningLeafletVO.getLeafletName())
.concat(type);
@@ -261,6 +265,23 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
return bpmInstanceInfo;
}
@Override
public Set<String> getAllRejectInstanceIds() {
Set<String> rejectInstanceIds = new HashSet<>();
// 查询所有走了流程但是流程状态为不通过的流程实例id
LambdaQueryWrapper<WarningLeaflet> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(WarningLeaflet::getCreateBy, RequestUtil.getUserIndex())
.eq(WarningLeaflet::getStatus, BpmProcessInstanceStatusEnum.REJECT.getStatus())
.eq(WarningLeaflet::getState, DataStateEnum.ENABLE.getCode())
.select(WarningLeaflet::getProcessInstanceId);
List<WarningLeaflet> warningLeaflets = this.baseMapper.selectList(lambdaQueryWrapper);
List<String> result = warningLeaflets.stream().map(WarningLeaflet::getProcessInstanceId).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(result)) {
rejectInstanceIds.addAll(result);
}
return rejectInstanceIds;
}
@Override
public Page<WarningLeafletVO> alarmPageData(WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam) {
QueryWrapper<WarningLeafletVO> warningLeafletVOQueryWrapper = new QueryWrapper<>();
@@ -302,14 +323,14 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
if (record.getProblemType().equals(ProblemTypeEnum.SITE_TEST.getCode()) && StrUtil.isNotBlank(record.getProblemId())) {
//查询到现场测试超标附件地址
TempLineRunTestWarning byId = lineRunTestWarningService.getById(record.getProblemId());
if(Objects.nonNull(byId)){
if (Objects.nonNull(byId)) {
record.setProblemPath(byId.getTestRunReport());
}
}
if (deptMap.containsKey(record.getDutyOrgId())) {
record.setDutyOrgName(deptMap.get(record.getDutyOrgId()));
}
if (!Objects.isNull(record.getFilePath())){
if (!Objects.isNull(record.getFilePath())) {
record.setFilePath(fileStorageUtil.getFileUrl(record.getFilePath()));
}
}
@@ -386,14 +407,14 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
if (record.getProblemType().equals(ProblemTypeEnum.SITE_TEST.getCode()) && StrUtil.isNotBlank(record.getProblemId())) {
//查询到现场测试超标附件地址
TempLineRunTestWarning byId = lineRunTestWarningService.getById(record.getProblemId());
if(Objects.nonNull(byId)){
if (Objects.nonNull(byId)) {
record.setProblemPath(byId.getTestRunReport());
}
}
if (deptMap.containsKey(record.getDutyOrgId())) {
record.setDutyOrgName(deptMap.get(record.getDutyOrgId()));
}
if (!Objects.isNull(record.getFilePath())){
if (!Objects.isNull(record.getFilePath())) {
record.setFilePath(fileStorageUtil.getFileUrl(record.getFilePath()));
}
}
@@ -415,6 +436,43 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
.in(WarningLeaflet::getId, supervisionId));
}
@Override
public List<TodoVO> getTodoBusiness() {
List<TodoVO> todoVOList = new ArrayList<>();
QueryWrapper<WarningLeafletVO> queryWrapper = new QueryWrapper<>();
List<String> deptIds = deptFeignClient.getDepSonIdtByDeptId(RequestUtil.getDeptIndex()).getData();
if(CollectionUtil.isEmpty(deptIds)){
return todoVOList;
}
queryWrapper.in("supervision_warning_leaflet.dept_id", deptIds)
.eq("supervision_warning_leaflet.status", 5)
.eq("supervision_warning_leaflet.state", DataStateEnum.ENABLE.getCode())
.orderByDesc("supervision_warning_leaflet.Update_Time");
List<WarningLeafletVO> warningLeafletVOList = this.baseMapper.getTodoBusiness(queryWrapper);
if(CollectionUtil.isNotEmpty(warningLeafletVOList)){
todoVOList = warningLeafletVOList.stream().map(item -> {
TodoVO todoVO = new TodoVO();
String title = "预警单";
Integer tabValue = 3;
if(item.getLeafletType()==2){
title = "告警单";
tabValue = 4;
}
todoVO.setTaskName(title);
String problemType = ProblemTypeEnum.getNameByCode(item.getProblemType());
todoVO.setTaskContent(item.getLeafletName());
todoVO.setStartUser(problemType);
todoVO.setId(item.getId());
todoVO.setTaskCreateTime(item.getCreateTime());
todoVO.setSource(3);
todoVO.setRoutePath("");
todoVO.setTabValue(tabValue);
return todoVO;
}).collect(Collectors.toList());
}
return todoVOList;
}
private String assembleOverLimitInfo(RMpPartHarmonicDetailDTO rMpPartHarmonicDetailDTO) {
String info = "";

View File

@@ -2,6 +2,7 @@ package com.njcn.supervision.service.plan.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
@@ -22,6 +23,7 @@ import com.njcn.common.utils.PubUtils;
import com.njcn.supervision.enums.SupervisionKeyEnum;
import com.njcn.supervision.mapper.plan.SupervisionPlanPOMapper;
import com.njcn.supervision.pojo.param.plan.SupervisionPlanParam;
import com.njcn.supervision.pojo.po.device.CheckDevice;
import com.njcn.supervision.pojo.po.plan.SupervisionPlanPO;
import com.njcn.supervision.pojo.po.plan.SupervisionProblemPO;
import com.njcn.supervision.pojo.vo.plan.SupervisionPlanVO;
@@ -41,10 +43,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -379,6 +378,23 @@ public class SupervisionPlanPOServiceImpl extends ServiceImpl<SupervisionPlanPOM
return null;
}
@Override
public Set<String> getAllRejectInstanceIds() {
Set<String> rejectInstanceIds = new HashSet<>();
// 查询所有走了流程但是流程状态为不通过的流程实例id
LambdaQueryWrapper<SupervisionPlanPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupervisionPlanPO::getCreateBy, RequestUtil.getUserIndex())
.eq(SupervisionPlanPO::getStatus, BpmProcessInstanceStatusEnum.REJECT.getStatus())
.eq(SupervisionPlanPO::getState, DataStateEnum.ENABLE.getCode())
.select(SupervisionPlanPO::getProcessInstanceId);
List<SupervisionPlanPO> supervisionPlanPOS = this.baseMapper.selectList(lambdaQueryWrapper);
List<String> result = supervisionPlanPOS.stream().map(SupervisionPlanPO::getProcessInstanceId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(result)){
rejectInstanceIds.addAll(result);
}
return rejectInstanceIds;
}
@Override
@Deprecated
@Transactional(rollbackFor = Exception.class)

View File

@@ -327,6 +327,14 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl<Super
return null;
}
/**
* 该流程暂时没有在页面体现出来
*/
@Override
public Set<String> getAllRejectInstanceIds() {
return new HashSet<>();
}
@Override
public String cancelGeneralSurvey(BpmProcessInstanceCancelParam cancelReqVO) {
//准备取消该流程,需要远程调用接口

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.StrPool;
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;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -25,6 +26,7 @@ import com.njcn.supervision.enums.SupervisionKeyEnum;
import com.njcn.supervision.enums.SupervisionResponseEnum;
import com.njcn.supervision.mapper.survey.SurveyPlanMapper;
import com.njcn.supervision.pojo.param.survey.SurveyPlanParam;
import com.njcn.supervision.pojo.po.device.CheckDevice;
import com.njcn.supervision.pojo.po.device.SupervisionDevMainReportPO;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineRunTestPO;
import com.njcn.supervision.pojo.po.survey.SurveyPlan;
@@ -275,6 +277,23 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
return bpmInstanceInfo;
}
@Override
public Set<String> getAllRejectInstanceIds() {
Set<String> rejectInstanceIds = new HashSet<>();
// 查询所有走了流程但是流程状态为不通过的流程实例id
LambdaQueryWrapper<SurveyPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SurveyPlan::getCreateBy, RequestUtil.getUserIndex())
.eq(SurveyPlan::getStatus, BpmProcessInstanceStatusEnum.REJECT.getStatus())
.eq(SurveyPlan::getState, DataStateEnum.ENABLE.getCode())
.select(SurveyPlan::getProcessInstanceId);
List<SurveyPlan> surveyPlanList = this.baseMapper.selectList(lambdaQueryWrapper);
List<String> result = surveyPlanList.stream().map(SurveyPlan::getProcessInstanceId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(result)){
rejectInstanceIds.addAll(result);
}
return rejectInstanceIds;
}
@Override
public SurveyPlanVO getVOById(String id) {
SurveyPlan surveyPlan = this.baseMapper.selectById(id);

View File

@@ -29,6 +29,7 @@ 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;
@@ -230,6 +231,7 @@ 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 流程
@@ -328,6 +330,23 @@ public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyT
return bpmInstanceInfo;
}
@Override
public Set<String> getAllRejectInstanceIds() {
Set<String> rejectInstanceIds = new HashSet<>();
// 查询所有走了流程但是流程状态为不通过的流程实例id
LambdaQueryWrapper<SurveyTest> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SurveyTest::getCreateBy, RequestUtil.getUserIndex())
.eq(SurveyTest::getStatus, BpmProcessInstanceStatusEnum.REJECT.getStatus())
.eq(SurveyTest::getState, DataStateEnum.ENABLE.getCode())
.select(SurveyTest::getProcessInstanceId);
List<SurveyTest> surveyTestList = this.baseMapper.selectList(lambdaQueryWrapper);
List<String> result = surveyTestList.stream().map(SurveyTest::getProcessInstanceId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(result)){
rejectInstanceIds.addAll(result);
}
return rejectInstanceIds;
}
@Override
public SurveyTestVO getVOById(String id) {
SurveyTestVO surveyTestVO = new SurveyTestVO();

View File

@@ -31,4 +31,5 @@ public interface IUserReportNormalService extends IBpmService<UserReportNormalPO
String cancelUserReport(BpmProcessInstanceCancelParam cancelReqVO);
UserReportVO.UserReportListVO getUserReportByFangAnId(String id);
}

View File

@@ -29,6 +29,8 @@ public interface UserReportPOService extends IBpmService<UserReportPO> {
Page<UserReportVO> getUserReport(UserReportParam.UserReportQueryParam userReportQueryParam);
UserReportVO getUserReportById(String id);
Boolean removeUserReport(List<String> ids);
UserReportVO.UserReportListVO getVOById(String id);

View File

@@ -29,10 +29,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
@@ -117,6 +114,15 @@ public class UserReportDeleteServiceImpl extends ServiceImpl<UserReportPOMapper,
return bpmInstanceInfo;
}
/**
* 该流程不需要了 by 吴瑞
*/
@Override
@Deprecated
public Set<String> getAllRejectInstanceIds() {
return new HashSet<>();
}
@Override
@Transactional(rollbackFor = Exception.class)
public String addEditor(UserReportParam userReportParam) {

View File

@@ -3,6 +3,7 @@ package com.njcn.supervision.service.user.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -15,15 +16,17 @@ import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO;
import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.supervision.enums.SupervisionKeyEnum;
import com.njcn.supervision.enums.UserNatureEnum;
import com.njcn.supervision.mapper.user.UserReportNormalMapper;
import com.njcn.supervision.pojo.param.user.UserReportNormalParam;
import com.njcn.supervision.pojo.po.user.UserReportNormalPO;
import com.njcn.supervision.pojo.po.user.UserReportPO;
import com.njcn.supervision.pojo.po.device.SupervisionDevMainReportPO;
import com.njcn.supervision.pojo.po.user.*;
import com.njcn.supervision.pojo.vo.user.UserReportVO;
import com.njcn.supervision.service.user.IUserReportNormalService;
import com.njcn.supervision.service.user.UserReportPOService;
import com.njcn.supervision.service.user.*;
import com.njcn.supervision.utils.InstanceUtil;
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 lombok.RequiredArgsConstructor;
@@ -49,8 +52,12 @@ public class UserReportNormalServiceImpl extends ServiceImpl<UserReportNormalMap
private final BpmProcessFeignClient bpmProcessFeignClient;
private final UserReportProjectPOService userReportProjectPOService;
private final UserReportSubstationPOService userReportSubstationPOService;
private final UserReportSensitivePOService userReportSensitivePOService;
private final UserReportPOService userReportPOService;
private final UserFeignClient userFeignClient;
private final DeptFeignClient deptFeignClient;
@Override
@@ -66,6 +73,7 @@ public class UserReportNormalServiceImpl extends ServiceImpl<UserReportNormalMap
userReportNormalPO.setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
}
userReportNormalPO.setCreateBy(RequestUtil.getUserIndex());
this.saveOrUpdate(userReportNormalPO);
userReportNormalPO = this.getById(userReportNormalPO.getId());
if (Objects.equals(userReportNormalParam.getSaveOrCheckflag(), "2")) {
@@ -188,6 +196,24 @@ public class UserReportNormalServiceImpl extends ServiceImpl<UserReportNormalMap
return bpmInstanceInfo;
}
@Override
public Set<String> getAllRejectInstanceIds() {
Set<String> rejectInstanceIds = new HashSet<>();
//查询当前用户创建的createBy的流程审核不通过的
LambdaQueryWrapper<UserReportNormalPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(UserReportNormalPO::getCreateBy, RequestUtil.getUserIndex())
.eq(UserReportNormalPO::getStatus, BpmProcessInstanceStatusEnum.REJECT.getStatus())
.eq(UserReportNormalPO::getState, DataStateEnum.ENABLE.getCode())
.select(UserReportNormalPO::getProcessInstanceId);
List<UserReportNormalPO> userReportNormalPOList = this.baseMapper.selectList(lambdaQueryWrapper);
if (CollectionUtil.isNotEmpty(userReportNormalPOList)) {
List<String> result = userReportNormalPOList.stream().map(UserReportNormalPO::getProcessInstanceId).collect(Collectors.toList());
rejectInstanceIds.addAll(result);
}
return rejectInstanceIds;
}
@Override
public String cancelUserReport(BpmProcessInstanceCancelParam cancelReqVO) {
//准备取消该流程,需要远程调用接口
@@ -201,4 +227,58 @@ public class UserReportNormalServiceImpl extends ServiceImpl<UserReportNormalMap
this.updateById(userReportNormalPO);
return userReportNormalPO.getId();
}
@Override
public UserReportVO.UserReportListVO getUserReportByFangAnId(String id) {
UserReportNormalPO userReportNormalServiceById = this.getById(id);
UserReportVO.UserReportListVO userReportVO = new UserReportVO.UserReportListVO();
UserReportPO userReportPO = userReportPOService.getById(userReportNormalServiceById.getUserReportId());
//复制基础信息
BeanUtil.copyProperties(userReportPO, userReportVO);
//处理特殊字段,用户名、部门名
UserVO userVO = userFeignClient.getUserById(userReportPO.getReporter()).getData();
userReportVO.setReporter(userVO.getName());
userReportVO.setOrgName(deptFeignClient.getDeptById(userReportPO.getOrgId()).getData().getName());
/*
根据用户性质获取自己特有的字段,此处需要特殊处理
1、每个附件需要返回文件名称以及可以预览的url
todo...by黄正剑
*/
if (
CollectionUtil.newArrayList(
UserNatureEnum.BUILD_POWER_GRID.getCode(),
UserNatureEnum.EXTEND_POWER_GRID.getCode()
).contains(userReportPO.getUserType())) {
//电网工程类用户额外数据
UserReportProjectPO byId = userReportProjectPOService.getById(userReportNormalServiceById.getUserReportId());
userReportVO.setUserReportProjectPO(byId);
} else if (
CollectionUtil.newArrayList(
UserNatureEnum.BUILD_NON_LINEAR_LOAD.getCode(),
UserNatureEnum.EXTEND_NON_LINEAR_LOAD.getCode(),
UserNatureEnum.BUILD_NEW_ENERGY_POWER_STATION.getCode(),
UserNatureEnum.EXTEND_NEW_ENERGY_POWER_STATION.getCode()
).contains(userReportPO.getUserType())) {
//非线性负荷用户 & 新能源发电站用户
UserReportSubstationPO byId = userReportSubstationPOService.getById(userReportNormalServiceById.getUserReportId());
userReportSubstationPOService.saveOrUpdate(byId);
userReportVO.setUserReportSubstationPO(byId);
} else if (UserNatureEnum.SENSITIVE_USER.getCode().equals(userReportPO.getUserType())) {
// 敏感及重要用户
UserReportSensitivePO byId = userReportSensitivePOService.getById(userReportNormalServiceById.getUserReportId());
userReportVO.setUserReportSensitivePO(byId);
}
List<UserReportNormalPO> list = this.baseMapper.selectList(new LambdaQueryWrapper<UserReportNormalPO>()
.eq(UserReportNormalPO::getUserReportId, userReportNormalServiceById.getUserReportId())
.eq(UserReportNormalPO::getStatus, BpmTaskStatusEnum.APPROVE.getStatus())
.eq(UserReportNormalPO::getState, DataStateEnum.ENABLE.getCode())
.orderByDesc(UserReportNormalPO::getCreateTime)
);
Optional<String> netInReport = list.stream().filter(x -> 0 == x.getType()).map(UserReportNormalPO::getReportUrl).findFirst();
Optional<String> governReport = list.stream().filter(x -> 1 == x.getType()).map(UserReportNormalPO::getReportUrl).findFirst();
userReportVO.setNetInReport(Arrays.asList(netInReport.isPresent() ? netInReport.get() : null));
userReportVO.setGovernReport(Arrays.asList(governReport.isPresent() ? governReport.get() : null));
return userReportVO;
}
}

View File

@@ -40,6 +40,7 @@ import com.njcn.supervision.mapper.user.UserReportPOMapper;
import com.njcn.supervision.pojo.dto.SensitiveReportExcel;
import com.njcn.supervision.pojo.dto.SensitiveUserSExcel;
import com.njcn.supervision.pojo.param.user.UserReportParam;
import com.njcn.supervision.pojo.po.device.CheckDevice;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineReport;
import com.njcn.supervision.pojo.po.user.*;
import com.njcn.supervision.pojo.vo.user.UserReportVO;
@@ -335,6 +336,14 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(userReportQueryParam), PageFactory.getPageSize(userReportQueryParam)), userReportVOQueryWrapper);
}
@Override
public UserReportVO getUserReportById(String id) {
QueryWrapper<UserReportVO> userReportVOQueryWrapper = new QueryWrapper<>();
userReportVOQueryWrapper.eq("supervision_user_report.id", id);
return this.baseMapper.getUserReportById(userReportVOQueryWrapper);
}
@Override
public Boolean removeUserReport(List<String> ids) {
this.lambdaUpdate().set(UserReportPO::getState, 0).in(UserReportPO::getId, ids).update();
@@ -413,6 +422,23 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
return bpmInstanceInfo;
}
@Override
public Set<String> getAllRejectInstanceIds() {
Set<String> rejectInstanceIds = new HashSet<>();
// 查询所有走了流程但是流程状态为不通过的流程实例id
LambdaQueryWrapper<UserReportPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(UserReportPO::getCreateBy, RequestUtil.getUserIndex())
.eq(UserReportPO::getStatus, BpmProcessInstanceStatusEnum.REJECT.getStatus())
.eq(UserReportPO::getState, DataStateEnum.ENABLE.getCode())
.select(UserReportPO::getProcessInstanceId);
List<UserReportPO> userReportPOList = this.baseMapper.selectList(lambdaQueryWrapper);
List<String> result = userReportPOList.stream().map(UserReportPO::getProcessInstanceId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(result)){
rejectInstanceIds.addAll(result);
}
return rejectInstanceIds;
}
@Override
public List<UserReportVO> getUserReportList() {
String deptIndex = RequestUtil.getDeptIndex();

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.bpm.api.BpmProcessFeignClient;
import com.njcn.bpm.enums.BpmProcessInstanceStatusEnum;
@@ -18,6 +19,7 @@ import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.supervision.enums.*;
import com.njcn.supervision.mapper.user.UserReportRenewalMapper;
import com.njcn.supervision.pojo.param.user.UserReportParam;
import com.njcn.supervision.pojo.po.device.CheckDevice;
import com.njcn.supervision.pojo.po.user.*;
import com.njcn.supervision.service.user.*;
import com.njcn.supervision.utils.InstanceUtil;
@@ -31,9 +33,8 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>
@@ -82,6 +83,23 @@ public class UserReportRenewalServiceImpl extends ServiceImpl<UserReportRenewalM
return new BpmInstanceInfo();
}
@Override
public Set<String> getAllRejectInstanceIds() {
Set<String> rejectInstanceIds = new HashSet<>();
// 查询所有走了流程但是流程状态为不通过的流程实例id
LambdaQueryWrapper<UserReportRenewalPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(UserReportRenewalPO::getCreateBy, RequestUtil.getUserIndex())
.eq(UserReportRenewalPO::getStatus, BpmProcessInstanceStatusEnum.REJECT.getStatus())
.eq(UserReportRenewalPO::getState, DataStateEnum.ENABLE.getCode())
.select(UserReportRenewalPO::getProcessInstanceId);
List<UserReportRenewalPO> userReportRenewalPOList = this.baseMapper.selectList(lambdaQueryWrapper);
List<String> result = userReportRenewalPOList.stream().map(UserReportRenewalPO::getProcessInstanceId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(result)){
rejectInstanceIds.addAll(result);
}
return rejectInstanceIds;
}
@Override
public UserReportRenewalPO getUserReportUpdateById(String id) {
@@ -143,6 +161,7 @@ public class UserReportRenewalServiceImpl extends ServiceImpl<UserReportRenewalM
po.setId(userReportParam.getId());
po.setUserReportMessage(userReport);
po.setState(DataStateEnum.ENABLE.getCode());
userReportPO.setCreateBy(RequestUtil.getUserIndex());
if (this.saveOrUpdate(po)) {
return userReportParam.getId();
}