Prechádzať zdrojové kódy

流程,增加list

dzx 1 rok pred
rodič
commit
3d0bad9e7c

+ 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.getPage(dto));
+    }
+
 
     @PostMapping
     @ApiOperation(value = "新增流程模板")

+ 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