提交 0cfa28bc authored 作者: whydesc's avatar whydesc

--工作流任务删除同时删除业务记录

上级 2ca4fbe4
......@@ -25,4 +25,7 @@ public interface SysDeployFormMapper extends BaseMapper<SysDeployForm> {
FlowForm selectSysFormByDeployId(String deployId);
int updateBisTabBpmStatus(FlowForm flowForm);
int updateBisTabUid(FlowForm flowForm);
int deleteMyTaskFlow(String instanceId);
int deleteMyTaskFlowFcc(String instanceId);
int deleteMyTaskFlowHis(String instanceId);
}
......@@ -40,4 +40,18 @@
where ${formContent}
</update>
<delete id="deleteMyTaskFlow" parameterType="String">
delete from my_task_flow where proc_ins_id = #{instanceId}
</delete>
<delete id="deleteMyTaskFlowFcc" parameterType="String">
delete from my_task_flow_cc where proc_ins_id = #{instanceId}
</delete>
<delete id="deleteMyTaskFlowHis" parameterType="String">
delete from my_task_flow_his where proc_ins_id = #{instanceId}
</delete>
</mapper>
\ No newline at end of file
......@@ -15,4 +15,5 @@ public interface ISysDeployFormService extends IService<SysDeployForm> {
public FlowForm selectSysFormByDeployId(String deployId);
public int updateBisTabBpmStatus( FlowForm flowForm);
public int updateBisTabUid( FlowForm flowForm);
public void deleteMyTaskFlowAndCCAndHis( String instanceId);
}
......@@ -47,6 +47,14 @@ public class SysDeployFormServiceImpl extends ServiceImpl<SysDeployFormMapper, S
return sysDeployFormMapper.updateBisTabUid(flowForm);
}
@Override
public void deleteMyTaskFlowAndCCAndHis( String instanceId) {
sysDeployFormMapper.deleteMyTaskFlow(instanceId);
sysDeployFormMapper.deleteMyTaskFlowFcc(instanceId);
sysDeployFormMapper.deleteMyTaskFlowHis(instanceId);
}
}
......@@ -131,17 +131,20 @@ public class FlowInstanceServiceImpl extends FlowServiceFactory implements IFlow
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("");
//flowFormben.setFormUrl(DeployId);
sysDeployFormService.updateBisTabBpmStatus(flowFormben);
}
try {
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("");
//flowFormben.setFormUrl(DeployId);
sysDeployFormService.updateBisTabBpmStatus(flowFormben);
}
} catch (Exception e) {
log.error(e.getMessage());
}
}
......@@ -160,58 +163,8 @@ public class FlowInstanceServiceImpl extends FlowServiceFactory implements IFlow
runtimeService.deleteProcessInstance(instanceId, deleteReason);
// 删除历史流程实例
historyService.deleteHistoricProcessInstance(instanceId);
/**
List<Task> task = taskService.createTaskQuery().processInstanceId(instanceId).list();
if (CollectionUtils.isEmpty(task)) {
throw new CustomException("流程未启动或已执行完成,取消申请失败");
}
// 查询历史数据
HistoricProcessInstance historicProcessInstance = getHistoricProcessInstanceById(instanceId);
if (historicProcessInstance.getEndTime() != null) {
historyService.deleteHistoricProcessInstance(historicProcessInstance.getId());
return;
}
// 删除流程实例
runtimeService.deleteProcessInstance(instanceId, deleteReason);
// 删除历史流程实例
historyService.deleteHistoricProcessInstance(instanceId);
*/
/*======================撤回删除 回调以及关键数据保存======================*/
/**
LambdaQueryWrapper<FlowMyBusiness> flowMyBusinessLambdaQueryWrapper = new LambdaQueryWrapper<>();
flowMyBusinessLambdaQueryWrapper.eq(FlowMyBusiness::getProcessInstanceId,instanceId)
;
//如果保存数据前未调用必调的FlowCommonService.initActBusiness方法,就会有问题
FlowMyBusiness business = flowMyBusinessService.getOne(flowMyBusinessLambdaQueryWrapper);
//设置数据
String doneUsers = business.getDoneUsers();
SysUser sysUser = iFlowThirdService.getLoginUser();
// 处理过流程的人
JSONArray doneUserList = new JSONArray();
if (StrUtil.isNotBlank(doneUsers)){
doneUserList = JSON.parseArray(doneUsers);
}
if (!doneUserList.contains(sysUser.getUsername())){
doneUserList.add(sysUser.getUsername());
}
business
.setActStatus(ActStatus.recall)
.setTaskId("")
.setTaskName("已撤回")
.setPriority("")
.setDoneUsers(doneUserList.toJSONString())
.setTodoUsers("")
;
flowMyBusinessService.updateById(business);
//spring容器类名
String serviceImplName = business.getServiceImplName();
FlowCallBackServiceI flowCallBackService = (FlowCallBackServiceI) SpringContextUtils.getBean(serviceImplName);
// 流程处理完后,进行回调业务层
if (flowCallBackService!=null)flowCallBackService.afterFlowHandle(business);
*/
//删除业务数据
sysDeployFormService.deleteMyTaskFlowAndCCAndHis(instanceId);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论