Quellcode durchsuchen

10/28 xx 产品、产品类别、产品架构、产品类别架构 基本框架搭建 与文件关联框架的搭建

xiexiang vor 1 Jahr
Ursprung
Commit
a0308b9ee6

+ 48 - 0
src/main/java/cn/cslg/pas/domain/business/AssoProductCategoryFile.java

@@ -0,0 +1,48 @@
+package cn.cslg.pas.domain.business;
+
+import cn.cslg.pas.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import org.joda.time.DateTime;
+
+/**
+ * 产品类别与文件关联表
+ * @Author xiexiang
+ * @Date 2023/10/28
+ */
+@Data
+@TableName("asso_product_category_file")
+/* 数据库中的表对应的类
+ */
+public class AssoProductCategoryFile extends BaseEntity<AssoProductCategoryFile> {
+    /**
+     * 主键id
+     */
+    @TableField(value = "id")
+    private Integer id;
+
+    /**
+     * 产品类别id
+     */
+    @TableField(value = "product_category_id")
+    private Integer productCategoryId;
+
+    /**
+     * 图片文件guid
+     */
+    @TableField(value = "file_guid")
+    private String fileGuid;
+
+    /**
+     * 创建人
+     */
+    @TableField(value = "create_id")
+    private Integer createId;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private DateTime createTime;
+}

+ 19 - 0
src/main/java/cn/cslg/pas/domain/business/AssoProductFile.java

@@ -18,14 +18,33 @@ import org.joda.time.DateTime;
 /* 数据库中的表对应的类
  */
 public class AssoProductFile extends BaseEntity<AssoProductFile> {
+    /**
+     * 主键
+     */
     @TableField(value = "id")
     private Integer id;
+
+    /**
+     * 产品id
+     */
     @TableField(value = "product_id")
     private Integer productId;
+
+    /**
+     * 图片
+     */
     @TableField(value = "file_guid")
     private String fileGuid;
+
+    /**
+     * 创建人
+     */
     @TableField(value = "create_id")
     private Integer createId;
+
+    /**
+     * 创建时间
+     */
     @TableField(value = "create_time")
     private DateTime createTime;
 }

+ 48 - 0
src/main/java/cn/cslg/pas/domain/business/AssoTreeNodeFile.java

@@ -0,0 +1,48 @@
+package cn.cslg.pas.domain.business;
+
+import cn.cslg.pas.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import org.joda.time.DateTime;
+
+/**
+ * 架构与文件关联表
+ * @Author xiexiang
+ * @Date 2023/10/28
+ */
+@Data
+@TableName("asso_tree_node_file")
+/* 数据库中的表对应的类
+ */
+public class AssoTreeNodeFile extends BaseEntity<AssoProductFile> {
+    /**
+     * 主键
+     */
+    @TableField(value = "id")
+    private Integer id;
+
+    /**
+     * 树节点id
+     */
+    @TableField(value = "tree_node_id")
+    private Integer treeNodeId;
+
+    /**
+     * 图片
+     */
+    @TableField(value = "file_guid")
+    private String fileGuid;
+
+    /**
+     * 创建人
+     */
+    @TableField(value = "create_id")
+    private Integer createId;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private DateTime createTime;
+}

+ 14 - 0
src/main/java/cn/cslg/pas/mapper/AssoProductCategoryFileMapper.java

@@ -0,0 +1,14 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.business.AssoProductCategoryFile;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 产品类别与文件关联Mapper层
+ * @Author xiexiang
+ * @Date 2023/10/28
+ */
+@Repository
+public interface AssoProductCategoryFileMapper extends BaseMapper<AssoProductCategoryFile> {
+}

+ 14 - 0
src/main/java/cn/cslg/pas/mapper/AssoTreeNodeFileMapper.java

@@ -0,0 +1,14 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.business.AssoTreeNodeFile;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 架构与文件关联Mapper
+ * @Author xiexiang
+ * @Date 2023/10/28
+ */
+@Repository
+public interface AssoTreeNodeFileMapper extends BaseMapper<AssoTreeNodeFile> {
+}

+ 15 - 0
src/main/java/cn/cslg/pas/service/business/AssoProductCategoryFileService.java

@@ -0,0 +1,15 @@
+package cn.cslg.pas.service.business;
+
+import cn.cslg.pas.domain.business.AssoProductCategoryFile;
+import cn.cslg.pas.mapper.AssoProductCategoryFileMapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 产品类别与文件关联Service层
+ * @Author xiexiang
+ * @Date 2023/10/28
+ */
+@Service
+public class AssoProductCategoryFileService extends ServiceImpl<AssoProductCategoryFileMapper, AssoProductCategoryFile> {
+}

+ 15 - 0
src/main/java/cn/cslg/pas/service/business/AssoTreeNodeFileService.java

@@ -0,0 +1,15 @@
+package cn.cslg.pas.service.business;
+
+import cn.cslg.pas.domain.business.AssoTreeNodeFile;
+import cn.cslg.pas.mapper.AssoTreeNodeFileMapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 架构与文件关联Service层
+ * @Author xiexiang
+ * @Date 2023/10/28
+ */
+@Service
+public class AssoTreeNodeFileService extends ServiceImpl<AssoTreeNodeFileMapper, AssoTreeNodeFile> {
+}

+ 121 - 8
src/main/java/cn/cslg/pas/service/business/ProductCategoryService.java

@@ -2,22 +2,32 @@ package cn.cslg.pas.service.business;
 
 import cn.cslg.pas.common.dto.business.ProductCategoryDTO;
 import cn.cslg.pas.common.model.cronModel.GroupVO;
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
 import cn.cslg.pas.common.model.request.GroupRequest;
 import cn.cslg.pas.common.model.request.QueryRequest;
+import cn.cslg.pas.common.utils.CacheUtils;
+import cn.cslg.pas.common.utils.LoginUtils;
+import cn.cslg.pas.domain.business.AssoProductCategoryFile;
 import cn.cslg.pas.domain.business.ProductCategory;
+import cn.cslg.pas.exception.UnLoginException;
 import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.factorys.businessFactory.Business;
 import cn.cslg.pas.mapper.ProductCategoryMapper;
 
+import cn.cslg.pas.service.common.FileManagerService;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 产品类别的Service层
@@ -30,17 +40,36 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
     @Autowired
     private ProductCategoryMapper productCategoryMapper;
 
+    @Autowired
+    private FileManagerService fileManagerService;
+
+    @Autowired
+    private AssoProductCategoryFileService assoProductCategoryFileService;
+
+    @Autowired
+    private CacheUtils cacheUtils;
+
+    @Autowired
+    private LoginUtils loginUtils;
+
     @Override
     public Object queryMessage(QueryRequest queryRequest) throws Exception {
         return null;
     }
 
+    /**
+     * 新增产品类别
+     * @param object
+     * @param files
+     * @return
+     */
     @Override
     public Object addMessage(Object object, List<MultipartFile> files) {
-        //object to productCategory
+        //object to productCategoryDTO
         ProductCategoryDTO productCategoryDTO = (ProductCategoryDTO)object;
-        //检测名成
+        //检测名称是否不规范
         productCategoryDTO.setName(productCategoryDTO.getName().trim());
+        //根据名称查询数据库中是否存在
         String name = productCategoryDTO.getName();
         LambdaQueryWrapper<ProductCategory> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(ProductCategory::getName, name);
@@ -48,30 +77,114 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
         if(productCategories != null && productCategories.size() != 0){
             throw new XiaoShiException("参数错误");
         }
-        //赋值
+        //获取登陆人信息 用于设置创建人
+        PersonnelVO personnelVO = new PersonnelVO();
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        } catch (Exception e) {
+            throw new UnLoginException("未登录");
+        }
+        //产品类别入表
         ProductCategory productCategory = new ProductCategory();
         BeanUtils.copyProperties(productCategoryDTO, productCategory);
-        //数据入表
         productCategory.insert();
+        //判断文件是否为空
+        if (files != null && files.size() != 0) {
+            try {
+                //调用上传文件接口
+                List<String> guids = fileManagerService.uploadFileGetGuid(files);
+                List<AssoProductCategoryFile> assoProductCategoryFiles = new ArrayList<>();
+                for (String item : guids) {
+                    AssoProductCategoryFile assoProductCategoryFile = new AssoProductCategoryFile();
+                    assoProductCategoryFile.setProductCategoryId(productCategory.getId());
+                    assoProductCategoryFile.setFileGuid(item);
+                    assoProductCategoryFile.setCreateId(personnelVO.getId());
+                    assoProductCategoryFiles.add(assoProductCategoryFile);
+                }
+                if (assoProductCategoryFiles != null && assoProductCategoryFiles.size() != 0) {
+                    assoProductCategoryFileService.saveBatch(assoProductCategoryFiles);
+                }
+            } catch (Exception e) {
 
+            }
+        }
         //返回id
         return productCategory.getId();
     }
 
+    /**
+     * 删除产品类别
+     * @param ids
+     * @return
+     */
     @Override
-    public Object deleteMessage(List<Integer> ids) {
-        this.removeByIds(ids);
-        return null;
+    @Transactional(rollbackFor = Exception.class)
+    public Object deleteMessage(List<Integer> ids) throws IOException {
+        //根据产品类别id删除产品类别和文件关联表
+        LambdaQueryWrapper<AssoProductCategoryFile> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.in(AssoProductCategoryFile::getProductCategoryId, ids);
+        List<AssoProductCategoryFile> assoProductCategoryFiles = assoProductCategoryFileService.list(queryWrapper);
+        List<String> guids = assoProductCategoryFiles.stream().map(AssoProductCategoryFile::getFileGuid).collect(Collectors.toList());
+        //TODO 根据guids删除文件
+        if (guids.size() != 0) {
+            fileManagerService.deleteFileFromFMS(guids);
+        }
+        //删除产品类别和文件关联表中数据
+        assoProductCategoryFiles.remove(queryWrapper);
+        //根据产品类别id删除产品类别
+        this.removeBatchByIds(ids);
+        return ids;
     }
 
+    /**
+     * 更新产品类别
+     * @param object
+     * @param files
+     * @return
+     */
     @Override
     public Object updateMessage(Object object, List<MultipartFile> files) {
         //object to productCategory
         ProductCategoryDTO productCategoryDTO = (ProductCategoryDTO)object;
+        //检测名称是否不规范
+        productCategoryDTO.setName(productCategoryDTO.getName().trim());
+        //根据名称查询数据库中是否存在
+        String name = productCategoryDTO.getName();
+        LambdaQueryWrapper<ProductCategory> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(ProductCategory::getName, name);
+        List<ProductCategory> productCategories = this.list(queryWrapper);
+        if (productCategories == null && productCategories.size() == 0) {
+            return null;
+        }
+        //获取登陆人信息 用于设置创建人
+        PersonnelVO personnelVO;
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        } catch (Exception e) {
+            throw new UnLoginException("未登录");
+        }
         ProductCategory productCategory = this.getById(productCategoryDTO.getId());
         BeanUtils.copyProperties(productCategoryDTO, productCategory);
         productCategory.insert();
-        return null;
+        if (files != null && files.size() != 0) {
+            try {
+                List<String> guids = fileManagerService.uploadFileGetGuid(files);
+                List<AssoProductCategoryFile> assoProductCategoryFiles = new ArrayList<>();
+                for (String item : guids) {
+                    AssoProductCategoryFile assoProductCategoryFile = new AssoProductCategoryFile();
+                    assoProductCategoryFile.setProductCategoryId(productCategory.getId());
+                    assoProductCategoryFile.setFileGuid(item);
+                    assoProductCategoryFile.setCreateId(personnelVO.getId());
+                    assoProductCategoryFiles.add(assoProductCategoryFile);
+                }
+                if (assoProductCategoryFiles != null && assoProductCategoryFiles.size() != 0) {
+                    assoProductCategoryFileService.saveBatch(assoProductCategoryFiles);
+                }
+            } catch (Exception e) {
+
+            }
+        }
+        return productCategory.getId();
     }
 
     @Override

+ 56 - 14
src/main/java/cn/cslg/pas/service/business/ProductService.java

@@ -2,10 +2,14 @@ package cn.cslg.pas.service.business;
 
 import cn.cslg.pas.common.dto.business.ProductDTO;
 import cn.cslg.pas.common.model.cronModel.GroupVO;
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
 import cn.cslg.pas.common.model.request.GroupRequest;
 import cn.cslg.pas.common.model.request.QueryRequest;
+import cn.cslg.pas.common.utils.CacheUtils;
+import cn.cslg.pas.common.utils.LoginUtils;
 import cn.cslg.pas.domain.business.AssoProductFile;
 import cn.cslg.pas.domain.business.Product;
+import cn.cslg.pas.exception.UnLoginException;
 import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.factorys.businessFactory.Business;
 import cn.cslg.pas.mapper.ProductMapper;
@@ -19,6 +23,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -38,11 +43,23 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> implemen
     @Autowired
     private AssoProductFileService assoProductFileService;
 
+    @Autowired
+    private CacheUtils cacheUtils;
+
+    @Autowired
+    private LoginUtils loginUtils;
+
     @Override
     public Object queryMessage(QueryRequest queryRequest) throws Exception {
         return null;
     }
 
+    /**
+     * 新增产品
+     * @param object
+     * @param files
+     * @return
+     */
     @Override
     public Integer addMessage(Object object, List<MultipartFile> files) {
         ProductDTO productDTO = (ProductDTO) object;
@@ -55,6 +72,13 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> implemen
         if (products != null && products.size() != 0) {
             throw new XiaoShiException("参数错误");
         }
+        //获取登陆人信息 用于设置创建人
+        PersonnelVO personnelVO = new PersonnelVO();
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        } catch (Exception e) {
+            throw new UnLoginException("未登录");
+        }
         //产品入库
         Product product = new Product();
         BeanUtils.copyProperties(productDTO, product);
@@ -63,13 +87,13 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> implemen
             try {
                 List<String> guids = fileManagerService.uploadFileGetGuid(files);
                 List<AssoProductFile> assoProductFiles = new ArrayList<>();
-                guids.forEach(item -> {
+                for (String item : guids) {
                     AssoProductFile assoProductFile = new AssoProductFile();
                     assoProductFile.setProductId(product.getId());
                     assoProductFile.setFileGuid(item);
-                    assoProductFile.setCreateId(1);
+                    assoProductFile.setCreateId(personnelVO.getId());
                     assoProductFiles.add(assoProductFile);
-                });
+                }
                 if (assoProductFiles != null && assoProductFiles.size() != 0) {
                     assoProductFileService.saveBatch(assoProductFiles);
                 }
@@ -80,32 +104,43 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> implemen
         return product.getId();
     }
 
+    /**
+     * 删除产品
+     * @param ids
+     * @return
+     */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Object deleteMessage(List<Integer> ids) {
-        //根据产品id删除产品
-        this.removeBatchByIds(ids);
+    public Object deleteMessage(List<Integer> ids) throws IOException {
         //根据产品id删除产品和文件关联
         LambdaQueryWrapper<AssoProductFile> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.in(AssoProductFile::getProductId, ids);
         List<AssoProductFile> assoProductFiles = assoProductFileService.list(queryWrapper);
         List<String> guids = assoProductFiles.stream().map(AssoProductFile::getFileGuid).collect(Collectors.toList());
         //TODO 根据guid删除文件
-        try {
+        if (guids.size() != 0) {
             fileManagerService.deleteFileFromFMS(guids);
-        } catch (Exception e) {
-            throw new XiaoShiException("调用删除接口错误");
         }
         //删除产品和文件关联表
         assoProductFiles.remove(queryWrapper);
+        //根据产品id删除产品
+        this.removeBatchByIds(ids);
         return ids;
     }
 
+    /**
+     * 更新产品
+     * @param object
+     * @param files
+     * @return
+     */
     @Override
     public Object updateMessage(Object object, List<MultipartFile> files) {
-        //object to productDTO
+        //object to product
         ProductDTO productDTO = (ProductDTO) object;
+        //检测名称是否不规范
         productDTO.setName(productDTO.getName().trim());
+        //根据名称查询数据库中是否存在
         String name = productDTO.getName();
         LambdaQueryWrapper<Product> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(Product::getName, name);
@@ -113,20 +148,27 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> implemen
         if(products == null || products.size() == 0){
             return null;
         }
-        Product product = new Product();
+        //获取登陆人信息 用于设置创建人
+        PersonnelVO personnelVO;
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        } catch (Exception e) {
+            throw new UnLoginException("未登录");
+        }
+        Product product = this.getById(productDTO.getId());
         BeanUtils.copyProperties(productDTO, product);
         product.insert();
         if (files != null && files.size() != 0) {
             try {
                 List<String> guids = fileManagerService.uploadFileGetGuid(files);
                 List<AssoProductFile> assoProductFiles = new ArrayList<>();
-                guids.forEach(item -> {
+                for (String item : guids) {
                     AssoProductFile assoProductFile = new AssoProductFile();
                     assoProductFile.setProductId(product.getId());
                     assoProductFile.setFileGuid(item);
-                    assoProductFile.setCreateId(1);
+                    assoProductFile.setCreateId(personnelVO.getId());
                     assoProductFiles.add(assoProductFile);
-                });
+                }
                 if (assoProductFiles != null && assoProductFiles.size() != 0) {
                     assoProductFileService.saveBatch(assoProductFiles);
                 }

+ 137 - 5
src/main/java/cn/cslg/pas/service/business/TreeNodeService.java

@@ -2,19 +2,32 @@ package cn.cslg.pas.service.business;
 
 import cn.cslg.pas.common.dto.business.TreeNodeDTO;
 import cn.cslg.pas.common.model.cronModel.GroupVO;
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
 import cn.cslg.pas.common.model.request.GroupRequest;
 import cn.cslg.pas.common.model.request.QueryRequest;
+import cn.cslg.pas.common.utils.CacheUtils;
+import cn.cslg.pas.common.utils.LoginUtils;
+import cn.cslg.pas.domain.business.AssoTreeNodeFile;
 import cn.cslg.pas.domain.business.TreeNode;
+import cn.cslg.pas.exception.UnLoginException;
+import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.factorys.businessFactory.Business;
 import cn.cslg.pas.mapper.TreeNodeMapper;
+import cn.cslg.pas.service.common.FileManagerService;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
+import org.antlr.v4.runtime.tree.Tree;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 架构的Service层
@@ -27,38 +40,157 @@ public class TreeNodeService extends ServiceImpl<TreeNodeMapper, TreeNode> imple
     @Autowired
     private TreeNodeMapper treeNodeMapper;
 
+    @Autowired
+    private AssoTreeNodeFileService assoTreeNodeFileService;
+
+    @Autowired
+    private FileManagerService fileManagerService;
+
+    @Autowired
+    private CacheUtils cacheUtils;
+
+    @Autowired
+    private LoginUtils loginUtils;
+
     @Override
     public Object queryMessage(QueryRequest queryRequest) throws Exception {
         return null;
     }
 
+    /**
+     * 新增架构
+     * @param object
+     * @param files
+     * @return
+     */
     @Override
     public Object addMessage(Object object, List<MultipartFile> files) {
         //object to treeNode
         TreeNodeDTO treeNodeDTO = (TreeNodeDTO)object;
+        //获取登录人信息
+        PersonnelVO personnelVO =new PersonnelVO();
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        }
+        catch (Exception e)
+        {
+            throw  new UnLoginException("未登录");
+        }
+        treeNodeDTO.setName(treeNodeDTO.getName().trim());
+        //根据名称查询是否重复
+        String name = treeNodeDTO.getName();
+        LambdaQueryWrapper<TreeNode> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(TreeNode::getName, name);
+        List<TreeNode> treeNodes = this.list(queryWrapper);
+        if(treeNodes != null && treeNodes.size() != 0){
+            throw new XiaoShiException("参数错误");
+        }
         //赋值
         TreeNode treeNode = new TreeNode();
         BeanUtils.copyProperties(treeNodeDTO, treeNode);
+        treeNode.setCreateId(personnelVO.getId());
         //数据入表
         treeNode.insert();
+        //处理文件
+        if(files != null && files.size() != 0){
+            try {
+                List<String> guids = fileManagerService.uploadFileGetGuid(files);
+                List<AssoTreeNodeFile> assoTreeNodeFiles = new ArrayList<>();
+                    for(String item:guids){
+                        AssoTreeNodeFile assoTreeNodeFile = new AssoTreeNodeFile();
+                        assoTreeNodeFile.setTreeNodeId(treeNode.getId());
+                        assoTreeNodeFile.setFileGuid(item);
+                        assoTreeNodeFile.setCreateId(personnelVO.getId());
+                        assoTreeNodeFiles.add(assoTreeNodeFile);
+                    }
+                    if(assoTreeNodeFiles != null && assoTreeNodeFiles.size() != 0){
+                        assoTreeNodeFileService.saveBatch(assoTreeNodeFiles);
+                    }
+            } catch (Exception e) {
+
+            }
+        }
         //返回id
         return treeNode.getId();
     }
 
+    /**
+     * 删除架构
+     * @param ids
+     * @return
+     */
     @Override
-    public Object deleteMessage(List<Integer> ids) {
-        this.removeByIds(ids);
-        return null;
+    @Transactional(rollbackFor = Exception.class)
+    public Object deleteMessage(List<Integer> ids) throws IOException {
+        //根据架构id删除架构和文件关联
+        LambdaQueryWrapper<AssoTreeNodeFile> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.in(AssoTreeNodeFile::getTreeNodeId, ids);
+        List<AssoTreeNodeFile> assoTreeNodeFiles = assoTreeNodeFileService.list(queryWrapper);
+        List<String> guids = assoTreeNodeFiles.stream().map(AssoTreeNodeFile::getFileGuid).collect(Collectors.toList());
+        //TODO 根据guids删除文件
+        if(guids.size() != 0){
+            fileManagerService.deleteFileFromFMS(guids);
+        }
+        //删除架构和文件关联表
+        assoTreeNodeFiles.remove(queryWrapper);
+        //根据架构id删除架构数据
+        this.removeBatchByIds(ids);
+        return ids;
     }
 
+    /**
+     * 更新架构
+     * @param object
+     * @param files
+     * @return
+     */
     @Override
     public Object updateMessage(Object object, List<MultipartFile> files) {
         //object to treeNode
-        TreeNodeDTO treeNodeDTO = (TreeNodeDTO) object;
+        TreeNodeDTO treeNodeDTO = (TreeNodeDTO)object;
+        //获取登录人信息
+        PersonnelVO personnelVO;
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        } catch (Exception e) {
+            throw  new UnLoginException("未登录");
+        }
+        treeNodeDTO.setName(treeNodeDTO.getName().trim());
+        //根据名称查询是否重复
+        String name = treeNodeDTO.getName();
+        LambdaQueryWrapper<TreeNode> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(TreeNode::getName, name);
+        List<TreeNode> treeNodes = this.list(queryWrapper);
+        if(treeNodes == null && treeNodes.size() == 0){
+            return null;
+        }
+        //赋值
         TreeNode treeNode = this.getById(treeNodeDTO.getId());
         BeanUtils.copyProperties(treeNodeDTO, treeNode);
+        treeNode.setCreateId(personnelVO.getId());
+        //数据入表
         treeNode.insert();
-        return null;
+        //处理文件
+        if(files != null && files.size() != 0){
+            try {
+                List<String> guids = fileManagerService.uploadFileGetGuid(files);
+                List<AssoTreeNodeFile> assoTreeNodeFiles = new ArrayList<>();
+                for(String item:guids){
+                    AssoTreeNodeFile assoTreeNodeFile = new AssoTreeNodeFile();
+                    assoTreeNodeFile.setTreeNodeId(treeNode.getId());
+                    assoTreeNodeFile.setFileGuid(item);
+                    assoTreeNodeFile.setCreateId(personnelVO.getId());
+                    assoTreeNodeFiles.add(assoTreeNodeFile);
+                }
+                if(assoTreeNodeFiles != null && assoTreeNodeFiles.size() != 0){
+                    assoTreeNodeFileService.saveBatch(assoTreeNodeFiles);
+                }
+            } catch (Exception e) {
+
+            }
+        }
+        //返回id
+        return treeNode.getId();
     }
 
     @Override