refactor(sip): 重构项目订单信息导出功能
-优化了订单信息的统计和展示逻辑 - 新增了部署服务和维保服务的分类统计- 调整了表格列的顺序和内容 - 优化了代码结构,提高了可读性和可维护性master
parent
317e5db7c6
commit
41cdc1fdb6
|
@ -112,6 +112,20 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getAllPriceData(){
|
||||||
|
let allPrice=0.00;
|
||||||
|
$('#productTable tbody').find('tr').find('.allPrice').each(function (index) {
|
||||||
|
allPrice+=parseFloat($(this).val())
|
||||||
|
})
|
||||||
|
$('#productTable2 tbody').find('tr').find('.allPrice').each(function (index) {
|
||||||
|
allPrice+=parseFloat($(this).val())
|
||||||
|
})
|
||||||
|
$('#productTable3 tbody').find('tr').find('.allPrice').each(function (index) {
|
||||||
|
allPrice+=parseFloat($(this).val())
|
||||||
|
})
|
||||||
|
console.log(`allPrice=${allPrice}`)
|
||||||
|
console.log('allPrice='+allPrice)
|
||||||
|
}
|
||||||
function addProduct(data) {
|
function addProduct(data) {
|
||||||
let length = $('#productTable tbody').find('tr').length
|
let length = $('#productTable tbody').find('tr').length
|
||||||
let flag=true
|
let flag=true
|
||||||
|
|
|
@ -202,7 +202,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
||||||
if (StringUtils.isNotEmpty(dto.getSerialNumber())){
|
if (StringUtils.isNotEmpty(dto.getSerialNumber())){
|
||||||
queryParams.setSerialNumber(dto.getSerialNumber());
|
queryParams.setSerialNumber(dto.getSerialNumber());
|
||||||
}
|
}
|
||||||
queryParams.setShip("1");
|
queryParams.setShip("1");
|
||||||
List<OrderInfo> orderInfos = orderInfoMapper.selectOrderInfoList(queryParams);
|
List<OrderInfo> orderInfos = orderInfoMapper.selectOrderInfoList(queryParams);
|
||||||
if (CollUtil.isEmpty(orderInfos)) {
|
if (CollUtil.isEmpty(orderInfos)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
|
@ -574,6 +574,7 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
|
||||||
info.setHardwareProjectProductInfoList(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.HARDWARE.getType(), Collections.emptyList()));
|
info.setHardwareProjectProductInfoList(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.HARDWARE.getType(), Collections.emptyList()));
|
||||||
List<ProjectProductInfo> maintenanceProjectProductInfoList = productListMap.getOrDefault(ProductInfo.ProductTypeEnum.SOFTWARE_MAINTENANCE.getType(), new ArrayList<>());
|
List<ProjectProductInfo> maintenanceProjectProductInfoList = productListMap.getOrDefault(ProductInfo.ProductTypeEnum.SOFTWARE_MAINTENANCE.getType(), new ArrayList<>());
|
||||||
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.HARDWARE_MAINTENANCE.getType(), Collections.emptyList()));
|
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.HARDWARE_MAINTENANCE.getType(), Collections.emptyList()));
|
||||||
|
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.OTHER.getType(), Collections.emptyList()));
|
||||||
info.setMaintenanceProjectProductInfoList(maintenanceProjectProductInfoList);
|
info.setMaintenanceProjectProductInfoList(maintenanceProjectProductInfoList);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.BiPredicate;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -28,8 +30,7 @@ import com.ruoyi.sip.dto.OrderExcelNumStaticsDto;
|
||||||
import com.ruoyi.sip.dto.StatisticsDetailDto;
|
import com.ruoyi.sip.dto.StatisticsDetailDto;
|
||||||
import com.ruoyi.sip.service.*;
|
import com.ruoyi.sip.service.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.*;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.sip.mapper.ProjectOrderInfoMapper;
|
import com.ruoyi.sip.mapper.ProjectOrderInfoMapper;
|
||||||
|
@ -58,6 +59,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
private ICnareaService cnareaService;
|
private ICnareaService cnareaService;
|
||||||
|
|
||||||
private static final List<String> MAINTENANCE_SERVICES = Arrays.asList("8813A3YA", "8813A3YB", "8813A7U4", "8813A7U2");
|
private static final List<String> MAINTENANCE_SERVICES = Arrays.asList("8813A3YA", "8813A3YB", "8813A7U4", "8813A7U2");
|
||||||
|
private static final List<String> DEPLOY_SERVICES = Arrays.asList("8814A0BT");
|
||||||
private static final List<String> WSS_LIST = Arrays.asList("3130A6LC");
|
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> WSP_LIST = Arrays.asList("3130A6LE");
|
||||||
private static final List<String> LS_LIST = Arrays.asList("3130A6LD");
|
private static final List<String> LS_LIST = Arrays.asList("3130A6LD");
|
||||||
|
@ -80,6 +82,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
projectOrderInfo.setHardwareProjectProductInfoList(productListMap.get(ProductInfo.ProductTypeEnum.HARDWARE.getType()));
|
projectOrderInfo.setHardwareProjectProductInfoList(productListMap.get(ProductInfo.ProductTypeEnum.HARDWARE.getType()));
|
||||||
List<ProjectProductInfo> maintenanceProjectProductInfoList = productListMap.getOrDefault(ProductInfo.ProductTypeEnum.HARDWARE_MAINTENANCE.getType(), new ArrayList<>());
|
List<ProjectProductInfo> maintenanceProjectProductInfoList = productListMap.getOrDefault(ProductInfo.ProductTypeEnum.HARDWARE_MAINTENANCE.getType(), new ArrayList<>());
|
||||||
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.SOFTWARE_MAINTENANCE.getType(), new ArrayList<>()));
|
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.SOFTWARE_MAINTENANCE.getType(), new ArrayList<>()));
|
||||||
|
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.OTHER.getType(), new ArrayList<>()));
|
||||||
projectOrderInfo.setMaintenanceProjectProductInfoList(maintenanceProjectProductInfoList);
|
projectOrderInfo.setMaintenanceProjectProductInfoList(maintenanceProjectProductInfoList);
|
||||||
|
|
||||||
|
|
||||||
|
@ -246,11 +249,13 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
int maxSoftware = maxCounts.get(0);
|
int maxSoftware = maxCounts.get(0);
|
||||||
int maxHardware = maxCounts.get(1);
|
int maxHardware = maxCounts.get(1);
|
||||||
int maxMaintenance = maxCounts.get(2);
|
int maxMaintenance = maxCounts.get(2);
|
||||||
|
int maxMaintenanceService = maxCounts.get(3);
|
||||||
|
int maxDeployService = maxCounts.get(4);
|
||||||
|
|
||||||
|
|
||||||
// 构建 Excel 表头和数据
|
// 构建 Excel 表头和数据
|
||||||
List<List<String>> header = buildExcelHeader(maxSoftware, maxHardware, maxMaintenance);
|
List<List<String>> header = buildExcelHeader(maxSoftware, maxHardware, maxMaintenance, maxMaintenanceService, maxDeployService);
|
||||||
List<List<String>> data = buildExcelData(projectInfos, maxSoftware, maxHardware, maxMaintenance);
|
List<List<String>> data = buildExcelData(projectInfos, maxSoftware, maxHardware, maxMaintenance, maxMaintenanceService, maxDeployService);
|
||||||
|
|
||||||
// 导出 Excel 文件
|
// 导出 Excel 文件
|
||||||
return writeExcelToFile(header, data);
|
return writeExcelToFile(header, data);
|
||||||
|
@ -295,6 +300,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
projectOrderInfo.setHardwareProjectProductInfoList(productListMap.get(ProductInfo.ProductTypeEnum.HARDWARE.getType()));
|
projectOrderInfo.setHardwareProjectProductInfoList(productListMap.get(ProductInfo.ProductTypeEnum.HARDWARE.getType()));
|
||||||
List<ProjectProductInfo> maintenanceProjectProductInfoList = productListMap.getOrDefault(ProductInfo.ProductTypeEnum.HARDWARE_MAINTENANCE.getType(), new ArrayList<>());
|
List<ProjectProductInfo> maintenanceProjectProductInfoList = productListMap.getOrDefault(ProductInfo.ProductTypeEnum.HARDWARE_MAINTENANCE.getType(), new ArrayList<>());
|
||||||
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.SOFTWARE_MAINTENANCE.getType(), new ArrayList<>()));
|
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.SOFTWARE_MAINTENANCE.getType(), new ArrayList<>()));
|
||||||
|
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.OTHER.getType(), new ArrayList<>()));
|
||||||
projectOrderInfo.setMaintenanceProjectProductInfoList(maintenanceProjectProductInfoList);
|
projectOrderInfo.setMaintenanceProjectProductInfoList(maintenanceProjectProductInfoList);
|
||||||
|
|
||||||
|
|
||||||
|
@ -327,6 +333,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
info.setHardwareProjectProductInfoList(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.HARDWARE.getType(), Collections.emptyList()));
|
info.setHardwareProjectProductInfoList(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.HARDWARE.getType(), Collections.emptyList()));
|
||||||
List<ProjectProductInfo> maintenanceProjectProductInfoList = productListMap.getOrDefault(ProductInfo.ProductTypeEnum.SOFTWARE_MAINTENANCE.getType(), new ArrayList<>());
|
List<ProjectProductInfo> maintenanceProjectProductInfoList = productListMap.getOrDefault(ProductInfo.ProductTypeEnum.SOFTWARE_MAINTENANCE.getType(), new ArrayList<>());
|
||||||
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.HARDWARE_MAINTENANCE.getType(), Collections.emptyList()));
|
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.HARDWARE_MAINTENANCE.getType(), Collections.emptyList()));
|
||||||
|
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.OTHER.getType(), Collections.emptyList()));
|
||||||
info.setMaintenanceProjectProductInfoList(maintenanceProjectProductInfoList);
|
info.setMaintenanceProjectProductInfoList(maintenanceProjectProductInfoList);
|
||||||
});
|
});
|
||||||
if ("YYS".equals(info.getBgProperty())) {
|
if ("YYS".equals(info.getBgProperty())) {
|
||||||
|
@ -338,7 +345,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Integer> calculateMaxProductCounts(List<ProjectOrderInfo> projectInfos) {
|
private List<Integer> calculateMaxProductCounts(List<ProjectOrderInfo> projectInfos) {
|
||||||
int maxSoftware = 0, maxHardware = 0, maxMaintenance = 0;
|
int maxSoftware = 0, maxHardware = 0, maxMaintenance = 0, maxMaintenanceService = 0, maxDeploy = 0;
|
||||||
|
|
||||||
for (ProjectOrderInfo info : projectInfos) {
|
for (ProjectOrderInfo info : projectInfos) {
|
||||||
if (info.getSoftwareProjectProductInfoList() != null) {
|
if (info.getSoftwareProjectProductInfoList() != null) {
|
||||||
|
@ -348,11 +355,19 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
maxHardware = Math.max(maxHardware, info.getHardwareProjectProductInfoList().size());
|
maxHardware = Math.max(maxHardware, info.getHardwareProjectProductInfoList().size());
|
||||||
}
|
}
|
||||||
if (info.getMaintenanceProjectProductInfoList() != null) {
|
if (info.getMaintenanceProjectProductInfoList() != null) {
|
||||||
maxMaintenance = Math.max(maxMaintenance, info.getMaintenanceProjectProductInfoList().size());
|
int allSize = info.getMaintenanceProjectProductInfoList().size();
|
||||||
|
|
||||||
|
List<ProjectProductInfo> notMaintenance = info.getMaintenanceProjectProductInfoList().stream().filter(item -> !MAINTENANCE_SERVICES.contains(item.getProductBomCode())).collect(Collectors.toList());
|
||||||
|
int maintenanceCount = allSize - notMaintenance.size();
|
||||||
|
List<ProjectProductInfo> notMaintenanceAndDeploy = notMaintenance.stream().filter(item -> !DEPLOY_SERVICES.contains(item.getProductBomCode())).collect(Collectors.toList());
|
||||||
|
int deployCount = allSize - maintenanceCount - notMaintenanceAndDeploy.size();
|
||||||
|
maxMaintenanceService = Math.max(maxMaintenanceService, maintenanceCount);
|
||||||
|
maxDeploy = Math.max(maxDeploy, deployCount);
|
||||||
|
maxMaintenance = Math.max(maxMaintenance, notMaintenanceAndDeploy.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Arrays.asList(maxSoftware, maxHardware, maxMaintenance);
|
return Arrays.asList(maxSoftware, maxHardware, maxMaintenance, maxMaintenanceService, maxDeploy);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String writeExcelToFile(List<List<String>> header, List<List<String>> data) {
|
private String writeExcelToFile(List<List<String>> header, List<List<String>> data) {
|
||||||
|
@ -361,13 +376,17 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
String filePath = util.getAbsoluteFile(fileName);
|
String filePath = util.getAbsoluteFile(fileName);
|
||||||
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
|
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
|
||||||
contentWriteCellStyle.setWrapped(true);
|
contentWriteCellStyle.setWrapped(true);
|
||||||
|
contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);
|
||||||
|
contentWriteCellStyle.setBorderTop(BorderStyle.THIN);
|
||||||
|
contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);
|
||||||
|
contentWriteCellStyle.setBorderRight(BorderStyle.THIN);
|
||||||
// 创建工作簿并写入数据
|
// 创建工作簿并写入数据
|
||||||
EasyExcel.write(filePath).head(header)
|
EasyExcel.write(filePath).head(header)
|
||||||
.sheet("订单信息")
|
.sheet("订单信息")
|
||||||
// 注册自定义列宽策略
|
// 注册自定义列宽策略
|
||||||
.registerWriteHandler(new CustomColumnWidthStyleStrategy())
|
.registerWriteHandler(new CustomColumnWidthStyleStrategy())
|
||||||
// 注册自动换行
|
// 注册自动换行
|
||||||
.registerWriteHandler(new HorizontalCellStyleStrategy(null, contentWriteCellStyle))
|
.registerWriteHandler(new HorizontalCellStyleStrategy(contentWriteCellStyle, contentWriteCellStyle))
|
||||||
.doWrite(data);
|
.doWrite(data);
|
||||||
|
|
||||||
return fileName;
|
return fileName;
|
||||||
|
@ -382,7 +401,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
Sheet sheet = writeSheetHolder.getSheet();
|
Sheet sheet = writeSheetHolder.getSheet();
|
||||||
|
|
||||||
// 基础列范围(前 25 列)
|
// 基础列范围(前 25 列)
|
||||||
if (columnIndex >= 0 && columnIndex <= 30) {
|
if (columnIndex >= 0 && columnIndex <= 28) {
|
||||||
// 自适应列宽逻辑
|
// 自适应列宽逻辑
|
||||||
sheet.setColumnWidth(columnIndex, 256 * 30); // 设置固定宽度为 20 个字符
|
sheet.setColumnWidth(columnIndex, 256 * 30); // 设置固定宽度为 20 个字符
|
||||||
}
|
}
|
||||||
|
@ -394,38 +413,16 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<List<String>> buildExcelHeader(int maxSoftware, int maxHardware, int maxMaintenance) {
|
public List<List<String>> buildExcelHeader(int maxSoftware, int maxHardware, int maxMaintenance, int maxMaintenanceService, int maxDeployService) {
|
||||||
List<List<String>> headerList = new ArrayList<>();
|
List<List<String>> headerList = new ArrayList<>();
|
||||||
headerList.add(Collections.singletonList("项目编号"));
|
headerList.add(Collections.singletonList("项目编号"));
|
||||||
headerList.add(Collections.singletonList("项目名称"));
|
|
||||||
headerList.add(Collections.singletonList("最终客户"));
|
|
||||||
headerList.add(Collections.singletonList("BG"));
|
|
||||||
headerList.add(Collections.singletonList("行业"));
|
|
||||||
headerList.add(Collections.singletonList("代表处"));
|
|
||||||
headerList.add(Collections.singletonList("进货商接口人"));
|
|
||||||
// headerList.add(Collections.singletonList("Email"));
|
|
||||||
headerList.add(Collections.singletonList("联系方式"));
|
|
||||||
headerList.add(Collections.singletonList("合同编号"));
|
|
||||||
headerList.add(Collections.singletonList("币种"));
|
|
||||||
headerList.add(Collections.singletonList("订单金额"));
|
|
||||||
headerList.add(Collections.singletonList("维保金额"));
|
|
||||||
headerList.add(Collections.singletonList("下单时间"));
|
headerList.add(Collections.singletonList("下单时间"));
|
||||||
// headerList.add(Collections.singletonList("执行单有效截止时间"));
|
headerList.add(Collections.singletonList("合同编号"));
|
||||||
// headerList.add(Collections.singletonList("要求到货时间"));
|
headerList.add(Collections.singletonList("项目名称"));
|
||||||
// headerList.add(Collections.singletonList("公司直发"));
|
|
||||||
headerList.add(Collections.singletonList("下单通路"));
|
headerList.add(Collections.singletonList("下单通路"));
|
||||||
// headerList.add(Collections.singletonList("供货商"));
|
|
||||||
headerList.add(Collections.singletonList("汇智责任人"));
|
headerList.add(Collections.singletonList("汇智责任人"));
|
||||||
// headerList.add(Collections.singletonList("Email"));
|
headerList.add(Collections.singletonList("代表处"));
|
||||||
// headerList.add(Collections.singletonList("联系方式"));
|
headerList.add(Collections.singletonList("最终客户"));
|
||||||
headerList.add(Collections.singletonList("进货商"));
|
|
||||||
// headerList.add(Collections.singletonList("进货商代码"));
|
|
||||||
headerList.add(Collections.singletonList("进货商类型"));
|
|
||||||
headerList.add(Collections.singletonList("进货商联系人"));
|
|
||||||
// headerList.add(Collections.singletonList("Email"));
|
|
||||||
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("WS胖授权软件数量"));
|
headerList.add(Collections.singletonList("WS胖授权软件数量"));
|
||||||
|
@ -438,6 +435,34 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
headerList.add(Collections.singletonList("nVIDIA授权金额"));
|
headerList.add(Collections.singletonList("nVIDIA授权金额"));
|
||||||
|
|
||||||
|
|
||||||
|
headerList.add(Collections.singletonList("BG"));
|
||||||
|
headerList.add(Collections.singletonList("行业"));
|
||||||
|
|
||||||
|
headerList.add(Collections.singletonList("进货商接口人"));
|
||||||
|
// headerList.add(Collections.singletonList("Email"));
|
||||||
|
headerList.add(Collections.singletonList("联系方式"));
|
||||||
|
|
||||||
|
headerList.add(Collections.singletonList("币种"));
|
||||||
|
|
||||||
|
|
||||||
|
// headerList.add(Collections.singletonList("执行单有效截止时间"));
|
||||||
|
// headerList.add(Collections.singletonList("要求到货时间"));
|
||||||
|
// headerList.add(Collections.singletonList("公司直发"));
|
||||||
|
|
||||||
|
// headerList.add(Collections.singletonList("供货商"));
|
||||||
|
|
||||||
|
// headerList.add(Collections.singletonList("Email"));
|
||||||
|
// headerList.add(Collections.singletonList("联系方式"));
|
||||||
|
headerList.add(Collections.singletonList("进货商"));
|
||||||
|
// headerList.add(Collections.singletonList("进货商代码"));
|
||||||
|
headerList.add(Collections.singletonList("进货商类型"));
|
||||||
|
headerList.add(Collections.singletonList("进货商联系人"));
|
||||||
|
// headerList.add(Collections.singletonList("Email"));
|
||||||
|
headerList.add(Collections.singletonList("联系方式"));
|
||||||
|
// headerList.add(Collections.singletonList("其他特别说明"));
|
||||||
|
// headerList.add(Collections.singletonList("订单状态"));
|
||||||
|
|
||||||
|
|
||||||
// 添加软件产品列
|
// 添加软件产品列
|
||||||
// for (int i = 1; i <= maxSoftware; i++) {
|
// for (int i = 1; i <= maxSoftware; i++) {
|
||||||
// headerList.add(Collections.singletonList("软件编码" + i));
|
// headerList.add(Collections.singletonList("软件编码" + i));
|
||||||
|
@ -461,39 +486,60 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
headerList.add(Collections.singletonList("数量" + i));
|
headerList.add(Collections.singletonList("数量" + i));
|
||||||
headerList.add(Collections.singletonList("总价" + i));
|
headerList.add(Collections.singletonList("总价" + i));
|
||||||
}
|
}
|
||||||
|
// 添加部署产品列
|
||||||
|
for (int i = 1; i <= maxDeployService; i++) {
|
||||||
|
headerList.add(Collections.singletonList("部署服务编码" + i));
|
||||||
|
headerList.add(Collections.singletonList("部署型号" + i));
|
||||||
|
headerList.add(Collections.singletonList("数量" + i));
|
||||||
|
headerList.add(Collections.singletonList("总价" + i));
|
||||||
|
}
|
||||||
|
// 添加维保产品列
|
||||||
|
for (int i = 1; i <= maxMaintenanceService; i++) {
|
||||||
|
headerList.add(Collections.singletonList("维保服务编码" + i));
|
||||||
|
headerList.add(Collections.singletonList("维保型号" + i));
|
||||||
|
headerList.add(Collections.singletonList("数量" + i));
|
||||||
|
headerList.add(Collections.singletonList("总价" + i));
|
||||||
|
}
|
||||||
|
|
||||||
headerList.add(Collections.singletonList("产品总价"));
|
headerList.add(Collections.singletonList("订单金额"));
|
||||||
|
headerList.add(Collections.singletonList("产品总价(配置信息总价)"));
|
||||||
|
headerList.add(Collections.singletonList("维保金额"));
|
||||||
|
|
||||||
return headerList;
|
return headerList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<List<String>> buildExcelData(List<ProjectOrderInfo> projectInfos, int maxSoftware, int maxHardware, int maxMaintenance) {
|
public List<List<String>> buildExcelData(List<ProjectOrderInfo> projectInfos, int maxSoftware, int maxHardware, int maxMaintenance, int maxMaintenanceService, int maxDeployService) {
|
||||||
List<List<String>> dataList = new ArrayList<>();
|
List<List<String>> dataList = new ArrayList<>();
|
||||||
for (ProjectOrderInfo info : projectInfos) {
|
for (ProjectOrderInfo info : projectInfos) {
|
||||||
List<String> row = new ArrayList<>();
|
List<String> row = new ArrayList<>();
|
||||||
// 添加基础字段
|
// 添加基础字段
|
||||||
row.add(info.getProjectCode());
|
row.add(info.getProjectCode());
|
||||||
|
row.add(DateUtil.format(info.getEstimatedOrderTime(), "yyyy-MM-dd"));
|
||||||
|
row.add(info.getOrderCode());
|
||||||
row.add(info.getProjectName());
|
row.add(info.getProjectName());
|
||||||
|
row.add(StringUtils.isEmpty(info.getOrderChannel()) ? "" :
|
||||||
|
"1".equals(info.getOrderChannel()) ? "总代" : "直签");
|
||||||
|
row.add(info.getDutyName());
|
||||||
|
row.add(info.getAgentName());
|
||||||
row.add(info.getCustomerName());
|
row.add(info.getCustomerName());
|
||||||
|
|
||||||
row.add(DictUtils.getDictLabel("bg_type", info.getBgProperty()));
|
row.add(DictUtils.getDictLabel("bg_type", info.getBgProperty()));
|
||||||
row.add(info.getIndustryType());
|
row.add(info.getIndustryType());
|
||||||
row.add(info.getAgentName());
|
|
||||||
row.add(info.getBusinessPerson());
|
row.add(info.getBusinessPerson());
|
||||||
// row.add(info.getBusinessEmail());
|
// row.add(info.getBusinessEmail());
|
||||||
row.add(info.getBusinessPhone());
|
row.add(info.getBusinessPhone());
|
||||||
row.add(info.getOrderCode());
|
|
||||||
row.add(DictUtils.getDictLabel("currency_type", info.getCurrencyType()));
|
row.add(DictUtils.getDictLabel("currency_type", info.getCurrencyType()));
|
||||||
row.add(info.getShipmentAmount() != null ? info.getShipmentAmount().toString() : "");
|
|
||||||
row.add(DateUtil.format(info.getEstimatedOrderTime(), "yyyy-MM-dd"));
|
|
||||||
// row.add(DateUtil.format(info.getOrderEndTime(), "yyyy-MM-dd"));
|
// row.add(DateUtil.format(info.getOrderEndTime(), "yyyy-MM-dd"));
|
||||||
// row.add(DateUtil.format(info.getDeliveryTime(), "yyyy-MM-dd"));
|
// row.add(DateUtil.format(info.getDeliveryTime(), "yyyy-MM-dd"));
|
||||||
// row.add(DictUtils.getDictLabel("company_delivery", info.getCompanyDelivery()));
|
// row.add(DictUtils.getDictLabel("company_delivery", info.getCompanyDelivery()));
|
||||||
|
|
||||||
row.add(StringUtils.isEmpty(info.getOrderChannel()) ? "" :
|
|
||||||
"1".equals(info.getOrderChannel()) ? "总代" : "直签");
|
|
||||||
// row.add(info.getSupplier());
|
// row.add(info.getSupplier());
|
||||||
row.add(info.getDutyName());
|
|
||||||
// row.add(info.getDutyEmail());
|
// row.add(info.getDutyEmail());
|
||||||
// row.add(info.getDutyPhone());
|
// row.add(info.getDutyPhone());
|
||||||
row.add(info.getPartnerName());
|
row.add(info.getPartnerName());
|
||||||
|
@ -502,8 +548,8 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
row.add(info.getPartnerUserName());
|
row.add(info.getPartnerUserName());
|
||||||
// row.add(info.getPartnerEmail());
|
// row.add(info.getPartnerEmail());
|
||||||
row.add(info.getPartnerPhone());
|
row.add(info.getPartnerPhone());
|
||||||
row.add(info.getRemark());
|
// row.add(info.getRemark());
|
||||||
row.add(DictUtils.getDictLabel("order_status", info.getOrderStatus()));
|
// row.add(DictUtils.getDictLabel("order_status", info.getOrderStatus()));
|
||||||
|
|
||||||
BigDecimal totalPrice = BigDecimal.ZERO;
|
BigDecimal totalPrice = BigDecimal.ZERO;
|
||||||
BigDecimal maintenancePrice = BigDecimal.ZERO;
|
BigDecimal maintenancePrice = BigDecimal.ZERO;
|
||||||
|
@ -514,7 +560,8 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
OrderExcelNumStaticsDto oneStorDto = new OrderExcelNumStaticsDto(BigDecimal.ZERO, 0L);
|
OrderExcelNumStaticsDto oneStorDto = new OrderExcelNumStaticsDto(BigDecimal.ZERO, 0L);
|
||||||
OrderExcelNumStaticsDto nVIDIADto = new OrderExcelNumStaticsDto(BigDecimal.ZERO, 0L);
|
OrderExcelNumStaticsDto nVIDIADto = new OrderExcelNumStaticsDto(BigDecimal.ZERO, 0L);
|
||||||
|
|
||||||
|
List<ProjectProductInfo> maintenanceList = new ArrayList<>();
|
||||||
|
List<ProjectProductInfo> deployList = new ArrayList<>();
|
||||||
// 添加软件产品列
|
// 添加软件产品列
|
||||||
for (int i = 0; i < maxSoftware; i++) {
|
for (int i = 0; i < maxSoftware; i++) {
|
||||||
if (CollUtil.isNotEmpty(info.getSoftwareProjectProductInfoList()) && i < info.getSoftwareProjectProductInfoList().size()) {
|
if (CollUtil.isNotEmpty(info.getSoftwareProjectProductInfoList()) && i < info.getSoftwareProjectProductInfoList().size()) {
|
||||||
|
@ -522,13 +569,6 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
if (productInfo.getAllPrice() != null) {
|
if (productInfo.getAllPrice() != null) {
|
||||||
totalPrice = totalPrice.add(productInfo.getAllPrice());
|
totalPrice = totalPrice.add(productInfo.getAllPrice());
|
||||||
}
|
}
|
||||||
// totalPrice = addProductRow(productInfo, row, totalPrice);
|
|
||||||
// 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(wssDto, productInfo, WSS_LIST);
|
||||||
staticsNum(wspDto, productInfo, WSP_LIST);
|
staticsNum(wspDto, productInfo, WSP_LIST);
|
||||||
staticsNum(lsDto, productInfo, LS_LIST);
|
staticsNum(lsDto, productInfo, LS_LIST);
|
||||||
|
@ -544,61 +584,81 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
if (CollUtil.isNotEmpty(info.getHardwareProjectProductInfoList()) && i < info.getHardwareProjectProductInfoList().size()) {
|
if (CollUtil.isNotEmpty(info.getHardwareProjectProductInfoList()) && i < info.getHardwareProjectProductInfoList().size()) {
|
||||||
ProjectProductInfo productInfo = info.getHardwareProjectProductInfoList().get(i);
|
ProjectProductInfo productInfo = info.getHardwareProjectProductInfoList().get(i);
|
||||||
totalPrice = addProductRow(productInfo, row, totalPrice);
|
totalPrice = addProductRow(productInfo, row, totalPrice);
|
||||||
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 {
|
} else {
|
||||||
addProductRow(null, row, totalPrice);
|
addProductRow(null, row, totalPrice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int serviceIndex=maxMaintenance;
|
||||||
// 添加服务产品列
|
// 添加服务产品列
|
||||||
for (int i = 0; i < maxMaintenance; i++) {
|
int maxMaintenanceIndex=-1;
|
||||||
if (CollUtil.isNotEmpty(info.getMaintenanceProjectProductInfoList()) && i < info.getMaintenanceProjectProductInfoList().size()) {
|
while(serviceIndex>0){
|
||||||
ProjectProductInfo productInfo = info.getMaintenanceProjectProductInfoList().get(i);
|
maxMaintenanceIndex++;
|
||||||
totalPrice = addProductRow(productInfo, row, totalPrice);
|
if (CollUtil.isNotEmpty(info.getMaintenanceProjectProductInfoList()) && maxMaintenanceIndex < info.getMaintenanceProjectProductInfoList().size()) {
|
||||||
|
ProjectProductInfo productInfo = info.getMaintenanceProjectProductInfoList().get(maxMaintenanceIndex);
|
||||||
|
|
||||||
if (productInfo != null && StringUtils.isNotEmpty(productInfo.getProductBomCode())
|
if (productInfo != null && StringUtils.isNotEmpty(productInfo.getProductBomCode())
|
||||||
&& MAINTENANCE_SERVICES.contains(productInfo.getProductBomCode())
|
&& MAINTENANCE_SERVICES.contains(productInfo.getProductBomCode())
|
||||||
&& productInfo.getAllPrice() != null) {
|
) {
|
||||||
|
maintenanceList.add(productInfo);
|
||||||
maintenancePrice = maintenancePrice.add(productInfo.getAllPrice());
|
maintenancePrice = maintenancePrice.add(productInfo.getAllPrice());
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
staticsNum(wssDto, productInfo, WSS_LIST);
|
if (productInfo != null && StringUtils.isNotEmpty(productInfo.getProductBomCode())
|
||||||
staticsNum(wspDto, productInfo, WSP_LIST);
|
&& DEPLOY_SERVICES.contains(productInfo.getProductBomCode())
|
||||||
staticsNum(lsDto, productInfo, LS_LIST);
|
) {
|
||||||
staticsNum(oneStorDto, productInfo, ONE_STOR_LIST);
|
deployList.add(productInfo);
|
||||||
staticsNum(nVIDIADto, productInfo, N_VIDIA_LIST);
|
continue;
|
||||||
|
}
|
||||||
|
totalPrice = addProductRow(productInfo, row, totalPrice);
|
||||||
|
serviceIndex--;
|
||||||
|
} else {
|
||||||
|
addProductRow(null, row, totalPrice);
|
||||||
|
serviceIndex--;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//添加部署
|
||||||
|
for (int i = 0; i < maxDeployService; i++) {
|
||||||
|
if (CollUtil.isNotEmpty(deployList) && i < deployList.size()) {
|
||||||
|
ProjectProductInfo productInfo = deployList.get(i);
|
||||||
|
totalPrice = addProductRow(productInfo, row, totalPrice);
|
||||||
} else {
|
} else {
|
||||||
addProductRow(null, row, totalPrice);
|
addProductRow(null, row, totalPrice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// totalPrice = totalPrice.add(wssDto.getAllPrice()).add(wspDto.getAllPrice()).add(lsDto.getAllPrice()).add(oneStorDto.getAllPrice()).add(nVIDIADto.getAllPrice());
|
//添加维保
|
||||||
|
for (int i = 0; i < maxMaintenanceService; i++) {
|
||||||
|
if (CollUtil.isNotEmpty(maintenanceList) && i < maintenanceList.size()) {
|
||||||
|
ProjectProductInfo productInfo = maintenanceList.get(i);
|
||||||
|
totalPrice = addProductRow(productInfo, row, totalPrice);
|
||||||
|
} else {
|
||||||
|
addProductRow(null, row, totalPrice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
row.add(8, wssDto.getQuantity().toString());
|
||||||
|
row.add(9, wssDto.getAllPrice().toString());
|
||||||
|
row.add(10, wspDto.getQuantity().toString());
|
||||||
|
row.add(11, wspDto.getAllPrice().toString());
|
||||||
|
row.add(12, lsDto.getQuantity().toString());
|
||||||
|
row.add(13, lsDto.getAllPrice().toString());
|
||||||
|
row.add(14, oneStorDto.getQuantity().toString());
|
||||||
|
row.add(15, oneStorDto.getAllPrice().toString());
|
||||||
|
row.add(16, nVIDIADto.getQuantity().toString());
|
||||||
|
row.add(17, nVIDIADto.getAllPrice().toString());
|
||||||
|
row.add(info.getShipmentAmount() != null ? info.getShipmentAmount().toString() : "");
|
||||||
row.add(totalPrice.toString());
|
row.add(totalPrice.toString());
|
||||||
//维保金额
|
//维保金额
|
||||||
row.add(11, maintenancePrice.toString());
|
row.add(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);
|
dataList.add(row);
|
||||||
}
|
}
|
||||||
return dataList;
|
return dataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void staticsNum(OrderExcelNumStaticsDto dto, ProjectProductInfo info, List<String> parentList) {
|
private void staticsNum(OrderExcelNumStaticsDto dto, ProjectProductInfo info, List<String> parentList) {
|
||||||
if (dto == null || parentList == null) {
|
if (dto == null || parentList == null) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue