|
@@ -6,9 +6,7 @@ import com.qmth.distributed.print.business.entity.ExamTask;
|
|
import com.qmth.distributed.print.business.entity.TFFlowLog;
|
|
import com.qmth.distributed.print.business.entity.TFFlowLog;
|
|
import com.qmth.distributed.print.business.enums.CustomFlowMultipleUserApproveTypeEnum;
|
|
import com.qmth.distributed.print.business.enums.CustomFlowMultipleUserApproveTypeEnum;
|
|
import com.qmth.distributed.print.business.enums.MessageEnum;
|
|
import com.qmth.distributed.print.business.enums.MessageEnum;
|
|
-import com.qmth.distributed.print.business.enums.TFCustomTypeEnum;
|
|
|
|
import com.qmth.distributed.print.business.service.BasicMessageService;
|
|
import com.qmth.distributed.print.business.service.BasicMessageService;
|
|
-import com.qmth.distributed.print.business.service.ExamTaskService;
|
|
|
|
import com.qmth.distributed.print.business.service.PrintCommonService;
|
|
import com.qmth.distributed.print.business.service.PrintCommonService;
|
|
import com.qmth.teachcloud.common.bean.params.ApproveUserResult;
|
|
import com.qmth.teachcloud.common.bean.params.ApproveUserResult;
|
|
import com.qmth.teachcloud.common.contant.SpringContextHolder;
|
|
import com.qmth.teachcloud.common.contant.SpringContextHolder;
|
|
@@ -16,6 +14,7 @@ import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
import com.qmth.teachcloud.common.enums.FlowApproveOperationEnum;
|
|
import com.qmth.teachcloud.common.enums.FlowApproveOperationEnum;
|
|
|
|
+import com.qmth.teachcloud.common.enums.TFCustomTypeEnum;
|
|
import com.qmth.teachcloud.common.service.SysUserService;
|
|
import com.qmth.teachcloud.common.service.SysUserService;
|
|
import com.qmth.teachcloud.common.util.JacksonUtil;
|
|
import com.qmth.teachcloud.common.util.JacksonUtil;
|
|
import org.activiti.engine.HistoryService;
|
|
import org.activiti.engine.HistoryService;
|
|
@@ -55,9 +54,10 @@ public class ProcessEventListener implements ActivitiEventListener, Serializable
|
|
Map<String, Object> map = activitiProcessStartedEvent.getVariables();
|
|
Map<String, Object> map = activitiProcessStartedEvent.getVariables();
|
|
Long objectId = (Long) map.get(SystemConstant.OBJECT_ID);
|
|
Long objectId = (Long) map.get(SystemConstant.OBJECT_ID);
|
|
TFCustomTypeEnum flowType = (TFCustomTypeEnum) map.get(SystemConstant.FLOW_TYPE);
|
|
TFCustomTypeEnum flowType = (TFCustomTypeEnum) map.get(SystemConstant.FLOW_TYPE);
|
|
- Object o = map.get(SystemConstant.FLOW_SUBMIT);
|
|
|
|
|
|
+ Object o = map.get(SystemConstant.OBJECT_DATA);
|
|
|
|
+ Boolean flowSubmit = (Boolean) map.get(SystemConstant.FLOW_SUBMIT);
|
|
//发送命题待审批短信
|
|
//发送命题待审批短信
|
|
- if (Objects.nonNull(objectId) && Objects.nonNull(flowType) && Objects.nonNull(o)) {
|
|
|
|
|
|
+ if (Objects.nonNull(objectId) && Objects.nonNull(flowType) && Objects.nonNull(o) && Objects.nonNull(flowSubmit) && flowSubmit) {
|
|
if (flowType == TFCustomTypeEnum.ELECTRON_FLOW && o instanceof ExamTask) {
|
|
if (flowType == TFCustomTypeEnum.ELECTRON_FLOW && o instanceof ExamTask) {
|
|
basicMessageService.sendNoticeTaskCreate((ExamTask) o);
|
|
basicMessageService.sendNoticeTaskCreate((ExamTask) o);
|
|
}
|
|
}
|
|
@@ -66,29 +66,32 @@ public class ProcessEventListener implements ActivitiEventListener, Serializable
|
|
case PROCESS_COMPLETED:
|
|
case PROCESS_COMPLETED:
|
|
// 流程结束
|
|
// 流程结束
|
|
log.info("流程结束_PROCESS_COMPLETED:ProcessInstanceId:{},ExecutionId:{},ProcessDefinitionId:{}", event.getProcessInstanceId(), event.getExecutionId(), event.getProcessDefinitionId());
|
|
log.info("流程结束_PROCESS_COMPLETED:ProcessInstanceId:{},ExecutionId:{},ProcessDefinitionId:{}", event.getProcessInstanceId(), event.getExecutionId(), event.getProcessDefinitionId());
|
|
- TaskService taskService = SpringContextHolder.getBean(TaskService.class);
|
|
|
|
HistoryService historyService = SpringContextHolder.getBean(HistoryService.class);
|
|
HistoryService historyService = SpringContextHolder.getBean(HistoryService.class);
|
|
SysUserService sysUserService = SpringContextHolder.getBean(SysUserService.class);
|
|
SysUserService sysUserService = SpringContextHolder.getBean(SysUserService.class);
|
|
- ExamTaskService examTaskService = SpringContextHolder.getBean(ExamTaskService.class);
|
|
|
|
PrintCommonService printCommonService = SpringContextHolder.getBean(PrintCommonService.class);
|
|
PrintCommonService printCommonService = SpringContextHolder.getBean(PrintCommonService.class);
|
|
|
|
|
|
List<HistoricVariableInstance> historicVariableInstanceList = historyService.createHistoricVariableInstanceQuery().processInstanceId(event.getProcessInstanceId()).list();
|
|
List<HistoricVariableInstance> historicVariableInstanceList = historyService.createHistoricVariableInstanceQuery().processInstanceId(event.getProcessInstanceId()).list();
|
|
if (Objects.nonNull(historicVariableInstanceList) && historicVariableInstanceList.size() > 0) {
|
|
if (Objects.nonNull(historicVariableInstanceList) && historicVariableInstanceList.size() > 0) {
|
|
TFFlowLog tfFlowLog = null;
|
|
TFFlowLog tfFlowLog = null;
|
|
|
|
+ Object object = null;
|
|
for (HistoricVariableInstance h : historicVariableInstanceList) {
|
|
for (HistoricVariableInstance h : historicVariableInstanceList) {
|
|
if (Objects.equals(h.getVariableName(), SystemConstant.APPROVE_TF_FLOW_LOG)) {
|
|
if (Objects.equals(h.getVariableName(), SystemConstant.APPROVE_TF_FLOW_LOG)) {
|
|
tfFlowLog = (TFFlowLog) h.getValue();
|
|
tfFlowLog = (TFFlowLog) h.getValue();
|
|
|
|
+ Optional.ofNullable(tfFlowLog).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("流程审批日志为空"));
|
|
|
|
+ } else if (Objects.equals(h.getVariableName(), SystemConstant.OBJECT_DATA)) {
|
|
|
|
+ object = h.getValue();
|
|
|
|
+ Optional.ofNullable(object).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("实体数据为空"));
|
|
|
|
+ }
|
|
|
|
+ if (Objects.nonNull(object) && Objects.nonNull(tfFlowLog)) {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (Objects.nonNull(tfFlowLog) && Objects.nonNull(tfFlowLog.getObjectTable())) {
|
|
|
|
|
|
+ if (Objects.nonNull(tfFlowLog.getObjectTable())) {
|
|
if (Objects.equals(tfFlowLog.getObjectTable(), TFCustomTypeEnum.ELECTRON_FLOW.getTable())) {//如果是命题任务交卷
|
|
if (Objects.equals(tfFlowLog.getObjectTable(), TFCustomTypeEnum.ELECTRON_FLOW.getTable())) {//如果是命题任务交卷
|
|
- ExamTask examTask = examTaskService.getById(tfFlowLog.getObjectId());
|
|
|
|
- Optional.ofNullable(examTask).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("命题任务为空"));
|
|
|
|
//取命题老师ID
|
|
//取命题老师ID
|
|
- SysUser sysUser = sysUserService.getById(examTask.getUserId());
|
|
|
|
|
|
+ SysUser sysUser = sysUserService.getById(((ExamTask) object).getUserId());
|
|
try {
|
|
try {
|
|
- printCommonService.checkData(examTask.getSchoolId(), examTask.getCourseCode(), examTask.getPaperNumber(), sysUser);
|
|
|
|
|
|
+ printCommonService.checkData(((ExamTask) object).getSchoolId(), ((ExamTask) object).getCourseCode(), ((ExamTask) object).getPaperNumber(), sysUser);
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
throw ExceptionResultEnum.ERROR.exception("生成pdf失败");
|
|
throw ExceptionResultEnum.ERROR.exception("生成pdf失败");
|
|
}
|
|
}
|
|
@@ -186,21 +189,19 @@ public class ProcessEventListener implements ActivitiEventListener, Serializable
|
|
case TASK_COMPLETED:
|
|
case TASK_COMPLETED:
|
|
// 任务被完成了。它会在ENTITY_DELETE事件之前触发。当任务是流程一部分时,事件会在流程继续运行之前, 后续事件将是ACTIVITY_COMPLETE,对应着完成任务的节点。
|
|
// 任务被完成了。它会在ENTITY_DELETE事件之前触发。当任务是流程一部分时,事件会在流程继续运行之前, 后续事件将是ACTIVITY_COMPLETE,对应着完成任务的节点。
|
|
log.info("流程任务完成_TASK_COMPLETED:ProcessInstanceId:{},ExecutionId:{},ProcessDefinitionId:{}", event.getProcessInstanceId(), event.getExecutionId(), event.getProcessDefinitionId());
|
|
log.info("流程任务完成_TASK_COMPLETED:ProcessInstanceId:{},ExecutionId:{},ProcessDefinitionId:{}", event.getProcessInstanceId(), event.getExecutionId(), event.getProcessDefinitionId());
|
|
- taskService = SpringContextHolder.getBean(TaskService.class);
|
|
|
|
|
|
+ TaskService taskService = SpringContextHolder.getBean(TaskService.class);
|
|
sysUserService = SpringContextHolder.getBean(SysUserService.class);
|
|
sysUserService = SpringContextHolder.getBean(SysUserService.class);
|
|
- examTaskService = SpringContextHolder.getBean(ExamTaskService.class);
|
|
|
|
basicMessageService = SpringContextHolder.getBean(BasicMessageService.class);
|
|
basicMessageService = SpringContextHolder.getBean(BasicMessageService.class);
|
|
|
|
|
|
Task task = taskService.createTaskQuery().executionId(event.getExecutionId()).singleResult();
|
|
Task task = taskService.createTaskQuery().executionId(event.getExecutionId()).singleResult();
|
|
if (Objects.nonNull(task)) {
|
|
if (Objects.nonNull(task)) {
|
|
TFFlowLog tfFlowLog = (TFFlowLog) taskService.getVariable(task.getId(), SystemConstant.APPROVE_TF_FLOW_LOG);
|
|
TFFlowLog tfFlowLog = (TFFlowLog) taskService.getVariable(task.getId(), SystemConstant.APPROVE_TF_FLOW_LOG);
|
|
- o = null;
|
|
|
|
- if (Objects.nonNull(tfFlowLog.getObjectTable()) && Objects.equals(tfFlowLog.getObjectTable(), TFCustomTypeEnum.ELECTRON_FLOW.getTable())) {
|
|
|
|
- o = examTaskService.getById(tfFlowLog.getObjectId());
|
|
|
|
- }
|
|
|
|
- if (Objects.nonNull(tfFlowLog) && (tfFlowLog.getApproveOperation() != FlowApproveOperationEnum.SUBMIT
|
|
|
|
|
|
+ Optional.ofNullable(tfFlowLog).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("流程审批日志为空"));
|
|
|
|
+ o = taskService.getVariable(task.getId(), SystemConstant.OBJECT_DATA);
|
|
|
|
+ Optional.ofNullable(o).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("实体数据为空"));
|
|
|
|
+ if (tfFlowLog.getApproveOperation() != FlowApproveOperationEnum.SUBMIT
|
|
&& tfFlowLog.getApproveOperation() != FlowApproveOperationEnum.END
|
|
&& tfFlowLog.getApproveOperation() != FlowApproveOperationEnum.END
|
|
- && tfFlowLog.getApproveOperation() != FlowApproveOperationEnum.FINISH)) {
|
|
|
|
|
|
+ && tfFlowLog.getApproveOperation() != FlowApproveOperationEnum.FINISH) {
|
|
if (Objects.nonNull(tfFlowLog.getPendApproveId())) {
|
|
if (Objects.nonNull(tfFlowLog.getPendApproveId())) {
|
|
String[] strs = tfFlowLog.getPendApproveId().split(",");
|
|
String[] strs = tfFlowLog.getPendApproveId().split(",");
|
|
List<Long> userIds = new ArrayList<>();
|
|
List<Long> userIds = new ArrayList<>();
|