提交 d2c7dbb3 authored 作者: kxjia's avatar kxjia

Merge branch 'master' of http://47.97.51.208/root/zrch-risk-39

...@@ -7,6 +7,7 @@ import org.jeecg.modules.flowable.domain.dto.FlowViewerDto; ...@@ -7,6 +7,7 @@ import org.jeecg.modules.flowable.domain.dto.FlowViewerDto;
import org.jeecg.modules.flowable.domain.vo.FlowTaskVo; import org.jeecg.modules.flowable.domain.vo.FlowTaskVo;
import java.io.InputStream; import java.io.InputStream;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -180,6 +181,7 @@ public interface IFlowTaskService { ...@@ -180,6 +181,7 @@ public interface IFlowTaskService {
public Result<List<String>> todoListAll(); public Result<List<String>> todoListAll();
public void saveMyTaskFlow(String thistaskId,Task nextTask,String userType,String approvalId,String messageTaskName);
public void saveMyTaskFlowHis(Task task,String userType,String approvalId,Date cdate,String loginUserid,String taskType,String OptionType);
}
}
...@@ -471,7 +471,11 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl ...@@ -471,7 +471,11 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
} }
String userType="user";
String approvalId=sysUser.getId();
flowTaskService.saveMyTaskFlowHis(task,userType,approvalId,cdate,sysUser.getId(),ProcessConstants.TASK_TYPE_START,OptionType);
/**
MyTaskFlowHis taskFlowHis=new MyTaskFlowHis(); MyTaskFlowHis taskFlowHis=new MyTaskFlowHis();
taskFlowHis.setTaskId(task.getId()); taskFlowHis.setTaskId(task.getId());
taskFlowHis.setProcDefId(task.getProcessDefinitionId()); taskFlowHis.setProcDefId(task.getProcessDefinitionId());
...@@ -488,8 +492,7 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl ...@@ -488,8 +492,7 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
taskFlowHis.setFormTableName(flowForm.getFormTableName()); taskFlowHis.setFormTableName(flowForm.getFormTableName());
} }
String userType="user";
String approvalId=sysUser.getId();
if(userType.equals("user")) { if(userType.equals("user")) {
taskFlowHis.setUid(approvalId); taskFlowHis.setUid(approvalId);
...@@ -509,6 +512,7 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl ...@@ -509,6 +512,7 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
taskFlowHis.setFlowName(flowname); taskFlowHis.setFlowName(flowname);
myTaskFlowHisService.save(taskFlowHis); myTaskFlowHisService.save(taskFlowHis);
*/
......
...@@ -200,6 +200,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -200,6 +200,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
} }
this.saveMyTaskFlowHis(task,userType,approvalId,cdate,loginUser.getId(),ProcessConstants.TASK_TYPE_HAND,OptionType);
/**
MyTaskFlowHis taskFlowHis=new MyTaskFlowHis(); MyTaskFlowHis taskFlowHis=new MyTaskFlowHis();
taskFlowHis.setTaskId(task.getId()); taskFlowHis.setTaskId(task.getId());
taskFlowHis.setProcDefId(task.getProcessDefinitionId()); taskFlowHis.setProcDefId(task.getProcessDefinitionId());
...@@ -235,6 +239,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -235,6 +239,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
taskFlowHis.setFlowName(flowname); taskFlowHis.setFlowName(flowname);
myTaskFlowHisService.save(taskFlowHis); myTaskFlowHisService.save(taskFlowHis);
*/
Task nextTask = taskService.createTaskQuery() Task nextTask = taskService.createTaskQuery()
...@@ -249,8 +254,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -249,8 +254,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
taskService.addCandidateGroup(nextTask.getId(),approvalId); taskService.addCandidateGroup(nextTask.getId(),approvalId);
} }
this.saveMyTaskFlow(task.getId(),nextTask,userType,approvalId,"待"+OptionType);
/**
// 处理表单数据 // 处理表单数据
// Map<String, Object> formData = processFormData(task); // Map<String, Object> formData = processFormData(task);
...@@ -327,6 +334,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -327,6 +334,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
sysDeployFormService.updateBisTabUid(flowFormben); sysDeployFormService.updateBisTabUid(flowFormben);
} }
*/
...@@ -379,6 +387,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -379,6 +387,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
@Override @Override
public void taskReject(FlowTaskVo flowTaskVo) { public void taskReject(FlowTaskVo flowTaskVo) {
Date cdate = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String curdate = sdf.format(cdate);
//Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
SysUser loginUser = iFlowThirdService.getLoginUser();
if (taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult().isSuspended()) { if (taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult().isSuspended()) {
throw new CustomException("任务处于挂起状态!"); throw new CustomException("任务处于挂起状态!");
...@@ -546,9 +560,15 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -546,9 +560,15 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
approvalId=formValues.get("approval").toString(); approvalId=formValues.get("approval").toString();
} }
String OptionType=ProcessConstants.OPTION_TYPE_REJECT;
//写入待办 //写入待办
this.saveMyTaskFlow(task.getId(),newTask,userType,approvalId,OptionType+"待处理");
this.saveMyTaskFlowHis(task,userType,approvalId,cdate,loginUser.getId(),ProcessConstants.TASK_TYPE_HAND,OptionType);
//有了以上信息,可以向相关表写入 相关信息了 //有了以上信息,可以向相关表写入 相关信息了
/**
MyTaskFlow taskFlow=new MyTaskFlow(); MyTaskFlow taskFlow=new MyTaskFlow();
taskFlow.setTaskId(newTask.getId()); taskFlow.setTaskId(newTask.getId());
taskFlow.setProcDefId(newTask.getProcessDefinitionId()); taskFlow.setProcDefId(newTask.getProcessDefinitionId());
...@@ -569,6 +589,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -569,6 +589,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
taskFlow.setTaskDefinitionKey(newTask.getTaskDefinitionKey()); taskFlow.setTaskDefinitionKey(newTask.getTaskDefinitionKey());
myTaskFlowService.save(taskFlow); myTaskFlowService.save(taskFlow);
*/
} catch (FlowableObjectNotFoundException e) { } catch (FlowableObjectNotFoundException e) {
throw new CustomException("未找到流程实例,流程可能已发生变化"); throw new CustomException("未找到流程实例,流程可能已发生变化");
...@@ -872,10 +893,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -872,10 +893,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
// 2. 核心操作:直接将任务的指派人改为目标用户 // 2. 核心操作:直接将任务的指派人改为目标用户
// 此时,任务的所有权彻底转移 // 此时,任务的所有权彻底转移
taskService.setAssignee(flowTaskVo.getTaskId(), targetUserId); taskService.setAssignee(flowTaskVo.getTaskId(), targetUserId);
flowTaskVo.getInstanceId();
Date date = new Date(); Date cdate = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String curdate = sdf.format(date); String curdate = sdf.format(cdate);
// 3. (可选) 添加一条评论或日志,记录这次转办动作 // 3. (可选) 添加一条评论或日志,记录这次转办动作
//taskService.addComment(flowTaskVo.getTaskId(), null, originalUserId + " 将任务转办给 " + targetUserId); //taskService.addComment(flowTaskVo.getTaskId(), null, originalUserId + " 将任务转办给 " + targetUserId);
...@@ -901,6 +922,16 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -901,6 +922,16 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
FlowForm sysForm = flowFormService.getById(formId); // 假设有这个方法 FlowForm sysForm = flowFormService.getById(formId); // 假设有这个方法
// 写入 待办 // 写入 待办
String userType="user";
String OptionType=ProcessConstants.OPTION_TYPE_ASSIGN;
//写入待办
this.saveMyTaskFlow(flowTaskVo.getTaskId(),task,userType,targetUserId,OptionType+"待处理");
this.saveMyTaskFlowHis(task,userType,loginUser.getId(),cdate,loginUser.getId(),ProcessConstants.TASK_TYPE_HAND,OptionType);
/**
MyTask myTask = new MyTask(); MyTask myTask = new MyTask();
myTask.setUid(targetUserId); myTask.setUid(targetUserId);
myTask.setTp(5); myTask.setTp(5);
...@@ -961,6 +992,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -961,6 +992,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
sysDeployFormService.updateBisTabUid(flowFormben); sysDeployFormService.updateBisTabUid(flowFormben);
} }
*/
...@@ -2654,13 +2687,25 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -2654,13 +2687,25 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
// 为任务添加一个“阅读者”身份链接 // 为任务添加一个“阅读者”身份链接
taskService.addUserIdentityLink(flowTaskVo.getTaskId(), targetUserId, "reader"); taskService.addUserIdentityLink(flowTaskVo.getTaskId(), targetUserId, "reader");
Date date = new Date(); Date cdate = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String curdate = sdf.format(date); String curdate = sdf.format(cdate);
// 3. (可选) 添加一条评论或日志,记录这次转办动作 // 3. (可选) 添加一条评论或日志,记录这次转办动作
//taskService.addComment(flowTaskVo.getTaskId(), null, originalUserId + " 将任务转办给 " + targetUserId); //taskService.addComment(flowTaskVo.getTaskId(), null, originalUserId + " 将任务转办给 " + targetUserId);
taskService.addComment(flowTaskVo.getTaskId(), flowTaskVo.getInstanceId(), curdate+loginUser.getRealname() + " 将任务转阅给 " + targetuser.getRealname()); taskService.addComment(flowTaskVo.getTaskId(), flowTaskVo.getInstanceId(), curdate+loginUser.getRealname() + " 将任务转阅给 " + targetuser.getRealname());
//写入待办
Task task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult();
String userType="user";
String OptionType=ProcessConstants.OPTION_TYPE_READ;
this.saveMyTaskFlow(flowTaskVo.getTaskId(),task,userType,targetUserId,OptionType+"待查看");
this.saveMyTaskFlowHis(task,userType,loginUser.getId(),cdate,loginUser.getId(),ProcessConstants.TASK_TYPE_HAND,OptionType);
} }
...@@ -2795,5 +2840,200 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -2795,5 +2840,200 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
@Override
public void saveMyTaskFlow(String thistaskId,Task nextTask,String userType,String approvalId,String messageTaskName){
//此方法为写入待办
// 根据流程定义ID查询流程定义对象
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.processDefinitionId(nextTask.getProcessDefinitionId())
.singleResult();
String deploymentId ="";
String flowname ="";
if (processDefinition != null) {
// 获取部署ID - 这就是你想要的deployId
deploymentId = processDefinition.getDeploymentId();
flowname=processDefinition.getName();
}
// 获取流程变量
Map<String, Object> formValues = getProcessVariables(thistaskId);
String zdmc="";
String zdval="";
String tasktitle="";
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");
}
}else{
zdmc=(String)formValues.get("dataName");
zdval=formValues.get("dataId").toString();
tasktitle=(String)formValues.get("tasktitle");
}
Long formId = Long.parseLong(nextTask.getFormKey());
FlowForm sysForm = flowFormService.getById(formId); // 假设有这个方法
MyTask myTask = new MyTask();
if(userType.equals("user")) {
myTask.setUid(approvalId);
} else {
myTask.setRoleid(approvalId);
}
myTask.setTp(5);
myTask.setTarget(nextTask.getName());
if(zdval!=null&&!zdval.equals("")){
myTask.setTargetId(zdval); //zdval
}
myTask.setStTime(new Date());
myTask.setTaskName(messageTaskName);
myTask.setName(nextTask.getName());
myTask.setSta(0);
myTask.setPriority("M");
myTask.setDes("");
//myTask.setLinkAddr("/project/plan/StPlanManList?"+zdmc+"="+zdval);
if(sysForm!=null){
if(sysForm.getFormTp().equals("2")){
myTask.setLinkAddr(sysForm.getFormListurl());
}else{
myTask.setLinkAddr("/flowable/task/todo/index");
}
}
myTaskService.save(myTask);
//有了以上信息,可以向相关表写入 相关信息了
MyTaskFlow taskFlow=new MyTaskFlow();
taskFlow.setTaskId(nextTask.getId());
taskFlow.setProcDefId(nextTask.getProcessDefinitionId());
taskFlow.setProcInsId(nextTask.getProcessInstanceId());
taskFlow.setExecutionId(nextTask.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(nextTask.getTaskDefinitionKey());
myTaskFlowService.save(taskFlow);
String tabname= sysForm.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(approvalId);
sysDeployFormService.updateBisTabUid(flowFormben);
}
}
@Override
public void saveMyTaskFlowHis(Task task,String userType,String approvalId,Date cdate,String loginUserid,String taskType,String OptionType){
//此方法为写入履历
// 根据流程定义ID查询流程定义对象
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.processDefinitionId(task.getProcessDefinitionId())
.singleResult();
String DeployId ="";
String flowname ="";
if (processDefinition != null) {
// 获取部署ID - 这就是你想要的deployId
DeployId = processDefinition.getDeploymentId();
flowname=processDefinition.getName();
}
// 获取流程变量
Map<String, Object> formValues = getProcessVariables(task.getId());
String zdmc="";
String zdval="";
String tasktitle="";
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");
}
}else{
zdmc=(String)formValues.get("dataName");
zdval=formValues.get("dataId").toString();
tasktitle=(String)formValues.get("tasktitle");
}
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);
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(loginUserid);
taskFlowHis.setOptionType(OptionType);//审核 转办 转阅
taskFlowHis.setTaskType(taskType);//发起 参与
taskFlowHis.setTaskName(task.getName());
taskFlowHis.setTaskTitle(tasktitle);
taskFlowHis.setFlowName(flowname);
myTaskFlowHisService.save(taskFlowHis);
}
} }
...@@ -114,8 +114,8 @@ public class PageTitleconfigController extends JeecgController<PageTitleconfig, ...@@ -114,8 +114,8 @@ public class PageTitleconfigController extends JeecgController<PageTitleconfig,
wrapper.or().in("roleid", Arrays.asList(finalRoleids.split(","))); wrapper.or().in("roleid", Arrays.asList(finalRoleids.split(",")));
} }
}) })
.orderByDesc("priority") .orderByDesc("st_time")
.orderByDesc("st_time"); .orderByDesc("priority");
queryWrapper.last("limit 5"); queryWrapper.last("limit 5");
List<MyTask> list = myTaskService.list(queryWrapper); List<MyTask> list = myTaskService.list(queryWrapper);
return Result.OK(list); return Result.OK(list);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论