From 8194d0ed1986d1c82f98c1ad1abfc0db1b460ede Mon Sep 17 00:00:00 2001
From: wang1 <844966816@qq.com>
Date: 星期五, 16 六月 2023 18:32:47 +0800
Subject: [PATCH] 主数据流程代码初次提交

---
 Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/FlowTaskUserC.java                        |    7 
 Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/enumpck/ProcessTemplateTypeEnum.java |    4 
 Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/mapper/UserMapper.java                       |    4 
 Source/UBCS/ubcs-service/ubcs-user/src/main/resources/mapper/UserMapper.xml                                            |    6 
 Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/FlowEngineService.java                   |    2 
 Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/FlowTaskUser.java                         |    1 
 Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/IUserService.java                    |   18 ++
 Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/FlowTaskUserController.java           |    7 
 Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/FlowTaskUserServiceImpl.java        |   87 ++++++++--
 Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/VCIFlowserviceImpl.java             |  145 ++++++++++++++++++
 Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/VCIFlowController.java                |   44 +++++
 Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/VICFlowService.java                      |   37 ++++
 Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java            |   18 ++
 Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/FlowProcessTSController.java          |    4 
 Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/business/service/impl/FlowBusinessServiceImpl.java      |   14 +
 Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/FlowEngineServiceImpl.java          |   11 +
 Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/controller/UserController.java               |    6 
 Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/FlowTaskUserService.java                 |   11 +
 18 files changed, 387 insertions(+), 39 deletions(-)

diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/business/service/impl/FlowBusinessServiceImpl.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/business/service/impl/FlowBusinessServiceImpl.java
index a84b86b..c2ce243 100644
--- a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/business/service/impl/FlowBusinessServiceImpl.java
+++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/business/service/impl/FlowBusinessServiceImpl.java
@@ -25,6 +25,7 @@
 import com.vci.ubcs.flow.engine.entity.FlowProcess;
 import com.vci.ubcs.flow.engine.utils.FlowCache;
 import lombok.AllArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
 import org.flowable.engine.HistoryService;
 import org.flowable.engine.TaskService;
 import org.flowable.engine.history.HistoricProcessInstance;
@@ -117,7 +118,7 @@
 
 		HistoricProcessInstanceQuery historyQuery = historyService.createHistoricProcessInstanceQuery().startedBy(taskUser).orderByProcessInstanceStartTime().desc();
 
-		if (bladeFlow.getCategory() != null) {
+		if (StringUtils.isNotEmpty(bladeFlow.getCategory())) {
 			historyQuery.processDefinitionCategory(bladeFlow.getCategory());
 		}
 		if (bladeFlow.getProcessDefinitionName() != null) {
@@ -142,7 +143,7 @@
 			String[] businessKey = Func.toStrArray(StringPool.COLON, historicProcessInstance.getBusinessKey());
 			if (businessKey.length > 1) {
 				flow.setBusinessTable(businessKey[0]);
-				flow.setBusinessId(businessKey[1]);
+				flow.setBusinessId(businessKey.length>1?businessKey[1]:"1");
 			}
 			flow.setHistoryActivityName(historicProcessInstance.getName());
 			flow.setProcessInstanceId(historicProcessInstance.getId());
@@ -190,7 +191,7 @@
 		HistoricTaskInstanceQuery doneQuery = historyService.createHistoricTaskInstanceQuery().taskAssignee(taskUser).finished()
 			.includeProcessVariables().orderByHistoricTaskInstanceEndTime().desc();
 
-		if (bladeFlow.getCategory() != null) {
+		if (StringUtils.isNotEmpty(bladeFlow.getCategory())) {
 			doneQuery.processCategoryIn(Func.toStrList(bladeFlow.getCategory()));
 		}
 		if (bladeFlow.getProcessDefinitionName() != null) {
@@ -230,7 +231,7 @@
 			if (Func.isNotEmpty(historicProcessInstance)) {
 				String[] businessKey = Func.toStrArray(StringPool.COLON, historicProcessInstance.getBusinessKey());
 				flow.setBusinessTable(businessKey[0]);
-				flow.setBusinessId(businessKey[1]);
+				flow.setBusinessId(businessKey.length>1?businessKey[1]:"1");
 				if (historicProcessInstance.getEndActivityId() != null) {
 					flow.setProcessIsFinished(FlowEngineConstant.STATUS_FINISHED);
 				} else {
@@ -278,7 +279,8 @@
 	 * @param status    鐘舵��
 	 */
 	private void buildFlowTaskList(BladeFlow bladeFlow, List<BladeFlow> flowList, TaskQuery taskQuery, String status) {
-		if (bladeFlow.getCategory() != null) {
+//		if (bladeFlow.getCategory() != null) {
+		if (StringUtils.isNotEmpty(bladeFlow.getCategory())) {
 			taskQuery.processCategoryIn(Func.toStrList(bladeFlow.getCategory()));
 		}
 		if (bladeFlow.getProcessDefinitionName() != null) {
@@ -305,7 +307,7 @@
 			if (Func.isNotEmpty(historicProcessInstance)) {
 				String[] businessKey = Func.toStrArray(StringPool.COLON, historicProcessInstance.getBusinessKey());
 				flow.setBusinessTable(businessKey[0]);
-				flow.setBusinessId(businessKey[1]);
+				flow.setBusinessId(businessKey.length>1?businessKey[1]:"1");
 			}
 
 			FlowProcess processDefinition = FlowCache.getProcessDefinition(task.getProcessDefinitionId());
diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/ProcessTSController.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/FlowProcessTSController.java
similarity index 97%
rename from Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/ProcessTSController.java
rename to Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/FlowProcessTSController.java
index 4bf34b9..37ecad5 100644
--- a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/ProcessTSController.java
+++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/FlowProcessTSController.java
@@ -29,7 +29,7 @@
 @RestController
 @RequestMapping("processTS")
 @AllArgsConstructor
-public class ProcessTSController {
+public class FlowProcessTSController {
 
 	private final FlowEngineService flowEngineService;
 	private final ProcessTemplateService processTemplateService;
@@ -41,7 +41,7 @@
 	@GetMapping("/tlist")
 	public R<IPage<ProcessTemplate>> tlist(@RequestParam Map<String, Object> flow, Query query) {
 		IPage<ProcessTemplate> pages = processTemplateService.page(Condition.getPage(query), Condition.getQueryWrapper(flow, ProcessTemplate.class)
-			.select("id,model_key modelKey,model_name modelName,button_Type_Key buttonTypeKey,button_Type_value buttonTypeValue")
+			.select("id,model_key modelKey,model_name modelName,button_Type_Key buttonTypeKey,button_Type_value buttonTypeValue,description")
 			.orderByDesc("last_updated"));
 		return R.data(pages);
 	}
diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/FlowTaskUserController.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/FlowTaskUserController.java
index 8aaba6c..bc67b15 100644
--- a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/FlowTaskUserController.java
+++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/FlowTaskUserController.java
@@ -8,6 +8,8 @@
 import org.springblade.core.tool.api.R;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 
 /**
  * 娴佺▼task瀹℃壒鎺у埗
@@ -24,11 +26,12 @@
 
 	/**
 	 * 娴佺▼task瀹℃壒浜哄憳鍒楄〃
+	 * ProcessTemplateTypeEnum
 	 * @return
 	 */
 	@GetMapping("list")
-	public R<FlowTaskUserC> list() {
-		return R.data(taskUserService.getUser());
+	public R<Object> list(String type,String templateId) {
+		return R.data(taskUserService.getUser(type,templateId));
 	}
 
 	/**
diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/VCIFlowController.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/VCIFlowController.java
new file mode 100644
index 0000000..fba4637
--- /dev/null
+++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/VCIFlowController.java
@@ -0,0 +1,44 @@
+package com.vci.ubcs.flow.engine.controller;
+
+import com.vci.ubcs.flow.core.entity.BladeFlow;
+import com.vci.ubcs.flow.engine.entity.FlowTaskUserC;
+import com.vci.ubcs.flow.engine.service.FlowTaskUserService;
+import com.vci.ubcs.flow.engine.service.VICFlowService;
+import lombok.AllArgsConstructor;
+import org.springblade.core.tenant.annotation.NonDS;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+
+/**
+ * 瀹氬埗娴佺▼銆佸惎鍔ㄣ�佽浆鍙戙�佸畬鎴愭帶鍒跺櫒
+ *
+ * @author wang1
+ */
+@NonDS
+@RestController
+@RequestMapping("vciflow")
+@AllArgsConstructor
+public class VCIFlowController {
+
+	private final VICFlowService vicFlowService;
+
+	/**
+	 * 鍚姩
+	 * @return
+	 */
+	@PostMapping("start")
+	public R<BladeFlow> list(@RequestBody FlowTaskUserC flowTaskUserC) {
+		return vicFlowService.startProcess(flowTaskUserC);
+	}
+
+	/**
+	 * 娴佺▼棰勬祴
+	 */
+	@PostMapping("a")
+	public R<BladeFlow> a(@RequestBody FlowTaskUserC flowTaskUserC) {
+		return vicFlowService.startProcess(flowTaskUserC);
+	}
+}
diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/FlowTaskUser.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/FlowTaskUser.java
index dde1fb2..fbab2e8 100644
--- a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/FlowTaskUser.java
+++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/FlowTaskUser.java
@@ -37,6 +37,7 @@
 	private String id;
 	private String name;//淇濆瓨鐨勮繖涓敹钘忓悕绉�
 	private String modelKey;
+	private String modelName;
 	private String classifyId;
 	private String templateId;
 	private String taskId;//娴佺▼taskid
diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/FlowTaskUserC.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/FlowTaskUserC.java
index 9e862db..8e77956 100644
--- a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/FlowTaskUserC.java
+++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/FlowTaskUserC.java
@@ -34,10 +34,17 @@
 	private String createdBy;
 	private String name;//淇濆瓨鐨勮繖涓敹钘忓悕绉�
 	private String modelKey;
+	private String modelName;
+	private String processName;
+	private String processDesc;
+	private String topName;
 	private String classifyId;
 	private String templateId;
 	private String taskId;//闃舵id锛屽氨鏄祦绋媡askid
 	private String taskName;//闃舵鍚嶇О
 	private List<FlowTaskUser> flowTaskUsers;//姣忎釜鑺傜偣鏀惰棌浜�
 	private List<ProcessStageAttr> processStageAttr;//娴佺▼闃舵淇濆瓨鐨勫睘鎬�
+	private List<String> ids;//娴佺▼鍙戣捣涓紶閫掕繃鏉ョ殑鏁版嵁id
+
+
 }
diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/FlowEngineService.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/FlowEngineService.java
index 9ea5718..de9f38b 100644
--- a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/FlowEngineService.java
+++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/FlowEngineService.java
@@ -173,4 +173,6 @@
 	 */
 	List<Map<String,String>> getNodeByFlowableKey(String key);
 
+	String getTaskIdString();
+
 }
diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/FlowTaskUserService.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/FlowTaskUserService.java
index a7ba9b4..d5950d0 100644
--- a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/FlowTaskUserService.java
+++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/FlowTaskUserService.java
@@ -35,9 +35,10 @@
 
 	/**
 	 * 鏌ヨ褰撳墠鐧婚檰浜哄杩欎釜娴佺▼鐨則askUser
+	 * @param type ProcessTemplateTypeEnum
 	 * @return
 	 */
-	FlowTaskUserC getUser();
+	Object getUser(String type,String templateId);
 
 	/**
 	 * 鏂板/淇敼娴佺▼鑺傜偣瀹℃牳浜洪厤缃�佸苟涓斾慨鏀规祦绋媥ml閮ㄧ讲鏂囦欢
@@ -51,4 +52,12 @@
 	 * @param name
 	 */
 	void deleteUser(String name);
+
+	/**
+	 * 閫氳繃妯℃澘id鍜屾ā鍨媖ey鏌ヨ瀹℃壒浜�
+	 * @param templateId
+	 * @param modelKey
+	 * @return
+	 */
+	List<FlowTaskUser> getTaskUserByTemplateAndModelKey(String templateId,String modelKey);
 }
diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/VICFlowService.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/VICFlowService.java
new file mode 100644
index 0000000..6f14049
--- /dev/null
+++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/VICFlowService.java
@@ -0,0 +1,37 @@
+/*
+ *      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 com.vci.ubcs.flow.engine.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.vci.ubcs.flow.core.entity.BladeFlow;
+import com.vci.ubcs.flow.engine.entity.FlowTaskUser;
+import com.vci.ubcs.flow.engine.entity.FlowTaskUserC;
+import org.springblade.core.tool.api.R;
+
+/**
+ * FlowService
+ *
+ * @author wang1
+ */
+public interface VICFlowService{
+
+	/**
+	 * 鍚姩娴佺▼
+	 * @return
+	 */
+	R<BladeFlow> startProcess(FlowTaskUserC flowTaskUserC);
+}
diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/FlowEngineServiceImpl.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/FlowEngineServiceImpl.java
index a11071e..297d6ca 100644
--- a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/FlowEngineServiceImpl.java
+++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/FlowEngineServiceImpl.java
@@ -93,6 +93,8 @@
 	private static final String USR_TASK = "userTask";
 	private static final String IMAGE_NAME = "image";
 	private static final String XML_NAME = "xml";
+	private static final String TASKID = "taskId";
+	private static final String TASKNAME = "taskName";
 	private static final Integer INT_1024 = 1024;
 	private static final BpmnJsonConverter BPMN_JSON_CONVERTER = new BpmnJsonConverter();
 	private static final BpmnXMLConverter BPMN_XML_CONVERTER = new BpmnXMLConverter();
@@ -508,16 +510,19 @@
 			for (FlowElement flowElement : process.getFlowElements()) {
 				if (flowElement instanceof UserTask) {
 					Map<String,String> mi = new HashMap<>();
-					mi.put("taskId",flowElement.getId());
-					mi.put("taskName",flowElement.getName());
+					mi.put(TASKID,flowElement.getId());
+					mi.put(TASKNAME,flowElement.getName());
 					ll.add(mi);
 				}
 			}
 		}
-
 		return ll;
 	}
 
+	@Override
+	public String getTaskIdString(){
+		return TASKID;
+	}
 	/**
 	 * 鏄惁宸插畬缁�
 	 *
diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/FlowTaskUserServiceImpl.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/FlowTaskUserServiceImpl.java
index ecdc82a..993a297 100644
--- a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/FlowTaskUserServiceImpl.java
+++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/FlowTaskUserServiceImpl.java
@@ -28,6 +28,7 @@
 import com.vci.ubcs.flow.engine.entity.*;
 import com.vci.ubcs.flow.engine.mapper.FlowMapper;
 import com.vci.ubcs.flow.engine.mapper.FlowTaskUserMapper;
+import com.vci.ubcs.flow.engine.mapper.ProcessTemplateMapper;
 import com.vci.ubcs.flow.engine.service.FlowEngineService;
 import com.vci.ubcs.flow.engine.service.FlowTaskUserService;
 import com.vci.ubcs.flow.engine.utils.FlowCache;
@@ -92,23 +93,62 @@
 
 	private FlowEngineService flowEngineService;
 	private FlowTaskUserMapper flowTaskUserMapper;
+	private ProcessTemplateMapper processTemplateMapper;
 
 	/**
 	 * 鏌ヨ褰撳墠鐧婚檰浜哄杩欎釜娴佺▼鐨則askUser
+	 * @param type ProcessTemplateTypeEnum
 	 * @return
 	 */
 	@Override
-	public FlowTaskUserC getUser(){
-		QueryWrapper<FlowTaskUser> queryWrapper = new QueryWrapper<>();
-		queryWrapper.eq("CREATED_BY", AuthUtil.getUserId());
-		List<FlowTaskUser> flowTaskUsers = baseMapper.selectList(queryWrapper);
-		FlowTaskUserC flowTaskUserCR = new FlowTaskUserC();
-		if(flowTaskUsers.size()==0){
-			return flowTaskUserCR;
+	public Object getUser(String type,String templateId){
+		Map kv = new HashMap();
+
+		//鏍规嵁type鏌ヨtop娴佺▼鏁版嵁
+		Map<String, Object> m = new HashMap<>();
+		m.put("button_type_key", type);
+		m.put("template_id", templateId);
+		List<ProcessTemplate> processTemplates = processTemplateMapper.selectByMap(m);
+ 		if(processTemplates.size()==0){
+			throw new ServiceException("涓婚搴撳畾涔�-妯℃澘绠$悊-娴佺▼妯℃澘锛屾病鏈夌粦瀹氭祦绋�!");
 		}
-		flowTaskUserCR.setName(flowTaskUsers.get(0).getName());//鏀惰棌鍚嶇О
-		flowTaskUserCR.setFlowTaskUsers(flowTaskUsers);
-		return flowTaskUserCR;
+		ProcessTemplate processTemplate = processTemplates.get(0);
+		kv.put("flow",processTemplate);
+
+
+		//top鏀惰棌閮ㄥ垎鏁版嵁
+		QueryWrapper<FlowTaskUser> queryWrapper = new QueryWrapper<>();
+		queryWrapper.eq("CREATED_BY", TaskUtil.getTaskUser());
+		List<FlowTaskUser> flowTaskUsers = baseMapper.selectList(queryWrapper);
+		List<FlowTaskUserC> cl = new ArrayList<>();
+
+		Map<String,List<FlowTaskUser>> nameMap = new HashMap<>();
+		for(FlowTaskUser flowTaskUser:flowTaskUsers){
+			String name = flowTaskUser.getName();//鏀惰棌鍚嶇О
+			List<FlowTaskUser> flowTaskUserListo = null;
+			if(nameMap.get(name)==null){
+				flowTaskUserListo = new ArrayList<>();
+			}else {
+				flowTaskUserListo = nameMap.get(name);
+			}
+			flowTaskUserListo.add(flowTaskUser);
+			nameMap.put(name,flowTaskUserListo);
+		}
+
+		for (String name:nameMap.keySet()){
+			FlowTaskUserC flowTaskUserCR = new FlowTaskUserC();
+			flowTaskUserCR.setName(name);//鏀惰棌鍚嶇О
+			flowTaskUserCR.setModelKey(nameMap.get(name).get(0).getModelKey());
+			flowTaskUserCR.setModelName(nameMap.get(name).get(0).getModelName());
+			flowTaskUserCR.setFlowTaskUsers(nameMap.get(name));
+			cl.add(flowTaskUserCR);
+		}
+		kv.put("collect",cl);
+
+		//鏁版嵁鑺傜偣鏁版嵁
+		List<Map<String,String>> tl = flowEngineService.getNodeByFlowableKey(processTemplate.getModelKey());
+		kv.put("user",tl);
+		return kv;
 	}
 
 	@Override
@@ -117,17 +157,20 @@
 		String name = flowTaskUserC.getName();//鏀惰棌鍚嶇О
 
 		//鏂板鎯呭喌涓嬮獙璇佹敹钘忓悕绉颁笉閲嶅
-		if(flowTaskUsers.get(0).getId()!=null) {
-			Map<String, Object> m = new HashMap<>();
-			m.put("name", name);
-			QueryWrapper q = Condition.getQueryWrapper(m, FlowTaskUser.class)
-				.select("id,model_key modelKey,name,description,version,created,last_updated lastUpdated");
-			if(flowTaskUserMapper.selectCount(q)>0){
-				throw new ServiceException("鏀惰棌鍚嶇О宸茬粡瀛樺湪!");
-			}
+		Map<String, Object> m = new HashMap<>();
+		m.put("name", name);
+		m.put("created_by", TaskUtil.getTaskUser());
+		QueryWrapper q = Condition.getQueryWrapper(m, FlowTaskUser.class)
+			.select("1");
+		if(flowTaskUserMapper.selectCount(q)>0){
+			throw new ServiceException("鏀惰棌鍚嶇О宸茬粡瀛樺湪!");
 		}
+
 		for (FlowTaskUser flowTaskUseri:flowTaskUsers){
 			flowTaskUseri.setName(name);
+			flowTaskUseri.setCreatedBy(TaskUtil.getTaskUser());
+			flowTaskUseri.setTemplateId(flowTaskUserC.getTemplateId());
+			flowTaskUseri.setModelKey(flowTaskUserC.getModelKey());
 		}
 		//鏂板銆佷慨鏀�
 		this.saveOrUpdateBatch(flowTaskUsers);
@@ -139,8 +182,14 @@
 	public void deleteUser(String name){
 		Map<String, Object> m = new HashMap<>();
 		m.put("name", name);
-		m.put("created_by", AuthUtil.getUserId());
+		m.put("created_by", TaskUtil.getTaskUser());
 		baseMapper.deleteByMap(m);
 	}
 
+	public List<FlowTaskUser> getTaskUserByTemplateAndModelKey(String templateId,String modelKey){
+		Map<String, Object> m = new HashMap<>();
+		m.put("template_id", templateId);
+		m.put("model_key", modelKey);
+		return baseMapper.selectByMap(m);
+	}
 }
diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/VCIFlowserviceImpl.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/VCIFlowserviceImpl.java
new file mode 100644
index 0000000..9012c4b
--- /dev/null
+++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/VCIFlowserviceImpl.java
@@ -0,0 +1,145 @@
+/*
+ *      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 com.vci.ubcs.flow.engine.service.impl;
+
+import com.vci.ubcs.flow.core.constant.ProcessConstant;
+import com.vci.ubcs.flow.core.entity.BladeFlow;
+import com.vci.ubcs.flow.core.utils.TaskUtil;
+import com.vci.ubcs.flow.engine.entity.*;
+import com.vci.ubcs.flow.engine.service.FlowEngineService;
+import com.vci.ubcs.flow.engine.service.FlowTaskUserService;
+import com.vci.ubcs.flow.engine.service.VICFlowService;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.flowable.bpmn.model.*;
+import org.flowable.engine.*;
+import org.flowable.engine.impl.persistence.entity.ExecutionEntity;
+import org.flowable.engine.repository.ProcessDefinition;
+import org.flowable.engine.runtime.ProcessInstance;
+import org.flowable.task.api.Task;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.support.Kv;
+import org.springframework.stereotype.Service;
+import java.util.*;
+
+/**
+ * 宸ヤ綔娴佹湇鍔″疄鐜扮被
+ *
+ * @author Chill
+ */
+@Slf4j
+@Service
+@AllArgsConstructor
+public class VCIFlowserviceImpl implements VICFlowService {
+
+	private final RuntimeService runtimeService;
+	private final IdentityService identityService;
+	private final RepositoryService repositoryService;
+	private final TaskService taskService;
+	private final FlowTaskUserService flowTaskUserService;
+	private final FlowEngineService flowEngineService;
+	private final HistoryService historyService;
+
+	@Override
+	public R<BladeFlow> startProcess(FlowTaskUserC flowTaskUserC){
+		String modelKey = flowTaskUserC.getModelKey();
+		String templateId = flowTaskUserC.getTemplateId();
+
+		Kv kv = Kv.create()
+			.set(ProcessConstant.TASK_VARIABLE_CREATE_USER, AuthUtil.getUserName());
+
+		// 璁剧疆娴佺▼鍚姩鐢ㄦ埛
+		identityService.setAuthenticatedUserId(TaskUtil.getTaskUser());
+
+		// 寮�鍚祦绋�
+		//鏌ヨ鏈�鏂扮殑娴佺▼閮ㄧ讲id
+		ProcessDefinition latesDefinition = repositoryService.createProcessDefinitionQuery().latestVersion().processDefinitionKey(modelKey).singleResult();
+		String processDefinitionId = latesDefinition.getId();
+
+		//鏌ヨ姣忎竴姝ュ鏍镐汉
+		List<FlowTaskUser> taskUsers = flowTaskUserService.getTaskUserByTemplateAndModelKey(templateId,modelKey);
+		Set<String> taskIdSet = new HashSet<>();
+		for (FlowTaskUser taskUser:taskUsers){
+			kv.put(taskUser.getTaskId(),TaskUtil.getTaskUser(taskUser.getUserId()));
+			taskIdSet.add(taskUser.getTaskId());
+		}
+
+		//瀵规瘮閰嶇疆鐨勫鏍镐汉鍛樺拰娴佺▼涓妭鐐规槸鍚︿竴鑷达紝鍙兘瀛樺湪娴佺▼鑺傜偣鍙樻洿浜嗭紝澶氫簡鎴栬�呭皯浜嗚妭鐐癸紝浣嗘槸閰嶇疆瀹℃牳浜哄憳鐨勮妭鐐规病鏈夊彉
+		List<Map<String,String>> processTasks = flowEngineService.getNodeByFlowableKey(modelKey);
+		for (Map<String,String> mi:processTasks){
+			String taskId = mi.get(flowEngineService.getTaskIdString());
+			if(!taskIdSet.contains(taskId)){
+				throw new ServiceException("娴佺▼宸查噸鏂伴儴缃诧紝鑺傜偣宸叉敼鍙橈紝璇疯缃鏍镐汉鍛橈紒");
+			}
+		}
+		if(taskIdSet.size()!=processTasks.size()){
+			throw new ServiceException("娴佺▼宸查噸鏂伴儴缃诧紝鑺傜偣宸叉敼鍙橈紝璇疯缃鏍镐汉鍛橈紒");
+		}
+
+		//娴佺▼涓枃浠躲�佸彉閲忕瓑
+		//do..
+
+		ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinitionId, modelKey, kv);
+		// 缁勮娴佺▼閫氱敤绫�
+		BladeFlow flow = new BladeFlow();
+		flow.setProcessInstanceId(processInstance.getId());
+
+		nextFlowNode("next","039ac1d8-0c1e-11ee-bebb-5c3a4570456d");
+		return R.data(flow);
+	}
+
+	/**
+	 * 鑾峰彇浠诲姟鑺傜偣
+	 *
+	 * @param node   鏌ヨ鑺傜偣閫夋嫨
+	 * @param processInstanceId 娴佺▼瀹炰緥id
+	 */
+	public void nextFlowNode(String node, String processInstanceId) {
+
+		Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).active().singleResult();
+
+		ExecutionEntity ee = (ExecutionEntity) runtimeService.createExecutionQuery()
+			.executionId(task.getExecutionId()).singleResult();
+		// 褰撳墠瀹℃壒鑺傜偣
+		String crruentActivityId = ee.getActivityId();
+		BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId());
+		FlowNode flowNode = (FlowNode) bpmnModel.getFlowElement(crruentActivityId);
+		// 杈撳嚭杩炵嚎
+		List<SequenceFlow> outFlows = flowNode.getOutgoingFlows();
+		for (SequenceFlow sequenceFlow : outFlows) {
+			//褰撳墠瀹℃壒鑺傜偣
+			if ("now".equals(node)) {
+				FlowElement sourceFlowElement = sequenceFlow.getSourceFlowElement();
+				System.out.println("褰撳墠鑺傜偣: id=" + sourceFlowElement.getId() + ",name=" + sourceFlowElement.getName());
+			} else if ("next".equals(node)) {
+				// 涓嬩竴涓鎵硅妭鐐�
+				FlowElement targetFlow = sequenceFlow.getTargetFlowElement();
+				if (targetFlow instanceof UserTask) {
+					System.out.println("涓嬩竴鑺傜偣: id=" + targetFlow.getId() + ",name=" + targetFlow.getName());
+				}
+				// 濡傛灉涓嬩釜瀹℃壒鑺傜偣涓虹粨鏉熻妭鐐�
+				if (targetFlow instanceof EndEvent) {
+					System.out.println("涓嬩竴鑺傜偣涓虹粨鏉熻妭鐐癸細id=" + targetFlow.getId() + ",name=" + targetFlow.getName());
+				}
+			}
+
+
+		}
+	}
+}
diff --git a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/enumpck/ProcessTemplateTypeEnum.java b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/enumpck/ProcessTemplateTypeEnum.java
index 3284d8e..6f47626 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/enumpck/ProcessTemplateTypeEnum.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/enumpck/ProcessTemplateTypeEnum.java
@@ -20,12 +20,12 @@
 	/**
 	 * 鍋滅敤
 	 */
-	ENABLE("ENABLE","鍋滅敤"),
+	ENABLE("ENABLE","鍚敤"),
 
 	/**
 	 * 鍚敤
 	 */
-	DISABLE("DISABLE","鍚敤");
+	DISABLE("DISABLE","鍋滅敤");
 
 	/**
 	 * 鏋氫妇鐨勫��
diff --git a/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/controller/UserController.java b/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/controller/UserController.java
index 4fe20fa..5322e78 100644
--- a/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/controller/UserController.java
+++ b/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/controller/UserController.java
@@ -142,6 +142,12 @@
 		return R.data(UserWrapper.build().pageVO(pages));
 	}
 
+	@GetMapping("/allPage")
+	public R<List<UserVO>> allPage(User user,Long deptId) {
+		List<User> userss = userService.selectAllUser(user,deptId);
+		return R.data(UserWrapper.build().listVO(userss));
+	}
+
 	/**
 	 * 鏂板鎴栦慨鏀�
 	 */
diff --git a/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/mapper/UserMapper.java b/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/mapper/UserMapper.java
index 0d21766..847bac9 100644
--- a/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/mapper/UserMapper.java
+++ b/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/mapper/UserMapper.java
@@ -43,6 +43,8 @@
 	 */
 	List<User> selectUserPage(IPage<User> page, @Param("user") User user, @Param("deptIdList") List<Long> deptIdList, @Param("tenantId") String tenantId);
 
+	List<User> selectUserPage(@Param("user") User user, @Param("deptIdList") List<Long> deptIdList, @Param("tenantId") String tenantId);
+
 	/**
 	 * 鑾峰彇鐢ㄦ埛
 	 *
@@ -50,7 +52,7 @@
 	 * @param account
 	 * @return
 	 */
-	User getUser(String tenantId, String account);
+	User getUser(String tenantId, String account,String name);
 
 	/**
 	 * 鑾峰彇瀵煎嚭鐢ㄦ埛鏁版嵁
diff --git a/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/IUserService.java b/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/IUserService.java
index 51ace0f..1d38c73 100644
--- a/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/IUserService.java
+++ b/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/IUserService.java
@@ -84,6 +84,15 @@
 	 * 鑷畾涔夊垎椤�
 	 *
 	 * @param user
+	 * @param deptId
+	 * @return
+	 */
+	List<User> selectAllUser(User user, Long deptId);
+
+	/**
+	 * 鑷畾涔夊垎椤�
+	 *
+	 * @param user
 	 * @param query
 	 * @return
 	 */
@@ -107,6 +116,15 @@
 	UserInfo userInfo(String tenantId, String account);
 
 	/**
+	 * 鐢ㄦ埛淇℃伅,涓哄暐涓嶅垹浜嗕笂杈归偅涓柟娉曞憿锛屽洜涓烘垜涓嶆暍,鐗垫壇鏈夌偣澶�
+	 *
+	 * @param tenantId
+	 * @param account
+	 * @return
+	 */
+	UserInfo userInfo(String tenantId, String account,String name);
+
+	/**
 	 * 鐢ㄦ埛淇℃伅
 	 *
 	 * @param tenantId
diff --git a/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java
index 4502b3c..c66d5f2 100644
--- a/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java
@@ -162,6 +162,13 @@
 	}
 
 	@Override
+	public List<User> selectAllUser(User user, Long deptId){
+		List<Long> deptIdList = SysCache.getDeptChildIds(deptId);
+		List<User> users = baseMapper.selectUserPage(user, deptIdList, (AuthUtil.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? StringPool.EMPTY : AuthUtil.getTenantId()));
+		return users;
+	}
+
+	@Override
 	public IPage<UserVO> selectUserSearch(UserVO user, Query query) {
 		LambdaQueryWrapper<User> queryWrapper = Wrappers.<User>query().lambda();
 		String tenantId = AuthUtil.getTenantId();
@@ -206,13 +213,20 @@
 
 	@Override
 	public UserInfo userInfo(String tenantId, String account) {
-		User user = baseMapper.getUser(tenantId, account);
+		User user = baseMapper.getUser(tenantId, account,null);
 		return buildUserInfo(user);
 	}
 
 	@Override
+	public UserInfo userInfo(String tenantId, String account,String name) {
+		User user = baseMapper.getUser(tenantId, account,name);
+		UserInfo userInfo = buildUserInfo(user);
+		return null;
+	}
+
+	@Override
 	public UserInfo userInfo(String tenantId, String account, UserEnum userEnum) {
-		User user = baseMapper.getUser(tenantId, account);
+		User user = baseMapper.getUser(tenantId, account,null);
 		return buildUserInfo(user, userEnum);
 	}
 
diff --git a/Source/UBCS/ubcs-service/ubcs-user/src/main/resources/mapper/UserMapper.xml b/Source/UBCS/ubcs-service/ubcs-user/src/main/resources/mapper/UserMapper.xml
index 89d7627..2229dba 100644
--- a/Source/UBCS/ubcs-service/ubcs-user/src/main/resources/mapper/UserMapper.xml
+++ b/Source/UBCS/ubcs-service/ubcs-user/src/main/resources/mapper/UserMapper.xml
@@ -77,7 +77,11 @@
             LEFT JOIN PL_SYS_USER_PWDSTRATEGY plup on plup.USER_ID=pou.ID
             LEFT JOIN PL_SYS_PWDSTRATEGY pss on pss.ID=plup.PWDSTRATEGY_ID
         WHERE
-            tenant_id = #{param1} and account = #{param2} and is_deleted = 0
+            tenant_id = #{param1} and account = #{param2}
+            <if test="param3!=null and param3 != ''">
+                and name = #{param3}
+            </if>
+          and is_deleted = 0
     </select>
 
     <select id="exportUser" resultType="com.vci.ubcs.system.user.excel.UserExcel">

--
Gitblit v1.9.3