Sfoglia il codice sorgente

产品管理相关

yzc 2 anni fa
parent
commit
c1eb4fa920

+ 106 - 5
sckw-modules/sckw-product/src/main/java/com/sckw/product/controller/KwpGoodsController.java

@@ -6,10 +6,10 @@ import com.sckw.core.model.page.PageHelperUtil;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.model.vo.TableStatisticRes;
 import com.sckw.core.web.response.HttpResult;
-import com.sckw.product.model.vo.req.AddGoodsParam;
-import com.sckw.product.model.vo.req.GoodsListParam;
-import com.sckw.product.model.vo.req.SelectGoodsListParam;
+import com.sckw.product.model.vo.req.*;
+import com.sckw.product.model.vo.res.BuildingMaterialsMarketList;
 import com.sckw.product.model.vo.res.GoodsDetail;
+import com.sckw.product.model.vo.res.GoodsDropList;
 import com.sckw.product.model.vo.res.GoodsList;
 import com.sckw.product.service.KwpGoodsService;
 import lombok.RequiredArgsConstructor;
@@ -41,7 +41,7 @@ public class KwpGoodsController {
     @PostMapping(value = "/addDraft", produces = MediaType.APPLICATION_JSON_VALUE)
     public HttpResult addDraft(@RequestBody AddGoodsParam addGoodsParam) {
         kwpGoodsService.addDraft(addGoodsParam);
-        return HttpResult.ok();
+        return HttpResult.ok("添加草稿商品成功");
     }
 
     /**
@@ -54,7 +54,7 @@ public class KwpGoodsController {
     @PostMapping(value = "/addShelves", produces = MediaType.APPLICATION_JSON_VALUE)
     public HttpResult addShelves(@RequestBody @Validated AddGoodsParam addGoodsParam) {
         kwpGoodsService.addShelves(addGoodsParam);
-        return HttpResult.ok();
+        return HttpResult.ok("添加上架商品成功");
     }
 
     /**
@@ -70,6 +70,19 @@ public class KwpGoodsController {
         return HttpResult.ok(goodsDetail);
     }
 
+    /**
+     * @desc: 修改
+     * @author: yzc
+     * @date: 2023-07-06 9:02
+     * @Param updateGoodsParam:
+     * @return: com.sckw.core.web.response.HttpResult
+     */
+    @PostMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
+    public HttpResult update(@RequestBody @Validated UpdateGoodsParam updateGoodsParam) {
+        kwpGoodsService.update(updateGoodsParam);
+        return HttpResult.ok("修改成功");
+    }
+
 
     /**
      * @desc: 分页查询商品列表
@@ -86,10 +99,98 @@ public class KwpGoodsController {
         return HttpResult.ok(result);
     }
 
+    /**
+     * @desc: 统计查询
+     * @author: yzc
+     * @date: 2023-07-06 8:33
+     * @Param params:
+     * @return: com.sckw.core.web.response.HttpResult
+     */
     @PostMapping(value = "/statistic", produces = MediaType.APPLICATION_JSON_VALUE)
     public HttpResult statistic(@RequestBody GoodsListParam params) {
         TableStatisticRes tableStatisticRes = kwpGoodsService.statistic(params);
         return HttpResult.ok(tableStatisticRes);
     }
 
+    /**
+     * @desc: 导出
+     * @author: yzc
+     * @date: 2023-07-06 8:33
+     * @Param params:
+     * @return: com.sckw.core.web.response.HttpResult
+     */
+    @PostMapping(value = "/export", produces = MediaType.APPLICATION_JSON_VALUE)
+    public void export(@RequestBody GoodsListParam params) {
+        kwpGoodsService.export(params);
+    }
+
+
+    /**
+     * @desc: 批量上架
+     * @author: yzc
+     * @date: 2023-07-06 8:56
+     * @Param ids:
+     * @return: com.sckw.core.web.response.HttpResult
+     */
+    @GetMapping("/batchPutOnShelves")
+    public HttpResult batchPutOnShelves(@RequestParam List<Long> ids) {
+        kwpGoodsService.batchPutOnShelves(ids);
+        return HttpResult.ok("批量上架成功");
+    }
+
+    /**
+     * @desc: 批量下架
+     * @author: yzc
+     * @date: 2023-07-06 8:56
+     * @Param ids:
+     * @return: com.sckw.core.web.response.HttpResult
+     */
+    @GetMapping("/batchTakeOffShelves")
+    public HttpResult batchTakeOffShelves(@RequestParam List<Long> ids) {
+        kwpGoodsService.batchTakeOffShelves(ids);
+        return HttpResult.ok("批量下架成功");
+    }
+
+    /**
+     * @desc: 批量删除
+     * @author: yzc
+     * @date: 2023-07-06 8:56
+     * @Param ids:
+     * @return: com.sckw.core.web.response.HttpResult
+     */
+    @GetMapping("/batchDelete")
+    public HttpResult batchDelete(@RequestParam List<Long> ids) {
+        kwpGoodsService.batchDelete(ids);
+        return HttpResult.ok("批量删除成功");
+    }
+
+    /**
+     * @desc: 建材市场分页查询
+     * @author: yzc
+     * @date: 2023-07-06 9:38
+     * @Param params:
+     * @return: com.sckw.core.web.response.HttpResult
+     */
+    @PostMapping(value = "/buildingMaterialsMarketList", produces = MediaType.APPLICATION_JSON_VALUE)
+    public HttpResult buildingMaterialsMarketList(@RequestBody BuildingMaterialsMarketListParam params) {
+        PageHelper.startPage(params.getPage(), params.getPageSize());
+        List<BuildingMaterialsMarketList> list = kwpGoodsService.buildingMaterialsMarketList(params);
+        PageResult result = PageHelperUtil.getPageResult(new PageInfo<>(list));
+        return HttpResult.ok(result);
+    }
+
+    /**
+     * @desc: 商品下拉列表
+     * @author: yzc
+     * @date: 2023-07-06 8:37
+     * @Param params:
+     * @return: com.sckw.core.web.response.HttpResult
+     */
+    @PostMapping(value = "/dropList", produces = MediaType.APPLICATION_JSON_VALUE)
+    public HttpResult dropList(@RequestBody GoodsDropListReq params) {
+        List<GoodsDropList> list = kwpGoodsService.dropList(params);
+        return HttpResult.ok(list);
+    }
+
+
 }

+ 68 - 0
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/GoodsListExport.java

@@ -0,0 +1,68 @@
+package com.sckw.product.model;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+/**
+ * @desc: 商品列表导出对象
+ * @author: yzc
+ * @date: 2023-07-06 9:15
+ */
+@Data
+public class GoodsListExport {
+
+    @ExcelProperty(value = "上架状态", index = 0)
+    private String status;
+
+    @ExcelProperty(value = "商品名称", index = 1)
+    private String name;
+
+    @ExcelProperty(value = "商品类别", index = 2)
+    private String type;
+
+    @ExcelProperty(value = "计量单位", index = 3)
+    private String unit;
+
+    @ExcelProperty(value = "规格尺寸", index = 4)
+    private String spec;
+
+    @ExcelProperty(value = "增值税", index = 5)
+    private String taxRate;
+
+    @ExcelProperty(value = "库存数量", index = 6)
+    private String amount;
+
+    @ExcelProperty(value = "交易方式", index = 7)
+    private String trading;
+
+    @ExcelProperty(value = "最高单价", index = 8)
+    private String highestPrice;
+
+    @ExcelProperty(value = "最低单价", index = 9)
+    private String lowestPrice;
+
+    @ExcelProperty(value = "地址", index = 10)
+    private String address;
+
+    @ExcelProperty(value = "客户经理", index = 11)
+    private String manageName;
+
+    @ExcelProperty(value = "联系电话", index = 12)
+    private String phone;
+
+    @ExcelProperty(value = "上架时间", index = 13)
+    private String addedTime;
+
+    @ExcelProperty(value = "下架时间", index = 14)
+    private String shelfTime;
+
+    @ExcelProperty(value = "供应企业", index = 15)
+    private String supplyEnt;
+
+    @ExcelProperty(value = "创造人", index = 16)
+    private String createByName;
+
+    @ExcelProperty(value = "备注", index = 17)
+    private String remark;
+
+}

+ 55 - 0
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/req/BuildingMaterialsMarketListParam.java

@@ -0,0 +1,55 @@
+package com.sckw.product.model.vo.req;
+
+import com.sckw.core.model.page.PageRequest;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * @desc: 建材市场列表请求参数
+ * @author: yzc
+ * @date: 2023-07-06 9:32
+ */
+@Getter
+@Setter
+@ToString
+public class BuildingMaterialsMarketListParam extends PageRequest {
+
+    /**
+     * 商品名称、企业名称(共用模糊匹配)
+     */
+    private String keywords;
+
+    /**
+     * 行业ids(不限为空)
+     */
+    private List<Long> industryIds;
+
+    /**
+     * 分类ids(不限为空)
+     */
+    private List<Long> classificationIds;
+
+    /**
+     * 类别ids(不限为空)
+     */
+    private List<Long> categoryIds;
+
+    /**
+     * 品名ids(不限为空)
+     */
+    private List<Long> productNameIds;
+
+    /**
+     * 地区集合(全国为空)
+     */
+    private List<Long> areaCodes;
+
+    /**
+     * 交易方式(预付款、货到付款、线下付款)
+     */
+    private List<Long> tradings;
+
+}

+ 20 - 0
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/req/GoodsDropListReq.java

@@ -0,0 +1,20 @@
+package com.sckw.product.model.vo.req;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+/**
+ * @desc: 商品下拉列表请求参数
+ * @author: yzc
+ * @date: 2023-07-06 8:38
+ */
+@Getter
+@Setter
+@ToString
+public class GoodsDropListReq {
+    /**
+     * 商品名称
+     */
+    private String name;
+}

+ 118 - 0
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/req/UpdateGoodsParam.java

@@ -0,0 +1,118 @@
+package com.sckw.product.model.vo.req;
+
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.hibernate.validator.constraints.Length;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @desc: 修改商品请求参数
+ * @author: yzc
+ * @date: 2023-07-03 8:35
+ */
+@Getter
+@Setter
+@ToString
+public class UpdateGoodsParam {
+
+    /**
+     * 商品id
+     */
+    @NotNull(message = "商品id不能为空")
+    private Long id;
+
+    /**
+     * 商品状态
+     */
+    @NotNull(message = "商品状态不能为空")
+    private Integer status;
+    /**
+     * 商品名称
+     */
+    private String name;
+
+    /**
+     * 商品类型
+     */
+    private Long typeId;
+
+    /**
+     * 单位(吨、方、件、箱、其他)
+     */
+    private String unit;
+
+    /**
+     * 规格尺寸
+     */
+    private String spec;
+
+    /**
+     * 库存数量
+     */
+    private BigDecimal amount;
+
+    /**
+     * 参数目录
+     */
+    @Size(max = 10, message = "参数目录最多支持10个")
+    private List<GoodsAttributes> attributes;
+
+    /**
+     * 发票税率(%)
+     */
+    private BigDecimal taxRate;
+
+    /**
+     * 交易方式(合同采购、直接采购、预付款、货到付款、到款发货)
+     */
+    private Long trading;
+
+    /**
+     * 预付款最低限额(万元)
+     */
+    private BigDecimal advancePrice;
+
+    /**
+     * 价格梯度
+     */
+    @Size(max = 4, message = "价格梯度最多4个")
+    private List<GoodsPriceRanges> priceRanges;
+
+    /**
+     * 供应企业
+     */
+    private Long supplyEntId;
+
+    /**
+     * 地址信息
+     */
+    private AddressInfo addressInfo;
+
+    /**
+     * 专属客户经理(用户ID)
+     */
+    private Long manager;
+
+    /**
+     * 备注
+     */
+    @Length(max = 100, message = "备注最多支持100字")
+    private String remark;
+
+    /**
+     * 商品缩略图
+     */
+    private String thumb;
+
+    /**
+     * 商品详情图片
+     */
+    @Size(max = 5, message = "商品详情图片最多支持5张")
+    private List<GoodsImages> images;
+
+}

+ 64 - 0
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/res/BuildingMaterialsMarketList.java

@@ -0,0 +1,64 @@
+package com.sckw.product.model.vo.res;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+
+/**
+ * @desc: 建材市场列表响应
+ * @author: yzc
+ * @date: 2023-07-06 9:37
+ */
+@Getter
+@Setter
+@ToString
+@Accessors(chain = true)
+public class BuildingMaterialsMarketList {
+
+    /**
+     * 商品id
+     */
+    private Long id;
+
+    /**
+     * 商品名称
+     */
+    private String name;
+
+    /**
+     * 缩略图
+     */
+    private String thumb;
+
+    /**
+     * 品名(type)
+     */
+    private String productName;
+
+    /**
+     * 规格大小
+     */
+    private String spec;
+
+    /**
+     * 单位(吨、方、件、箱、其他)
+     */
+    private String unit;
+
+    /**
+     * 交易方式(预付款、货到付款、线下付款)
+     */
+    private String trading;
+
+    /**
+     * 发货地
+     */
+    private String address;
+
+    /**
+     * 供应商
+     */
+    private String supplyEnt;
+
+}

+ 33 - 0
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/res/GoodsDropList.java

@@ -0,0 +1,33 @@
+package com.sckw.product.model.vo.res;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+
+/**
+ * @desc: 商品下拉列表
+ * @author: yzc
+ * @date: 2023-07-06 8:41
+ */
+@Getter
+@Setter
+@ToString
+@Accessors(chain = true)
+public class GoodsDropList {
+    /**
+     * 商品id
+     */
+    private Long id;
+
+    /**
+     * 商品名称
+     */
+    private String name;
+
+    /**
+     * 供应单位名称
+     */
+    private String supplyEnt;
+
+}

+ 91 - 4
sckw-modules/sckw-product/src/main/java/com/sckw/product/service/KwpGoodsService.java

@@ -7,16 +7,20 @@ import com.sckw.core.model.vo.TableStatisticRes;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.web.context.LoginUserHolder;
+import com.sckw.excel.utils.EasyExcelUtil;
 import com.sckw.product.dao.KwpGoodsMapper;
 import com.sckw.product.model.*;
 import com.sckw.product.model.vo.req.*;
+import com.sckw.product.model.vo.res.BuildingMaterialsMarketList;
 import com.sckw.product.model.vo.res.GoodsDetail;
+import com.sckw.product.model.vo.res.GoodsDropList;
 import com.sckw.product.model.vo.res.GoodsList;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -166,6 +170,17 @@ public class KwpGoodsService {
         return null;
     }
 
+    /**
+     * @desc: 统计查询
+     * @author: yzc
+     * @date: 2023-07-05 17:55
+     * @Param params:
+     * @return: com.sckw.core.model.vo.TableRes
+     */
+    public TableStatisticRes statistic(GoodsListParam params) {
+        return null;
+    }
+
     /**
      * @desc: 条件获取商品信息
      * @author: yzc
@@ -180,13 +195,85 @@ public class KwpGoodsService {
     }
 
     /**
-     * @desc: TODO
+     * @desc: 商品下拉列表
      * @author: yzc
-     * @date: 2023-07-05 17:55
+     * @date: 2023-07-06 8:45
      * @Param params:
-     * @return: com.sckw.core.model.vo.TableRes
+     * @return: java.util.List<com.sckw.product.model.vo.res.GoodsDropList>
      */
-    public TableStatisticRes statistic(GoodsListParam params) {
+    public List<GoodsDropList> dropList(GoodsDropListReq params) {
+        return null;
+    }
+
+    /**
+     * @desc: 更新商品信息
+     * @author: yzc
+     * @date: 2023-07-06 8:50
+     * @Param updateGoodsParam:
+     * @return: void
+     */
+    public void update(UpdateGoodsParam updateGoodsParam) {
+
+    }
+
+    /**
+     * @desc: 批量上架
+     * @author: yzc
+     * @date: 2023-07-06 8:56
+     * @Param ids:
+     * @return: void
+     */
+    public void batchPutOnShelves(List<Long> ids) {
+
+    }
+
+    /**
+     * @desc: 批量下架
+     * @author: yzc
+     * @date: 2023-07-06 8:56
+     * @Param ids:
+     * @return: void
+     */
+    public void batchTakeOffShelves(List<Long> ids) {
+
+    }
+
+    /**
+     * @desc: 批量删除
+     * @author: yzc
+     * @date: 2023-07-06 8:56
+     * @Param ids:
+     * @return: void
+     */
+    public void batchDelete(List<Long> ids) {
+
+    }
+
+    /**
+     * @desc: 导出
+     * @author: yzc
+     * @date: 2023-07-06 9:07
+     * @Param params:
+     * @return: void
+     */
+    public void export(GoodsListParam params) {
+
+        List<GoodsListExport> list = new ArrayList<>();
+        try {
+            EasyExcelUtil.writeSingleExcel("商品列表信息", "sheet1", list, GoodsListExport.class);
+        } catch (IOException e) {
+            throw new BusinessException("导出商品列表异常", e.getMessage());
+        }
+    }
+
+    /**
+     * @desc: 建材市场分页查询
+     * @author: yzc
+     * @date: 2023-07-06 9:38
+     * @Param params:
+     * @return: java.util.List<com.sckw.product.model.vo.res.BuildingMaterialsMarketList>
+     */
+    public List<BuildingMaterialsMarketList> buildingMaterialsMarketList(BuildingMaterialsMarketListParam params) {
         return null;
     }
 }