Browse Source

工作流完善

wangwei 7 years ago
parent
commit
6370715aba

+ 39 - 1
hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/pom.xml

@@ -95,7 +95,16 @@
             <artifactId>hsweb-system-authorization-service-api</artifactId>
             <version>${project.version}</version>
         </dependency>
-
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-datasource-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <scope>runtime</scope>
+        </dependency>
         <dependency>
             <groupId>com.h2database</groupId>
             <artifactId>h2</artifactId>
@@ -118,6 +127,20 @@
             <version>4.3.7.RELEASE</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.mybatis</groupId>
+            <artifactId>mybatis-spring</artifactId>
+            <version>RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.hswebframework.web</groupId>
             <artifactId>hsweb-spring-boot-starter</artifactId>
@@ -141,5 +164,20 @@
             <artifactId>hsweb-system-dynamic-form-service-api</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-authorization-basic</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-access-logging-aop</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hswebframework.web</groupId>
+            <artifactId>hsweb-system-organizational-starter</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 </project>

+ 2 - 12
hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/src/main/java/org/hswebframework/web/workflow/Application.java

@@ -2,26 +2,16 @@ package org.hswebframework.web.workflow;
 
 import org.hswebframework.web.dao.Dao;
 import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.beans.factory.ObjectProvider;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
-import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
-import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
-import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
-import org.springframework.http.converter.HttpMessageConverter;
-
-import java.util.Collections;
-import java.util.List;
 
 /**
  * @author zhouhao
  */
 @SpringBootApplication
-@ComponentScan("org.hswebframework.web.workflow")
-@MapperScan(value = "org.hswebframework.web.workflow", markerInterface = Dao.class) //扫描mybatis dao
+//@ComponentScan("org.hswebframework.web.workflow")
+//@MapperScan(value = "org.hswebframework.web.workflow", markerInterface = Dao.class) //扫描mybatis dao
 public class Application {
     public static void main(String[] args) {
         SpringApplication.run(Application.class);

+ 30 - 8
hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/src/main/java/org/hswebframework/web/workflow/flowable/controller/FlowableUtilsController.java

@@ -1,17 +1,19 @@
 package org.hswebframework.web.workflow.flowable.controller;
 
 import org.activiti.engine.impl.pvm.process.ActivityImpl;
-import org.activiti.engine.repository.ProcessDefinition;
-import org.hswebframework.web.commons.entity.PagerResult;
+import org.hswebframework.web.commons.entity.DataStatus;
 import org.hswebframework.web.controller.message.ResponseMessage;
+import org.hswebframework.web.entity.organizational.RelationDefineEntity;
+import org.hswebframework.web.entity.organizational.SimpleRelationDefineEntity;
+import org.hswebframework.web.service.organizational.RelationDefineService;
+import org.hswebframework.web.service.organizational.RelationInfoService;
 import org.hswebframework.web.workflow.flowable.service.BpmActivityService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Author wangwei
@@ -23,10 +25,30 @@ public class FlowableUtilsController {
 
     @Autowired
     BpmActivityService bpmActivityService;
+    @Autowired
+    RelationDefineService relationDefineService;
+    @Autowired
+    RelationInfoService relationInfoService;
 
     @GetMapping("{procDefId}/acts")
-    public ResponseMessage<List<ActivityImpl>> acts(@PathVariable String procDefId){
+    public ResponseMessage<Map<String, Object>> acts(@PathVariable String procDefId){
+        Map<String, Object> map = new HashMap<>();
         List<ActivityImpl> activities = bpmActivityService.getActivitiesById(procDefId,null);
-        return ResponseMessage.ok(activities);
+        for (ActivityImpl activity: activities) {
+            if(activity.getProperty("type").equals("userTask")) map.put(activity.getId(), activity.getProperty("name"));
+        }
+        return ResponseMessage.ok(map);
+    }
+
+    @GetMapping("relation-define")
+    public ResponseMessage<List<RelationDefineEntity>> getRelationDefines(){
+        SimpleRelationDefineEntity entity = new SimpleRelationDefineEntity();
+        entity.setStatus(DataStatus.STATUS_ENABLED);
+        List<RelationDefineEntity> list = relationDefineService.select(entity);
+
+        return ResponseMessage.ok(list);
     }
+
+//    @PostMapping("act/{actId}-{defineId}")
+//    public ResponseMessage
 }

+ 15 - 0
hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/src/main/java/org/hswebframework/web/workflow/flowable/entity/SimpleActivityImp.java

@@ -0,0 +1,15 @@
+package org.hswebframework.web.workflow.flowable.entity;
+
+import org.activiti.engine.impl.pvm.process.ActivityImpl;
+import org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl;
+
+/**
+ * @Author wangwei
+ * @Date 2017/9/4.
+ */
+public class SimpleActivityImp extends ActivityImpl {
+
+    public SimpleActivityImp(String id, ProcessDefinitionImpl processDefinition) {
+        super(id, processDefinition);
+    }
+}

+ 22 - 21
hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/src/test/java/org/hswebframework/web/workflow/flowable/ControllerTest.java

@@ -55,15 +55,15 @@ public class ControllerTest extends SimpleWebApplicationTests {
     }
 
     // 流程图元数据test
-    @Test
-    public void activityImplTest() {
-        ActivityImpl activity = bpmTaskService.selectActivityImplByTask("");
-        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testid").latestVersion().active().singleResult();
-        Map<String, List<String>> map = bpmActivityService.getNextClaim(processDefinition.getId(), activity.getId());
-        System.out.println("=========>>>");
-        System.out.println(JSON.toJSONString(map));
-        System.out.println("=========>>>");
-    }
+//    @Test
+//    public void activityImplTest() {
+//        ActivityImpl activity = bpmTaskService.selectActivityImplByTask("");
+//        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testid").latestVersion().active().singleResult();
+//        Map<String, List<String>> map = bpmActivityService.getNextClaim(processDefinition.getId(), activity.getId());
+//        System.out.println("=========>>>");
+//        System.out.println(JSON.toJSONString(map));
+//        System.out.println("=========>>>");
+//    }
 
     // 流程流转test
     @Test
@@ -113,18 +113,18 @@ public class ControllerTest extends SimpleWebApplicationTests {
 
     }
 
-    @Autowired
-    RepositoryService repositoryService;
-
-    @Test
-    public void task() {
-        ActivityImpl activity = bpmTaskService.selectActivityImplByTask("");
-        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testid").orderByProcessDefinitionVersion().desc().singleResult();
-        Map<String, List<String>> map = bpmActivityService.getNextClaim(processDefinition.getId(), activity.getId());
-        System.out.println("=========>>>");
-        System.out.println(JSON.toJSONString(map));
-        System.out.println("=========>>>");
-    }
+//    @Autowired
+//    RepositoryService repositoryService;
+//
+//    @Test
+//    public void task() {
+//        ActivityImpl activity = bpmTaskService.selectActivityImplByTask("");
+//        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testid").orderByProcessDefinitionVersion().desc().singleResult();
+//        Map<String, List<String>> map = bpmActivityService.getNextClaim(processDefinition.getId(), activity.getId());
+//        System.out.println("=========>>>");
+//        System.out.println(JSON.toJSONString(map));
+//        System.out.println("=========>>>");
+//    }
 
     @Configuration
     public static class config {
@@ -137,6 +137,7 @@ public class ControllerTest extends SimpleWebApplicationTests {
                 configuration
                         .setAsyncExecutorActivate(false)
                         .setJobExecutorActivate(false)
+                        .setDatabaseSchemaUpdate("false")
                         .setActivityFontName("宋体")
                         .setLabelFontName("宋体")
                         .setAnnotationFontName("宋体");

+ 0 - 17
hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/src/test/java/org/hswebframework/web/workflow/flowable/TestApplication.java

@@ -1,17 +0,0 @@
-package org.hswebframework.web.workflow.flowable;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-/**
- * TODO 完成注释
- *
- * @author zhouhao
- */
-@SpringBootApplication
-public class TestApplication {
-
-    public static void main(String[] args) {
-        SpringApplication.run(TestApplication.class, args);
-    }
-}