|
|
@ -16,6 +16,9 @@ import cn.jyjz.xiaoyao.common.base.util.SpringUtils;
|
|
|
|
import cn.jyjz.xiaoyao.common.base.util.StringUtils;
|
|
|
|
import cn.jyjz.xiaoyao.common.base.util.StringUtils;
|
|
|
|
import cn.jyjz.xiaoyao.common.base.vo.UserToken;
|
|
|
|
import cn.jyjz.xiaoyao.common.base.vo.UserToken;
|
|
|
|
import cn.jyjz.xiaoyao.oa.from.service.UserViewapproeService;
|
|
|
|
import cn.jyjz.xiaoyao.oa.from.service.UserViewapproeService;
|
|
|
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.dataobject.OcrTaskchildPicture;
|
|
|
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.service.OcrPictureService;
|
|
|
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.service.OcrTaskchildPictureService;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.flowable.bpmn.model.MultiInstanceLoopCharacteristics;
|
|
|
|
import org.flowable.bpmn.model.MultiInstanceLoopCharacteristics;
|
|
|
|
import org.flowable.bpmn.model.UserTask;
|
|
|
|
import org.flowable.bpmn.model.UserTask;
|
|
|
@ -46,15 +49,16 @@ public class FlowInstanceServiceImpl extends FlowServiceFactory implements IFlow
|
|
|
|
private IFlowTaskService flowTaskService;
|
|
|
|
private IFlowTaskService flowTaskService;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private UserViewapproeService userViewApproeService;
|
|
|
|
private UserViewapproeService userViewApproeService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private OcrTaskchildPictureService ocrTaskchildPictureService;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean startProcessInstanceById(String procDefId, Map<String, Object> variables, HttpServletRequest request, String formid, String servicename,String deptid) {
|
|
|
|
public boolean startProcessInstanceById(String procDefId, Map<String, Object> variables, HttpServletRequest request, String formid, String servicename, String deptid) {
|
|
|
|
|
|
|
|
|
|
|
|
IFormCustomService iFormCustomService = null;
|
|
|
|
IFormCustomService iFormCustomService = null;
|
|
|
|
if (StringUtils.isNotBlank(servicename)) {
|
|
|
|
if (StringUtils.isNotBlank(servicename)) {
|
|
|
|
iFormCustomService = SpringUtils.getBean(servicename);
|
|
|
|
iFormCustomService = SpringUtils.getBean(servicename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(formid)) {
|
|
|
|
if (StringUtils.isBlank(formid)) {
|
|
|
|
//表单主键
|
|
|
|
//表单主键
|
|
|
|
formid = iFormCustomService.saveForm(request);
|
|
|
|
formid = iFormCustomService.saveForm(request);
|
|
|
@ -87,24 +91,27 @@ public class FlowInstanceServiceImpl extends FlowServiceFactory implements IFlow
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
variables.put("businessKey", businessKey);
|
|
|
|
variables.put("businessKey", businessKey);
|
|
|
|
|
|
|
|
|
|
|
|
//获取下一个节点
|
|
|
|
//获取下一个节点
|
|
|
|
UserTask userTask = this.flowTaskService.getNextTasks(procDefId);
|
|
|
|
UserTask userTask = this.flowTaskService.getNextTasks(procDefId);
|
|
|
|
if(null != userTask){
|
|
|
|
if (null != userTask) {
|
|
|
|
MultiInstanceLoopCharacteristics multiInstance = userTask.getLoopCharacteristics();
|
|
|
|
MultiInstanceLoopCharacteristics multiInstance = userTask.getLoopCharacteristics();
|
|
|
|
// 会签节点
|
|
|
|
// 会签节点
|
|
|
|
if (Objects.nonNull(multiInstance)) {
|
|
|
|
if (Objects.nonNull(multiInstance)) {
|
|
|
|
List<String> loginnames = flowTaskService.getAssignee(userTask,userName);
|
|
|
|
List<String> loginnames = flowTaskService.getAssignee(userTask, userName);
|
|
|
|
if(null != loginnames && !loginnames.isEmpty()){
|
|
|
|
if (null != loginnames && !loginnames.isEmpty()) {
|
|
|
|
variables.put("persons",loginnames);
|
|
|
|
variables.put("persons", loginnames);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
processInstance = runtimeService.startProcessInstanceById(procDefId, businessKey, variables);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
processInstance = runtimeService.startProcessInstanceById(procDefId, businessKey, variables);
|
|
|
|
|
|
|
|
OcrTaskchildPicture taskchildPicture = ocrTaskchildPictureService.getById(formid);
|
|
|
|
|
|
|
|
taskchildPicture.setProcessdefinitionid(processInstance.getProcessDefinitionId());
|
|
|
|
|
|
|
|
taskchildPicture.setProcessinstanceid(processInstance.getProcessInstanceId());
|
|
|
|
|
|
|
|
ocrTaskchildPictureService.updateById(taskchildPicture);
|
|
|
|
if (null != iFormCustomService) {
|
|
|
|
if (null != iFormCustomService) {
|
|
|
|
FlowTaskCompleteVO flowTaskCompleteVO = flowTaskService.updateNowTaskAssignee(processInstance.getProcessInstanceId(), processInstance.getProcessDefinitionId(),deptid);
|
|
|
|
FlowTaskCompleteVO flowTaskCompleteVO = flowTaskService.updateNowTaskAssignee(processInstance.getProcessInstanceId(), processInstance.getProcessDefinitionId(), deptid);
|
|
|
|
|
|
|
|
|
|
|
|
if (null == flowTaskCompleteVO) {
|
|
|
|
if (null == flowTaskCompleteVO) {
|
|
|
|
throw new ServiceException("没有审批人,请联系管理员,流程定义:" + businessKey);
|
|
|
|
throw new ServiceException("没有审批人,请联系管理员,流程定义:" + businessKey);
|
|
|
@ -145,7 +152,7 @@ public class FlowInstanceServiceImpl extends FlowServiceFactory implements IFlow
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean startProcessInstanceById(String procDefId, String userName, String createuser, String formid, String servicename,String depti) {
|
|
|
|
public boolean startProcessInstanceById(String procDefId, String userName, String createuser, String formid, String servicename, String depti) {
|
|
|
|
|
|
|
|
|
|
|
|
IFormCustomService iFormCustomService = null;
|
|
|
|
IFormCustomService iFormCustomService = null;
|
|
|
|
if (StringUtils.isNotBlank(servicename)) {
|
|
|
|
if (StringUtils.isNotBlank(servicename)) {
|
|
|
@ -173,24 +180,24 @@ public class FlowInstanceServiceImpl extends FlowServiceFactory implements IFlow
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
variables.put("businessKey", businessKey);
|
|
|
|
variables.put("businessKey", businessKey);
|
|
|
|
|
|
|
|
|
|
|
|
//获取下一个节点
|
|
|
|
//获取下一个节点
|
|
|
|
UserTask userTask = this.flowTaskService.getNextTasks(procDefId);
|
|
|
|
UserTask userTask = this.flowTaskService.getNextTasks(procDefId);
|
|
|
|
if(null != userTask){
|
|
|
|
if (null != userTask) {
|
|
|
|
MultiInstanceLoopCharacteristics multiInstance = userTask.getLoopCharacteristics();
|
|
|
|
MultiInstanceLoopCharacteristics multiInstance = userTask.getLoopCharacteristics();
|
|
|
|
// 会签节点
|
|
|
|
// 会签节点
|
|
|
|
if (Objects.nonNull(multiInstance)) {
|
|
|
|
if (Objects.nonNull(multiInstance)) {
|
|
|
|
List<String> loginnames = flowTaskService.getAssignee(userTask,userName);
|
|
|
|
List<String> loginnames = flowTaskService.getAssignee(userTask, userName);
|
|
|
|
if(null != loginnames && !loginnames.isEmpty()){
|
|
|
|
if (null != loginnames && !loginnames.isEmpty()) {
|
|
|
|
variables.put("persons",loginnames);
|
|
|
|
variables.put("persons", loginnames);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
processInstance = runtimeService.startProcessInstanceById(procDefId, businessKey, variables);
|
|
|
|
processInstance = runtimeService.startProcessInstanceById(procDefId, businessKey, variables);
|
|
|
|
|
|
|
|
|
|
|
|
if (null != iFormCustomService) {
|
|
|
|
if (null != iFormCustomService) {
|
|
|
|
FlowTaskCompleteVO flowTaskCompleteVO = flowTaskService.updateNowTaskAssignee(processInstance.getProcessInstanceId(), processInstance.getProcessDefinitionId(),depti);
|
|
|
|
FlowTaskCompleteVO flowTaskCompleteVO = flowTaskService.updateNowTaskAssignee(processInstance.getProcessInstanceId(), processInstance.getProcessDefinitionId(), depti);
|
|
|
|
|
|
|
|
|
|
|
|
if (null == flowTaskCompleteVO) {
|
|
|
|
if (null == flowTaskCompleteVO) {
|
|
|
|
throw new ServiceException("没有审批人,请联系管理员,流程定义:" + businessKey);
|
|
|
|
throw new ServiceException("没有审批人,请联系管理员,流程定义:" + businessKey);
|
|
|
|