From 03f8682ad38ca7eff5a9fe08fb35836a48aa3c1e Mon Sep 17 00:00:00 2001 From: liujiang <569804566@qq.com> Date: Sat, 5 Apr 2025 22:35:53 +0800 Subject: [PATCH] =?UTF-8?q?master=EF=BC=9A=E9=9C=80=E6=B1=82=E5=8D=95?= =?UTF-8?q?=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 --- ...toreCustomerProductDiscountController.java | 8 - .../xkt/StoreFactoryController.java | 4 +- .../StoreProductBarcodeMatchController.java | 2 - .../xkt/StoreProductColorController.java | 15 +- .../xkt/StoreProductDemandController.java | 77 +--- ...ProductStorageDemandDeducteController.java | 13 +- .../xkt/StoreSaleRefundRecordController.java | 18 +- .../StoreProdDemandDeleteVO.java | 26 ++ .../StoreProdDemandVerifyResVO.java | 21 + .../StoreProdDemandVerifyVO.java | 72 ++++ .../com/ruoyi/common/constant/Constants.java | 19 +- .../StoreProdDemandDeleteDTO.java | 23 + .../StoreProdDemandVerifyDTO.java | 64 +++ .../StoreProdDemandVerifyResDTO.java | 21 + .../xkt/mapper/StoreProductDemandMapper.java | 11 + .../service/IStoreProductDemandService.java | 55 +-- .../xkt/service/impl/ExpressServiceImpl.java | 4 +- ...oreCustomerProductDiscountServiceImpl.java | 2 +- .../impl/StoreCustomerServiceImpl.java | 1 - .../service/impl/StoreFactoryServiceImpl.java | 10 +- .../impl/StoreProductDemandServiceImpl.java | 405 +++++++++++++++--- .../impl/StoreProductStockServiceImpl.java | 13 +- .../impl/StoreProductStorageServiceImpl.java | 114 ++--- .../mapper/StoreProductDemandMapper.xml | 9 + 24 files changed, 730 insertions(+), 277 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandDeleteVO.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandVerifyResVO.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandVerifyVO.java create mode 100644 xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandDeleteDTO.java create mode 100644 xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandVerifyDTO.java create mode 100644 xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandVerifyResDTO.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreCustomerProductDiscountController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreCustomerProductDiscountController.java index 5869cb9b3..94af016eb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreCustomerProductDiscountController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreCustomerProductDiscountController.java @@ -14,7 +14,6 @@ import com.ruoyi.xkt.service.IStoreCustomerProductDiscountService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -48,12 +47,6 @@ public class StoreCustomerProductDiscountController extends XktBaseController { } - - - - - - /** * 查询档口客户优惠列表 */ @@ -97,7 +90,6 @@ public class StoreCustomerProductDiscountController extends XktBaseController { } - /** * 删除档口客户优惠 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreFactoryController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreFactoryController.java index 75ca2a93c..a529120b1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreFactoryController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreFactoryController.java @@ -17,7 +17,6 @@ import com.ruoyi.xkt.service.IStoreFactoryService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -import org.apache.commons.lang3.ObjectUtils; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -79,11 +78,10 @@ public class StoreFactoryController extends XktBaseController { @ApiOperation(value = "获取档口合作工厂详细信息", httpMethod = "GET", response = R.class) @GetMapping(value = "/{storeId}/{storeFactoryId}") public R getInfo(@PathVariable("storeId") Long storeId, @PathVariable("storeFactoryId") Long storeFactoryId) { - return R.ok(BeanUtil.toBean(storeFactoryService.selectByStoreFacId(storeId ,storeFactoryId), StoreFactoryVO.class)); + return R.ok(BeanUtil.toBean(storeFactoryService.selectByStoreFacId(storeId, storeFactoryId), StoreFactoryVO.class)); } - /** * 导出档口合作工厂列表 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductBarcodeMatchController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductBarcodeMatchController.java index ba46fae3a..1e9b34e84 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductBarcodeMatchController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductBarcodeMatchController.java @@ -12,7 +12,6 @@ import com.ruoyi.xkt.domain.StoreProductBarcodeMatch; import com.ruoyi.xkt.dto.storeProdBarcodeMatch.BarcodeMatchDTO; import com.ruoyi.xkt.service.IStoreProductBarcodeMatchService; import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -44,7 +43,6 @@ public class StoreProductBarcodeMatchController extends XktBaseController { } - /** * 查询档口条形码和第三方系统条形码匹配结果列表 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductColorController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductColorController.java index e196dd4c5..1d26928ce 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductColorController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductColorController.java @@ -1,23 +1,18 @@ package com.ruoyi.web.controller.xkt; import cn.hutool.core.bean.BeanUtil; -import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.XktBaseController; import com.ruoyi.common.core.domain.R; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.web.controller.xkt.vo.storePordColor.StoreProdColorResVO; -import com.ruoyi.xkt.domain.StoreProductColor; import com.ruoyi.xkt.service.IStoreProductColorService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; -import java.util.List; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; /** * 档口当前商品颜色Controller @@ -40,7 +35,7 @@ public class StoreProductColorController extends XktBaseController { @ApiOperation(value = "模糊查询档口所有的商品颜色分类", httpMethod = "GET", response = R.class) @GetMapping(value = "/fuzzy") public R fuzzyQueryColorList(@RequestParam(value = "prodArtNum", required = false) String prodArtNum, - @RequestParam("storeId") Long storeId) { + @RequestParam("storeId") Long storeId) { return success(BeanUtil.copyToList(storeProdColorService.fuzzyQueryColorList(storeId, prodArtNum), StoreProdColorResVO.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 a5f2ced2c..94736ecb3 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 @@ -1,30 +1,21 @@ package com.ruoyi.web.controller.xkt; import cn.hutool.core.bean.BeanUtil; -import com.github.pagehelper.PageInfo; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.XktBaseController; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.page.Page; -import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.web.controller.xkt.vo.storeCustomer.StoreCusPageVO; import com.ruoyi.web.controller.xkt.vo.storeProductDemand.*; -import com.ruoyi.xkt.domain.StoreProductDemand; -import com.ruoyi.xkt.dto.storeCustomer.StoreCusPageDTO; import com.ruoyi.xkt.dto.storeProductDemand.*; import com.ruoyi.xkt.service.IStoreProductDemandService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -41,22 +32,17 @@ public class StoreProductDemandController extends XktBaseController { final IStoreProductDemandService storeProdDemandService; - - // TODO 入库单判断需求单是否存在 - // TODO 入库单判断需求单是否存在 - // TODO 入库单判断需求单是否存在 - // TODO 入库单判断需求单是否存在 - - - // TODO 删除需求单,若该需求单有已完成的入库单,则该需求单状态改为已完成,并将数量改为已完成的入库单数量 - // TODO 删除需求单,若该需求单有已完成的入库单,则该需求单状态改为已完成,并将数量改为已完成的入库单数量 - // TODO 删除需求单,若该需求单有已完成的入库单,则该需求单状态改为已完成,并将数量改为已完成的入库单数量 - // TODO 删除需求单,若该需求单有已完成的入库单,则该需求单状态改为已完成,并将数量改为已完成的入库单数量 - - - // TODO 点击安排生产,状态才会变成:生产中,若仅仅是由入库单来反推,则不能变更状态 - // TODO 点击安排生产,状态才会变成:生产中,若仅仅是由入库单来反推,则不能变更状态 - // TODO 点击安排生产,状态才会变成:生产中,若仅仅是由入库单来反推,则不能变更状态 + /** + * 商品入库校验是否存在需求单 + */ + @PreAuthorize("@ss.hasPermi('system:demand:query')") + @ApiOperation(value = "商品入库校验是否存在需求单", httpMethod = "POST", response = R.class) + @Log(title = "商品入库校验是否存在需求单", businessType = BusinessType.INSERT) + @PostMapping("/verify") + public R verifyDemandExist(@Validated @RequestBody StoreProdDemandVerifyVO demandVerifyVO) { + return R.ok(BeanUtil.toBean(storeProdDemandService + .verifyDemandExist(BeanUtil.toBean(demandVerifyVO, StoreProdDemandVerifyDTO.class)), StoreProdDemandVerifyResVO.class)); + } /** * 根据货号获取所有颜色的库存数量、在产数量 @@ -65,7 +51,7 @@ public class StoreProductDemandController extends XktBaseController { @PreAuthorize("@ss.hasPermi('system:demand:query')") @GetMapping(value = "/exists-quantity/{storeId}/{storeProdId}") public R> getStockAndProduceQuantity(@PathVariable("storeId") Long storeId, @PathVariable("storeProdId") Long storeProdId) { - return R.ok(BeanUtil.copyToList(storeProdDemandService.getStockAndProduceQuantity(storeId, storeProdId), StoreProdDemandQuantityVO.class)); + return R.ok(BeanUtil.copyToList(storeProdDemandService.getStockAndProduceQuantity(storeId, storeProdId), StoreProdDemandQuantityVO.class)); } /** @@ -98,39 +84,22 @@ public class StoreProductDemandController extends XktBaseController { @PutMapping public R updateWorkingStatus(@Validated @RequestBody StoreProdDemandWorkingVO workingVO) { return R.ok(storeProdDemandService.updateWorkingStatus(BeanUtil.toBean(workingVO, StoreProdDemandWorkingDTO.class))); + + // TODO 是否需要导出excel表格 + // TODO 是否需要导出excel表格 + // TODO 是否需要导出excel表格 + } - - - - - - - - - - - - - /** - * 获取档口商品需求单详细信息 - */ - @PreAuthorize("@ss.hasPermi('system:demand:query')") - @GetMapping(value = "/{storeProdDemandId}") - public R getInfo(@PathVariable("storeProdDemandId") Long storeProdDemandId) { - return success(storeProdDemandService.selectStoreProductDemandByStoreProdDemandId(storeProdDemandId)); - } - - - - /** * 删除档口商品需求单 */ @PreAuthorize("@ss.hasPermi('system:demand:remove')") - @Log(title = "档口商品需求单", businessType = BusinessType.DELETE) - @DeleteMapping("/{storeProdDemandIds}") - public R remove(@PathVariable Long[] storeProdDemandIds) { - return success(storeProdDemandService.deleteStoreProductDemandByStoreProdDemandIds(storeProdDemandIds)); + @ApiOperation(value = "删除档口商品需求单", httpMethod = "DELETE", response = R.class) + @Log(title = "删除档口商品需求单", businessType = BusinessType.DELETE) + @DeleteMapping("") + public R remove(@Validated @RequestBody StoreProdDemandDeleteVO deleteVO) { + return R.ok(storeProdDemandService.deleteByStoreProdDemandIds(BeanUtil.toBean(deleteVO, StoreProdDemandDeleteDTO.class))); } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductStorageDemandDeducteController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductStorageDemandDeducteController.java index 423b34368..945bac63c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductStorageDemandDeducteController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreProductStorageDemandDeducteController.java @@ -1,19 +1,10 @@ package com.ruoyi.web.controller.xkt; -import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.XktBaseController; -import com.ruoyi.common.core.domain.R; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.xkt.domain.StoreProductStorageDemandDeduct; import com.ruoyi.xkt.service.IStoreProductStorageDemandDeducteService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; -import java.util.List; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; /** * 档口商品入库抵扣需求Controller diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreSaleRefundRecordController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreSaleRefundRecordController.java index 8e8c057a5..2bd87a225 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreSaleRefundRecordController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreSaleRefundRecordController.java @@ -1,29 +1,19 @@ package com.ruoyi.web.controller.xkt; import cn.hutool.core.bean.BeanUtil; -import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.XktBaseController; import com.ruoyi.common.core.domain.R; -import com.ruoyi.common.core.page.Page; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.web.controller.xkt.vo.storeProdStock.StoreProdStockPageVO; import com.ruoyi.web.controller.xkt.vo.storeSaleRefundRecord.StoreSaleRefundRecordVO; -import com.ruoyi.xkt.domain.StoreSaleRefundRecord; -import com.ruoyi.xkt.dto.storeProductStock.StoreProdStockPageDTO; import com.ruoyi.xkt.dto.storeSaleRefundRecord.StoreSaleRefundRecordDTO; import com.ruoyi.xkt.service.IStoreSaleRefundRecordService; -import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; -import javax.servlet.http.HttpServletResponse; -import javax.validation.constraints.NotNull; import java.util.List; /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandDeleteVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandDeleteVO.java new file mode 100644 index 000000000..5b6e8658a --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandDeleteVO.java @@ -0,0 +1,26 @@ +package com.ruoyi.web.controller.xkt.vo.storeProductDemand; + +import io.swagger.annotations.ApiModel; +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 + */ +@ApiModel("档口需求删除") +@Data +public class StoreProdDemandDeleteVO { + + @ApiModelProperty(value = "档口ID", required = true) + @NotNull(message = "档口ID不能为空") + private Long storeId; + @NotNull(message = "档口需求明细ID不能为空") + @ApiModelProperty(value = "档口需求明细ID", required = true) + private List storeProdDemandDetailIdList; + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandVerifyResVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandVerifyResVO.java new file mode 100644 index 000000000..4bac78c01 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandVerifyResVO.java @@ -0,0 +1,21 @@ +package com.ruoyi.web.controller.xkt.vo.storeProductDemand; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@ApiModel("档口商品生产入库校验是否存在需求单返回前端数据") +@Data +public class StoreProdDemandVerifyResVO { + + @ApiModelProperty(value = "需求不存在信息列表") + private List errorMsgList; + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandVerifyVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandVerifyVO.java new file mode 100644 index 000000000..add649c07 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/storeProductDemand/StoreProdDemandVerifyVO.java @@ -0,0 +1,72 @@ +package com.ruoyi.web.controller.xkt.vo.storeProductDemand; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@ApiModel("档口商品生产入库校验是否存在需求单") +@Data +public class StoreProdDemandVerifyVO { + + @NotNull(message = "档口ID不能为空") + @ApiModelProperty(value = "档口ID", required = true) + private Long storeId; + @NotNull(message = "需求列表不能为空") + @ApiModelProperty(value = "需求列表", required = true) + private List detailList; + + @Data + @ApiModel(value = "需求列表") + public static class DetailVO { + @NotNull(message = "档口商品ID不能为空") + @ApiModelProperty(value = "档口商品ID", required = true) + private Long storeProdId; + @NotNull(message = "档口商品颜色ID不能为空") + @ApiModelProperty(value = "档口商品颜色ID", required = true) + private Long storeProdColorId; + @NotBlank(message = "货号不能为空") + @ApiModelProperty(value = "货号", required = true) + private String prodArtNum; + @NotBlank(message = "颜色不能为空") + @ApiModelProperty(value = "颜色", required = true) + private String colorName; + @ApiModelProperty(value = "尺码30") + private Integer size30; + @ApiModelProperty(value = "尺码31") + private Integer size31; + @ApiModelProperty(value = "尺码32") + private Integer size32; + @ApiModelProperty(value = "尺码33") + private Integer size33; + @ApiModelProperty(value = "尺码34") + private Integer size34; + @ApiModelProperty(value = "尺码35") + private Integer size35; + @ApiModelProperty(value = "尺码36") + private Integer size36; + @ApiModelProperty(value = "尺码37") + private Integer size37; + @ApiModelProperty(value = "尺码38") + private Integer size38; + @ApiModelProperty(value = "尺码39") + private Integer size39; + @ApiModelProperty(value = "尺码40") + private Integer size40; + @ApiModelProperty(value = "尺码41") + private Integer size41; + @ApiModelProperty(value = "尺码42") + private Integer size42; + @ApiModelProperty(value = "尺码43") + private Integer size43; + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index 900b102a4..be51d9036 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -172,7 +172,24 @@ public class Constants "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config", "com.ruoyi.generator" }; public static final String UNDELETED = "0"; - public static final String DELETED = "2"; + public static final Integer SIZE_30 = 30; + public static final Integer SIZE_31 = 31; + public static final Integer SIZE_32 = 32; + public static final Integer SIZE_33 = 33; + public static final Integer SIZE_34 = 34; + public static final Integer SIZE_35 = 35; + public static final Integer SIZE_36 = 36; + public static final Integer SIZE_37 = 37; + public static final Integer SIZE_38 = 38; + public static final Integer SIZE_39 = 39; + public static final Integer SIZE_40 = 40; + public static final Integer SIZE_41 = 41; + public static final Integer SIZE_42 = 42; + public static final Integer SIZE_43 = 43; + + + + } diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandDeleteDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandDeleteDTO.java new file mode 100644 index 000000000..3392408d6 --- /dev/null +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandDeleteDTO.java @@ -0,0 +1,23 @@ +package com.ruoyi.xkt.dto.storeProductDemand; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@ApiModel("档口需求删除") +@Data +public class StoreProdDemandDeleteDTO { + + @ApiModelProperty(value = "档口ID", required = true) + private Long storeId; + @ApiModelProperty(value = "档口需求明细ID", required = true) + private List storeProdDemandDetailIdList; + +} diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandVerifyDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandVerifyDTO.java new file mode 100644 index 000000000..85ecf08bf --- /dev/null +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandVerifyDTO.java @@ -0,0 +1,64 @@ +package com.ruoyi.xkt.dto.storeProductDemand; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@ApiModel("档口商品生产入库校验是否存在需求单") +@Data +public class StoreProdDemandVerifyDTO { + + @ApiModelProperty(value = "档口ID", required = true) + private Long storeId; + @ApiModelProperty(value = "需求列表", required = true) + private List detailList; + + @Data + @ApiModel(value = "需求列表") + public static class DetailDTO { + @ApiModelProperty(value = "档口商品ID", required = true) + private Long storeProdId; + @ApiModelProperty(value = "档口商品颜色ID", required = true) + private Long storeProdColorId; + @ApiModelProperty(value = "货号", required = true) + private String prodArtNum; + @ApiModelProperty(value = "颜色", required = true) + private String colorName; + @ApiModelProperty(value = "尺码30") + private Integer size30; + @ApiModelProperty(value = "尺码31") + private Integer size31; + @ApiModelProperty(value = "尺码32") + private Integer size32; + @ApiModelProperty(value = "尺码33") + private Integer size33; + @ApiModelProperty(value = "尺码34") + private Integer size34; + @ApiModelProperty(value = "尺码35") + private Integer size35; + @ApiModelProperty(value = "尺码36") + private Integer size36; + @ApiModelProperty(value = "尺码37") + private Integer size37; + @ApiModelProperty(value = "尺码38") + private Integer size38; + @ApiModelProperty(value = "尺码39") + private Integer size39; + @ApiModelProperty(value = "尺码40") + private Integer size40; + @ApiModelProperty(value = "尺码41") + private Integer size41; + @ApiModelProperty(value = "尺码42") + private Integer size42; + @ApiModelProperty(value = "尺码43") + private Integer size43; + } + +} diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandVerifyResDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandVerifyResDTO.java new file mode 100644 index 000000000..2cf8f2b1d --- /dev/null +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandVerifyResDTO.java @@ -0,0 +1,21 @@ +package com.ruoyi.xkt.dto.storeProductDemand; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liujiang + * @version v1.0 + * @date 2025/3/27 15:12 + */ +@ApiModel("档口商品生产入库校验是否存在需求单返回前端数据") +@Data +public class StoreProdDemandVerifyResDTO { + + @ApiModelProperty(value = "需求不存在信息列表") + private List errorMsgList; + +} 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 7cdccaa5a..53aa49cfa 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductDemandMapper.java +++ b/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductDemandMapper.java @@ -68,4 +68,15 @@ public interface StoreProductDemandMapper extends BaseMapper */ void updateStatusByIds(@Param("demandIdList") List demandIdList); + + /** + * 删除指定的需求列表 + * + * 通过此方法可以批量删除需求,每个需求通过其唯一的ID来标识 + * 此方法接收一个需求ID列表,将根据这些ID删除对应的需求 + * + * @param deleteDemandIdList 需要删除的需求ID列表,每个元素都是一个长整型数字 + */ + void deleteDemandList(@Param("deleteDemandIdList") List deleteDemandIdList); + } 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 b9f29fe16..95534e102 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/IStoreProductDemandService.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/IStoreProductDemandService.java @@ -1,7 +1,6 @@ package com.ruoyi.xkt.service; import com.ruoyi.common.core.page.Page; -import com.ruoyi.xkt.domain.StoreProductDemand; import com.ruoyi.xkt.dto.storeProductDemand.*; import java.util.List; @@ -13,53 +12,14 @@ import java.util.List; * @date 2025-03-26 */ public interface IStoreProductDemandService { - /** - * 查询档口商品需求单 - * - * @param storeProdDemandId 档口商品需求单主键 - * @return 档口商品需求单 - */ - public StoreProductDemand selectStoreProductDemandByStoreProdDemandId(Long storeProdDemandId); - - /** - * 查询档口商品需求单列表 - * - * @param storeProductDemand 档口商品需求单 - * @return 档口商品需求单集合 - */ - public List selectStoreProductDemandList(StoreProductDemand storeProductDemand); - - /** - * 新增档口商品需求单 - * - * @param storeProductDemand 档口商品需求单 - * @return 结果 - */ - public int insertStoreProductDemand(StoreProductDemand storeProductDemand); - - /** - * 修改档口商品需求单 - * - * @param storeProductDemand 档口商品需求单 - * @return 结果 - */ - public int updateStoreProductDemand(StoreProductDemand storeProductDemand); /** * 批量删除档口商品需求单 * - * @param storeProdDemandIds 需要删除的档口商品需求单主键集合 + * @param deleteDTO 需要删除的档口商品需求单主键集合 * @return 结果 */ - public int deleteStoreProductDemandByStoreProdDemandIds(Long[] storeProdDemandIds); - - /** - * 删除档口商品需求单信息 - * - * @param storeProdDemandId 档口商品需求单主键 - * @return 结果 - */ - public int deleteStoreProductDemandByStoreProdDemandId(Long storeProdDemandId); + public int deleteByStoreProdDemandIds(StoreProdDemandDeleteDTO deleteDTO); /** * 获取指定门店及商品的库存和生产数量 @@ -71,7 +31,6 @@ public interface IStoreProductDemandService { */ List getStockAndProduceQuantity(Long storeId, Long storeProdId); - /** * 创建需求订单 * @@ -100,4 +59,14 @@ public interface IStoreProductDemandService { */ Integer updateWorkingStatus(StoreProdDemandWorkingDTO workingDTO); + /** + * 校验产品需求是否存在 + * 该方法用于验证给定的产品需求信息,在库存中是否存在有效的匹配 + * 主要用于在进行产品需求处理前,确保需求是可满足的或者已存在的 + * + * @param demandVerifyDTO 包含需求验证信息的DTO对象,用于传递需求校验所需的参数 + * @return 返回一个包含校验结果的DTO对象,包括是否存在以及相关的验证信息 + */ + StoreProdDemandVerifyResDTO verifyDemandExist(StoreProdDemandVerifyDTO demandVerifyDTO); + } diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/ExpressServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/ExpressServiceImpl.java index 1c4eee85e..2bbf23b27 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/ExpressServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/ExpressServiceImpl.java @@ -44,8 +44,8 @@ public class ExpressServiceImpl implements IExpressService { Assert.notEmpty(cityCode); Assert.notEmpty(countyCode); Map map = expressFeeConfigMapper.selectList(Wrappers.lambdaQuery(ExpressFeeConfig.class) - .eq(ExpressFeeConfig::getExpressId, expressId) - .in(ExpressFeeConfig::getRegionCode, Arrays.asList(provinceCode, cityCode, countyCode))) + .eq(ExpressFeeConfig::getExpressId, expressId) + .in(ExpressFeeConfig::getRegionCode, Arrays.asList(provinceCode, cityCode, countyCode))) .stream() //过滤掉已被删除的配置 .filter(BeanValidators::exists) diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreCustomerProductDiscountServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreCustomerProductDiscountServiceImpl.java index bb6e9e0a0..b84d93635 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreCustomerProductDiscountServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreCustomerProductDiscountServiceImpl.java @@ -85,7 +85,6 @@ public class StoreCustomerProductDiscountServiceImpl implements IStoreCustomerPr } - /** * 查询档口客户优惠 * @@ -149,6 +148,7 @@ public class StoreCustomerProductDiscountServiceImpl implements IStoreCustomerPr /** * 新增档口客户 + * * @param cusProdDisDTO 新增档口客户入参 * @return StoreCustomer */ 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 a6a0d7624..e695e0097 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 @@ -14,7 +14,6 @@ import com.ruoyi.xkt.dto.storeCustomer.StoreCusDTO; import com.ruoyi.xkt.dto.storeCustomer.StoreCusFuzzyResDTO; import com.ruoyi.xkt.dto.storeCustomer.StoreCusPageDTO; import com.ruoyi.xkt.dto.storeCustomer.StoreCusPageResDTO; -import com.ruoyi.xkt.dto.storeProduct.StoreProdPageDTO; import com.ruoyi.xkt.mapper.StoreCustomerMapper; import com.ruoyi.xkt.service.IStoreCustomerService; import lombok.RequiredArgsConstructor; diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreFactoryServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreFactoryServiceImpl.java index 8b7658f28..95676b36b 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreFactoryServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreFactoryServiceImpl.java @@ -101,18 +101,12 @@ public class StoreFactoryServiceImpl implements IStoreFactoryService { @Transactional(readOnly = true) public StoreFactoryResDTO selectByStoreFacId(Long storeId, Long storeFacId) { StoreFactory storeFactory = Optional.ofNullable(this.storeFactoryMapper.selectOne(new LambdaQueryWrapper() - .eq(StoreFactory::getId, storeFacId).eq(StoreFactory::getDelFlag, Constants.UNDELETED).eq(StoreFactory::getStoreId, storeId))) + .eq(StoreFactory::getId, storeFacId).eq(StoreFactory::getDelFlag, Constants.UNDELETED).eq(StoreFactory::getStoreId, storeId))) .orElseThrow(() -> new ServiceException("档口合作工厂不存在!", HttpStatus.ERROR)); return BeanUtil.toBean(storeFactory, StoreFactoryResDTO.class); } - - - - - - /** * 查询档口合作工厂列表 * @@ -126,8 +120,6 @@ public class StoreFactoryServiceImpl implements IStoreFactoryService { } - - /** * 批量删除档口合作工厂 * 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 92e56b4d2..cdcab8394 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 @@ -19,6 +19,7 @@ import com.ruoyi.xkt.service.IStoreProductDemandService; import com.ruoyi.xkt.service.IVoucherSequenceService; import lombok.RequiredArgsConstructor; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.ibatis.executor.BatchResult; import org.springframework.stereotype.Service; @@ -27,6 +28,8 @@ import org.springframework.transaction.annotation.Transactional; import java.util.*; import java.util.stream.Collectors; +import static com.ruoyi.common.constant.Constants.*; + /** * 档口商品需求单Service业务层处理 * @@ -56,7 +59,7 @@ public class StoreProductDemandServiceImpl implements IStoreProductDemandService */ @Override @Transactional(readOnly = true) - public List getStockAndProduceQuantity(Long storeId, Long storeProdId) { + public List getStockAndProduceQuantity(Long storeId, Long storeProdId) { List prodColorList = Optional.ofNullable(this.storeProdColorMapper.selectList(new LambdaQueryWrapper() .eq(StoreProductColor::getStoreId, storeId).eq(StoreProductColor::getDelFlag, Constants.UNDELETED).eq(StoreProductColor::getStoreProdId, storeProdId))) .orElseThrow(() -> new RuntimeException("该档口下没有商品及颜色")); @@ -96,7 +99,6 @@ public class StoreProductDemandServiceImpl implements IStoreProductDemandService Integer size41Demand = Optional.ofNullable(demandDetailList).map(x -> x.stream().map(StoreProductDemandDetail::getSize41).reduce(0, Integer::sum)).orElse(0); Integer size42Demand = Optional.ofNullable(demandDetailList).map(x -> x.stream().map(StoreProductDemandDetail::getSize42).reduce(0, Integer::sum)).orElse(0); Integer size43Demand = Optional.ofNullable(demandDetailList).map(x -> x.stream().map(StoreProductDemandDetail::getSize43).reduce(0, Integer::sum)).orElse(0); - // 尺码为30的数组 List size30List = Arrays.asList(ObjectUtils.isNotEmpty(stock) && ObjectUtils.isNotEmpty(stock.getSize30()) ? stock.getSize30().toString() : Constants.UNDELETED, size30Demand.toString()); List size31List = Arrays.asList(ObjectUtils.isNotEmpty(stock) && ObjectUtils.isNotEmpty(stock.getSize31()) ? stock.getSize31().toString() : Constants.UNDELETED, size31Demand.toString()); List size32List = Arrays.asList(ObjectUtils.isNotEmpty(stock) && ObjectUtils.isNotEmpty(stock.getSize32()) ? stock.getSize32().toString() : Constants.UNDELETED, size32Demand.toString()); @@ -205,79 +207,370 @@ public class StoreProductDemandServiceImpl implements IStoreProductDemandService return list.size(); } - /** - * 查询档口商品需求单 + * 校验产品需求是否存在 + * 该方法用于验证给定的产品需求信息,在库存中是否存在有效的匹配 + * 主要用于在进行产品需求处理前,确保需求是可满足的或者已存在的 * - * @param storeProdDemandId 档口商品需求单主键 - * @return 档口商品需求单 + * @param demandVerifyDTO 包含需求验证信息的DTO对象,用于传递需求校验所需的参数 + * @return 返回一个包含校验结果的DTO对象,包括是否存在以及相关的验证信息 */ @Override @Transactional(readOnly = true) - public StoreProductDemand selectStoreProductDemandByStoreProdDemandId(Long storeProdDemandId) { - return storeProdDemandMapper.selectStoreProductDemandByStoreProdDemandId(storeProdDemandId); - } - - /** - * 查询档口商品需求单列表 - * - * @param storeProductDemand 档口商品需求单 - * @return 档口商品需求单 - */ - @Override - @Transactional(readOnly = true) - public List selectStoreProductDemandList(StoreProductDemand storeProductDemand) { - return storeProdDemandMapper.selectStoreProductDemandList(storeProductDemand); - } - - /** - * 新增档口商品需求单 - * - * @param storeProductDemand 档口商品需求单 - * @return 结果 - */ - @Override - @Transactional - public int insertStoreProductDemand(StoreProductDemand storeProductDemand) { - storeProductDemand.setCreateTime(DateUtils.getNowDate()); - return storeProdDemandMapper.insertStoreProductDemand(storeProductDemand); - } - - /** - * 修改档口商品需求单 - * - * @param storeProductDemand 档口商品需求单 - * @return 结果 - */ - @Override - @Transactional - public int updateStoreProductDemand(StoreProductDemand storeProductDemand) { - storeProductDemand.setUpdateTime(DateUtils.getNowDate()); - return storeProdDemandMapper.updateStoreProductDemand(storeProductDemand); + public StoreProdDemandVerifyResDTO verifyDemandExist(StoreProdDemandVerifyDTO demandVerifyDTO) { + // 所有的档口颜色ID列表 + List prodColorIdList = demandVerifyDTO.getDetailList().stream().map(StoreProdDemandVerifyDTO.DetailDTO::getStoreProdColorId).distinct().collect(Collectors.toList()); + List demandDetailList = this.storeProdDemandDetailMapper.selectList(new LambdaQueryWrapper() + .eq(StoreProductDemandDetail::getStoreId, demandVerifyDTO.getStoreId()).eq(StoreProductDemandDetail::getDelFlag, Constants.UNDELETED) + .in(StoreProductDemandDetail::getDetailStatus, Arrays.asList(DemandStatus.PENDING_PRODUCTION.getValue(), DemandStatus.IN_PRODUCTION.getValue())) + .in(StoreProductDemandDetail::getStoreProdColorId, prodColorIdList)); + List errorsMsgList = new ArrayList<>(); + if (CollectionUtils.isEmpty(demandDetailList)) { + demandVerifyDTO.getDetailList().forEach(x -> { + List errors = this.addErrorMsg(x); + if (CollectionUtils.isNotEmpty(errors)) { + errorsMsgList.addAll(errors); + } + }); + } else { + Map> demandDetailMap = demandDetailList.stream().collect(Collectors.groupingBy(StoreProductDemandDetail::getStoreProdColorId)); + Map> colorSizeQuantityMap = new LinkedHashMap<>(); + demandDetailMap.forEach((prodColorId, tempDemandDetailList) -> { + Map sizeQuantityMap = new LinkedHashMap<>(); + tempDemandDetailList.forEach(x -> { + if (ObjectUtils.isNotEmpty(x.getSize30())) { + sizeQuantityMap.put(SIZE_30, sizeQuantityMap.getOrDefault(SIZE_30, 0) + x.getSize30()); + } + if (ObjectUtils.isNotEmpty(x.getSize31())) { + sizeQuantityMap.put(SIZE_31, sizeQuantityMap.getOrDefault(SIZE_31, 0) + x.getSize31()); + } + if (ObjectUtils.isNotEmpty(x.getSize32())) { + sizeQuantityMap.put(SIZE_32, sizeQuantityMap.getOrDefault(SIZE_32, 0) + x.getSize32()); + } + if (ObjectUtils.isNotEmpty(x.getSize33())) { + sizeQuantityMap.put(SIZE_33, sizeQuantityMap.getOrDefault(SIZE_33, 0) + x.getSize33()); + } + if (ObjectUtils.isNotEmpty(x.getSize34())) { + sizeQuantityMap.put(SIZE_34, sizeQuantityMap.getOrDefault(SIZE_34, 0) + x.getSize34()); + } + if (ObjectUtils.isNotEmpty(x.getSize35())) { + sizeQuantityMap.put(SIZE_35, sizeQuantityMap.getOrDefault(SIZE_35, 0) + x.getSize35()); + } + if (ObjectUtils.isNotEmpty(x.getSize36())) { + sizeQuantityMap.put(SIZE_36, sizeQuantityMap.getOrDefault(SIZE_36, 0) + x.getSize36()); + } + if (ObjectUtils.isNotEmpty(x.getSize37())) { + sizeQuantityMap.put(SIZE_37, sizeQuantityMap.getOrDefault(SIZE_37, 0) + x.getSize37()); + } + if (ObjectUtils.isNotEmpty(x.getSize38())) { + sizeQuantityMap.put(SIZE_38, sizeQuantityMap.getOrDefault(SIZE_38, 0) + x.getSize38()); + } + if (ObjectUtils.isNotEmpty(x.getSize39())) { + sizeQuantityMap.put(SIZE_39, sizeQuantityMap.getOrDefault(SIZE_39, 0) + x.getSize39()); + } + if (ObjectUtils.isNotEmpty(x.getSize40())) { + sizeQuantityMap.put(SIZE_40, sizeQuantityMap.getOrDefault(SIZE_40, 0) + x.getSize40()); + } + if (ObjectUtils.isNotEmpty(x.getSize41())) { + sizeQuantityMap.put(SIZE_41, sizeQuantityMap.getOrDefault(SIZE_41, 0) + x.getSize41()); + } + if (ObjectUtils.isNotEmpty(x.getSize42())) { + sizeQuantityMap.put(SIZE_42, sizeQuantityMap.getOrDefault(SIZE_42, 0) + x.getSize42()); + } + if (ObjectUtils.isNotEmpty(x.getSize43())) { + sizeQuantityMap.put(SIZE_43, sizeQuantityMap.getOrDefault(SIZE_43, 0) + x.getSize43()); + } + }); + if (MapUtils.isNotEmpty(sizeQuantityMap)) { + colorSizeQuantityMap.put(prodColorId, sizeQuantityMap); + } + }); + // 按照入库的数量依次进行对比,若需求单中不存在匹配信息,则直接返回错误信息 + demandVerifyDTO.getDetailList().forEach(x -> { + Map sizeQuantityMap = colorSizeQuantityMap.get(x.getStoreProdColorId()); + final String prefix = x.getProdArtNum() + x.getColorName(); + final String suffix = "码"; + // 如果没有对应的需求单则直接返回错误信息 + if (MapUtils.isEmpty(sizeQuantityMap)) { + List errors = this.addErrorMsg(x); + if (CollectionUtils.isNotEmpty(errors)) { + errorsMsgList.addAll(errors); + } + } else { + if (ObjectUtils.isNotEmpty(x.getSize30()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_30))) { + errorsMsgList.add(prefix + SIZE_30 + suffix); + } + if (ObjectUtils.isNotEmpty(x.getSize31()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_31))) { + errorsMsgList.add(prefix + SIZE_31 + suffix); + } + if (ObjectUtils.isNotEmpty(x.getSize32()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_32))) { + errorsMsgList.add(prefix + SIZE_32 + suffix); + } + if (ObjectUtils.isNotEmpty(x.getSize33()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_33))) { + errorsMsgList.add(prefix + SIZE_33 + suffix); + } + if (ObjectUtils.isNotEmpty(x.getSize34()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_34))) { + errorsMsgList.add(prefix + SIZE_34 + suffix); + } + if (ObjectUtils.isNotEmpty(x.getSize35()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_35))) { + errorsMsgList.add(prefix + SIZE_35 + suffix); + } + if (ObjectUtils.isNotEmpty(x.getSize36()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_36))) { + errorsMsgList.add(prefix + SIZE_36 + suffix); + } + if (ObjectUtils.isNotEmpty(x.getSize37()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_37))) { + errorsMsgList.add(prefix + SIZE_37 + suffix); + } + if (ObjectUtils.isNotEmpty(x.getSize38()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_38))) { + errorsMsgList.add(prefix + SIZE_38 + suffix); + } + if (ObjectUtils.isNotEmpty(x.getSize39()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_39))) { + errorsMsgList.add(prefix + SIZE_39 + suffix); + } + if (ObjectUtils.isNotEmpty(x.getSize40()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_40))) { + errorsMsgList.add(prefix + SIZE_40 + suffix); + } + if (ObjectUtils.isNotEmpty(x.getSize41()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_41))) { + errorsMsgList.add(prefix + SIZE_41 + suffix); + } + if (ObjectUtils.isNotEmpty(x.getSize42()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_42))) { + errorsMsgList.add(prefix + SIZE_42 + suffix); + } + if (ObjectUtils.isNotEmpty(x.getSize43()) && ObjectUtils.isEmpty(sizeQuantityMap.get(SIZE_43))) { + errorsMsgList.add(prefix + SIZE_43 + suffix); + } + } + }); + } + return new StoreProdDemandVerifyResDTO() {{ + setErrorMsgList(errorsMsgList); + }}; } /** * 批量删除档口商品需求单 * - * @param storeProdDemandIds 需要删除的档口商品需求单主键 + * @param deleteDTO 需要删除的档口商品需求单主键 * @return 结果 */ @Override @Transactional - public int deleteStoreProductDemandByStoreProdDemandIds(Long[] storeProdDemandIds) { - return storeProdDemandMapper.deleteStoreProductDemandByStoreProdDemandIds(storeProdDemandIds); + public int deleteByStoreProdDemandIds(StoreProdDemandDeleteDTO deleteDTO) { + List demandDetailList = Optional.ofNullable(this.storeProdDemandDetailMapper.selectList(new LambdaQueryWrapper() + .eq(StoreProductDemandDetail::getStoreId, deleteDTO.getStoreId()).eq(StoreProductDemandDetail::getDelFlag, Constants.UNDELETED) + .in(StoreProductDemandDetail::getId, deleteDTO.getStoreProdDemandDetailIdList()))) + .orElseThrow(() -> new ServiceException("需求单明细不存在!", HttpStatus.ERROR)); + // 根据需求明细ID能否找到对应的入库与需求抵扣关系数据 + List deductList = this.storageDemandDeductMapper.selectList(new LambdaQueryWrapper() + .in(StoreProductStorageDemandDeduct::getStoreProdDemandDetailId, deleteDTO.getStoreProdDemandDetailIdList()) + .eq(StoreProductStorageDemandDeduct::getDelFlag, Constants.UNDELETED)); + if (CollectionUtils.isEmpty(deductList)) { + // 标记需求详情列表中的所有记录为已删除 + demandDetailList.forEach(x -> x.setDelFlag(Constants.DELETED)); + // 批量更新需求详情列表中的所有记录 + List list = this.storeProdDemandDetailMapper.updateById(demandDetailList); + // 查询所有未删除的需求详情记录 + List allDemandDetailList = this.storeProdDemandDetailMapper.selectList(new LambdaQueryWrapper() + .eq(StoreProductDemandDetail::getStoreId, deleteDTO.getStoreId()) + .in(StoreProductDemandDetail::getStoreProdDemandId, demandDetailList.stream() + .map(StoreProductDemandDetail::getStoreProdDemandId).distinct().collect(Collectors.toList()))); + // 将查询结果按需求ID分组 + Map> demandGroupMap = allDemandDetailList.stream().collect(Collectors.groupingBy(StoreProductDemandDetail::getStoreProdDemandId)); + // 遍历分组后的结果,找出所有记录都被删除的需求ID + List deleteDemandIdList = new ArrayList<>(); + demandGroupMap.forEach((demandId, tempDetailList) -> { + if (tempDetailList.stream().allMatch(x -> Objects.equals(x.getDelFlag(), Constants.DELETED))) { + deleteDemandIdList.add(demandId); + } + }); + // 如果存在所有记录都被删除的需求ID,则删除这些需求 + if (CollectionUtils.isNotEmpty(deleteDemandIdList)) { + this.storeProdDemandMapper.deleteDemandList(deleteDemandIdList); + } + // 返回更新的需求详情记录数 + return list.size(); + } else { + // 按照入库单明细ID进行分组,获取每个入库单明细对应的抵扣数量 + Map> deductQuantityMap = deductList.stream().collect(Collectors + .groupingBy(StoreProductStorageDemandDeduct::getStoreProdDemandDetailId, Collectors.toList())); + // key 为入库单明细ID,value 为该入库单明细对应的尺码与数量 + Map> deductSizeQuantityMap = new HashMap<>(); + deductQuantityMap.forEach((demandDetailId, sizeDeductList) -> { + Map sizeQuantityMap = new HashMap<>(); + Integer size30Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_30)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_30, size30Quantity); + Integer size31Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_31)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_31, size31Quantity); + Integer size32Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_32)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_32, size32Quantity); + Integer size33Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_33)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_33, size33Quantity); + Integer size34Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_34)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_34, size34Quantity); + Integer size35Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_35)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_35, size35Quantity); + Integer size36Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_36)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_36, size36Quantity); + Integer size37Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_37)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_37, size37Quantity); + Integer size38Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_38)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_38, size38Quantity); + Integer size39Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_39)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_39, size39Quantity); + Integer size40Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_40)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_40, size40Quantity); + Integer size41Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_41)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_41, size41Quantity); + Integer size42Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_42)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_42, size42Quantity); + Integer size43Quantity = sizeDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_43)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_43, size43Quantity); + deductSizeQuantityMap.put(demandDetailId, sizeQuantityMap); + }); + // 依次更新每个明细、每个尺码的数量 + demandDetailList.forEach(demandDetail -> { + Integer quantity = 0; + Map sizeQuantityMap = deductSizeQuantityMap.get(demandDetail.getId()); + if (MapUtils.isEmpty(sizeQuantityMap)) { + return; + } + if (ObjectUtils.isNotEmpty(demandDetail.getSize30())) { + demandDetail.setSize30(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_30), 0)); + quantity += demandDetail.getSize30(); + } + if (ObjectUtils.isNotEmpty(demandDetail.getSize31())) { + demandDetail.setSize31(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_31), 0)); + quantity += demandDetail.getSize31(); + } + if (ObjectUtils.isNotEmpty(demandDetail.getSize32())) { + demandDetail.setSize32(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_32), 0)); + quantity += demandDetail.getSize32(); + } + if (ObjectUtils.isNotEmpty(demandDetail.getSize33())) { + demandDetail.setSize33(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_33), 0)); + quantity += demandDetail.getSize33(); + } + if (ObjectUtils.isNotEmpty(demandDetail.getSize34())) { + demandDetail.setSize34(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_34), 0)); + quantity += demandDetail.getSize34(); + } + if (ObjectUtils.isNotEmpty(demandDetail.getSize35())) { + demandDetail.setSize35(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_35), 0)); + quantity += demandDetail.getSize35(); + } + if (ObjectUtils.isNotEmpty(demandDetail.getSize36())) { + demandDetail.setSize36(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_36), 0)); + quantity += demandDetail.getSize36(); + } + if (ObjectUtils.isNotEmpty(demandDetail.getSize37())) { + demandDetail.setSize37(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_37), 0)); + quantity += demandDetail.getSize37(); + } + if (ObjectUtils.isNotEmpty(demandDetail.getSize38())) { + demandDetail.setSize38(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_38), 0)); + quantity += demandDetail.getSize38(); + } + if (ObjectUtils.isNotEmpty(demandDetail.getSize39())) { + demandDetail.setSize39(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_39), 0)); + quantity += demandDetail.getSize39(); + } + if (ObjectUtils.isNotEmpty(demandDetail.getSize40())) { + demandDetail.setSize40(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_40), 0)); + quantity += demandDetail.getSize40(); + } + if (ObjectUtils.isNotEmpty(demandDetail.getSize41())) { + demandDetail.setSize41(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_41), 0)); + quantity += demandDetail.getSize41(); + } + if (ObjectUtils.isNotEmpty(demandDetail.getSize42())) { + demandDetail.setSize42(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_42), 0)); + quantity += demandDetail.getSize42(); + } + if (ObjectUtils.isNotEmpty(demandDetail.getSize43())) { + demandDetail.setSize43(ObjectUtils.defaultIfNull(sizeQuantityMap.get(SIZE_43), 0)); + quantity += demandDetail.getSize43(); + } + demandDetail + // 更新状态为已完成 + .setDetailStatus(DemandStatus.PRODUCTION_COMPLETE.getValue()) + // 更新数量为最新数量 + .setQuantity(quantity); + }); + 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)); + Map> demandMap = listAfterUpdate.stream().collect(Collectors.groupingBy(StoreProductDemandDetail::getStoreProdDemandId)); + List completeDemandIdList = new ArrayList<>(); + demandMap.forEach((demandId, detailListAfterUpdate) -> { + if (detailListAfterUpdate.stream().allMatch(x -> Objects.equals(x.getDetailStatus(), DemandStatus.PRODUCTION_COMPLETE.getValue()))) { + completeDemandIdList.add(demandId); + } + }); + if (CollectionUtils.isNotEmpty(completeDemandIdList)) { + this.storeProdDemandMapper.updateStatusByIds(completeDemandIdList); + } + return demandDetailList.size(); + } } + /** - * 删除档口商品需求单信息 + * 根据商品详情信息添加错误消息 + * 此方法遍历商品的不同尺寸,如果该尺寸有错误,则生成相应的错误消息 + * 错误消息格式为:商品的货号和颜色名称 + 尺寸 + "码" * - * @param storeProdDemandId 档口商品需求单主键 - * @return 结果 + * @param detailDTO 商品详情对象,包含商品的各个尺寸信息 + * @return 返回一个字符串列表,包含所有错误消息 */ - @Override - @Transactional - public int deleteStoreProductDemandByStoreProdDemandId(Long storeProdDemandId) { - return storeProdDemandMapper.deleteStoreProductDemandByStoreProdDemandId(storeProdDemandId); + private List addErrorMsg(StoreProdDemandVerifyDTO.DetailDTO detailDTO) { + List errorMsgList = new ArrayList<>(); + final String prefix = detailDTO.getProdArtNum() + detailDTO.getColorName(); + final String suffix = "码"; + if (ObjectUtils.isNotEmpty(detailDTO.getSize30())) { + errorMsgList.add(prefix + SIZE_30 + suffix); + } + if (ObjectUtils.isNotEmpty(detailDTO.getSize31())) { + errorMsgList.add(prefix + SIZE_31 + suffix); + } + if (ObjectUtils.isNotEmpty(detailDTO.getSize32())) { + errorMsgList.add(prefix + SIZE_32 + suffix); + } + if (ObjectUtils.isNotEmpty(detailDTO.getSize33())) { + errorMsgList.add(prefix + SIZE_33 + suffix); + } + if (ObjectUtils.isNotEmpty(detailDTO.getSize34())) { + errorMsgList.add(prefix + SIZE_34 + suffix); + } + if (ObjectUtils.isNotEmpty(detailDTO.getSize35())) { + errorMsgList.add(prefix + SIZE_35 + suffix); + } + if (ObjectUtils.isNotEmpty(detailDTO.getSize36())) { + errorMsgList.add(prefix + SIZE_36 + suffix); + } + if (ObjectUtils.isNotEmpty(detailDTO.getSize37())) { + errorMsgList.add(prefix + SIZE_37 + suffix); + } + if (ObjectUtils.isNotEmpty(detailDTO.getSize38())) { + errorMsgList.add(prefix + SIZE_38 + suffix); + } + if (ObjectUtils.isNotEmpty(detailDTO.getSize39())) { + errorMsgList.add(prefix + SIZE_39 + suffix); + } + if (ObjectUtils.isNotEmpty(detailDTO.getSize40())) { + errorMsgList.add(prefix + SIZE_40 + suffix); + } + if (ObjectUtils.isNotEmpty(detailDTO.getSize41())) { + errorMsgList.add(prefix + SIZE_41 + suffix); + } + if (ObjectUtils.isNotEmpty(detailDTO.getSize42())) { + errorMsgList.add(prefix + SIZE_42 + suffix); + } + if (ObjectUtils.isNotEmpty(detailDTO.getSize43())) { + errorMsgList.add(prefix + SIZE_43 + suffix); + } + return errorMsgList; } diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductStockServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductStockServiceImpl.java index 9c3353fd9..943c198da 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductStockServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductStockServiceImpl.java @@ -13,10 +13,10 @@ import com.ruoyi.xkt.domain.StoreProductFile; import com.ruoyi.xkt.domain.StoreProductStock; import com.ruoyi.xkt.domain.SysFile; import com.ruoyi.xkt.dto.storeProductFile.StoreProdMainPicDTO; +import com.ruoyi.xkt.dto.storeProductStock.StoreProdStockDTO; import com.ruoyi.xkt.dto.storeProductStock.StoreProdStockPageDTO; import com.ruoyi.xkt.dto.storeProductStock.StoreProdStockPageResDTO; import com.ruoyi.xkt.dto.storeProductStock.StoreProdStockResDTO; -import com.ruoyi.xkt.dto.storeProductStock.StoreProdStockDTO; import com.ruoyi.xkt.enums.FileType; import com.ruoyi.xkt.mapper.StoreProductFileMapper; import com.ruoyi.xkt.mapper.StoreProductStockMapper; @@ -136,7 +136,7 @@ public class StoreProductStockServiceImpl implements IStoreProductStockService { /** * 清空库存 * - * @param storeId 档口ID + * @param storeId 档口ID * @param storeProdStockId 清空库存 * @return int */ @@ -155,8 +155,8 @@ public class StoreProductStockServiceImpl implements IStoreProductStockService { /** * 调整库存 * - * @param storeId 档口ID - * @param updateStockList 库存更新diff list 要包含正负数 + * @param storeId 档口ID + * @param updateStockList 库存更新diff list 要包含正负数 * @param multiplierFactor 乘积因子 0 直接调整库存,将库存更新为页面输入的数量 1 不变数量 * @return int */ @@ -319,8 +319,9 @@ public class StoreProductStockServiceImpl implements IStoreProductStockService { /** * 通过数量diff增减或扣减库存 - * @param stock 数据库库存表 - * @param adjustDTO diff数据 + * + * @param stock 数据库库存表 + * @param adjustDTO diff数据 * @param isInCrease true 增加库存 false 减少库存 * @return StoreProductStock */ diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductStorageServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductStorageServiceImpl.java index ba3202809..4b0fa8dda 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductStorageServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductStorageServiceImpl.java @@ -35,6 +35,8 @@ import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; +import static com.ruoyi.common.constant.Constants.*; + /** * 档口商品入库Service业务层处理 * @@ -244,34 +246,34 @@ public class StoreProductStorageServiceImpl implements IStoreProductStorageServi Map> latestDeductSizeQuantityMap = new LinkedHashMap<>(); latestDeductMap.forEach((storeProdDemandDetailId, latestDeductList) -> { Map sizeQuantityMap = new LinkedHashMap<>(); - Integer size30Quantity = latestDeductList.stream().filter(x -> x.getSize() == 30).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); - sizeQuantityMap.put(30, size30Quantity); - Integer size31Quantity = latestDeductList.stream().filter(x -> x.getSize() == 31).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); - sizeQuantityMap.put(31, size31Quantity); - Integer size32Quantity = latestDeductList.stream().filter(x -> x.getSize() == 32).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); - sizeQuantityMap.put(32, size32Quantity); - Integer size33Quantity = latestDeductList.stream().filter(x -> x.getSize() == 33).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); - sizeQuantityMap.put(33, size33Quantity); - Integer size34Quantity = latestDeductList.stream().filter(x -> x.getSize() == 34).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); - sizeQuantityMap.put(34, size34Quantity); - Integer size35Quantity = latestDeductList.stream().filter(x -> x.getSize() == 35).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); - sizeQuantityMap.put(35, size35Quantity); - Integer size36Quantity = latestDeductList.stream().filter(x -> x.getSize() == 36).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); - sizeQuantityMap.put(36, size36Quantity); - Integer size37Quantity = latestDeductList.stream().filter(x -> x.getSize() == 37).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); - sizeQuantityMap.put(37, size37Quantity); - Integer size38Quantity = latestDeductList.stream().filter(x -> x.getSize() == 38).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); - sizeQuantityMap.put(38, size38Quantity); - Integer size39Quantity = latestDeductList.stream().filter(x -> x.getSize() == 39).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); - sizeQuantityMap.put(39, size39Quantity); - Integer size40Quantity = latestDeductList.stream().filter(x -> x.getSize() == 40).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); - sizeQuantityMap.put(40, size40Quantity); - Integer size41Quantity = latestDeductList.stream().filter(x -> x.getSize() == 41).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); - sizeQuantityMap.put(41, size41Quantity); - Integer size42Quantity = latestDeductList.stream().filter(x -> x.getSize() == 42).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); - sizeQuantityMap.put(42, size42Quantity); - Integer size43Quantity = latestDeductList.stream().filter(x -> x.getSize() == 43).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); - sizeQuantityMap.put(43, size43Quantity); + Integer size30Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_30)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_30, size30Quantity); + Integer size31Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_31)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_31, size31Quantity); + Integer size32Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_32)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_32, size32Quantity); + Integer size33Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_33)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_33, size33Quantity); + Integer size34Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_34)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_34, size34Quantity); + Integer size35Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_35)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_35, size35Quantity); + Integer size36Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_36)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_36, size36Quantity); + Integer size37Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_37)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_37, size37Quantity); + Integer size38Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_38)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_38, size38Quantity); + Integer size39Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_39)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_39, size39Quantity); + Integer size40Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_40)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_40, size40Quantity); + Integer size41Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_41)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_41, size41Quantity); + Integer size42Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_42)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_42, size42Quantity); + Integer size43Quantity = latestDeductList.stream().filter(x -> Objects.equals(x.getSize(), SIZE_43)).map(x -> ObjectUtils.defaultIfNull(x.getQuantity(), 0)).reduce(0, Integer::sum); + sizeQuantityMap.put(SIZE_43, size43Quantity); latestDeductSizeQuantityMap.put(storeProdDemandDetailId, sizeQuantityMap); }); // 筛选出所有和本次需求单抵扣有关的需求单列表 @@ -407,46 +409,46 @@ public class StoreProductStorageServiceImpl implements IStoreProductStorageServi for (StoreProductStorageDetail storageDetail : detailList) { Map sizeStorageMap = new LinkedHashMap<>(); if (ObjectUtils.isNotEmpty(storageDetail.getSize30())) { - sizeStorageMap.put(30, storageDetail.getSize30()); + sizeStorageMap.put(SIZE_30, storageDetail.getSize30()); } if (ObjectUtils.isNotEmpty(storageDetail.getSize31())) { - sizeStorageMap.put(31, storageDetail.getSize31()); + sizeStorageMap.put(SIZE_31, storageDetail.getSize31()); } if (ObjectUtils.isNotEmpty(storageDetail.getSize32())) { - sizeStorageMap.put(32, storageDetail.getSize32()); + sizeStorageMap.put(SIZE_32, storageDetail.getSize32()); } if (ObjectUtils.isNotEmpty(storageDetail.getSize33())) { - sizeStorageMap.put(33, storageDetail.getSize33()); + sizeStorageMap.put(SIZE_33, storageDetail.getSize33()); } if (ObjectUtils.isNotEmpty(storageDetail.getSize34())) { - sizeStorageMap.put(34, storageDetail.getSize34()); + sizeStorageMap.put(SIZE_34, storageDetail.getSize34()); } if (ObjectUtils.isNotEmpty(storageDetail.getSize35())) { - sizeStorageMap.put(35, storageDetail.getSize35()); + sizeStorageMap.put(SIZE_35, storageDetail.getSize35()); } if (ObjectUtils.isNotEmpty(storageDetail.getSize36())) { - sizeStorageMap.put(36, storageDetail.getSize36()); + sizeStorageMap.put(SIZE_36, storageDetail.getSize36()); } if (ObjectUtils.isNotEmpty(storageDetail.getSize37())) { - sizeStorageMap.put(37, storageDetail.getSize37()); + sizeStorageMap.put(SIZE_37, storageDetail.getSize37()); } if (ObjectUtils.isNotEmpty(storageDetail.getSize38())) { - sizeStorageMap.put(38, storageDetail.getSize38()); + sizeStorageMap.put(SIZE_38, storageDetail.getSize38()); } if (ObjectUtils.isNotEmpty(storageDetail.getSize39())) { - sizeStorageMap.put(39, storageDetail.getSize39()); + sizeStorageMap.put(SIZE_39, storageDetail.getSize39()); } if (ObjectUtils.isNotEmpty(storageDetail.getSize40())) { - sizeStorageMap.put(40, storageDetail.getSize40()); + sizeStorageMap.put(SIZE_40, storageDetail.getSize40()); } if (ObjectUtils.isNotEmpty(storageDetail.getSize41())) { - sizeStorageMap.put(41, storageDetail.getSize41()); + sizeStorageMap.put(SIZE_41, storageDetail.getSize41()); } if (ObjectUtils.isNotEmpty(storageDetail.getSize42())) { - sizeStorageMap.put(42, storageDetail.getSize42()); + sizeStorageMap.put(SIZE_42, storageDetail.getSize42()); } if (ObjectUtils.isNotEmpty(storageDetail.getSize43())) { - sizeStorageMap.put(43, storageDetail.getSize43()); + sizeStorageMap.put(SIZE_43, storageDetail.getSize43()); } if (MapUtils.isNotEmpty(sizeStorageMap)) { storageQuantityMap.put(storageDetail.getStoreProdColorId(), new LinkedHashMap>() {{ @@ -524,46 +526,46 @@ public class StoreProductStorageServiceImpl implements IStoreProductStorageServi size43Deduct = this.handleSize43RequireQuantity(size43Deduct, size43DemandMap, demandDetail); } if (MapUtils.isNotEmpty(size30DemandMap)) { - sizeRequireMap.put(30, size30DemandMap); + sizeRequireMap.put(SIZE_30, size30DemandMap); } if (MapUtils.isNotEmpty(size31DemandMap)) { - sizeRequireMap.put(31, size31DemandMap); + sizeRequireMap.put(SIZE_31, size31DemandMap); } if (MapUtils.isNotEmpty(size32DemandMap)) { - sizeRequireMap.put(32, size32DemandMap); + sizeRequireMap.put(SIZE_32, size32DemandMap); } if (MapUtils.isNotEmpty(size33DemandMap)) { - sizeRequireMap.put(33, size33DemandMap); + sizeRequireMap.put(SIZE_33, size33DemandMap); } if (MapUtils.isNotEmpty(size34DemandMap)) { - sizeRequireMap.put(34, size34DemandMap); + sizeRequireMap.put(SIZE_34, size34DemandMap); } if (MapUtils.isNotEmpty(size35DemandMap)) { - sizeRequireMap.put(35, size35DemandMap); + sizeRequireMap.put(SIZE_35, size35DemandMap); } if (MapUtils.isNotEmpty(size36DemandMap)) { - sizeRequireMap.put(36, size36DemandMap); + sizeRequireMap.put(SIZE_36, size36DemandMap); } if (MapUtils.isNotEmpty(size37DemandMap)) { - sizeRequireMap.put(37, size37DemandMap); + sizeRequireMap.put(SIZE_37, size37DemandMap); } if (MapUtils.isNotEmpty(size38DemandMap)) { - sizeRequireMap.put(38, size38DemandMap); + sizeRequireMap.put(SIZE_38, size38DemandMap); } if (MapUtils.isNotEmpty(size39DemandMap)) { - sizeRequireMap.put(39, size39DemandMap); + sizeRequireMap.put(SIZE_39, size39DemandMap); } if (MapUtils.isNotEmpty(size40DemandMap)) { - sizeRequireMap.put(40, size40DemandMap); + sizeRequireMap.put(SIZE_40, size40DemandMap); } if (MapUtils.isNotEmpty(size41DemandMap)) { - sizeRequireMap.put(41, size41DemandMap); + sizeRequireMap.put(SIZE_41, size41DemandMap); } if (MapUtils.isNotEmpty(size42DemandMap)) { - sizeRequireMap.put(42, size42DemandMap); + sizeRequireMap.put(SIZE_42, size42DemandMap); } if (MapUtils.isNotEmpty(size43DemandMap)) { - sizeRequireMap.put(43, size43DemandMap); + sizeRequireMap.put(SIZE_43, size43DemandMap); } if (MapUtils.isNotEmpty(sizeRequireMap)) { unDeductMap.put(storeProdColorId, sizeRequireMap); diff --git a/xkt/src/main/resources/mapper/StoreProductDemandMapper.xml b/xkt/src/main/resources/mapper/StoreProductDemandMapper.xml index c9f4affe6..6b14adcd2 100644 --- a/xkt/src/main/resources/mapper/StoreProductDemandMapper.xml +++ b/xkt/src/main/resources/mapper/StoreProductDemandMapper.xml @@ -97,5 +97,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + UPDATE store_product_demand SET del_flag = 2 WHERE id in + + #{id} + + + + + \ No newline at end of file