提交 5717cf8e authored 作者: whydesc's avatar whydesc

--会签功能完善

上级 385fe3aa
......@@ -590,7 +590,7 @@
//alert("dd"+isFixed.value);
// if (!isFixed.value) {
//alert("dd"+userType.value);
if (userType.value === 'user') {
submitData.values['approval'] = formData.checkSendUser;
submitData.values['copyUser'] = formData.copyUser;
......@@ -604,7 +604,12 @@
} else if (formData.checkSendRole) {
submitData.values['approval'] = formData.checkSendRole;
submitData.values['approvalType'] = 'role';
}else{
submitData.values['approval'] = formData.checkSendUser;
submitData.values['copyUser'] = formData.copyUser;
submitData.values['approvalType'] = 'user';
}
console.log("ssss why ----",submitData);
const result = await complete(submitData);
message.success('任务发送成功');
......
......@@ -160,6 +160,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
}
if (DelegationState.PENDING.equals(task.getDelegationState())) {
taskService.addComment(taskVo.getTaskId(), taskVo.getInstanceId(), FlowComment.DELEGATE.getType(), taskVo.getComment());
taskService.resolveTask(taskVo.getTaskId(), taskVo.getValues());
......@@ -167,12 +168,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
} else {
// 获取流程变量
Map<String, Object> formValues = getProcessVariables(taskVo.getTaskId());
String zdmc="";
String zdval="";
String tasktitle="";
String zdmc = "";
String zdval = "";
String tasktitle = "";
if(formValues.get("dataName")==null){
if(formValues.get("_value")!=null) {
if (formValues.get("dataName") == null) {
if (formValues.get("_value") != null) {
Map zdv = (Map) formValues.get("_value");
zdmc = (String) zdv.get("dataName");
......@@ -180,10 +181,29 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
tasktitle = (String) zdv.get("tasktitle");
}
}else{
zdmc=(String)formValues.get("dataName");
zdval=formValues.get("dataId").toString();
tasktitle=(String)formValues.get("tasktitle");
} else {
zdmc = (String) formValues.get("dataName");
zdval = formValues.get("dataId").toString();
tasktitle = (String) formValues.get("tasktitle");
}
//处理多用户 多实例
String approval = ""; //发送人
Object approvalUserObject = taskVo.getValues().get("approval");
if (approvalUserObject != null) {
approval = approvalUserObject.toString();
}
// 2. 设置流程变量
Map<String, Object> variables = new HashMap<>();
List<String> approverIds=null;
if (!approval.equals("") && approval.indexOf(",") > 0) {
// 1. 接收前端数据
approverIds = Arrays.asList(approval.split(","));
// 2. 设置流程变量
variables.put("assigneeList", approverIds); // 对应BPMN里的collection
}
......@@ -191,61 +211,85 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
//Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
SysUser loginUser = iFlowThirdService.getLoginUser();
if (!approval.equals("") && approval.indexOf(",") > 0) {
taskService.complete(taskVo.getTaskId(), variables);
List<Task> nextTask2List = taskService.createTaskQuery()
.processInstanceId(taskVo.getInstanceId())
.active().list();
for(int k=0;k<nextTask2List.size();k++){
Task ntaxk= nextTask2List.get(k);
taskService.setAssignee(ntaxk.getId(), approverIds.get(k));
}
} else {
taskService.complete(taskVo.getTaskId(), taskVo.getValues());
//处理抄送
String copyUser=""; //抄送人
String copyUser = ""; //抄送人
Object copyUserObject = taskVo.getValues().get("copyUser");
if(copyUserObject!=null) {
if (copyUserObject != null) {
copyUser = copyUserObject.toString();
}
String userType ="";
String approvalId="";
String userType = "";
String approvalId = "";
Object userTypeObject = taskVo.getValues().get("approvalType");
if(userTypeObject!=null) {
if (userTypeObject != null) {
userType = userTypeObject.toString();
}
Object approvalObject = taskVo.getValues().get("approval");
if(approvalObject!=null) {
if (approvalObject != null) {
approvalId = approvalObject.toString();
}
this.saveMyTaskFlowHis(task,userType,approvalId,cdate,loginUser.getId(),ProcessConstants.TASK_TYPE_HAND,OptionType,copyUser,ProcessConstants.OPTION_TYPE_CC);
this.saveMyTaskFlowHis(task, userType, approvalId, cdate, loginUser.getId(), ProcessConstants.TASK_TYPE_HAND, OptionType, copyUser, ProcessConstants.OPTION_TYPE_CC);
FlowForm flowForm=sysDeployFormService.selectSysDeployFormByDeployId(deploymentId);
FlowForm flowForm = sysDeployFormService.selectSysDeployFormByDeployId(deploymentId);
List<Task> task2List = taskService.createTaskQuery().processInstanceId(taskVo.getInstanceId()).active().list();
Task nextTask = taskService.createTaskQuery()
Task nextTask = null;/**taskService.createTaskQuery()
.processInstanceId(taskVo.getInstanceId())
.singleResult();
.singleResult();*/
if (CollUtil.isNotEmpty(task2List)){
nextTask = task2List.get(0);
}
if(nextTask!=null){
if (nextTask != null) {
if(userType.equals("user")) {
if (task.getTaskDefinitionKey().equals(nextTask.getTaskDefinitionKey())){
//* 当前节点是会签节点,没有走完
}else{
if (userType.equals("user")) {
taskService.setAssignee(nextTask.getId(), approvalId);
} else {
taskService.addCandidateGroup(nextTask.getId(),approvalId);
taskService.addCandidateGroup(nextTask.getId(), approvalId);
}
}
this.saveMyTaskFlow(task.getId(),nextTask,userType,approvalId,"待"+OptionType,null);
this.saveMyTaskFlow(task.getId(), nextTask, userType, approvalId, "待" + OptionType, null);
if(flowForm!=null){
if (flowForm != null) {
String tabname= flowForm.getFormTableName();
if(tabname!=null&&!tabname.equals("")&&zdmc!=null&&!zdmc.equals("")&&zdval!=null&&!zdval.equals("")){
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();
String formContent = zdmc + "=" + zdval;
FlowForm flowFormben = new FlowForm();
flowFormben.setFormTableName(tabname);
flowFormben.setFormContent(formContent);
flowFormben.setFormTp("2");
flowFormben.setFormUrl(deploymentId);
if(tabname!=null&&tabname.equals("st_plan_man")){
if (tabname != null && tabname.equals("st_plan_man")) {
flowFormben.setFormRules(nextTask.getName());
}else{
} else {
flowFormben.setFormRules(null);
}
......@@ -256,14 +300,14 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
}
}
}else{
} else {
//是最后一个 id 判断是最后一个节点
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();
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");
......@@ -276,6 +320,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
}
}
}
return Result.OK();
......@@ -1679,17 +1725,18 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
if (Objects.nonNull(multiInstance)) {
// 会签 多实例
String collectionString = multiInstance.getInputDataItem();
if(values!=null){
Object colObj = values.get(collectionString);
List<String> userNameList = null;
if(colObj!=null){
if (colObj != null) {
userNameList = (List) colObj;
}
if (CollUtil.isNotEmpty(userNameList)){
if (CollUtil.isNotEmpty(userNameList)) {
// 待办人员从变量中获取 否则就是节点中配置的用户 sysUserFromTask
List<SysUser> userList = Lists.newArrayList();
for (String username : userNameList) {
SysUser userByUsername = iFlowThirdService.getUserByUsername(username);
if (userByUsername==null){
if (userByUsername == null) {
throw new CustomException(username + " 用户名未找到");
} else {
userList.add(userByUsername);
......@@ -1699,7 +1746,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
} else {
// 变量中没有传入,写入节点中配置的用户
List<String> collect_username = sysUserFromTask.stream().map(SysUser::getUsername).collect(Collectors.toList());
values.put(collectionString,collect_username);
values.put(collectionString, collect_username);
}
}
} else {
// todo 读取自定义节点属性做些啥?
......@@ -2794,11 +2842,12 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
zdval=formValues.get("dataId").toString();
tasktitle=(String)formValues.get("tasktitle");
}
if(nextTask.getFormKey()!=null) {
Long formId = Long.parseLong(nextTask.getFormKey());
FlowForm sysForm = flowFormService.getById(formId); // 假设有这个方法
MyTask myTask = new MyTask();
if(userType.equals("user")) {
if (userType.equals("user")) {
myTask.setUid(approvalId);
} else {
myTask.setRoleid(approvalId);
......@@ -2806,7 +2855,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
myTask.setTp(5);
myTask.setTarget(nextTask.getName());
if(zdval!=null&&!zdval.equals("")){
if (zdval != null && !zdval.equals("")) {
myTask.setTargetId(zdval); //zdval
}
......@@ -2817,10 +2866,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
myTask.setPriority("M");
myTask.setDes("");
//myTask.setLinkAddr("/project/plan/StPlanManList?"+zdmc+"="+zdval);
if(sysForm!=null){
if(sysForm.getFormTp().equals("2")){
if (sysForm != null) {
if (sysForm.getFormTp().equals("2")) {
myTask.setLinkAddr(sysForm.getFormListurl());
}else{
} else {
myTask.setLinkAddr("/flowable/task/todo/index");
}
......@@ -2829,22 +2878,19 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
myTaskService.save(myTask);
//有了以上信息,可以向相关表写入 相关信息了
MyTaskFlow taskFlow=new MyTaskFlow();
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("")){
if (zdval != null && !zdval.equals("")) {
taskFlow.setTargetId(zdval);
}
taskFlow.setDeployId(deploymentId);
taskFlow.setFormTableName(sysForm.getFormTableName());
if(userType.equals("user")) {
if (userType.equals("user")) {
taskFlow.setUid(approvalId);
} else {
taskFlow.setRoleid(approvalId);
......@@ -2855,20 +2901,20 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
myTaskFlowService.save(taskFlow);
//写抄送信息
if(copyUser!=null&&!copyUser.equals("")){
MyTaskFlowCc myTaskFlowCc=new MyTaskFlowCc();
if (copyUser != null && !copyUser.equals("")) {
MyTaskFlowCc myTaskFlowCc = new MyTaskFlowCc();
myTaskFlowCc.setCcid(copyUser);
myTaskFlowCc.setTaskId(nextTask.getId());
myTaskFlowCc.setProcDefId(nextTask.getProcessDefinitionId());
myTaskFlowCc.setProcInsId(nextTask.getProcessInstanceId());
myTaskFlowCc.setExecutionId(nextTask.getExecutionId());
if(zdval!=null&&!zdval.equals("")){
if (zdval != null && !zdval.equals("")) {
myTaskFlowCc.setTargetId(zdval);
}
myTaskFlowCc.setDeployId(deploymentId);
myTaskFlowCc.setFormTableName(sysForm.getFormTableName());
if(userType.equals("user")) {
if (userType.equals("user")) {
myTaskFlowCc.setUid(approvalId);
} else {
myTaskFlowCc.setRoleid(approvalId);
......@@ -2882,10 +2928,10 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
}
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();
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);
......@@ -2893,6 +2939,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
sysDeployFormService.updateBisTabUid(flowFormben);
}
}
......@@ -2948,13 +2996,16 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
}
taskFlowHis.setDeployId(DeployId);
FlowForm tsysForm =null;
if(task.getFormKey()!=null) {
Long tformId = Long.parseLong(task.getFormKey());
FlowForm tsysForm = flowFormService.getById(tformId); // 假设有这个方法
if(tsysForm!=null&&tsysForm.getFormTableName()!=null){
tsysForm = flowFormService.getById(tformId); // 假设有这个方法
if (tsysForm != null && tsysForm.getFormTableName() != null) {
taskFlowHis.setFormTableName(tsysForm.getFormTableName());
}
if(userType.equals("user")) {
taskFlowHis.setUid(approvalId);
} else {
......@@ -2977,24 +3028,24 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
//写抄送信息
if(copyUser!=null&&!copyUser.equals("")){
MyTaskFlowCc myTaskFlowCc=new MyTaskFlowCc();
if(copyUser!=null&&!copyUser.equals("")) {
MyTaskFlowCc myTaskFlowCc = new MyTaskFlowCc();
myTaskFlowCc.setCcid(copyUser);
myTaskFlowCc.setTaskId(task.getId());
myTaskFlowCc.setProcDefId(task.getProcessDefinitionId());
myTaskFlowCc.setProcInsId(task.getProcessInstanceId());
myTaskFlowCc.setExecutionId(task.getExecutionId());
if(zdval!=null&&!zdval.equals("")){
if (zdval != null && !zdval.equals("")) {
myTaskFlowCc.setTargetId(zdval);
}
myTaskFlowCc.setDeployId(DeployId);
if(tsysForm!=null&&tsysForm.getFormTableName()!=null){
if (tsysForm != null && tsysForm.getFormTableName() != null) {
myTaskFlowCc.setFormTableName(tsysForm.getFormTableName());
}
if(userType.equals("user")) {
if (userType.equals("user")) {
myTaskFlowCc.setUid(approvalId);
} else {
myTaskFlowCc.setRoleid(approvalId);
......@@ -3014,6 +3065,8 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
}
}
......
......@@ -170,9 +170,9 @@ spring:
# username: root
# password: ZhongRunChangHong/123
url: jdbc:mysql://localhost:3306/zrch_stm_db_3.9_new?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
url: jdbc:mysql://47.98.203.68:3306/zrch_stm_db_3.9?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: 123456
password: ZhongRunChangHong/123
driver-class-name: com.mysql.cj.jdbc.Driver
# # shardingjdbc数据源
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论