Commit efa5a86f by chenweisong

更新

parent c4465ead
...@@ -23,7 +23,6 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -23,7 +23,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.sql.Timestamp;
import java.util.*; import java.util.*;
@Api(tags = "活动 控制器", description = "Task Info") @Api(tags = "活动 控制器", description = "Task Info")
...@@ -47,7 +46,11 @@ public class TaskController { ...@@ -47,7 +46,11 @@ public class TaskController {
@Autowired @Autowired
private UserService userService; private UserService userService;
@Autowired @Autowired
private FeignAuthService feignAuthService;
@Autowired
private ProcessService processService; private ProcessService processService;
@Autowired
private UserTemplateMapperService userTemplateMapperService;
@Autowired @Autowired
private ManagementService managementService; private ManagementService managementService;
...@@ -58,7 +61,6 @@ public class TaskController { ...@@ -58,7 +61,6 @@ public class TaskController {
@Autowired @Autowired
private TaskService taskService; private TaskService taskService;
@ApiOperation(value = "获取首页活动列表") @ApiOperation(value = "获取首页活动列表")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页", paramType = "query", required = true, dataType = "int", defaultValue = "1"), @ApiImplicitParam(name = "pageNo", value = "当前页", paramType = "query", required = true, dataType = "int", defaultValue = "1"),
...@@ -91,64 +93,60 @@ public class TaskController { ...@@ -91,64 +93,60 @@ public class TaskController {
@ApiOperation(value = "我的任务", notes = "补录任务列表及审核任务列表") @ApiOperation(value = "我的任务", notes = "补录任务列表及审核任务列表")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", paramType = "query", required = false, dataType = "long") @ApiImplicitParam(name = "userId", value = "用户id", paramType = "query", required = true, dataType = "long", defaultValue = "3")
}) })
@PostMapping(value = "/getMyTasks") @PostMapping(value = "/getMyTasks")
public ApiResponse getMyMissions(Long userId) { public ApiResponse getMyMissions(long userId) {
// User user = userService.findById(userId); Map user = feignAuthService.getUserById(userId);
// TwinkleValidator.notNull(user, "用户不存在"); CommonValidator.notNull(user, "用户不存在");
List<UserTemplateMapper> mappers = userTemplateMapperService.findAllByUserIdAndActivityStatus(userId, Activity.STATUS_BEGIN);
String username = user.get("name").toString();
mappers.forEach(mapper -> {
Template template = mapper.getTemplate();
// 查找当前模板的任务
List<Task> tasks = taskService.createTaskQuery().taskCandidateUser("id:" + template.getId())
.list();
System.out.println("taskLength:" + tasks.size());
});
List<Map> missions = new ArrayList<>(); List<Map> missions = new ArrayList<>();
List<User> userList = userService.findAll();
userList.forEach(user -> {
String username;
if (user.getUsername().equals("发起人") || user.getUsername().equals("审核人")) {
username = user.getUsername();
} else {
// 查找当前用户所有的activiti task
username = "%" + user.getUsername() + ":template:%";
}
List<Task> tasks = taskService.createTaskQuery().taskAssigneeLike(username)
.list();
tasks.forEach(task -> {
String assignee = task.getAssignee();
Map map = new HashMap();
if (user.getUsername().equals("发起人") || user.getUsername().equals("审核人")) {
} else {
long templateId = Long.parseLong(assignee.split(":template:")[1]);
String processId = task.getProcessInstanceId();
Process process = processService.findByProcessId(processId);
Mission mission = missionService.findByProcessIdAndUsernameAndTemplateIdAndStatusAndType(process.getId(), user.getUsername(), templateId, Mission.STATUS_BEGIN);
mission.setTaskId(task.getId());
missionService.save(mission);
map.put("id", mission.getId());
map.put("userId", mission.getUser().getId());
map.put("username", mission.getUser().getUsername());
Template template = mission.getTemplate();
Map _template = new HashMap();
_template.put("id", mission.getId());
_template.put("config", template.getConfig());
_template.put("name", template.getName());
_template.put("createAt", template.getCreateAt());
map.put("excelList", Arrays.asList(_template));
}
if (task.getTaskDefinitionKey().toLowerCase().equals("dataenter")) {
map.put("kind", 1);
map.put("mission", "填写补录数据");
} else if (task.getTaskDefinitionKey().toLowerCase().equals("dataaudit")) {
map.put("kind", 2);
map.put("mission", "审核补录数据");
} else if (task.getTaskDefinitionKey().toLowerCase().equals("useraudit")) {
map.put("kind", 3);
map.put("mission", "审核人审核");
} else if (task.getTaskDefinitionKey().toLowerCase().equals("databackflow")) {
map.put("kind", 4);
map.put("mission", "数据回流");
}
missions.add(map);
});
List<Task> tasks = taskService.createTaskQuery().taskAssigneeLike(username)
.list();
tasks.forEach(task -> {
String assignee = task.getAssignee();
Map map = new HashMap();
long templateId = Long.parseLong(assignee.split(":template:")[1]);
String processId = task.getProcessInstanceId();
Process process = processService.findByProcessId(processId);
Mission mission = missionService.findByProcessIdAndUsernameAndTemplateIdAndStatusAndType(process.getId(), username, templateId, Mission.STATUS_BEGIN);
mission.setTaskId(task.getId());
missionService.save(mission);
map.put("id", mission.getId());
Template template = mission.getTemplate();
Map _template = new HashMap();
_template.put("id", mission.getId());
_template.put("config", template.getConfig());
_template.put("name", template.getName());
_template.put("createAt", template.getCreateAt());
map.put("excelList", Arrays.asList(_template));
if (task.getTaskDefinitionKey().toLowerCase().equals("dataenter")) {
map.put("kind", 1);
map.put("mission", "填写补录数据");
} else if (task.getTaskDefinitionKey().toLowerCase().equals("dataaudit")) {
map.put("kind", 2);
map.put("mission", "审核补录数据");
} else if (task.getTaskDefinitionKey().toLowerCase().equals("useraudit")) {
map.put("kind", 3);
map.put("mission", "审核人审核");
} else if (task.getTaskDefinitionKey().toLowerCase().equals("databackflow")) {
map.put("kind", 4);
map.put("mission", "数据回流");
}
missions.add(map);
}); });
return ApiResponse.ok(missions); return ApiResponse.ok(missions);
} }
...@@ -161,17 +159,15 @@ public class TaskController { ...@@ -161,17 +159,15 @@ public class TaskController {
CommonValidator.notNull(form.getType(), "类型不能为空"); CommonValidator.notNull(form.getType(), "类型不能为空");
CommonValidator.isTrue(form.getExcels() != null && form.getExcels().size() != 0, "补录模板不能为空"); CommonValidator.isTrue(form.getExcels() != null && form.getExcels().size() != 0, "补录模板不能为空");
/** // manager
* manager
*/
User admin = userService.getManager(); User admin = userService.getManager();
form.setUser(admin); form.setUser(admin);
// 新建活动 // 新建活动
Activity activity = new Activity(); Activity activity = new Activity();
activity = BeanUtils.convertTo(form, activity); activity = BeanUtils.convertTo(form, activity);
activity.setCreateAt(DateUtil.getTimestamp()); activity.setCreateAt(DateUtil.getTimestamp());
activity.setStatus(Activity.STATUS_WAIT);
final Activity finalActivity = activityService.save(activity); final Activity finalActivity = activityService.save(activity);
// 新建excel实例 // 新建excel实例
...@@ -184,11 +180,11 @@ public class TaskController { ...@@ -184,11 +180,11 @@ public class TaskController {
CommonValidator.isTrue(excelForm.getNeedAudit() != null && excelForm.getNeedAudit() != 0, "模板needAudit不能为空"); CommonValidator.isTrue(excelForm.getNeedAudit() != null && excelForm.getNeedAudit() != 0, "模板needAudit不能为空");
CommonValidator.isTrue(excelForm.getNeedConfirm() != null && excelForm.getNeedConfirm() != 0, "模板needConfirm不能为空"); CommonValidator.isTrue(excelForm.getNeedConfirm() != null && excelForm.getNeedConfirm() != 0, "模板needConfirm不能为空");
CommonValidator.isFalse((StringUtils.isEmpty(excelForm.getUpStreamAddr()) && StringUtils.isNotEmpty(excelForm.getBackStreamAddr()) CommonValidator.isFalse((StringUtils.isEmpty(excelForm.getUpStreamAddr()) && StringUtils.isNotEmpty(excelForm.getBackStreamAddr())
|| (StringUtils.isNotEmpty(excelForm.getUpStreamAddr()) && StringUtils.isEmpty(excelForm.getBackStreamAddr()))), "上游地址和回流地址需同时填写或者同时为空"); || (StringUtils.isNotEmpty(excelForm.getUpStreamAddr()) && StringUtils.isEmpty(excelForm.getBackStreamAddr()))), "上游地址和回流地址需同时填写或者同时为空");
excelForm.setActivity(finalActivity); excelForm.setActivity(finalActivity);
Template template = new Template(); Template template = new Template();
template = BeanUtils.convertTo(excelForm, template); template = BeanUtils.convertTo(excelForm, template);
template.setCreateAt(DateUtil.getTimestamp()); template.setCreateAt(DateUtil.getTimestamp());
...@@ -196,13 +192,16 @@ public class TaskController { ...@@ -196,13 +192,16 @@ public class TaskController {
// 查找当前补录所有的用户 // 查找当前补录所有的用户
List<Long> userIdList = excelForm.getUserIdList(); List<Long> userIdList = excelForm.getUserIdList();
userIdList.forEach(userId -> { userIdList.forEach(userId -> {
// 创建了一些空白任务 UserTemplateMapper mapper = new UserTemplateMapper();
missionService.save(user, finalTemplate); mapper.setCreateAt(DateUtil.getTimestamp());
mapper.setActivity(finalActivity);
mapper.setTemplate(finalTemplate);
mapper.setUserId(userId);
userTemplateMapperService.save(mapper);
}); });
}); });
return ApiResponse.ok(activity.getId()); return ApiResponse.ok(finalActivity.getId());
} }
@ApiOperation(value = "修改活动") @ApiOperation(value = "修改活动")
...@@ -235,56 +234,28 @@ public class TaskController { ...@@ -235,56 +234,28 @@ public class TaskController {
deploymentId(deploy.getId()). deploymentId(deploy.getId()).
singleResult(); singleResult();
// 指定发起人
String inputUser = activity.getUser().getUsername();
Map<String, Object> variables = new HashMap<>(); Map<String, Object> variables = new HashMap<>();
variables.put("inputUser", inputUser);
// 所有分组(所有模板 1:1)
List<String> groups = new ArrayList<>();
templateList.forEach(template -> {
groups.add("id:" + template.getId());
});
variables.put("groups", groups);
//启动流程 //启动流程
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processDefinition.getKey(), variables); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processDefinition.getKey(), variables);
// 新建进程
Process process = new Process(); Process process = new Process();
process.setProcessId(processInstance.getId()); process.setProcessId(processInstance.getId());
process.setActivity(activity); process.setActivity(activity);
// 新建当前任务进程,但是先不绑定missions // 新建当前任务进程,但是先不绑定missions
process.setMissionList(null);
process.setStatus(Process.STATUS_BEGIN); process.setStatus(Process.STATUS_BEGIN);
processService.save(process); processService.save(process);
activity.setStatus(Activity.STATUS_BEGIN);
// 发起人把流程发送到下一个人 activityService.save(activity);
Task resultTask = taskService.createTaskQuery().processInstanceId(processInstance.getId()).
taskInvolvedUser(inputUser).singleResult();
//直接提交标准到下个节点
taskService.claim(resultTask.getId(), inputUser);
//保存审批意见
taskService.addComment(resultTask.getId(), processInstance.getId(), "发起人启动分发任务");
List<String> userNameList = new ArrayList<>();
List<Mission> allMissions = new ArrayList<>();
// 所有模板绑定的人查找任务, 现在基本都是补录任务
templateList.forEach(template -> {
List<Mission> missionList = missionService.findAllByTemplateIdAndStatus(template.getId(), Mission.STATUS_BEGIN);
// 当前所有任务的参与人员
missionList.forEach(mission -> {
mission.setProcess(process);
// 更新mission
missionService.save(mission);
User user = mission.getUser();
userNameList.add(user.getUsername() + ":template:" + template.getId());
});
allMissions.addAll(missionList);
});
process.setMissionList(allMissions);
processService.save(process);
Map<String, Object> vars = new HashMap<>();
// 分发录入任务
vars.put("candidateUsers", userNameList);
// 提交任务,并把补录人任务划分好
taskService.complete(resultTask.getId(), vars);
return ApiResponse.ok(); return ApiResponse.ok();
} }
...@@ -297,14 +268,14 @@ public class TaskController { ...@@ -297,14 +268,14 @@ public class TaskController {
public ApiResponse passTask(long taskId) { public ApiResponse passTask(long taskId) {
Activity activity = activityService.get(taskId); Activity activity = activityService.get(taskId);
// 完结活动, 流程跑完 // 完结活动, 流程跑完
User judge = userService.getAudit(); // User judge = userService.getAudit();
List<Task> taskList = taskService.createTaskQuery().processInstanceId(assignment.getProcessId()) // List<Task> taskList = taskService.createTaskQuery().processInstanceId(assignment.getProcessId())
.taskAssignee(judge.getUsername()).list(); // .taskAssignee(judge.getUsername()).list();
TwinkleValidator.notLessThan(taskList.size(), 1, "启动失败"); // TwinkleValidator.notLessThan(taskList.size(), 1, "启动失败");
Task task = taskList.get(0); // Task task = taskList.get(0);
taskService.complete(task.getId(), ImmutableMap.of("pass", "true")); // taskService.complete(task.getId(), ImmutableMap.of("pass", "true"));
assignment.setStatus(Assignment.STATUS_COMPLETED); // assignment.setStatus(Assignment.STATUS_COMPLETED);
activityService.update(activity); // activityService.update(activity);
return ApiResponse.ok(); return ApiResponse.ok();
} }
...@@ -314,12 +285,12 @@ public class TaskController { ...@@ -314,12 +285,12 @@ public class TaskController {
public ApiResponse rejectTask(@RequestParam Long taskId) { public ApiResponse rejectTask(@RequestParam Long taskId) {
Activity activity = activityService.get(taskId); Activity activity = activityService.get(taskId);
// 完结活动, 流程跑完 // 完结活动, 流程跑完
User judge = userService.getAudit(); // User judge = userService.getAudit();
List<Task> taskList = taskService.createTaskQuery().processInstanceId(assignment.getProcessId()) // List<Task> taskList = taskService.createTaskQuery().processInstanceId(assignment.getProcessId())
.taskAssignee(judge.getUsername()).list(); // .taskAssignee(judge.getUsername()).list();
TwinkleValidator.notLessThan(taskList.size(), 1, "启动失败"); // TwinkleValidator.notLessThan(taskList.size(), 1, "启动失败");
Task task = taskList.get(0); // Task task = taskList.get(0);
taskService.complete(task.getId(), ImmutableMap.of("pass", "false")); // taskService.complete(task.getId(), ImmutableMap.of("pass", "false"));
return ApiResponse.ok(); return ApiResponse.ok();
} }
......
...@@ -12,5 +12,5 @@ public interface MissionDao extends JpaRepository<Mission, Long> { ...@@ -12,5 +12,5 @@ public interface MissionDao extends JpaRepository<Mission, Long> {
long countAllByActivityIdAndStatus(long activityId, int status); long countAllByActivityIdAndStatus(long activityId, int status);
Mission findByProcessIdAndUserUsernameAndTemplateIdAndStatusAndType(long processId, String username, long templateId, int status, int type); Mission findByProcessIdAndTemplateIdAndStatusAndType(long processId, long templateId, int status, int type);
} }
...@@ -3,7 +3,11 @@ package com.keymobile.rest.dao; ...@@ -3,7 +3,11 @@ package com.keymobile.rest.dao;
import com.keymobile.rest.model.UserTemplateMapper; import com.keymobile.rest.model.UserTemplateMapper;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface UserTemplateMapperDao extends JpaRepository<UserTemplateMapper, Long> { public interface UserTemplateMapperDao extends JpaRepository<UserTemplateMapper, Long> {
List<UserTemplateMapper> findAllByTemplateId(long templateId);
List<UserTemplateMapper> findAllByUserIdAndActivityStatus(long userId, int status);
} }
...@@ -21,6 +21,8 @@ public class Activity implements Serializable { ...@@ -21,6 +21,8 @@ public class Activity implements Serializable {
public static int TYPE_AUTO = 2; public static int TYPE_AUTO = 2;
public static int TYPE_MANUAL = 1; public static int TYPE_MANUAL = 1;
public static int STATUS_WAIT = 1;
public static int STATUS_BEGIN = 2;
/** /**
* 报送频度 按年 按周 按月 按日 自动推送 * 报送频度 按年 按周 按月 按日 自动推送
*/ */
...@@ -48,6 +50,8 @@ public class Activity implements Serializable { ...@@ -48,6 +50,8 @@ public class Activity implements Serializable {
@Column(nullable = false, name = "create_at") @Column(nullable = false, name = "create_at")
private Timestamp createAt; private Timestamp createAt;
@Column(columnDefinition = ("integer(2) comment '状态'"))
private Integer status;
/** /**
* 发送人 * 发送人
......
...@@ -8,7 +8,7 @@ import java.io.Serializable; ...@@ -8,7 +8,7 @@ import java.io.Serializable;
import java.sql.Timestamp; import java.sql.Timestamp;
/** /**
* spreadJs 配置的报表 * spreadJs 配置的报表 activiti 组概念
*/ */
@Data @Data
@Entity @Entity
......
package com.keymobile.rest.model; package com.keymobile.rest.model;
import lombok.Data; import lombok.Data;
import javax.persistence.*; import javax.persistence.*;
...@@ -23,9 +22,12 @@ public class UserTemplateMapper implements Serializable { ...@@ -23,9 +22,12 @@ public class UserTemplateMapper implements Serializable {
@Column(nullable = false, columnDefinition = ("bigint(22) comment '用户id'")) @Column(nullable = false, columnDefinition = ("bigint(22) comment '用户id'"))
private long userId; private long userId;
@Column(nullable = false, columnDefinition = ("bigint(22) comment '模板id'"))
private long templateId;
@Column(nullable = false, name = "create_at") @Column(nullable = false, name = "create_at")
private Timestamp createAt; private Timestamp createAt;
@ManyToOne
private Template template;
@ManyToOne
private Activity activity;
} }
...@@ -30,6 +30,8 @@ public interface FeignAuthService { ...@@ -30,6 +30,8 @@ public interface FeignAuthService {
@GetMapping("/users/find") @GetMapping("/users/find")
List<Map> getUsersByOrgId(@RequestParam("orgId") long orgId); List<Map> getUsersByOrgId(@RequestParam("orgId") long orgId);
@GetMapping("/userById")
Map getUserById(@RequestParam("id") long id);
/** /**
* 获取所有用户组 * 获取所有用户组
......
...@@ -17,15 +17,14 @@ public class MissionService { ...@@ -17,15 +17,14 @@ public class MissionService {
@Autowired @Autowired
private MissionDao missionDao; private MissionDao missionDao;
public Mission save(User user, Template template) { public Mission save(long userId, Template template) {
Mission info = new Mission(); Mission info = new Mission();
info.setTemplate(template); info.setTemplate(template);
// 初始的开始状态 // 初始的开始状态
info.setStatus(Mission.STATUS_BEGIN); info.setStatus(Mission.STATUS_BEGIN);
info.setUser(user); info.setUserId(userId);
info.setType(Mission.TYPE_RECORD); info.setType(Mission.TYPE_RECORD);
Timestamp now = Timestamp.valueOf(DateUtil.getDateTime()); info.setCreateAt(DateUtil.getTimestamp());
info.setCreateAt(now);
info = missionDao.save(info); info = missionDao.save(info);
return info; return info;
} }
...@@ -40,7 +39,7 @@ public class MissionService { ...@@ -40,7 +39,7 @@ public class MissionService {
} }
public Mission findByProcessIdAndUsernameAndTemplateIdAndStatusAndType(long processId, String username, long templateId, int status) { public Mission findByProcessIdAndUsernameAndTemplateIdAndStatusAndType(long processId, String username, long templateId, int status) {
return missionDao.findByProcessIdAndUserUsernameAndTemplateIdAndStatusAndType(processId, username, templateId, 1, status); return missionDao.findByProcessIdAndTemplateIdAndStatusAndType(processId, templateId, 1, status);
} }
public List<Mission> findAllByTemplateIdAndStatus(long templateId, int status) { public List<Mission> findAllByTemplateIdAndStatus(long templateId, int status) {
......
...@@ -13,13 +13,12 @@ public class UserTemplateMapperService { ...@@ -13,13 +13,12 @@ public class UserTemplateMapperService {
@Autowired @Autowired
private UserTemplateMapperDao userTemplateMapperDao; private UserTemplateMapperDao userTemplateMapperDao;
public List<UserTemplateMapper> findAllByTemplateId(long templateId) {
public UserTemplateMapper findById(long id) { return userTemplateMapperDao.findAllByTemplateId(templateId);
return userTemplateMapperDao.getOne(id);
} }
public List<UserTemplateMapper> findAll() { public List<UserTemplateMapper> findAllByUserIdAndActivityStatus(long userId, int status) {
return userTemplateMapperDao.findAll(); return userTemplateMapperDao.findAllByUserIdAndActivityStatus(userId, status);
} }
public void save(UserTemplateMapper userTemplateMapper) { public void save(UserTemplateMapper userTemplateMapper) {
......
<?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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" 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="m1585635262708" name="" targetNamespace="http://www.activiti.org/testm1585635262708" typeLanguage="http://www.w3.org/2001/XMLSchema">
<process id="MoreSubProcessStanard" isClosed="false" isExecutable="true" processType="None">
<startEvent id="StartEvent" name="StartEvent"/>
<subProcess activiti:exclusive="true" id="SubProcess" triggeredByEvent="false">
<multiInstanceLoopCharacteristics activiti:collection="groups" activiti:elementVariable="group" isSequential="false">
<completionCondition>
<![CDATA[${nrOfCompletedInstances/nrOfInstances == 1}]]>
</completionCondition>
</multiInstanceLoopCharacteristics>
<startEvent id="_7" name="StartEvent"/>
<userTask activiti:candidateGroups="${group}" activiti:exclusive="true" id="DataEnter" name="开始填写">
<documentation id="_8_D_1"/>
</userTask>
<sequenceFlow id="_9" sourceRef="_7" targetRef="DataEnter"/>
<exclusiveGateway gatewayDirection="Unspecified" id="_10"/>
<sequenceFlow id="_11" sourceRef="DataEnter" targetRef="_10"/>
<userTask activiti:assignee="${auditUser}" activiti:async="false" activiti:exclusive="false" id="DataAudit" name="审核数据"/>
<sequenceFlow id="_13" sourceRef="_10" targetRef="DataAudit">
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${NeedDataAudit == true}]]>
</conditionExpression>
</sequenceFlow>
<exclusiveGateway gatewayDirection="Unspecified" id="_15"/>
<sequenceFlow id="_16" sourceRef="_15" targetRef="DataEnter">
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${DataAudit == false}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow id="_17" sourceRef="DataAudit" targetRef="_15"/>
<endEvent id="_18" name="EndEvent"/>
<sequenceFlow id="_19" sourceRef="_15" targetRef="_18">
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${DataAudit == true}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow id="_20" sourceRef="_10" targetRef="_18">
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${NeedDataAudit == false}]]>
</conditionExpression>
</sequenceFlow>
</subProcess>
<sequenceFlow id="_21" sourceRef="StartEvent" targetRef="SubProcess"/>
<exclusiveGateway gatewayDirection="Unspecified" id="_22"/>
<exclusiveGateway gatewayDirection="Unspecified" id="_23" name="ExclusiveGateway"/>
<exclusiveGateway gatewayDirection="Unspecified" id="_24" name="ExclusiveGateway"/>
<userTask activiti:assignee="${backFlowUser}" activiti:exclusive="true" id="_26" name="数据回流"/>
<endEvent id="_27" name="EndEvent"/>
<sequenceFlow id="_28" sourceRef="SubProcess" targetRef="_22"/>
<sequenceFlow id="_31" sourceRef="_24" targetRef="_23">
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${Confirm == true }]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow id="_32" sourceRef="_22" targetRef="_23">
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${NeedConfirm == false }]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow id="_33" sourceRef="_23" targetRef="_26">
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${NeedDataBack == true }]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow id="_34" sourceRef="_26" targetRef="_27"/>
<sequenceFlow id="_35" sourceRef="_23" targetRef="_27">
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${NeedDataBack == false }]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow id="_36" sourceRef="_24" targetRef="_27">
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${Confirm == false }]]>
</conditionExpression>
</sequenceFlow>
<userTask activiti:assignee="${manager}" activiti:exclusive="true" id="ManagerConfirm" name="负责人审核"/>
<sequenceFlow id="_39" sourceRef="_22" targetRef="ManagerConfirm">
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${NeedConfirm == true }]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow id="_40" sourceRef="ManagerConfirm" targetRef="_24"/>
</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="MoreSubProcessStanard">
<bpmndi:BPMNShape bpmnElement="StartEvent" id="Shape-StartEvent">
<dc:Bounds height="32.0" width="32.0" x="40.0" y="25.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="SubProcess" id="Shape-SubProcess" isExpanded="true">
<dc:Bounds height="205.0" width="310.0" x="260.0" y="25.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="205.0" width="310.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_22" id="Shape-_22" isMarkerVisible="false">
<dc:Bounds height="32.0" width="32.0" x="655.0" y="55.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_23" id="Shape-_23" isMarkerVisible="false">
<dc:Bounds height="32.0" width="32.0" x="770.0" y="160.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_24" id="Shape-_24" isMarkerVisible="false">
<dc:Bounds height="32.0" width="32.0" x="635.0" y="230.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_26" id="Shape-_26">
<dc:Bounds height="55.0" width="85.0" x="865.0" y="45.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_27" id="Shape-_27">
<dc:Bounds height="32.0" width="32.0" x="730.0" y="330.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="ManagerConfirm" id="Shape-ManagerConfirm">
<dc:Bounds height="55.0" width="85.0" x="595.0" y="140.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_7" id="Shape-_7">
<dc:Bounds height="32.0" width="32.0" x="285.0" y="35.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="DataEnter" id="Shape-DataEnter">
<dc:Bounds height="55.0" width="85.0" x="330.0" y="40.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_10" id="Shape-_10" isMarkerVisible="false">
<dc:Bounds height="32.0" width="32.0" x="445.0" y="50.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="DataAudit" id="Shape-DataAudit">
<dc:Bounds height="55.0" width="85.0" x="405.0" y="130.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_15" id="Shape-_15" isMarkerVisible="false">
<dc:Bounds height="32.0" width="32.0" x="345.0" y="140.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_18" id="Shape-_18">
<dc:Bounds height="32.0" width="32.0" x="505.0" y="160.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="_13" id="BPMNEdge__13" sourceElement="_10" targetElement="_12">
<di:waypoint x="461.0" y="97.0"/>
<di:waypoint x="461.0" y="130.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_35" id="BPMNEdge__35" sourceElement="_23" targetElement="_27">
<di:waypoint x="817.0" y="176.0"/>
<di:waypoint x="820.0" y="255.0"/>
<di:waypoint x="762.0" y="346.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_34" id="BPMNEdge__34" sourceElement="_26" targetElement="_27">
<di:waypoint x="913.0" y="115.0"/>
<di:waypoint x="913.0" y="170.0"/>
<di:waypoint x="762.0" y="346.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_36" id="BPMNEdge__36" sourceElement="_24" targetElement="_27">
<di:waypoint x="682.0" y="246.0"/>
<di:waypoint x="715.0" y="295.0"/>
<di:waypoint x="730.0" y="346.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_17" id="BPMNEdge__17" sourceElement="_12" targetElement="_15">
<di:waypoint x="391.0" y="157.5"/>
<di:waypoint x="377.0" y="156.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_39" id="BPMNEdge__39" sourceElement="_22" targetElement="_38">
<di:waypoint x="667.5" y="98.5"/>
<di:waypoint x="667.5" y="140.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_16" id="BPMNEdge__16" sourceElement="_15" targetElement="_8">
<di:waypoint x="361.0" y="125.0"/>
<di:waypoint x="361.0" y="95.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_19" id="BPMNEdge__19" sourceElement="_15" targetElement="_18">
<di:waypoint x="361.0" y="187.0"/>
<di:waypoint x="445.0" y="205.0"/>
<di:waypoint x="521.0" y="192.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_40" id="BPMNEdge__40" sourceElement="_38" targetElement="_24">
<di:waypoint x="651.0" y="210.0"/>
<di:waypoint x="651.0" y="230.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_20" id="BPMNEdge__20" sourceElement="_10" targetElement="_18">
<di:waypoint x="492.0" y="66.0"/>
<di:waypoint x="520.0" y="125.0"/>
<di:waypoint x="520.0" y="160.0312805773287"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_21" id="BPMNEdge__21" sourceElement="_2" targetElement="_5">
<di:waypoint x="87.0" y="41.0"/>
<di:waypoint x="260.0" y="127.5"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_28" id="BPMNEdge__28" sourceElement="_5" targetElement="_22">
<di:waypoint x="585.0" y="127.5"/>
<di:waypoint x="655.0" y="71.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_9" id="BPMNEdge__9" sourceElement="_7" targetElement="_8">
<di:waypoint x="332.0" y="51.0"/>
<di:waypoint x="330.0" y="67.5"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_31" id="BPMNEdge__31" sourceElement="_24" targetElement="_23">
<di:waypoint x="682.0" y="246.0"/>
<di:waypoint x="770.0" y="176.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_11" id="BPMNEdge__11" sourceElement="_8" targetElement="_10">
<di:waypoint x="430.0" y="67.5"/>
<di:waypoint x="445.0" y="66.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_33" id="BPMNEdge__33" sourceElement="_23" targetElement="_26">
<di:waypoint x="817.0" y="176.0"/>
<di:waypoint x="865.0" y="72.5"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_32" id="BPMNEdge__32" sourceElement="_22" targetElement="_23">
<di:waypoint x="702.0" y="71.0"/>
<di:waypoint x="770.0" y="176.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
...@@ -26,8 +26,8 @@ spring: ...@@ -26,8 +26,8 @@ spring:
jpa: jpa:
show-sql: false show-sql: false
database-platform: org.hibernate.dialect.MySQL5Dialect database-platform: org.hibernate.dialect.MySQL5Dialect
# hibernate: hibernate:
# ddl-auto: update ddl-auto: update
#47.105.193.165:3306/dev0 192.168.0.192:3306/cmb_dev test test #47.105.193.165:3306/dev0 192.168.0.192:3306/cmb_dev test test
datasource: datasource:
url: jdbc:mysql://47.105.193.165:3306/dev0?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8 url: jdbc:mysql://47.105.193.165:3306/dev0?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
...@@ -52,7 +52,7 @@ server: ...@@ -52,7 +52,7 @@ server:
port: 8110 port: 8110
app: app:
active-process: MoreSubProcess.bpmn active-process: MoreSubProcessStandard.bpmn
swagger2: swagger2:
host: localhost:8110 host: localhost:8110
......
...@@ -10,6 +10,7 @@ import org.activiti.engine.repository.Deployment; ...@@ -10,6 +10,7 @@ import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition; import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task; import org.activiti.engine.task.Task;
import org.apache.commons.lang.StringUtils;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -37,8 +38,8 @@ public class ProcessTest { ...@@ -37,8 +38,8 @@ public class ProcessTest {
@Resource @Resource
private HistoryService historyService; private HistoryService historyService;
// 默认启动的固化流程 // 默认启动的固化流程
@Value("${app.active-process}") // @Value("${app.active-process}")
private String process; private String process = "MoreSubProcessStandard.bpmn";
// @Test // @Test
public void createActivitiTask() { public void createActivitiTask() {
...@@ -65,27 +66,35 @@ public class ProcessTest { ...@@ -65,27 +66,35 @@ public class ProcessTest {
// 指定发起人 // 指定发起人
Map<String, Object> variables = new HashMap<>(); Map<String, Object> variables = new HashMap<>();
variables.put("inputUser", "发起人chenws"); variables.put("manager", "你妈的发起人啊圣诞节阿思");
variables.put("groups", Arrays.asList("组1", "组2", "组3"));
//启动流程 //启动流程
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processDefinition.getKey(), variables); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processDefinition.getKey(), variables);
List<Task> tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
tasks.forEach(task -> {
if(StringUtils.isEmpty(task.getAssignee())) {
// taskService.claim(task.getId(), "肥仔宋");
}
System.out.println(task.getAssignee());
});
// 发起人把流程发送到下一个人 // Task resultTask = taskService.createTaskQuery().processInstanceId(processInstance.getId()).
Task resultTask = taskService.createTaskQuery().processInstanceId(processInstance.getId()). // taskInvolvedUser("发起人chenws").singleResult();
taskInvolvedUser("发起人chenws").singleResult();
//直接提交标准到下个节点 //直接提交标准到下个节点
taskService.claim(resultTask.getId(), "发起人chenws"); // taskService.claim(resultTask.getId(), "发起人chenws");
//保存审批意见 //保存审批意见
taskService.addComment(resultTask.getId(), processInstance.getId(), "发起人chenws启动分发任务"); // taskService.addComment(resultTask.getId(), processInstance.getId(), "发起人chenws启动分发任务");
Map<String, Object> vars = new HashMap<>(); // Map<String, Object> vars = new HashMap<>();
// 分发录入任务 // 分发录入任务
vars.put("candidateUsers", Arrays.asList("chenws1", "chenws2")); // vars.put("candidateUsers", Arrays.asList("chenws1", "chenws2"));
// 提交任务,并把补录人任务划分好 // 提交任务,并把补录人任务划分好
taskService.complete(resultTask.getId(), vars); // taskService.complete(resultTask.getId(), vars);
} }
...@@ -94,8 +103,15 @@ public class ProcessTest { ...@@ -94,8 +103,15 @@ public class ProcessTest {
// 65046 // 65046
Task resultTask = taskService.createTaskQuery().taskId("162506").singleResult(); // Task resultTask = taskService.createTaskQuery().taskId("162506").singleResult();
taskService.complete(resultTask.getId()); // taskService.complete(resultTask.getId());
// 187538
// taskService.claim("210033", "chenws2");
taskService.complete("210040", ImmutableMap.of());
// taskService.complete(resultTask.getId());
// taskService.complete(resultTask.getId(), ImmutableMap.of("needDataAudit", "false", "needConfirm", "true")); // taskService.complete(resultTask.getId(), ImmutableMap.of("needDataAudit", "false", "needConfirm", "true"));
// taskService.complete(resultTask.getId(), ImmutableMap.of("signConfirm", "false")); // taskService.complete(resultTask.getId(), ImmutableMap.of("signConfirm", "false"));
......
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