Commit b3f8ecf7 by chenweisong

更新

parent c8b75de4
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId> <artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency> </dependency>
<dependency> <!-- <dependency>-->
<groupId>org.springframework.cloud</groupId> <!-- <groupId>org.springframework.cloud</groupId>-->
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> <!-- <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>-->
</dependency> <!-- </dependency>-->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
......
...@@ -91,6 +91,12 @@ public class IndexCtrl { ...@@ -91,6 +91,12 @@ public class IndexCtrl {
return ImmutableMap.of("code", 200); return ImmutableMap.of("code", 200);
} }
@ApiOperation(value = "查看当前收数进度")
@PostMapping(value = "/task/saveData")
public Map viewTaskProcess(@RequestParam int id) {
return ImmutableMap.of("code", 200);
}
@ApiOperation(value = "获取补录人员列表") @ApiOperation(value = "获取补录人员列表")
@PostMapping(value = "/user/list") @PostMapping(value = "/user/list")
...@@ -114,4 +120,5 @@ public class IndexCtrl { ...@@ -114,4 +120,5 @@ public class IndexCtrl {
return ImmutableMap.of("code", 200); return ImmutableMap.of("code", 200);
} }
} }
...@@ -27,7 +27,7 @@ public class Excel implements Serializable { ...@@ -27,7 +27,7 @@ public class Excel implements Serializable {
@Column(columnDefinition = "VARCHAR(300) COMMENT 'SpreadJs表格配置'") @Column(columnDefinition = "VARCHAR(300) COMMENT 'SpreadJs表格配置'")
private String config; private String config;
@Column(columnDefinition = "VARCHAR(50) COMMENT '备注'") @Column
private String desc; private String desc;
@Column(columnDefinition = "DATETIME COMMENT '创建时间'") @Column(columnDefinition = "DATETIME COMMENT '创建时间'")
......
...@@ -24,7 +24,7 @@ import java.util.Arrays; ...@@ -24,7 +24,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service(value = "ApiTaskService")
public class TaskService { public class TaskService {
@Autowired @Autowired
...@@ -82,7 +82,7 @@ public class TaskService { ...@@ -82,7 +82,7 @@ public class TaskService {
public void start(long id) { public void start(long id) {
// 启动流程
} }
public void pass(long id) { public void pass(long id) {
...@@ -116,9 +116,8 @@ public class TaskService { ...@@ -116,9 +116,8 @@ public class TaskService {
} }
private User getLoginUser() { private User getLoginUser() {
User user = new User(); List<User> userList = userDao.findAllByRole(User.ROLE_MANAGER);
user.setRole(User.ROLE_MANAGER); User user = userList.get(0);
user.setUsername("管理员");
return user; return user;
} }
} }
...@@ -11,8 +11,8 @@ spring: ...@@ -11,8 +11,8 @@ spring:
jpa: jpa:
show-sql: true show-sql: true
database-platform: org.hibernate.dialect.MySQL5Dialect database-platform: org.hibernate.dialect.MySQL5Dialect
hibernate: # hibernate:
ddl-auto: update # ddl-auto: update
datasource: datasource:
url: jdbc:mysql://47.105.193.165:3306/test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8 url: jdbc:mysql://47.105.193.165:3306/test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
username: root username: root
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:tns="http://www.activiti.org/test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.w3.org/1999/XPath" id="m1583416072125" name="" targetNamespace="http://www.activiti.org/test" typeLanguage="http://www.w3.org/2001/XMLSchema">
<process id="demo" isClosed="false" isExecutable="true" name="demo" processType="None">
<startEvent id="Start" name="Start"/>
<userTask activiti:assignee="chenws" activiti:exclusive="true" id="_3" name="请假"/>
<sequenceFlow id="_4" sourceRef="Start" targetRef="_3"/>
<userTask activiti:assignee="主管" activiti:exclusive="true" id="主管" name="主管"/>
<sequenceFlow id="_6" sourceRef="_3" targetRef="主管"/>
<userTask activiti:assignee="总监" activiti:exclusive="true" id="总监" name="总监"/>
<sequenceFlow id="_8" sourceRef="主管" targetRef="总监"/>
<endEvent id="_9" name="EndEvent"/>
<sequenceFlow id="_10" sourceRef="总监" targetRef="_9"/>
</process>
<bpmndi:BPMNDiagram documentation="background=#3C3F41;count=1;horizontalcount=1;orientation=0;width=842.4;height=1195.2;imageableWidth=832.4;imageableHeight=1185.2;imageableX=5.0;imageableY=5.0" id="Diagram-_1" name="New Diagram">
<bpmndi:BPMNPlane bpmnElement="demo">
<bpmndi:BPMNShape bpmnElement="Start" id="Shape-Start">
<omgdc:Bounds height="32.0" width="32.0" x="50.0" y="120.0"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_3" id="Shape-_3">
<omgdc:Bounds height="55.0" width="85.0" x="155.0" y="115.0"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="主管" id="Shape-主管">
<omgdc:Bounds height="55.0" width="85.0" x="325.0" y="120.0"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="总监" id="Shape-总监">
<omgdc:Bounds height="55.0" width="85.0" x="465.0" y="135.0"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_9" id="Shape-_9">
<omgdc:Bounds height="32.0" width="32.0" x="605.0" y="135.0"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="_4" id="BPMNEdge__4" sourceElement="Start" targetElement="_3">
<omgdi:waypoint x="82.0" y="136.0"/>
<omgdi:waypoint x="155.0" y="142.5"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_6" id="BPMNEdge__6" sourceElement="_3" targetElement="主管">
<omgdi:waypoint x="240.0" y="142.5"/>
<omgdi:waypoint x="325.0" y="147.5"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_8" id="BPMNEdge__8" sourceElement="主管" targetElement="总监">
<omgdi:waypoint x="410.0" y="147.5"/>
<omgdi:waypoint x="465.0" y="162.5"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_10" id="BPMNEdge__10" sourceElement="总监" targetElement="_9">
<omgdi:waypoint x="550.0" y="162.5"/>
<omgdi:waypoint x="605.0" y="151.0"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
package com.keymobile;
import javafx.application.Application;
import org.activiti.engine.*;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricProcessInstanceQuery;
import org.activiti.engine.repository.DeploymentBuilder;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.task.Task;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ProcessTest {
@Resource
private RepositoryService repositoryService;
@Resource
private RuntimeService runtimeService;
@Resource
private TaskService taskService;
@Resource
private HistoryService historyService;
@Test
public void createActivitiTask() {
// 加载的我们创建好的demo.bpmn 文件还有png文件
// 获取流的引擎
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
processEngine.getRepositoryService()
.createDeployment()
.addClasspathResource("demo.bpmn")
.addClasspathResource("demo.bpmn.png")
.deploy();
}
@Test
public void start() {
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
processEngine.getTaskService()
.complete("32502");
}
@Test
public void zhuguan() {
try {
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
List<ProcessDefinition> processDefList = processEngine.getRepositoryService().createProcessDefinitionQuery()
.orderByProcessDefinitionVersion().asc()//按照版本的升序排列
.list();
for (ProcessDefinition processDefinition : processDefList) {
System.out.println(processDefinition.getName());
// repositoryService.deleteDeployment(processDefinition.getDeploymentId());
// repositoryService.suspendProcessDefinitionByKey(processDefinition.getKey());
// HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery();
// historicProcessInstanceQuery.processDefinitionId(processDefinition.getId());
// List<HistoricProcessInstance> list = historicProcessInstanceQuery.list();
//
// list.forEach(pi -> {
// runtimeService.suspendProcessInstanceById(pi.getId()); // 挂起流程
// runtimeService.deleteProcessInstance(pi.getId(), "删除原因");//删除流程
// });
}
List<Task> tasks = processEngine.getTaskService().createTaskQuery().list();
for (Task task : tasks) {
System.out.println(task.getName() + "***" + task.getAssignee());
}
// DeploymentBuilder deployBuilder = repositoryService.createDeployment().;
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
package com.keymobile.activiti;
import javafx.application.Application;
import org.activiti.engine.HistoryService;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.task.Task;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ProcessTest {
@Resource
private RepositoryService repositoryService;
@Resource
private RuntimeService runtimeService;
@Resource
private TaskService taskService;
@Resource
private HistoryService historyService;
@Test
public void testDeploy() {
String filePath = "/TestProcess.bpmn";
try {
InputStream is = Class.class.getClass().getResource(filePath).openStream();
/*//读取bpmn文件,并发布
Deployment deployment=repositoryService.createDeployment().addInputStream("bpmn20.xml",is).deploy();
ProcessDefinition processDefinition = repositoryService.createProcessDefin.itionQuery().deploymentId(deployment.getId()).singleResult();
Long businessKey=new Double(1000000*Math.random()).longValue();
//启动流程
runtimeService.startProcessInstanceById(processDefinition.getId(),businessKey.toString());
//查询任务实例
List<Task> taskList=taskService.createTaskQuery().processDefinitionId(processDefinition.getId()).list();
for(Task task:taskList){
System.out.println("task name is " + task.getName() + " ,task key is " + task.getTaskDefinitionKey());
}*/
// 部署流程定义
repositoryService.createDeployment().addInputStream("bpmn20.xml", is).deploy();
// 启动流程实例
String procId = runtimeService.startProcessInstanceByKey("testProcess").getId();
/******************第一个任务开始******************************/
List<Task> taskList = taskService.createTaskQuery().taskCandidateGroup("zhangkb").list();
for (Task task : taskList) {
System.out.println("Following task is available for sales group: " + task.getName());
// 认领任务这里由foozie认领,因为fozzie是sales组的成员
taskService.claim(task.getId(), "zhangkb");
}
//查看fozzie是否能够获取该任务
taskList = taskService.createTaskQuery().taskAssignee("zhangkb").list();
System.out.println("zhangkb当前的任务数:" + taskList.size());
for (Task task : taskList) {
System.out.println("the task name is :" + task.getName());
// 执行(完成)任务
taskService.complete(task.getId());
}
System.out.println("gonzo当前的任务数:" + taskService.createTaskQuery().taskAssignee("gonzo").count());
/******************第一个任务结束******************************/
/******************第二个任务开始******************************/
taskList = taskService.createTaskQuery().taskCandidateGroup("management").list();
for (Task task : taskList) {
System.out.println("Following task is available for management group: " + task.getName());
taskService.claim(task.getId(), "kermit");
}
//查看kermit是否能够获取改任务
taskList = taskService.createTaskQuery().taskAssignee("kermit").list();
System.out.println("kermit当前任务数:" + taskList.size());
for (Task task : taskList) {
System.out.println("the task name is :" + task.getName());
taskService.complete(task.getId());
}
System.out.println("kermit当前任务数:" + taskService.createTaskQuery().taskAssignee("kermit").count());
/******************第二个任务结束******************************/
/******************第三个任务开始******************************/
//获取第三个任务
taskList = taskService.createTaskQuery().taskCandidateGroup("management").list();
for (Task task : taskList) {
System.out.println("Following task is available for management group: " + task.getName());
taskService.claim(task.getId(), "gonzo");
}
//查看gonzo是否能够获取改任务
taskList = taskService.createTaskQuery().taskAssignee("gonzo").list();
System.out.println("gonzo当前任务数:" + taskList.size());
for (Task task : taskList) {
System.out.println("the task name is :" + task.getName());
taskService.complete(task.getId());
}
System.out.println("gonzo当前任务数:" + taskService.createTaskQuery().taskAssignee("gonzo").count());
/******************第三个任务结束******************************/
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(procId).singleResult();
System.out.println("流程结束时间:" + historicProcessInstance.getEndTime());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment