浏览代码

20221021
项目登记审批通过添加审批通过时间和审批人
自检类型管理和浏览审批类型管理上级节点数据筛选修改

sunruiqi 2 年之前
父节点
当前提交
7bea8089aa

+ 12 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/domain/ProgramProjectListInfo.java

@@ -315,4 +315,16 @@ public class ProgramProjectListInfo {
     @TableField(exist = false)
     @TableField(exist = false)
     private String procInsId4;
     private String procInsId4;
 
 
+    /**
+     * 审批通过时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date agreeTime;
+
+    /**
+     * 审批人
+     */
+    private String agreeUserId;
+
 }
 }

+ 12 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/service/dto/ProjectListDto.java

@@ -136,4 +136,16 @@ public class ProjectListDto extends BaseEntity {
 
 
     private List<WorkAttachmentDto> files;
     private List<WorkAttachmentDto> files;
 
 
+    /**
+     * 审批通过时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date agreeTime;
+
+    /**
+     * 审批人
+     */
+    private String agreeUserId;
+
 }
 }

+ 6 - 2
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/proofread/controller/ProofreadTypeController.java

@@ -3,6 +3,7 @@ package com.jeeplus.test.proofread.controller;
 import com.jeeplus.core.service.TreeService;
 import com.jeeplus.core.service.TreeService;
 import com.jeeplus.test.proofread.domain.ProofreadType;
 import com.jeeplus.test.proofread.domain.ProofreadType;
 import com.jeeplus.test.proofread.mapper.ProofreadTypeMapper;
 import com.jeeplus.test.proofread.mapper.ProofreadTypeMapper;
+import com.jeeplus.test.proofread.service.ProofreadTypeForTreeDataService;
 import com.jeeplus.test.proofread.service.ProofreadTypeService;
 import com.jeeplus.test.proofread.service.ProofreadTypeService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
@@ -23,6 +24,9 @@ public class ProofreadTypeController {
     @Resource
     @Resource
     private ProofreadTypeMapper mapper;
     private ProofreadTypeMapper mapper;
 
 
+    @Resource
+    private ProofreadTypeForTreeDataService treeDataService;
+
     /**
     /**
      * 列表查询
      * 列表查询
      * @param type
      * @param type
@@ -78,8 +82,8 @@ public class ProofreadTypeController {
      */
      */
     @ApiOperation(value = "查询树形")
     @ApiOperation(value = "查询树形")
     @GetMapping("/treeData")
     @GetMapping("/treeData")
-    public ResponseEntity<List<ProofreadType>> treeData(@RequestParam(required = false) String extId) throws Exception{
-        List<ProofreadType> infos = service.treeData(extId);
+    public ResponseEntity<List<ProofreadType>> treeData(@RequestParam(required = false) String extId, @RequestParam(required = false) String type) throws Exception{
+        List<ProofreadType> infos = treeDataService.treeDataForType(extId, type);
         return ResponseEntity.ok(infos);
         return ResponseEntity.ok(infos);
     }
     }
 
 

+ 107 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/proofread/service/ProofreadTypeForTreeDataService.java

@@ -0,0 +1,107 @@
+package com.jeeplus.test.proofread.service;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.core.service.TreeService;
+import com.jeeplus.core.service.dto.TreeDTO;
+import com.jeeplus.test.proofread.domain.ProofreadType;
+import com.jeeplus.test.proofread.mapper.ProofreadTypeMapper;
+import com.jeeplus.test.reimbursement.reimbursementType.domain.ReimbursementTypeInfo;
+import com.jeeplus.test.reimbursement.reimbursementType.mapper.ReimbursementTypeMapper;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class ProofreadTypeForTreeDataService extends TreeService<ProofreadTypeMapper, ProofreadType> {
+
+    /**
+     * 获取JSON树形数据。
+     *
+     * @param extId 排除的ID
+     * @param type 禁选类型
+     * @return
+     */
+    public List<ProofreadType> treeDataForType(String extId, String type) throws Exception{
+        List <ProofreadType> allList = super.list (new LambdaQueryWrapper<>( (Class <ProofreadType>) entityClass ).eq(ProofreadType::getType, type).orderByAsc ( ProofreadType::getSort ));
+        ProofreadType root = entityClass.getConstructor ( ).newInstance ( );
+        root.setId ( TreeDTO.getRootId () );
+        List <ProofreadType> rootTree = this.formatListToTreeForType ( root, allList, extId );
+        return rootTree;
+    }
+
+    /**
+     * 以root为根节点, 将allList从线性列表转为树形列表
+     *
+     * @param root    根节点, 为空抛出空指针异常
+     * @param allList 所有需要参与构造为树的列表
+     * @param extId   需要排除在树之外的节点(子节点一并被排除)
+     * @return java.util.List<T>
+     * @Author 滕鑫源
+     * @Date 2020/10/23 17:04
+     **/
+    public List <ProofreadType> formatListToTreeForType (ProofreadType root, List <ProofreadType> allList, String extId) {
+        String rootId = root.getId ( );
+        // 最终的树形态
+        List <ProofreadType> trees = Lists.newArrayList ( );
+
+        // 把需要构造树的所有列表, 根据以父id作为key, 整理为列表
+        Map<String, List <ProofreadType>> treeMap = Maps.newHashMap ( );
+        for (ProofreadType entity : allList) {
+            List <ProofreadType> entities = treeMap.get ( entity.getParentId ( ) );
+            if ( entities == null ) {
+                entities = Lists.newLinkedList ( );
+            }
+
+            // 剔除排除项, 构造treeMap, 转递归为线性操作
+            if ( StrUtil.isBlank ( extId ) || (!extId.equals ( entity.getId ( ) ) && entity.getParentIds ( ).indexOf ( "," + extId + "," ) == -1) ) {
+                entities.add ( entity );
+                treeMap.put ( entity.getParentId ( ), entities );
+            }
+
+        }
+
+        // 没有给定的子树, 返回空树
+        if ( treeMap.get ( rootId ) == null || treeMap.get ( rootId ).isEmpty ( ) ) {
+            return trees;
+        }
+
+        // 开始递归格式化
+        List <ProofreadType> children = treeMap.get ( rootId );
+        for (ProofreadType parent : children) {
+            formatFillChildren ( parent, treeMap );
+            trees.add ( parent );
+        }
+        if ( StrUtil.equals ( rootId, TreeDTO.getRootId () ) ) {
+            return children;
+        } else {
+            root.setChildren ( trees );
+            return Lists.newArrayList ( root );
+        }
+    }
+
+    /**
+     * 从treeMap中取出子节点填入parent, 并递归此操作
+     *
+     * @param parent
+     * @param treeMap
+     * @return void
+     * @Author 滕鑫源
+     * @Date 2020/9/30 16:33
+     **/
+    private void formatFillChildren(ProofreadType parent, Map <String, List <ProofreadType>> treeMap) {
+        List <ProofreadType> children = treeMap.get ( parent.getId ( ) );
+        parent.setChildren ( children );
+        if ( children != null && !children.isEmpty ( ) ) {
+            for (ProofreadType child : children) {
+                formatFillChildren ( child, treeMap );
+            }
+        }
+    }
+
+}