From d8ef3450ddffc251399201781b6795697c8cac11 Mon Sep 17 00:00:00 2001 From: chenhao <852066789@qq.com> Date: Wed, 2 Jul 2025 10:55:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor(sip):=20=E9=87=8D=E6=9E=84=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E8=AE=A2=E5=8D=95=E4=BF=A1=E6=81=AF=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了冗余的 foldOnFold功能 - 优化了项目订单信息的保存和计算逻辑 - 重构了 Excel 导出相关代码,提高了可扩展性和可维护性 - 删除了未使用的变量和注释掉的代码 --- .../templates/layout/product-list.html | 26 +-- .../templates/project/order/edit.html | 49 ----- .../sip/controller/ProjectInfoController.java | 1 - .../ProjectOrderInfoController.java | 2 +- .../sip/service/IProjectOrderInfoService.java | 2 +- .../service/IProjectProductInfoService.java | 2 +- .../service/impl/ProjectInfoServiceImpl.java | 9 +- .../impl/ProjectOrderInfoServiceImpl.java | 170 +++++++++++------- .../impl/ProjectProductInfoServiceImpl.java | 5 +- 9 files changed, 123 insertions(+), 143 deletions(-) diff --git a/ruoyi-admin/src/main/resources/templates/layout/product-list.html b/ruoyi-admin/src/main/resources/templates/layout/product-list.html index 10b2df75..771df480 100644 --- a/ruoyi-admin/src/main/resources/templates/layout/product-list.html +++ b/ruoyi-admin/src/main/resources/templates/layout/product-list.html @@ -280,10 +280,10 @@ function getFlag() { let level = $('#level'); let orderChannel = $('#orderChannel'); - if (!level.length || !orderChannel.length){ - return [[${foldOnFold}]]; - } - return level && orderChannel && orderChannel.val() === '2' && (level.val() === '01' || level.val() === '02'); + // if (!level.length || !orderChannel.length){ + // return [[${foldOnFold}]]; + // } + return level.length && orderChannel.length && orderChannel.val() === '2' && (level.val() === '01' || level.val() === '02'); } function initPrice() { $('.productTable .quantity').on('input', function () { @@ -292,9 +292,9 @@ let cateVal = $(this).parent().parent().find('.cataloguePrice').val() if (priceVal && num) { let allPrice = num * priceVal; - if (getFlag()) { - allPrice *= FOLD_ON_FOLD - } + // if (getFlag()) { + // allPrice *= FOLD_ON_FOLD + // } $(this).parent().parent().find('.allPrice').val(allPrice.toFixed(2)) $(this).parent().parent().find('.allPrice-formmat').val(formatAmountNumber(allPrice.toFixed(2))) @@ -353,9 +353,9 @@ let allPriceNumber = price * num - if (getFlag()) { - allPriceNumber *= FOLD_ON_FOLD - } + // if (getFlag()) { + // allPriceNumber *= FOLD_ON_FOLD + // } $(this).parent().parent().parent().find('.allPrice').val(allPriceNumber.toFixed(2)) let allPrice = $(this).parent().parent().parent().find('.allPrice').val() $(this).parent().parent().parent().find('.allPrice-formmat').val(formatAmountNumber(allPrice)) @@ -366,9 +366,9 @@ let num = $(this).parent().parent().find('.quantity').val() $(this).parent().parent().find('.price').val(val) let allPriceNumber = val * num - if (getFlag()) { - allPriceNumber *= FOLD_ON_FOLD - } + // if (getFlag()) { + // allPriceNumber *= FOLD_ON_FOLD + // } $(this).parent().parent().find('.allPrice').val(allPriceNumber.toFixed(2)) $(this).parent().parent().find('.allPrice-formmat').val(formatAmountNumber(allPriceNumber.toFixed(2))) diff --git a/ruoyi-admin/src/main/resources/templates/project/order/edit.html b/ruoyi-admin/src/main/resources/templates/project/order/edit.html index 4c4db76a..8b3b77ae 100644 --- a/ruoyi-admin/src/main/resources/templates/project/order/edit.html +++ b/ruoyi-admin/src/main/resources/templates/project/order/edit.html @@ -357,55 +357,6 @@ var hardwareProjectProductInfoList = [] var maintenanceProjectProductInfoList = [] - // function changePrice(){ - // changeAllPrice().then(()=>{ - // - // setOrderPriceData() - // console.log('修改总价完成') - // }) - // } - // function changeAllPrice() { - // console.log('产品总价修改开始') - // return new Promise (resolve => { - // if (getFlag()) { - // $('#productTable tbody').find('tr').find('.allPrice').each(function (index) { - // let data = parseFloat($(this).val()); - // $(this).val((FOLD_ON_FOLD*data).toFixed(2)) - // $(this).parent().find('.allPrice-formmat').val(formatAmountNumber($(this).val())) - // - // }) - // $('#productTable2 tbody').find('tr').find('.allPrice').each(function (index) { - // let data = parseFloat($(this).val()); - // $(this).val((FOLD_ON_FOLD*data).toFixed(2)) - // $(this).parent().find('.allPrice-formmat').val(formatAmountNumber($(this).val())) - // }) - // $('#productTable3 tbody').find('tr').find('.allPrice').each(function (index) { - // let data = parseFloat($(this).val()); - // $(this).val((FOLD_ON_FOLD*data).toFixed(2)) - // $(this).parent().find('.allPrice-formmat').val(formatAmountNumber($(this).val())) - // }) - // } - // else { - // $('#productTable tbody').find('tr').find('.allPrice').each(function (index) { - // let data = parseFloat($(this).val()); - // $(this).val((data/FOLD_ON_FOLD).toFixed(2)) - // $(this).parent().find('.allPrice-formmat').val(formatAmountNumber($(this).val())) - // }) - // $('#productTable2 tbody').find('tr').find('.allPrice').each(function (index) { - // let data = parseFloat($(this).val()); - // $(this).val((data/FOLD_ON_FOLD).toFixed(2)) - // $(this).parent().find('.allPrice-formmat').val(formatAmountNumber($(this).val())) - // }) - // $('#productTable3 tbody').find('tr').find('.allPrice').each(function (index) { - // let data = parseFloat($(this).val()); - // $(this).val((data/FOLD_ON_FOLD).toFixed(2)) - // $(this).parent().find('.allPrice-formmat').val(formatAmountNumber($(this).val())) - // }) - // } - // console.log('产品总价修改完成') - // resolve() - // }) - // } function initProductList() { initProjectList() let data = { diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectInfoController.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectInfoController.java index a1620790..eeb4141c 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectInfoController.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectInfoController.java @@ -138,7 +138,6 @@ public class ProjectInfoController extends BaseController List orderInfoList = orderInfoService.selectProjectOrderInfoByProjectId(Collections.singletonList(id)); ProjectOrderInfo orderInfo = CollUtil.isNotEmpty(orderInfoList) ? orderInfoList.get(0) : null; mmap.put("orderInfo", orderInfo); - mmap.put("foldOnFold", orderInfoService.foldOnFold(orderInfo)); return prefix + "/edit"; } @GetMapping("/query/{id}") diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectOrderInfoController.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectOrderInfoController.java index abb49f7c..1458c5bc 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectOrderInfoController.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectOrderInfoController.java @@ -122,7 +122,7 @@ public class ProjectOrderInfoController extends BaseController ProjectOrderInfo projectOrderInfo = projectOrderInfoService.selectProjectOrderInfoById(id); mmap.put("projectOrderInfo", projectOrderInfo); mmap.put("user", ShiroUtils.getSysUser()); - mmap.put("foldOnFold", projectOrderInfoService.foldOnFold(projectOrderInfo)); +// mmap.put("foldOnFold", projectOrderInfoService.foldOnFold(projectOrderInfo)); return prefix + "/edit"; } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectOrderInfoService.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectOrderInfoService.java index 764b93f7..cae48a4c 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectOrderInfoService.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectOrderInfoService.java @@ -76,5 +76,5 @@ public interface IProjectOrderInfoService List listHomePageData(HomepageQueryDto dto); ProjectOrderInfo selectProjectOrderInfoByOrderCode(String orderCode); - Boolean foldOnFold(ProjectOrderInfo info); +// Boolean foldOnFold(ProjectOrderInfo info); } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectProductInfoService.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectProductInfoService.java index cd3c15ad..b6959ebe 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectProductInfoService.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectProductInfoService.java @@ -63,5 +63,5 @@ public interface IProjectProductInfoService List selectProjectProductInfoListByProjectId(List projectId); - void saveBatch(List addList, Supplier supplier); + void saveBatch(List addList); } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectInfoServiceImpl.java index 7de384a5..e5937ee1 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectInfoServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectInfoServiceImpl.java @@ -190,14 +190,7 @@ public class ProjectInfoServiceImpl implements IProjectInfoService { for (ProjectProductInfo projectProductInfo : projectProductInfoList) { projectProductInfo.setProjectId(projectInfo1.getId()); } - productInfoService.saveBatch(projectProductInfoList, () -> { - List projectOrderInfos = orderInfoService.selectProjectOrderInfoByProjectId(Collections.singletonList(projectInfo1.getId())); - if (CollUtil.isEmpty(projectOrderInfos)) { - return false; - } - ProjectOrderInfo projectOrderInfo = projectOrderInfos.get(0); - return orderInfoService.foldOnFold(projectOrderInfo); - }); + productInfoService.saveBatch(projectProductInfoList); } //插入变更记录信息 List projectWorkProgressList = projectInfo1.getProjectWorkProgressList(); diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectOrderInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectOrderInfoServiceImpl.java index 8237ffc0..bbfeff44 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectOrderInfoServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectOrderInfoServiceImpl.java @@ -161,10 +161,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService { projectProductInfo.setProjectId(projectId); } } - productInfoService.saveBatch(projectProductInfoList, () -> { - //直签+国代/省代时,这里的总价自动再做1.2%的折扣 - return foldOnFold(projectOrderInfo); - }); + productInfoService.saveBatch(projectProductInfoList); } } @@ -265,16 +262,11 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService { // 计算各类产品的最大数量 List maxCounts = calculateMaxProductCounts(projectInfos); - int maxSoftware = maxCounts.get(0); - int maxHardware = maxCounts.get(1); - int maxMaintenance = maxCounts.get(2); - int maxMaintenanceService = maxCounts.get(3); - int maxDeployService = maxCounts.get(4); // 构建 Excel 表头和数据 - List> header = buildExcelHeader(maxSoftware, maxHardware, maxMaintenance, maxMaintenanceService, maxDeployService); - List> data = buildExcelData(projectInfos, maxSoftware, maxHardware, maxMaintenance, maxMaintenanceService, maxDeployService); + List> header = buildExcelHeader(maxCounts); + List> data = buildExcelData(projectInfos, maxCounts); // 导出 Excel 文件 return writeExcelToFile(header, data); @@ -327,15 +319,15 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService { } - @Override - public Boolean foldOnFold(ProjectOrderInfo projectOrderInfo) { - if (projectOrderInfo == null) { - return false; - } - //直签+国代/省代时,这里的总价自动再做1.2%的折扣 - return "2".equals(projectOrderInfo.getOrderChannel()) && ("01".equals(projectOrderInfo.getLevel()) || "02".equals(projectOrderInfo.getLevel())); - - } +// @Override +// public Boolean foldOnFold(ProjectOrderInfo projectOrderInfo) { +// if (projectOrderInfo == null) { +// return false; +// } +// //直签+国代/省代时,这里的总价自动再做1.2%的折扣 +// return "2".equals(projectOrderInfo.getOrderChannel()) && ("01".equals(projectOrderInfo.getLevel()) || "02".equals(projectOrderInfo.getLevel())); +// +// } private List fetchProjectInfos(ProjectOrderInfo projectOrderInfo) { List projectOrderInfos = projectOrderInfoMapper.selectProjectOrderInfoList(projectOrderInfo); @@ -374,11 +366,19 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService { } private List calculateMaxProductCounts(List projectInfos) { - int maxSoftware = 0, maxHardware = 0, maxMaintenance = 0, maxMaintenanceService = 0, maxDeploy = 0; + int maxSoftware = 0, maxHardware = 0, maxMaintenance = 0, maxMaintenanceService = 0, maxDeploy = 0, maxOne = 0, maxNvidia = 0; for (ProjectOrderInfo info : projectInfos) { if (info.getSoftwareProjectProductInfoList() != null) { maxSoftware = Math.max(maxSoftware, info.getSoftwareProjectProductInfoList().size()); + maxOne = Math.toIntExact(Math.max(maxOne, + info.getSoftwareProjectProductInfoList().stream().filter(item -> + ONE_STOR_LIST.contains(item.getProductBomCode())).count())); + maxNvidia = Math.toIntExact(Math.max(maxNvidia, + info.getSoftwareProjectProductInfoList().stream().filter(item -> + N_VIDIA_LIST.contains(item.getProductBomCode())).count())); + + } if (info.getHardwareProjectProductInfoList() != null) { maxHardware = Math.max(maxHardware, info.getHardwareProjectProductInfoList().size()); @@ -396,7 +396,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService { } } - return Arrays.asList(maxSoftware, maxHardware, maxMaintenance, maxMaintenanceService, maxDeploy); + return Arrays.asList(maxSoftware, maxHardware, maxMaintenance, maxMaintenanceService, maxDeploy, maxOne, maxNvidia); } private String writeExcelToFile(List> header, List> data) { @@ -428,9 +428,8 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService { protected void setColumnWidth(WriteSheetHolder writeSheetHolder, List list, Cell cell, Head head, Integer integer, Boolean aBoolean) { int columnIndex = cell.getColumnIndex(); Sheet sheet = writeSheetHolder.getSheet(); - // 基础列范围(前 25 列) - if (columnIndex >= 0 && columnIndex <= 28) { + if (columnIndex >= 0 && columnIndex <= 35) { // 自适应列宽逻辑 sheet.setColumnWidth(columnIndex, 256 * 30); // 设置固定宽度为 20 个字符 } @@ -442,15 +441,22 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService { } } - public List> buildExcelHeader(int maxSoftware, int maxHardware, int maxMaintenance, int maxMaintenanceService, int maxDeployService) { + public List> buildExcelHeader(List maxCounts) { + int maxSoftware = maxCounts.get(0); + int maxHardware = maxCounts.get(1); + int maxMaintenance = maxCounts.get(2); + int maxMaintenanceService = maxCounts.get(3); + int maxDeployService = maxCounts.get(4); + int maxOne = maxCounts.get(5); + int maxNvidia = maxCounts.get(6); List> headerList = new ArrayList<>(); 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("WS瘦授权软件数量")); headerList.add(Collections.singletonList("WS瘦授权软件金额")); @@ -458,10 +464,12 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService { 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授权金额")); + addHeadList(maxOne, headerList, "ONEstor"); + addHeadList(maxNvidia, headerList, "nVIDIA"); +// headerList.add(Collections.singletonList("ONEstor数量")); +// headerList.add(Collections.singletonList("ONEstor金额")); +// headerList.add(Collections.singletonList("nVIDIA授权数量")); +// headerList.add(Collections.singletonList("nVIDIA授权金额")); headerList.add(Collections.singletonList("BG")); @@ -501,34 +509,18 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService { // } // 添加终端产品列 - for (int i = 1; i <= maxHardware; i++) { - headerList.add(Collections.singletonList("终端编码" + i)); - headerList.add(Collections.singletonList("型号" + i)); - headerList.add(Collections.singletonList("数量" + i)); - headerList.add(Collections.singletonList("总价" + i)); - } + addHeadList(maxHardware, headerList, "终端"); + // 添加服务产品列 - for (int i = 1; i <= maxMaintenance; i++) { - headerList.add(Collections.singletonList("服务编码" + i)); - headerList.add(Collections.singletonList("型号" + i)); - headerList.add(Collections.singletonList("数量" + i)); - headerList.add(Collections.singletonList("总价" + i)); - } + addHeadList(maxMaintenance, headerList, "服务"); + // 添加部署产品列 - 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)); - } + addHeadList(maxDeployService, headerList, "部署服务"); + // 添加维保产品列 - 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)); - } + addHeadList(maxMaintenanceService, headerList, "维保服务"); + headerList.add(Collections.singletonList("订单金额")); headerList.add(Collections.singletonList("产品总价(配置信息总价)")); @@ -537,7 +529,24 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService { return headerList; } - public List> buildExcelData(List projectInfos, int maxSoftware, int maxHardware, int maxMaintenance, int maxMaintenanceService, int maxDeployService) { + private void addHeadList(int maxOne, List> headerList, String prefix) { + for (int i = 1; i <= maxOne; i++) { + headerList.add(Collections.singletonList(prefix + "编码" + i)); + headerList.add(Collections.singletonList(prefix + "型号" + i)); + headerList.add(Collections.singletonList(prefix + "数量" + i)); + headerList.add(Collections.singletonList(prefix + "金额" + i)); + } + } + + public List> buildExcelData(List projectInfos, List maxCounts) { + int maxSoftware = maxCounts.get(0); + int maxHardware = maxCounts.get(1); + int maxMaintenance = maxCounts.get(2); + int maxMaintenanceService = maxCounts.get(3); + int maxDeployService = maxCounts.get(4); + int maxOne = maxCounts.get(5); + int maxNvidia = maxCounts.get(6); + List> dataList = new ArrayList<>(); for (ProjectOrderInfo info : projectInfos) { List row = new ArrayList<>(); @@ -552,9 +561,10 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService { OrderExcelNumStaticsDto lsDto = new OrderExcelNumStaticsDto(BigDecimal.ZERO, 0L); OrderExcelNumStaticsDto oneStorDto = new OrderExcelNumStaticsDto(BigDecimal.ZERO, 0L); OrderExcelNumStaticsDto nVIDIADto = new OrderExcelNumStaticsDto(BigDecimal.ZERO, 0L); - List maintenanceList = new ArrayList<>(); List deployList = new ArrayList<>(); + List oneList = new ArrayList<>(); + List nvidiaList = new ArrayList<>(); // 添加软件产品列 for (int i = 0; i < maxSoftware; i++) { if (CollUtil.isNotEmpty(info.getSoftwareProjectProductInfoList()) && i < info.getSoftwareProjectProductInfoList().size()) { @@ -565,8 +575,14 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService { 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); + if (ONE_STOR_LIST.contains(productInfo.getProductBomCode())) { + oneList.add(productInfo); + } + if (N_VIDIA_LIST.contains(productInfo.getProductBomCode())) { + nvidiaList.add(productInfo); + } +// staticsNum(oneStorDto, productInfo, ONE_STOR_LIST); +// staticsNum(nVIDIADto, productInfo, N_VIDIA_LIST); } else { // addProductRow(null, row, totalPrice); } @@ -612,10 +628,19 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService { 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()); + int insertIndex=14; + for (int i = 0; i < maxOne; i++) { + ProjectProductInfo projectProductInfo = i < oneList.size() ? oneList.get(i) : null; + insertIndex = addProductRowByIndex(projectProductInfo, row, insertIndex); + } + for (int i = 0; i < maxNvidia; i++) { + ProjectProductInfo projectProductInfo = i < nvidiaList.size() ? nvidiaList.get(i) : null; + insertIndex = addProductRowByIndex(projectProductInfo, row, insertIndex); + } +// 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()); //维保金额 @@ -642,10 +667,10 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService { row.add(DateUtil.format(info.getEstimatedOrderTime(), "yyyy-MM-dd")); row.add(info.getOrderCode()); row.add(info.getProjectName()); + row.add(info.getAgentName()); + row.add(info.getDutyName()); row.add(StringUtils.isEmpty(info.getOrderChannel()) ? "" : "1".equals(info.getOrderChannel()) ? "总代" : "直签"); - row.add(info.getDutyName()); - row.add(info.getAgentName()); row.add(info.getCustomerName()); row.add(DictUtils.getDictLabel("bg_type", info.getBgProperty())); @@ -718,4 +743,19 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService { } return totalPrice; } + + private int addProductRowByIndex(ProjectProductInfo productInfo, List row, Integer index) { + if (productInfo == null) { + row.add(index++, ""); + row.add(index++, ""); + row.add(index++, ""); + row.add(index++, ""); + return index; + } + row.add(index++, productInfo.getProductBomCode()); + row.add(index++, productInfo.getModel()); + row.add(index++, productInfo.getQuantity() == null ? "" : productInfo.getQuantity().toString()); + row.add(index++, productInfo.getAllPrice() == null ? "" : productInfo.getAllPrice().toString()); + return index; + } } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectProductInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectProductInfoServiceImpl.java index 74e35d12..f7a2ab2b 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectProductInfoServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectProductInfoServiceImpl.java @@ -110,7 +110,7 @@ public class ProjectProductInfoServiceImpl implements IProjectProductInfoService } @Override - public void saveBatch(List list, Supplier supplier) { + public void saveBatch(List list) { //校验数据是否在产品库中 List codeList = list.stream().map(ProjectProductInfo::getProductBomCode).distinct().collect(Collectors.toList()); List productInfos = productInfoService.selectProductInfoByCodeList(codeList); @@ -134,9 +134,6 @@ public class ProjectProductInfoServiceImpl implements IProjectProductInfoService } if (info.getPrice() != null && info.getQuantity() != null) { BigDecimal allPrice = info.getPrice().multiply(new BigDecimal(info.getQuantity())); - if (supplier.get()) { - allPrice = allPrice.multiply(new BigDecimal(FOLD_ON_FOLD)); - } info.setAllPrice(allPrice.setScale(2, RoundingMode.HALF_UP)); } }