1.技术监督功能干扰源用户代码提交

This commit is contained in:
cdf
2024-04-10 18:53:57 +08:00
parent c348b24b51
commit ec1e8eb04a
20 changed files with 229 additions and 37 deletions

View File

@@ -0,0 +1,33 @@
package com.njcn.process.enums;
import lombok.Getter;
/**
* pqs
*
* @author cdf
* @date 2024/4/10
*/
@Getter
public enum ThsFlowTypeEnum {
rGeneralSurvey("电站普测计划",1),
rLoadTypeUser("干扰源用户新建计划",2)
;
private final String name;
private final Integer code;
ThsFlowTypeEnum(String name, Integer type) {
this.name = name;
this.code = type;
}
}

View File

@@ -53,4 +53,5 @@ public class FlowProcDefDto implements Serializable {
private Date deploymentTime; private Date deploymentTime;
} }

View File

@@ -100,6 +100,9 @@ public class FlowTaskDto implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date finishTime; private Date finishTime;
@ApiModelProperty("此流程对应的发起表单功能") @ApiModelProperty("此流程对应的发起表单功能的id")
private String formAssId; private String formAssId;
@ApiModelProperty("1.普测电站 1.干扰源用户")
private Integer formType;
} }

View File

@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import java.util.List;
@Data @Data
@@ -21,12 +22,14 @@ public class LoadTypeUserCheckParam {
private String checkResult; private String checkResult;
@ApiModelProperty(value="审核人") @ApiModelProperty(value="审核人")
@NotBlank(message = "审核人不能为空")
private String checkPerson; private String checkPerson;
@ApiModelProperty(value="审核意见") @ApiModelProperty(value="审核意见")
@NotBlank(message = "审核意见不能为空") @NotBlank(message = "审核意见不能为空")
private String checkComment; private String checkComment;
@ApiModelProperty(value="id集合")
private List<String> ids;
} }

View File

@@ -39,4 +39,10 @@ public class FlowableAss{
private String execIndex; private String execIndex;
/**
* 技术监督功能 1.普测电站 2.干扰源用户
*/
private Integer type;
} }

View File

@@ -249,4 +249,19 @@ public class LoadTypeUserManageController extends BaseController {
loadTypeUserManageService.delLoadTypeUserPlan(list); loadTypeUserManageService.delLoadTypeUserPlan(list);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} }
/**
* 提交审核
* @author cdf
* @date 2024/3/29
*/
@ApiOperation("提交审核")
@PostMapping(value = "submitAuditUser")
@ApiImplicitParam(name = "loadTypeUserCheckParam", value = "实体参数", required = true)
public HttpResult<Boolean> submitAuditUser(@RequestBody LoadTypeUserCheckParam loadTypeUserCheckParam) {
String methodDescribe = getMethodDescribe("submitAuditUser");
loadTypeUserManageService.submitAuditUser(loadTypeUserCheckParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}
} }

View File

@@ -75,9 +75,10 @@ public class FlowDefinitionController extends BaseController {
@PostMapping("/start") @PostMapping("/start")
public HttpResult<String> start(@ApiParam(value = "流程定义id") @RequestParam(value = "procDefId") String procDefId, public HttpResult<String> start(@ApiParam(value = "流程定义id") @RequestParam(value = "procDefId") String procDefId,
@ApiParam(value = "监督单id") @RequestParam(value = "thsIndex") String thsIndex, @ApiParam(value = "监督单id") @RequestParam(value = "thsIndex") String thsIndex,
@ApiParam(value = "表单功能类型") @RequestParam(value = "type") Integer type,
@ApiParam(value = "变量集合,json对象") @RequestBody Map<String, Object> variables) { @ApiParam(value = "变量集合,json对象") @RequestBody Map<String, Object> variables) {
String methodDescribe = getMethodDescribe("start"); String methodDescribe = getMethodDescribe("start");
String res = flowDefinitionService.startProcessInstanceById(procDefId, thsIndex, variables); String res = flowDefinitionService.startProcessInstanceById(procDefId, thsIndex,type, variables);
if (Objects.nonNull(res)) { if (Objects.nonNull(res)) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
} }

View File

@@ -70,10 +70,7 @@ public class FlowInstanceController extends BaseController {
@GetMapping(value = "/delete") @GetMapping(value = "/delete")
public HttpResult delete(@ApiParam(value = "流程实例ID", required = true) @RequestParam String instanceIds) { public HttpResult delete(@ApiParam(value = "流程实例ID", required = true) @RequestParam String instanceIds) {
String methodDescribe = getMethodDescribe("delete"); String methodDescribe = getMethodDescribe("delete");
flowInstanceService.delete(instanceIds,"测试删除");
flowInstanceService.delete(instanceIds,"测试删除");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} }

View File

@@ -29,7 +29,10 @@ public interface LoadTypeUserManageMapper extends BaseMapper<RLoadTypeUserManage
Page<RLoadTypeUserManageVO> getLoadTypeUserPage(IPage<RLoadTypeUserManageVO> page, Page<RLoadTypeUserManageVO> getLoadTypeUserPage(IPage<RLoadTypeUserManageVO> page,
@Param("param") LoadTypeUserSearchParam loadTypeUserSearchParam, @Param("param") LoadTypeUserSearchParam loadTypeUserSearchParam,
@Param("ids") List<String> ids, @Param("ids") List<String> ids,
@Param("aStatus") String aStatus @Param("aStatus") Integer aStatus,
@Param("iStatus") Integer iStatus,
@Param("iCheckPerson")String iCheckPerson,
@Param("aCheckPerson")String aCheckPerson
); );
/** /**

View File

@@ -6,6 +6,7 @@
<select id="selectDeployList" resultType="com.njcn.process.pojo.dto.flowable.FlowProcDefDto"> <select id="selectDeployList" resultType="com.njcn.process.pojo.dto.flowable.FlowProcDefDto">
SELECT SELECT
ffa.form_id,
rp.id_ as id, rp.id_ as id,
rp.deployment_id_ as deploymentId, rp.deployment_id_ as deploymentId,
rd.name_ as name, rd.name_ as name,
@@ -17,6 +18,7 @@
FROM FROM
act_re_procdef rp act_re_procdef rp
LEFT JOIN act_re_deployment rd ON rp.deployment_id_ = rd.id_ LEFT JOIN act_re_deployment rd ON rp.deployment_id_ = rd.id_
left join flow_form_ass ffa on rp.ID_ = ffa.definition_id
<where> <where>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and rd.name_ like concat('%', #{name}, '%') and rd.name_ like concat('%', #{name}, '%')

View File

@@ -26,8 +26,17 @@
<if test="param.fileUploadflag != null and param.fileUploadflag != ''"> <if test="param.fileUploadflag != null and param.fileUploadflag != ''">
and r.i_is_file_upload = #{param.fileUploadflag} and r.i_is_file_upload = #{param.fileUploadflag}
</if> </if>
<if test="aStatus!= null and aStatus != ''"> <if test="aStatus!= null">
and r.a_status != #{aStatus} and r.a_status = #{aStatus}
</if>
<if test="iStatus!= null">
and r.i_status = #{iStatus}
</if>
<if test="iCheckPerson!= null and iCheckPerson != ''">
and r.i_check_person = #{iCheckPerson}
</if>
<if test="aCheckPerson!= null and aCheckPerson != ''">
and r.a_check_person = #{aCheckPerson}
</if> </if>
</where> </where>
order by record_time desc order by record_time desc

View File

@@ -104,4 +104,7 @@ public interface LoadTypeUserManageService {
*/ */
Boolean delLoadTypeUserPlan(List<String> ids); Boolean delLoadTypeUserPlan(List<String> ids);
Boolean submitAuditUser(LoadTypeUserCheckParam loadTypeUserCheckParam);
} }

View File

@@ -25,7 +25,7 @@ public interface IFlowDefinitionService {
* @param variables 流程变量 * @param variables 流程变量
* @return * @return
*/ */
String startProcessInstanceById(String procDefId,String thsIndex, Map<String, Object> variables); String startProcessInstanceById(String procDefId,String thsIndex,Integer type, Map<String, Object> variables);

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -18,12 +19,14 @@ import com.njcn.device.pms.api.DistributionMonitorClient;
import com.njcn.oss.utils.FileStorageUtil; import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.process.constant.Param; import com.njcn.process.constant.Param;
import com.njcn.process.enums.AuditProcessEnum; import com.njcn.process.enums.AuditProcessEnum;
import com.njcn.process.enums.ThsFlowTypeEnum;
import com.njcn.process.mapper.FlowFormAssMapper; import com.njcn.process.mapper.FlowFormAssMapper;
import com.njcn.process.mapper.FlowableAssMapper; import com.njcn.process.mapper.FlowableAssMapper;
import com.njcn.process.mapper.LoadTypeUserManageMapper; import com.njcn.process.mapper.LoadTypeUserManageMapper;
import com.njcn.process.pojo.param.*; import com.njcn.process.pojo.param.*;
import com.njcn.process.pojo.po.FlowFormAss; import com.njcn.process.pojo.po.FlowFormAss;
import com.njcn.process.pojo.po.FlowableAss; import com.njcn.process.pojo.po.FlowableAss;
import com.njcn.process.pojo.po.RGeneralSurveyPlanPO;
import com.njcn.process.pojo.po.RLoadTypeUserManage; import com.njcn.process.pojo.po.RLoadTypeUserManage;
import com.njcn.process.pojo.vo.LoadTypeRelationExcel; import com.njcn.process.pojo.vo.LoadTypeRelationExcel;
import com.njcn.process.pojo.vo.LoadTypeUserExcel; import com.njcn.process.pojo.vo.LoadTypeUserExcel;
@@ -33,6 +36,7 @@ import com.njcn.process.service.LoadTypeUserManageService;
import com.njcn.process.service.flowable.IFlowDefinitionService; import com.njcn.process.service.flowable.IFlowDefinitionService;
import com.njcn.process.service.flowable.IFlowInstanceService; import com.njcn.process.service.flowable.IFlowInstanceService;
import com.njcn.process.service.flowable.IFlowTaskService; import com.njcn.process.service.flowable.IFlowTaskService;
import com.njcn.process.utils.FlowableUtils;
import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum; import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum; import com.njcn.system.enums.DicDataTypeEnum;
@@ -102,14 +106,16 @@ public class LoadTypeUserManageServiceImpl extends ServiceImpl<LoadTypeUserManag
Page<RLoadTypeUserManageVO> page = new Page<>(loadTypeUserSearchParam.getPageNum(), loadTypeUserSearchParam.getPageSize()); Page<RLoadTypeUserManageVO> page = new Page<>(loadTypeUserSearchParam.getPageNum(), loadTypeUserSearchParam.getPageSize());
List<String> ids=deptFeignClient.getDepSonIdtByDeptId (loadTypeUserSearchParam.getOrgNo()).getData ( ); List<String> ids=deptFeignClient.getDepSonIdtByDeptId (loadTypeUserSearchParam.getOrgNo()).getData ( );
Integer checkType = loadTypeUserSearchParam.getCheckType(); Integer checkType = loadTypeUserSearchParam.getCheckType();
String aStatus = null; Integer aStatus = null;
//0表示不是审核信息 1标识审核信息 //0表示不是审核信息 1标识审核信息
String checkPerson = null;
if(checkType==1){ if(checkType==1){
ids=ids.stream().filter(x->!x.contains(loadTypeUserSearchParam.getOrgNo())).collect(Collectors.toList()); aStatus = AuditProcessEnum.WaitAudit.getStatus();
aStatus = dicDataFeignClient.getDicDataByCode(DicDataEnum.FINISH.getCode()).getData().getId(); checkPerson = RequestUtil.getUserIndex();
} }
//干扰源用户信息录入 //干扰源用户信息录入
Page<RLoadTypeUserManageVO> loadTypeUserPage = loadTypeUserManageMapper.getLoadTypeUserPage(page, loadTypeUserSearchParam,ids,aStatus); Page<RLoadTypeUserManageVO> loadTypeUserPage = loadTypeUserManageMapper.getLoadTypeUserPage(page, loadTypeUserSearchParam,ids,aStatus,aStatus,checkPerson,checkPerson);
//查询审核,创建用户信息 //查询审核,创建用户信息
List<String> personList = new ArrayList<>(); List<String> personList = new ArrayList<>();
@@ -117,7 +123,7 @@ public class LoadTypeUserManageServiceImpl extends ServiceImpl<LoadTypeUserManag
if(StrUtil.isNotBlank(it.getACheckPerson())){ if(StrUtil.isNotBlank(it.getACheckPerson())){
personList.add(it.getACheckPerson()); personList.add(it.getACheckPerson());
} }
if(StrUtil.isNotBlank(it.getACheckPerson())){ if(StrUtil.isNotBlank(it.getICheckPerson())){
personList.add(it.getICheckPerson()); personList.add(it.getICheckPerson());
} }
if(StrUtil.isNotBlank(it.getCreateBy())){ if(StrUtil.isNotBlank(it.getCreateBy())){
@@ -136,8 +142,8 @@ public class LoadTypeUserManageServiceImpl extends ServiceImpl<LoadTypeUserManag
if(StrUtil.isNotBlank(rLoadTypeUserManageVO.getACheckPerson())){ if(StrUtil.isNotBlank(rLoadTypeUserManageVO.getACheckPerson())){
rLoadTypeUserManageVO.setACheckPersonName(userMap.get(rLoadTypeUserManageVO.getACheckPerson()).getName()); rLoadTypeUserManageVO.setACheckPersonName(userMap.get(rLoadTypeUserManageVO.getACheckPerson()).getName());
} }
if(StrUtil.isNotBlank(rLoadTypeUserManageVO.getICheckPersonName())){ if(StrUtil.isNotBlank(rLoadTypeUserManageVO.getICheckPerson())){
rLoadTypeUserManageVO.setICheckPersonName(userMap.get(rLoadTypeUserManageVO.getICheckPersonName()).getName()); rLoadTypeUserManageVO.setICheckPersonName(userMap.get(rLoadTypeUserManageVO.getICheckPerson()).getName());
} }
if(StrUtil.isNotBlank(rLoadTypeUserManageVO.getCreateBy())){ if(StrUtil.isNotBlank(rLoadTypeUserManageVO.getCreateBy())){
rLoadTypeUserManageVO.setCreateByName(userMap.get(rLoadTypeUserManageVO.getCreateBy()).getName()); rLoadTypeUserManageVO.setCreateByName(userMap.get(rLoadTypeUserManageVO.getCreateBy()).getName());
@@ -166,8 +172,11 @@ public class LoadTypeUserManageServiceImpl extends ServiceImpl<LoadTypeUserManag
} }
if (rLoadTypeUserManageVO.getAFilePath() != null) { if (rLoadTypeUserManageVO.getAFilePath() != null) {
String aFile = fileStorageUtil.getFileUrl(rLoadTypeUserManageVO.getAFilePath()); String aFile = fileStorageUtil.getFileUrl(rLoadTypeUserManageVO.getAFilePath());
rLoadTypeUserManageVO.setIFile(aFile); rLoadTypeUserManageVO.setAFile(aFile);
} }
rLoadTypeUserManageVO.setOrgName(deptFeignClient.getDeptById(rLoadTypeUserManage.getOrgNo()).getData().getName());
return rLoadTypeUserManageVO; return rLoadTypeUserManageVO;
} }
@@ -193,7 +202,7 @@ public class LoadTypeUserManageServiceImpl extends ServiceImpl<LoadTypeUserManag
//绑定工作流 //绑定工作流
//开始流程 //开始流程
FlowFormAss flowFormAss = flowFormAssMapper.selectOne(new LambdaQueryWrapper<FlowFormAss>().eq(FlowFormAss::getFormId, 2)); /*FlowFormAss flowFormAss = flowFormAssMapper.selectOne(new LambdaQueryWrapper<FlowFormAss>().eq(FlowFormAss::getFormId, 2));
if (Objects.isNull(flowFormAss)) { if (Objects.isNull(flowFormAss)) {
throw new BusinessException("当前功能未绑定流程,请先绑定流程"); throw new BusinessException("当前功能未绑定流程,请先绑定流程");
} }
@@ -205,7 +214,7 @@ public class LoadTypeUserManageServiceImpl extends ServiceImpl<LoadTypeUserManag
flowTaskVo.setTaskId(task.getId()); flowTaskVo.setTaskId(task.getId());
flowTaskVo.setInstanceId(processId); flowTaskVo.setInstanceId(processId);
flowTaskVo.setComment(RequestUtil.getUserNickname() + "发起录入干扰源用户申请"); flowTaskVo.setComment(RequestUtil.getUserNickname() + "发起录入干扰源用户申请");
iFlowTaskService.complete(flowTaskVo); iFlowTaskService.complete(flowTaskVo);*/
return true; return true;
} }
@@ -228,8 +237,8 @@ public class LoadTypeUserManageServiceImpl extends ServiceImpl<LoadTypeUserManag
rLoadTypeUserManage.setIFilePath(fileStorageUtil.uploadMultipart(multipartFile,OssPath.LOAD_TYPE_USER)); rLoadTypeUserManage.setIFilePath(fileStorageUtil.uploadMultipart(multipartFile,OssPath.LOAD_TYPE_USER));
rLoadTypeUserManage.setIFilePathName(multipartFile.getOriginalFilename()); rLoadTypeUserManage.setIFilePathName(multipartFile.getOriginalFilename());
rLoadTypeUserManage.setIUploadTime(new Date()); rLoadTypeUserManage.setIUploadTime(new Date());
rLoadTypeUserManage.setIIsFileUpload(rLoadTypeUserManage.getIFilePath()!=null?1:0);
} }
rLoadTypeUserManage.setIIsFileUpload(rLoadTypeUserManage.getIFilePath()!=null?1:0);
loadTypeUserManageMapper.updateById(rLoadTypeUserManage); loadTypeUserManageMapper.updateById(rLoadTypeUserManage);
return true; return true;
} }
@@ -437,19 +446,19 @@ public class LoadTypeUserManageServiceImpl extends ServiceImpl<LoadTypeUserManag
@Override @Override
@Transactional(rollbackFor = {Exception.class}) @Transactional(rollbackFor = {Exception.class})
public Boolean checkLoadTypeUserI(LoadTypeUserCheckParam loadTypeUserCheckParam) { public Boolean checkLoadTypeUserI(LoadTypeUserCheckParam loadTypeUserCheckParam) {
boolean result = true;
UpdateWrapper<RLoadTypeUserManage> updateWrapper = new UpdateWrapper(); UpdateWrapper<RLoadTypeUserManage> updateWrapper = new UpdateWrapper();
updateWrapper.eq("id", loadTypeUserCheckParam.getId()); updateWrapper.eq("id", loadTypeUserCheckParam.getId());
updateWrapper.set("i_check_comment", loadTypeUserCheckParam.getCheckComment()); updateWrapper.set("i_check_comment", loadTypeUserCheckParam.getCheckComment());
updateWrapper.set("i_check_person", loadTypeUserCheckParam.getCheckPerson()); updateWrapper.set("i_status", Objects.equals("1", loadTypeUserCheckParam.getCheckResult()) ? AuditProcessEnum.AuditPass.getStatus() :AuditProcessEnum.AuditRefuse.getStatus());
DictData fail = dicDataFeignClient.getDicDataByCode(DicDataEnum.FAILED.getCode()).getData();
DictData finish = dicDataFeignClient.getDicDataByCode(DicDataEnum.FINISH.getCode()).getData();
updateWrapper.set("i_status", Objects.equals("1", loadTypeUserCheckParam.getCheckResult()) ? finish.getId() : fail.getId());
int i = loadTypeUserManageMapper.update(null, updateWrapper); int i = loadTypeUserManageMapper.update(null, updateWrapper);
result = i == 1;
return result; //流程审核
FlowableAss flowableAss = flowableAssMapper.selectOne(new LambdaQueryWrapper<FlowableAss>().eq(FlowableAss::getType, ThsFlowTypeEnum.rLoadTypeUser.getCode()).eq(FlowableAss::getThsIndex,loadTypeUserCheckParam.getId()));
if(Objects.isNull(flowableAss)){
throw new BusinessException("当前功能未绑定流程,请联系管理员处理");
}
FlowableUtils.dealAuditResult(flowableAss,loadTypeUserCheckParam.getCheckResult(),iFlowTaskService,loadTypeUserCheckParam.getCheckComment());
return true;
} }
/** /**
@@ -498,6 +507,73 @@ public class LoadTypeUserManageServiceImpl extends ServiceImpl<LoadTypeUserManag
return true; return true;
} }
@Override
public Boolean submitAuditUser(LoadTypeUserCheckParam loadTypeUserCheckParam) {
String userId = RequestUtil.getUserIndex();
List<String> ids = loadTypeUserCheckParam.getIds();
Integer count = this.lambdaQuery().in(RLoadTypeUserManage::getId, ids).eq(RLoadTypeUserManage::getCreateBy, userId).count();
if (count != ids.size()) {
throw new BusinessException("只可以操作自己创建的计划!");
}
this.update(new LambdaUpdateWrapper<RLoadTypeUserManage>()
.in(RLoadTypeUserManage::getId, ids)
.set(RLoadTypeUserManage::getIStatus, AuditProcessEnum.WaitAudit.getStatus()).set(RLoadTypeUserManage::getICheckPerson, loadTypeUserCheckParam.getCheckPerson())
);
//绑定工作流
Map<String, Object> map = new HashMap<>();
//map.put("applyUser",userId);
for (String planId : ids) {
//需要判断那些流程已经启动,已经启动的则为驳回后的再次提交审核
FlowableAss flowableAss = flowableAssMapper.selectOne(new LambdaQueryWrapper<FlowableAss>().eq(FlowableAss::getThsIndex, planId));
if (Objects.nonNull(flowableAss)) {
//不为空则认为是驳回后的重新发起
Task task = iFlowTaskService.getTask(flowableAss.getExecIndex());
FlowTaskVo flowTaskVo = new FlowTaskVo();
flowTaskVo.setTaskId(task.getId());
flowTaskVo.setAssignee(userId);
flowTaskVo.setComment(RequestUtil.getUserNickname() + "重新发起新建干扰源用户申请");
iFlowTaskService.complete(flowTaskVo);
Task taskNext = iFlowTaskService.getTask(flowableAss.getExecIndex());
FlowTaskVo flowTaskVoNext = new FlowTaskVo();
flowTaskVoNext.setTaskId(taskNext.getId());
flowTaskVoNext.setAssignee(loadTypeUserCheckParam.getCheckPerson());
iFlowTaskService.toNextTaskUser(flowTaskVoNext);
} else {
//开始流程
FlowFormAss flowFormAss = flowFormAssMapper.selectOne(new LambdaQueryWrapper<FlowFormAss>().eq(FlowFormAss::getFormId, 2));
if (Objects.isNull(flowFormAss)) {
throw new BusinessException("当前功能未绑定流程,请先绑定流程");
}
String processId = iFlowDefinitionService.startProcessInstanceById(flowFormAss.getDefinitionId(), planId,ThsFlowTypeEnum.rLoadTypeUser.getCode(), map);
Task task = iFlowTaskService.getTask(processId);
FlowTaskVo flowTaskVo = new FlowTaskVo();
flowTaskVo.setTaskId(task.getId());
flowTaskVo.setInstanceId(processId);
flowTaskVo.setComment(RequestUtil.getUserNickname() + "发起新建干扰源用户申请");
iFlowTaskService.complete(flowTaskVo);
Task taskReport = iFlowTaskService.getTask(processId);
FlowTaskVo flowTaskVoReport = new FlowTaskVo();
flowTaskVoReport.setTaskId(taskReport.getId());
flowTaskVoReport.setAssignee(userId);
flowTaskVoReport.setComment(RequestUtil.getUserNickname() + "填报了预测评估报告");
iFlowTaskService.complete(flowTaskVoReport);
Task taskNext = iFlowTaskService.getTask(processId);
FlowTaskVo flowTaskVoNext = new FlowTaskVo();
flowTaskVoNext.setTaskId(taskNext.getId());
flowTaskVoNext.setAssignee(loadTypeUserCheckParam.getCheckPerson());
iFlowTaskService.toNextTaskUser(flowTaskVoNext);
}
}
return true;
}
/** /**
* @Description: 干扰源用户报告状态,待审核无法修改信息 * @Description: 干扰源用户报告状态,待审核无法修改信息
* @param id * @param id

View File

@@ -19,6 +19,7 @@ import com.njcn.oss.constant.OssPath;
import com.njcn.oss.enums.OssResponseEnum; import com.njcn.oss.enums.OssResponseEnum;
import com.njcn.oss.utils.FileStorageUtil; import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.process.enums.AuditProcessEnum; import com.njcn.process.enums.AuditProcessEnum;
import com.njcn.process.enums.ThsFlowTypeEnum;
import com.njcn.process.mapper.*; import com.njcn.process.mapper.*;
import com.njcn.process.pojo.param.*; import com.njcn.process.pojo.param.*;
import com.njcn.process.pojo.po.*; import com.njcn.process.pojo.po.*;
@@ -492,14 +493,15 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
//处理流程 //处理流程
FlowableAss flowableAss = flowableAssMapper.selectOne(new LambdaQueryWrapper<FlowableAss>().eq(FlowableAss::getThsIndex, rGeneralSurveyPlanChcekParm.getPlanNo())); FlowableAss flowableAss = flowableAssMapper.selectOne(new LambdaQueryWrapper<FlowableAss>().eq(FlowableAss::getThsIndex, rGeneralSurveyPlanChcekParm.getPlanNo()));
if(Objects.isNull(flowableAss)){
throw new BusinessException("当前功能未绑定流程,请联系管理员处理");
}
String auditResult = Objects.equals("1", rGeneralSurveyPlanChcekParm.getCheckResult()) ? "同意" : "拒绝"; String auditResult = Objects.equals("1", rGeneralSurveyPlanChcekParm.getCheckResult()) ? "同意" : "拒绝";
Task task = iFlowTaskService.getTask(flowableAss.getExecIndex()); Task task = iFlowTaskService.getTask(flowableAss.getExecIndex());
FlowTaskVo flowTaskVo = new FlowTaskVo(); FlowTaskVo flowTaskVo = new FlowTaskVo();
flowTaskVo.setTaskId(task.getId()); flowTaskVo.setTaskId(task.getId());
flowTaskVo.setComment(RequestUtil.getUserNickname() + auditResult + " 编号为" + rGeneralSurveyPlanChcekParm.getPlanNo() + "的计划,理由:" + rGeneralSurveyPlanChcekParm.getCheckComment()); flowTaskVo.setComment(RequestUtil.getUserNickname() + auditResult + " 编号为" + rGeneralSurveyPlanChcekParm.getPlanNo() + "的计划,理由:" + rGeneralSurveyPlanChcekParm.getCheckComment());
if (Objects.equals("0", rGeneralSurveyPlanChcekParm.getCheckResult())) { if (Objects.equals("0", rGeneralSurveyPlanChcekParm.getCheckResult())) {
//拒绝,则回退到申请步骤 //拒绝,则回退到申请步骤
iFlowTaskService.taskReject(flowTaskVo); iFlowTaskService.taskReject(flowTaskVo);
@@ -749,7 +751,7 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
throw new BusinessException("当前功能未绑定流程,请先绑定流程"); throw new BusinessException("当前功能未绑定流程,请先绑定流程");
} }
String processId = iFlowDefinitionService.startProcessInstanceById(flowFormAss.getDefinitionId(), planId, map); String processId = iFlowDefinitionService.startProcessInstanceById(flowFormAss.getDefinitionId(), planId, ThsFlowTypeEnum.rGeneralSurvey.getCode(), map);
Task task = iFlowTaskService.getTask(processId); Task task = iFlowTaskService.getTask(processId);
FlowTaskVo flowTaskVo = new FlowTaskVo(); FlowTaskVo flowTaskVo = new FlowTaskVo();
flowTaskVo.setTaskId(task.getId()); flowTaskVo.setTaskId(task.getId());

View File

@@ -282,7 +282,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
} else { } else {
proInId = "flow_yzep99kb:2:6358e099-dcba-11ed-8026-b07b253cdad9"; proInId = "flow_yzep99kb:2:6358e099-dcba-11ed-8026-b07b253cdad9";
} }
iFlowDefinitionService.startProcessInstanceById(proInId, thsSupervise.getSupIndex(), mapParam); iFlowDefinitionService.startProcessInstanceById(proInId, thsSupervise.getSupIndex(),55, mapParam);
} }
/** /**

View File

@@ -70,7 +70,7 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String startProcessInstanceById(String procDefId,String thsIndex, Map<String, Object> variables) { public String startProcessInstanceById(String procDefId,String thsIndex,Integer type, Map<String, Object> variables) {
try { try {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId) ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId)
.latestVersion().singleResult(); .latestVersion().singleResult();
@@ -87,6 +87,7 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
flowableAss.setThsIndex(thsIndex); flowableAss.setThsIndex(thsIndex);
flowableAss.setProIndex(res.getDeploymentId()); flowableAss.setProIndex(res.getDeploymentId());
flowableAss.setExecIndex(res.getProcessInstanceId()); flowableAss.setExecIndex(res.getProcessInstanceId());
flowableAss.setType(type);
flowableAssMapper.insert(flowableAss); flowableAssMapper.insert(flowableAss);
return res.getProcessInstanceId(); return res.getProcessInstanceId();

View File

@@ -2,6 +2,7 @@ package com.njcn.process.service.impl.flowable;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.process.factory.FlowServiceFactory; import com.njcn.process.factory.FlowServiceFactory;
import com.njcn.process.pojo.vo.flowable.FlowTaskVo; import com.njcn.process.pojo.vo.flowable.FlowTaskVo;
@@ -90,7 +91,7 @@ public class FlowInstanceServiceImpl extends FlowServiceFactory implements IFlow
HistoricProcessInstance historicProcessInstance = HistoricProcessInstance historicProcessInstance =
historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
if (Objects.isNull(historicProcessInstance)) { if (Objects.isNull(historicProcessInstance)) {
throw new FlowableObjectNotFoundException("流程实例不存在: " + processInstanceId); throw new BusinessException("流程实例不存在: " + processInstanceId);
} }
return historicProcessInstance; return historicProcessInstance;
} }

View File

@@ -201,6 +201,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
flowTask.setFinishTime(hisIns.getEndTime()); flowTask.setFinishTime(hisIns.getEndTime());
flowTask.setProcInsId(hisIns.getId()); flowTask.setProcInsId(hisIns.getId());
FlowableAss flowableAss = flowableAssMapper.selectOne(new LambdaQueryWrapper<FlowableAss>().eq(FlowableAss::getExecIndex,hisIns.getId()));
flowTask.setFormAssId(flowableAss.getThsIndex());
// 计算耗时 // 计算耗时
if (Objects.nonNull(hisIns.getEndTime())) { if (Objects.nonNull(hisIns.getEndTime())) {
long time = hisIns.getEndTime().getTime() - hisIns.getStartTime().getTime(); long time = hisIns.getEndTime().getTime() - hisIns.getStartTime().getTime();
@@ -340,6 +342,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
FlowTaskDto flowTask = new FlowTaskDto(); FlowTaskDto flowTask = new FlowTaskDto();
flowTask.setFormAssId(flowableAss.getThsIndex()); flowTask.setFormAssId(flowableAss.getThsIndex());
flowTask.setFormType(flowableAss.getType());
// 当前流程信息 // 当前流程信息
flowTask.setTaskId(task.getId()); flowTask.setTaskId(task.getId());
flowTask.setTaskDefKey(task.getTaskDefinitionKey()); flowTask.setTaskDefKey(task.getTaskDefinitionKey());

View File

@@ -1,9 +1,16 @@
package com.njcn.process.utils; package com.njcn.process.utils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.process.pojo.po.FlowableAss;
import com.njcn.process.pojo.vo.flowable.FlowTaskVo;
import com.njcn.process.service.flowable.IFlowTaskService;
import com.njcn.web.utils.RequestUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.flowable.bpmn.model.*; import org.flowable.bpmn.model.*;
import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior; import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior;
import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior; import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior;
import org.flowable.task.api.Task;
import org.flowable.task.api.history.HistoricTaskInstance; import org.flowable.task.api.history.HistoricTaskInstance;
import java.util.*; import java.util.*;
@@ -586,4 +593,30 @@ public class FlowableUtils {
log.info("清洗后的历史节点数据:" + lastHistoricTaskInstanceList); log.info("清洗后的历史节点数据:" + lastHistoricTaskInstanceList);
return lastHistoricTaskInstanceList; return lastHistoricTaskInstanceList;
} }
/**
*
* @author cdf
* @date 2024/4/10
*/
public static void dealAuditResult(FlowableAss flowableAss, String auditFlag, IFlowTaskService iFlowTaskService,String comment){
String auditResult = Objects.equals("1", auditFlag) ? "同意" : "拒绝";
Task task = iFlowTaskService.getTask(flowableAss.getExecIndex());
FlowTaskVo flowTaskVo = new FlowTaskVo();
flowTaskVo.setTaskId(task.getId());
flowTaskVo.setComment(RequestUtil.getUserNickname() + auditResult + " 理由:" + comment);
if (Objects.equals("0", auditFlag)) {
//拒绝,则回退到申请步骤
iFlowTaskService.taskReject(flowTaskVo);
} else {
//同意
flowTaskVo.setInstanceId(flowableAss.getExecIndex());
Map<String, Object> map = new HashMap<>();
map.put("auditFlag", 1);
flowTaskVo.setVariables(map);
iFlowTaskService.complete(flowTaskVo);
}
}
} }