瀏覽代碼

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

dzx 1 年之前
父節點
當前提交
ffe9b1c90c

+ 13 - 0
src/main/java/com/xjrsoft/module/dataexpert/controller/DataExpertSourceController.java

@@ -60,6 +60,19 @@ public class DataExpertSourceController {
         return RT.ok(pageOutput);
     }
 
+    @GetMapping(value = "/list")
+    @ApiOperation(value="数据导出-数据源设置列表")
+    @SaCheckPermission("dataexpertsource:detail")
+    public RT<List<DataExpertSourceVo>> list(@Valid DataExpertSourcePageDto dto){
+
+        LambdaQueryWrapper<DataExpertSource> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper
+                .orderByDesc(DataExpertSource::getId)
+                .select(DataExpertSource.class,x -> VoToColumnUtil.fieldsToColumns(DataExpertSourcePageVo.class).contains(x.getProperty()));
+        List<DataExpertSource> list = dataExpertSourceService.list(queryWrapper);
+        return RT.ok(BeanUtil.copyToList(list, DataExpertSourceVo.class));
+    }
+
     @GetMapping(value = "/info")
     @ApiOperation(value="根据id查询数据导出-数据源设置信息")
     @SaCheckPermission("dataexpertsource:detail")

+ 6 - 0
src/main/java/com/xjrsoft/module/workflow/controller/WorkflowSchemaController.java

@@ -58,6 +58,12 @@ public class WorkflowSchemaController {
         return R.ok(workflowSchemaService.getPage(dto));
     }
 
+    @GetMapping("/list")
+    @ApiOperation(value = "流程列表(不分页)")
+    public R list(@Valid WorkflowSchemaPageDto dto) {
+        return R.ok(workflowSchemaService.getList(dto));
+    }
+
 
     @PostMapping
     @ApiOperation(value = "新增流程模板")

+ 19 - 10
src/main/java/com/xjrsoft/module/workflow/listener/TaskTimeoutListener.java

@@ -9,11 +9,15 @@ import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.xjrsoft.common.enums.WorkflowNoticePolicyType;
+import com.xjrsoft.common.enums.YesOrNoEnum;
 import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.module.oa.utils.SendMessageUtil;
 import com.xjrsoft.module.workflow.constant.WorkflowConstant;
 import com.xjrsoft.module.workflow.entity.WorkflowSchema;
-import com.xjrsoft.module.workflow.model.*;
+import com.xjrsoft.module.workflow.model.MemberConfig;
+import com.xjrsoft.module.workflow.model.NoticePolicyParam;
+import com.xjrsoft.module.workflow.model.TimeoutRemidConfig;
+import com.xjrsoft.module.workflow.model.WorkflowSchemaConfig;
 import com.xjrsoft.module.workflow.service.IWorkflowExecuteService;
 import com.xjrsoft.module.workflow.service.IWorkflowSchemaService;
 import com.xjrsoft.module.workflow.utils.WorkFlowUtil;
@@ -27,7 +31,6 @@ import org.springframework.data.redis.listener.RedisMessageListenerContainer;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.CompletableFuture;
@@ -62,7 +65,13 @@ public class TaskTimeoutListener extends KeyExpirationEventMessageListener {
             String taskId = split[0];
 
             Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
-
+            if (task == null) {
+                return;
+            }
+            int code = Convert.toInt(taskService.getVariable(task.getId(),WorkflowConstant.TASK_IS_APPOINT_APPROVE));
+            if (code == YesOrNoEnum.NO.getCode()){
+                return;
+            }
             //到期未指定的任务 将变量设置为不需要指定
 //            taskService.setVariableLocal(task.getId(), WorkflowConstant.TASK_IS_APPOINT_APPROVE, YesOrNoEnum.NO.getCode());
 
@@ -82,15 +91,15 @@ public class TaskTimeoutListener extends KeyExpirationEventMessageListener {
 
                 Map<String, Object> variables = taskService.getVariables(currentTask.getId(), variableNames);
 
-                Long schemaId = Convert.toLong(taskService.getVariable(currentTask.getId(), WorkflowConstant.PROCESS_SCHEMA_ID_KEY));
+//                Long schemaId = Convert.toLong(taskService.getVariable(currentTask.getId(), WorkflowConstant.PROCESS_SCHEMA_ID_KEY));
 
-                IWorkflowSchemaService workflowSchemaService = SpringUtil.getBean(IWorkflowSchemaService.class);
-                WorkflowSchema workflowSchema = workflowSchemaService.getOne(Wrappers.lambdaQuery(WorkflowSchema.class).eq(WorkflowSchema::getId, schemaId).select(WorkflowSchema::getJsonContent));
+//                IWorkflowSchemaService workflowSchemaService = SpringUtil.getBean(IWorkflowSchemaService.class);
+//                WorkflowSchema workflowSchema = workflowSchemaService.getOne(Wrappers.lambdaQuery(WorkflowSchema.class).eq(WorkflowSchema::getId, schemaId).select(WorkflowSchema::getJsonContent));
 
-                WorkflowSchemaConfig workflowSchemaConfig = JSONUtil.toBean(workflowSchema.getJsonContent(), WorkflowSchemaConfig.class);
+//                WorkflowSchemaConfig workflowSchemaConfig = JSONUtil.toBean(workflowSchema.getJsonContent(), WorkflowSchemaConfig.class);
 
-                Map<String, Object> userTaskConfigMap = workflowSchemaConfig.getChildNodeConfig().stream().filter(x -> x.containsValue(currentTask.getTaskDefinitionKey())).findFirst().orElse(new HashMap<>());
-                UserTaskConfig userTaskConfig = Convert.convert(UserTaskConfig.class, userTaskConfigMap);
+//                Map<String, Object> userTaskConfigMap = workflowSchemaConfig.getChildNodeConfig().stream().filter(x -> x.containsValue(currentTask.getTaskDefinitionKey())).findFirst().orElse(new HashMap<>());
+//                UserTaskConfig userTaskConfig = Convert.convert(UserTaskConfig.class, userTaskConfigMap);
 
                 List<String> approveIds = ListUtil.toList(Convert.toStr(approvedIds).split(StringPool.COMMA));
 
@@ -104,7 +113,7 @@ public class TaskTimeoutListener extends KeyExpirationEventMessageListener {
                 param.setSchemaName(MapUtil.get(variables, WorkflowConstant.PROCESS_SCHEMA_NAME_KEY, String.class));
                 param.setStartUserName(MapUtil.get(variables, WorkflowConstant.PROCESS_START_USER_NAME_KEY, String.class));
                 // 默认强制推送微信消息
-                param.setNoticePolicyConfigs(new ArrayList(){{
+                param.setNoticePolicyConfigs(new ArrayList() {{
                     add(WorkflowNoticePolicyType.WECHAT.getCode());
                 }});
                 //超时消息

+ 2 - 0
src/main/java/com/xjrsoft/module/workflow/service/IWorkflowSchemaService.java

@@ -30,6 +30,8 @@ public interface IWorkflowSchemaService extends MPJBaseService<WorkflowSchema> {
      * @return
      */
     PageOutput<WorkflowSchemaPageVo>  getPage(WorkflowSchemaPageDto dto);
+
+    List<WorkflowSchemaPageVo>  getList(WorkflowSchemaPageDto dto);
     /**
      * 新增流程模板设计
      * @param dto

+ 55 - 1
src/main/java/com/xjrsoft/module/workflow/service/impl/WorkflowSchemaServiceImpl.java

@@ -57,6 +57,7 @@ import org.camunda.bpm.engine.repository.Deployment;
 import org.camunda.bpm.engine.repository.ProcessDefinition;
 import org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration;
 import org.camunda.commons.utils.IoUtil;
+import org.checkerframework.checker.units.qual.A;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
@@ -82,7 +83,7 @@ public class WorkflowSchemaServiceImpl extends MPJBaseServiceImpl<WorkflowSchema
 
     private final RepositoryService repositoryService;
 
-    private final SpringProcessEngineConfiguration processEngineConfiguration;
+//    private final SpringProcessEngineConfiguration processEngineConfiguration;
 
     private final WorkflowSchemaDraftMapper workflowSchemaDraftMapper;
 
@@ -146,6 +147,59 @@ public class WorkflowSchemaServiceImpl extends MPJBaseServiceImpl<WorkflowSchema
         return ConventPage.getPageOutput(page);
     }
 
+    public List<WorkflowSchemaPageVo> getList(WorkflowSchemaPageDto dto) {
+
+        SaSession tokenSession = StpUtil.getTokenSession();
+        List<Long> roleIds = tokenSession.get(GlobalConstant.LOGIN_USER_ROLE_ID_KEY, new ArrayList<>());
+        Post post = tokenSession.get(GlobalConstant.LOGIN_USER_POST_INFO_KEY, new Post());
+
+        List<Long> allSchemaId = new ArrayList<>();
+
+        //是否需要管控权限
+        if (dto.getIsAuth()) {
+            LambdaQueryWrapper<WorkflowSchemaAuth> query = Wrappers.lambdaQuery(WorkflowSchemaAuth.class)
+                    .eq(WorkflowSchemaAuth::getObjType, -1)
+                    .or(x -> x.eq(WorkflowSchemaAuth::getObjType, 2).in(WorkflowSchemaAuth::getObjId, post.getId()))
+                    .or(x -> x.eq(WorkflowSchemaAuth::getObjType, 1).in(WorkflowSchemaAuth::getObjId, roleIds))
+                    .or(x -> x.eq(WorkflowSchemaAuth::getObjType, 0).in(WorkflowSchemaAuth::getObjId, StpUtil.getLoginIdAsLong())
+                    );
+            List<WorkflowSchemaAuth> authList = workflowSchemaAuthService.list(query);
+            allSchemaId = authList.stream().map(WorkflowSchemaAuth::getSchemaId).collect(Collectors.toList());
+
+            if (CollectionUtil.isEmpty(allSchemaId)) {
+                //如果权限为空  返回空数组
+                PageOutput<WorkflowSchemaPageVo> pageOutput = new PageOutput<>();
+                pageOutput.setList(new ArrayList<>());
+                pageOutput.setCurrentPage(0);
+                pageOutput.setTotalPage(0);
+                pageOutput.setPageSize(0);
+                return new ArrayList<>();
+            }
+
+        }
+
+
+        //因为多表关联 会有多个表都使用了id字段,  所以必须专门指定主表的Id
+        List<String> orderList = new ArrayList<>();
+        orderList.add("category");orderList.add("id");
+        List<WorkflowSchemaPageVo> workflowSchemaPageVos = selectJoinList(WorkflowSchemaPageVo.class,
+                MPJWrappers.<WorkflowSchema>lambdaJoin()
+                        .disableSubLogicDel()
+                        .orderByDescStr(orderList)
+                        .eq(ObjectUtil.isNotNull(dto.getEnabledMark()), WorkflowSchema::getEnabledMark, dto.getEnabledMark())
+                        .like(StrUtil.isNotBlank(dto.getKeyword()), WorkflowSchema::getName, dto.getKeyword())
+                        .like(StrUtil.isNotBlank(dto.getName()), WorkflowSchema::getName, dto.getName())
+                        .like(StrUtil.isNotBlank(dto.getCode()), WorkflowSchema::getCode, dto.getCode())
+                        .eq(ObjectUtil.isNotNull(dto.getCategory()), WorkflowSchema::getCategory, dto.getCategory())
+                        .in(dto.getIsAuth() && CollectionUtil.isNotEmpty(allSchemaId), WorkflowSchema::getId, allSchemaId)
+                        .select(WorkflowSchema::getId)
+                        .select(WorkflowSchema.class, x -> VoToColumnUtil.fieldsToColumns(WorkflowSchemaPageVo.class).contains(x.getProperty()))
+                        .selectAs(DictionaryDetail::getName, WorkflowSchemaPageVo::getCategoryName)
+                        .leftJoin(DictionaryDetail.class, DictionaryDetail::getId, WorkflowSchema::getCategory));
+
+        return workflowSchemaPageVos;
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     @SneakyThrows