提交代码

main
姜玉琦 2024-02-27 02:45:37 +08:00
parent ab67fcc363
commit fb31744f9b
17 changed files with 1034 additions and 426 deletions

View File

@ -138,4 +138,56 @@ LEFT OUTER JOIN pro_project_apply ppa ON DEF.BUSINESS_KEY_ = ppa.id
LEFT JOIN sys_user ru ON ru.user_id = RES.ASSIGNEE_
LEFT JOIN sys_dept rd ON rd.dept_id = ru.dept_id
WHERE
RES.ASSIGNEE_ is not null and RES.END_TIME_ is not null)
RES.ASSIGNEE_ is not null and RES.END_TIME_ is not null)
##审批意见
DROP view vw_flow_comment;
CREATE VIEW vw_flow_comment AS (
SELECT
hi.ID_ as cc,
hc.ID_ AS commentId,
hc.TYPE_ AS commentType,
ht.ID_ AS taskId,
ht.NAME_ AS taskName,
ht.REV_ AS rev,
CASE
WHEN hc.TYPE_ = 1 and ht.NAME_ !='提交申请' THEN
'通过'
WHEN hc.TYPE_ = 2 THEN
'退回'
WHEN hc.TYPE_ = 3 THEN
'驳回'
WHEN hc.TYPE_ = 4 THEN
'委派'
WHEN hc.TYPE_ = 5 THEN
'转办'
WHEN hc.TYPE_ = 6 THEN
'终止'
WHEN hc.TYPE_ = 7 THEN
'撤回'
END AS commentResult,
ht.PROC_INST_ID_ AS procInstId,
ht.TASK_DEF_KEY_ AS taskDefKey,
ht.EXECUTION_ID_ AS executionId,
ht.DELETE_REASON_ AS deleteReason,
DATE_FORMAT(
ht.START_TIME_,
'%Y-%m-%d %H:%i:%S'
) AS startTime,
DATE_FORMAT(
ht.END_TIME_,
'%Y-%m-%d %H:%i:%S'
) AS endTime,
ht.DURATION_ AS duration,
hc.MESSAGE_ AS message,
ru.nick_name AS assigneeName,
rd.dept_name AS deptName,
r.role_name as candidate
FROM
act_hi_taskinst ht
LEFT JOIN act_hi_comment hc ON hc.TASK_ID_ = ht.ID_ or (hc.TASK_ID_ is null and hc.PROC_INST_ID_ = ht.PROC_INST_ID_)
LEFT JOIN act_hi_identitylink hi on hi.TYPE_ = 'candidate' and hi.TASK_ID_ = ht.ID_ and hi.USER_ID_ IS NULL
left JOIN sys_role r on r.role_id = hi.group_Id_
LEFT JOIN sys_user ru ON ru.user_id = ht.ASSIGNEE_
LEFT JOIN sys_dept rd ON rd.dept_id = ru.dept_id
where hc.TYPE_ is null or hc.TYPE_!='event')

View File

@ -2,7 +2,7 @@ package com.yanzhu.flowable.controller;
import com.yanzhu.common.core.domain.AjaxResult;
import com.yanzhu.system.domain.flowable.FlowTaskVo;
import com.yanzhu.flowable.domain.FlowTaskVo;
import com.yanzhu.flowable.service.IFlowInstanceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

View File

@ -5,7 +5,7 @@ import com.yanzhu.common.core.domain.AjaxResult;
import com.yanzhu.common.enums.BusinessType;
import com.yanzhu.flowable.domain.FlowTaskDto;
import com.yanzhu.system.domain.flowable.FlowQueryVo;
import com.yanzhu.system.domain.flowable.FlowTaskVo;
import com.yanzhu.flowable.domain.FlowTaskVo;
import com.yanzhu.flowable.service.IFlowTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -95,6 +95,13 @@ public class FlowTaskController {
return flowTaskService.complete(flowTaskVo);
}
@ApiOperation(value = "重新提交流程")
@Log(title = "重新提交流程", businessType = BusinessType.UPDATE)
@PostMapping(value = "/completeAndModify")
public AjaxResult completeAndModify(@RequestBody FlowTaskVo flowTaskVo) {
return flowTaskService.complete(flowTaskVo);
}
@ApiOperation(value = "驳回任务")
@Log(title = "驳回流程", businessType = BusinessType.UPDATE)
@PostMapping(value = "/reject")

View File

@ -1,5 +1,6 @@
package com.yanzhu.system.domain.flowable;
package com.yanzhu.flowable.domain;
import com.yanzhu.project.domain.ProProjectApply;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -45,6 +46,9 @@ public class FlowTaskVo {
@ApiModelProperty("流程变量信息")
private Map<String, Object> variables;
@ApiModelProperty("流程变量信息")
private ProProjectApply proProjectApply;
@ApiModelProperty("审批人")
private String assignee;

View File

@ -0,0 +1,29 @@
package com.yanzhu.flowable.listener;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.flowable.engine.delegate.TaskListener;
import org.flowable.task.service.delegate.DelegateTask;
import org.springframework.stereotype.Component;
/**
*
*
* create:
* assignment
* complete
* deletecompleteTask
*
* @author Tony
* @date 2021/4/20
*/
@Slf4j
@Component
public class FlowTaskEndListener implements ExecutionListener {
@Override
public void notify(DelegateExecution delegateExecution) {
log.info("任务结束监听器:{}", delegateExecution);
}
}

View File

@ -22,11 +22,8 @@ public class FlowTaskListener implements TaskListener{
@Override
public void notify(DelegateTask delegateTask) {
log.info("任务监听器:{}", delegateTask);
// TODO 获取事件类型 delegateTask.getEventName(),可以通过监听器给任务执行人发送相应的通知消息
}
}

View File

@ -1,7 +1,7 @@
package com.yanzhu.flowable.service;
import com.yanzhu.common.core.domain.AjaxResult;
import com.yanzhu.system.domain.flowable.FlowTaskVo;
import com.yanzhu.flowable.domain.FlowTaskVo;
import org.flowable.engine.history.HistoricProcessInstance;
import java.util.Map;

View File

@ -2,7 +2,7 @@ package com.yanzhu.flowable.service;
import com.yanzhu.common.core.domain.AjaxResult;
import com.yanzhu.system.domain.flowable.FlowQueryVo;
import com.yanzhu.system.domain.flowable.FlowTaskVo;
import com.yanzhu.flowable.domain.FlowTaskVo;
import org.flowable.task.api.Task;
import java.io.InputStream;

View File

@ -199,12 +199,8 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
@Override
public AjaxResult startProcessInstanceById(String procDefId, ProProjectApply proProjectApply) {
try {
int res;
if(proProjectApply.getId()!=null){
res = proProjectApplyService.updateProProjectApply(proProjectApply);
}else{
res = proProjectApplyService.insertProProjectApply(proProjectApply);
}
/**保存流程表单**/
int res = proProjectApplyService.insertProProjectApply(proProjectApply);
if(res>0){
Map<String, Object> variables = new HashMap<>();
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId)

View File

@ -1,9 +1,8 @@
package com.yanzhu.flowable.service.impl;
import com.yanzhu.common.core.domain.AjaxResult;
import com.yanzhu.common.utils.SecurityUtils;
import com.yanzhu.system.domain.flowable.FlowTaskVo;
import com.yanzhu.flowable.domain.FlowTaskVo;
import com.yanzhu.flowable.factory.FlowServiceFactory;
import com.yanzhu.flowable.service.IFlowInstanceService;
import lombok.extern.slf4j.Slf4j;

View File

@ -1,6 +1,5 @@
package com.yanzhu.flowable.service.impl;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.TypeReference;
@ -19,8 +18,9 @@ import com.yanzhu.flowable.domain.FlowNextDto;
import com.yanzhu.flowable.domain.FlowTaskDto;
import com.yanzhu.flowable.domain.FlowViewerDto;
import com.yanzhu.flowable.flow.ModelUtils;
import com.yanzhu.project.service.IProProjectApplyService;
import com.yanzhu.system.domain.flowable.FlowQueryVo;
import com.yanzhu.system.domain.flowable.FlowTaskVo;
import com.yanzhu.flowable.domain.FlowTaskVo;
import com.yanzhu.flowable.factory.FlowServiceFactory;
import com.yanzhu.flowable.flow.CustomProcessDiagramGenerator;
import com.yanzhu.flowable.flow.FindNextNodeUtil;
@ -56,6 +56,7 @@ import org.flowable.task.api.history.HistoricTaskInstance;
import org.flowable.task.api.history.HistoricTaskInstanceQuery;
import org.flowable.engine.impl.cmd.AddMultiInstanceExecutionCmd;
import org.flowable.engine.impl.cmd.DeleteMultiInstanceExecutionCmd;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -86,6 +87,9 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
@Resource
private ISysFormService sysFormService;
@Autowired
private IProProjectApplyService proProjectApplyService;
/**
*
*
@ -94,18 +98,22 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult complete(FlowTaskVo taskVo) {
/**表单不为空时,重新修改表单**/
if(!Objects.isNull(taskVo.getProProjectApply())){
proProjectApplyService.updateProProjectApply(taskVo.getProProjectApply());
}
Task task = taskService.createTaskQuery().taskId(taskVo.getTaskId()).singleResult();
if (Objects.isNull(task)) {
return AjaxResult.error("任务不存在");
}
if (DelegationState.PENDING.equals(task.getDelegationState())) {
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getType(), taskVo.getComment());
taskService.resolveTask(taskVo.getTaskId(), taskVo.getVariables());
taskService.resolveTask(taskVo.getTaskId());
} else {
Long userId = SecurityUtils.getUserId();
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.NORMAL.getType(), taskVo.getComment());
Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
taskService.setAssignee(taskVo.getTaskId(), userId.toString());
taskService.complete(taskVo.getTaskId(), taskVo.getVariables());
taskService.setAssignee(taskVo.getTaskId(), Convert.toStr(userId));
taskService.complete(taskVo.getTaskId());
}
return AjaxResult.success();
}

View File

@ -123,6 +123,7 @@ export function exportDeployment(query) {
params: query
})
}
// 流程节点表单
export function flowTaskForm(query) {
return request({
@ -131,3 +132,13 @@ export function flowTaskForm(query) {
params: query
})
}
// 完成任务并修改表单
export function completeAndModify(data) {
return request({
url: '/flowable/task/completeAndModify',
method: 'post',
data: data
})
}

View File

@ -20,7 +20,7 @@
<div class="canvas" ref="flowCanvas"></div>
<div class="maskLayer" />
</div>
<el-timeline>
<el-timeline style="padding-left: 0px !important;">
<el-timeline-item
v-for="(item, index) in flowRecordList"
:key="index"
@ -129,7 +129,7 @@
</div>
</el-form-item>
<el-form-item label="申请时间">
{{ parseTime(initData.createTime, "{y}-{m}-{d} {h}:{i}") }}
{{ options.createTime }}
</el-form-item>
<el-form-item label="使用时间" v-if="initData.useTime">
{{ parseTime(initData.useTime, "{y}-{m}-{d} {h}:{i}") }}
@ -523,7 +523,7 @@ export default {
}
.containers {
width: 100%;
height: 150px;
height: 100px;
.canvas {
width: 100%;
height: 100px;
@ -548,7 +548,7 @@ export default {
}
.djs-container svg {
min-height: 150px;
min-height: 100px;
}
.highlight.djs-shape .djs-visual > :nth-child(1) {

File diff suppressed because it is too large Load Diff

View File

@ -148,7 +148,7 @@
<el-tag size="medium">v{{ scope.row.procDefVersion }}</el-tag>
</template>
</el-table-column>
<el-table-column label="提交时间" align="center" prop="createTime" width="160" />
<el-table-column label="申请时间" align="center" prop="createTime" width="160" />
<el-table-column label="流程状态" align="center" width="100">
<template slot-scope="scope">
<el-tag v-if="scope.row.finishTime == null" size="mini"></el-tag>
@ -362,11 +362,11 @@
rows="5"
/>
</el-form-item>
<div style="text-align: right;">
<el-button type="primary" @click="handleStopClick"> </el-button>
<el-button @click="cancelStop"> </el-button>
</div>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleStopClick"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<detailDrawer ref="detailDrawer"></detailDrawer>
<editTaskDrawer ref="editTaskDrawer" :closeCallBack="getList"></editTaskDrawer>
@ -417,6 +417,7 @@ export default {
title: "",
//
open: false,
stopOpen: false,
src: "",
definitionList: [],
//
@ -511,6 +512,9 @@ export default {
this.open = false;
this.reset();
},
cancelStop() {
this.stopOpen = false;
},
//
reset() {
this.form = {
@ -586,16 +590,6 @@ export default {
this.$refs.initTaskDrawer.show(row);
},
/** 取消流程申请 */
handleStop(row) {
const params = {
instanceId: row.procInsId,
};
stopProcess(params).then((res) => {
this.$modal.msgSuccess(res.msg);
this.getList();
});
},
/** 取消流程申请 */
handleStop(row) {
this.form.taskId = row.taskId;
this.form.userId = this.$store.getters.userId;

View File

@ -62,6 +62,7 @@
<el-form-item label="附件说明" prop="applyFiles">
<FileUpload
:limit="9"
v-model="form.applyFiles"
:fileType="['pdf', 'png', 'jpg', 'jpeg', 'doc', 'docx', 'xls', 'xlsx']"
/>
</el-form-item>
@ -180,7 +181,7 @@
</template>
</el-table-column>
</el-table>
<div style="text-align: center; margin: 20px 0px;">
<div style="text-align: center; margin: 20px 0px">
<el-button type="primary" @click="submitForm"></el-button>
<el-button @click="doCanel"> </el-button>
</div>
@ -216,7 +217,7 @@ export default {
form: {
id: null,
deptId: null,
projId: null,
projId: 0,
projName: null,
parProjName: null,
applyType: null,
@ -281,6 +282,7 @@ export default {
},
//
projectChage(val) {
this.$forceUpdate();
for (let i = 0; i < this.projectOptions.length; i++) {
if (this.projectOptions[i].id == val) {
this.form.projName = this.projectOptions[i].name;

View File

@ -68,7 +68,7 @@
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="danger"
@ -82,7 +82,7 @@
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</el-row> -->
<el-table
v-loading="loading"
@ -90,21 +90,45 @@
border
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
label="任务编号"
label="项目单位"
align="center"
prop="taskId"
prop="businessKeyParName"
:show-overflow-tooltip="true"
/>
<el-table-column label="流程名称" align="center" prop="procDefName" />
<el-table-column
label="项目名称"
align="center"
prop="businessKeyName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="流程名称"
align="center"
prop="procDefName"
width="120"
:show-overflow-tooltip="true"
/>
<el-table-column label="流程编号" align="center" width="80">
<template slot-scope="scope">
<label>{{ scope.row.taskId }}</label>
</template>
</el-table-column>
<el-table-column label="流程类别" align="center" prop="category" width="180">
<template slot-scope="scope">
<dict-tag
:options="dict.type.sys_process_category"
:value="scope.row.category"
/>
</template>
</el-table-column>
<el-table-column label="当前节点" align="center" prop="taskName" />
<el-table-column label="流程版本" align="center">
<template slot-scope="scope">
<el-tag size="medium">v{{ scope.row.procDefVersion }}</el-tag>
</template>
</el-table-column>
<el-table-column label="流程发起人" align="center">
<el-table-column label="流程发起人" align="center" width="180">
<template slot-scope="scope">
<label
>{{ scope.row.startUserName }}
@ -112,7 +136,12 @@
>
</template>
</el-table-column>
<el-table-column label="接收时间" align="center" prop="createTime" width="180" />
<el-table-column label="接收时间" align="center" prop="createTime" width="160" />
<el-table-column label="处理耗时" align="center" prop="duration" width="150">
<template slot-scope="scope">
{{getDurationDate(scope.row.duration)}}
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -133,6 +162,8 @@
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<approveDrawer ref="approveDrawer" :closeCallBack="getList"></approveDrawer>
<editTaskDrawer ref="editTaskDrawer" :closeCallBack="getList"></editTaskDrawer>
</div>
</template>
@ -210,26 +241,20 @@ export default {
this.queryParams.params["endDate"] = this.daterangeCheckTime[1];
}
//
this.$store.dispatch('initMyTaskNum');
this.$store.dispatch("initMyTaskNum");
myAwaitFlowTaskList(this.queryParams).then((response) => {
this.todoList = response.data.records;
this.total = response.data.total;
this.todoList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
handleProcess(row) {
this.$router.push({
path: "/flowable/task/todo/detail/index",
query: {
procInsId: row.procInsId,
executionId: row.executionId,
deployId: row.deployId,
taskId: row.taskId,
taskName: row.taskName,
startUser: row.startUserName + "-" + row.startDeptName,
},
});
//if (row.taskName == "") {
this.$refs.editTaskDrawer.show(row);
//} else {
// this.$refs.approveDrawer.show(row);
//}
},
//
cancel() {
@ -250,7 +275,7 @@ export default {
parentDeploymentId: null,
engineVersion: null,
};
this.daterangeCheckTime=[];
this.daterangeCheckTime = [];
this.resetForm("form");
},
/** 搜索按钮操作 */
@ -261,7 +286,7 @@ export default {
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.daterangeCheckTime=[];
this.daterangeCheckTime = [];
this.handleQuery();
},
//