提交 231f2ed0 authored 作者: kxjia's avatar kxjia

优化代码

...@@ -315,6 +315,11 @@ ...@@ -315,6 +315,11 @@
"isAttr": true, "isAttr": true,
"type": "String" "type": "String"
}, },
{
"name": "isRead",
"isAttr": true,
"type": "Boolean"
},
{ {
"name": "followUpDate", "name": "followUpDate",
"isAttr": true, "isAttr": true,
......
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
expId?: string expId?: string
async?: boolean async?: boolean
userName?: string userName?: string
isRead?: boolean
isTransmit?: boolean
isReject?: boolean
isSend?: boolean
[key: string]: any [key: string]: any
} }
...@@ -43,7 +47,11 @@ ...@@ -43,7 +47,11 @@
const bpmnFormData = reactive<BpmnFormData>({ const bpmnFormData = reactive<BpmnFormData>({
async: false, async: false,
userType: 'user' userType: 'user',
isTransmit: true,
isReject: true,
isSend: true,
isRead: true,
}); });
const selectData = reactive<SelectData>({}) const selectData = reactive<SelectData>({})
...@@ -109,20 +117,6 @@ ...@@ -109,20 +117,6 @@
} }
} }
// 获取用户列表
// const getUserList = async (params) => {
// try {
// loading.value = true;
// const userList = await defHttp.get({ url: "/sys/user/list", params });
// return userList;
// } catch (error) {
// console.error('获取用户列表失败:', error);
// return [];
// } finally {
// loading.value = false;
// }
// }
const formSchema: FormSchema[] = [ const formSchema: FormSchema[] = [
{ {
label: '异步', label: '异步',
...@@ -211,7 +205,7 @@ ...@@ -211,7 +205,7 @@
updateCustomElement("userType", "role") updateCustomElement("userType", "role")
emit('update', { candidateGroups, userType: 'role' }) emit('update', { candidateGroups, userType: 'role' })
if (bpmnFormData.userType !== 'role') { if(bpmnFormData.userType !== 'role') {
bpmnFormData.userType = 'role' bpmnFormData.userType = 'role'
isUser.value = false isUser.value = false
updateCustomElement("userType", "role") updateCustomElement("userType", "role")
...@@ -253,7 +247,79 @@ ...@@ -253,7 +247,79 @@
emit('update', { priority }) emit('update', { priority })
} }
} }
},
{
label: '是否转阅',
field: 'isRead',
component: 'RadioGroup',
defaultValue: true,
componentProps: {
options: [
{ label: '是', value: true },
{ label: '否', value: false },
],
disabled: props.readonly,
onChange: (isRead: boolean) => {
bpmnFormData.isRead = isRead
updateCustomElement("isRead", isRead)
emit('update', { isRead })
}
}
},
{
label: '是否转办',
field: 'isTransmit',
component: 'RadioGroup',
defaultValue: true,
componentProps: {
options: [
{ label: '是', value: true },
{ label: '否', value: false },
],
disabled: props.readonly,
onChange: (isTransmit: boolean) => {
bpmnFormData.isTransmit = isTransmit
updateCustomElement("isTransmit", isTransmit)
emit('update', { isTransmit })
}
} }
},
{
label: '是否可退',
field: 'isReject',
component: 'RadioGroup',
defaultValue: true,
componentProps: {
options: [
{ label: '是', value: true },
{ label: '否', value: false },
],
disabled: props.readonly,
onChange: (isReject: boolean) => {
bpmnFormData.isReject = isReject
updateCustomElement("isReject", isReject)
emit('update', { isReject })
}
}
},
{
label: '是否发送',
field: 'isSend',
component: 'RadioGroup',
defaultValue: true,
componentProps: {
options: [
{ label: '是', value: true },
{ label: '否', value: false },
],
disabled: props.readonly,
onChange: (isSend: boolean) => {
bpmnFormData.isSend = isSend
updateCustomElement("isSend", isSend)
emit('update', { isSend })
}
}
},
]; ];
const [registerForm, { updateSchema, setFieldsValue, getFieldsValue, setProps }] = useForm({ const [registerForm, { updateSchema, setFieldsValue, getFieldsValue, setProps }] = useForm({
...@@ -283,6 +349,58 @@ ...@@ -283,6 +349,58 @@
}); });
}; };
// 保存所有自定义属性(打包成 JSON)
const saveCustomProperties = (element: any, customData: Record<string, any>) => {
if (!modelerStore.modeler || !element) {
return false
}
try {
const modeling = modelerStore.modeler.get('modeling')
let targetElement = element
if (isProxy(element)) {
targetElement = toRaw(element)
}
// 将所有自定义属性转为 JSON 字符串存储
const customDataStr = JSON.stringify(customData)
modeling.updateProperties(targetElement, {
'customData': customDataStr
})
return true
} catch (error) {
console.error('保存自定义属性失败:', error)
return false
}
}
// 读取所有自定义属性
const getCustomProperties = (element: any): Record<string, any> => {
if (!element || !element.businessObject) {
return {}
}
try {
const customDataStr = element.businessObject.customData
if (customDataStr) {
return JSON.parse(customDataStr)
}
return {}
} catch (error) {
console.error('读取自定义属性失败:', error)
return {}
}
}
// 获取单个自定义属性
const getCustomProperty = (element: any, key: string, defaultValue: any = null) => {
const customProps = getCustomProperties(element)
return customProps[key] !== undefined ? customProps[key] : defaultValue
}
// 更新自定义流程节点/参数信息 // 更新自定义流程节点/参数信息
const updateCustomElement = (key: string, value: any) => { const updateCustomElement = (key: string, value: any) => {
if (!modelerStore.modeler || !modelerStore.element) { if (!modelerStore.modeler || !modelerStore.element) {
...@@ -291,13 +409,19 @@ ...@@ -291,13 +409,19 @@
} }
try { try {
// BPMN 标准属性列表(这些可以直接更新)
const standardProps = ['async', 'dueDate', 'priority', 'assignee', 'candidateGroups', 'userType']
if (standardProps.includes(key)) {
// 标准属性直接更新
const taskAttr: Record<string, any> = {} const taskAttr: Record<string, any> = {}
taskAttr[key] = value taskAttr[key] = value
safeUpdateProperties(modelerStore.element, taskAttr)
const success = safeUpdateProperties(modelerStore.element, taskAttr) } else {
// 自定义属性:先获取现有自定义属性,更新后统一保存
if (!success) { const currentCustomProps = getCustomProperties(modelerStore.element)
console.error('更新自定义属性失败') currentCustomProps[key] = value
saveCustomProperties(modelerStore.element, currentCustomProps)
} }
} catch (error) { } catch (error) {
console.error('更新自定义属性失败:', error) console.error('更新自定义属性失败:', error)
...@@ -339,7 +463,11 @@ ...@@ -339,7 +463,11 @@
if (!modelerStore.element?.businessObject || modelerStore.element.type === 'bpmn:Process') { if (!modelerStore.element?.businessObject || modelerStore.element.type === 'bpmn:Process') {
return return
} }
const businessObject = modelerStore.element.businessObject const element = modelerStore.element
const businessObject = element.businessObject
// 获取所有自定义属性
const customProps = getCustomProperties(element)
// 重置表单数据 // 重置表单数据
const formData: BpmnFormData = { const formData: BpmnFormData = {
...@@ -348,7 +476,12 @@ ...@@ -348,7 +476,12 @@
assignee: businessObject.assignee || '', assignee: businessObject.assignee || '',
candidateGroups: businessObject.candidateGroups || '', candidateGroups: businessObject.candidateGroups || '',
dueDate: businessObject.dueDate || '', dueDate: businessObject.dueDate || '',
priority: businessObject.priority || 'medium' priority: businessObject.priority || 'medium',
// 从自定义属性中读取
isRead: customProps.isRead !== undefined ? customProps.isRead : true,
isTransmit: customProps.isTransmit !== undefined ? customProps.isTransmit : true,
isReject: customProps.isReject !== undefined ? customProps.isReject : true,
isSend: customProps.isSend !== undefined ? customProps.isSend : true
} }
isUser.value = formData.userType === "user" isUser.value = formData.userType === "user"
......
...@@ -5,8 +5,9 @@ ...@@ -5,8 +5,9 @@
<div class="form-header"> <div class="form-header">
<span class="form-title">当前待办<font color="red">[{{ editableNode?.name || '无' }}]</font></span> <span class="form-title">当前待办<font color="red">[{{ editableNode?.name || '无' }}]</font></span>
<a-space> <a-space>
<a-button v-if="props.showApprovalPanel" type="primary" ghost @click="handleApproval">审批</a-button> <a-button v-show="props.showApprovalPanel" type="primary" ghost @click="handleApproval">审批</a-button>
<a-button v-else type="primary" ghost @click="handleSend">发送</a-button> <a-button v-show="!props.showApprovalPanel" type="primary" ghost @click="handleSend">保存</a-button>
<a-button v-show="!props.showApprovalPanel" type="primary" ghost @click="handleSend">保存并发送</a-button>
<a-button v-show="!props.showApprovalPanel" type="primary" ghost @click="handleReject">驳回</a-button> <a-button v-show="!props.showApprovalPanel" type="primary" ghost @click="handleReject">驳回</a-button>
<a-button type="primary" ghost @click="handleTransmit">转办</a-button> <a-button type="primary" ghost @click="handleTransmit">转办</a-button>
<a-button type="primary" ghost @click="handleRead">转阅</a-button> <a-button type="primary" ghost @click="handleRead">转阅</a-button>
......
<template> <template>
<BasicDrawer <BasicDrawer
title="任务指派" title="发送任务"
width="30%" width="30%"
:closable="true" :closable="true"
:mask-closable="false" :mask-closable="false"
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
:header-style="{ backgroundColor: '#018ffb', borderBottom: '1px solid #e8eef2' }" :header-style="{ backgroundColor: '#018ffb', borderBottom: '1px solid #e8eef2' }"
> >
<div class="drawer-content" style="height: 80vh"> <div class="drawer-content" style="height: 80vh">
<a-card title="选择任务指派人" :bordered="false" class="assignee-card"> <a-card title="选择任务接收人" :bordered="false" class="assignee-card">
<a-form layout="vertical"> <a-form layout="vertical">
<a-form-item label="用户类型" required> <a-form-item label="用户类型" required>
<a-radio-group v-model:value="localUserType" disabled> <a-radio-group v-model:value="localUserType" disabled>
...@@ -47,8 +47,12 @@ ...@@ -47,8 +47,12 @@
</a-form> </a-form>
<div class="assignee-actions"> <div class="assignee-actions">
<a-space> <a-space>
<a-button @click="handleClose">取消</a-button> <a-button @click="handleClose" block style="width: 150px;">取消</a-button>
<a-button type="primary" :loading="confirmLoading" @click="handleConfirm">确认</a-button> <a-button type="primary" style="width: 150px;"
:loading="confirmLoading"
@click="handleConfirm" block>
确认
</a-button>
</a-space> </a-space>
</div> </div>
</a-card> </a-card>
...@@ -68,6 +72,11 @@ import { UserOutlined, TeamOutlined } from '@ant-design/icons-vue' ...@@ -68,6 +72,11 @@ import { UserOutlined, TeamOutlined } from '@ant-design/icons-vue'
import UserSelectModal from '/@/components/Form/src/jeecg/components/modal/UserSelectModal.vue' import UserSelectModal from '/@/components/Form/src/jeecg/components/modal/UserSelectModal.vue'
import RoleSelectModal from '/@/components/Form/src/jeecg/components/modal/RoleSelectModal.vue' import RoleSelectModal from '/@/components/Form/src/jeecg/components/modal/RoleSelectModal.vue'
import { complete, getMyTaskFlow } from '/@/components/Process/api/todo' import { complete, getMyTaskFlow } from '/@/components/Process/api/todo'
import { queryUserById } from '/@/views/system/user/user.api'
import { queryRoleById } from '/@/views/system/role/role.api'
import { useMessage } from '/@/hooks/web/useMessage'
const { createConfirm } = useMessage()
const emit = defineEmits(['success', 'error', 'close']) const emit = defineEmits(['success', 'error', 'close'])
...@@ -81,7 +90,7 @@ const confirmLoading = ref(false) ...@@ -81,7 +90,7 @@ const confirmLoading = ref(false)
const dataId = ref('') const dataId = ref('')
const deployId = ref('') const deployId = ref('')
const [registerBasicDrawer, { closeDrawer }] = useDrawerInner((data) => { const [registerBasicDrawer, { closeDrawer }] = useDrawerInner(async (data) => {
if (data) { if (data) {
dataId.value = data.dataId || '' dataId.value = data.dataId || ''
deployId.value = data.deployId || '' deployId.value = data.deployId || ''
...@@ -89,6 +98,11 @@ const [registerBasicDrawer, { closeDrawer }] = useDrawerInner((data) => { ...@@ -89,6 +98,11 @@ const [registerBasicDrawer, { closeDrawer }] = useDrawerInner((data) => {
localUserType.value = data.userType === 'role' ? 'role' : 'user' localUserType.value = data.userType === 'role' ? 'role' : 'user'
assigneeId.value = data.assignee assigneeId.value = data.assignee
assigneeDisplayName.value = data.assigneeName || '' assigneeDisplayName.value = data.assigneeName || ''
if(localUserType.value === 'user') {
await setUserInfo( assigneeId.value, data.assigneeName || '')
} else {
await setRoleInfo( assigneeId.value, data.assigneeName || '')
}
} else { } else {
localUserType.value = data.userType === 'role' ? 'role' : 'user' localUserType.value = data.userType === 'role' ? 'role' : 'user'
} }
...@@ -124,6 +138,16 @@ const handleClose = () => { ...@@ -124,6 +138,16 @@ const handleClose = () => {
} }
const handleConfirm = async () => { const handleConfirm = async () => {
createConfirm({
title: '确认发送任务吗?',
okText: '确认',
okType: 'danger',
iconType: 'warning',
onOk: async () => {
if (!assigneeId.value) {
message.warning('请选择任务接收人')
return
}
confirmLoading.value = true confirmLoading.value = true
try { try {
if (dataId.value && deployId.value) { if (dataId.value && deployId.value) {
...@@ -147,6 +171,8 @@ const handleConfirm = async () => { ...@@ -147,6 +171,8 @@ const handleConfirm = async () => {
} finally { } finally {
confirmLoading.value = false confirmLoading.value = false
} }
}
})
} }
const getAssigneeData = () => ({ const getAssigneeData = () => ({
...@@ -160,15 +186,32 @@ const setUserInfo = (userId: string, userNameValue: string) => { ...@@ -160,15 +186,32 @@ const setUserInfo = (userId: string, userNameValue: string) => {
assigneeId.value = userId assigneeId.value = userId
assigneeDisplayName.value = userNameValue assigneeDisplayName.value = userNameValue
localUserType.value = 'user' localUserType.value = 'user'
if(userNameValue) return
queryUserById({ id:userId }).then(res => {
if (res?.realname) {
assigneeDisplayName.value = res.realname || ''
}
})
} }
const setRoleInfo = (roleId: string, roleNameValue: string) => { const setRoleInfo = (roleId: string, roleNameValue: string) => {
assigneeId.value = roleId assigneeId.value = roleId
assigneeDisplayName.value = roleNameValue assigneeDisplayName.value = roleNameValue
localUserType.value = 'role' localUserType.value = 'role'
if(roleNameValue) return
queryRoleById({ id: roleId }).then(res => {
if (res) {
assigneeDisplayName.value = res.roleName || ''
}
})
} }
defineExpose({ getAssigneeData, submit: handleConfirm, setUserInfo, setRoleInfo }) defineExpose({
getAssigneeData,
submit: handleConfirm,
setUserInfo,
setRoleInfo
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
......
...@@ -538,7 +538,10 @@ ...@@ -538,7 +538,10 @@
if (!showApprovalUi.value) { if (!showApprovalUi.value) {
await complete(submitData); const result =await complete(submitData);
message.success('任务结束成功');
emit('success', result);
emit('callback'); emit('callback');
return false; return false;
} }
......
...@@ -408,7 +408,7 @@ ...@@ -408,7 +408,7 @@
if (needStartFlow && record.deployId) { if (needStartFlow && record.deployId) {
try { try {
const formData = { dataId, dataName: 'id' }; const formData = { dataId, dataName: 'id',tasktitle:record.projectName };
const startResRaw = await definitionStartByDeployId(record.deployId, formData); const startResRaw = await definitionStartByDeployId(record.deployId, formData);
const startRes = pickStartResult(startResRaw); const startRes = pickStartResult(startResRaw);
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
import { columns } from './StProblemCheck.data'; import { columns } from './StProblemCheck.data';
import { list, problemArchive } from './StProblemCheck.api'; import { list, problemArchive } from './StProblemCheck.api';
const { createConfirm } = useMessage();
const props = defineProps({ const props = defineProps({
currentFlowNode: { type: Object, default: () => ({}) }, currentFlowNode: { type: Object, default: () => ({}) },
}); });
...@@ -37,7 +39,14 @@ ...@@ -37,7 +39,14 @@
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext; const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
function handleArchive(record: Recordable) { function handleArchive(record: Recordable) {
createConfirm({
title: '确认归档问题吗?',
okText: '确认',
okType: 'danger',
onOk: () => {
problemArchive({ id: record.id }).then(handleSuccess); problemArchive({ id: record.id }).then(handleSuccess);
},
});
} }
function handleSuccess() { function handleSuccess() {
...@@ -46,7 +55,11 @@ ...@@ -46,7 +55,11 @@
} }
function getTableAction(record) { function getTableAction(record) {
return [{ label: '问题归档', onClick: handleArchive.bind(null, record) }]; return [
{
label: '问题归档',
onClick: handleArchive.bind(null, record)
}];
} }
</script> </script>
......
...@@ -69,6 +69,7 @@ export const columns: BasicColumn[] = [ ...@@ -69,6 +69,7 @@ export const columns: BasicColumn[] = [
return render.renderDict(text, 'bpm_status'); return render.renderDict(text, 'bpm_status');
}, },
sorter: true, sorter: true,
ifShow: false,
}, },
]; ];
//查询数据 //查询数据
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" /> <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template> </template>
</BasicTable> </BasicTable>
<StProblemCheckModal @register="registerModal" @success="handleSuccess" :center="true" /> <StProblemCheckModal @register="registerModal" @success="handleSuccess" :centered="true" />
</div> </div>
</template> </template>
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
import StProblemCheckModal from './components/StProblemCheckModal.vue'; import StProblemCheckModal from './components/StProblemCheckModal.vue';
import { columns, searchFormSchema } from './StProblemCheck.data'; import { columns, searchFormSchema } from './StProblemCheck.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, saveOrUpdate } from './StProblemCheck.api'; import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, saveOrUpdate } from './StProblemCheck.api';
import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage();
const props = defineProps({ const props = defineProps({
beforeFlowNode: { type: Object, default: () => ({}) }, beforeFlowNode: { type: Object, default: () => ({}) },
...@@ -113,6 +115,7 @@ ...@@ -113,6 +115,7 @@
} }
async function handleFlow(record: Recordable) { async function handleFlow(record: Recordable) {
emit('sendWorkFlow', record); emit('sendWorkFlow', record);
} }
......
...@@ -25,6 +25,7 @@ enum Api { ...@@ -25,6 +25,7 @@ enum Api {
saveRoleIndex = '/sys/sysRoleIndex/add', saveRoleIndex = '/sys/sysRoleIndex/add',
editRoleIndex = '/sys/sysRoleIndex/edit', editRoleIndex = '/sys/sysRoleIndex/edit',
queryIndexByCode = '/sys/sysRoleIndex/queryByCode', queryIndexByCode = '/sys/sysRoleIndex/queryByCode',
queryById = '/sys/role/queryById',
} }
/** /**
* 导出api * 导出api
...@@ -186,3 +187,10 @@ export const saveOrUpdateRoleIndex = (params, isUpdate) => { ...@@ -186,3 +187,10 @@ export const saveOrUpdateRoleIndex = (params, isUpdate) => {
* @param params * @param params
*/ */
export const queryIndexByCode = (params) => defHttp.get({ url: Api.queryIndexByCode, params }, { isTransformResponse: false }); export const queryIndexByCode = (params) => defHttp.get({ url: Api.queryIndexByCode, params }, { isTransformResponse: false });
/**
*
* @param params
* @returns
*/
export const queryRoleById = (params) => defHttp.get({ url: Api.queryById, params });
...@@ -23,6 +23,8 @@ enum Api { ...@@ -23,6 +23,8 @@ enum Api {
changePassword = '/sys/user/changePassword', changePassword = '/sys/user/changePassword',
frozenBatch = '/sys/user/frozenBatch', frozenBatch = '/sys/user/frozenBatch',
queryById = '/sys/user/queryById',
getQuitList = '/sys/user/getQuitList', getQuitList = '/sys/user/getQuitList',
putCancelQuit = '/sys/user/putCancelQuit', putCancelQuit = '/sys/user/putCancelQuit',
resetPassword = '/sys/user/resetPassword', resetPassword = '/sys/user/resetPassword',
...@@ -266,3 +268,10 @@ export const saveOrUpdateAgent = (params) => { ...@@ -266,3 +268,10 @@ export const saveOrUpdateAgent = (params) => {
export const userQuitAgent = (params) => { export const userQuitAgent = (params) => {
return defHttp.put({ url: Api.userQuitAgent, params }); return defHttp.put({ url: Api.userQuitAgent, params });
}; };
/**
*
* @param params
* @returns
*/
export const queryUserById = (params) => defHttp.get({ url: Api.queryById, params });
\ No newline at end of file
...@@ -83,5 +83,37 @@ public class ProcessConstants { ...@@ -83,5 +83,37 @@ public class ProcessConstants {
*/ */
public static final String PROCESS_ISAPPROVE = "isApprove"; public static final String PROCESS_ISAPPROVE = "isApprove";
/**
* 节点类型-发起
*/
public static final String TASK_TYPE_START = "发起";
/**
* 节点类型-参与
*/
public static final String TASK_TYPE_HAND = "参与";
/**
* 操作类型-转阅
*/
public static final String OPTION_TYPE_READ = "转阅";
/**
* 操作类型-审批
*/
public static final String OPTION_TYPE_APPROVE = "审批";
/**
* 操作类型-办理
*/
public static final String OPTION_TYPE_HAND = "办理";
/**
* 操作类型-转办
*/
public static final String OPTION_TYPE_ASSIGN = "转办";
/**
* 操作类型-驳回
*/
public static final String OPTION_TYPE_REJECT = "驳回";
} }
...@@ -22,9 +22,11 @@ import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessS ...@@ -22,9 +22,11 @@ import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessS
import org.jeecg.modules.flowable.apithird.entity.SysUser; import org.jeecg.modules.flowable.apithird.entity.SysUser;
import org.jeecg.modules.flowable.apithird.service.IFlowThirdService; import org.jeecg.modules.flowable.apithird.service.IFlowThirdService;
import org.jeecg.modules.flowable.common.constant.ProcessConstants; import org.jeecg.modules.flowable.common.constant.ProcessConstants;
import org.jeecg.modules.flowable.domain.dto.FlowNextDto;
import org.jeecg.modules.flowable.domain.dto.FlowProcDefDto; import org.jeecg.modules.flowable.domain.dto.FlowProcDefDto;
import org.jeecg.modules.flowable.factory.FlowServiceFactory; import org.jeecg.modules.flowable.factory.FlowServiceFactory;
import org.jeecg.modules.flowable.service.IFlowDefinitionService; import org.jeecg.modules.flowable.service.IFlowDefinitionService;
import org.jeecg.modules.flowable.service.IFlowTaskService;
import org.jeecg.modules.stm.my.entity.MyTaskFlowHis; import org.jeecg.modules.stm.my.entity.MyTaskFlowHis;
import org.jeecg.modules.stm.my.service.IMyTaskFlowHisService; import org.jeecg.modules.stm.my.service.IMyTaskFlowHisService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -57,6 +59,7 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl ...@@ -57,6 +59,7 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
private IMyTaskFlowHisService myTaskFlowHisService; private IMyTaskFlowHisService myTaskFlowHisService;
private static final String BPMN_FILE_SUFFIX = ".bpmn"; private static final String BPMN_FILE_SUFFIX = ".bpmn";
@Override @Override
...@@ -363,7 +366,7 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl ...@@ -363,7 +366,7 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
String curdate = sdf.format(cdate); String curdate = sdf.format(cdate);
try { try {
String flowname ="";
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.deploymentId(DeployId) // 替换为你的deploymentId .deploymentId(DeployId) // 替换为你的deploymentId
.singleResult(); .singleResult();
...@@ -371,6 +374,7 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl ...@@ -371,6 +374,7 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
if (processDefinition != null) { if (processDefinition != null) {
procDefId = processDefinition.getId(); procDefId = processDefinition.getId();
// 使用 procDefId // 使用 procDefId
flowname=processDefinition.getName();
} }
...@@ -390,11 +394,35 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl ...@@ -390,11 +394,35 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
// 流程发起时 跳过发起人节点 // 流程发起时 跳过发起人节点
ProcessInstance processInstance = runtimeService.startProcessInstanceById(procDefId, variables); ProcessInstance processInstance = runtimeService.startProcessInstanceById(procDefId, variables);
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).active().singleResult(); Task task = taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).active().singleResult();
String OptionType="";
Boolean isnodeisApprove=false;
FlowNextDto flowtDto=flowTaskService.getFlowNodeType(task.getId());
if(flowtDto!=null){
isnodeisApprove=flowtDto.isNodeisApprove();
}
if(isnodeisApprove){
OptionType=ProcessConstants.OPTION_TYPE_APPROVE;//审核
}else{
OptionType=ProcessConstants.OPTION_TYPE_HAND;//办理
}
result.put("deployId", DeployId); result.put("deployId", DeployId);
result.put("taskId", task.getId()); result.put("taskId", task.getId());
result.put("procInsId", task.getProcessInstanceId()); result.put("procInsId", task.getProcessInstanceId());
result.put("executionId", task.getExecutionId()); result.put("executionId", task.getExecutionId());
result.put("instanceId", task.getProcessInstanceId()); result.put("instanceId", task.getProcessInstanceId());
//需要返回 节点审批设置
if(isnodeisApprove){
result.put("nodeisApprove", flowtDto.isNodeisApprove());
}else{
result.put("nodeisApprove", false);
}
String Title=task.getName(); String Title=task.getName();
// //
...@@ -413,15 +441,19 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl ...@@ -413,15 +441,19 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
if(flowForm!=null){ if(flowForm!=null){
String zdmc=""; String zdmc="";
String zdval=""; String zdval="";
String tasktitle="";
if(variables.get("dataName")==null){ if(variables.get("dataName")==null){
Map zdv=(Map)variables.get("_value"); Map zdv=(Map)variables.get("_value");
zdmc=(String)zdv.get("dataName"); zdmc=(String)zdv.get("dataName");
zdval=zdv.get("dataId").toString(); zdval=zdv.get("dataId").toString();
tasktitle=(String)zdv.get("tasktitle");
}else{ }else{
zdmc=(String)variables.get("dataName"); zdmc=(String)variables.get("dataName");
zdval=variables.get("dataId").toString(); zdval=variables.get("dataId").toString();
tasktitle=(String)variables.get("tasktitle");
} }
...@@ -469,11 +501,12 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl ...@@ -469,11 +501,12 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
taskFlowHis.setOptionTime(cdate); taskFlowHis.setOptionTime(cdate);
taskFlowHis.setOptionId(sysUser.getId()); taskFlowHis.setOptionId(sysUser.getId());
taskFlowHis.setOptionType("操作类型"); taskFlowHis.setOptionType(OptionType);//审核 转办 转阅
taskFlowHis.setTaskType("发起");//发起 办理 转办 结束 taskFlowHis.setTaskType(ProcessConstants.TASK_TYPE_START);//发起 参与
taskFlowHis.setTaskName(task.getName()); taskFlowHis.setTaskName(task.getName());
taskFlowHis.setTaskTitle("标题"); taskFlowHis.setTaskTitle(tasktitle);
taskFlowHis.setFlowName(""); taskFlowHis.setFlowName(flowname);
myTaskFlowHisService.save(taskFlowHis); myTaskFlowHisService.save(taskFlowHis);
......
...@@ -126,14 +126,33 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -126,14 +126,33 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
if (Objects.isNull(task)) { if (Objects.isNull(task)) {
return Result.error("任务不存在"); return Result.error("任务不存在");
} }
String OptionType="";
Boolean isnodeisApprove=false;
FlowNextDto flowtDto=getFlowNodeType(task.getId());
if(flowtDto!=null){
isnodeisApprove=flowtDto.isNodeisApprove();
}
if(isnodeisApprove){
OptionType=ProcessConstants.OPTION_TYPE_APPROVE;//审核
}else{
OptionType=ProcessConstants.OPTION_TYPE_HAND;//办理
}
// 根据流程定义ID查询流程定义对象 // 根据流程定义ID查询流程定义对象
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.processDefinitionId(task.getProcessDefinitionId()) .processDefinitionId(task.getProcessDefinitionId())
.singleResult(); .singleResult();
String deploymentId =""; String deploymentId ="";
String flowname ="";
if (processDefinition != null) { if (processDefinition != null) {
// 获取部署ID - 这就是你想要的deployId // 获取部署ID - 这就是你想要的deployId
deploymentId = processDefinition.getDeploymentId(); deploymentId = processDefinition.getDeploymentId();
flowname=processDefinition.getName();
} }
...@@ -146,6 +165,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -146,6 +165,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
Map<String, Object> formValues = getProcessVariables(taskVo.getTaskId()); Map<String, Object> formValues = getProcessVariables(taskVo.getTaskId());
String zdmc=""; String zdmc="";
String zdval=""; String zdval="";
String tasktitle="";
if(formValues.get("dataName")==null){ if(formValues.get("dataName")==null){
if(formValues.get("_value")!=null) { if(formValues.get("_value")!=null) {
...@@ -153,11 +173,13 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -153,11 +173,13 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
Map zdv = (Map) formValues.get("_value"); Map zdv = (Map) formValues.get("_value");
zdmc = (String) zdv.get("dataName"); zdmc = (String) zdv.get("dataName");
zdval = zdv.get("dataId").toString(); zdval = zdv.get("dataId").toString();
tasktitle = (String) zdv.get("tasktitle");
} }
}else{ }else{
zdmc=(String)formValues.get("dataName"); zdmc=(String)formValues.get("dataName");
zdval=formValues.get("dataId").toString(); zdval=formValues.get("dataId").toString();
tasktitle=(String)formValues.get("tasktitle");
} }
...@@ -205,11 +227,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -205,11 +227,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
taskFlowHis.setOptionTime(cdate); taskFlowHis.setOptionTime(cdate);
taskFlowHis.setOptionId(loginUser.getId()); taskFlowHis.setOptionId(loginUser.getId());
taskFlowHis.setOptionType("操作类型");
taskFlowHis.setTaskType("节点类型");//发起 办理 转办 结束 taskFlowHis.setOptionType(OptionType);//审核 转办 转阅
taskFlowHis.setTaskType(ProcessConstants.TASK_TYPE_HAND);//发起 参与
taskFlowHis.setTaskName(task.getName()); taskFlowHis.setTaskName(task.getName());
taskFlowHis.setTaskTitle("标题"); taskFlowHis.setTaskTitle(tasktitle);
taskFlowHis.setFlowName(""); taskFlowHis.setFlowName(flowname);
myTaskFlowHisService.save(taskFlowHis); myTaskFlowHisService.save(taskFlowHis);
...@@ -356,6 +379,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -356,6 +379,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
@Override @Override
public void taskReject(FlowTaskVo flowTaskVo) { public void taskReject(FlowTaskVo flowTaskVo) {
if (taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult().isSuspended()) { if (taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult().isSuspended()) {
throw new CustomException("任务处于挂起状态!"); throw new CustomException("任务处于挂起状态!");
} }
...@@ -449,6 +473,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -449,6 +473,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
})); }));
// 设置驳回意见 // 设置驳回意见
currentTaskIds.forEach(item -> taskService.addComment(item, task.getProcessInstanceId(), FlowComment.REJECT.getType(), flowTaskVo.getComment())); currentTaskIds.forEach(item -> taskService.addComment(item, task.getProcessInstanceId(), FlowComment.REJECT.getType(), flowTaskVo.getComment()));
// 1. 获取当前运行的任务(源节点)
Task sourceTask = taskService.createTaskQuery().taskId(task.getId()).singleResult();
// 获取流程实例ID(可以从 sourceTask 中获取)
String processInstanceId = sourceTask.getProcessInstanceId();
try { try {
// 如果父级任务多于 1 个,说明当前节点不是并行节点,原因为不考虑多对多情况 // 如果父级任务多于 1 个,说明当前节点不是并行节点,原因为不考虑多对多情况
...@@ -465,6 +493,83 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -465,6 +493,83 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
.processInstanceId(task.getProcessInstanceId()) .processInstanceId(task.getProcessInstanceId())
.moveActivityIdsToSingleActivityId(currentIds, targetIds.get(0)).changeState(); .moveActivityIdsToSingleActivityId(currentIds, targetIds.get(0)).changeState();
} }
// 根据流程定义ID查询流程定义对象
/**
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.processDefinitionId(task.getProcessDefinitionId())
.singleResult();
*/
String deploymentId ="";
String flowname ="";
if (processDefinition != null) {
// 获取部署ID - 这就是你想要的deployId
deploymentId = processDefinition.getDeploymentId();
flowname=processDefinition.getName();
}
// 查询该流程实例下最新的运行中任务,即驳回后的新任务
Task newTask = taskService.createTaskQuery()
.processInstanceId(processInstanceId)
.active() // 只查询未完成的任务
.singleResult(); // 单节点流程通常只有一个当前任务
Long tformId = Long.parseLong(newTask.getFormKey());
FlowForm sysForm = flowFormService.getById(tformId); // 假设有这个方法
// 获取任务关联的本地变量
Map<String, Object> formValues = taskService.getVariables(newTask.getId());
String zdmc="";
String zdval="";
String tasktitle="";
String userType ="";
String approvalId="";
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();
tasktitle = (String) zdv.get("tasktitle");
userType= (String) zdv.get("approvalType");
approvalId = zdv.get("approval").toString();
}
}else{
zdmc=(String)formValues.get("dataName");
zdval=formValues.get("dataId").toString();
tasktitle=(String)formValues.get("tasktitle");
userType=(String)formValues.get("approvalType");
approvalId=formValues.get("approval").toString();
}
//写入待办
//有了以上信息,可以向相关表写入 相关信息了
MyTaskFlow taskFlow=new MyTaskFlow();
taskFlow.setTaskId(newTask.getId());
taskFlow.setProcDefId(newTask.getProcessDefinitionId());
taskFlow.setProcInsId(newTask.getProcessInstanceId());
taskFlow.setExecutionId(newTask.getExecutionId());
if(zdval!=null&&!zdval.equals("")){
taskFlow.setTargetId(zdval);
}
taskFlow.setDeployId(deploymentId);
taskFlow.setFormTableName(sysForm.getFormTableName());
if(userType.equals("user")) {
taskFlow.setUid(approvalId);
} else {
taskFlow.setRoleid(approvalId);
}
taskFlow.setTaskDefinitionKey(newTask.getTaskDefinitionKey());
myTaskFlowService.save(taskFlow);
} catch (FlowableObjectNotFoundException e) { } catch (FlowableObjectNotFoundException e) {
throw new CustomException("未找到流程实例,流程可能已发生变化"); throw new CustomException("未找到流程实例,流程可能已发生变化");
} catch (FlowableException e) { } catch (FlowableException e) {
...@@ -2521,6 +2626,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -2521,6 +2626,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void assignReadTask(FlowTaskVo flowTaskVo) { public void assignReadTask(FlowTaskVo flowTaskVo) {
// 删除指定的历史流程实例
//historyService.deleteHistoricProcessInstance("778a6343-330f-11f1-a134-02423b4bce10");
// 删除指定的流程实例,需要传入流程实例ID和删除原因
//runtimeService.deleteProcessInstance("14e72dca-3324-11f1-8430-02423b4bce10", "测试数据清理");
SysUser loginUser = iFlowThirdService.getLoginUser(); SysUser loginUser = iFlowThirdService.getLoginUser();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论