From 7f28afd9840aeb06b9594daa1f61e439607d27fb Mon Sep 17 00:00:00 2001 From: liujiang <569804566@qq.com> Date: Tue, 8 Jul 2025 17:06:42 +0800 Subject: [PATCH] =?UTF-8?q?master=EF=BC=9A=E7=94=9F=E4=BA=A7=E9=9C=80?= =?UTF-8?q?=E6=B1=82=E5=8A=9F=E8=83=BD=E5=AE=8C=E5=96=84=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkt/StoreProductController.java | 7 +- .../xkt/StoreProductDemandController.java | 14 + .../xkt/vo/storeProd/StoreProdCreateVO.java | 254 +++++++++++ .../xkt/vo/storeProd/StoreProdUpdateVO.java | 255 +++++++++++ .../xkt/vo/storeProd/StoreProdVO.java | 72 ++-- .../StoreProdDemandExportVO.java | 3 +- .../StoreProdDemandFinishAllVO.java | 27 ++ .../StoreProdDemandStatusCountResVO.java | 23 + .../com/ruoyi/xkt/domain/StoreCustomer.java | 1 + .../dto/storeProduct/StoreProdCreateDTO.java | 34 ++ .../xkt/dto/storeProduct/StoreProdDTO.java | 96 ++++- .../dto/storeProduct/StoreProdUpdateDTO.java | 132 ++++++ .../StoreProdDemandFinishAllDTO.java | 24 ++ .../StoreProdDemandStatusCountResDTO.java | 23 + .../ruoyi/xkt/mapper/StoreCustomerMapper.java | 48 --- .../mapper/StoreProductColorPriceMapper.java | 1 - .../xkt/mapper/StoreProductDemandMapper.java | 8 + .../xkt/service/IStoreCustomerService.java | 48 +-- .../service/IStoreProductDemandService.java | 16 + .../xkt/service/IStoreProductService.java | 5 +- .../impl/StoreCustomerServiceImpl.java | 54 +-- .../impl/StoreProductDemandServiceImpl.java | 64 ++- .../service/impl/StoreProductServiceImpl.java | 401 +++++++++--------- .../resources/mapper/StoreCustomerMapper.xml | 88 ---- .../mapper/StoreProductColorPriceMapper.xml | 4 - .../mapper/StoreProductDemandMapper.xml | 90 +--- .../mapper/UserSubscriptionsMapper.xml | 4 +- 27 files changed, 1219 insertions(+), 577 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdCreateVO.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdUpdateVO.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandFinishAllVO.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandStatusCountResVO.java create mode 100644 xkt/src/main/java/com/ruoyi/xkt/dto/storeProduct/StoreProdCreateDTO.java create mode 100644 xkt/src/main/java/com/ruoyi/xkt/dto/storeProduct/StoreProdUpdateDTO.java create mode 100644 xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandFinishAllDTO.java create mode 100644 xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandStatusCountResDTO.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductController.java index 047ff957e..012cbb921 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductController.java @@ -101,17 +101,18 @@ public class StoreProductController extends XktBaseController { @ApiOperation(value = "新增档口商品", httpMethod = "POST", response = R.class) @PostMapping public R create(@Validated @RequestBody StoreProdVO storeProdVO) throws IOException { - return R.ok(storeProdService.insertStoreProduct(BeanUtil.toBean(storeProdVO, StoreProdDTO.class))); + return R.ok(storeProdService.create(BeanUtil.toBean(storeProdVO, StoreProdDTO.class))); } @PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()") @ApiOperation(value = "修改档口商品", httpMethod = "PUT", response = R.class) @Log(title = "修改档口商品", businessType = BusinessType.UPDATE) @PutMapping("/{storeProdId}") - public R edit(@PathVariable Long storeProdId, @Validated @RequestBody StoreProdVO storeProdVO) throws IOException { - return R.ok(storeProdService.updateStoreProduct(storeProdId, BeanUtil.toBean(storeProdVO, StoreProdDTO.class))); + public R update(@PathVariable Long storeProdId, @Validated @RequestBody StoreProdVO storeProdVO) throws IOException { + return R.ok(storeProdService.update(storeProdId, BeanUtil.toBean(storeProdVO, StoreProdDTO.class))); } + @PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()") @Log(title = "修改档口商品状态", businessType = BusinessType.UPDATE) @ApiOperation(value = "修改档口商品状态", httpMethod = "PUT", response = R.class) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductDemandController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductDemandController.java index 4c877f153..9fb0b3595 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductDemandController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductDemandController.java @@ -37,6 +37,12 @@ public class StoreProductDemandController extends XktBaseController { final IStoreProductDemandService storeProdDemandService; + @ApiOperation(value = "获取所有需求单状态", httpMethod = "GET", response = R.class) + @GetMapping(value = "/status/num/{storeId}") + public R getStatusNum(@PathVariable Long storeId) { + return R.ok(BeanUtil.toBean(storeProdDemandService.getStatusNum(storeId), StoreProdDemandStatusCountResVO.class)); + } + @PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()") @ApiOperation(value = "商品入库校验是否存在需求单", httpMethod = "POST", response = R.class) @Log(title = "商品入库校验是否存在需求单", businessType = BusinessType.INSERT) @@ -84,6 +90,14 @@ public class StoreProductDemandController extends XktBaseController { return R.ok(storeProdDemandService.deleteByStoreProdDemandIds(BeanUtil.toBean(deleteVO, StoreProdDemandDeleteDTO.class))); } + @PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()") + @ApiOperation(value = "全部完成", httpMethod = "PUT", response = R.class) + @Log(title = "全部完成", businessType = BusinessType.UPDATE) + @PutMapping("/finish-all") + public R finishAll(@Validated @RequestBody StoreProdDemandFinishAllVO allFinishVO) { + return R.ok(storeProdDemandService.finishAll(BeanUtil.toBean(allFinishVO, StoreProdDemandFinishAllDTO.class))); + } + @PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()") @ApiOperation(value = "导出生产需求", httpMethod = "POST", response = R.class) @Log(title = "导出生产需求", businessType = BusinessType.EXPORT) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdCreateVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdCreateVO.java new file mode 100644 index 000000000..373c9bf41 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdCreateVO.java @@ -0,0 +1,254 @@ +package com.ruoyi.web.controller.xkt.vo.storeProd; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.ruoyi.web.controller.xkt.vo.storeColor.StoreColorVO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@Data +@JsonInclude(JsonInclude.Include.NON_NULL) +public class StoreProdCreateVO { + + @ApiModelProperty(value = "档口商品名称") + private String prodName; + @ApiModelProperty(value = "档口ID", required = true) + @NotNull(message = "档口ID不能为空!") + private Long storeId; + @ApiModelProperty(value = "商品分类ID", required = true) + @NotNull(message = "商品分类ID不能为空!") + private Long prodCateId; + @ApiModelProperty(value = "商品分类名称", required = true) + @NotBlank(message = "商品分类名称不能为空!") + private String prodCateName; + @ApiModelProperty(value = "工厂货号") + @Size(min = 0, max = 15, message = "工厂货号不能超过60个字!") + private String factoryArtNum; + @ApiModelProperty(value = "商品货号", required = true) + @Size(min = 0, max = 15, message = "商品货号不能超过60个字!") + @NotBlank(message = "商品货号不能为空!") + private String prodArtNum; + @ApiModelProperty(value = "商品标题", required = true) + @Size(min = 0, max = 60, message = "商品标题不能超过60个字!") + @NotBlank(message = "商品标题不能为空!") + private String prodTitle; + @ApiModelProperty(value = "商品重量") + private BigDecimal prodWeight; + @ApiModelProperty(value = "生产价格") + private Integer producePrice; + @ApiModelProperty(value = "大小码加价") + private Integer overPrice; + @ApiModelProperty(value = "发货时效") + private Integer deliveryTime; + @ApiModelProperty(value = "上架方式:1 立即上架 2 定时上架", required = true) + @NotNull(message = "上架方式不能为空!") + private Integer listingWay; + @ApiModelProperty(value = "商品状态:1.未发布 2. 在售 3. 尾货 4.已下架 5. 已删除", required = true) + @NotNull(message = "商品状态不能为空!") + private Integer prodStatus; + @ApiModelProperty(value = "定时发货时间(精确到小时)") + @JsonFormat(pattern = "yyyy-MM-dd HH") + private Date listingWaySchedule; + @ApiModelProperty(value = "档口文件列表", required = true) + @NotNull(message = "档口文件不能为空!") + @Valid + private List fileList; + @NotNull(message = "档口类目属性不能为空!") + @Valid + @ApiModelProperty(value = "档口类目属性", required = true) + private StoreProdCateAttrVO cateAttr; + @NotNull(message = "档口所有颜色列表不能为空!") + @ApiModelProperty(value = "档口所有颜色列表", required = true) + @Valid + private List allColorList; + @NotNull(message = "档口尺码列表不能为空!") + @Valid + @ApiModelProperty(value = "档口尺码列表", required = true) + private List sizeList; + @Valid + @NotNull(message = "商品颜色价格列表不能为空!") + @ApiModelProperty(value = "档口颜色价格列表", required = true) + private List colorPriceList; + @ApiModelProperty(value = "档口服务承诺") + private StoreProdSvcVO svc; + @NotBlank(message = "详情内容不能为空!") + @ApiModelProperty(value = "详情内容", required = true) + private String detail; + @ApiModelProperty(value = "档口生产工艺") + private StoreProdProcessVO process; + + + + @Data + @Valid + public static class SPCColorPriceVO { + @ApiModelProperty(value = "档口商品颜色ID") + private Long storeColorId; + @NotBlank(message = "颜色名称不能为空!") + @ApiModelProperty(value = "颜色名称", required = true) + private String colorName; + @NotNull(message = "档口商品定价不能为空!") + @ApiModelProperty(value = "档口商品定价", required = true) + private BigDecimal price; + @NotNull(message = "排序不能为空!") + @ApiModelProperty(value = "排序", required = true) + private Integer orderNum; + } + + + @Data + @Valid + public static class StoreProdFileVO { + @NotBlank(message = "文件名称不能为空!") + @ApiModelProperty(value = "文件名称", required = true) + private String fileName; + @NotBlank(message = "文件路径不能为空!") + @ApiModelProperty(value = "文件路径", required = true) + private String fileUrl; + @NotNull(message = "文件大小不能为空!") + @ApiModelProperty(value = "文件大小", required = true) + private BigDecimal fileSize; + @NotNull(message = "文件类型不能为空!") + @ApiModelProperty(value = "文件类型", required = true) + private Integer fileType; + @ApiModelProperty(value = "排序", required = true) + @NotNull(message = "排序不能为空!") + private Integer orderNum; + } + + @Data + public static class StoreProdCateAttrVO { + @NotBlank(message = "帮面材质不可为空!") + @ApiModelProperty(value = "帮面材质", required = true) + private String upperMaterial; + @NotBlank(message = "内里材质不可为空!") + @ApiModelProperty(value = "内里材质", required = true) + private String liningMaterial; + @NotBlank(message = "鞋垫材质不可为空!") + @ApiModelProperty(value = "鞋垫材质", required = true) + private String insoleMaterial; + @ApiModelProperty(value = "上市季节年份") + private String releaseYearSeason; + @ApiModelProperty(value = "后跟高") + private String heelHeight; + @ApiModelProperty(value = "跟底款式") + private String heelType; + @ApiModelProperty(value = "鞋头款式") + private String toeStyle; + @ApiModelProperty(value = "适合季节") + private String suitableSeason; + @ApiModelProperty(value = "开口深度") + private String collarDepth; + @ApiModelProperty(value = "鞋底材质") + private String outsoleMaterial; + @ApiModelProperty(value = "风格") + private String style; + @ApiModelProperty(value = "款式") + private String design; + @ApiModelProperty(value = "皮质特征") + private String leatherFeatures; + @ApiModelProperty(value = "制作工艺") + private String manufacturingProcess; + @ApiModelProperty(value = "图案") + private String pattern; + @ApiModelProperty(value = "闭合方式") + private String closureType; + @ApiModelProperty(value = "适用场景") + private String occasion; + @ApiModelProperty(value = "适用年龄") + private String suitableAge; + @ApiModelProperty(value = "厚薄") + private String thickness; + @ApiModelProperty(value = "流行元素") + private String fashionElements; + @ApiModelProperty(value = "适用对象") + private String suitablePerson; + } + + @Data + @AllArgsConstructor + @NoArgsConstructor + @Valid + public static class SPCSizeVO { + @ApiModelProperty(value = "商品尺码", required = true) + @NotNull(message = "档口商品定价不能为空!") + private Integer size; + @NotNull(message = "是否是标准尺码不能为空!") + @ApiModelProperty(value = "是否是标准尺码", required = true) + private Integer standard; + } + + @Data + public static class StoreProdSvcVO { + @ApiModelProperty(value = "大小码及定制款可退") + private String customRefund; + @ApiModelProperty(value = "30天包退") + private String thirtyDayRefund; + @ApiModelProperty(value = "一件起批") + private String oneBatchSale; + @ApiModelProperty(value = "退款72小时到账") + private String refundWithinThreeDay; + } + + @Data + public static class StoreProdProcessVO { + @ApiModelProperty(value = "鞋型") + private String shoeType; + @ApiModelProperty(value = "楦号") + private String shoeSize; + @ApiModelProperty(value = "主皮") + private String mainSkin; + @ApiModelProperty(value = "主皮用量") + private String mainSkinUsage; + @ApiModelProperty(value = "配皮") + private String matchSkin; + @ApiModelProperty(value = "配皮用量") + private String matchSkinUsage; + @ApiModelProperty(value = "领口") + private String neckline; + @ApiModelProperty(value = "膛底") + private String insole; + @ApiModelProperty(value = "扣件/拉头") + private String fastener; + @ApiModelProperty(value = "辅料") + private String shoeAccessories; + @ApiModelProperty(value = "包头") + private String toeCap; + @ApiModelProperty(value = "包边") + private String edgeBinding; + @ApiModelProperty(value = "中大底") + private String midOutsole; + @ApiModelProperty(value = "防水台") + private String platformSole; + @ApiModelProperty(value = "中底厂家编码") + private String midsoleFactoryCode; + @ApiModelProperty(value = "外底厂家编码") + private String outsoleFactoryCode; + @ApiModelProperty(value = "跟厂编码") + private String heelFactoryCode; + @ApiModelProperty(value = "配料") + private String components; + @ApiModelProperty(value = "第二底料") + private String secondSoleMaterial; + @ApiModelProperty(value = "第二配料") + private String secondUpperMaterial; + @ApiModelProperty(value = "自定义") + private String customAttr; + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdUpdateVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdUpdateVO.java new file mode 100644 index 000000000..a1ea91e87 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdUpdateVO.java @@ -0,0 +1,255 @@ +package com.ruoyi.web.controller.xkt.vo.storeProd; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.ruoyi.web.controller.xkt.vo.storeColor.StoreColorVO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@Data +@JsonInclude(JsonInclude.Include.NON_NULL) +public class StoreProdUpdateVO { + + @ApiModelProperty(value = "档口商品名称") + private String prodName; + @ApiModelProperty(value = "档口ID", required = true) + @NotNull(message = "档口ID不能为空!") + private Long storeId; + @ApiModelProperty(value = "商品分类ID", required = true) + @NotNull(message = "商品分类ID不能为空!") + private Long prodCateId; + @ApiModelProperty(value = "商品分类名称", required = true) + @NotBlank(message = "商品分类名称不能为空!") + private String prodCateName; + @ApiModelProperty(value = "工厂货号") + @Size(min = 0, max = 15, message = "工厂货号不能超过60个字!") + private String factoryArtNum; + @ApiModelProperty(value = "商品货号", required = true) + @Size(min = 0, max = 15, message = "商品货号不能超过60个字!") + @NotBlank(message = "商品货号不能为空!") + private String prodArtNum; + @ApiModelProperty(value = "商品标题", required = true) + @Size(min = 0, max = 60, message = "商品标题不能超过60个字!") + @NotBlank(message = "商品标题不能为空!") + private String prodTitle; + @ApiModelProperty(value = "商品重量") + private BigDecimal prodWeight; + @ApiModelProperty(value = "生产价格") + private Integer producePrice; + @ApiModelProperty(value = "大小码加价") + private Integer overPrice; + @ApiModelProperty(value = "发货时效") + private Integer deliveryTime; + @ApiModelProperty(value = "上架方式:1 立即上架 2 定时上架", required = true) + @NotNull(message = "上架方式不能为空!") + private Integer listingWay; + @ApiModelProperty(value = "商品状态:1.未发布 2. 在售 3. 尾货 4.已下架 5. 已删除", required = true) + @NotNull(message = "商品状态不能为空!") + private Integer prodStatus; + @ApiModelProperty(value = "定时发货时间(精确到小时)") + @JsonFormat(pattern = "yyyy-MM-dd HH") + private Date listingWaySchedule; + @ApiModelProperty(value = "档口文件列表", required = true) + @NotNull(message = "档口文件不能为空!") + @Valid + private List fileList; + @NotNull(message = "档口类目属性不能为空!") + @Valid + @ApiModelProperty(value = "档口类目属性", required = true) + private StoreProdCateAttrVO cateAttr; + @NotNull(message = "档口所有颜色列表不能为空!") + @ApiModelProperty(value = "档口所有颜色列表", required = true) + @Valid + private List allColorList; + @NotNull(message = "档口尺码列表不能为空!") + @Valid + @ApiModelProperty(value = "档口尺码列表", required = true) + private List sizeList; + @Valid + @NotNull(message = "商品颜色价格列表不能为空!") + @ApiModelProperty(value = "档口颜色价格列表", required = true) + private List colorPriceList; + @ApiModelProperty(value = "档口服务承诺") + private StoreProdSvcVO svc; + @NotBlank(message = "详情内容不能为空!") + @ApiModelProperty(value = "详情内容", required = true) +// @Xss + private String detail; + @ApiModelProperty(value = "档口生产工艺") + private StoreProdProcessVO process; + + + + @Data + @Valid + public static class SPCColorPriceVO { + @ApiModelProperty(value = "档口商品颜色ID") + private Long storeColorId; + @NotBlank(message = "颜色名称不能为空!") + @ApiModelProperty(value = "颜色名称", required = true) + private String colorName; + @NotNull(message = "档口商品定价不能为空!") + @ApiModelProperty(value = "档口商品定价", required = true) + private BigDecimal price; + @NotNull(message = "排序不能为空!") + @ApiModelProperty(value = "排序", required = true) + private Integer orderNum; + } + + + @Data + @Valid + public static class StoreProdFileVO { + @NotBlank(message = "文件名称不能为空!") + @ApiModelProperty(value = "文件名称", required = true) + private String fileName; + @NotBlank(message = "文件路径不能为空!") + @ApiModelProperty(value = "文件路径", required = true) + private String fileUrl; + @NotNull(message = "文件大小不能为空!") + @ApiModelProperty(value = "文件大小", required = true) + private BigDecimal fileSize; + @NotNull(message = "文件类型不能为空!") + @ApiModelProperty(value = "文件类型", required = true) + private Integer fileType; + @ApiModelProperty(value = "排序", required = true) + @NotNull(message = "排序不能为空!") + private Integer orderNum; + } + + @Data + public static class StoreProdCateAttrVO { + @NotBlank(message = "帮面材质不可为空!") + @ApiModelProperty(value = "帮面材质", required = true) + private String upperMaterial; + @NotBlank(message = "内里材质不可为空!") + @ApiModelProperty(value = "内里材质", required = true) + private String liningMaterial; + @NotBlank(message = "鞋垫材质不可为空!") + @ApiModelProperty(value = "鞋垫材质", required = true) + private String insoleMaterial; + @ApiModelProperty(value = "上市季节年份") + private String releaseYearSeason; + @ApiModelProperty(value = "后跟高") + private String heelHeight; + @ApiModelProperty(value = "跟底款式") + private String heelType; + @ApiModelProperty(value = "鞋头款式") + private String toeStyle; + @ApiModelProperty(value = "适合季节") + private String suitableSeason; + @ApiModelProperty(value = "开口深度") + private String collarDepth; + @ApiModelProperty(value = "鞋底材质") + private String outsoleMaterial; + @ApiModelProperty(value = "风格") + private String style; + @ApiModelProperty(value = "款式") + private String design; + @ApiModelProperty(value = "皮质特征") + private String leatherFeatures; + @ApiModelProperty(value = "制作工艺") + private String manufacturingProcess; + @ApiModelProperty(value = "图案") + private String pattern; + @ApiModelProperty(value = "闭合方式") + private String closureType; + @ApiModelProperty(value = "适用场景") + private String occasion; + @ApiModelProperty(value = "适用年龄") + private String suitableAge; + @ApiModelProperty(value = "厚薄") + private String thickness; + @ApiModelProperty(value = "流行元素") + private String fashionElements; + @ApiModelProperty(value = "适用对象") + private String suitablePerson; + } + + @Data + @AllArgsConstructor + @NoArgsConstructor + @Valid + public static class SPCSizeVO { + @ApiModelProperty(value = "商品尺码", required = true) + @NotNull(message = "档口商品定价不能为空!") + private Integer size; + @NotNull(message = "是否是标准尺码不能为空!") + @ApiModelProperty(value = "是否是标准尺码", required = true) + private Integer standard; + } + + @Data + public static class StoreProdSvcVO { + @ApiModelProperty(value = "大小码及定制款可退") + private String customRefund; + @ApiModelProperty(value = "30天包退") + private String thirtyDayRefund; + @ApiModelProperty(value = "一件起批") + private String oneBatchSale; + @ApiModelProperty(value = "退款72小时到账") + private String refundWithinThreeDay; + } + + @Data + public static class StoreProdProcessVO { + @ApiModelProperty(value = "鞋型") + private String shoeType; + @ApiModelProperty(value = "楦号") + private String shoeSize; + @ApiModelProperty(value = "主皮") + private String mainSkin; + @ApiModelProperty(value = "主皮用量") + private String mainSkinUsage; + @ApiModelProperty(value = "配皮") + private String matchSkin; + @ApiModelProperty(value = "配皮用量") + private String matchSkinUsage; + @ApiModelProperty(value = "领口") + private String neckline; + @ApiModelProperty(value = "膛底") + private String insole; + @ApiModelProperty(value = "扣件/拉头") + private String fastener; + @ApiModelProperty(value = "辅料") + private String shoeAccessories; + @ApiModelProperty(value = "包头") + private String toeCap; + @ApiModelProperty(value = "包边") + private String edgeBinding; + @ApiModelProperty(value = "中大底") + private String midOutsole; + @ApiModelProperty(value = "防水台") + private String platformSole; + @ApiModelProperty(value = "中底厂家编码") + private String midsoleFactoryCode; + @ApiModelProperty(value = "外底厂家编码") + private String outsoleFactoryCode; + @ApiModelProperty(value = "跟厂编码") + private String heelFactoryCode; + @ApiModelProperty(value = "配料") + private String components; + @ApiModelProperty(value = "第二底料") + private String secondSoleMaterial; + @ApiModelProperty(value = "第二配料") + private String secondUpperMaterial; + @ApiModelProperty(value = "自定义") + private String customAttr; + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdVO.java index 1ed1d8015..74d059330 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdVO.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProd/StoreProdVO.java @@ -2,7 +2,6 @@ package com.ruoyi.web.controller.xkt.vo.storeProd; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonInclude; -import com.ruoyi.common.xss.Xss; import com.ruoyi.web.controller.xkt.vo.storeColor.StoreColorVO; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; @@ -68,34 +67,48 @@ public class StoreProdVO { @ApiModelProperty(value = "档口文件列表", required = true) @NotNull(message = "档口文件不能为空!") @Valid - private List fileList; + private List fileList; @NotNull(message = "档口类目属性不能为空!") @Valid @ApiModelProperty(value = "档口类目属性", required = true) - private StoreProdCateAttrVO cateAttr; + private StoreProdCreateVO.StoreProdCateAttrVO cateAttr; @NotNull(message = "档口所有颜色列表不能为空!") @ApiModelProperty(value = "档口所有颜色列表", required = true) - private List allColorList; - @NotNull(message = "商品颜色列表不能为空!") @Valid - @ApiModelProperty(value = "商品颜色列表", required = true) - private List colorList; + private List allColorList; @NotNull(message = "档口尺码列表不能为空!") @Valid @ApiModelProperty(value = "档口尺码列表", required = true) - private List sizeList; - @NotNull(message = "档口颜色价格列表不能为空!") + private List sizeList; @Valid + @NotNull(message = "商品颜色价格列表不能为空!") @ApiModelProperty(value = "档口颜色价格列表", required = true) - private List priceList; + private List colorPriceList; @ApiModelProperty(value = "档口服务承诺") - private StoreProdSvcVO svc; + private StoreProdCreateVO.StoreProdSvcVO svc; @NotBlank(message = "详情内容不能为空!") @ApiModelProperty(value = "详情内容", required = true) -// @Xss private String detail; @ApiModelProperty(value = "档口生产工艺") - private StoreProdProcessVO process; + private StoreProdCreateVO.StoreProdProcessVO process; + + + @Data + @Valid + public static class SPCColorPriceVO { + @ApiModelProperty(value = "档口商品颜色ID") + private Long storeColorId; + @NotBlank(message = "颜色名称不能为空!") + @ApiModelProperty(value = "颜色名称", required = true) + private String colorName; + @NotNull(message = "档口商品定价不能为空!") + @ApiModelProperty(value = "档口商品定价", required = true) + private BigDecimal price; + @NotNull(message = "排序不能为空!") + @ApiModelProperty(value = "排序", required = true) + private Integer orderNum; + } + @Data @Valid @@ -166,29 +179,11 @@ public class StoreProdVO { private String suitablePerson; } - @Data - @Valid - public static class StoreProdColorVO { - @ApiModelProperty(value = "档口颜色ID") - private Long storeColorId; - @NotBlank(message = "颜色名称不能为空!") - @ApiModelProperty(value = "颜色名称", required = true) - private String colorName; - @NotNull(message = "排序不能为空!") - @ApiModelProperty(value = "排序", required = true) - private Integer orderNum; - } - @Data @AllArgsConstructor @NoArgsConstructor @Valid - public static class StoreProdColorSizeVO { - @ApiModelProperty(value = "档口颜色ID") - private Long storeColorId; - @NotBlank(message = "颜色名称不能为空!") - @ApiModelProperty(value = "颜色名称") - private String colorName; + public static class SPCSizeVO { @ApiModelProperty(value = "商品尺码", required = true) @NotNull(message = "档口商品定价不能为空!") private Integer size; @@ -197,19 +192,6 @@ public class StoreProdVO { private Integer standard; } - @Data - @Valid - public static class StoreProdColorPriceVO { - @ApiModelProperty(value = "档口商品颜色ID") - private Long storeColorId; - @NotBlank(message = "颜色名称不能为空!") - @ApiModelProperty(value = "颜色名称", required = true) - private String colorName; - @NotNull(message = "档口商品定价不能为空!") - @ApiModelProperty(value = "档口商品定价", required = true) - private BigDecimal price; - } - @Data public static class StoreProdSvcVO { @ApiModelProperty(value = "大小码及定制款可退") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandExportVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandExportVO.java index 40c6a04f4..f3634a0e4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandExportVO.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandExportVO.java @@ -19,8 +19,7 @@ public class StoreProdDemandExportVO { @ApiModelProperty(value = "档口ID", required = true) @NotNull(message = "档口ID不能为空") private Long storeId; - @NotNull(message = "档口需求明细ID不能为空") - @ApiModelProperty(value = "档口需求明细ID", required = true) + @ApiModelProperty(value = "档口需求明细ID") private List storeProdDemandDetailIdList; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandFinishAllVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandFinishAllVO.java new file mode 100644 index 000000000..8ec11e127 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandFinishAllVO.java @@ -0,0 +1,27 @@ +package com.ruoyi.web.controller.xkt.vo.storeProductDemand; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@Data +public class StoreProdDemandFinishAllVO { + + @ApiModelProperty(value = "档口ID", required = true) + @NotNull(message = "档口ID不能为空") + private Long storeId; + @NotNull(message = "档口需求明细ID不能为空") + @ApiModelProperty(value = "档口需求明细ID", required = true) + private List storeProdDemandDetailIdList; + @NotNull(message = "档口需求ID列表不能为空") + @ApiModelProperty(value = "档口需求ID列表", required = true) + private List storeProdDemandIdList; + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandStatusCountResVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandStatusCountResVO.java new file mode 100644 index 000000000..527d3f277 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandStatusCountResVO.java @@ -0,0 +1,23 @@ +package com.ruoyi.web.controller.xkt.vo.storeProductDemand; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@Data +@JsonInclude(JsonInclude.Include.NON_NULL) +public class StoreProdDemandStatusCountResVO { + + @ApiModelProperty(value = "待生产数量") + private Integer unProductionNum; + @ApiModelProperty(value = "生产中数量") + private Integer inProductionNum; + @ApiModelProperty(value = "生产完成数量") + private Integer productionCompleteNum; + +} diff --git a/xkt/src/main/java/com/ruoyi/xkt/domain/StoreCustomer.java b/xkt/src/main/java/com/ruoyi/xkt/domain/StoreCustomer.java index 9f7c202db..c8cfa539c 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/domain/StoreCustomer.java +++ b/xkt/src/main/java/com/ruoyi/xkt/domain/StoreCustomer.java @@ -19,6 +19,7 @@ import java.math.BigDecimal; */ @EqualsAndHashCode(callSuper = true) @Data +@Accessors(chain = true) public class StoreCustomer extends XktBaseEntity { private static final long serialVersionUID = 1L; diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProduct/StoreProdCreateDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProduct/StoreProdCreateDTO.java new file mode 100644 index 000000000..5769e99a3 --- /dev/null +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProduct/StoreProdCreateDTO.java @@ -0,0 +1,34 @@ +package com.ruoyi.xkt.dto.storeProduct; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.ruoyi.xkt.dto.storeColor.StoreColorDTO; +import com.ruoyi.xkt.dto.storeProdCateAttr.StoreProdCateAttrDTO; +import com.ruoyi.xkt.dto.storeProdProcess.StoreProdProcessDTO; +import com.ruoyi.xkt.dto.storeProdSvc.StoreProdSvcDTO; +import com.ruoyi.xkt.dto.storeProductFile.StoreProdFileDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@Data +@JsonInclude(JsonInclude.Include.NON_NULL) +public class StoreProdCreateDTO { + + + +} diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProduct/StoreProdDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProduct/StoreProdDTO.java index 57ccc0dc2..2c9e4fd9a 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProduct/StoreProdDTO.java +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProduct/StoreProdDTO.java @@ -11,10 +11,15 @@ import com.ruoyi.xkt.dto.storeProdSvc.StoreProdSvcDTO; import com.ruoyi.xkt.dto.storeProductFile.StoreProdFileDTO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; import lombok.experimental.Accessors; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; import java.math.BigDecimal; import java.util.Date; import java.util.List; @@ -29,19 +34,27 @@ import java.util.List; @Accessors(chain = true) public class StoreProdDTO { - @ApiModelProperty("档口商品名称") + @ApiModelProperty(value = "档口商品名称") private String prodName; - @ApiModelProperty(value = "档口ID") + @ApiModelProperty(value = "档口ID", required = true) + @NotNull(message = "档口ID不能为空!") private Long storeId; - @ApiModelProperty(value = "商品分类ID") + @ApiModelProperty(value = "商品分类ID", required = true) + @NotNull(message = "商品分类ID不能为空!") private Long prodCateId; - @ApiModelProperty(value = "商品分类名称") + @ApiModelProperty(value = "商品分类名称", required = true) + @NotBlank(message = "商品分类名称不能为空!") private String prodCateName; @ApiModelProperty(value = "工厂货号") + @Size(min = 0, max = 15, message = "工厂货号不能超过60个字!") private String factoryArtNum; - @ApiModelProperty(value = "商品货号") + @ApiModelProperty(value = "商品货号", required = true) + @Size(min = 0, max = 15, message = "商品货号不能超过60个字!") + @NotBlank(message = "商品货号不能为空!") private String prodArtNum; - @ApiModelProperty(value = "商品标题") + @ApiModelProperty(value = "商品标题", required = true) + @Size(min = 0, max = 60, message = "商品标题不能超过60个字!") + @NotBlank(message = "商品标题不能为空!") private String prodTitle; @ApiModelProperty(value = "商品重量") private BigDecimal prodWeight; @@ -51,31 +64,74 @@ public class StoreProdDTO { private Integer overPrice; @ApiModelProperty(value = "发货时效") private Integer deliveryTime; - @ApiModelProperty(value = "上架方式") + @ApiModelProperty(value = "上架方式:1 立即上架 2 定时上架", required = true) + @NotNull(message = "上架方式不能为空!") private Integer listingWay; - @ApiModelProperty(value = "商品状态") + @ApiModelProperty(value = "商品状态:1.未发布 2. 在售 3. 尾货 4.已下架 5. 已删除", required = true) + @NotNull(message = "商品状态不能为空!") private Integer prodStatus; - @ApiModelProperty(value = "详情内容") - private String detail; @ApiModelProperty(value = "定时发货时间(精确到小时)") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + @JsonFormat(pattern = "yyyy-MM-dd HH") private Date listingWaySchedule; - @ApiModelProperty(value = "档口文件列表") + @ApiModelProperty(value = "档口文件列表", required = true) + @NotNull(message = "档口文件不能为空!") + @Valid private List fileList; - @ApiModelProperty(value = "档口类目属性列表") + @NotNull(message = "档口类目属性不能为空!") + @Valid + @ApiModelProperty(value = "档口类目属性", required = true) private StoreProdCateAttrDTO cateAttr; @NotNull(message = "档口所有颜色列表不能为空!") - @ApiModelProperty(value = "档口所有颜色列表") + @ApiModelProperty(value = "档口所有颜色列表", required = true) + @Valid private List allColorList; - @ApiModelProperty(value = "商品颜色列表") - private List colorList; - @ApiModelProperty(value = "档口商品尺码列表") - private List sizeList; - @ApiModelProperty(value = "档口价格列表") - private List priceList; + @NotNull(message = "档口尺码列表不能为空!") + @Valid + @ApiModelProperty(value = "档口尺码列表", required = true) + private List sizeList; + @Valid + @NotNull(message = "商品颜色价格列表不能为空!") + @ApiModelProperty(value = "档口颜色价格列表", required = true) + private List colorPriceList; @ApiModelProperty(value = "档口服务承诺") private StoreProdSvcDTO svc; + @NotBlank(message = "详情内容不能为空!") + @ApiModelProperty(value = "详情内容", required = true) +// @Xss + private String detail; @ApiModelProperty(value = "档口生产工艺") private StoreProdProcessDTO process; + + @Data + @Valid + public static class SPCColorPriceDTO { + @ApiModelProperty(value = "档口商品颜色ID") + private Long storeColorId; + @NotBlank(message = "颜色名称不能为空!") + @ApiModelProperty(value = "颜色名称", required = true) + private String colorName; + @NotNull(message = "档口商品定价不能为空!") + @ApiModelProperty(value = "档口商品定价", required = true) + private BigDecimal price; + @NotNull(message = "排序不能为空!") + @ApiModelProperty(value = "排序", required = true) + private Integer orderNum; + } + + + @Data + @AllArgsConstructor + @NoArgsConstructor + @Valid + public static class SPCSizeDTO { + @ApiModelProperty(value = "商品尺码", required = true) + @NotNull(message = "档口商品定价不能为空!") + private Integer size; + @NotNull(message = "是否是标准尺码不能为空!") + @ApiModelProperty(value = "是否是标准尺码", required = true) + private Integer standard; + } + + } diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProduct/StoreProdUpdateDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProduct/StoreProdUpdateDTO.java new file mode 100644 index 000000000..0481b71a4 --- /dev/null +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProduct/StoreProdUpdateDTO.java @@ -0,0 +1,132 @@ +package com.ruoyi.xkt.dto.storeProduct; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.ruoyi.xkt.dto.storeColor.StoreColorDTO; +import com.ruoyi.xkt.dto.storeProdCateAttr.StoreProdCateAttrDTO; +import com.ruoyi.xkt.dto.storeProdProcess.StoreProdProcessDTO; +import com.ruoyi.xkt.dto.storeProdSvc.StoreProdSvcDTO; +import com.ruoyi.xkt.dto.storeProductFile.StoreProdFileDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@Data +@JsonInclude(JsonInclude.Include.NON_NULL) +public class StoreProdUpdateDTO { + + @ApiModelProperty(value = "档口商品名称") + private String prodName; + @ApiModelProperty(value = "档口ID", required = true) + @NotNull(message = "档口ID不能为空!") + private Long storeId; + @ApiModelProperty(value = "商品分类ID", required = true) + @NotNull(message = "商品分类ID不能为空!") + private Long prodCateId; + @ApiModelProperty(value = "商品分类名称", required = true) + @NotBlank(message = "商品分类名称不能为空!") + private String prodCateName; + @ApiModelProperty(value = "工厂货号") + @Size(min = 0, max = 15, message = "工厂货号不能超过60个字!") + private String factoryArtNum; + @ApiModelProperty(value = "商品货号", required = true) + @Size(min = 0, max = 15, message = "商品货号不能超过60个字!") + @NotBlank(message = "商品货号不能为空!") + private String prodArtNum; + @ApiModelProperty(value = "商品标题", required = true) + @Size(min = 0, max = 60, message = "商品标题不能超过60个字!") + @NotBlank(message = "商品标题不能为空!") + private String prodTitle; + @ApiModelProperty(value = "商品重量") + private BigDecimal prodWeight; + @ApiModelProperty(value = "生产价格") + private Integer producePrice; + @ApiModelProperty(value = "大小码加价") + private Integer overPrice; + @ApiModelProperty(value = "发货时效") + private Integer deliveryTime; + @ApiModelProperty(value = "上架方式:1 立即上架 2 定时上架", required = true) + @NotNull(message = "上架方式不能为空!") + private Integer listingWay; + @ApiModelProperty(value = "商品状态:1.未发布 2. 在售 3. 尾货 4.已下架 5. 已删除", required = true) + @NotNull(message = "商品状态不能为空!") + private Integer prodStatus; + @ApiModelProperty(value = "定时发货时间(精确到小时)") + @JsonFormat(pattern = "yyyy-MM-dd HH") + private Date listingWaySchedule; + @ApiModelProperty(value = "档口文件列表", required = true) + @NotNull(message = "档口文件不能为空!") + @Valid + private List fileList; + @NotNull(message = "档口类目属性不能为空!") + @Valid + @ApiModelProperty(value = "档口类目属性", required = true) + private StoreProdCateAttrDTO cateAttr; + @NotNull(message = "档口所有颜色列表不能为空!") + @ApiModelProperty(value = "档口所有颜色列表", required = true) + @Valid + private List allColorList; + @NotNull(message = "档口尺码列表不能为空!") + @Valid + @ApiModelProperty(value = "档口尺码列表", required = true) + private List sizeList; + @Valid + @NotNull(message = "商品颜色价格列表不能为空!") + @ApiModelProperty(value = "档口颜色价格列表", required = true) + private List colorPriceList; + @ApiModelProperty(value = "档口服务承诺") + private StoreProdSvcDTO svc; + @NotBlank(message = "详情内容不能为空!") + @ApiModelProperty(value = "详情内容", required = true) +// @Xss + private String detail; + @ApiModelProperty(value = "档口生产工艺") + private StoreProdProcessDTO process; + + + @Data + @Valid + public static class SPCColorPriceDTO { + @ApiModelProperty(value = "档口商品颜色ID") + private Long storeColorId; + @NotBlank(message = "颜色名称不能为空!") + @ApiModelProperty(value = "颜色名称", required = true) + private String colorName; + @NotNull(message = "档口商品定价不能为空!") + @ApiModelProperty(value = "档口商品定价", required = true) + private BigDecimal price; + @NotNull(message = "排序不能为空!") + @ApiModelProperty(value = "排序", required = true) + private Integer orderNum; + } + + + @Data + @AllArgsConstructor + @NoArgsConstructor + @Valid + public static class SPCSizeDTO { + @ApiModelProperty(value = "商品尺码", required = true) + @NotNull(message = "档口商品定价不能为空!") + private Integer size; + @NotNull(message = "是否是标准尺码不能为空!") + @ApiModelProperty(value = "是否是标准尺码", required = true) + private Integer standard; + } + + +} diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandFinishAllDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandFinishAllDTO.java new file mode 100644 index 000000000..7a35e6844 --- /dev/null +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandFinishAllDTO.java @@ -0,0 +1,24 @@ +package com.ruoyi.xkt.dto.storeProductDemand; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@Data +public class StoreProdDemandFinishAllDTO { + + @ApiModelProperty(value = "档口ID") + private Long storeId; + @ApiModelProperty(value = "档口需求明细ID") + private List storeProdDemandDetailIdList; + @ApiModelProperty(value = "档口需求ID列表") + private List storeProdDemandIdList; + +} diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandStatusCountResDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandStatusCountResDTO.java new file mode 100644 index 000000000..9c6a49433 --- /dev/null +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandStatusCountResDTO.java @@ -0,0 +1,23 @@ +package com.ruoyi.xkt.dto.storeProductDemand; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@Data +@JsonInclude(JsonInclude.Include.NON_NULL) +public class StoreProdDemandStatusCountResDTO { + + @ApiModelProperty(value = "待生产数量") + private Integer unProductionNum; + @ApiModelProperty(value = "生产中数量") + private Integer inProductionNum; + @ApiModelProperty(value = "生产完成数量") + private Integer productionCompleteNum; + +} diff --git a/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreCustomerMapper.java b/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreCustomerMapper.java index 3d9c36fb1..bcc6a04f5 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreCustomerMapper.java +++ b/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreCustomerMapper.java @@ -3,8 +3,6 @@ package com.ruoyi.xkt.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.xkt.domain.StoreCustomer; -import java.util.List; - /** * 档口客户Mapper接口 * @@ -12,51 +10,5 @@ import java.util.List; * @date 2025-03-26 */ public interface StoreCustomerMapper extends BaseMapper { - /** - * 查询档口客户 - * - * @param id 档口客户主键 - * @return 档口客户 - */ - public StoreCustomer selectStoreCustomerByStoreCusId(Long id); - /** - * 查询档口客户列表 - * - * @param storeCustomer 档口客户 - * @return 档口客户集合 - */ - public List selectStoreCustomerList(StoreCustomer storeCustomer); - - /** - * 新增档口客户 - * - * @param storeCustomer 档口客户 - * @return 结果 - */ - public int insertStoreCustomer(StoreCustomer storeCustomer); - - /** - * 修改档口客户 - * - * @param storeCustomer 档口客户 - * @return 结果 - */ - public int updateStoreCustomer(StoreCustomer storeCustomer); - - /** - * 删除档口客户 - * - * @param id 档口客户主键 - * @return 结果 - */ - public int deleteStoreCustomerByStoreCusId(Long id); - - /** - * 批量删除档口客户 - * - * @param storeCusIds 需要删除的数据主键集合 - * @return 结果 - */ - public int deleteStoreCustomerByStoreCusIds(Long[] storeCusIds); } diff --git a/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductColorPriceMapper.java b/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductColorPriceMapper.java index e10a560a1..5decfeafa 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductColorPriceMapper.java +++ b/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductColorPriceMapper.java @@ -19,7 +19,6 @@ import java.util.List; @Repository public interface StoreProductColorPriceMapper extends BaseMapper { - void updateDelFlagByStoreProdId(Long storeProdId); List selectListByStoreProdId(Long storeProdId); diff --git a/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductDemandMapper.java b/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductDemandMapper.java index 145ad0be9..e488b2939 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductDemandMapper.java +++ b/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductDemandMapper.java @@ -2,6 +2,7 @@ package com.ruoyi.xkt.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.xkt.domain.StoreProductDemand; +import com.ruoyi.xkt.dto.storeProductDemand.StoreProdDemandStatusCountResDTO; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -31,4 +32,11 @@ public interface StoreProductDemandMapper extends BaseMapper */ void deleteDemandList(@Param("deleteDemandIdList") List deleteDemandIdList); + /** + * 查询各状态数量 + * + * @param storeId 档口ID + * @return StoreProdDemandStatusCountResDTO + */ + StoreProdDemandStatusCountResDTO getStatusNum(@Param("storeId") Long storeId); } diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/IStoreCustomerService.java b/xkt/src/main/java/com/ruoyi/xkt/service/IStoreCustomerService.java index 04af5edb5..e27707d2a 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/IStoreCustomerService.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/IStoreCustomerService.java @@ -1,7 +1,6 @@ package com.ruoyi.xkt.service; import com.ruoyi.common.core.page.Page; -import com.ruoyi.xkt.domain.StoreCustomer; import com.ruoyi.xkt.dto.storeCustomer.StoreCusDTO; import com.ruoyi.xkt.dto.storeCustomer.StoreCusFuzzyResDTO; import com.ruoyi.xkt.dto.storeCustomer.StoreCusPageDTO; @@ -22,23 +21,7 @@ public interface IStoreCustomerService { * @param storeCusId 档口客户主键 * @return 档口客户 */ - public StoreCusDTO selectByStoreCusId(Long storeCusId); - - /** - * 查询档口客户列表 - * - * @param storeCustomer 档口客户 - * @return 档口客户集合 - */ - public List selectStoreCustomerList(StoreCustomer storeCustomer); - - /** - * 新增档口客户 - * - * @param storeCustomer 档口客户 - * @return 结果 - */ - public int insertStoreCustomer(StoreCustomer storeCustomer); + StoreCusDTO selectByStoreCusId(Long storeCusId); /** * 修改档口客户 @@ -46,28 +29,29 @@ public interface IStoreCustomerService { * @param storeCusDTO 档口客户 * @return 结果 */ - public int updateStoreCus(StoreCusDTO storeCusDTO); + int updateStoreCus(StoreCusDTO storeCusDTO); /** - * 批量删除档口客户 + * 新增档口客户 * - * @param storeCusIds 需要删除的档口客户主键集合 - * @return 结果 + * @param storeCusDTO 新增入参 + * @return */ - public int deleteStoreCustomerByStoreCusIds(Long[] storeCusIds); - - /** - * 删除档口客户信息 - * - * @param storeCusId 档口客户主键 - * @return 结果 - */ - public int deleteStoreCustomerByStoreCusId(Long storeCusId); - int create(StoreCusDTO storeCusDTO); + /** + * 删除档口客户 + * + * @param storeCusId 档口客户ID + */ void deleteStoreCus(Long storeCusId); + /** + * 查询档口客户分页 + * + * @param storeCusPageDTO + * @return + */ Page selectPage(StoreCusPageDTO storeCusPageDTO); /** diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/IStoreProductDemandService.java b/xkt/src/main/java/com/ruoyi/xkt/service/IStoreProductDemandService.java index bab495730..fb9e8f60a 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/IStoreProductDemandService.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/IStoreProductDemandService.java @@ -68,6 +68,7 @@ public interface IStoreProductDemandService { * @return 返回一个包含校验结果的DTO对象,包括是否存在以及相关的验证信息 */ StoreProdDemandVerifyResDTO verifyDemandExist(StoreProdDemandVerifyDTO demandVerifyDTO); + /** * 导出生产需求单 * @@ -76,4 +77,19 @@ public interface IStoreProductDemandService { */ List export(StoreProdDemandExportDTO exportDTO); + /** + * 获取需求单各个状态对应的数量 + * + * @param storeId 档口ID + * @return StoreProdDemandStatusCountResDTO + */ + StoreProdDemandStatusCountResDTO getStatusNum(Long storeId); + + /** + * 全部完成 + * + * @param finishAllDTO 全部完成 + * @return Integer + */ + Integer finishAll(StoreProdDemandFinishAllDTO finishAllDTO); } diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/IStoreProductService.java b/xkt/src/main/java/com/ruoyi/xkt/service/IStoreProductService.java index 3118b77dd..c11d5ccc9 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/IStoreProductService.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/IStoreProductService.java @@ -48,7 +48,7 @@ public interface IStoreProductService { * @param storeProdDTO 档口商品 * @return 结果 */ - int insertStoreProduct(StoreProdDTO storeProdDTO) throws IOException; + int create(StoreProdDTO storeProdDTO) throws IOException; /** * 修改档口商品 @@ -56,7 +56,7 @@ public interface IStoreProductService { * @param storeProdDTO 档口商品 * @return 结果 */ - int updateStoreProduct(Long storeProdId, StoreProdDTO storeProdDTO) throws IOException; + int update(Long storeProdId, StoreProdDTO storeProdDTO) throws IOException; /** * 更新档口商品状态 @@ -158,4 +158,5 @@ public interface IStoreProductService { * @return List */ List fuzzyQueryLatest30List(Long storeId, String prodArtNum); + } diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreCustomerServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreCustomerServiceImpl.java index 7a36b95cf..ee5475885 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreCustomerServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreCustomerServiceImpl.java @@ -8,7 +8,6 @@ import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.core.page.Page; import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.xkt.domain.StoreCustomer; import com.ruoyi.xkt.dto.storeCustomer.StoreCusDTO; @@ -116,7 +115,7 @@ public class StoreCustomerServiceImpl implements IStoreCustomerService { .eq(StoreCustomer::getId, storeCusDTO.getStoreCusId()).eq(StoreCustomer::getDelFlag, Constants.UNDELETED))) .orElseThrow(() -> new ServiceException("档口客户不存在!")); BeanUtil.copyProperties(storeCusDTO, storeCus); - return storeCusMapper.updateStoreCustomer(storeCus); + return storeCusMapper.updateById(storeCus); } @@ -135,55 +134,4 @@ public class StoreCustomerServiceImpl implements IStoreCustomerService { return BeanUtil.toBean(storeCus, StoreCusDTO.class); } - /** - * 查询档口客户列表 - * - * @param storeCustomer 档口客户 - * @return 档口客户 - */ - @Override - @Transactional(readOnly = true) - public List selectStoreCustomerList(StoreCustomer storeCustomer) { - return storeCusMapper.selectStoreCustomerList(storeCustomer); - } - - /** - * 新增档口客户 - * - * @param storeCustomer 档口客户 - * @return 结果 - */ - @Override - @Transactional - public int insertStoreCustomer(StoreCustomer storeCustomer) { - storeCustomer.setCreateTime(DateUtils.getNowDate()); - return storeCusMapper.insertStoreCustomer(storeCustomer); - } - - - /** - * 批量删除档口客户 - * - * @param storeCusIds 需要删除的档口客户主键 - * @return 结果 - */ - @Override - @Transactional - public int deleteStoreCustomerByStoreCusIds(Long[] storeCusIds) { - return storeCusMapper.deleteStoreCustomerByStoreCusIds(storeCusIds); - } - - /** - * 删除档口客户信息 - * - * @param storeCusId 档口客户主键 - * @return 结果 - */ - @Override - @Transactional - public int deleteStoreCustomerByStoreCusId(Long storeCusId) { - return storeCusMapper.deleteStoreCustomerByStoreCusId(storeCusId); - } - - } diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductDemandServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductDemandServiceImpl.java index 89d7d3108..92ad13ae1 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductDemandServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductDemandServiceImpl.java @@ -51,6 +51,18 @@ public class StoreProductDemandServiceImpl implements IStoreProductDemandService final StoreProductStorageDemandDeductMapper storageDemandDeductMapper; + /** + * 获取需求单各个状态对应的数量 + * + * @param storeId 档口ID + * @return StoreProdDemandStatusCountResDTO + */ + @Override + @Transactional(readOnly = true) + public StoreProdDemandStatusCountResDTO getStatusNum(Long storeId) { + return this.storeProdDemandMapper.getStatusNum(storeId); + } + /** * 获取指定门店及商品的库存和生产数量 * 此方法用于查询特定门店中特定商品的库存和生产数量信息,帮助进行库存管理和生产计划制定 @@ -381,9 +393,12 @@ public class StoreProductDemandServiceImpl implements IStoreProductDemandService @Override @Transactional(readOnly = true) public List export(StoreProdDemandExportDTO exportDTO) { - List demandDetailList = this.storeProdDemandDetailMapper.selectList(new LambdaQueryWrapper() - .eq(StoreProductDemandDetail::getStoreId, exportDTO.getStoreId()).eq(StoreProductDemandDetail::getDelFlag, Constants.UNDELETED) - .in(StoreProductDemandDetail::getId, exportDTO.getStoreProdDemandDetailIdList())); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(StoreProductDemandDetail::getStoreId, exportDTO.getStoreId()).eq(StoreProductDemandDetail::getDelFlag, Constants.UNDELETED); + if (CollectionUtils.isNotEmpty(exportDTO.getStoreProdDemandDetailIdList())) { + queryWrapper.in(StoreProductDemandDetail::getId, exportDTO.getStoreProdDemandDetailIdList()); + } + List demandDetailList = this.storeProdDemandDetailMapper.selectList(queryWrapper); List downLoadList = demandDetailList.stream().sorted(Comparator.comparing(StoreProductDemandDetail::getProdArtNum)) .map(x -> new StoreProdDemandDownloadDTO() .setProdArtNum(x.getProdArtNum()).setColorName(x.getColorName()).setSize30Quantity(x.getSize30()).setSize31Quantity(x.getSize31()) @@ -552,8 +567,8 @@ public class StoreProductDemandServiceImpl implements IStoreProductDemandService // 更新数量为最新数量 .setQuantity(quantity); }); - this.storeProdDemandDetailMapper.updateById(demandDetailList); // 有需求明细的抵扣关系,则将已完成的入库单数量变更为当前需求单数量 并将需求明细状态置为已完成 + this.storeProdDemandDetailMapper.updateById(demandDetailList); List listAfterUpdate = this.storeProdDemandDetailMapper.selectList(new LambdaQueryWrapper() .in(StoreProductDemandDetail::getStoreProdDemandId, demandDetailList.stream().map(StoreProductDemandDetail::getStoreProdDemandId).collect(Collectors.toList())) .eq(StoreProductDemandDetail::getDelFlag, Constants.UNDELETED)); @@ -571,6 +586,47 @@ public class StoreProductDemandServiceImpl implements IStoreProductDemandService } } + /** + * 全部完成 + * + * @param finishAllDTO 全部完成 + * @return Integer + */ + @Override + @Transactional + public Integer finishAll(StoreProdDemandFinishAllDTO finishAllDTO) { + List demandDetailList = this.storeProdDemandDetailMapper.selectList(new LambdaQueryWrapper() + .eq(StoreProductDemandDetail::getDelFlag, Constants.UNDELETED).eq(StoreProductDemandDetail::getStoreId, finishAllDTO.getStoreId()) + .in(StoreProductDemandDetail::getId, finishAllDTO.getStoreProdDemandDetailIdList())); + if (CollectionUtils.isEmpty(demandDetailList)) { + throw new ServiceException("没有找到任何需求单!", HttpStatus.ERROR); + } + // 调整状态为已完成 + demandDetailList.forEach(demandDetail -> demandDetail.setDetailStatus(DemandStatus.PRODUCTION_COMPLETE.getValue())); + int count = this.storeProdDemandDetailMapper.updateById(demandDetailList).size(); + // 查询需求单所有的明细列表,判断状态是否都已完成 + List allDemandDetailList = this.storeProdDemandDetailMapper.selectList(new LambdaQueryWrapper() + .eq(StoreProductDemandDetail::getDelFlag, Constants.UNDELETED).eq(StoreProductDemandDetail::getStoreId, finishAllDTO.getStoreId()) + .in(StoreProductDemandDetail::getStoreProdDemandId, finishAllDTO.getStoreProdDemandIdList())); + List finishDemandIdList = new ArrayList<>(); + // 判断有哪些是都已完成的 + allDemandDetailList.stream().collect(Collectors.groupingBy(StoreProductDemandDetail::getStoreProdDemandId)) + .forEach((demandId, detailList) -> { + // 所有明细均已完成 + if (detailList.stream().allMatch(x -> Objects.equals(x.getDetailStatus(), DemandStatus.PRODUCTION_COMPLETE.getValue()))) { + finishDemandIdList.add(demandId); + } + }); + if (CollectionUtils.isEmpty(finishDemandIdList)) { + return count; + } + List demandList = this.storeProdDemandMapper.selectList(new LambdaQueryWrapper() + .in(StoreProductDemand::getId, finishDemandIdList).eq(StoreProductDemand::getDelFlag, Constants.UNDELETED)); + demandList.forEach(demand -> demand.setDemandStatus(DemandStatus.PRODUCTION_COMPLETE.getValue())); + this.storeProdDemandMapper.updateById(demandList); + return count; + } + /** * 根据商品详情信息添加错误消息 diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductServiceImpl.java index cd3cbe664..2206f1656 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductServiceImpl.java @@ -196,8 +196,7 @@ public class StoreProductServiceImpl implements IStoreProductService { @Override @Transactional - public int insertStoreProduct(StoreProdDTO storeProdDTO) throws IOException { - + public int create(StoreProdDTO createDTO) throws IOException { // TODO 富文本标签过滤 // TODO 富文本标签过滤 @@ -208,29 +207,25 @@ public class StoreProductServiceImpl implements IStoreProductService { // TODO 富文本标签过滤 // 用户是否为档口管理者或子账户 - if (!SecurityUtils.isAdmin() && !SecurityUtils.isStoreManagerOrSub(storeProdDTO.getStoreId())) { + if (!SecurityUtils.isAdmin() && !SecurityUtils.isStoreManagerOrSub(createDTO.getStoreId())) { throw new ServiceException("当前用户非档口管理者或子账号,无权限操作!", HttpStatus.ERROR); } // 组装StoreProduct数据 - StoreProduct storeProd = BeanUtil.toBean(storeProdDTO, StoreProduct.class).setVoucherDate(DateUtils.getNowDate()) + StoreProduct storeProd = BeanUtil.toBean(createDTO, StoreProduct.class).setVoucherDate(DateUtils.getNowDate()) .setRecommendWeight(0L).setSaleWeight(0L).setPopularityWeight(0L); int count = this.storeProdMapper.insert(storeProd); - // 处理档口所有颜色 - Map storeColorMap = this.handleStoreColor(storeProdDTO); - // 处理编辑档口商品颜色 - this.handleStoreProdColorList(storeColorMap, storeProd, storeProdDTO.getColorList(), storeProd.getId(), storeProd.getStoreId(), Boolean.TRUE); - // 处理编辑档口商品颜色尺码 - this.handleStoreProdColorSizeList(storeColorMap, storeProdDTO.getSizeList(), storeProd.getId(), Boolean.TRUE); - // 处理StoreProduct其它属性 - this.handleStoreProdProperties(storeColorMap, storeProd, storeProdDTO); + // 新增档口商品颜色相关 + this.createProdColor(createDTO, storeProd); + // 新增档口商品其它属性 + this.createOtherProperties(createDTO, storeProd); // 立即发布 将商品同步到 ES 商品文档,并将商品主图同步到 以图搜款服务中 if (Objects.equals(storeProd.getListingWay(), ListingType.RIGHT_NOW.getValue())) { // redis中的档口 Store store = this.redisCache.getCacheObject(CacheConstants.STORE_KEY + storeProd.getStoreId()); // 向ES索引: product_info 创建文档 - this.createESDoc(storeProd, storeProdDTO, store.getStoreName()); + this.createESDoc(storeProd, createDTO, store.getStoreName()); // 搜图服务同步 - sync2ImgSearchServer(storeProd.getId(), storeProdDTO.getFileList()); + sync2ImgSearchServer(storeProd.getId(), createDTO.getFileList()); // 新增档口商品动态、关注档口通知公告 this.createNotice(storeProd, store.getStoreName()); } @@ -241,12 +236,12 @@ public class StoreProductServiceImpl implements IStoreProductService { /** * 修改档口商品 * - * @param storeProdDTO 档口商品 + * @param updateDTO 档口商品 * @return 结果 */ @Override @Transactional - public int updateStoreProduct(final Long storeProdId, StoreProdDTO storeProdDTO) throws IOException { + public int update(final Long storeProdId, StoreProdDTO updateDTO) throws IOException { // TODO 富文本标签过滤 @@ -262,37 +257,31 @@ public class StoreProductServiceImpl implements IStoreProductService { .eq(StoreProduct::getId, storeProdId).eq(StoreProduct::getDelFlag, Constants.UNDELETED))) .orElseThrow(() -> new ServiceException("档口商品不存在!", HttpStatus.ERROR)); // 更新档口商品信息 - BeanUtil.copyProperties(storeProdDTO, storeProd); + BeanUtil.copyProperties(updateDTO, storeProd); int count = this.storeProdMapper.updateById(storeProd); // 档口文件(商品主图、主图视频、下载的商品详情)的del_flag置为2 this.storeProdFileMapper.updateDelFlagByStoreProdId(storeProdId); // 档口类目属性列表的 del_flag置为2 this.storeProdCateAttrMapper.updateDelFlagByStoreProdId(storeProdId); - // 档口颜色价格列表的del_flag置为2 - this.storeProdColorPriceMapper.updateDelFlagByStoreProdId(storeProdId); // 档口详情内容的del_flag置为2 this.storeProdDetailMapper.updateDelFlagByStoreProdId(storeProdId); // 档口服务承诺的del_flag置为2 this.storeProdSvcMapper.updateDelFlagByStoreProdId(storeProdId); // 档口工艺信息的del_flag置为2 this.storeProdProcMapper.updateDelFlagByStoreProdId(storeProdId); - // 处理档口所有颜色 - Map storeColorMap = this.handleStoreColor(storeProdDTO); + // 更新档口商品颜色价格及尺码等 + this.updateColorRelation(updateDTO, storeProdId, storeProd.getStoreId()); // 处理更新逻辑 - this.handleStoreProdProperties(storeColorMap, storeProd, storeProdDTO); - // 处理编辑档口商品颜色 - this.handleStoreProdColorList(storeColorMap, storeProd, storeProdDTO.getColorList(), storeProdId, storeProd.getStoreId(), Boolean.FALSE); - // 处理编辑档口商品颜色尺码 - this.handleStoreProdColorSizeList(storeColorMap, storeProdDTO.getSizeList(), storeProdId, Boolean.FALSE); + this.updateOtherProperties(updateDTO, storeProd); // 只有在售和尾货状态,更新ES 信息 及 图搜 if (Objects.equals(storeProd.getProdStatus(), EProductStatus.ON_SALE.getValue()) || Objects.equals(storeProd.getProdStatus(), EProductStatus.TAIL_GOODS.getValue())) { // 从redis中获取store Store store = this.redisCache.getCacheObject(CacheConstants.STORE_KEY + storeProd.getStoreId()); // 更新索引: product_info 的文档 - this.updateESDoc(storeProd, storeProdDTO, store.getStoreName()); + this.updateESDoc(storeProd, updateDTO, store.getStoreName()); // 搜图服务同步 - sync2ImgSearchServer(storeProd.getId(), storeProdDTO.getFileList()); + sync2ImgSearchServer(storeProd.getId(), updateDTO.getFileList()); // 更新档口商品动态、关注档口、收藏商品通知公告 this.updateNotice(storeProd, store.getStoreName()); } @@ -300,157 +289,182 @@ public class StoreProductServiceImpl implements IStoreProductService { } /** - * 处理档口所有的颜色 + * 更新商品其它属性 * - * @param storeProdDTO 入参 - * @return Map + * @param updateDTO 更新入参 + * @param storeProd 档口商品 */ - private Map handleStoreColor(StoreProdDTO storeProdDTO) { - // 处理档口所有颜色列表 - List storeColorList = this.storeColorMapper.selectList(new LambdaQueryWrapper() - .eq(StoreColor::getStoreId, storeProdDTO.getStoreId()).eq(StoreColor::getDelFlag, Constants.UNDELETED)); - List dbStoreColorIdList = storeColorList.stream().map(StoreColor::getId).collect(Collectors.toList()); - // 新增的颜色列表 - List addColorList = storeProdDTO.getAllColorList().stream().filter(x -> !dbStoreColorIdList.contains(x.getStoreColorId())) - .map(x -> BeanUtil.toBean(x, StoreColor.class).setStoreId(storeProdDTO.getStoreId())).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(addColorList)) { - this.storeColorMapper.insert(addColorList); + private void updateOtherProperties(StoreProdDTO updateDTO, StoreProduct storeProd) { + // 上传的文件列表 + final List fileDTOList = updateDTO.getFileList(); + // 将文件插入到SysFile表中 + List fileList = BeanUtil.copyToList(fileDTOList, SysFile.class); + this.fileMapper.insert(fileList); + // 将文件名称和文件ID映射到Map中 + Map fileMap = fileList.stream().collect(Collectors.toMap(SysFile::getFileName, SysFile::getId)); + // 档口文件(商品主图、主图视频、下载的商品详情) + List prodFileList = fileDTOList.stream().map(x -> BeanUtil.toBean(x, StoreProductFile.class) + .setFileId(fileMap.get(x.getFileName())).setStoreProdId(storeProd.getId()).setStoreId(updateDTO.getStoreId())) + .collect(Collectors.toList()); + this.storeProdFileMapper.insert(prodFileList); + // 档口类目属性 + this.storeProdCateAttrMapper.insert(BeanUtil.toBean(updateDTO.getCateAttr(), StoreProductCategoryAttribute.class) + .setStoreProdId(storeProd.getId()).setStoreId(storeProd.getStoreId())); + // 档口详情内容 + StoreProductDetail storeProdDetail = new StoreProductDetail().setDetail(updateDTO.getDetail()).setStoreProdId(storeProd.getId()); + this.storeProdDetailMapper.insert(storeProdDetail); + // 档口服务承诺 + if (ObjectUtils.isNotEmpty(updateDTO.getSvc())) { + this.storeProdSvcMapper.insert(BeanUtil.toBean(updateDTO.getSvc(), StoreProductService.class).setStoreProdId(storeProd.getId())); } - // 所有的档口颜色 - CollectionUtils.addAll(addColorList, storeColorList); - return addColorList.stream().collect(Collectors.toMap(StoreColor::getColorName, Function.identity())); - } - - - /** - * 处理店铺商品颜色尺码列表 - * - * @param storeColorMap - * @param sizeDTOList 店铺商品颜色尺码DTO列表 - * @param storeProdId 店铺商品ID - * @param isInsert 是否是插入操作 - */ - private void handleStoreProdColorSizeList(Map storeColorMap, List sizeDTOList, Long storeProdId, Boolean isInsert) { - sizeDTOList.forEach(x -> x.setStoreColorId(storeColorMap.get(x.getColorName()).getId())); - if (isInsert) { - // 如果是插入操作,直接插入新的颜色尺码信息 - List toAddList = sizeDTOList.stream().sorted(Comparator.comparing(StoreProdColorSizeDTO::getStoreColorId)) - .filter(x -> ObjectUtils.isEmpty(x.getStoreProdColorSizeId())).map(x -> BeanUtil - .toBean(x, StoreProductColorSize.class).setStoreProdId(storeProdId)) - .collect(Collectors.toList()); - this.storeProdColorSizeMapper.insert(toAddList); - } else { - // 查询当前商品最新的颜色,并与现在做对比 - List dbColorList = this.storeProdColorMapper.selectList(new LambdaQueryWrapper() - .eq(StoreProductColor::getStoreProdId, storeProdId).eq(StoreProductColor::getDelFlag, Constants.UNDELETED)); - List dbColorIdList = dbColorList.stream().map(StoreProductColor::getId).collect(Collectors.toList()); - List newColorIdList = sizeDTOList.stream().map(StoreProdColorSizeDTO::getStoreColorId).collect(Collectors.toList()); - // 判断这两个list 内容是否完全一致(不考虑顺序,只考虑内容) - boolean colorEqual = CollectionUtils.isEqualCollection(dbColorIdList, newColorIdList); - - // 如果不是插入操作,首先获取数据库中的颜色尺码信息 - List colorSizeList = Optional.ofNullable(this.storeProdColorSizeMapper.selectList(new LambdaQueryWrapper() - .eq(StoreProductColorSize::getStoreProdId, storeProdId).eq(StoreProductColorSize::getDelFlag, Constants.UNDELETED))) - .orElseThrow(() -> new ServiceException("该档口下没有商品及颜色", HttpStatus.ERROR)); - // 标准尺码是否一致 - List dbStandardList = colorSizeList.stream().filter(x -> Objects.equals(x.getStandard(), ProductSizeStatus.STANDARD.getValue())) - .map(StoreProductColorSize::getSize).distinct().collect(Collectors.toList()); - List newStandardList = sizeDTOList.stream().filter(x -> Objects.equals(x.getStandard(), ProductSizeStatus.STANDARD.getValue())) - .map(StoreProdColorSizeDTO::getSize).collect(Collectors.toList()); - boolean standardEqual = CollectionUtils.isEqualCollection(dbStandardList, newStandardList); - // 如果两项都没变动,则不做任何调整 - if (colorEqual && standardEqual) { - return; - } - boolean colorUpdate = Boolean.FALSE; - // 颜色不相等 - if (!colorEqual) { - // 新增的颜色 - List addColorIdList = newColorIdList.stream().filter(x -> !dbColorIdList.contains(x)).collect(Collectors.toList()); - List toUpdateList = new ArrayList<>(); - if (CollectionUtils.isNotEmpty(addColorIdList)) { - Map sizeMap = sizeDTOList.stream().collect(Collectors.toMap(StoreProdColorSizeDTO::getSize, StoreProdColorSizeDTO::getStandard)); - sizeMap.forEach((size, standard) -> addColorIdList.forEach(storeColorId -> toUpdateList - .add(new StoreProductColorSize().setSize(size).setStoreColorId(storeColorId).setStoreProdId(storeProdId).setStandard(standard)))); - } - // 删除的颜色 - List deleteColorIdList = dbColorIdList.stream().filter(x -> !newColorIdList.contains(x)).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(deleteColorIdList)) { - toUpdateList.addAll(colorSizeList.stream().filter(x -> deleteColorIdList.contains(x.getStoreColorId())).peek(x -> x.setDelFlag(DELETED)).collect(Collectors.toList())); - } - if (CollectionUtils.isNotEmpty(toUpdateList)) { - this.storeProdColorSizeMapper.insertOrUpdate(toUpdateList); - } - colorUpdate = Boolean.TRUE; - } - if (!standardEqual) { - // 如果更新过颜色,则重新从数据库获取数据 - if (colorUpdate) { - colorSizeList = Optional.ofNullable(this.storeProdColorSizeMapper.selectList(new LambdaQueryWrapper() - .eq(StoreProductColorSize::getStoreProdId, storeProdId).eq(StoreProductColorSize::getDelFlag, Constants.UNDELETED))) - .orElseThrow(() -> new ServiceException("该档口下没有商品及颜色", HttpStatus.ERROR)); - } - // 新增的标准尺码 - List createStandardList = newStandardList.stream().filter(item -> !dbStandardList.contains(item)).collect(Collectors.toList()); - List toUpdateList = new ArrayList<>(); - if (CollectionUtils.isNotEmpty(createStandardList)) { - toUpdateList.addAll(colorSizeList.stream().filter(item -> createStandardList.contains(item.getSize())).peek(x -> x.setStandard(ProductSizeStatus.STANDARD.getValue())).collect(Collectors.toList())); - } - // 删除的标准尺码 - List deleteStandardList = dbStandardList.stream().filter(item -> !newStandardList.contains(item)).collect(Collectors.toList()); - // 将这些标准尺码的standard置为0 - if (CollectionUtils.isNotEmpty(deleteStandardList)) { - toUpdateList.addAll(colorSizeList.stream().filter(x -> deleteStandardList.contains(x.getSize())).peek(x -> x.setStandard(ProductSizeStatus.UN_STANDARD.getValue())).collect(Collectors.toList())); - } - if (CollectionUtils.isNotEmpty(toUpdateList)) { - this.storeProdColorSizeMapper.insertOrUpdate(toUpdateList); - } - } + // 档口生产工艺信息 + if (ObjectUtils.isNotEmpty(updateDTO.getProcess())) { + this.storeProdProcMapper.insert(BeanUtil.toBean(updateDTO.getProcess(), StoreProductProcess.class).setStoreProdId(storeProd.getId())); } } /** - * 处理店铺商品颜色列表 + * 更新档口商品其它属性 * - * @param storeColorMap - * @param storeProd 档口商品 - * @param colorDTOList 商品颜色DTO列表 - * @param storeProdId 店铺商品ID - * @param storeId 店铺ID - * @param isInsert 是否是插入操作 + * @param updateDTO 更新入参 + * @param storeProdId 档口商品ID + * @param storeId 档口ID */ - private void handleStoreProdColorList(Map storeColorMap, StoreProduct storeProd, List colorDTOList, Long storeProdId, Long storeId, Boolean isInsert) { - // 档口商品颜色map,给入参赋值 - colorDTOList.forEach(x -> x.setStoreColorId(storeColorMap.get(x.getColorName()).getId())); - if (isInsert) { - // 过滤出需要添加的商品颜色,并转换为StoreProductColor对象 - List toAddList = colorDTOList.stream().filter(x -> ObjectUtils.isEmpty(x.getStoreProdColorId())) - .map(x -> BeanUtil.toBean(x, StoreProductColor.class).setStoreProdId(storeProdId).setStoreId(storeId)).collect(Collectors.toList()); - // 如果是插入操作,直接添加新的商品颜色 - this.storeProdColorMapper.insert(toAddList); - // 给设置了所有商品优惠的客户 新增优惠 - this.createStoreCusDiscount(toAddList, storeProd); - } else { - List dbColorList = Optional.ofNullable(this.storeProdColorMapper.selectList(new LambdaQueryWrapper() - .eq(StoreProductColor::getStoreProdId, storeProdId).eq(StoreProductColor::getDelFlag, Constants.UNDELETED) - .eq(StoreProductColor::getStoreId, storeId))) - .orElseThrow(() -> new ServiceException("该档口下没有商品及颜色", HttpStatus.ERROR)); - final List dbStoreColorIdList = dbColorList.stream().map(StoreProductColor::getStoreColorId).collect(Collectors.toList()); - final List newStoreColorIdList = colorDTOList.stream().map(StoreProdColorDTO::getStoreColorId).collect(Collectors.toList()); - // 新增的颜色 - List newColorList = colorDTOList.stream().filter(x -> !dbStoreColorIdList.contains(x.getStoreColorId())) - .map(x -> BeanUtil.toBean(x, StoreProductColor.class).setStoreProdId(storeProdId).setStoreId(storeId)).collect(Collectors.toList()); - // 给设置了所有商品优惠的客户 新增优惠 - this.createStoreCusDiscount(newColorList, storeProd); - // 删除的颜色 - List deleteColorList = dbColorList.stream().filter(x -> !newStoreColorIdList.contains(x.getStoreColorId())) - .peek(x -> x.setDelFlag(Constants.DELETED)).collect(Collectors.toList()); - // 将deleteColorList添加到newColorList中 并且是null-safe - CollectionUtils.addAll(newColorList, deleteColorList); - if (CollectionUtils.isNotEmpty(newColorList)) { - this.storeProdColorMapper.insertOrUpdate(newColorList); - } + private void updateColorRelation(StoreProdDTO updateDTO, Long storeProdId, Long storeId) { + // 处理档口所有颜色 + Map storeColorMap = updateDTO.getAllColorList().stream().filter(x -> ObjectUtils.isNotEmpty(x.getStoreColorId())) + .collect(Collectors.toMap(StoreColorDTO::getColorName, StoreColorDTO::getStoreColorId)); + List newColorList = updateDTO.getAllColorList().stream().filter(x -> ObjectUtils.isEmpty(x.getStoreColorId())) + .map(x -> BeanUtil.toBean(x, StoreColor.class).setStoreId(updateDTO.getStoreId())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(newColorList)) { + this.storeColorMapper.insert(newColorList); + storeColorMap.putAll(newColorList.stream().collect(Collectors.toMap(StoreColor::getColorName, StoreColor::getId))); } + // 所有颜色列表 + List prodColorList = this.storeProdColorMapper.selectList(new LambdaQueryWrapper() + .eq(StoreProductColor::getStoreProdId, storeProdId).eq(StoreProductColor::getDelFlag, Constants.UNDELETED)); + List existColorIdList = prodColorList.stream().map(StoreProductColor::getStoreColorId).collect(Collectors.toList()); + prodColorList.forEach(color -> { + // 判断有哪些是删除的颜色 + if (!storeColorMap.containsValue(color.getStoreColorId())) { + color.setDelFlag(Constants.DELETED); + } + }); + // 非新增颜色价格map + Map existColorPriceMap = updateDTO.getColorPriceList().stream().filter(x -> ObjectUtils.isNotEmpty(x.getStoreColorId())) + .collect(Collectors.toMap(StoreProdDTO.SPCColorPriceDTO::getStoreColorId, StoreProdDTO.SPCColorPriceDTO::getPrice)); + // 所有已存在的颜色价格列表 + List storeColorPriceList = this.storeProdColorPriceMapper.selectList(new LambdaQueryWrapper() + .eq(StoreProductColorPrice::getStoreProdId, storeProdId).eq(StoreProductColorPrice::getDelFlag, Constants.UNDELETED)); + storeColorPriceList.forEach(x -> { + // 判断有哪些是删除的颜色 + if (!storeColorMap.containsValue(x.getStoreColorId())) { + x.setDelFlag(Constants.DELETED); + } else { + // 更新颜色价格 + x.setPrice(existColorPriceMap.get(x.getStoreColorId())); + } + }); + // 标准尺码map + Map standardSizeMap = updateDTO.getSizeList().stream().collect(Collectors + .toMap(StoreProdDTO.SPCSizeDTO::getSize, StoreProdDTO.SPCSizeDTO::getStandard)); + // 所有已存在的颜色价格尺码列表 + List storeColorSizeList = this.storeProdColorSizeMapper.selectList(new LambdaQueryWrapper() + .eq(StoreProductColorSize::getStoreProdId, storeProdId).eq(StoreProductColorSize::getDelFlag, Constants.UNDELETED)); + storeColorSizeList.forEach(x -> { + // 哪些是删除颜色 + if (!storeColorMap.containsValue(x.getStoreColorId())) { + x.setDelFlag(Constants.DELETED); + } else { + // 更新标准尺码 + x.setStandard(standardSizeMap.get(x.getSize())); + } + }); + // 新增的颜色价格等 + List newColorPriceList = updateDTO.getColorPriceList().stream() + .filter(x -> !existColorIdList.contains(x.getStoreColorId())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(newColorPriceList)) { + newColorPriceList.forEach(newColorPrice -> { + Long storeColorId = storeColorMap.get(newColorPrice.getColorName()); + prodColorList.add(new StoreProductColor().setStoreProdId(storeProdId).setStoreColorId(storeColorMap.get(newColorPrice.getColorName())) + .setColorName(newColorPrice.getColorName()).setOrderNum(newColorPrice.getOrderNum()).setStoreId(storeId)); + storeColorPriceList.add(new StoreProductColorPrice().setStoreColorId(storeColorId).setPrice(newColorPrice.getPrice()).setStoreProdId(storeProdId)); + updateDTO.getSizeList().forEach(size -> storeColorSizeList.add(new StoreProductColorSize().setStoreColorId(storeColorId).setSize(size.getSize()) + .setStoreProdId(storeProdId).setStandard(size.getStandard()))); + }); + } + this.storeProdColorMapper.insertOrUpdate(prodColorList); + this.storeProdColorPriceMapper.insertOrUpdate(storeColorPriceList); + this.storeProdColorSizeMapper.insertOrUpdate(storeColorSizeList); + } + + /** + * 新增档口商品其它属性 + * + * @param createDTO 新增入参 + * @param storeProd 档口商品 + */ + private void createOtherProperties(StoreProdDTO createDTO, StoreProduct storeProd) { + // 上传的文件列表 + final List fileDTOList = createDTO.getFileList(); + // 将文件插入到SysFile表中 + List fileList = BeanUtil.copyToList(fileDTOList, SysFile.class); + this.fileMapper.insert(fileList); + // 将文件名称和文件ID映射到Map中 + Map fileMap = fileList.stream().collect(Collectors.toMap(SysFile::getFileName, SysFile::getId)); + // 档口文件(商品主图、主图视频、下载的商品详情) + List prodFileList = fileDTOList.stream().map(x -> BeanUtil.toBean(x, StoreProductFile.class) + .setFileId(fileMap.get(x.getFileName())).setStoreProdId(storeProd.getId()).setStoreId(createDTO.getStoreId())) + .collect(Collectors.toList()); + this.storeProdFileMapper.insert(prodFileList); + // 档口类目属性 + this.storeProdCateAttrMapper.insert(BeanUtil.toBean(createDTO.getCateAttr(), StoreProductCategoryAttribute.class) + .setStoreProdId(storeProd.getId()).setStoreId(storeProd.getStoreId())); + // 档口详情内容 + StoreProductDetail storeProdDetail = new StoreProductDetail().setDetail(createDTO.getDetail()).setStoreProdId(storeProd.getId()); + this.storeProdDetailMapper.insert(storeProdDetail); + // 档口服务承诺 + if (ObjectUtils.isNotEmpty(createDTO.getSvc())) { + this.storeProdSvcMapper.insert(BeanUtil.toBean(createDTO.getSvc(), StoreProductService.class).setStoreProdId(storeProd.getId())); + } + // 档口生产工艺信息 + if (ObjectUtils.isNotEmpty(createDTO.getProcess())) { + this.storeProdProcMapper.insert(BeanUtil.toBean(createDTO.getProcess(), StoreProductProcess.class).setStoreProdId(storeProd.getId())); + } + } + + /** + * 新增档口商品颜色等 + * + * @param createDTO 入参 + * @param storeProd 档口商品 + */ + private void createProdColor(StoreProdDTO createDTO, StoreProduct storeProd) { + // 处理档口所有颜色 + Map storeColorMap = createDTO.getAllColorList().stream().filter(x -> ObjectUtils.isNotEmpty(x.getStoreColorId())) + .collect(Collectors.toMap(StoreColorDTO::getColorName, StoreColorDTO::getStoreColorId)); + List newColorList = createDTO.getAllColorList().stream().filter(x -> ObjectUtils.isEmpty(x.getStoreColorId())) + .map(x -> BeanUtil.toBean(x, StoreColor.class).setStoreId(createDTO.getStoreId())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(newColorList)) { + this.storeColorMapper.insert(newColorList); + storeColorMap.putAll(newColorList.stream().collect(Collectors.toMap(StoreColor::getColorName, StoreColor::getId))); + } + // 新增 档口颜色与尺码 + List prodColorPriceList = new ArrayList<>(); + List prodColorSizeList = new ArrayList<>(); + List prodColorList = new ArrayList<>(); + createDTO.getColorPriceList().forEach(colorPrice -> { + prodColorList.add(new StoreProductColor().setStoreProdId(storeProd.getId()).setStoreColorId(storeColorMap.get(colorPrice.getColorName())) + .setColorName(colorPrice.getColorName()).setOrderNum(colorPrice.getOrderNum()).setStoreId(storeProd.getStoreId())); + prodColorPriceList.add(new StoreProductColorPrice().setStoreProdId(storeProd.getId()).setPrice(colorPrice.getPrice()) + .setStoreColorId(storeColorMap.get(colorPrice.getColorName()))); + prodColorSizeList.addAll(createDTO.getSizeList().stream().map(x -> new StoreProductColorSize().setSize(x.getSize()).setStoreProdId(storeProd.getId()) + .setStandard(x.getStandard()).setStoreColorId(storeColorMap.get(colorPrice.getColorName()))) + .collect(Collectors.toList())); + }); + this.storeProdColorPriceMapper.insert(prodColorPriceList); + this.storeProdColorSizeMapper.insert(prodColorSizeList); + this.storeProdColorMapper.insert(prodColorList); } /** @@ -829,11 +843,10 @@ public class StoreProductServiceImpl implements IStoreProductService { /** * 处理档口商品属性 * - * @param storeColorMap 档口颜色map - * @param storeProd 档口商品实体 - * @param storeProdDTO 档口商品数据传输对象 + * @param storeProd 档口商品实体 + * @param storeProdDTO 档口商品数据传输对象 */ - private void handleStoreProdProperties(Map storeColorMap, StoreProduct storeProd, StoreProdDTO storeProdDTO) { + private void handleStoreProdProperties(StoreProduct storeProd, StoreProdDTO storeProdDTO) { // 上传的文件列表 final List fileDTOList = storeProdDTO.getFileList(); // 将文件插入到SysFile表中 @@ -850,10 +863,10 @@ public class StoreProductServiceImpl implements IStoreProductService { this.storeProdCateAttrMapper.insert(BeanUtil.toBean(storeProdDTO.getCateAttr(), StoreProductCategoryAttribute.class) .setStoreProdId(storeProd.getId()).setStoreId(storeProd.getStoreId())); // 档口颜色价格列表 - List priceList = storeProdDTO.getPriceList().stream().map(x -> BeanUtil.toBean(x, StoreProductColorPrice.class) - .setStoreProdId(storeProd.getId()).setStoreColorId(storeColorMap.get(x.getColorName()).getId())) - .collect(Collectors.toList()); - this.storeProdColorPriceMapper.insert(priceList); +// List priceList = storeProdDTO.getPriceList().stream().map(x -> BeanUtil.toBean(x, StoreProductColorPrice.class) +// .setStoreProdId(storeProd.getId()).setStoreColorId(storeColorMap.get(x.getColorName()).getId())) +// .collect(Collectors.toList()); +// this.storeProdColorPriceMapper.insert(priceList); // 档口详情内容 StoreProductDetail storeProdDetail = new StoreProductDetail().setDetail(storeProdDTO.getDetail()).setStoreProdId(storeProd.getId()); this.storeProdDetailMapper.insert(storeProdDetail); @@ -892,13 +905,13 @@ public class StoreProductServiceImpl implements IStoreProductService { /** * 向ES索引更新文档 * - * @param storeProd 档口商品 - * @param storeProdDTO 档口商品更新入参 - * @param storeName 档口名称 + * @param storeProd 档口商品 + * @param updateDTO 档口商品更新入参 + * @param storeName 档口名称 * @throws IOException */ - private void updateESDoc(StoreProduct storeProd, StoreProdDTO storeProdDTO, String storeName) throws IOException { - ESProductDTO esProductDTO = this.getESDTO(storeProd, storeProdDTO, storeName); + private void updateESDoc(StoreProduct storeProd, StoreProdDTO updateDTO, String storeName) throws IOException { + ESProductDTO esProductDTO = this.getESDTO(storeProd, updateDTO, storeName); try { UpdateResponse updateResponse = esClientWrapper.getEsClient().update(u -> u .index(Constants.ES_IDX_PRODUCT_INFO).doc(esProductDTO).id(storeProd.getId().toString()), ESProductDTO.class); @@ -913,29 +926,29 @@ public class StoreProductServiceImpl implements IStoreProductService { /** * 组装ES 入参 DTO * - * @param storeProd 档口商品 - * @param storeProdDTO 档口商品更新入参 - * @param storeName 档口名称 + * @param storeProd 档口商品 + * @param updateDTO 档口商品更新入参 + * @param storeName 档口名称 * @return */ - private ESProductDTO getESDTO(StoreProduct storeProd, StoreProdDTO storeProdDTO, String storeName) { + private ESProductDTO getESDTO(StoreProduct storeProd, StoreProdDTO updateDTO, String storeName) { // 获取第一张主图 - String firstMainPic = storeProdDTO.getFileList().stream().filter(x -> Objects.equals(x.getFileType(), FileType.MAIN_PIC.getValue())) + String firstMainPic = updateDTO.getFileList().stream().filter(x -> Objects.equals(x.getFileType(), FileType.MAIN_PIC.getValue())) .min(Comparator.comparing(StoreProdFileDTO::getOrderNum)).map(StoreProdFileDTO::getFileUrl) .orElseThrow(() -> new ServiceException("商品主图不存在!", HttpStatus.ERROR)); // 是否有主图视频 - boolean hasVideo = storeProdDTO.getFileList().stream().anyMatch(x -> Objects.equals(x.getFileType(), FileType.MAIN_PIC_VIDEO.getValue())); + boolean hasVideo = updateDTO.getFileList().stream().anyMatch(x -> Objects.equals(x.getFileType(), FileType.MAIN_PIC_VIDEO.getValue())); // 获取上一级分类的分类ID 及 分类名称 - ProdCateDTO parCate = this.prodCateMapper.getParentCate(storeProdDTO.getProdCateId()); + ProdCateDTO parCate = this.prodCateMapper.getParentCate(updateDTO.getProdCateId()); // 获取当前商品的最低价格 - BigDecimal minPrice = storeProdDTO.getPriceList().stream().min(Comparator.comparing(StoreProdColorPriceSimpleDTO::getPrice)) - .map(StoreProdColorPriceSimpleDTO::getPrice).orElseThrow(() -> new ServiceException("商品价格不存在!", HttpStatus.ERROR)); + BigDecimal minPrice = updateDTO.getColorPriceList().stream().min(Comparator.comparing(StoreProdDTO.SPCColorPriceDTO::getPrice)) + .map(StoreProdDTO.SPCColorPriceDTO::getPrice).orElseThrow(() -> new ServiceException("商品价格不存在!", HttpStatus.ERROR)); // 获取使用季节 - String season = storeProdDTO.getCateAttr().getSuitableSeason(); + String season = updateDTO.getCateAttr().getSuitableSeason(); // 获取风格 - String style = storeProdDTO.getCateAttr().getStyle(); + String style = updateDTO.getCateAttr().getStyle(); return BeanUtil.toBean(storeProd, ESProductDTO.class).setHasVideo(hasVideo) - .setProdCateName(storeProdDTO.getProdCateName()).setSaleWeight("0").setRecommendWeight("0").setPopularityWeight("0") + .setProdCateName(updateDTO.getProdCateName()).setSaleWeight("0").setRecommendWeight("0").setPopularityWeight("0") .setCreateTime(DateUtils.getTime()).setStoreName(storeName).setMainPicUrl(firstMainPic) .setParCateId(parCate.getProdCateId().toString()).setParCateName(parCate.getName()).setProdPrice(minPrice.toString()) .setSeason(season).setStyle(style).setTags(Collections.singletonList(style)); diff --git a/xkt/src/main/resources/mapper/StoreCustomerMapper.xml b/xkt/src/main/resources/mapper/StoreCustomerMapper.xml index 00e38030f..66b8f715b 100644 --- a/xkt/src/main/resources/mapper/StoreCustomerMapper.xml +++ b/xkt/src/main/resources/mapper/StoreCustomerMapper.xml @@ -3,93 +3,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - - - - - - - select id, store_id, cus_name, phone, remark, version, del_flag, create_by, create_time, update_by, update_time from store_customer - - - - - - - - insert into store_customer - - store_id, - cus_name, - phone, - remark, - version, - del_flag, - create_by, - create_time, - update_by, - update_time, - - - #{storeId}, - #{cusName}, - #{phone}, - #{remark}, - #{version}, - #{delFlag}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - - - - - update store_customer - - store_id = #{storeId}, - cus_name = #{cusName}, - phone = #{phone}, - remark = #{remark}, - version = #{version}, - del_flag = #{delFlag}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - - where id = #{id} - - - - delete from store_customer where id = #{id} - - - - delete from store_customer where id in - - #{id} - - \ No newline at end of file diff --git a/xkt/src/main/resources/mapper/StoreProductColorPriceMapper.xml b/xkt/src/main/resources/mapper/StoreProductColorPriceMapper.xml index a25f1225e..d83555953 100644 --- a/xkt/src/main/resources/mapper/StoreProductColorPriceMapper.xml +++ b/xkt/src/main/resources/mapper/StoreProductColorPriceMapper.xml @@ -4,10 +4,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - UPDATE store_product_color_price SET del_flag = 2 WHERE store_prod_id = #{storeProdId} - - - - - and code = #{code} - and demand_status = #{demandStatus} - and version = #{version} - - - - - - - insert into store_product_demand - - code, - demand_status, - version, - del_flag, - create_by, - create_time, - update_by, - update_time, - - - #{code}, - #{demandStatus}, - #{version}, - #{delFlag}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - - - - - update store_product_demand - - code = #{code}, - demand_status = #{demandStatus}, - version = #{version}, - del_flag = #{delFlag}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - - where id = #{id} - - - - delete from store_product_demand where id = #{id} - - - - delete from store_product_demand where id in - - #{id} - - UPDATE @@ -104,6 +25,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + diff --git a/xkt/src/main/resources/mapper/UserSubscriptionsMapper.xml b/xkt/src/main/resources/mapper/UserSubscriptionsMapper.xml index e3219b79c..1ced30992 100644 --- a/xkt/src/main/resources/mapper/UserSubscriptionsMapper.xml +++ b/xkt/src/main/resources/mapper/UserSubscriptionsMapper.xml @@ -72,14 +72,14 @@ SELECT us.user_id, 3 AS targetNoticeType FROM user_subscriptions us WHERE us.del_flag = 0 - AND us.store_id = ? + AND us.store_id = #{storeId} UNION SELECT uf.user_id , 4 AS targetNoticeType FROM user_favorites uf WHERE uf.del_flag = 0 - AND uf.store_prod_id = ? + AND uf.store_prod_id = #{storeProdId}