提交 b3cec006 authored 作者: whydesc's avatar whydesc

--工作流和业务的处理履历信息和bug处理

上级 88956ce8
......@@ -536,11 +536,13 @@
submitData.values['userTaskid'] = nextNodeNameSelevue.value;
}
if (!showApprovalUi.value) {
await complete(submitData);
emit('callback');
return false;
}
const formData = await validate();
Object.assign(submitData, formData);
......@@ -562,6 +564,7 @@
submitData.values['approvalType'] = 'role';
}
// }
console.log("-----------submitData ",submitData);
// 执行发送
const result = await complete(submitData);
......
<template>
<div class="plan-management-page">
<!-- 页面头部区域 -->
<!-- <div class="page-header">
<div class="header-content">
<div class="header-left">
<h1 class="page-title">计划编制管理</h1>
<p class="page-desc">统一管理和追踪所有业务计划的编制与审批流程</p>
</div>
<div class="header-stats">
<div class="stat-item">
<span class="stat-value">--</span>
<span class="stat-label">计划总数</span>
</div>
<div class="stat-item warning">
<span class="stat-value">--</span>
<span class="stat-label">待处理</span>
</div>
<div class="stat-item success">
<span class="stat-value">--</span>
<span class="stat-label">已完成</span>
</div>
</div>
</div>
</div> -->
<!-- 主内容区 -->
<div class="main-content">
<!-- 搜索区域 -->
......@@ -19,12 +43,12 @@
<JSearchSelect placeholder="请选择类型" v-model:value="queryParam['projectType']" dict="projecttype" />
</a-form-item>
</a-col>
<a-col :xl="7" :lg="8" :md="12" :sm="24">
<a-col :xl="5" :lg="8" :md="12" :sm="24">
<a-form-item label="执行部门">
<JSelectDept placeholder="请选择执行部门" v-model:value="queryParam['execDepCode']" />
</a-form-item>
</a-col>
<a-col :xl="5" :lg="8" :md="12" :sm="24">
<a-col :xl="4" :lg="8" :md="12" :sm="24">
<a-form-item label="计划状态">
<a-select
v-model:value="queryParam['status']"
......@@ -42,8 +66,6 @@
/>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :xl="5" :lg="8" :md="12" :sm="24">
<a-form-item label="计划日期">
<a-range-picker
......@@ -54,6 +76,8 @@
/>
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :xl="5" :lg="8" :md="12" :sm="24">
<a-form-item label="优先级">
<a-select
......@@ -82,7 +106,7 @@
/>
</a-form-item>
</a-col>
<a-col :xl="7" :lg="16" :md="24" :sm="24">
<a-col :xl="14" :lg="16" :md="24" :sm="24">
<a-form-item class="search-btn-group">
<a-space :size="8">
<a-button type="primary" @click="searchQuery">查询</a-button>
......@@ -142,12 +166,12 @@
<!-- 待办抽屉 -->
<div v-if="isShowDrawer">
<a-drawer destroyOnClose v-model:open="isShowDrawer" class="flat-drawer" title="待办任务" placement="right" width="90%">
<!-- <template #extra>
<template #extra>
<div class="drawer-tags">
<span class="tag">发起人: {{ startUser }}</span>
<span class="tag">任务节点: {{ taskName }}</span>
</div>
</template> -->
</template>
<TodoIndex v-if="isShowDrawer" ref="refTodoIndex" @callback="handleSuccess" />
</a-drawer>
</div>
......@@ -521,6 +545,8 @@
{
label: '待办',
ifShow: () => {
console.log("-------------record['uid'] ",record['uid']);
console.log("-------------userStore.getUserInfo.id ",userStore.getUserInfo.id);
if (record['bpmStatus'] == '2' && record['uid'] == userStore.getUserInfo.id) return true;
else return false;
},
......
......@@ -4,12 +4,12 @@
<select id="selectSysDeployFormByDeployId" resultType="org.jeecg.modules.flowable.apithird.business.entity.FlowForm">
select t2.form_table_name as formTableName,t1.form_options as formContent,t1.form_name as formName,t1.form_id as formId from sys_form t1 left join sys_deploy_form t2 on t1.form_id = t2.form_id
where t2.deploy_id = #{deployId} limit 1
where t2.deploy_id = #{deployId} order by t2.id desc limit 1
</select>
<select id="selectSysFormByDeployId" resultType="org.jeecg.modules.flowable.apithird.business.entity.FlowForm">
select t1.* from sys_form t1 left join sys_deploy_form t2 on t1.form_id = t2.form_id
where t2.deploy_id = #{deployId} limit 1
where t2.deploy_id = #{deployId} order by t2.id desc limit 1
</select>
<update id="updateBisTabBpmStatus" parameterType="org.jeecg.modules.flowable.apithird.business.entity.FlowForm">
......
......@@ -19,4 +19,5 @@ public class FlowTaskVo {
private List<String> candidateUsers;
private List<String> candidateGroups;
private String userTaskid;
private boolean nodeisApprove;
}
package org.jeecg.modules.flowable.domain.vo;
import lombok.Data;
@Data
public class MyTaskFlowVo {
private java.lang.String formTableName;
private java.lang.String targetId;
private java.lang.String deployId;
private java.lang.String taskId;
private java.lang.String procInsId;
private java.lang.String executionId;
private java.lang.String procDefId;
private java.lang.String uid;
private java.lang.String roleid;
private java.lang.String taskDefinitionKey;
private boolean nodeisApprove;
}
......@@ -25,6 +25,8 @@ import org.jeecg.modules.flowable.common.constant.ProcessConstants;
import org.jeecg.modules.flowable.domain.dto.FlowProcDefDto;
import org.jeecg.modules.flowable.factory.FlowServiceFactory;
import org.jeecg.modules.flowable.service.IFlowDefinitionService;
import org.jeecg.modules.stm.my.entity.MyTaskFlowHis;
import org.jeecg.modules.stm.my.service.IMyTaskFlowHisService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -33,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -50,6 +53,8 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
FlowTaskServiceImpl flowTaskService;
@Autowired
private ISysDeployFormService sysDeployFormService;
@Autowired
private IMyTaskFlowHisService myTaskFlowHisService;
private static final String BPMN_FILE_SUFFIX = ".bpmn";
......@@ -353,6 +358,9 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
public Result startProcessInstanceByDeployId(String DeployId, Map<String, Object> variables) {
// 构建返回结果
Map<String, Object> result = new HashMap<>();
Date cdate = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String curdate = sdf.format(cdate);
try {
......@@ -431,6 +439,48 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
}
MyTaskFlowHis taskFlowHis=new MyTaskFlowHis();
taskFlowHis.setTaskId(task.getId());
taskFlowHis.setProcDefId(task.getProcessDefinitionId());
taskFlowHis.setProcInsId(task.getProcessInstanceId());
taskFlowHis.setExecutionId(task.getExecutionId());
if(zdval!=null&&!zdval.equals("")){
taskFlowHis.setTargetId(zdval);
}
taskFlowHis.setDeployId(DeployId);
if(flowForm!=null&&flowForm.getFormTableName()!=null){
taskFlowHis.setFormTableName(flowForm.getFormTableName());
}
String userType="user";
String approvalId=sysUser.getId();
if(userType.equals("user")) {
taskFlowHis.setUid(approvalId);
} else {
taskFlowHis.setRoleid(approvalId);
}
taskFlowHis.setTaskDefinitionKey(task.getTaskDefinitionKey());
taskFlowHis.setOptionTime(cdate);
taskFlowHis.setOptionId(sysUser.getId());
taskFlowHis.setOptionType("操作类型");
taskFlowHis.setTaskType("发起");//发起 办理 转办 结束
taskFlowHis.setTaskName(task.getName());
taskFlowHis.setTaskTitle("标题");
taskFlowHis.setFlowName("");
myTaskFlowHisService.save(taskFlowHis);
}
......
......@@ -56,6 +56,7 @@ import org.jeecg.modules.flowable.domain.dto.FlowNextDto;
import org.jeecg.modules.flowable.domain.dto.FlowTaskDto;
import org.jeecg.modules.flowable.domain.dto.FlowViewerDto;
import org.jeecg.modules.flowable.domain.vo.FlowTaskVo;
import org.jeecg.modules.flowable.domain.vo.MyTaskFlowVo;
import org.jeecg.modules.flowable.factory.FlowServiceFactory;
import org.jeecg.modules.flowable.flow.CustomProcessDiagramGenerator;
import org.jeecg.modules.flowable.flow.FindNextNodeUtil;
......@@ -63,6 +64,7 @@ import org.jeecg.modules.flowable.flow.FlowableUtils;
import org.jeecg.modules.flowable.service.IFlowTaskService;
import org.jeecg.modules.stm.my.entity.MyTask;
import org.jeecg.modules.stm.my.entity.MyTaskFlow;
import org.jeecg.modules.stm.my.entity.MyTaskFlowHis;
import org.jeecg.modules.stm.my.service.IMyTaskFlowHisService;
import org.jeecg.modules.stm.my.service.IMyTaskFlowService;
import org.jeecg.modules.stm.my.service.IMyTaskService;
......@@ -116,52 +118,116 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
@Override
public Result complete(FlowTaskVo taskVo) {
Date cdate = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String curdate = sdf.format(cdate);
Task task = taskService.createTaskQuery().taskId(taskVo.getTaskId()).singleResult();
if (Objects.isNull(task)) {
return Result.error("任务不存在");
}
// 根据流程定义ID查询流程定义对象
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.processDefinitionId(task.getProcessDefinitionId())
.singleResult();
String deploymentId ="";
if (processDefinition != null) {
// 获取部署ID - 这就是你想要的deployId
deploymentId = processDefinition.getDeploymentId();
}
if (DelegationState.PENDING.equals(task.getDelegationState())) {
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getType(), taskVo.getComment());
taskService.resolveTask(taskVo.getTaskId(), taskVo.getValues());
//taskService.setAssignee(taskVo.getTaskId(),"e9ca23d68d884d4ebb19d07889727dae");
} else {
// 获取流程变量
Map<String, Object> formValues = getProcessVariables(taskVo.getTaskId());
String zdmc="";
String zdval="";
if(formValues.get("dataName")==null){
if(formValues.get("_value")!=null) {
Map zdv = (Map) formValues.get("_value");
zdmc = (String) zdv.get("dataName");
zdval = zdv.get("dataId").toString();
}
}else{
zdmc=(String)formValues.get("dataName");
zdval=formValues.get("dataId").toString();
}
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getComment());
//Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
SysUser loginUser = iFlowThirdService.getLoginUser();
taskService.complete(taskVo.getTaskId(), taskVo.getValues());
String userType ="";
String approvalId="";
Object userTypeObject = taskVo.getValues().get("approvalType");
if(userTypeObject!=null) {
userType = userTypeObject.toString();
approvalId = taskVo.getValues().get("approval").toString();
}
MyTaskFlowHis taskFlowHis=new MyTaskFlowHis();
taskFlowHis.setTaskId(task.getId());
taskFlowHis.setProcDefId(task.getProcessDefinitionId());
taskFlowHis.setProcInsId(task.getProcessInstanceId());
taskFlowHis.setExecutionId(task.getExecutionId());
if(zdval!=null&&!zdval.equals("")){
taskFlowHis.setTargetId(zdval);
}
taskFlowHis.setDeployId(deploymentId);
Long tformId = Long.parseLong(task.getFormKey());
FlowForm tsysForm = flowFormService.getById(tformId); // 假设有这个方法
if(tsysForm!=null&&tsysForm.getFormTableName()!=null){
taskFlowHis.setFormTableName(tsysForm.getFormTableName());
}
if(userType.equals("user")) {
taskFlowHis.setUid(approvalId);
} else {
taskFlowHis.setRoleid(approvalId);
}
taskFlowHis.setTaskDefinitionKey(task.getTaskDefinitionKey());
taskFlowHis.setOptionTime(cdate);
taskFlowHis.setOptionId(loginUser.getId());
taskFlowHis.setOptionType("操作类型");
taskFlowHis.setTaskType("节点类型");//发起 办理 转办 结束
taskFlowHis.setTaskName(task.getName());
taskFlowHis.setTaskTitle("标题");
taskFlowHis.setFlowName("");
myTaskFlowHisService.save(taskFlowHis);
Task nextTask = taskService.createTaskQuery()
.processInstanceId(taskVo.getInstanceId())
.singleResult();
if(nextTask!=null){
String userType = userTypeObject.toString();
String approvalId = taskVo.getValues().get("approval").toString();
if(userType.equals("user")) {
taskService.setAssignee(nextTask.getId(), approvalId);
} else {
taskService.addCandidateGroup(nextTask.getId(),approvalId);
}
// 获取流程变量
Map<String, Object> formValues = getProcessVariables(taskVo.getTaskId());
String zdmc="";
String zdval="";
if(formValues.get("dataName")==null){
if(formValues.get("_value")!=null) {
Map zdv = (Map) formValues.get("_value");
zdmc = (String) zdv.get("dataName");
zdval = zdv.get("dataId").toString();
}
}else{
zdmc=(String)formValues.get("dataName");
zdval=formValues.get("dataId").toString();
}
// 处理表单数据
// Map<String, Object> formData = processFormData(task);
......@@ -201,16 +267,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
myTaskService.save(myTask);
// 4. 根据流程定义ID查询流程定义对象
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.processDefinitionId(task.getProcessDefinitionId())
.singleResult();
String deploymentId ="";
if (processDefinition != null) {
// 获取部署ID - 这就是你想要的deployId
deploymentId = processDefinition.getDeploymentId();
}
//有了以上信息,可以向相关表写入 相关信息了
MyTaskFlow taskFlow=new MyTaskFlow();
taskFlow.setTaskId(nextTask.getId());
......@@ -248,62 +308,30 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
}
}
}
//判断是否是最后一个节点
Task endnextTask = taskService.createTaskQuery()
.processInstanceId(taskVo.getInstanceId())
.singleResult();
if(endnextTask==null){
// 获取流程变量
Map<String, Object> formValues = getProcessVariables(taskVo.getTaskId());
String zdmc = Optional.ofNullable(formValues)
.map(map -> map.get("dataName"))
.map(Object::toString) // 安全转换为String
.orElse(null);
String zdval = Optional.ofNullable(formValues)
.map(map -> map.get("dataId"))
.map(Object::toString) // 安全转换为String
.orElse(null);
// 通过流程定义ID查询流程定义对象
ProcessDefinition processDefinition = repositoryService
.createProcessDefinitionQuery()
.processDefinitionId(task.getProcessDefinitionId()) // 替换为你的流程定义ID
.singleResult();
}else{
//是最后一个 id 判断是最后一个节点
if (processDefinition != null) {
// 从流程定义对象中获取部署ID
String DeployId = processDefinition.getDeploymentId();
FlowForm flowForm=sysDeployFormService.selectSysDeployFormByDeployId(DeployId);
FlowForm flowForm=sysDeployFormService.selectSysDeployFormByDeployId(deploymentId);
if(flowForm!=null){
if(flowForm!=null){
String tabname= flowForm.getFormTableName();
if(tabname!=null&&!tabname.equals("")&&zdmc!=null&&!zdmc.equals("")&&zdval!=null&&!zdval.equals("")){
String formContent=zdmc+"="+zdval;
FlowForm flowFormben=new FlowForm();
flowFormben.setFormTableName(tabname);
flowFormben.setFormContent(formContent);
flowFormben.setFormTp("3");
flowFormben.setFormUrl(DeployId);
sysDeployFormService.updateBisTabBpmStatus(flowFormben);
String tabname= flowForm.getFormTableName();
if(tabname!=null&&!tabname.equals("")&&zdmc!=null&&!zdmc.equals("")&&zdval!=null&&!zdval.equals("")){
String formContent=zdmc+"="+zdval;
FlowForm flowFormben=new FlowForm();
flowFormben.setFormTableName(tabname);
flowFormben.setFormContent(formContent);
flowFormben.setFormTp("3");
flowFormben.setFormUrl(deploymentId);
sysDeployFormService.updateBisTabBpmStatus(flowFormben);
}
}
}
}
}
}
return Result.OK();
}
@Override
......@@ -1625,18 +1653,22 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
//String dataType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_DATA_TYPE);
String dataType="fixed";
String userType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_USER_TYPE);
if(userType!=null) {
flowNextDto.setType(userType);
if (userType.equals("user") && (userTask.getAssignee() == null || (userTask.getAssignee() != null && userTask.getAssignee().equals("")))) {
dataType = "dynamic";
}
if (userType.equals("role") && (userTask.getCandidateGroups() == null || (userTask.getCandidateGroups() != null && userTask.getCandidateGroups().size() == 0))) {
dataType = "dynamic";
}
if (userType.equals("role") && (userTask.getCandidateGroups() != null && userTask.getCandidateGroups().size() > 0)) {
dataType = "fixed";
}
}else{
flowNextDto.setType("user");//why 2026-4-13 如果是null, 强制指定
}
flowNextDto.setDataType(dataType);
flowNextDto.setType(userType);
if(userType.equals("user")&&(userTask.getAssignee()==null||(userTask.getAssignee()!=null&&userTask.getAssignee().equals("")))){
dataType="dynamic";
}
if(userType.equals("role")&&(userTask.getCandidateGroups()==null||(userTask.getCandidateGroups()!=null&&userTask.getCandidateGroups().size()==0))){
dataType="dynamic";
}
if(userType.equals("role")&&(userTask.getCandidateGroups()!=null&&userTask.getCandidateGroups().size()>0)){
dataType="fixed";
}
flowNextDto.setDataType(dataType);
}
......@@ -2464,7 +2496,20 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
//flowTaskVo.getDeploymentId()
//flowTaskVo.getDataId()
MyTaskFlow myTaskFlow= myTaskFlowService.selectMyTaskFlowByDeployId(flowTaskVo.getDeploymentId(),flowTaskVo.getDataId());
return Result.OK(myTaskFlow);
MyTaskFlowVo vo=new MyTaskFlowVo();
vo.setTaskId(myTaskFlow.getTaskId());
vo.setDeployId(myTaskFlow.getDeployId());
vo.setProcDefId(myTaskFlow.getProcDefId());
vo.setProcInsId(myTaskFlow.getProcInsId());
vo.setExecutionId(myTaskFlow.getExecutionId());
FlowNextDto flowtDto=getFlowNodeType(myTaskFlow.getTaskId());
if(flowtDto!=null){
vo.setNodeisApprove(flowtDto.isNodeisApprove());
}
return Result.OK(vo);
}
......
......@@ -74,4 +74,6 @@ public class MyTaskFlow implements Serializable {
private java.lang.String taskDefinitionKey;
}
......@@ -95,4 +95,16 @@ public class MyTaskFlowHis implements Serializable {
@Excel(name = "节点类型", width = 15)
@Schema(description = "节点类型")
private java.lang.String taskType;
/**节点名称*/
@Excel(name = "节点名称", width = 15)
@Schema(description = "节点名称")
private java.lang.String taskName;
/**标题*/
@Excel(name = "标题", width = 15)
@Schema(description = "标题")
private java.lang.String taskTitle;
/**流程名称*/
@Excel(name = "流程名称", width = 15)
@Schema(description = "流程名称")
private java.lang.String flowName;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论