Ver código fonte

Merge branch 'master' of http://47.110.251.215:3000/java_org/bladex

liuyc 3 anos atrás
pai
commit
278029edd0
19 arquivos alterados com 537 adições e 23 exclusões
  1. 7 0
      blade-ops-api/blade-flow-api/src/main/java/org/springblade/flow/core/feign/IFlowClient.java
  2. 8 0
      blade-ops-api/blade-flow-api/src/main/java/org/springblade/flow/core/feign/IFlowClientFallback.java
  3. 46 0
      blade-ops-api/blade-flow-api/src/main/java/org/springblade/flow/core/vo/FlowProcessVO.java
  4. 16 0
      blade-ops/blade-flow/src/main/java/org/springblade/flow/business/feign/FlowClient.java
  5. 0 12
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/Task.java
  6. 3 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/ProjectAssignmentUserClient.java
  7. 78 2
      blade-service/blade-business/src/main/java/org/springblade/business/controller/FixedFlowController.java
  8. 11 1
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java
  9. 34 0
      blade-service/blade-business/src/main/java/org/springblade/business/dto/TaskParallelDTO.java
  10. 69 0
      blade-service/blade-business/src/main/java/org/springblade/business/entity/TaskParallel.java
  11. 0 2
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TaskMapper.xml
  12. 33 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TaskParallelMapper.java
  13. 21 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TaskParallelMapper.xml
  14. 32 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITaskParallelService.java
  15. 36 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskParallelServiceImpl.java
  16. 103 5
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java
  17. 34 0
      blade-service/blade-business/src/main/java/org/springblade/business/vo/TaskParallelVO.java
  18. 6 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ProjectAssignmentUserClientImpl.java
  19. 0 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml

+ 7 - 0
blade-ops-api/blade-flow-api/src/main/java/org/springblade/flow/core/feign/IFlowClient.java

@@ -17,14 +17,17 @@
 package org.springblade.flow.core.feign;
 
 import org.springblade.core.launch.constant.AppConstant;
+import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
 import org.springblade.flow.core.entity.BladeFlow;
+import org.springblade.flow.core.vo.FlowProcessVO;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -44,6 +47,10 @@ public interface IFlowClient {
 	String COMPLETE_TASK = API_PREFIX + "/complete-task";
 	String TASK_VARIABLE = API_PREFIX + "/task-variable";
 	String TASK_VARIABLES = API_PREFIX + "/task-variables";
+	String START_FLOW = API_PREFIX + "/start-flow";
+
+	@PostMapping(START_FLOW)
+	List<FlowProcessVO> startFlowList(@RequestParam("category") String category, Query query, @RequestParam(required = false, defaultValue = "1") Integer mode);
 
 	/**
 	 * 开启流程

+ 8 - 0
blade-ops-api/blade-flow-api/src/main/java/org/springblade/flow/core/feign/IFlowClientFallback.java

@@ -16,10 +16,13 @@
  */
 package org.springblade.flow.core.feign;
 
+import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
 import org.springblade.flow.core.entity.BladeFlow;
+import org.springblade.flow.core.vo.FlowProcessVO;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -30,6 +33,11 @@ import java.util.Map;
 @Component
 public class IFlowClientFallback implements IFlowClient {
 
+	@Override
+	public List<FlowProcessVO> startFlowList(String category, Query query, Integer mode) {
+		return null;
+	}
+
 	@Override
 	public R<BladeFlow> startProcessInstanceById(String processDefinitionId, String businessKey, Map<String, Object> variables) {
 		return R.fail("远程调用失败");

+ 46 - 0
blade-ops-api/blade-flow-api/src/main/java/org/springblade/flow/core/vo/FlowProcessVO.java

@@ -0,0 +1,46 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.flow.core.vo;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * FlowProcess
+ *
+ * @author Chill
+ */
+@Data
+@NoArgsConstructor
+public class FlowProcessVO implements Serializable {
+
+	private String id;
+	private String tenantId;
+	private String name;
+	private String key;
+	private String category;
+	private String categoryName;
+	private Integer version;
+	private String deploymentId;
+	private String resourceName;
+	private String diagramResourceName;
+	private Integer suspensionState;
+	private Date deploymentTime;
+}

+ 16 - 0
blade-ops/blade-flow/src/main/java/org/springblade/flow/business/feign/FlowClient.java

@@ -16,11 +16,15 @@
  */
 package org.springblade.flow.business.feign;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import lombok.AllArgsConstructor;
 import org.flowable.engine.IdentityService;
 import org.flowable.engine.RuntimeService;
 import org.flowable.engine.TaskService;
 import org.flowable.engine.runtime.ProcessInstance;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
 import org.springblade.core.tenant.annotation.NonDS;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.support.Kv;
@@ -29,11 +33,15 @@ import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.flow.core.entity.BladeFlow;
 import org.springblade.flow.core.feign.IFlowClient;
 import org.springblade.flow.core.utils.TaskUtil;
+import org.springblade.flow.core.vo.FlowProcessVO;
+import org.springblade.flow.engine.entity.FlowProcess;
+import org.springblade.flow.engine.service.FlowEngineService;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -50,6 +58,14 @@ public class FlowClient implements IFlowClient {
 	private final IdentityService identityService;
 	private final TaskService taskService;
 
+	private final FlowEngineService flowEngineService;
+
+	@Override
+	public List<FlowProcessVO> startFlowList(String category, Query query, Integer mode) {
+		List<FlowProcess> processes = this.flowEngineService.selectProcessPage(Condition.getPage(query), category, mode).getRecords();
+		return JSONArray.parseArray(JSONObject.toJSONString(processes), FlowProcessVO.class);
+	}
+
 	@Override
 	@PostMapping(START_PROCESS_INSTANCE_BY_ID)
 	public R<BladeFlow> startProcessInstanceById(String processDefinitionId, String businessKey, @RequestBody Map<String, Object> variables) {

+ 0 - 12
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/Task.java

@@ -99,18 +99,6 @@ public class Task extends BaseEntity {
     @ApiModelProperty("上报批次")
     private Integer batch;
 
-    /**
-     * 电签状态,1成功,99失败
-     */
-    @ApiModelProperty("电签状态,1成功,99失败")
-    private String eVisaStatus;
-
-    /**
-     * 电签结果内容
-     */
-    @ApiModelProperty("电签结果内容")
-    private String eVisaContent;
-
     /**
      * 上报人
      */

+ 3 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/ProjectAssignmentUserClient.java

@@ -17,6 +17,9 @@ public interface ProjectAssignmentUserClient {
      */
     String API_PREFIX = "/api/manager/projectAssignmentUser";
 
+    @GetMapping(API_PREFIX + "/queryContractDownAllUser")
+    List<SaveUserInfoByProjectDTO> queryContractDownAllUser(@RequestParam String contractId);
+
     @GetMapping(API_PREFIX + "/queryCurrentUserDownAllContractAndProjectId")
     List<SaveUserInfoByProjectDTO> queryCurrentUserDownAllContractAndProjectId(@RequestParam Long userId);
 

+ 78 - 2
blade-service/blade-business/src/main/java/org/springblade/business/controller/FixedFlowController.java

@@ -14,6 +14,14 @@ import org.springblade.business.service.IFixedFlowLinkService;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
+import org.springblade.manager.entity.SignPfxFile;
+import org.springblade.manager.feign.ProjectAssignmentUserClient;
+import org.springblade.manager.vo.RoleSignPfxUserVO;
+import org.springblade.system.feign.ISysClient;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
+import org.springblade.system.vo.RoleVO;
 import org.springframework.beans.BeanUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -24,6 +32,7 @@ import org.springblade.business.service.IFixedFlowService;
 import org.springblade.core.boot.ctrl.BladeController;
 
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -42,6 +51,73 @@ public class FixedFlowController extends BladeController {
 
 	private final IFixedFlowLinkService fixedFlowLinkService;
 
+	private final ISysClient sysClient;
+
+	private final ProjectAssignmentUserClient projectAssignmentUserClient;
+
+	private final IUserClient userClient;
+
+	/**
+	 * 获取系统所有角色划分
+	 */
+	@GetMapping("/queryAllRoleList")
+	@ApiOperationSupport(order = 9)
+	@ApiOperation(value = "获取系统所有角色划分")
+	public R<List<RoleSignPfxUserVO>> queryAllRoleList(@RequestParam String contractId){
+		//获取当前系统配置的角色划分
+		List<RoleVO> roleVOS = this.sysClient.search().getData();
+		//获取项目人员
+		List<SaveUserInfoByProjectDTO> contractUserList = this.projectAssignmentUserClient.queryContractDownAllUser(contractId);
+
+		//返回结果
+		List<RoleSignPfxUserVO> result = new ArrayList<>();
+		for(RoleVO vo : roleVOS){
+			//设置实体
+			RoleSignPfxUserVO pfxUserVo = new RoleSignPfxUserVO();
+			pfxUserVo.setRoleId(vo.getId());
+			pfxUserVo.setRoleName(vo.getRoleName());
+
+			//处理子节点
+			List<RoleVO> childRoles =  vo.getChildren();
+			if(childRoles != null && childRoles.size() > 0) {
+				for (RoleVO childVo : childRoles) {
+					//设置实体
+					RoleSignPfxUserVO childPfxUserVo = new RoleSignPfxUserVO();
+					childPfxUserVo.setRoleId(childVo.getId());
+					childPfxUserVo.setRoleName(childVo.getRoleName());
+
+					//循环项目人员,获取个人证书,如果没有个人证书则删除
+					Iterator<SaveUserInfoByProjectDTO> iterator = contractUserList.iterator();
+					while (iterator.hasNext()){
+						SaveUserInfoByProjectDTO next = iterator.next();
+						if(next.getRoleId().equals(childVo.getId().toString())){
+							//获取用户信息
+							User user = this.userClient.userInfoById(Long.parseLong(next.getUserId())).getData();
+							if(user == null){
+								iterator.remove();
+								continue;
+							}
+							//设置信息
+							SignPfxFile userSignPfx = new SignPfxFile();
+							userSignPfx.setCertificateUserId(user.getId());
+							userSignPfx.setCertificateUserName(user.getName());
+							//设置用户信息
+							childPfxUserVo.getSignPfxFileList().add(userSignPfx);
+						}
+					}
+					//设置子集
+					pfxUserVo.getChildRoleList().add(childPfxUserVo);
+					pfxUserVo.getSignPfxFileList().addAll(childPfxUserVo.getSignPfxFileList());
+				}
+			}
+
+			//设置结果
+			result.add(pfxUserVo);
+		}
+
+		return R.data(result);
+	}
+
 	/**
 	 * 详情
 	 */
@@ -115,7 +191,7 @@ public class FixedFlowController extends BladeController {
 	@PostMapping("/update")
 	@ApiOperationSupport(order = 4)
 	@ApiOperation(value = "修改", notes = "传入fixedFlow对象")
-	public R update(@Valid @RequestBody FixedFlowVO vo) {
+	public R<Boolean> update(@Valid @RequestBody FixedFlowVO vo) {
 		//获取环节处理人顺序
 		String linkUserJoinString = vo.getLinkUserJoinString();
 		if(StringUtils.isNotEmpty(linkUserJoinString)){
@@ -149,7 +225,7 @@ public class FixedFlowController extends BladeController {
 	@PostMapping("/remove")
 	@ApiOperationSupport(order = 5)
 	@ApiOperation(value = "逻辑删除", notes = "传入ids")
-	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+	public R<Boolean> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
 		if(this.fixedFlowService.deleteLogic(Func.toLongList(ids))){
 			//同步删除环节
 			this.fixedFlowLinkService.deletedByFixedFlowId(ids);

+ 11 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java

@@ -50,13 +50,23 @@ public class TaskController extends BladeController {
 
 	private final ITaskService taskService;
 
+	/**
+	 * 完成/审批任务
+	 */
+	@PostMapping("complete-approval-task")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "完成任务")
+	public R<Boolean> completeApprovalTask(){
+		return null;
+	}
+
 	/**
 	 * 上报
 	 */
 	@PostMapping("start-approval")
 	@ApiOperationSupport(order = 1)
 	@ApiOperation(value = "上报", notes = "taskVO对象")
-	public R startApproval(@RequestBody TaskVO taskVO){
+	public R<Boolean> startApproval(@RequestBody TaskVO taskVO){
 		return R.data(this.taskService.startApproval(taskVO));
 	}
 	

+ 34 - 0
blade-service/blade-business/src/main/java/org/springblade/business/dto/TaskParallelDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.dto;
+
+import org.springblade.business.entity.TaskParallel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2022-07-04
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class TaskParallelDTO extends TaskParallel {
+	private static final long serialVersionUID = 1L;
+
+}

+ 69 - 0
blade-service/blade-business/src/main/java/org/springblade/business/entity/TaskParallel.java

@@ -0,0 +1,69 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.springblade.core.mp.base.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.secure.utils.AuthUtil;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2022-07-04
+ */
+@Data
+@TableName("u_task_parallel")
+@EqualsAndHashCode(callSuper = true)
+public class TaskParallel extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * u_task的process_instance_id
+     */
+    private String processInstanceId;
+    /**
+     * 并行实例ID
+     */
+    private String parallelProcessInstanceId;
+    /**
+     * 电签状态,1成功,99失败
+     */
+    private Integer eVisaStatus;
+    /**
+     * 电签结果内容
+     */
+    private String eVisaContent;
+
+    public TaskParallel(String processInstanceId, String parallelProcessInstanceId){
+        this.processInstanceId = processInstanceId;
+        this.parallelProcessInstanceId = parallelProcessInstanceId;
+        this.setIsDeleted(0);
+        this.setCreateUser(AuthUtil.getUserId());
+        this.setCreateTime(new Date());
+    }
+
+    public TaskParallel(){}
+
+}

+ 0 - 2
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TaskMapper.xml

@@ -22,8 +22,6 @@
         <result column="fixed_flow_id" property="fixedFlowId"/>
         <result column="form_data_id" property="formDataId"/>
         <result column="batch" property="batch"/>
-        <result column="e_visa_status" property="eVisaStatus"/>
-        <result column="e_visa_content" property="eVisaContent"/>
         <result column="report_user" property="reportUser"/>
         <result column="report_user_name" property="reportUserName"/>
     </resultMap>

+ 33 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TaskParallelMapper.java

@@ -0,0 +1,33 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.mapper;
+
+import org.springblade.business.entity.TaskParallel;
+import org.springblade.business.vo.TaskParallelVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-07-04
+ */
+public interface TaskParallelMapper extends BaseMapper<TaskParallel> {
+
+}

+ 21 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TaskParallelMapper.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.business.mapper.TaskParallelMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="taskParallelResultMap" type="org.springblade.business.entity.TaskParallel">
+        <result column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="process_instance_id" property="processInstanceId"/>
+        <result column="parallel_process_instance_id" property="parallelProcessInstanceId"/>
+        <result column="e_visa_status" property="eVisaStatus"/>
+        <result column="e_visa_content" property="eVisaContent"/>
+    </resultMap>
+
+</mapper>

+ 32 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/ITaskParallelService.java

@@ -0,0 +1,32 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.service;
+
+import org.springblade.business.entity.TaskParallel;
+import org.springblade.business.vo.TaskParallelVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2022-07-04
+ */
+public interface ITaskParallelService extends BaseService<TaskParallel> {
+
+}

+ 36 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskParallelServiceImpl.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.service.impl;
+
+import org.springblade.business.entity.TaskParallel;
+import org.springblade.business.vo.TaskParallelVO;
+import org.springblade.business.mapper.TaskParallelMapper;
+import org.springblade.business.service.ITaskParallelService;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2022-07-04
+ */
+@Service
+public class TaskParallelServiceImpl extends BaseServiceImpl<TaskParallelMapper, TaskParallel> implements ITaskParallelService {
+
+}

+ 103 - 5
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -16,20 +16,39 @@
  */
 package org.springblade.business.service.impl;
 
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.time.DateUtils;
+import org.springblade.business.entity.FixedFlowLink;
 import org.springblade.business.entity.Task;
+import org.springblade.business.entity.TaskParallel;
 import org.springblade.business.mapper.TaskMapper;
+import org.springblade.business.service.IFixedFlowLinkService;
+import org.springblade.business.service.ITaskParallelService;
 import org.springblade.business.service.ITaskService;
 import org.springblade.business.vo.TaskVO;
+import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.support.Kv;
 import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.flow.core.constant.ProcessConstant;
+import org.springblade.flow.core.entity.BladeFlow;
+import org.springblade.flow.core.feign.IFlowClient;
 import org.springblade.flow.core.utils.FlowUtil;
+import org.springblade.flow.core.utils.TaskUtil;
+import org.springblade.flow.core.vo.FlowProcessVO;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 任务审核主表 服务实现类
@@ -37,23 +56,102 @@ import java.util.Date;
  * @author BladeX
  * @since 2022-07-01
  */
+@Slf4j
 @Service
+@AllArgsConstructor
 public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implements ITaskService {
 
+    private final IFlowClient flowClient;
+
+    private final IFixedFlowLinkService fixedFlowLinkService;
+
+    private final ITaskParallelService taskParallelService;
+
     @Override
     public Boolean startApproval(TaskVO vo) {
         //获取业务表
         String businessTable = FlowUtil.getBusinessTable(ProcessConstant.EXAMINATION_AND_APPROVAL);
         if(Func.isEmpty(vo.getId())){
+            vo.setId(SnowFlakeUtil.getId());
+            //设置开始/结束时间
+            Date nowTime = new Date();
+            vo.setStartTime(DateUtil.format(nowTime, "yyyy-MM-dd"));
+            vo.setEndTime(DateUtil.format(DateUtils.addDays(nowTime, vo.getRestrictDay()), "yyyy-MM-dd"));
+
+            Query query = new Query();
+            query.setCurrent(1);
+            query.setSize(999);
+            //获取流程
+            List<FlowProcessVO> modeProcessVOS = this.flowClient.startFlowList("", query, 1);
+            if(modeProcessVOS == null || modeProcessVOS.size() == 0){
+                return false;
+            }
+            //获取当中的审批流程
+            String taskFlowId = null;
+            for(FlowProcessVO processVO : modeProcessVOS){
+                if("approval".equals(processVO.getKey())){
+                    taskFlowId = processVO.getId();
+                    break;
+                }
+            }
+            //如果没有对应流程,直接返回
+            if(StringUtils.isEmpty(taskFlowId)){
+                return false;
+            }
+            //获取选择的固定流程
+            List<FixedFlowLink> links = this.fixedFlowLinkService.selectFixedFlowLink(vo.getFixedFlowId().toString());
+            if(links == null || links.size() == 0){
+                return false;
+            }
+            //根据所选择的固定流程所含有的环节发起审批任务
+            StringBuilder instanceIds = new StringBuilder();
+            for(FixedFlowLink link : links){
+                // 启动流程
+                Kv variables = Kv.create()
+                        //下一步流程审批人
+                        .set("taskUser", TaskUtil.getTaskUser(link.getFixedFlowLinkUser().toString()));
+                R<BladeFlow> result = flowClient.startProcessInstanceById(taskFlowId, FlowUtil.getBusinessKey(businessTable, String.valueOf(vo.getId())), variables);
+                if (result.isSuccess()) {
+                    log.debug("并行流程已启动,流程ID:" + result.getData().getProcessInstanceId());
+                    //拼接并行的实例ID
+                    instanceIds.append(",").append(result.getData().getProcessInstanceId());
+                } else {
+                    throw new ServiceException("开启并行流程失败");
+                }
+            }
+
+            //启动主流程
+            R<BladeFlow> result = this.flowClient.startProcessInstanceById(taskFlowId, FlowUtil.getBusinessKey(businessTable, String.valueOf(vo.getId())),
+                    Kv.create().set(ProcessConstant.TASK_VARIABLE_CREATE_USER, AuthUtil.getUserName()).set("taskUser", TaskUtil.getTaskUser("")));
+            if (result.isSuccess()) {
+                log.debug("主流程已启动,流程ID:" + result.getData().getProcessInstanceId());
+                //拼接并行的实例ID
+                vo.setProcessInstanceId(result.getData().getProcessInstanceId());
+            } else {
+                throw new ServiceException("开启主流程失败");
+            }
+
+            vo.setProcessDefinitionId(taskFlowId);
             //bean Copy
+            vo.setReportUser(AuthUtil.getUserId().toString());
+            vo.setReportUserName(AuthUtil.getUserName());
+            vo.setCreateUser(AuthUtil.getUserId());
+            vo.setCreateTime(nowTime);
             Task task = new Task();
             BeanUtils.copyProperties(vo, task);
-            //设置开始/结束时间
-            Date nowTime = new Date();
-            task.setStartTime(DateUtil.format(nowTime, "yyyy-MM-dd"));
-            task.setEndTime(DateUtil.format(DateUtils.addDays(nowTime, vo.getRestrictDay()), "yyyy-MM-dd"));
+            //保存并行数据
+            String[] instanceIdArray = instanceIds.toString().split(",");
+            List<TaskParallel> taskParallelArray = new ArrayList<>();
+            for(String instanceId : instanceIdArray){
+                if(StringUtils.isNotEmpty(instanceId)){
+                    taskParallelArray.add(new TaskParallel(vo.getProcessInstanceId(), instanceId));
+                }
+            }
+            this.taskParallelService.saveBatch(taskParallelArray);
 
+            //保存主表数据
+            this.save(task);
         }
-        return null;
+        return true;
     }
 }

+ 34 - 0
blade-service/blade-business/src/main/java/org/springblade/business/vo/TaskParallelVO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.vo;
+
+import org.springblade.business.entity.TaskParallel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2022-07-04
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class TaskParallelVO extends TaskParallel {
+	private static final long serialVersionUID = 1L;
+
+}

+ 6 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ProjectAssignmentUserClientImpl.java

@@ -1,5 +1,6 @@
 package org.springblade.manager.feign;
 
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
@@ -16,6 +17,11 @@ public class ProjectAssignmentUserClientImpl implements ProjectAssignmentUserCli
 
     private final SaveUserInfoByProjectService saveUserInfoByProjectService;
 
+    @Override
+    public List<SaveUserInfoByProjectDTO> queryContractDownAllUser(String contractId) {
+        return this.saveUserInfoByProjectService.list(Wrappers.<SaveUserInfoByProjectDTO>lambdaQuery().eq(SaveUserInfoByProjectDTO::getContractId, contractId).eq(SaveUserInfoByProjectDTO::getIsDeleted, 0));
+    }
+
     @Override
     public List<SaveUserInfoByProjectDTO> queryCurrentUserDownAllContractAndProjectId(Long userId) {
         return this.saveUserInfoByProjectService.queryCurrentUserDownAllContractAndProjectId(userId);

+ 0 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml

@@ -304,7 +304,6 @@
           m_wbs_tree_contract
         where
           is_deleted = 0
-        and parent_id in(select id from m_wbs_tree_contract where is_deleted = 0 and contract_id = #{contractId} and parent_id = 0)
         and major_data_type = 5
         and contract_id = #{contractId}
     </select>