Quellcode durchsuchen

Merge remote-tracking branch 'origin/dev' into dev

大数据与最优化研究所 vor 1 Jahr
Ursprung
Commit
309620eb21

+ 0 - 1
src/main/java/com/xjrsoft/module/organization/dto/AddUserDto.java

@@ -96,7 +96,6 @@ public class AddUserDto implements Serializable {
     @ApiModelProperty("qq号码")
     private String qqNumber;
 
-    @JsonFormat(pattern = "yyyy-MM-dd")
     @ApiModelProperty("生日")
     private LocalDate birthDate;
 

+ 1 - 1
src/main/java/com/xjrsoft/module/system/dto/DictionaryItemPageDto.java

@@ -19,6 +19,6 @@ public class DictionaryItemPageDto extends PageInput {
     private String name;
 
     @ApiModelProperty(value = "数据字典项目编码")
-    @Length(max = 10,message = "编码长度不超过10个字符")
+    @Length(max = 20,message = "编码长度不超过20个字符")
     private String code;
 }

+ 13 - 1
src/main/java/com/xjrsoft/module/workflow/listener/TaskDelegate.java

@@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.xjrsoft.common.constant.GlobalConstant;
 import com.xjrsoft.common.enums.*;
+import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.common.utils.RedisUtil;
 import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.entity.UserRoleRelation;
@@ -91,7 +92,18 @@ public class TaskDelegate implements TaskListener {
             if (workflowSchema == null) {
                 workflowSchema = workflowSchemaService.getById(MapUtil.getLong(variableMaps, WorkflowConstant.PROCESS_SCHEMA_ID_KEY));
             }
-            WorkflowSchemaConfig workflowSchemaConfig = JSONUtil.toBean(workflowSchema.getJsonContent(), WorkflowSchemaConfig.class);
+            // TODO 判断当前流程是否发生了变更
+            WorkflowSchemaConfig workflowSchemaConfig = null;
+            if (workflowSchema.getDefinitionId().equals(delegateTask.getProcessDefinitionId())) {
+                workflowSchemaConfig = JSONUtil.toBean(workflowSchema.getJsonContent(), WorkflowSchemaConfig.class);
+            } else {
+                IWorkflowSchemaHistoryService workflowSchemaHistoryService = SpringUtil.getBean(IWorkflowSchemaHistoryService.class);
+                WorkflowSchemaHistory workflowSchemaHistory = workflowSchemaHistoryService.getOne(Wrappers.lambdaQuery(WorkflowSchemaHistory.class).eq(WorkflowSchemaHistory::getDefinitionId, delegateTask.getProcessDefinitionId()));
+                if (workflowSchemaHistory == null) {
+                    throw new MyException("流转历史记录已丢失!");
+                }
+                workflowSchemaConfig = JSONUtil.toBean(workflowSchemaHistory.getJsonContent(), WorkflowSchemaConfig.class);
+            }
 
             Optional<Map<String, Object>> userTaskConfigOp = workflowSchemaConfig.getChildNodeConfig().stream().filter(c -> c.containsValue(delegateTask.getTaskDefinitionKey())).findFirst();
 

+ 48 - 35
src/main/java/com/xjrsoft/module/workflow/service/impl/WorkflowExecuteServiceImpl.java

@@ -41,7 +41,6 @@ import com.xjrsoft.module.oa.entity.News;
 import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.entity.UserRoleRelation;
 import com.xjrsoft.module.organization.service.IUserService;
-import com.xjrsoft.module.student.entity.BaseStudentAssessmentCategory;
 import com.xjrsoft.module.system.entity.File;
 import com.xjrsoft.module.system.entity.Stamp;
 import com.xjrsoft.module.system.service.IFileService;
@@ -50,18 +49,7 @@ import com.xjrsoft.module.workflow.constant.WorkflowConstant;
 import com.xjrsoft.module.workflow.dto.*;
 import com.xjrsoft.module.workflow.entity.*;
 import com.xjrsoft.module.workflow.mapper.*;
-import com.xjrsoft.module.workflow.model.ApiConfig;
-import com.xjrsoft.module.workflow.model.ApiRequestParamsConfig;
-import com.xjrsoft.module.workflow.model.AuthConfig;
-import com.xjrsoft.module.workflow.model.ButtonConfig;
-import com.xjrsoft.module.workflow.model.FormAssignmentConfig;
-import com.xjrsoft.module.workflow.model.FormConfig;
-import com.xjrsoft.module.workflow.model.MemberConfig;
-import com.xjrsoft.module.workflow.model.ProcessParamConfig;
-import com.xjrsoft.module.workflow.model.RelationProcessConfig;
-import com.xjrsoft.module.workflow.model.StartNodeConfig;
-import com.xjrsoft.module.workflow.model.UserTaskConfig;
-import com.xjrsoft.module.workflow.model.WorkflowSchemaConfig;
+import com.xjrsoft.module.workflow.model.*;
 import com.xjrsoft.module.workflow.service.*;
 import com.xjrsoft.module.workflow.utils.WorkFlowUtil;
 import com.xjrsoft.module.workflow.vo.*;
@@ -154,6 +142,9 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
     private final ObjectMapper objectMapper;
 
     private final XjrWorkflowExtraMapper xjrWorkflowExtraMapper;
+
+    private final WorkflowSchemaHistoryMapper workflowSchemaHistoryMapper;
+
     /**
      * 数据库存储xml字段的后缀
      */
@@ -306,7 +297,17 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
         vo.setWorkflowChat(workflowSchema.getWorkflowChat());
 
         //获取到整个流程模板的配置
-        WorkflowSchemaConfig workflowSchemaConfig = JSONUtil.toBean(workflowSchema.getJsonContent(), WorkflowSchemaConfig.class);
+        // TODO 判断当前流程是否发生了变更
+        WorkflowSchemaConfig workflowSchemaConfig = null;
+        if (workflowSchema.getDefinitionId().equals(task.getProcessDefinitionId())) {
+            workflowSchemaConfig = JSONUtil.toBean(workflowSchema.getJsonContent(), WorkflowSchemaConfig.class);
+        } else {
+            WorkflowSchemaHistory workflowSchemaHistory = workflowSchemaHistoryMapper.selectOne(Wrappers.lambdaQuery(WorkflowSchemaHistory.class).eq(WorkflowSchemaHistory::getDefinitionId, task.getProcessDefinitionId()));
+            if (workflowSchemaHistory == null) {
+                throw new MyException("流转历史记录已丢失!");
+            }
+            workflowSchemaConfig = JSONUtil.toBean(workflowSchemaHistory.getJsonContent(), WorkflowSchemaConfig.class);
+        }
 
         Optional<HistoricVariableInstance> relationTasksOp = variableInstanceList.stream().filter(x -> x.getName().equals(WorkflowConstant.RELATION_TASK_KEY)).findFirst();
 
@@ -1612,7 +1613,18 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
 //        //获取工作流配置信息
 //        WorkflowSchema workflowSchema = workflowSchemaMapper.selectById(schemaId);
         //获取到整个流程模板的配置
-        WorkflowSchemaConfig workflowSchemaConfig = JSONUtil.toBean(workflowSchema.getJsonContent(), WorkflowSchemaConfig.class);
+        WorkflowSchemaConfig workflowSchemaConfig = null;
+        // TODO 判断当前流程是否发生了变更
+        if (workflowSchema.getDefinitionId().equals(task.getProcessDefinitionId())) {
+            workflowSchemaConfig = JSONUtil.toBean(workflowSchema.getJsonContent(), WorkflowSchemaConfig.class);
+        } else {
+            WorkflowSchemaHistory workflowSchemaHistory = workflowSchemaHistoryMapper.selectOne(Wrappers.lambdaQuery(WorkflowSchemaHistory.class).eq(WorkflowSchemaHistory::getDefinitionId, task.getProcessDefinitionId()));
+            if (workflowSchemaHistory == null) {
+                throw new MyException("流转历史记录已丢失!");
+            }
+            workflowSchemaConfig = JSONUtil.toBean(workflowSchemaHistory.getJsonContent(), WorkflowSchemaConfig.class);
+        }
+//        WorkflowSchemaConfig workflowSchemaConfig = JSONUtil.toBean(workflowSchema.getJsonContent(), WorkflowSchemaConfig.class);
         //找到当前用户任务节点的配置信息
         Optional<Map<String, Object>> userTaskMapOptional = workflowSchemaConfig.getChildNodeConfig().stream().filter(x -> x.containsValue(task.getTaskDefinitionKey())).findFirst();
         //判断是否找得到此任务节点 没有则报错
@@ -3198,7 +3210,7 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
                 .collect(Collectors.toList());
         List<Task> list = taskService.createTaskQuery().taskIdIn(taskIds).list();
         List<WorkflowExtra> workflowExtraList = new ArrayList<>();
-        if(processIds.size() > 0){
+        if (processIds.size() > 0) {
             QueryWrapper<WorkflowExtra> workflowExtraQueryWrapper = new QueryWrapper<>();
             workflowExtraQueryWrapper
                     .select("process_id as process_id, MAX(current_progress) as current_progress")
@@ -4337,7 +4349,7 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
      */
     private List<ProcessRecordListVo> getCustomProcessRecordListVos(String processInstanceId, int onlySelf, Integer usageScenario) {
         List<Integer> usageScenarioList = new ArrayList<>();
-        for (int i = 1; i <= usageScenario; i++){
+        for (int i = 1; i <= usageScenario; i++) {
             usageScenarioList.add(i);
         }
         User user = StpUtil.getTokenSession().get(GlobalConstant.LOGIN_USER_INFO_KEY, new User());
@@ -4549,11 +4561,12 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
 
     /**
      * 删除发起节点自动审批的准备审批记录
+     *
      * @param task
      * @param schemaId
      * @param message
      */
-    private void deleteAutoAgreePrepareNodeInRecord(Task task, Long schemaId, String message){
+    private void deleteAutoAgreePrepareNodeInRecord(Task task, Long schemaId, String message) {
         IXjrWorkflowOperateRecordService xjrWorkflowOperateRecordService = SpringUtil.getBean(IXjrWorkflowOperateRecordService.class);
 
         QueryWrapper<XjrWorkflowOperateRecord> wrapper = new QueryWrapper<XjrWorkflowOperateRecord>()
@@ -5435,14 +5448,14 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
                 String message = "审批信息:由于审批超时,【系统】【自动同意】审批,审批意见为:“系统自动同意审批”,由【" + oldTaskName + "】 流转到【" + "结束节点" + "】";
                 record.setMessage(message);
 
-                operateRecord.setOperateInfo("审批人:" +oldTaskName + ", 审批结果:同意, 审批内容:由于审批超时,系统自动同意审批");
+                operateRecord.setOperateInfo("审批人:" + oldTaskName + ", 审批结果:同意, 审批内容:由于审批超时,系统自动同意审批");
             }
             //单流向
             if (nextTaskNameList.size() == 1) {
                 String message = "审批信息:由于审批超时,【系统】【自动同意】审批,审批意见为:“系统自动同意审批”,由【" + oldTaskName + "】 流转到【" + nextTaskNameList.get(0) + "】";
                 record.setMessage(message);
 
-                operateRecord.setOperateInfo("审批人:" +oldTaskName + ", 审批结果:同意, 审批内容:由于审批超时,系统自动同意审批");
+                operateRecord.setOperateInfo("审批人:" + oldTaskName + ", 审批结果:同意, 审批内容:由于审批超时,系统自动同意审批");
             }//多流向
             if (nextTaskNameList.size() > 1) {
                 String message = "审批信息:由于审批超时,【系统】【自动同意】审批,审批意见为:“系统自动同意审批”,由【" + oldTaskName + "】 流转到【" + nextTaskNameList.get(0) + "】";
@@ -5451,7 +5464,7 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
                 }
                 record.setMessage(message);
 
-                operateRecord.setOperateInfo("审批人:" +oldTaskName + ", 审批结果:同意, 审批内容:由于审批超时,系统自动同意审批");
+                operateRecord.setOperateInfo("审批人:" + oldTaskName + ", 审批结果:同意, 审批内容:由于审批超时,系统自动同意审批");
             }
 
             workflowRecordMapper.insert(record);
@@ -5465,14 +5478,14 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
         List<ProcessRecordListVo> processRecordListVos = this.getCustomProcessRecordListVos(dto.getProcessId(), 0, 1);
 
         List<UserDefinedProcessRecordListVo> userDefinedProcessRecordListVos = new ArrayList<>();
-        for(ProcessRecordListVo p : processRecordListVos){
+        for (ProcessRecordListVo p : processRecordListVos) {
             String comment = p.getComment();
             String[] commentArr = comment.split(",");
-            if(commentArr.length > 1){
+            if (commentArr.length > 1) {
                 String[] approveUserNameArr = commentArr[0].split(":");
                 String[] approveResultArr = commentArr[1].split(":");
                 String[] approveCommentArr = commentArr[2].split(":");
-                userDefinedProcessRecordListVos.add(new UserDefinedProcessRecordListVo(){{
+                userDefinedProcessRecordListVos.add(new UserDefinedProcessRecordListVo() {{
                     setNodeType(p.getNodeType());
                     setNodeName(p.getNodeName());
                     setComment(p.getComment());
@@ -5484,8 +5497,8 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
                 }});
             }
 
-            if(p.getNodeName().equals("开始节点")) {
-                userDefinedProcessRecordListVos.add(new UserDefinedProcessRecordListVo(){{
+            if (p.getNodeName().equals("开始节点")) {
+                userDefinedProcessRecordListVos.add(new UserDefinedProcessRecordListVo() {{
                     setNodeType(p.getNodeType());
                     setComment(p.getComment());
                     setStartTime(p.getStartTime());
@@ -5509,14 +5522,14 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
         List<ProcessRecordListVo> processRecordListVos = this.getCustomProcessRecordListVos(dto.getProcessId(), 0, 2);
 
         List<UserDefinedProcessRecordListVo> userDefinedProcessRecordListVos = new ArrayList<>();
-        for(ProcessRecordListVo p : processRecordListVos){
+        for (ProcessRecordListVo p : processRecordListVos) {
             String comment = p.getComment();
             String[] commentArr = comment.split(",");
-            if(commentArr.length > 1){
+            if (commentArr.length > 1) {
                 String[] approveUserNameArr = commentArr[0].split(":");
                 String[] approveResultArr = commentArr[1].split(":");
                 String[] approveCommentArr = commentArr[2].split(":");
-                userDefinedProcessRecordListVos.add(new UserDefinedProcessRecordListVo(){{
+                userDefinedProcessRecordListVos.add(new UserDefinedProcessRecordListVo() {{
                     setNodeType(p.getNodeType());
                     setNodeName(p.getNodeName());
                     setComment(p.getComment());
@@ -5527,8 +5540,8 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
                     setApproveComment(approveCommentArr.length > 1 ? approveCommentArr[1] : "");
                 }});
             }
-            if(p.getNodeName().equals("开始节点")) {
-                userDefinedProcessRecordListVos.add(new UserDefinedProcessRecordListVo(){{
+            if (p.getNodeName().equals("开始节点")) {
+                userDefinedProcessRecordListVos.add(new UserDefinedProcessRecordListVo() {{
                     setNodeType(p.getNodeType());
                     setComment(p.getComment());
                     setStartTime(p.getStartTime());
@@ -5544,8 +5557,8 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
                 }});
             }
 
-            if(p.getNodeName().equals("结束节点")) {
-                userDefinedProcessRecordListVos.add(new UserDefinedProcessRecordListVo(){{
+            if (p.getNodeName().equals("结束节点")) {
+                userDefinedProcessRecordListVos.add(new UserDefinedProcessRecordListVo() {{
                     setNodeType(p.getNodeType());
                     setComment(p.getComment());
                     setStartTime(p.getStartTime());
@@ -5556,8 +5569,8 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
                 }});
             }
 
-            if(p.getComment().contains("准备审批")) {
-                userDefinedProcessRecordListVos.add(new UserDefinedProcessRecordListVo(){{
+            if (p.getComment().contains("准备审批")) {
+                userDefinedProcessRecordListVos.add(new UserDefinedProcessRecordListVo() {{
                     setNodeType(p.getNodeType());
                     setComment(p.getComment());
                     setStartTime(p.getStartTime());