refactor(sip): 重构项目订单信息相关功能
- 移除了冗余的 foldOnFold功能 - 优化了项目订单信息的保存和计算逻辑 - 重构了 Excel 导出相关代码,提高了可扩展性和可维护性 - 删除了未使用的变量和注释掉的代码master
parent
ec62b4a4a7
commit
d8ef3450dd
|
@ -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)))
|
||||
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -138,7 +138,6 @@ public class ProjectInfoController extends BaseController
|
|||
List<ProjectOrderInfo> 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}")
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
||||
|
|
|
@ -76,5 +76,5 @@ public interface IProjectOrderInfoService
|
|||
List<StatisticsDetailDto> listHomePageData(HomepageQueryDto dto);
|
||||
|
||||
ProjectOrderInfo selectProjectOrderInfoByOrderCode(String orderCode);
|
||||
Boolean foldOnFold(ProjectOrderInfo info);
|
||||
// Boolean foldOnFold(ProjectOrderInfo info);
|
||||
}
|
||||
|
|
|
@ -63,5 +63,5 @@ public interface IProjectProductInfoService
|
|||
|
||||
List<ProjectProductInfo> selectProjectProductInfoListByProjectId(List<Long> projectId);
|
||||
|
||||
void saveBatch(List<ProjectProductInfo> addList, Supplier<Boolean> supplier);
|
||||
void saveBatch(List<ProjectProductInfo> addList);
|
||||
}
|
||||
|
|
|
@ -190,14 +190,7 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
|
|||
for (ProjectProductInfo projectProductInfo : projectProductInfoList) {
|
||||
projectProductInfo.setProjectId(projectInfo1.getId());
|
||||
}
|
||||
productInfoService.saveBatch(projectProductInfoList, () -> {
|
||||
List<ProjectOrderInfo> 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<ProjectWorkProgress> projectWorkProgressList = projectInfo1.getProjectWorkProgressList();
|
||||
|
|
|
@ -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<Integer> 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<List<String>> header = buildExcelHeader(maxSoftware, maxHardware, maxMaintenance, maxMaintenanceService, maxDeployService);
|
||||
List<List<String>> data = buildExcelData(projectInfos, maxSoftware, maxHardware, maxMaintenance, maxMaintenanceService, maxDeployService);
|
||||
List<List<String>> header = buildExcelHeader(maxCounts);
|
||||
List<List<String>> 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<ProjectOrderInfo> fetchProjectInfos(ProjectOrderInfo projectOrderInfo) {
|
||||
List<ProjectOrderInfo> projectOrderInfos = projectOrderInfoMapper.selectProjectOrderInfoList(projectOrderInfo);
|
||||
|
@ -374,11 +366,19 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
|||
}
|
||||
|
||||
private List<Integer> calculateMaxProductCounts(List<ProjectOrderInfo> 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<List<String>> header, List<List<String>> data) {
|
||||
|
@ -428,9 +428,8 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
|||
protected void setColumnWidth(WriteSheetHolder writeSheetHolder, List<CellData> 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<List<String>> buildExcelHeader(int maxSoftware, int maxHardware, int maxMaintenance, int maxMaintenanceService, int maxDeployService) {
|
||||
public List<List<String>> buildExcelHeader(List<Integer> 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<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("下单通路"));
|
||||
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<List<String>> buildExcelData(List<ProjectOrderInfo> projectInfos, int maxSoftware, int maxHardware, int maxMaintenance, int maxMaintenanceService, int maxDeployService) {
|
||||
private void addHeadList(int maxOne, List<List<String>> 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<List<String>> buildExcelData(List<ProjectOrderInfo> projectInfos, List<Integer> 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<List<String>> dataList = new ArrayList<>();
|
||||
for (ProjectOrderInfo info : projectInfos) {
|
||||
List<String> 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<ProjectProductInfo> maintenanceList = new ArrayList<>();
|
||||
List<ProjectProductInfo> deployList = new ArrayList<>();
|
||||
List<ProjectProductInfo> oneList = new ArrayList<>();
|
||||
List<ProjectProductInfo> 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<String> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ public class ProjectProductInfoServiceImpl implements IProjectProductInfoService
|
|||
}
|
||||
|
||||
@Override
|
||||
public void saveBatch(List<ProjectProductInfo> list, Supplier<Boolean> supplier) {
|
||||
public void saveBatch(List<ProjectProductInfo> list) {
|
||||
//校验数据是否在产品库中
|
||||
List<String> codeList = list.stream().map(ProjectProductInfo::getProductBomCode).distinct().collect(Collectors.toList());
|
||||
List<ProductInfo> 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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue