master:系统导出格式调优;

pull/1121/head
liujiang 2025-10-24 17:04:38 +08:00
parent 6bba79c2fd
commit 68dd217069
8 changed files with 97 additions and 89 deletions

View File

@ -3,6 +3,7 @@ package com.ruoyi.xkt.dto.storeProdStorage;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.apache.poi.ss.usermodel.IndexedColors;
import java.math.BigDecimal;
import java.util.Date;
@ -17,53 +18,53 @@ import java.util.Date;
public class StoreStorageDetailDownloadDTO {
@Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, needMerge = true, height = 28)
@Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, needMerge = true, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer orderNum;
@Excel(name = "单据编号", needMerge = true, height = 28)
@Excel(name = "单据编号", needMerge = true, width = 26, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String code;
@Excel(name = "工厂名称", needMerge = true, height = 28)
@Excel(name = "工厂名称", needMerge = true, width = 20, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String facName;
@Excel(name = "入库类型", readConverterExp = "1=生产入库,2=其它入库,3=维修入库", needMerge = true, height = 28)
@Excel(name = "入库类型", readConverterExp = "1=生产入库,2=其它入库,3=维修入库", needMerge = true, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer storageType;
@Excel(name = "入库日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm", needMerge = true, height = 28)
private Date createTime;
@Excel(name = "总生产成本", height = 28)
@Excel(name = "入库日期", width = 20, needMerge = true, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String createTime;
@Excel(name = "总生产成本", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private BigDecimal produceAmount;
@Excel(name = "货号", height = 28)
@Excel(name = "货号", width = 20, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String prodArtNum;
@Excel(name = "颜色", height = 28)
@Excel(name = "颜色", width = 20, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String colorName;
@Excel(name = "30", height = 28)
@Excel(name = "30", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size30Quantity;
@Excel(name = "31", height = 28)
@Excel(name = "31", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size31Quantity;
@Excel(name = "32", height = 28)
@Excel(name = "32", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size32Quantity;
@Excel(name = "33", height = 28)
@Excel(name = "33", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size33Quantity;
@Excel(name = "34", height = 28)
@Excel(name = "34", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size34Quantity;
@Excel(name = "35", height = 28)
@Excel(name = "35", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size35Quantity;
@Excel(name = "36", height = 28)
@Excel(name = "36", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size36Quantity;
@Excel(name = "37", height = 28)
@Excel(name = "37", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size37Quantity;
@Excel(name = "38", height = 28)
@Excel(name = "38", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size38Quantity;
@Excel(name = "39", height = 28)
@Excel(name = "39", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size39Quantity;
@Excel(name = "40", height = 28)
@Excel(name = "40", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size40Quantity;
@Excel(name = "41", height = 28)
@Excel(name = "41", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size41Quantity;
@Excel(name = "42", height = 28)
@Excel(name = "42", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size42Quantity;
@Excel(name = "43", height = 28)
@Excel(name = "43", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size43Quantity;
@Excel(name = "入库总量", height = 28)
@Excel(name = "入库总量", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer totalQuantity;
@Excel(name = "操作人名称", height = 28)
@Excel(name = "操作人名称", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String operatorName;
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.xkt.dto.storeProductDemand;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.poi.ss.usermodel.IndexedColors;
/**
* @author liujiang
@ -14,47 +15,49 @@ import lombok.experimental.Accessors;
public class StoreProdDemandDownloadDTO {
@Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, needMerge = true, height = 28)
@Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, needMerge = true, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer orderNum;
@Excel(name = "货号", needMerge = true, height = 28)
@Excel(name = "货号", needMerge = true, width = 20, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String prodArtNum;
@Excel(name = "需求单号", needMerge = true, height = 28)
@Excel(name = "需求单号", needMerge = true, width = 28, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String code;
@Excel(name = "工厂名称", needMerge = true, height = 28)
@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)
private String facName;
@Excel(name = "是否紧急单", height = 28)
@Excel(name = "是否紧急单", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String emergency;
@Excel(name = "颜色", height = 28)
@Excel(name = "颜色", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String colorName;
@Excel(name = "30", height = 28)
@Excel(name = "30", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size30Quantity;
@Excel(name = "31", height = 28)
@Excel(name = "31", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size31Quantity;
@Excel(name = "32", height = 28)
@Excel(name = "32", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size32Quantity;
@Excel(name = "33", height = 28)
@Excel(name = "33", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size33Quantity;
@Excel(name = "34", height = 28)
@Excel(name = "34", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size34Quantity;
@Excel(name = "35", height = 28)
@Excel(name = "35", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size35Quantity;
@Excel(name = "36", height = 28)
@Excel(name = "36", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size36Quantity;
@Excel(name = "37", height = 28)
@Excel(name = "37", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size37Quantity;
@Excel(name = "38", height = 28)
@Excel(name = "38", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size38Quantity;
@Excel(name = "39", height = 28)
@Excel(name = "39", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size39Quantity;
@Excel(name = "40", height = 28)
@Excel(name = "40", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size40Quantity;
@Excel(name = "41", height = 28)
@Excel(name = "41", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size41Quantity;
@Excel(name = "42", height = 28)
@Excel(name = "42", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size42Quantity;
@Excel(name = "43", height = 28)
@Excel(name = "43", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size43Quantity;
@Excel(name = "合计", height = 28)
@Excel(name = "合计", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer totalQuantity;
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.xkt.dto.storeProductStock;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.apache.poi.ss.usermodel.IndexedColors;
/**
* @author liujiang
@ -14,41 +15,41 @@ import lombok.Data;
public class StoreProdStockDownloadDTO {
@Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, needMerge = true, height = 28)
@Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, needMerge = true, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer orderNum;
@Excel(name = "货号", needMerge = true, height = 28)
@Excel(name = "货号", needMerge = true, width = 20, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String prodArtNum;
@Excel(name = "颜色", height = 28)
@Excel(name = "颜色", width = 20, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String colorName;
@Excel(name = "30", height = 28)
@Excel(name = "30", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size30Quantity;
@Excel(name = "31", height = 28)
@Excel(name = "31", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size31Quantity;
@Excel(name = "32", height = 28)
@Excel(name = "32", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size32Quantity;
@Excel(name = "33", height = 28)
@Excel(name = "33", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size33Quantity;
@Excel(name = "34", height = 28)
@Excel(name = "34", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size34Quantity;
@Excel(name = "35", height = 28)
@Excel(name = "35", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size35Quantity;
@Excel(name = "36", height = 28)
@Excel(name = "36", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size36Quantity;
@Excel(name = "37", height = 28)
@Excel(name = "37", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size37Quantity;
@Excel(name = "38", height = 28)
@Excel(name = "38", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size38Quantity;
@Excel(name = "39", height = 28)
@Excel(name = "39", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size39Quantity;
@Excel(name = "40", height = 28)
@Excel(name = "40", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size40Quantity;
@Excel(name = "41", height = 28)
@Excel(name = "41", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size41Quantity;
@Excel(name = "42", height = 28)
@Excel(name = "42", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size42Quantity;
@Excel(name = "43", height = 28)
@Excel(name = "43", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer size43Quantity;
@Excel(name = "总库存", height = 28)
@Excel(name = "总库存", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer totalQuantity;
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.xkt.dto.storeSale;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.apache.poi.ss.usermodel.IndexedColors;
import java.math.BigDecimal;
import java.util.Date;
@ -14,30 +15,27 @@ import java.util.Date;
*/
@ApiModel("档口销售导出数据")
@Data
public class StoreSaleDownloadDTO {
@Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, height = 28)
@Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer orderNum;
@Excel(name = "单据编号", height = 28)
@Excel(name = "单据编号", width = 28, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String code;
@Excel(name = "客户", height = 28)
@Excel(name = "客户", width = 20, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String storeCusName;
@Excel(name = "出库日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm", height = 28)
private Date createTime;
@Excel(name = "销售总额", height = 28)
@Excel(name = "出库日期", width = 26, height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String createTime;
@Excel(name = "销售总额", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private BigDecimal amount;
@Excel(name = "销售数量", height = 28)
@Excel(name = "销售数量", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String quantity;
@Excel(name = "抹零金额", height = 28)
private BigDecimal roundOff;
@Excel(name = "结款状态", readConverterExp = "1=已结清,2=欠款", height = 28)
@Excel(name = "结款状态", readConverterExp = "1=已结清,2=欠款", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer paymentStatus;
@Excel(name = "支付方式", readConverterExp = "1=支付宝,2=微信支付,3=现金,4=欠款", height = 28)
@Excel(name = "支付方式", readConverterExp = "1=支付宝,2=微信支付,3=现金,4=欠款", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer payWay;
@Excel(name = "销售类型", readConverterExp = "1=销售,2=退货,3=销售/退货", height = 28)
@Excel(name = "销售类型", readConverterExp = "1=销售,2=退货,3=销售/退货", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private Integer saleType;
@Excel(name = "操作人名称", height = 28)
@Excel(name = "操作人名称", height = 28, headerBackgroundColor = IndexedColors.SKY_BLUE)
private String operatorName;
}

View File

@ -426,6 +426,7 @@ public class StoreProductDemandServiceImpl implements IStoreProductDemandService
.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())

View File

@ -213,14 +213,15 @@ public class StoreSaleServiceImpl implements IStoreSaleService {
if (!SecurityUtils.isAdmin() && !SecurityUtils.isStoreManagerOrSub(exportDTO.getStoreId())) {
throw new ServiceException("当前用户非档口管理者或子账号,无权限操作!", HttpStatus.ERROR);
}
List<StoreSaleDownloadDTO> downloadList = new ArrayList<>();
// 导出指定销售出库单
if (CollectionUtils.isNotEmpty(exportDTO.getStoreSaleIdList())) {
return this.storeSaleMapper.selectExportList(exportDTO.getStoreSaleIdList());
downloadList = this.storeSaleMapper.selectExportList(exportDTO.getStoreSaleIdList());
} else {
// 没有传时间,则设置当前时间往前推半年
if (ObjectUtils.isEmpty(exportDTO.getVoucherDateStart()) && ObjectUtils.isEmpty(exportDTO.getVoucherDateEnd())) {
exportDTO.setVoucherDateEnd(java.sql.Date.valueOf(LocalDate.now()));
exportDTO.setVoucherDateEnd(java.sql.Date.valueOf(LocalDate.now().minusMonths(6)));
exportDTO.setVoucherDateStart(java.sql.Date.valueOf(LocalDate.now().minusMonths(6)));
} else {
LocalDate start = exportDTO.getVoucherDateStart().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate end = exportDTO.getVoucherDateEnd().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
@ -235,8 +236,15 @@ public class StoreSaleServiceImpl implements IStoreSaleService {
throw new ServiceException("导出时间间隔不能超过6个月!", HttpStatus.ERROR);
}
}
return this.storeSaleMapper.selectExportListVoucherDateBetween(exportDTO);
downloadList = this.storeSaleMapper.selectExportListVoucherDateBetween(exportDTO);
}
if (CollectionUtils.isEmpty(downloadList)) {
return downloadList;
}
for (int i = 0; i < downloadList.size(); i++) {
downloadList.get(i).setOrderNum(i + 1);
}
return downloadList;
}
/**

View File

@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
sps.`code`,
sf.fac_name,
sps.create_time,
DATE_FORMAT(spsd.create_time, '%Y-%m-%d %H:%i') AS create_time,
sps.quantity,
sps.produce_amount,
sps.storage_type,
@ -63,7 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
sps.`code`,
sf.fac_name,
sps.create_time,
DATE_FORMAT(spsd.create_time, '%Y-%m-%d %H:%i') AS create_time,
sps.quantity,
sps.produce_amount,
sps.storage_type,

View File

@ -26,13 +26,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectExportList" resultType="com.ruoyi.xkt.dto.storeSale.StoreSaleDownloadDTO">
SELECT
ROW_NUMBER() OVER ( ORDER BY ss.voucher_date DESC ) AS orderNum,
ss.`code`,
sc.cus_name AS storeCusName,
ss.create_time,
DATE_FORMAT(ss.create_time, '%Y-%m-%d %H:%i') AS create_time,
ss.amount,
CONCAT(IFNULL( ss.sale_quantity, 0 ),'/', CASE WHEN IFNULL( ss.refund_quantity, 0 ) > 0 THEN '-' ELSE '' END, IFNULL( ss.refund_quantity, 0 )) AS quantity,
IFNULL( ss.round_off, 0 ) AS round_off,
ss.payment_status,
ss.pay_way,
ss.sale_type,
@ -53,13 +51,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectExportListVoucherDateBetween" resultType="com.ruoyi.xkt.dto.storeSale.StoreSaleDownloadDTO">
SELECT
ROW_NUMBER() OVER ( ORDER BY ss.voucher_date DESC ) AS orderNum,
ss.`code`,
sc.cus_name AS storeCusName,
ss.voucher_date,
DATE_FORMAT(ss.create_time, '%Y-%m-%d %H:%i') AS create_time,
ss.amount,
CONCAT(IFNULL( ss.sale_quantity, 0 ),'/', CASE WHEN IFNULL( ss.refund_quantity, 0 ) > 0 THEN '-' ELSE '' END, IFNULL( ss.refund_quantity, 0 )) AS quantity,
IFNULL( ss.round_off, 0 ) AS round_off,
ss.payment_status,
ss.pay_way,
ss.sale_type,