feat:订单导出修改

master
chenhao 2025-06-22 10:58:33 +08:00
parent f1c9b9fd0a
commit 2ea2477b99
2 changed files with 86 additions and 5 deletions

View File

@ -0,0 +1,15 @@
package com.ruoyi.sip.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrderExcelNumStaticsDto {
private BigDecimal allPrice;
private Long quantity;
}

View File

@ -24,6 +24,7 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.sip.domain.*;
import com.ruoyi.sip.dto.HomepageQueryDto;
import com.ruoyi.sip.dto.OrderExcelNumStaticsDto;
import com.ruoyi.sip.dto.StatisticsDetailDto;
import com.ruoyi.sip.service.*;
import lombok.extern.slf4j.Slf4j;
@ -57,6 +58,12 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
private ICnareaService cnareaService;
private static final List<String> MAINTENANCE_SERVICES = Arrays.asList("8813A3YA", "8813A3YB", "8813A7U4", "8813A7U2");
private static final List<String> WSS_LIST = Arrays.asList("3130A6LC");
private static final List<String> WSP_LIST = Arrays.asList("3130A6LE");
private static final List<String> LS_LIST = Arrays.asList("3130A6LD");
private static final List<String> ONE_STOR_LIST = Arrays.asList("3130A4NA", "3130A4N9", "3130A4N5");
private static final List<String> N_VIDIA_LIST = Arrays.asList("0504A14F", "0504A14G", "0504A1JX");
/**
*
*
@ -280,7 +287,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
if (CollUtil.isEmpty(projectOrderInfos)) {
return null;
}
ProjectOrderInfo projectOrderInfo= projectOrderInfos.stream().max(Comparator.comparing(ProjectOrderInfo::getVersionCode)).get();
ProjectOrderInfo projectOrderInfo = projectOrderInfos.stream().max(Comparator.comparing(ProjectOrderInfo::getVersionCode)).get();
List<ProjectProductInfo> projectProductInfos = productInfoService.selectProjectProductInfoListByProjectId(Collections.singletonList(projectOrderInfo.getProjectId()));
Map<String, List<ProjectProductInfo>> productListMap = projectProductInfos.stream().collect(Collectors.groupingBy(ProjectProductInfo::getType));
@ -291,7 +298,6 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
projectOrderInfo.setMaintenanceProjectProductInfoList(maintenanceProjectProductInfoList);
return projectOrderInfo;
}
@ -420,6 +426,16 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
headerList.add(Collections.singletonList("联系方式"));
headerList.add(Collections.singletonList("其他特别说明"));
headerList.add(Collections.singletonList("订单状态"));
headerList.add(Collections.singletonList("WS瘦授权软件数量"));
headerList.add(Collections.singletonList("WS瘦授权软件金额"));
headerList.add(Collections.singletonList("WS胖授权软件数量"));
headerList.add(Collections.singletonList("WS胖授权软件金额"));
headerList.add(Collections.singletonList("LS软件数量"));
headerList.add(Collections.singletonList("LS软件金额"));
headerList.add(Collections.singletonList("ONEstor数量"));
headerList.add(Collections.singletonList("ONEstor金额"));
headerList.add(Collections.singletonList("nVIDIA授权数量"));
headerList.add(Collections.singletonList("nVIDIA授权金额"));
// 添加软件产品列
@ -492,16 +508,29 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
BigDecimal totalPrice = BigDecimal.ZERO;
BigDecimal maintenancePrice = BigDecimal.ZERO;
OrderExcelNumStaticsDto wssDto = new OrderExcelNumStaticsDto(BigDecimal.ZERO, 0L);
OrderExcelNumStaticsDto wspDto = new OrderExcelNumStaticsDto(BigDecimal.ZERO, 0L);
OrderExcelNumStaticsDto lsDto = new OrderExcelNumStaticsDto(BigDecimal.ZERO, 0L);
OrderExcelNumStaticsDto oneStorDto = new OrderExcelNumStaticsDto(BigDecimal.ZERO, 0L);
OrderExcelNumStaticsDto nVIDIADto = new OrderExcelNumStaticsDto(BigDecimal.ZERO, 0L);
// 添加软件产品列
for (int i = 0; i < maxSoftware; i++) {
if (CollUtil.isNotEmpty(info.getSoftwareProjectProductInfoList()) && i < info.getSoftwareProjectProductInfoList().size()) {
ProjectProductInfo productInfo = info.getSoftwareProjectProductInfoList().get(i);
totalPrice = addProductRow(productInfo, row, totalPrice);
if (productInfo!=null && StringUtils.isNotEmpty(productInfo.getProductBomCode())
if (productInfo != null && StringUtils.isNotEmpty(productInfo.getProductBomCode())
&& MAINTENANCE_SERVICES.contains(productInfo.getProductBomCode())
&& productInfo.getAllPrice() != null) {
maintenancePrice = maintenancePrice.add(productInfo.getAllPrice());
}
staticsNum(wssDto, productInfo, WSS_LIST);
staticsNum(wspDto, productInfo, WSP_LIST);
staticsNum(lsDto, productInfo, LS_LIST);
staticsNum(oneStorDto, productInfo, ONE_STOR_LIST);
staticsNum(nVIDIADto, productInfo, N_VIDIA_LIST);
} else {
addProductRow(null, row, totalPrice);
}
@ -512,11 +541,17 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
if (CollUtil.isNotEmpty(info.getHardwareProjectProductInfoList()) && i < info.getHardwareProjectProductInfoList().size()) {
ProjectProductInfo productInfo = info.getHardwareProjectProductInfoList().get(i);
totalPrice = addProductRow(productInfo, row, totalPrice);
if (productInfo!=null && StringUtils.isNotEmpty(productInfo.getProductBomCode())
if (productInfo != null && StringUtils.isNotEmpty(productInfo.getProductBomCode())
&& MAINTENANCE_SERVICES.contains(productInfo.getProductBomCode())
&& productInfo.getAllPrice() != null) {
maintenancePrice = maintenancePrice.add(productInfo.getAllPrice());
}
staticsNum(wssDto, productInfo, WSS_LIST);
staticsNum(wspDto, productInfo, WSP_LIST);
staticsNum(lsDto, productInfo, LS_LIST);
staticsNum(oneStorDto, productInfo, ONE_STOR_LIST);
staticsNum(nVIDIADto, productInfo, N_VIDIA_LIST);
} else {
addProductRow(null, row, totalPrice);
}
@ -527,11 +562,16 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
if (CollUtil.isNotEmpty(info.getMaintenanceProjectProductInfoList()) && i < info.getMaintenanceProjectProductInfoList().size()) {
ProjectProductInfo productInfo = info.getMaintenanceProjectProductInfoList().get(i);
totalPrice = addProductRow(productInfo, row, totalPrice);
if (productInfo!=null && StringUtils.isNotEmpty(productInfo.getProductBomCode())
if (productInfo != null && StringUtils.isNotEmpty(productInfo.getProductBomCode())
&& MAINTENANCE_SERVICES.contains(productInfo.getProductBomCode())
&& productInfo.getAllPrice() != null) {
maintenancePrice = maintenancePrice.add(productInfo.getAllPrice());
}
staticsNum(wssDto, productInfo, WSS_LIST);
staticsNum(wspDto, productInfo, WSP_LIST);
staticsNum(lsDto, productInfo, LS_LIST);
staticsNum(oneStorDto, productInfo, ONE_STOR_LIST);
staticsNum(nVIDIADto, productInfo, N_VIDIA_LIST);
} else {
addProductRow(null, row, totalPrice);
}
@ -540,12 +580,38 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
row.add(totalPrice.toString());
//维保金额
row.add(11, maintenancePrice.toString());
row.add(21, wssDto.getQuantity().toString());
row.add(22, wssDto.getAllPrice().toString());
row.add(23, wspDto.getQuantity().toString());
row.add(24, wspDto.getAllPrice().toString());
row.add(25, lsDto.getQuantity().toString());
row.add(26, lsDto.getAllPrice().toString());
row.add(27, oneStorDto.getQuantity().toString());
row.add(28, oneStorDto.getAllPrice().toString());
row.add(29, nVIDIADto.getQuantity().toString());
row.add(30, nVIDIADto.getAllPrice().toString());
dataList.add(row);
}
return dataList;
}
private void staticsNum(OrderExcelNumStaticsDto dto, ProjectProductInfo info, List<String> parentList) {
if (dto == null || parentList == null) {
return;
}
if (info != null && StringUtils.isNotEmpty(info.getProductBomCode())
&& parentList.contains(info.getProductBomCode())
) {
BigDecimal allPrice = info.getAllPrice() == null ? BigDecimal.ZERO : info.getAllPrice();
Long quantity = info.getQuantity() == null ? 0L : info.getQuantity();
BigDecimal dtoAllPrice = dto.getAllPrice() == null ? BigDecimal.ZERO : dto.getAllPrice();
Long dtoQuantity = dto.getQuantity() == null ? 0L : dto.getQuantity();
dto.setAllPrice(allPrice.add(dtoAllPrice));
dto.setQuantity(quantity + dtoQuantity);
}
}
private String formatterStr(String value) {
if (StringUtils.isEmpty(value)) {
return "";