Browse Source

PC端新增商品文档管理
PC端商品库增加商品文档处理逻辑
PC端商品增加商品文档处理逻辑
APP端增加接口获取商品文档

FengChaoYu 1 day ago
parent
commit
9a89cbcd34
26 changed files with 515 additions and 82 deletions
  1. 19 0
      mall-miniapp-service/src/main/java/com/gree/mall/miniapp/bean/goods/GoodsDocumentsRelaBean.java
  2. 4 0
      mall-miniapp-service/src/main/java/com/gree/mall/miniapp/commonmapper/AppMapper.java
  3. 13 5
      mall-miniapp-service/src/main/java/com/gree/mall/miniapp/controller/goods/GoodsController.java
  4. 42 9
      mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/goods/GoodsLogic.java
  5. 9 0
      mall-miniapp-service/src/main/resources/mapper/AppMapper.xml
  6. 2 2
      mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsAdviceNoticeVO.java
  7. 2 1
      mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsBean.java
  8. 19 0
      mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsDocumentsBean.java
  9. 19 0
      mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsDocumentsRelaBean.java
  10. 36 0
      mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsDocumentsVO.java
  11. 2 0
      mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsLibraryBean.java
  12. 19 0
      mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsLibraryDocumentsRelaBean.java
  13. 2 0
      mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsSpecBean.java
  14. 9 0
      mall-server-api/src/main/java/com/gree/mall/manager/commonmapper/CommonMapper.java
  15. 2 2
      mall-server-api/src/main/java/com/gree/mall/manager/commonmapper/CustomGoodsCategoryMapper.java
  16. 2 1
      mall-server-api/src/main/java/com/gree/mall/manager/constant/Constant.java
  17. 0 4
      mall-server-api/src/main/java/com/gree/mall/manager/controller/goods/GoodsAdviceNoticeController.java
  18. 13 13
      mall-server-api/src/main/java/com/gree/mall/manager/controller/goods/GoodsCategoryController.java
  19. 74 0
      mall-server-api/src/main/java/com/gree/mall/manager/controller/goods/GoodsDocumentsController.java
  20. 2 4
      mall-server-api/src/main/java/com/gree/mall/manager/logic/goods/GoodsAdviceNoticeLogic.java
  21. 16 20
      mall-server-api/src/main/java/com/gree/mall/manager/logic/goods/GoodsCategoryLogic.java
  22. 91 0
      mall-server-api/src/main/java/com/gree/mall/manager/logic/goods/GoodsDocumentsLogic.java
  23. 44 18
      mall-server-api/src/main/java/com/gree/mall/manager/logic/goods/GoodsLibraryLogic.java
  24. 47 2
      mall-server-api/src/main/java/com/gree/mall/manager/logic/goods/GoodsLogic.java
  25. 23 0
      mall-server-api/src/main/resources/mapper/CommonMapper.xml
  26. 4 1
      mall-server-api/src/main/resources/mapper/CustomGoodsCategoryMapper.xml

+ 19 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/bean/goods/GoodsDocumentsRelaBean.java

@@ -0,0 +1,19 @@
+package com.gree.mall.miniapp.bean.goods;
+
+import com.gree.mall.miniapp.plus.entity.GoodsDocumentsRela;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ApiModel
+public class GoodsDocumentsRelaBean extends GoodsDocumentsRela {
+
+    @ApiModelProperty(value = "文件名称")
+    private String fileName;
+
+    @ApiModelProperty(value = "文件地址")
+    private String url;
+}

+ 4 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/commonmapper/AppMapper.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.gree.mall.miniapp.bean.goods.GoodsNewBean;
 import com.gree.mall.miniapp.bean.order.OrderStatusBean;
 import com.gree.mall.miniapp.bean.order.ShoppingCartList;
+import com.gree.mall.miniapp.plus.entity.CommonFile;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -14,6 +15,9 @@ import java.util.List;
 @Mapper
 public interface AppMapper {
 
+    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
+    List<CommonFile> findCommonFileById(@Param("ids") List<String> ids);
+
     /**
      * 查询购物车的商品清单
      * @param userId

+ 13 - 5
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/controller/goods/GoodsController.java

@@ -3,16 +3,16 @@ package com.gree.mall.miniapp.controller.goods;
 import cn.hutool.extra.qrcode.QrCodeUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.gree.mall.miniapp.annotation.ApiNotAuth;
-import com.gree.mall.miniapp.bean.goods.*;
-import com.gree.mall.miniapp.bean.user.UserWxBean;
+import com.gree.mall.miniapp.bean.goods.CategoryBean;
+import com.gree.mall.miniapp.bean.goods.GoodsBean;
+import com.gree.mall.miniapp.bean.goods.GoodsDocumentsRelaBean;
+import com.gree.mall.miniapp.bean.goods.GoodsNewBean;
 import com.gree.mall.miniapp.constant.Constant;
-import com.gree.mall.miniapp.enums.QrCodeEnum;
 import com.gree.mall.miniapp.exception.RemoteServiceException;
 import com.gree.mall.miniapp.helper.ResponseHelper;
 import com.gree.mall.miniapp.logic.common.outside.WechatLogic;
 import com.gree.mall.miniapp.logic.goods.CategoryLogic;
 import com.gree.mall.miniapp.logic.goods.GoodsLogic;
-import com.gree.mall.miniapp.bean.goods.GoodsBean;
 import com.gree.mall.miniapp.logic.user.UserLogic;
 import com.gree.mall.miniapp.plus.entity.Brand;
 import com.gree.mall.miniapp.plus.entity.Goods;
@@ -22,7 +22,6 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.integration.redis.util.RedisLockRegistry;
 import org.springframework.web.bind.annotation.*;
@@ -206,4 +205,13 @@ public class GoodsController {
         }
     }
 
+    @PostMapping("/documents")
+    @ApiOperation("商品文档")
+    public ResponseHelper<List<GoodsDocumentsRelaBean>> documents(
+            @ApiParam(value = "商品id",required = true) @RequestParam String goodsId
+    ) {
+        List<GoodsDocumentsRelaBean> list = goodsLogic.documents(goodsId);
+        return ResponseHelper.success(list);
+    }
+
 }

+ 42 - 9
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/goods/GoodsLogic.java

@@ -1,20 +1,21 @@
 package com.gree.mall.miniapp.logic.goods;
 
-import com.baomidou.mybatisplus.core.toolkit.IdWorker;
-import com.gree.mall.miniapp.logic.common.outside.WechatLogic;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.gree.mall.miniapp.logic.promotion.PromotionFullPieceLogic;
-import org.apache.commons.lang3.StringUtils;
+import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.gree.mall.miniapp.bean.goods.*;
+import com.gree.mall.miniapp.bean.goods.GoodsBean;
+import com.gree.mall.miniapp.bean.goods.GoodsDocumentsRelaBean;
+import com.gree.mall.miniapp.bean.goods.GoodsNewBean;
+import com.gree.mall.miniapp.bean.goods.GoodsSpecSecBean;
 import com.gree.mall.miniapp.bean.user.CurrentCompanyWechat;
+import com.gree.mall.miniapp.commonmapper.AppMapper;
 import com.gree.mall.miniapp.commonmapper.GoodsSpecDetailMapper;
 import com.gree.mall.miniapp.constant.Constant;
-import com.gree.mall.miniapp.enums.QrCodeEnum;
-import com.gree.mall.miniapp.enums.UserTypeEnum;
 import com.gree.mall.miniapp.exception.RemoteServiceException;
 import com.gree.mall.miniapp.logic.common.CommonLogic;
+import com.gree.mall.miniapp.logic.common.outside.WechatLogic;
+import com.gree.mall.miniapp.logic.promotion.PromotionFullPieceLogic;
 import com.gree.mall.miniapp.plus.entity.*;
 import com.gree.mall.miniapp.plus.service.*;
 import org.springframework.beans.BeanUtils;
@@ -24,9 +25,9 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 
@@ -68,6 +69,10 @@ public class GoodsLogic {
     GoodsAdviceNoticeService goodsAdviceNoticeService;
     @Resource
     GoodsAdviceNoticeItemService goodsAdviceNoticeItemService;
+    @Resource
+    GoodsDocumentsRelaService goodsDocumentsRelaService;
+    @Resource
+    AppMapper appMapper;
 
     /**
      * 商品列表
@@ -314,4 +319,32 @@ public class GoodsLogic {
             throw new RemoteServiceException("已记录");
         }
     }
+
+    public List<GoodsDocumentsRelaBean> documents(String goodsId) {
+        // 文档列表
+        final List<GoodsDocumentsRela> relaList = goodsDocumentsRelaService.lambdaQuery()
+                .eq(GoodsDocumentsRela::getGoodsId, goodsId)
+                .list();
+
+        List<GoodsDocumentsRelaBean> relaBeanList = new ArrayList<>();
+        if (CollectionUtil.isNotEmpty(relaList)) {
+
+            final List<CommonFile> commonFileList = appMapper.findCommonFileById(relaList.stream()
+                    .map(GoodsDocumentsRela::getCommonFileId)
+                    .collect(Collectors.toList()));
+
+            final Map<String, CommonFile> fileMap = commonFileList.stream().collect(Collectors.toMap(CommonFile::getId, Function.identity()));
+
+            for (GoodsDocumentsRela rela : relaList) {
+                GoodsDocumentsRelaBean relaBean = new GoodsDocumentsRelaBean();
+                BeanUtils.copyProperties(rela, relaBean);
+                final CommonFile commonFile = fileMap.get(rela.getCommonFileId());
+                relaBean.setFileName(commonFile.getName());
+                relaBean.setUrl(commonFile.getUrl());
+                relaBeanList.add(relaBean);
+            }
+        }
+
+        return relaBeanList;
+    }
 }

+ 9 - 0
mall-miniapp-service/src/main/resources/mapper/AppMapper.xml

@@ -1,6 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.gree.mall.miniapp.commonmapper.AppMapper">
+    <select id="findCommonFileById" resultType="com.gree.mall.miniapp.plus.entity.CommonFile">
+        SELECT * FROM common_file
+        WHERE
+        id IN
+        <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </select>
 
     <select id="queryShoppingCartList" resultType="com.gree.mall.miniapp.bean.order.ShoppingCartList">
         SELECT
@@ -71,4 +79,5 @@
         </if>
 
     </select>
+
 </mapper>

+ 2 - 2
mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsAdviceNoticeVO.java

@@ -8,9 +8,9 @@ import lombok.Data;
 
 import java.util.Date;
 
-@ZfireField(tbName = "a")
-@ApiModel
 @Data
+@ApiModel
+@ZfireField(tbName = "a")
 public class GoodsAdviceNoticeVO {
     @ZfireField(hide = true)
     @ApiModelProperty(value = "id")

+ 2 - 1
mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsBean.java

@@ -38,5 +38,6 @@ public class GoodsBean extends Goods {
     @ApiModelProperty("标签")
     private List<String> tagsLabel;
 
-
+    @ApiModelProperty("文档文件")
+    private List<GoodsDocumentsRelaBean> goodsDocumentsRelaList;
 }

+ 19 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsDocumentsBean.java

@@ -0,0 +1,19 @@
+package com.gree.mall.manager.bean.goods;
+
+import com.gree.mall.manager.plus.entity.CommonFile;
+import com.gree.mall.manager.plus.entity.GoodsDocuments;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ApiModel
+public class GoodsDocumentsBean extends GoodsDocuments {
+
+    @ApiModelProperty
+    private List<CommonFile> fileList;
+}

+ 19 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsDocumentsRelaBean.java

@@ -0,0 +1,19 @@
+package com.gree.mall.manager.bean.goods;
+
+import com.gree.mall.manager.plus.entity.GoodsDocumentsRela;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ApiModel
+public class GoodsDocumentsRelaBean extends GoodsDocumentsRela {
+
+    @ApiModelProperty(value = "文件名称")
+    private String fileName;
+
+    @ApiModelProperty(value = "文件地址")
+    private String url;
+}

+ 36 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsDocumentsVO.java

@@ -0,0 +1,36 @@
+package com.gree.mall.manager.bean.goods;
+
+import com.gree.mall.manager.annotation.ZfireField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel
+@ZfireField(tbName = "a")
+public class GoodsDocumentsVO {
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "id")
+    private String id;
+
+    @ApiModelProperty(value = "文件夹名称")
+    private String folderName;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "父分类id")
+    private String parentCategoryId;
+
+    @ZfireField(tbName = "b", colName = "name", ignoreSelect = true)
+    @ApiModelProperty(value = "父分类名称")
+    private String parentCategoryName;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "分类id")
+    private String categoryId;
+
+    @ZfireField(tbName = "c")
+    @ApiModelProperty(value = "分类名称")
+    private String name;
+
+}

+ 2 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsLibraryBean.java

@@ -21,4 +21,6 @@ public class GoodsLibraryBean extends GoodsLibrary {
     @ApiModelProperty("规格")
     private List<GoodsLibrarySpec> goodsLibrarySpecList;
 
+    @ApiModelProperty("文档文件")
+    private List<GoodsLibraryDocumentsRelaBean> goodsLibraryDocumentsRelaList;
 }

+ 19 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsLibraryDocumentsRelaBean.java

@@ -0,0 +1,19 @@
+package com.gree.mall.manager.bean.goods;
+
+import com.gree.mall.manager.plus.entity.GoodsLibraryDocumentsRela;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ApiModel
+public class GoodsLibraryDocumentsRelaBean extends GoodsLibraryDocumentsRela {
+
+    @ApiModelProperty(value = "文件名称")
+    private String fileName;
+
+    @ApiModelProperty(value = "文件地址")
+    private String url;
+}

+ 2 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/goods/GoodsSpecBean.java

@@ -82,4 +82,6 @@ public class GoodsSpecBean extends Goods {
     @ApiModelProperty("套购商品配置的用户列表-详情用")
     private List<User> users;
 
+    @ApiModelProperty("文档文件")
+    private List<GoodsDocumentsRelaBean> goodsDocumentsRelaList;
 }

+ 9 - 0
mall-server-api/src/main/java/com/gree/mall/manager/commonmapper/CommonMapper.java

@@ -28,6 +28,7 @@ import com.gree.mall.manager.bean.user.UserCompanyCreditBillItemVO;
 import com.gree.mall.manager.bean.user.UserCompanyCreditBillVO;
 import com.gree.mall.manager.bean.workorder.*;
 import com.gree.mall.manager.enums.UserTypeEnum;
+import com.gree.mall.manager.plus.entity.CommonFile;
 import com.gree.mall.manager.zfire.bean.WorkerParamBean;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
 import org.apache.ibatis.annotations.Mapper;
@@ -40,6 +41,7 @@ import java.util.List;
 @Mapper
 public interface CommonMapper {
 
+    List<CommonFile> findCommonFileById(@Param("ids") List<String> ids);
     /**
      * 分类
      * @param page
@@ -625,4 +627,11 @@ public interface CommonMapper {
      * @return
      */
     IPage<GoodsAdviceNoticeItemVO> goodsAdviceNoticeItemList(Page page, @Param("id") String id);
+
+    /**
+     * 商品文件夹列表
+     * @param page
+     * @return
+     */
+    IPage<GoodsDocumentsVO> goodsDocumentsList(Page page, @Param("ex") ZfireParamBean zfireParamBean);
 }

+ 2 - 2
mall-server-api/src/main/java/com/gree/mall/manager/commonmapper/CustomGoodsCategoryMapper.java

@@ -8,7 +8,7 @@ import java.util.List;
 public interface CustomGoodsCategoryMapper {
 
 
-    List<GoodsCategoryBean> list(@Param("type") Integer type,@Param("level") Integer level, @Param("status") Boolean status,
-                                 @Param("name") String name,@Param("companyWechatIds") List<String> companyWechatIds);
+    List<GoodsCategoryBean> list(@Param("type") Integer type, @Param("level") Integer level, @Param("status") Boolean status,
+                                 @Param("name") String name, @Param("platform") Boolean platform, @Param("companyWechatIds") List<String> companyWechatIds);
 
 }

+ 2 - 1
mall-server-api/src/main/java/com/gree/mall/manager/constant/Constant.java

@@ -1,6 +1,5 @@
 package com.gree.mall.manager.constant;
 
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
@@ -45,6 +44,8 @@ public class Constant {
         public final static String MARKETING_CONTENT_FILE = "marketing_content_file";
         //营销素材封面图
         public final static String MARKETING_SHOW_IMAGE = "marketing_show_image";
+
+        public final static String GOODS_DOCUMENTS = "goods_documents";
     }
 
     public class RedisPrefix {

+ 0 - 4
mall-server-api/src/main/java/com/gree/mall/manager/controller/goods/GoodsAdviceNoticeController.java

@@ -5,12 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.gree.mall.manager.annotation.ZfireList;
 import com.gree.mall.manager.bean.goods.GoodsAdviceNoticeItemVO;
 import com.gree.mall.manager.bean.goods.GoodsAdviceNoticeVO;
-import com.gree.mall.manager.bean.goods.GoodsMaterialVO;
-import com.gree.mall.manager.bean.goods.GoodsPurchaseVO;
 import com.gree.mall.manager.helper.ResponseHelper;
 import com.gree.mall.manager.logic.goods.GoodsAdviceNoticeLogic;
-import com.gree.mall.manager.logic.goods.GoodsMaterialLogic;
-import com.gree.mall.manager.zfire.bean.WebsitGoodsParamBean;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
 import com.gree.mall.manager.zfire.util.FieldUtils;
 import io.swagger.annotations.Api;

+ 13 - 13
mall-server-api/src/main/java/com/gree/mall/manager/controller/goods/GoodsCategoryController.java

@@ -4,7 +4,6 @@ import com.gree.mall.manager.bean.goods.GoodsCategoryBean;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.helper.ResponseHelper;
 import com.gree.mall.manager.logic.goods.GoodsCategoryLogic;
-import com.gree.mall.manager.plus.entity.CarouselMap;
 import com.gree.mall.manager.plus.entity.GoodsCategory;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -18,7 +17,7 @@ import java.util.List;
 
 @Slf4j
 @RestController
-@Api(value = "分类管理", tags ={"分类管理"} )
+@Api(value = "分类管理", tags = {"分类管理"})
 @RequestMapping(value = "/goods/category", produces = "application/json; charset=utf-8")
 public class GoodsCategoryController {
 
@@ -28,28 +27,29 @@ public class GoodsCategoryController {
     @GetMapping("/list")
     @ApiOperation(value = "分类管理列表")
     public ResponseHelper<List<GoodsCategoryBean>> page(
-            @RequestParam(required = false)Integer type,
-            @ApiParam(value = "层级",required = false) @RequestParam(required = false, defaultValue = "1") Integer categoryLevel,
-            @ApiParam(value = "分类名称",required = false) @RequestParam(required = false) String name,
-            @ApiParam(value = "状态(true:显示 false:隐藏",required = false) @RequestParam(required = false) Boolean status,
+            @RequestParam(required = false) Integer type,
+            @ApiParam(value = "层级", required = false) @RequestParam(required = false, defaultValue = "1") Integer categoryLevel,
+            @ApiParam(value = "分类名称", required = false) @RequestParam(required = false) String name,
+            @ApiParam(value = "状态(true:显示 false:隐藏", required = false) @RequestParam(required = false) Boolean status,
+            @ApiParam(value = "平台分类") @RequestParam(required = false, defaultValue = "false") Boolean platform,
             HttpServletRequest request
     ) throws RemoteServiceException {
-        List<GoodsCategoryBean> list = goodsCategoryLogic.list(type,categoryLevel,name,status,request);
+        List<GoodsCategoryBean> list = goodsCategoryLogic.list(type, categoryLevel, name, status, platform, request);
         return ResponseHelper.success(list);
     }
 
     @PostMapping("/add")
     @ApiOperation(value = "新增分类")
     public ResponseHelper add(
-            @ApiParam(value = "object",required = true) @RequestBody GoodsCategoryBean goodsCategoryBean,HttpServletRequest request) {
-        goodsCategoryLogic.add(goodsCategoryBean,request);
+            @ApiParam(value = "object", required = true) @RequestBody GoodsCategoryBean goodsCategoryBean, HttpServletRequest request) {
+        goodsCategoryLogic.add(goodsCategoryBean, request);
         return ResponseHelper.success();
     }
 
     @PostMapping("/update")
     @ApiOperation(value = "修改分类")
     public ResponseHelper update(
-            @ApiParam(value = "object",required = true) @RequestBody GoodsCategory goodsCategory) {
+            @ApiParam(value = "object", required = true) @RequestBody GoodsCategory goodsCategory) {
         goodsCategoryLogic.update(goodsCategory);
         return ResponseHelper.success();
     }
@@ -57,7 +57,7 @@ public class GoodsCategoryController {
     @PostMapping("/delete")
     @ApiOperation(value = "删除分类")
     public ResponseHelper delete(
-            @ApiParam(value = "分类id",required = true) @RequestParam String categoryId
+            @ApiParam(value = "分类id", required = true) @RequestParam String categoryId
     ) {
         goodsCategoryLogic.delete(categoryId);
         return ResponseHelper.success();
@@ -66,8 +66,8 @@ public class GoodsCategoryController {
     @GetMapping("/detail")
     @ApiOperation("详情")
     public ResponseHelper<GoodsCategory> detail(
-            @ApiParam(value = "分类id",required = true) @RequestParam String categoryId
-    ){
+            @ApiParam(value = "分类id", required = true) @RequestParam String categoryId
+    ) {
         GoodsCategory detail = goodsCategoryLogic.detail(categoryId);
         return ResponseHelper.success(detail);
     }

+ 74 - 0
mall-server-api/src/main/java/com/gree/mall/manager/controller/goods/GoodsDocumentsController.java

@@ -0,0 +1,74 @@
+package com.gree.mall.manager.controller.goods;
+
+import cn.hutool.core.lang.TypeReference;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.gree.mall.manager.annotation.ZfireList;
+import com.gree.mall.manager.bean.goods.GoodsDocumentsBean;
+import com.gree.mall.manager.bean.goods.GoodsDocumentsVO;
+import com.gree.mall.manager.exception.RemoteServiceException;
+import com.gree.mall.manager.helper.ResponseHelper;
+import com.gree.mall.manager.logic.goods.GoodsDocumentsLogic;
+import com.gree.mall.manager.zfire.bean.ZfireParamBean;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+@Slf4j
+@RestController
+@Api(value = "商品文档API", tags ={"商品文档API"} )
+@RequestMapping(value = "/goods/documents", produces = "application/json; charset=utf-8")
+public class GoodsDocumentsController {
+
+    @Resource
+    GoodsDocumentsLogic goodsDocumentsLogic;
+
+    @ZfireList
+    @PostMapping("/list")
+    @ApiOperation(value = "列表")
+    public ResponseHelper<IPage<GoodsDocumentsVO>> page(
+            @RequestBody ZfireParamBean zfireParamBean
+    ) throws Exception {
+        IPage<GoodsDocumentsVO> page = goodsDocumentsLogic.page(zfireParamBean);
+        return ResponseHelper.success(page, new TypeReference<GoodsDocumentsVO>() {});
+    }
+
+    @PostMapping("/detail")
+    @ApiOperation(value = "详情")
+    public ResponseHelper<GoodsDocumentsBean> detail(
+            @ApiParam(value = "id",required = true) @RequestParam String id
+    ) throws RemoteServiceException {
+        GoodsDocumentsBean detail = goodsDocumentsLogic.detail(id);
+        return ResponseHelper.success(detail);
+    }
+
+    @PostMapping("/add")
+    @ApiOperation(value = "新增")
+    public ResponseHelper add(
+            @ApiParam(value = "object",required = true) @RequestBody GoodsDocumentsBean bean
+    ) throws RemoteServiceException {
+        goodsDocumentsLogic.add(bean);
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("/add/file")
+    @ApiOperation(value = "新增")
+    public ResponseHelper addFile(
+            @ApiParam(value = "object",required = true) @RequestBody GoodsDocumentsBean bean
+    ) throws RemoteServiceException {
+        goodsDocumentsLogic.addFile(bean);
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("/del")
+    @ApiOperation(value = "删除")
+    public ResponseHelper del(
+            @ApiParam(value = "id",required = true) @RequestParam String id
+    ) throws RemoteServiceException {
+        goodsDocumentsLogic.del(id);
+        return ResponseHelper.success();
+    }
+}

+ 2 - 4
mall-server-api/src/main/java/com/gree/mall/manager/logic/goods/GoodsAdviceNoticeLogic.java

@@ -6,8 +6,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
 import com.gree.mall.manager.bean.goods.GoodsAdviceNoticeItemVO;
 import com.gree.mall.manager.bean.goods.GoodsAdviceNoticeVO;
-import com.gree.mall.manager.bean.goods.GoodsMaterialVO;
-import com.gree.mall.manager.bean.listvo.goods.GoodsMaterialStockAccVO;
 import com.gree.mall.manager.commonmapper.CommonMapper;
 import com.gree.mall.manager.enums.IsYesNoEnum;
 import com.gree.mall.manager.enums.NoticeEnum;
@@ -26,9 +24,9 @@ import org.springframework.transaction.annotation.Transactional;
 import java.util.*;
 import java.util.stream.Collectors;
 
-@RequiredArgsConstructor
-@Service
 @Slf4j
+@Service
+@RequiredArgsConstructor
 public class GoodsAdviceNoticeLogic {
     
     private final CommonLogic commonLogic;

+ 16 - 20
mall-server-api/src/main/java/com/gree/mall/manager/logic/goods/GoodsCategoryLogic.java

@@ -1,6 +1,5 @@
 package com.gree.mall.manager.logic.goods;
 
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
 import com.gree.mall.manager.bean.goods.GoodsCategoryBean;
 import com.gree.mall.manager.commonmapper.CustomGoodsCategoryMapper;
@@ -8,7 +7,6 @@ import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.logic.common.CommonLogic;
 import com.gree.mall.manager.plus.entity.*;
 import com.gree.mall.manager.plus.service.*;
-import net.bytebuddy.asm.Advice;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -19,7 +17,6 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.util.Date;
 import java.util.List;
-import java.util.function.Function;
 import java.util.stream.Collectors;
 
 @Component
@@ -48,14 +45,14 @@ public class GoodsCategoryLogic {
      * @param status
      * @return
      */
-    public List<GoodsCategoryBean> list(Integer type,Integer level, String name, Boolean status, HttpServletRequest request) {
+    public List<GoodsCategoryBean> list(Integer type, Integer level, String name, Boolean status, Boolean platform, HttpServletRequest request) {
         //获取当前登录企业微信id
         AdminUserCom adminUser = commonLogic.getAdminUser(request);
         List<String> companyWechatIds = adminUser.getCompanyWechatIds();
-        if(type == null){
+        if (type == null) {
             type = 1;
         }
-        return customGoodsCategoryMapper.list(type,level, status, name, companyWechatIds);
+        return customGoodsCategoryMapper.list(type, level, status, name, platform, companyWechatIds);
     }
 
     /**
@@ -70,25 +67,25 @@ public class GoodsCategoryLogic {
 //            throw new RemoteServiceException("非租户账号不可操作当前信息");
 //        }
         GoodsCategoryBean goodsCategory = goodsCategoryBean;
-        if(!CollectionUtils.isEmpty(goodsCategoryBean.getChildren())){
+        if (!CollectionUtils.isEmpty(goodsCategoryBean.getChildren())) {
             goodsCategory = goodsCategoryBean.getChildren().get(0);
         }
-        if(goodsCategory.getType() == null){
+        if (goodsCategory.getType() == null) {
             goodsCategory.setType(1);
         }
         //检查名称不可重复
         Integer count = goodsCategoryService.lambdaQuery()
                 .ne(StringUtils.isNotBlank(goodsCategory.getCategoryId()), GoodsCategory::getCategoryId, goodsCategory.getCategoryId())
-                .eq(GoodsCategory::getType,goodsCategory.getType())
+                .eq(GoodsCategory::getType, goodsCategory.getType())
                 .eq(GoodsCategory::getName, goodsCategory.getName())
                 .eq(GoodsCategory::getCompanyWechatId, adminUser.getCompanyWechatId()).count();
-        if(count > 0){
-            throw new RemoteServiceException("分类名称【"+goodsCategory.getName()+"】已存在");
+        if (count > 0) {
+            throw new RemoteServiceException("分类名称【" + goodsCategory.getName() + "】已存在");
         }
         //最多只能2级
-        if(StringUtils.isNotBlank(goodsCategory.getParentId())) {
+        if (StringUtils.isNotBlank(goodsCategory.getParentId())) {
             goodsCategory.setLevel(2);
-        }else{
+        } else {
             goodsCategory.setLevel(1);
         }
         goodsCategory.setCreateTime(new Date());
@@ -110,11 +107,11 @@ public class GoodsCategoryLogic {
         //检查名称不可重复
         Integer count = goodsCategoryService.lambdaQuery()
                 .ne(GoodsCategory::getCategoryId, goodsCategory.getCategoryId())
-                .eq(GoodsCategory::getType,old.getType())
+                .eq(GoodsCategory::getType, old.getType())
                 .eq(GoodsCategory::getName, goodsCategory.getName())
                 .eq(GoodsCategory::getCompanyWechatId, old.getCompanyWechatId()).count();
-        if(count > 0){
-            throw new RemoteServiceException("分类名称【"+goodsCategory.getName()+"】已存在");
+        if (count > 0) {
+            throw new RemoteServiceException("分类名称【" + goodsCategory.getName() + "】已存在");
         }
         goodsCategoryService.updateById(goodsCategory);
         //如果有子集,覆盖子集的一些参数
@@ -124,7 +121,6 @@ public class GoodsCategoryLogic {
     }
 
 
-
     /**
      * 删除分类
      *
@@ -140,15 +136,15 @@ public class GoodsCategoryLogic {
                 .eq(GoodsCategory::getParentId, categoryId).list();
         List<String> goodsCategoryIds = list.stream().map(GoodsCategory::getCategoryId).collect(Collectors.toList());
         Integer count = goodsService.lambdaQuery().in(Goods::getCategoryId, goodsCategoryIds).count();
-        if(count > 0){
+        if (count > 0) {
             throw new RemoteServiceException("分类已被商品使用,不可删除");
         }
         Integer count1 = goodsMaterialService.lambdaQuery().in(GoodsMaterial::getMainId, goodsCategoryIds).count();
-        if(count1 > 0){
+        if (count1 > 0) {
             throw new RemoteServiceException("服务分类已被物料使用,不可删除");
         }
         Integer count2 = goodsSpecService.lambdaQuery().in(GoodsSpec::getMainId, goodsCategoryIds).count();
-        if(count2 > 0){
+        if (count2 > 0) {
             throw new RemoteServiceException("服务分类已被商品规格使用,不可删除");
         }
 

+ 91 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/goods/GoodsDocumentsLogic.java

@@ -0,0 +1,91 @@
+package com.gree.mall.manager.logic.goods;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gree.mall.manager.bean.admin.AdminUserCom;
+import com.gree.mall.manager.bean.goods.GoodsDocumentsBean;
+import com.gree.mall.manager.bean.goods.GoodsDocumentsVO;
+import com.gree.mall.manager.commonmapper.CommonMapper;
+import com.gree.mall.manager.constant.Constant;
+import com.gree.mall.manager.exception.RemoteServiceException;
+import com.gree.mall.manager.logic.common.CommonLogic;
+import com.gree.mall.manager.plus.entity.CommonFile;
+import com.gree.mall.manager.plus.entity.GoodsDocuments;
+import com.gree.mall.manager.plus.service.GoodsDocumentsService;
+import com.gree.mall.manager.zfire.bean.ZfireParamBean;
+import com.gree.mall.manager.zfire.util.FieldUtils;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class GoodsDocumentsLogic {
+
+    private final CommonLogic commonLogic;
+    private final CommonMapper commonMapper;
+    private final GoodsDocumentsService goodsDocumentsService;
+
+    public IPage<GoodsDocumentsVO> page(ZfireParamBean zfireParamBean) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        if (Objects.nonNull(adminUser.getAdminCompanyWechat())) {
+            adminUser.setAdminCompanyWechat(null);
+        }
+        FieldUtils.supplyParam(zfireParamBean, GoodsDocumentsVO.class, adminUser);
+        IPage<GoodsDocumentsVO> list = commonMapper.goodsDocumentsList(new Page(zfireParamBean.getPageNum(),
+                zfireParamBean.getPageSize()), zfireParamBean);
+        return list;
+    }
+
+    public GoodsDocumentsBean detail(String id) {
+        GoodsDocumentsBean bean = new GoodsDocumentsBean();
+        final GoodsDocuments documents = goodsDocumentsService.getById(id);
+        BeanUtils.copyProperties(documents, bean);
+        final List<CommonFile> fileList = commonLogic.queryFileByObjId(id, Constant.Img.GOODS_DOCUMENTS);
+        bean.setFileList(fileList);
+        return bean;
+    }
+
+    @Transactional
+    public void add(GoodsDocumentsBean bean) {
+        if (StringUtils.isBlank(bean.getFolderName())) {
+            throw new RemoteServiceException("文件夹名称不能为空");
+        }
+        if (StringUtils.isBlank(bean.getParentCategoryId())) {
+            throw new RemoteServiceException("请选择父分类");
+        }
+        final Integer count = goodsDocumentsService.lambdaQuery()
+                .eq(GoodsDocuments::getFolderName, StrUtil.trim(bean.getFolderName()))
+                .eq(GoodsDocuments::getParentCategoryId, bean.getParentCategoryId())
+                .eq(StringUtils.isNotBlank(bean.getCategoryId()), GoodsDocuments::getCategoryId, bean.getCategoryId())
+                .count();
+
+        if (count > 0) {
+            throw new RemoteServiceException("重复存在文件夹名称");
+        }
+
+        bean.insert();
+    }
+
+    @Transactional
+    public void addFile(GoodsDocumentsBean bean) {
+        if (CollectionUtil.isNotEmpty(bean.getFileList())) {
+            List<String> fileList = bean.getFileList().stream().map(CommonFile::getId).collect(Collectors.toList());
+            commonLogic.bindFile(bean.getId(), Constant.Img.GOODS_DOCUMENTS, fileList);
+        }
+    }
+
+    public void del(String id) {
+        goodsDocumentsService.removeById(id);
+    }
+}

+ 44 - 18
mall-server-api/src/main/java/com/gree/mall/manager/logic/goods/GoodsLibraryLogic.java

@@ -1,45 +1,37 @@
 package com.gree.mall.manager.logic.goods;
 
 import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.lang.TypeReference;
-import cn.hutool.json.JSONUtil;
-import com.alibaba.fastjson.JSONObject;
+import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gree.mall.manager.bean.goods.GoodsLibraryBean;
-import com.gree.mall.manager.bean.goods.GoodsMaterialVO;
-import com.gree.mall.manager.bean.goods.outside.GoodsBean;
-import com.gree.mall.manager.bean.goods.outside.GoodsSpec;
+import com.gree.mall.manager.bean.goods.GoodsLibraryDocumentsRelaBean;
 import com.gree.mall.manager.bean.listvo.goods.GoodsLibraryVO;
 import com.gree.mall.manager.commonmapper.CommonMapper;
-import com.gree.mall.manager.enums.StatusEnum;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.helper.ResponseHelper;
 import com.gree.mall.manager.logic.common.CommonLogic;
 import com.gree.mall.manager.plus.entity.CommonFile;
 import com.gree.mall.manager.plus.entity.GoodsLibrary;
+import com.gree.mall.manager.plus.entity.GoodsLibraryDocumentsRela;
 import com.gree.mall.manager.plus.entity.GoodsLibrarySpec;
+import com.gree.mall.manager.plus.service.GoodsLibraryDocumentsRelaService;
 import com.gree.mall.manager.plus.service.GoodsLibraryService;
 import com.gree.mall.manager.plus.service.GoodsLibrarySpecService;
-import com.gree.mall.manager.utils.HttpUtils;
-import com.gree.mall.manager.utils.StringUtil;
 import com.gree.mall.manager.utils.oss.OSSUtil;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
 import com.gree.mall.manager.zfire.util.FieldUtils;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Value;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
 
 import java.io.InputStream;
-import java.math.BigDecimal;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
@@ -61,7 +53,7 @@ public class GoodsLibraryLogic {
     private final GoodsLibraryService goodsLibraryService;
     private final GoodsLibrarySpecService goodsLibrarySpecService;
     private final CommonMapper commonMapper;
-
+    private final GoodsLibraryDocumentsRelaService goodsLibraryDocumentsRelaService;
 
     /**
      * 商品库列表
@@ -96,6 +88,16 @@ public class GoodsLibraryLogic {
         );
         goodsLibrarySpecService.lambdaUpdate().eq(GoodsLibrarySpec::getGoodsLibraryId,goodsLibraryBean.getGoodsLibraryId()).remove();
         goodsLibrarySpecService.saveOrUpdateBatch(goodsLibrarySpecList);
+
+        List<GoodsLibraryDocumentsRelaBean> goodsLibraryDocumentsRelaBeanList = goodsLibraryBean.getGoodsLibraryDocumentsRelaList();
+        goodsLibraryDocumentsRelaService.lambdaUpdate().eq(GoodsLibraryDocumentsRela::getGoodsLibraryId, goodsLibraryBean.getGoodsLibraryId()).remove();
+        goodsLibraryDocumentsRelaService.saveOrUpdateBatch(goodsLibraryDocumentsRelaBeanList.stream()
+                .map(v -> {
+                    GoodsLibraryDocumentsRela rela = new GoodsLibraryDocumentsRela();
+                    BeanUtils.copyProperties(v, rela);
+                    return rela;
+                })
+                .collect(Collectors.toList()));
     }
 
 
@@ -108,6 +110,30 @@ public class GoodsLibraryLogic {
         //规格
         List<GoodsLibrarySpec> list = goodsLibrarySpecService.lambdaQuery().eq(GoodsLibrarySpec::getGoodsLibraryId, goodsLibraryBean.getGoodsLibraryId()).list();
         goodsLibraryBean.setGoodsLibrarySpecList(list);
+
+        final List<GoodsLibraryDocumentsRela> relaList = goodsLibraryDocumentsRelaService.lambdaQuery()
+                .eq(GoodsLibraryDocumentsRela::getGoodsLibraryId, goodsLibraryId)
+                .list();
+
+        if (CollectionUtil.isNotEmpty(relaList)) {
+            List<GoodsLibraryDocumentsRelaBean> relaBeanList = new ArrayList<>();
+            final List<CommonFile> commonFileList = commonMapper.findCommonFileById(relaList.stream()
+                    .map(GoodsLibraryDocumentsRela::getCommonFileId)
+                    .collect(Collectors.toList()));
+
+            final Map<String, CommonFile> fileMap = commonFileList.stream().collect(Collectors.toMap(CommonFile::getId, Function.identity()));
+
+            for (GoodsLibraryDocumentsRela rela : relaList) {
+                GoodsLibraryDocumentsRelaBean relaBean = new GoodsLibraryDocumentsRelaBean();
+                BeanUtils.copyProperties(rela, relaBean);
+                final CommonFile commonFile = fileMap.get(rela.getCommonFileId());
+                relaBean.setFileName(commonFile.getName());
+                relaBean.setUrl(commonFile.getUrl());
+                relaBeanList.add(relaBean);
+            }
+            goodsLibraryBean.setGoodsLibraryDocumentsRelaList(relaBeanList);
+        }
+
         return goodsLibraryBean;
     }
 

+ 47 - 2
mall-server-api/src/main/java/com/gree/mall/manager/logic/goods/GoodsLogic.java

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
 import com.gree.mall.manager.bean.goods.*;
+import com.gree.mall.manager.commonmapper.CommonMapper;
 import com.gree.mall.manager.commonmapper.CustomGoodsMapper;
 import com.gree.mall.manager.constant.Constant;
 import com.gree.mall.manager.enums.FreightTypeEnum;
@@ -26,11 +27,9 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.text.ParseException;
@@ -44,6 +43,7 @@ import java.util.stream.Collectors;
 public class GoodsLogic {
 
     private final CommonLogic commonLogic;
+    private final CommonMapper commonMapper;
     private final CustomGoodsMapper customGoodsMapper;
     private final GoodsService goodsService;
     private final GoodsDetailService goodsDetailService;
@@ -56,6 +56,7 @@ public class GoodsLogic {
     private final GoodsMaterialService goodsMaterialService;
     private final UserLogic userLogic;
     private final GoodsMaterialStorageService goodsMaterialStorageService;
+    private final GoodsDocumentsRelaService goodsDocumentsRelaService;
 
     /**
      * 商品列表
@@ -290,6 +291,30 @@ public class GoodsLogic {
             goodsBean.setTagsLabel(tagList);
         }
 
+        // 文档列表
+        final List<GoodsDocumentsRela> relaList = goodsDocumentsRelaService.lambdaQuery()
+                .eq(GoodsDocumentsRela::getGoodsId, goodsId)
+                .list();
+
+        if (CollectionUtil.isNotEmpty(relaList)) {
+            List<GoodsDocumentsRelaBean> relaBeanList = new ArrayList<>();
+            final List<CommonFile> commonFileList = commonMapper.findCommonFileById(relaList.stream()
+                    .map(GoodsDocumentsRela::getCommonFileId)
+                    .collect(Collectors.toList()));
+
+            final Map<String, CommonFile> fileMap = commonFileList.stream().collect(Collectors.toMap(CommonFile::getId, Function.identity()));
+
+            for (GoodsDocumentsRela rela : relaList) {
+                GoodsDocumentsRelaBean relaBean = new GoodsDocumentsRelaBean();
+                BeanUtils.copyProperties(rela, relaBean);
+                final CommonFile commonFile = fileMap.get(rela.getCommonFileId());
+                relaBean.setFileName(commonFile.getName());
+                relaBean.setUrl(commonFile.getUrl());
+                relaBeanList.add(relaBean);
+            }
+            goodsBean.setGoodsDocumentsRelaList(relaBeanList);
+        }
+
         return goodsBean;
     }
 
@@ -374,6 +399,8 @@ public class GoodsLogic {
         this.saveGoodsTagRela(goodsBean.getTags(), goodsBean.getGoodsId(), 1);
         this.saveGoodsTagRela(goodsBean.getTagsLabel(), goodsBean.getGoodsId(), 2);
 
+        // 保存文档
+        saveGoodsDocumentsRela(goodsBean);
     }
 
     private void commonCheckGoods(GoodsBean goodsBean) {
@@ -500,6 +527,24 @@ public class GoodsLogic {
         this.saveGoodsTagRela(goodsBean.getTags(), goodsBean.getGoodsId(), 1);
         this.saveGoodsTagRela(goodsBean.getTagsLabel(), goodsBean.getGoodsId(), 2);
 
+        // 保存文档
+        goodsDocumentsRelaService.lambdaUpdate()
+                .eq(GoodsDocumentsRela::getGoodsId, goodsBean.getGoodsId())
+                .remove();
+        saveGoodsDocumentsRela(goodsBean);
+    }
+
+    private void saveGoodsDocumentsRela(GoodsBean goodsBean) {
+        if (CollectionUtil.isNotEmpty(goodsBean.getGoodsDocumentsRelaList())) {
+            List<GoodsDocumentsRela> relaList = new ArrayList<>();
+            for (GoodsDocumentsRelaBean relaBean : goodsBean.getGoodsDocumentsRelaList()) {
+                GoodsDocumentsRela rela = new GoodsDocumentsRela();
+                BeanUtils.copyProperties(relaBean, rela);
+                rela.setGoodsId(goodsBean.getGoodsId());
+                relaList.add(rela);
+            }
+            goodsDocumentsRelaService.saveBatch(relaList);
+        }
     }
 
     /**

+ 23 - 0
mall-server-api/src/main/resources/mapper/CommonMapper.xml

@@ -1,6 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.gree.mall.manager.commonmapper.CommonMapper">
+    <select id="findCommonFileById" resultType="com.gree.mall.manager.plus.entity.CommonFile">
+        SELECT * FROM common_file
+        WHERE
+            id IN
+        <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </select>
     <select id="queryChargingStandrdList" resultType="com.gree.mall.manager.bean.charging.ChargingStandardBean">
         select
             a.* ,
@@ -1187,4 +1195,19 @@
         ORDER BY a.create_time DESC
     </select>
 
+    <select id="goodsDocumentsList" resultType="com.gree.mall.manager.bean.goods.GoodsDocumentsVO">
+        SELECT
+        ${ex.selected},
+        b.name AS parent_category_name
+        FROM goods_documents a
+            LEFT JOIN goods_category b ON a.parent_category_id = b.category_id
+            LEFT JOIN goods_category c ON a.category_id = c.category_id
+        ${ex.query}
+        <if test="ex.orderBy == null or ex.orderBy ==''">
+            ORDER BY a.create_time DESC
+        </if>
+        ${ex.orderBy}
+    </select>
+
+
 </mapper>

+ 4 - 1
mall-server-api/src/main/resources/mapper/CustomGoodsCategoryMapper.xml

@@ -46,7 +46,10 @@
             <if test='name != null'>
                 AND name like concat('%',#{name,jdbcType=VARCHAR},'%')
             </if>
-            <if test=' companyWechatIds != null and companyWechatIds.size > 0' >
+            <if test="platform != null and platform">
+                AND company_wechat_id = ''
+            </if>
+            <if test='platform != null and !platform and companyWechatIds != null and companyWechatIds.size > 0' >
                 AND company_wechat_id in
                 <foreach collection="companyWechatIds" open="(" close=")" item="companyWechatId" separator=",">
                      #{companyWechatId}