master:导出生产需求模板调优;
parent
9e37cf062b
commit
82d72b8ac2
|
|
@ -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<StoreProdDemandDownloadDTO> downloadList = storeProdDemandService.export(BeanUtil.toBean(exportVO, StoreProdDemandExportDTO.class));
|
||||
ExcelUtil<StoreProdDemandDownloadDTO> util = new ExcelUtil<>(StoreProdDemandDownloadDTO.class);
|
||||
// 获取哪些列需要隐藏
|
||||
StoreDemandTemplateResDTO template = this.storeTemplateService.getTemplate(exportVO.getStoreId());
|
||||
if (ObjectUtils.isNotEmpty(template)) {
|
||||
List<String> 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<String> getHideColumns(StoreDemandTemplateResDTO template) {
|
||||
List<String> 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<Long> storeProdDemandDetailIdList;
|
||||
@ApiModelProperty(value = "导出开始时间")
|
||||
private Date voucherDateStart;
|
||||
@ApiModelProperty(value = "导出结束时间")
|
||||
private Date voucherDateEnd;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<StoreProductColor> {
|
|||
* @return StoreProdStatusCountResDTO
|
||||
*/
|
||||
StoreProdStatusCountResDTO getStatusNum(@Param("storeId") Long storeId);
|
||||
|
||||
/**
|
||||
* 获取商品的内里
|
||||
*
|
||||
* @param storeId 档口ID
|
||||
* @param prodArtNumList 货号列表
|
||||
* @return List<StoreProdDemandDownloadDTO>
|
||||
*/
|
||||
List<StoreProdDemandDownloadDTO> selectLiningMaterialList(@Param("storeId") Long storeId, @Param("prodArtNumList") List<String> prodArtNumList);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<StoreProductD
|
|||
StoreProdDemandStatusCountResDTO getStatusNum(@Param("storeId") Long storeId,
|
||||
@Param("sixMonthAgo") Date sixMonthAgo,
|
||||
@Param("now") Date now);
|
||||
|
||||
/**
|
||||
* 获取导出列表
|
||||
*
|
||||
* @param exportDTO 导出参数
|
||||
* @return 导出列表
|
||||
*/
|
||||
List<StoreProdDemandDownloadDTO> selectDownloadList(StoreProdDemandExportDTO exportDTO);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<StoreProdDemandDownloadDTO> export(StoreProdDemandExportDTO exportDTO) {
|
||||
LambdaQueryWrapper<StoreProductDemandDetail> queryWrapper = new LambdaQueryWrapper<StoreProductDemandDetail>()
|
||||
.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<StoreProdDemandDownloadDTO> downloadList = this.storeProdDemandDetailMapper.selectDownloadList(exportDTO);
|
||||
if (CollectionUtils.isEmpty(downloadList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<StoreProductDemandDetail> demandDetailList = this.storeProdDemandDetailMapper.selectList(queryWrapper);
|
||||
if (CollectionUtils.isEmpty(demandDetailList)) {
|
||||
return new ArrayList<>();
|
||||
// 获取商品内里
|
||||
List<StoreProdDemandDownloadDTO> liningMaterialList = this.storeProdColorMapper
|
||||
.selectLiningMaterialList(exportDTO.getStoreId(), downloadList.stream().map(StoreProdDemandDownloadDTO::getProdArtNum).collect(Collectors.toList()));
|
||||
// 商品货号及颜色的内里材质map
|
||||
Map<String, String> 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<StoreProductDemand> demandList = this.storeProdDemandMapper.selectList(new LambdaQueryWrapper<StoreProductDemand>()
|
||||
.eq(StoreProductDemand::getDelFlag, UNDELETED).in(StoreProductDemand::getId, demandDetailList.stream()
|
||||
.map(StoreProductDemandDetail::getStoreProdDemandId).collect(Collectors.toList())));
|
||||
Map<Long, String> demandCodeMap = CollectionUtils.isEmpty(demandList) ? new HashMap<>()
|
||||
: demandList.stream().collect(Collectors.toMap(StoreProductDemand::getId, StoreProductDemand::getCode));
|
||||
List<StoreFactory> storeFacList = this.storeFacMapper.selectList(new LambdaQueryWrapper<StoreFactory>()
|
||||
.eq(StoreFactory::getDelFlag, UNDELETED).eq(StoreFactory::getStoreId, exportDTO.getStoreId()));
|
||||
Map<Long, String> storeFacMap = CollectionUtils.isEmpty(storeFacList) ? new HashMap<>()
|
||||
: storeFacList.stream().collect(Collectors.toMap(StoreFactory::getId, StoreFactory::getFacName));
|
||||
List<StoreProdDemandDownloadDTO> 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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -150,5 +150,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
);
|
||||
</select>
|
||||
|
||||
<select id="selectLiningMaterialList">
|
||||
SELECT
|
||||
sp.prod_art_num,
|
||||
spc.color_name,
|
||||
spc.shoe_upper_lining_material
|
||||
FROM
|
||||
store_product_color spc
|
||||
JOIN store_product sp ON spc.store_prod_id = sp.id
|
||||
WHERE
|
||||
spc.del_flag = 0
|
||||
AND spc.store_id = #{storeId}
|
||||
AND sp.prod_art_num IN
|
||||
<foreach item="item" collection="prodArtNumList" separator="," open="(" close=")" index="">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -55,5 +55,72 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND spdd.create_time between #{sixMonthAgo} AND #{now}
|
||||
</select>
|
||||
|
||||
<select id="selectDownloadList" resultType="com.ruoyi.xkt.dto.storeProductDemand.StoreProdDemandDownloadDTO">
|
||||
SELECT
|
||||
spp.partner_name,
|
||||
spp.trademark,
|
||||
sf.fac_name,
|
||||
spd.`code`,
|
||||
DATE_FORMAT( spd.create_time, '%Y-%m-%d' ) AS createTime,
|
||||
sp.factory_art_num,
|
||||
sp.prod_art_num,
|
||||
spdd.color_name,
|
||||
spca.shaft_material,
|
||||
spdd.detail_status AS demandStatus,
|
||||
spdd.emergency,
|
||||
spp.shoe_type,
|
||||
spp.shoe_size,
|
||||
spp.main_skin,
|
||||
spp.main_skin_usage,
|
||||
spp.match_skin,
|
||||
spp.match_skin_usage,
|
||||
spp.neckline,
|
||||
spp.insole,
|
||||
spp.fastener,
|
||||
spp.shoe_accessories,
|
||||
spp.toe_cap,
|
||||
spp.edge_binding,
|
||||
spp.mid_outsole,
|
||||
spp.platform_sole,
|
||||
spp.midsole_factory_code,
|
||||
spp.outsole_factory_code,
|
||||
spp.heel_factory_code,
|
||||
spp.components,
|
||||
spp.second_sole_material,
|
||||
spp.second_upper_material,
|
||||
NULLIF( spdd.size_30, 0 ) AS size30Quantity,
|
||||
NULLIF( spdd.size_31, 0 ) AS size31Quantity,
|
||||
NULLIF( spdd.size_32, 0 ) AS size32Quantity,
|
||||
NULLIF( spdd.size_33, 0 ) AS size33Quantity,
|
||||
NULLIF( spdd.size_34, 0 ) AS size34Quantity,
|
||||
NULLIF( spdd.size_35, 0 ) AS size35Quantity,
|
||||
NULLIF( spdd.size_36, 0 ) AS size36Quantity,
|
||||
NULLIF( spdd.size_37, 0 ) AS size37Quantity,
|
||||
NULLIF( spdd.size_38, 0 ) AS size38Quantity,
|
||||
NULLIF( spdd.size_39, 0 ) AS size39Quantity,
|
||||
NULLIF( spdd.size_40, 0 ) AS size40Quantity,
|
||||
NULLIF( spdd.size_41, 0 ) AS size41Quantity,
|
||||
NULLIF( spdd.size_42, 0 ) AS size42Quantity,
|
||||
NULLIF( spdd.size_43, 0 ) AS size43Quantity
|
||||
FROM
|
||||
store_product_demand_detail spdd
|
||||
JOIN store_product_demand spd ON spdd.store_prod_demand_id = spd.id
|
||||
JOIN store_product sp ON spdd.store_prod_id = sp.id AND sp.del_flag = 0
|
||||
JOIN store_factory sf ON spdd.store_id = sf.store_id AND sf.del_flag = 0
|
||||
JOIN store_product_category_attribute spca ON spdd.store_prod_id = spca.store_prod_id AND spca.del_flag = 0
|
||||
JOIN store_product_process spp ON spdd.store_prod_id = spp.store_prod_id AND spp.del_flag = 0
|
||||
WHERE
|
||||
spdd.del_flag = 0 AND spdd.store_id = #{storeId}
|
||||
<if test="voucherDateStart != null"> and spd.create_time >= #{voucherDateStart}</if>
|
||||
<if test="voucherDateEnd != null"> and spd.create_time <= #{voucherDateEnd}</if>
|
||||
<if test="detailStatus != null"> and spdd.detail_status = #{detailStatus}</if>
|
||||
<if test="storeProdDemandDetailIdList != null and storeProdDemandDetailIdList.size > 0">
|
||||
AND spdd.id IN
|
||||
<foreach item="id" collection="storeProdDemandDetailIdList" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue