From 82d72b8ac2107d13808e07244a435ae230f53ade Mon Sep 17 00:00:00 2001 From: liujiang <569804566@qq.com> Date: Sat, 15 Nov 2025 22:40:43 +0800 Subject: [PATCH] =?UTF-8?q?master=EF=BC=9A=E5=AF=BC=E5=87=BA=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E9=9C=80=E6=B1=82=E6=A8=A1=E6=9D=BF=E8=B0=83=E4=BC=98?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkt/StoreProductDemandController.java | 168 ++++++++++++++++++ .../com/ruoyi/common/constant/Constants.java | 2 + .../StoreStorageDetailDownloadDTO.java | 6 +- .../StoreProdDemandDownloadDTO.java | 107 ++++++++--- .../StoreProdDemandExportDTO.java | 5 + .../StoreDemandTemplateResDTO.java | 2 +- .../StoreProdStockDownloadDTO.java | 4 +- .../xkt/mapper/StoreProductColorMapper.java | 11 ++ .../StoreProductDemandDetailMapper.java | 14 +- .../impl/StoreProductDemandServiceImpl.java | 67 ++----- ...StoreProductDemandTemplateServiceImpl.java | 9 +- .../mapper/StoreProductColorMapper.xml | 17 ++ .../mapper/StoreProductDemandDetailMapper.xml | 67 +++++++ 13 files changed, 388 insertions(+), 91 deletions(-) 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 9fb0b3595..b5f549088 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 @@ -2,6 +2,7 @@ package com.ruoyi.web.controller.xkt; import cn.hutool.core.bean.BeanUtil; import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.controller.XktBaseController; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.page.Page; @@ -10,10 +11,14 @@ import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.web.controller.xkt.vo.storeProductDemand.*; import com.ruoyi.xkt.dto.storeProductDemand.*; +import com.ruoyi.xkt.dto.storeProductDemandTemplate.StoreDemandTemplateResDTO; import com.ruoyi.xkt.service.IStoreProductDemandService; +import com.ruoyi.xkt.service.IStoreProductDemandTemplateService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; +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.*; @@ -21,7 +26,9 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; +import java.util.ArrayList; import java.util.List; +import java.util.Objects; /** * 档口商品需求单Controller @@ -36,6 +43,7 @@ import java.util.List; public class StoreProductDemandController extends XktBaseController { final IStoreProductDemandService storeProdDemandService; + final IStoreProductDemandTemplateService storeTemplateService; @ApiOperation(value = "获取所有需求单状态", httpMethod = "GET", response = R.class) @GetMapping(value = "/status/num/{storeId}") @@ -105,11 +113,171 @@ public class StoreProductDemandController extends XktBaseController { public void export(HttpServletResponse response, @Validated @RequestBody StoreProdDemandExportVO exportVO) throws UnsupportedEncodingException { List downloadList = storeProdDemandService.export(BeanUtil.toBean(exportVO, StoreProdDemandExportDTO.class)); ExcelUtil util = new ExcelUtil<>(StoreProdDemandDownloadDTO.class); + // 获取哪些列需要隐藏 + StoreDemandTemplateResDTO template = this.storeTemplateService.getTemplate(exportVO.getStoreId()); + if (ObjectUtils.isNotEmpty(template)) { + List hideColumns = this.getHideColumns(template); + if (CollectionUtils.isNotEmpty(hideColumns)) { + util.hideColumn(hideColumns.toArray(new String[0])); + } + } // 设置下载excel名 String encodedFileName = URLEncoder.encode("生产需求" + DateUtils.getDate(), "UTF-8").replaceAll("\\+", "%20"); response.setHeader("Content-disposition", "attachment;filename=" + encodedFileName + ".xlsx"); util.exportExcel(response, downloadList, "生产需求记录"); } + /** + * 动态设置下载的excel列 + * + * @param template 档口下载的需求模板 + * @return 隐藏的列 + */ + private List getHideColumns(StoreDemandTemplateResDTO template) { + List hideColumns = new ArrayList<>(); + if (Objects.equals(template.getSelectSize30(), Constants.UNSELECTED)) { + hideColumns.add("size30Quantity"); + } + if (Objects.equals(template.getSelectSize31(), Constants.UNSELECTED)) { + hideColumns.add("size31Quantity"); + } + if (Objects.equals(template.getSelectSize32(), Constants.UNSELECTED)) { + hideColumns.add("size32Quantity"); + } + if (Objects.equals(template.getSelectSize33(), Constants.UNSELECTED)) { + hideColumns.add("size33Quantity"); + } + if (Objects.equals(template.getSelectSize34(), Constants.UNSELECTED)) { + hideColumns.add("size34Quantity"); + } + if (Objects.equals(template.getSelectSize35(), Constants.UNSELECTED)) { + hideColumns.add("size35Quantity"); + } + if (Objects.equals(template.getSelectSize36(), Constants.UNSELECTED)) { + hideColumns.add("size36Quantity"); + } + if (Objects.equals(template.getSelectSize37(), Constants.UNSELECTED)) { + hideColumns.add("size37Quantity"); + } + if (Objects.equals(template.getSelectSize38(), Constants.UNSELECTED)) { + hideColumns.add("size38Quantity"); + } + if (Objects.equals(template.getSelectSize39(), Constants.UNSELECTED)) { + hideColumns.add("size39Quantity"); + } + if (Objects.equals(template.getSelectSize40(), Constants.UNSELECTED)) { + hideColumns.add("size40Quantity"); + } + if (Objects.equals(template.getSelectSize41(), Constants.UNSELECTED)) { + hideColumns.add("size41Quantity"); + } + if (Objects.equals(template.getSelectSize42(), Constants.UNSELECTED)) { + hideColumns.add("size42Quantity"); + } + if (Objects.equals(template.getSelectSize43(), Constants.UNSELECTED)) { + hideColumns.add("size43Quantity"); + } + if (Objects.equals(template.getSelectFacName(), Constants.UNSELECTED)) { + hideColumns.add("facName"); + } + if (Objects.equals(template.getSelectDemandCode(), Constants.UNSELECTED)) { + hideColumns.add("code"); + } + if (Objects.equals(template.getSelectMakeTime(), Constants.UNSELECTED)) { + hideColumns.add("createTime"); + } + if (Objects.equals(template.getSelectFactoryArtNum(), Constants.UNSELECTED)) { + hideColumns.add("factoryArtNum"); + } + if (Objects.equals(template.getSelectProdArtNum(), Constants.UNSELECTED)) { + hideColumns.add("prodArtNum"); + } + if (Objects.equals(template.getSelectColorName(), Constants.UNSELECTED)) { + hideColumns.add("colorName"); + } + if (Objects.equals(template.getSelectShoeUpperLiningMaterial(), Constants.UNSELECTED)) { + hideColumns.add("shoeUpperLiningMaterial"); + } + if (Objects.equals(template.getSelectShaftMaterial(), Constants.UNSELECTED)) { + hideColumns.add("shaftMaterial"); + } + if (Objects.equals(template.getSelectDemandStatus(), Constants.UNSELECTED)) { + hideColumns.add("demandStatus"); + } + if (Objects.equals(template.getSelectEmergency(), Constants.UNSELECTED)) { + hideColumns.add("emergency"); + } + if (Objects.equals(template.getSelectPartnerName(), Constants.UNSELECTED)) { + hideColumns.add("partnerName"); + } + if (Objects.equals(template.getSelectTrademark(), Constants.UNSELECTED)) { + hideColumns.add("trademark"); + } + if (Objects.equals(template.getSelectShoeType(), Constants.UNSELECTED)) { + hideColumns.add("shoeType"); + } + if (Objects.equals(template.getSelectShoeSize(), Constants.UNSELECTED)) { + hideColumns.add("shoeSize"); + } + if (Objects.equals(template.getSelectMainSkin(), Constants.UNSELECTED)) { + hideColumns.add("mainSkin"); + } + if (Objects.equals(template.getSelectMainSkinUsage(), Constants.UNSELECTED)) { + hideColumns.add("mainSkinUsage"); + } + if (Objects.equals(template.getSelectMatchSkin(), Constants.UNSELECTED)) { + hideColumns.add("matchSkin"); + } + if (Objects.equals(template.getSelectMatchSkinUsage(), Constants.UNSELECTED)) { + hideColumns.add("matchSkinUsage"); + } + if (Objects.equals(template.getSelectNeckline(), Constants.UNSELECTED)) { + hideColumns.add("neckline"); + } + if (Objects.equals(template.getSelectInsole(), Constants.UNSELECTED)) { + hideColumns.add("insole"); + } + if (Objects.equals(template.getSelectFastener(), Constants.UNSELECTED)) { + hideColumns.add("fastener"); + } + if (Objects.equals(template.getSelectShoeAccessories(), Constants.UNSELECTED)) { + hideColumns.add("shoeAccessories"); + } + if (Objects.equals(template.getSelectToeCap(), Constants.UNSELECTED)) { + hideColumns.add("toeCap"); + } + if (Objects.equals(template.getSelectEdgeBinding(), Constants.UNSELECTED)) { + hideColumns.add("edgeBinding"); + } + if (Objects.equals(template.getSelectMidOutsole(), Constants.UNSELECTED)) { + hideColumns.add("midOutsole"); + } + if (Objects.equals(template.getSelectPlatformSole(), Constants.UNSELECTED)) { + hideColumns.add("platformSole"); + } + if (Objects.equals(template.getSelectMidsoleFactoryCode(), Constants.UNSELECTED)) { + hideColumns.add("midsoleFactoryCode"); + } + if (Objects.equals(template.getSelectOutsoleFactoryCode(), Constants.UNSELECTED)) { + hideColumns.add("outsoleFactoryCode"); + } + if (Objects.equals(template.getSelectHeelFactoryCode(), Constants.UNSELECTED)) { + hideColumns.add("heelFactoryCode"); + } + if (Objects.equals(template.getSelectComponents(), Constants.UNSELECTED)) { + hideColumns.add("components"); + } + if (Objects.equals(template.getSelectSecondSoleMaterial(), Constants.UNSELECTED)) { + hideColumns.add("secondSoleMaterial"); + } + if (Objects.equals(template.getSelectSecondUpperMaterial(), Constants.UNSELECTED)) { + hideColumns.add("secondUpperMaterial"); + } + if (Objects.equals(template.getSelectQuantity(), Constants.UNSELECTED)) { + hideColumns.add("quantity"); + } + return hideColumns; + } + } 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 ee0040bfd..c79be3057 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 @@ -177,6 +177,8 @@ public class Constants public static final String UNDELETED = "0"; public static final String DELETED = "2"; public static final String SYS_NORMAL_STATUS = "0"; + public static final Integer SELECTED = 1; + public static final Integer UNSELECTED = 0; public static final Integer SIZE_30 = 30; public static final Integer SIZE_31 = 31; diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProdStorage/StoreStorageDetailDownloadDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProdStorage/StoreStorageDetailDownloadDTO.java index 3fa744f63..539ece8cb 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProdStorage/StoreStorageDetailDownloadDTO.java +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProdStorage/StoreStorageDetailDownloadDTO.java @@ -18,15 +18,15 @@ import java.util.Date; public class StoreStorageDetailDownloadDTO { - @Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, needMerge = true, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer orderNum; - @Excel(name = "单据编号", needMerge = true, width = 26, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "单据编号", width = 26, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) private String code; @Excel(name = "工厂名称", width = 20, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) private String facName; @Excel(name = "入库类型", readConverterExp = "1=生产入库,2=其它入库,3=维修入库", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer storageType; - @Excel(name = "入库日期", width = 20, needMerge = true, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "入库日期", width = 20, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) private String createTime; @Excel(name = "总生产成本", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) private BigDecimal produceAmount; diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandDownloadDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandDownloadDTO.java index 65459b0cf..5fc8ddad4 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandDownloadDTO.java +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandDownloadDTO.java @@ -12,52 +12,103 @@ import org.apache.poi.ss.usermodel.IndexedColors; */ @Data @Accessors(chain = true) - public class StoreProdDemandDownloadDTO { - @Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, needMerge = true, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, width = 3, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer orderNum; - @Excel(name = "货号", needMerge = true, width = 20, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) - private String prodArtNum; - @Excel(name = "需求单号", needMerge = true, width = 28, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) - private String code; - @Excel(name = "创建日期", width = 26, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) - private String createTime; - @Excel(name = "工厂名称", needMerge = true, width = 22, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "客户名称", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String partnerName; + @Excel(name = "商标", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String trademark; + @Excel(name = "工厂名称", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private String facName; - @Excel(name = "是否紧急单", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) - private String emergency; - @Excel(name = "颜色", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "需求单号", needMerge = true, width = 18, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String code; + @Excel(name = "创建日期", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String createTime; + @Excel(name = "工厂货号", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String factoryArtNum; + @Excel(name = "商品货号", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String prodArtNum; + @Excel(name = "颜色", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private String colorName; - @Excel(name = "30", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "内里", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String shoeUpperLiningMaterial; + @Excel(name = "面料", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String shaftMaterial; + @Excel(name = "生产状态", readConverterExp = "1=待生产,2=生产中,3=生产完成", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private Integer demandStatus; + @Excel(name = "紧急度", readConverterExp = "0=正常,1=紧急", width = 5, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private Integer emergency; + @Excel(name = "鞋型", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String shoeType; + @Excel(name = "楦号", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String shoeSize; + @Excel(name = "主皮", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String mainSkin; + @Excel(name = "主皮用量", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String mainSkinUsage; + @Excel(name = "配皮", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String matchSkin; + @Excel(name = "配皮用量", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String matchSkinUsage; + @Excel(name = "领口", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String neckline; + @Excel(name = "膛底", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String insole; + @Excel(name = "扣件/拉头", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String fastener; + @Excel(name = "辅料", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String shoeAccessories; + @Excel(name = "包头", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String toeCap; + @Excel(name = "包边", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String edgeBinding; + @Excel(name = "中大底", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String midOutsole; + @Excel(name = "防水台", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String platformSole; + @Excel(name = "中底厂家编码", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String midsoleFactoryCode; + @Excel(name = "外底厂家编码", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String outsoleFactoryCode; + @Excel(name = "跟厂编码", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String heelFactoryCode; + @Excel(name = "配料", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String components; + @Excel(name = "第二底料", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String secondSoleMaterial; + @Excel(name = "第二配料", width = 10, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private String secondUpperMaterial; + @Excel(name = "30", width = 2, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer size30Quantity; - @Excel(name = "31", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "31", width = 2, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer size31Quantity; - @Excel(name = "32", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "32", width = 2, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer size32Quantity; - @Excel(name = "33", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "33", width = 2, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer size33Quantity; - @Excel(name = "34", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "34", width = 2, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer size34Quantity; - @Excel(name = "35", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "35", width = 2, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer size35Quantity; - @Excel(name = "36", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "36", width = 2, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer size36Quantity; - @Excel(name = "37", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "37", width = 2, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer size37Quantity; - @Excel(name = "38", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "38", width = 2, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer size38Quantity; - @Excel(name = "39", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "39", width = 2, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer size39Quantity; - @Excel(name = "40", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "40", width = 2, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer size40Quantity; - @Excel(name = "41", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "41", width = 2, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer size41Quantity; - @Excel(name = "42", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "42", width = 2, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer size42Quantity; - @Excel(name = "43", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "43", width = 2, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer size43Quantity; - @Excel(name = "合计", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) - private Integer totalQuantity; + @Excel(name = "总数", width = 3, height = 24, headerBackgroundColor = IndexedColors.SKY_BLUE) + private Integer quantity; } diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandExportDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandExportDTO.java index 270a11894..83dd898f2 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandExportDTO.java +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemand/StoreProdDemandExportDTO.java @@ -3,6 +3,7 @@ package com.ruoyi.xkt.dto.storeProductDemand; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.Date; import java.util.List; /** @@ -20,5 +21,9 @@ public class StoreProdDemandExportDTO { private Integer detailStatus; @ApiModelProperty(value = "档口需求明细ID") private List storeProdDemandDetailIdList; + @ApiModelProperty(value = "导出开始时间") + private Date voucherDateStart; + @ApiModelProperty(value = "导出结束时间") + private Date voucherDateEnd; } diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemandTemplate/StoreDemandTemplateResDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemandTemplate/StoreDemandTemplateResDTO.java index 49582473d..5bb97424c 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemandTemplate/StoreDemandTemplateResDTO.java +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductDemandTemplate/StoreDemandTemplateResDTO.java @@ -16,7 +16,7 @@ public class StoreDemandTemplateResDTO { @ApiModelProperty(value = "档口ID") private Long storeId; - @ApiModelProperty(value = "尺码30") + @ApiModelProperty(value = "尺码30") private Integer selectSize30; @ApiModelProperty(value = "尺码31") private Integer selectSize31; diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductStock/StoreProdStockDownloadDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductStock/StoreProdStockDownloadDTO.java index 888e3d178..32a62b82a 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductStock/StoreProdStockDownloadDTO.java +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/storeProductStock/StoreProdStockDownloadDTO.java @@ -15,9 +15,9 @@ import org.apache.poi.ss.usermodel.IndexedColors; public class StoreProdStockDownloadDTO { - @Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, needMerge = true, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) private Integer orderNum; - @Excel(name = "货号", needMerge = true, width = 20, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) + @Excel(name = "货号", width = 20, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) private String prodArtNum; @Excel(name = "颜色", width = 20, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE) private String colorName; diff --git a/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductColorMapper.java b/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductColorMapper.java index 9a239ceea..fd83a4c1c 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductColorMapper.java +++ b/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductColorMapper.java @@ -10,6 +10,7 @@ import com.ruoyi.xkt.dto.storeProdColorPrice.StoreProdColorPriceResDTO; import com.ruoyi.xkt.dto.storeProduct.StoreProdPageDTO; import com.ruoyi.xkt.dto.storeProduct.StoreProdPageResDTO; import com.ruoyi.xkt.dto.storeProduct.StoreProdStatusCountResDTO; +import com.ruoyi.xkt.dto.storeProductDemand.StoreProdDemandDownloadDTO; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @@ -79,4 +80,14 @@ public interface StoreProductColorMapper extends BaseMapper { * @return StoreProdStatusCountResDTO */ StoreProdStatusCountResDTO getStatusNum(@Param("storeId") Long storeId); + + /** + * 获取商品的内里 + * + * @param storeId 档口ID + * @param prodArtNumList 货号列表 + * @return List + */ + List selectLiningMaterialList(@Param("storeId") Long storeId, @Param("prodArtNumList") List prodArtNumList); + } diff --git a/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductDemandDetailMapper.java b/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductDemandDetailMapper.java index 4d2b2db33..4e06994b9 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductDemandDetailMapper.java +++ b/xkt/src/main/java/com/ruoyi/xkt/mapper/StoreProductDemandDetailMapper.java @@ -2,10 +2,7 @@ package com.ruoyi.xkt.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.xkt.domain.StoreProductDemandDetail; -import com.ruoyi.xkt.dto.storeProductDemand.StoreProdDemandPageDTO; -import com.ruoyi.xkt.dto.storeProductDemand.StoreProdDemandPageResDTO; -import com.ruoyi.xkt.dto.storeProductDemand.StoreProdDemandSimpleDTO; -import com.ruoyi.xkt.dto.storeProductDemand.StoreProdDemandStatusCountResDTO; +import com.ruoyi.xkt.dto.storeProductDemand.*; import org.apache.ibatis.annotations.Param; import java.util.Date; @@ -46,4 +43,13 @@ public interface StoreProductDemandDetailMapper extends BaseMapper selectDownloadList(StoreProdDemandExportDTO exportDTO); + } 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 bce97963b..17456f0d0 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 @@ -28,6 +28,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -400,58 +401,26 @@ public class StoreProductDemandServiceImpl implements IStoreProductDemandService @Override @Transactional(readOnly = true) public List export(StoreProdDemandExportDTO exportDTO) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() - .eq(StoreProductDemandDetail::getStoreId, exportDTO.getStoreId()).eq(StoreProductDemandDetail::getDelFlag, Constants.UNDELETED) - .orderByDesc(StoreProductDemandDetail::getCreateTime); - if (CollectionUtils.isNotEmpty(exportDTO.getStoreProdDemandDetailIdList())) { - queryWrapper.in(StoreProductDemandDetail::getId, exportDTO.getStoreProdDemandDetailIdList()); + // 如果这两项都为空,则表示是全部状态的导出所有 增加时间显示最近半年数据 + if (ObjectUtils.isEmpty(exportDTO.getDetailStatus()) && CollectionUtils.isEmpty(exportDTO.getStoreProdDemandDetailIdList())) { + exportDTO.setVoucherDateEnd(DateUtils.toDate(LocalDateTime.now())); + exportDTO.setVoucherDateStart(DateUtils.toDate(LocalDateTime.now().minusMonths(6))); } - if (ObjectUtils.isNotEmpty(exportDTO.getDetailStatus())) { - queryWrapper.eq(StoreProductDemandDetail::getDetailStatus, exportDTO.getDetailStatus()); + List downloadList = this.storeProdDemandDetailMapper.selectDownloadList(exportDTO); + if (CollectionUtils.isEmpty(downloadList)) { + return Collections.emptyList(); } - List demandDetailList = this.storeProdDemandDetailMapper.selectList(queryWrapper); - if (CollectionUtils.isEmpty(demandDetailList)) { - return new ArrayList<>(); + // 获取商品内里 + List liningMaterialList = this.storeProdColorMapper + .selectLiningMaterialList(exportDTO.getStoreId(), downloadList.stream().map(StoreProdDemandDownloadDTO::getProdArtNum).collect(Collectors.toList())); + // 商品货号及颜色的内里材质map + Map prodColorLiningMaterialMap = liningMaterialList.stream().collect(Collectors + .toMap(x -> x.getProdArtNum() + x.getColorName(), StoreProdDemandDownloadDTO::getShoeUpperLiningMaterial)); + for (int i = 0; i < downloadList.size(); i++) { + downloadList.get(i).setOrderNum(i + 1) + .setShoeUpperLiningMaterial(prodColorLiningMaterialMap.get(downloadList.get(i).getProdArtNum() + downloadList.get(i).getColorName())); } - List demandList = this.storeProdDemandMapper.selectList(new LambdaQueryWrapper() - .eq(StoreProductDemand::getDelFlag, UNDELETED).in(StoreProductDemand::getId, demandDetailList.stream() - .map(StoreProductDemandDetail::getStoreProdDemandId).collect(Collectors.toList()))); - Map demandCodeMap = CollectionUtils.isEmpty(demandList) ? new HashMap<>() - : demandList.stream().collect(Collectors.toMap(StoreProductDemand::getId, StoreProductDemand::getCode)); - List storeFacList = this.storeFacMapper.selectList(new LambdaQueryWrapper() - .eq(StoreFactory::getDelFlag, UNDELETED).eq(StoreFactory::getStoreId, exportDTO.getStoreId())); - Map storeFacMap = CollectionUtils.isEmpty(storeFacList) ? new HashMap<>() - : storeFacList.stream().collect(Collectors.toMap(StoreFactory::getId, StoreFactory::getFacName)); - List downLoadList = demandDetailList.stream().sorted(Comparator.comparing(StoreProductDemandDetail::getProdArtNum)) - .map(x -> new StoreProdDemandDownloadDTO().setProdArtNum(x.getProdArtNum()).setColorName(x.getColorName()) - .setFacName(storeFacMap.getOrDefault(x.getStoreFactoryId(), "")) - .setCode(demandCodeMap.getOrDefault(x.getStoreProdDemandId(), "")) - .setCreateTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm", x.getCreateTime())) - .setEmergency(Objects.equals(x.getEmergency(), 0) ? "正常单" : "紧急单") - .setSize30Quantity(x.getSize30()).setSize31Quantity(x.getSize31()).setSize32Quantity(x.getSize32()) - .setSize33Quantity(x.getSize33()).setSize34Quantity(x.getSize34()).setSize35Quantity(x.getSize35()) - .setSize36Quantity(x.getSize36()).setSize37Quantity(x.getSize37()).setSize38Quantity(x.getSize38()) - .setSize39Quantity(x.getSize39()).setSize40Quantity(x.getSize40()).setSize41Quantity(x.getSize41()) - .setSize42Quantity(x.getSize42()).setSize43Quantity(x.getSize43()) - .setTotalQuantity(ObjectUtils.defaultIfNull(x.getSize30(), 0) + - ObjectUtils.defaultIfNull(x.getSize31(), 0) + - ObjectUtils.defaultIfNull(x.getSize32(), 0) + - ObjectUtils.defaultIfNull(x.getSize33(), 0) + - ObjectUtils.defaultIfNull(x.getSize34(), 0) + - ObjectUtils.defaultIfNull(x.getSize35(), 0) + - ObjectUtils.defaultIfNull(x.getSize36(), 0) + - ObjectUtils.defaultIfNull(x.getSize37(), 0) + - ObjectUtils.defaultIfNull(x.getSize38(), 0) + - ObjectUtils.defaultIfNull(x.getSize39(), 0) + - ObjectUtils.defaultIfNull(x.getSize40(), 0) + - ObjectUtils.defaultIfNull(x.getSize41(), 0) + - ObjectUtils.defaultIfNull(x.getSize42(), 0) + - ObjectUtils.defaultIfNull(x.getSize43(), 0))) - .collect(Collectors.toList()); - for (int i = 0; i < downLoadList.size(); i++) { - downLoadList.get(i).setOrderNum(i + 1); - } - return downLoadList; + return downloadList; } /** diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductDemandTemplateServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductDemandTemplateServiceImpl.java index ae259285e..fb4afa1f9 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductDemandTemplateServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreProductDemandTemplateServiceImpl.java @@ -14,6 +14,9 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Optional; +import static com.ruoyi.common.constant.Constants.SELECTED; +import static com.ruoyi.common.constant.Constants.UNSELECTED; + /** * 档口需求下载模板Service业务层处理 * @@ -26,8 +29,6 @@ public class StoreProductDemandTemplateServiceImpl implements IStoreProductDeman final StoreProductDemandTemplateMapper templateMapper; - private static final Integer SELECTED = 1; - private static final Integer UNSELECTED = 0; /** * 获取当前档口设置的模板 @@ -66,10 +67,10 @@ public class StoreProductDemandTemplateServiceImpl implements IStoreProductDeman .setSelectPlatformSole(UNSELECTED).setSelectMidsoleFactoryCode(UNSELECTED) .setSelectOutsoleFactoryCode(UNSELECTED).setSelectHeelFactoryCode(UNSELECTED) .setSelectComponents(UNSELECTED).setSelectSecondSoleMaterial(UNSELECTED) - .setSelectSecondUpperMaterial(UNSELECTED); + .setSelectSecondUpperMaterial(UNSELECTED).setSelectDemandCode(UNSELECTED); // 设置初始化值 template.setSelectSize34(SELECTED).setSelectSize35(SELECTED).setSelectSize36(SELECTED).setSelectSize37(SELECTED).setSelectSize38(SELECTED) - .setSelectSize39(SELECTED).setSelectSize40(SELECTED).setSelectFacName(SELECTED).setSelectDemandCode(SELECTED).setSelectMakeTime(SELECTED) + .setSelectSize39(SELECTED).setSelectSize40(SELECTED).setSelectFacName(SELECTED).setSelectMakeTime(SELECTED) .setSelectFactoryArtNum(SELECTED).setSelectProdArtNum(SELECTED).setSelectColorName(SELECTED).setSelectShoeUpperLiningMaterial(SELECTED) .setSelectShaftMaterial(SELECTED).setSelectDemandStatus(SELECTED).setSelectEmergency(SELECTED).setSelectQuantity(SELECTED); this.templateMapper.insertOrUpdate(template); diff --git a/xkt/src/main/resources/mapper/StoreProductColorMapper.xml b/xkt/src/main/resources/mapper/StoreProductColorMapper.xml index c8f8623fa..c348c6d4a 100644 --- a/xkt/src/main/resources/mapper/StoreProductColorMapper.xml +++ b/xkt/src/main/resources/mapper/StoreProductColorMapper.xml @@ -150,5 +150,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ); + + \ No newline at end of file diff --git a/xkt/src/main/resources/mapper/StoreProductDemandDetailMapper.xml b/xkt/src/main/resources/mapper/StoreProductDemandDetailMapper.xml index 5f52e7f20..e6491ae18 100644 --- a/xkt/src/main/resources/mapper/StoreProductDemandDetailMapper.xml +++ b/xkt/src/main/resources/mapper/StoreProductDemandDetailMapper.xml @@ -55,5 +55,72 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND spdd.create_time between #{sixMonthAgo} AND #{now} + + \ No newline at end of file