Ver código fonte

归档树相关调整

liuyc 3 anos atrás
pai
commit
9b121a4b10

+ 10 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/ArchiveTreeVO.java

@@ -39,35 +39,39 @@ import java.util.List;
 public class ArchiveTreeVO extends ArchiveTree implements INode<ArchiveTreeVO> {
     private static final long serialVersionUID = 1L;
 
-
     /**
      * 主键ID
      */
     @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "主键id")
     private Long id;
 
     /**
      * 父节点ID
      */
     @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "父级id")
     private Long parentId;
 
     /**
      * title
      */
     @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "节点名称")
     private String title;
 
     /**
      * 子孙节点
      */
     @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    @ApiModelProperty(value = "子孙节点")
     private List<ArchiveTreeVO> children;
 
     /**
      * 是否有子孙节点
      */
     @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    @ApiModelProperty(value = "是否有子孙节点")
     private Boolean hasChildren;
 
     @Override
@@ -81,26 +85,31 @@ public class ArchiveTreeVO extends ArchiveTree implements INode<ArchiveTreeVO> {
     /**
      * 内业资料类型(用于显示控制)
      */
+    @ApiModelProperty(value = "内业资料类型(用于显示控制)")
     private String majorDataType;
 
     /**
      * 显示层级(用于显示控制)
      */
+    @ApiModelProperty(value = "显示层级(用于显示控制)")
     private String displayHierarchy;
 
     /**
      * 是否为存储节点
      */
+    @ApiModelProperty(value = "是否为存储节点")
     private Integer isStorageNode;
 
     /**
      * 是否为显示树
      */
+    @ApiModelProperty(value = "是否为显示树")
     private Integer isUploadFileDisplayConfigurationTree;
 
     /**
      * 是否为竣工图 '0'否 '1'是
      */
+    @ApiModelProperty(value = "是否为竣工图 '0'否 '1'是")
     private Integer isBuiltDrawing;
 
 

+ 5 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ArchiveTreeController.java

@@ -44,7 +44,7 @@ public class ArchiveTreeController extends BladeController {
      */
     @PostMapping("/init")
     @ApiOperationSupport(order = 1)
-    @ApiOperation(value = "初始化归档树根节点")
+    @ApiOperation(value = "初始化归档树根节点", notes = "传入token")
     public R<ArchiveTree> init() {
         boolean b = archiveTreeService.initArchiveTree();
         if (b) {
@@ -96,11 +96,14 @@ public class ArchiveTreeController extends BladeController {
     @ApiOperationSupport(order = 5)
     @ApiOperation(value = "逻辑删除", notes = "传入id")
     public R remove(@ApiParam(value = "id", required = true) @RequestParam String id) {
-        List<ArchiveTree> archiveTrees = archiveTreeService.selectByParentId(id);
+        List<ArchiveTree> archiveTrees = archiveTreeService.selectByParentIdOrId(id);
         archiveTrees.stream().forEach(archiveTree -> {
             if (archiveTree.getParentId() == Long.parseLong(id)) {
                 throw new ServiceException("当前节点下存在子节点,删除失败");
             }
+            if (archiveTree.getIsUploadFileDisplayConfigurationTree() == 1) {
+                throw new ServiceException("当前节点被引用中,删除失败");
+            }
         });
         return R.status(archiveTreeService.deleteLogic(Func.toLongList(id)));
     }

+ 2 - 12
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ContractInfoController.java

@@ -16,27 +16,20 @@
  */
 package org.springblade.manager.controller;
 
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.nacos.common.utils.MD5Utils;
+
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.*;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
-
 import javax.validation.Valid;
-
 import org.apache.commons.lang.StringUtils;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
-import org.springblade.core.mp.utils.PageUtil;
-import org.springblade.core.secure.BladeUser;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.manager.dto.FindAllUserByConditionDTO;
 import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
 import org.springblade.manager.dto.WbsTreeContractDTO;
@@ -49,16 +42,13 @@ import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springblade.system.user.vo.UserVO2;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.DigestUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.RequestParam;
-
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.wrapper.ContractInfoWrapper;
 import org.springblade.manager.service.IContractInfoService;
 import org.springblade.core.boot.ctrl.BladeController;
-import sun.security.provider.MD5;
-import sun.security.provider.SHA;
+
 
 import java.util.*;
 

+ 0 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ProjectInfoController.java

@@ -17,7 +17,6 @@
 package org.springblade.manager.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import io.swagger.annotations.*;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
@@ -32,7 +31,6 @@ import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
 import org.springblade.manager.dto.WbsTreeContractDTO;
 import org.springblade.manager.dto.ProjectInfoDTO;
 import org.springblade.manager.entity.ContractInfo;
-import org.springblade.manager.entity.SaveUserInfoByProject;
 import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.service.*;
 import org.springblade.manager.vo.*;
@@ -43,7 +41,6 @@ import org.springblade.manager.wrapper.ProjectInfoWrapper;
 import org.springblade.core.boot.ctrl.BladeController;
 
 import java.util.List;
-import java.util.Map;
 
 /**
  * 客户级项目表 控制器

+ 1 - 13
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsFormElementController.java

@@ -19,38 +19,26 @@ package org.springblade.manager.controller;
 import io.swagger.annotations.*;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
-
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
-
 import org.springblade.core.excel.util.ExcelUtil;
-import org.springblade.core.mp.support.Condition;
 import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.support.Kv;
-import org.springblade.core.tool.utils.Func;
 import org.springblade.manager.dto.FormElementDTO;
 import org.springblade.manager.dto.WbsFormElementDTO;
 import org.springblade.manager.dto.WbsFormElementDTO2;
-import org.springblade.manager.dto.WbsTreeDTO2;
 import org.springblade.manager.entity.WbsFormElement;
-import org.springblade.manager.entity.WbsTree;
 import org.springblade.manager.excel.*;
 import org.springblade.manager.vo.WbsFormElementVO;
 import org.springblade.manager.vo.WbsFormElementVO2;
-import org.springblade.manager.vo.WbsTreeVO;
 import org.springblade.manager.wrapper.WbsFormElementWrapper;
-import org.springblade.manager.wrapper.WbsTreeWrapper;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springblade.manager.service.IWbsFormElementService;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springframework.web.multipart.MultipartFile;
-
-import java.io.File;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
+
 
 /**
  * wbs表单元素 控制器

+ 0 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsInfoController.java

@@ -25,15 +25,12 @@ import javax.validation.Valid;
 
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
-import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.manager.dto.WbsInfoDTO;
 import org.springblade.manager.entity.WbsInfo;
-import org.springblade.manager.entity.WbsTree;
 import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.mapper.WbsTreePrivateMapper;
-import org.springblade.manager.service.IWbsTreePrivateService;
 import org.springblade.manager.service.IWbsTreeService;
 import org.springblade.manager.vo.WbsInfoVO;
 import org.springframework.transaction.annotation.Transactional;

+ 0 - 6
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreePrivateController.java

@@ -11,10 +11,8 @@ import org.springblade.core.secure.BladeUser;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.support.Kv;
 import org.springblade.core.tool.utils.Func;
-import org.springblade.manager.dto.WbsTreeDTO2;
 import org.springblade.manager.dto.WbsTreePrivateDTO2;
 import org.springblade.manager.dto.WbsTreePrivateDTO3;
-import org.springblade.manager.entity.WbsTree;
 import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.mapper.WbsTreeContractMapper;
@@ -22,11 +20,7 @@ import org.springblade.manager.mapper.WbsTreePrivateMapper;
 import org.springblade.manager.service.IWbsTreePrivateService;
 import org.springblade.manager.vo.WbsNodeTableVO;
 import org.springblade.manager.vo.WbsTreePrivateVO;
-import org.springblade.manager.vo.WbsTreeVO;
 import org.springblade.manager.wrapper.WbsTreePrivateWrapper;
-import org.springblade.manager.wrapper.WbsTreeWrapper;
-import org.springblade.system.cache.DictCache;
-import org.springblade.system.enums.DictEnum;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IArchiveTreeService.java

@@ -40,7 +40,7 @@ public interface IArchiveTreeService extends BaseService<ArchiveTree> {
 
 	List<ArchiveTreeVO> tree(String tenantI,Integer disPlayTree,Integer nodeType);
 
-	List<ArchiveTree> selectByParentId(String id);
+	List<ArchiveTree> selectByParentIdOrId(String id);
 
     boolean submitDisplayConfigTree(String ids);
 }

+ 33 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeServiceImpl.java

@@ -90,9 +90,10 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
         archiveTree.setTenantId(AuthUtil.getTenantId());
         archiveTree.setParentId(0L);
         archiveTree.setAncestors(String.valueOf(0));
-        archiveTree.setNodeName("系统级归档");
-        archiveTree.setFullName("系统级归档");
+        archiveTree.setNodeName("系统级归档模板");
+        archiveTree.setFullName("系统级归档模板");
         archiveTree.setIsStorageNode(0);
+        archiveTree.setSort(0);
         if (AuthUtil.getUserId() != null && AuthUtil.getDeptId() != null) {
             archiveTree.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
             archiveTree.setCreateUser(AuthUtil.getUserId());
@@ -115,8 +116,12 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
     }
 
     @Override
-    public List<ArchiveTree> selectByParentId(String id) {
-        return baseMapper.selectList(Wrappers.<ArchiveTree>query().lambda().eq(ArchiveTree::getParentId, id));
+    public List<ArchiveTree> selectByParentIdOrId(String id) {
+        return baseMapper.selectList(Wrappers.<ArchiveTree>query().lambda()
+                .eq(ArchiveTree::getParentId, id)
+                .or()
+                .eq(ArchiveTree::getId, id)
+        );
     }
 
     @Override
@@ -178,7 +183,31 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
             //如果是电子原生文件,那么默认是存储节点
             archiveTreeDTO.setIsStorageNode(1);
         }
+
+        //新增节点默认排序
+        //获取当前同级节点List
+        if (archiveTreeDTO.getId() == null) {
+            List<ArchiveTree> trees = baseMapper.selectList(Wrappers.<ArchiveTree>query().lambda()
+                    .eq(ArchiveTree::getParentId, archiveTreeDTO.getParentId())
+            );
+            //判空
+            List<ArchiveTree> collect = trees.stream().filter(f -> {
+                if (f.getSort() == null) {
+                    f.setSort(0);
+                }
+                return true;
+            }).collect(Collectors.toList());
+            //获取最大Sort
+            Optional<ArchiveTree> max = collect.stream().max(Comparator.comparingInt(ArchiveTree::getSort));
+            Integer sort = 0;
+            if (max.isPresent()) {
+                sort = max.get().getSort();
+            }
+            archiveTreeDTO.setSort(sort + 1);
+        }
+
         return save(archiveTreeDTO);
     }
 
+
 }

+ 0 - 9
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -8,25 +8,16 @@ import org.springblade.business.entity.ConstructionLedger;
 import org.springblade.business.feign.ConstructionLedgerFeign;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.log.exception.ServiceException;
-import org.springblade.core.log.logger.BladeLogger;
 import org.springblade.core.mp.base.BaseServiceImpl;
-import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.node.ForestNodeMerger;
-import org.springblade.core.tool.utils.StringPool;
 import org.springblade.manager.dto.WbsTreeContractDTO;
-import org.springblade.manager.entity.WbsInfo;
-import org.springblade.manager.entity.WbsTree;
 import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.mapper.WbsInfoMapper;
 import org.springblade.manager.mapper.WbsTreeContractMapper;
 import org.springblade.manager.mapper.WbsTreePrivateMapper;
-import org.springblade.manager.service.IFormulaService;
 import org.springblade.manager.service.IWbsTreeContractService;
 import org.springblade.manager.vo.WbsTreeContractTreeVO;
-import org.springblade.manager.vo.WbsTreeContractTreeVO2;
-import org.springblade.manager.vo.WbsTreeContractVO2;
-import org.springblade.manager.vo.WbsTreeVO;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 

+ 0 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

@@ -13,7 +13,6 @@ import org.springblade.manager.dto.WbsTreePrivateDTO2;
 import org.springblade.manager.dto.WbsTreePrivateDTO3;
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.entity.WbsInfo;
-import org.springblade.manager.entity.WbsTree;
 import org.springblade.manager.entity.WbsTreePrivate;
 
 import org.springblade.manager.mapper.ContractInfoMapper;
@@ -26,7 +25,6 @@ import org.springblade.manager.vo.WbsTreePrivateVO;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Optional;

+ 0 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeServiceImpl.java

@@ -57,7 +57,6 @@ import java.io.File;
 import java.io.IOException;
 import java.util.*;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 /**
  * 服务实现类