Commit f21c137dd51244acf374d9fdd8d733d28b37f314
1 parent
1691c6bf
fix:给orderbase订单添加(捆绑)invoice和生产科对账单号增加注释,
Showing
8 changed files
with
97 additions
and
63 deletions
src/main/java/com/order/erp/domain/dto/order/OrderBaseInfoDO.java
... | ... | @@ -120,4 +120,14 @@ public class OrderBaseInfoDO extends BaseDO implements Serializable { |
120 | 120 | * 是否返单 |
121 | 121 | */ |
122 | 122 | private String returnOrder; |
123 | + | |
124 | + /** | |
125 | + * invoice号 | |
126 | + */ | |
127 | + private String invoiceNo; | |
128 | + /** | |
129 | + * 生产科对账单号 | |
130 | + */ | |
131 | + private String checkNo; | |
132 | + | |
123 | 133 | } | ... | ... |
src/main/java/com/order/erp/domain/vo/order/BusinessProfitRatioResultVO.java
src/main/java/com/order/erp/domain/vo/order/OrderBaseInfoQueryVO.java
... | ... | @@ -188,5 +188,14 @@ public class OrderBaseInfoQueryVO extends BasePageVO implements Serializable { |
188 | 188 | |
189 | 189 | private List<Long> exportOrderIds; |
190 | 190 | |
191 | + /** | |
192 | + * invoice 首页筛选invoice。 | |
193 | + */ | |
194 | + private List<String> invoiceNo; | |
195 | + | |
196 | + /** | |
197 | + * checkNo 首页筛选Check。 | |
198 | + */ | |
199 | + private List<String> CheckNo; | |
191 | 200 | } |
192 | 201 | ... | ... |
src/main/java/com/order/erp/domain/vo/order/OrderBaseInfoVO.java
src/main/java/com/order/erp/service/order/impl/CalculateProfitServiceImpl.java
... | ... | @@ -67,8 +67,6 @@ public class CalculateProfitServiceImpl { |
67 | 67 | */ |
68 | 68 | public ServerResult businessProfitRatioExport(HttpServletResponse response, BusinessProfitRatioQueryVO queryVO) throws IOException { |
69 | 69 | BusinessProfitRatioResultVO resultVO = buildBusinessProfitRatioResultVO(queryVO); |
70 | -// File file = pdfUtils.createBusinessProfitResultPdf(resultVO, "business_profit_ratio.pdf"); | |
71 | -// FileUtil.downloadFile(request, response, file, true); | |
72 | 70 | //开始 |
73 | 71 | Workbook workbook = new XSSFWorkbook(); |
74 | 72 | Sheet sheet = workbook.createSheet("业务净利润分析表"); |
... | ... | @@ -205,10 +203,6 @@ public class CalculateProfitServiceImpl { |
205 | 203 | */ |
206 | 204 | public ServerResult innerProfitRatioExport(HttpServletResponse response,InnerProfitRatioQueryVO queryVO) throws IOException { |
207 | 205 | InnerProfitRatioResultVO resultVO = buildInnerProfitRatioResultVO(queryVO); |
208 | -// File file = pdfUtils.createInnerProfitResultPdf(resultVO, "inner_profit_ratio.pdf"); | |
209 | -// FileUtil.downloadFile(request, response, file, true); | |
210 | -////开始 | |
211 | -//结束 | |
212 | 206 | Workbook workbook = new XSSFWorkbook(); |
213 | 207 | Sheet sheet = workbook.createSheet("内部生产净利润分析表"); |
214 | 208 | Row row = sheet.createRow(0); |
... | ... | @@ -392,7 +386,7 @@ public class CalculateProfitServiceImpl { |
392 | 386 | customerRmbTotalPrice = customerRmbTotalPrice.add(new BigDecimal(profitAnalysisDO.getCustomerRmbTotalPrice())); |
393 | 387 | customerTotalPrice=customerTotalPrice.add(new BigDecimal(profitAnalysisDO.getCustomerTotalPrice())); |
394 | 388 | productionDepartmentTotalPrice = productionDepartmentTotalPrice.add(new BigDecimal(profitAnalysisDO.getProductionDepartmentTotalPrice())); |
395 | - //这里的包装费用好像为美元。需要采用人民币。 | |
389 | + //这里得到的包装费用好像为美元。需要采用人民币。所以乘上汇率。 | |
396 | 390 | packetTotalPrice = packetTotalPrice.add(new BigDecimal(profitAnalysisDO.getPacketTotalPrice()).multiply(exchangeRate)); |
397 | 391 | } |
398 | 392 | |
... | ... | @@ -433,39 +427,45 @@ public class CalculateProfitServiceImpl { |
433 | 427 | BigDecimal totalProfitPrice = developProfit.add(actualRatioProfitPrice).add(packetProfitPrice); |
434 | 428 | BusinessProfitRatioResultVO resultVO = new BusinessProfitRatioResultVO(); |
435 | 429 | BeanUtils.copyProperties(queryVO, resultVO); |
436 | - //5 | |
430 | + //5 客户总金额 | |
437 | 431 | resultVO.setCustomerTotalPrice(customerRmbTotalPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); |
438 | - //6 | |
432 | + //6 生产科总价 | |
439 | 433 | resultVO.setProductionDepartmentTotalPrice(productionDepartmentTotalPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); |
440 | 434 | // resultVO.setPacketTotalPrice(packetTotalPrice.multiply(new BigDecimal(10 )).doubleValue()); |
441 | - //7 | |
435 | + //7 包装费用合计金额 | |
442 | 436 | resultVO.setPacketTotalPrice(packetTotalPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); |
437 | + // 14 包装费用合计 与包装费用合计金额都是一个值。 | |
443 | 438 | resultVO.setPacketTotalPriceCount(packetTotalPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); |
444 | - //9 如果没有配置固定成本,就会得到0。 | |
439 | + //9 如果没有配置固定成本,就会得到0。 固定成本计算¥:开发持续时间*日固定成本(日固定成本需要从系统配置读取) | |
445 | 440 | resultVO.setFixCost(fixCost.setScale(2, BigDecimal.ROUND_HALF_UP)); |
446 | - //10.1 | |
441 | + //10.1 西班牙团队提成比例:订单总金额*配置比例。 | |
447 | 442 | resultVO.setSpainRatioProfitPrice(spainRatioProfitPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); |
448 | - //10.2 | |
443 | + //10.2 中国团队提成比例:订单总金额*配置比例。 | |
449 | 444 | resultVO.setChinaRatioProfitPrice(chinaRatioProfitPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); |
450 | - //11 | |
445 | + //11 支出合计计算¥:生产科总金额+包装费用总金额+研发开发费+复制费用+固定成本+西班牙提成+中国团队提成 | |
451 | 446 | resultVO.setOutTotalPrice(outTotalPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); |
452 | - //13 | |
447 | + //13 研发贸易净利润¥: 客户金额合计-支出合计(正数黑色字体、负数红色字体并加上-号) | |
453 | 448 | resultVO.setDevelopProfit(developProfit.setScale(2, BigDecimal.ROUND_HALF_UP)); |
454 | - //18 | |
449 | + //18 包装费用收益计算¥:包装费用合计金额-包装费用实际金额 | |
455 | 450 | resultVO.setPacketProfitPrice(packetProfitPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); |
456 | - //19 | |
451 | + //19 汇率收益计算:实际汇率(财务手动输入)-固定汇率(取系统汇率)*客户金额合计(基础信息汇总) | |
457 | 452 | resultVO.setActualRatioProfitPrice(actualRatioProfitPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); |
458 | - //20 | |
453 | + //20 综合收益计算¥: 贸易研发净利润+包装费用收益+汇率收益。 | |
459 | 454 | resultVO.setTotalProfitPrice(totalProfitPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); |
460 | - // 16 | |
455 | + // 16 实际跟单单价:包装费用实际金额除订单数量。 | |
461 | 456 | resultVO.setActualRmbPrice(queryVO.getPacketActualTotalPrice().divide(new BigDecimal(sumCount), 2, BigDecimal.ROUND_HALF_UP)); |
457 | + // 17 实际跟单单价折算美金:实际跟单单价/汇率(6.2) | |
462 | 458 | resultVO.setActualPrice((resultVO.getActualRmbPrice().divide(exchangeRate,2, BigDecimal.ROUND_HALF_UP))); |
463 | 459 | resultVO.setOrderCount(sumCount); |
464 | - //12 | |
460 | + //12 毛利润计算:客户总价-生产科总价-包装费用总价。 | |
465 | 461 | resultVO.setGrossProfit(customerRmbTotalPrice.subtract(productionDepartmentTotalPrice).subtract(packetTotalPrice).setScale(2, BigDecimal.ROUND_HALF_UP)); |
462 | + // 项目号 | |
466 | 463 | resultVO.setProjectNo(String.join(",",projectList)); |
464 | + // 包装费用合计(美元) | |
467 | 465 | resultVO.setPacketTotalPriceUsd(packetTotalPrice.divide(exchangeRate, 2, RoundingMode.HALF_UP)); |
466 | + // 客户总金额(美元) | |
468 | 467 | resultVO.setCustomerTotalPriceUsd(customerTotalPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); |
468 | + //生产科总金额合计(美元) | |
469 | 469 | resultVO.setProductionDepartmentTotalPriceUsd(productionDepartmentTotalPrice.divide(exchangeRate, 2, RoundingMode.HALF_UP)); |
470 | 470 | return resultVO; |
471 | 471 | } |
... | ... | @@ -567,7 +567,7 @@ public class CalculateProfitServiceImpl { |
567 | 567 | .divide(queryVO.getProductionDepartmentPredictPrice(),4,BigDecimal.ROUND_HALF_UP); |
568 | 568 | } |
569 | 569 | } |
570 | - //如果大于1.05则就把内部生产提成变为0 | |
570 | + //需求要求:如果计算出来的预算占比大于1.05则就把内部生产提成变为0 | |
571 | 571 | if(predictRatio.compareTo(bigDecimal)>0){ |
572 | 572 | innerProduceTotalPrice=BigDecimal.ZERO; |
573 | 573 | } |
... | ... | @@ -579,22 +579,25 @@ public class CalculateProfitServiceImpl { |
579 | 579 | |
580 | 580 | InnerProfitRatioResultVO resultVO = new InnerProfitRatioResultVO(); |
581 | 581 | BeanUtils.copyProperties(queryVO, resultVO); |
582 | + //生产持续时间。 | |
582 | 583 | resultVO.setProjectDays(projectDays); |
584 | + //数量。 | |
583 | 585 | resultVO.setOrderCount(sumCount); |
586 | + //客户总价。 | |
584 | 587 | resultVO.setCustomerTotalPrice(customerTotalPrice.setScale(2, RoundingMode.HALF_UP).doubleValue()); |
585 | - // 5 | |
588 | + // 5 生产科总价合计 | |
586 | 589 | resultVO.setProductionDepartmentTotalPrice(productionDepartmentTotalPrice.setScale(2, RoundingMode.HALF_UP)); |
587 | - // 9 | |
590 | + // 9 内部生产固定成本:生产持续时间*固定陈本(配置) | |
588 | 591 | resultVO.setInnerProduceFixProfit(innerProduceFixProfit.setScale(2, RoundingMode.HALF_UP)); |
589 | - // 7.1 | |
592 | + // 7.1预算占比计算:实际发生费用/生产科预算金额。 | |
590 | 593 | resultVO.setPredictRatio(predictRatio.multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)); |
591 | - // 将计算结果乘以 100,并四舍五入到整数 | |
594 | + // 将计算结果乘以 100,并四舍五入到整数 预算占比与实际占比差:1-预算占比。 | |
592 | 595 | resultVO.setPredictAndActualRatio(predictAndActualRatio.multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)); |
593 | - // 8 | |
596 | + // 8 内部生产毛利润计算:生产科总价减去实际发生费用。 | |
594 | 597 | resultVO.setGrossProfit(grossProfit.setScale(2, RoundingMode.HALF_UP)); |
595 | - // 10 | |
598 | + // 10 内部生产提成计算:订单数量*生产提成单价 | |
596 | 599 | resultVO.setInnerProduceTotalPrice(innerProduceTotalPrice.setScale(2, RoundingMode.HALF_UP)); |
597 | - // 11 | |
600 | + // 11 内部生产净利润计算:生产科总价-实际发生费用-内部生产提成计算-内部生产固定成本。 | |
598 | 601 | resultVO.setInnerProduceTotalProfit(innerProduceTotalProfit.setScale(2, RoundingMode.HALF_UP)); |
599 | 602 | //项目号 |
600 | 603 | resultVO.setProjectNo(String.join(", ", projectNoSet)); | ... | ... |
src/main/java/com/order/erp/service/order/impl/InvoiceBillOrderServiceImpl.java
... | ... | @@ -573,13 +573,18 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap |
573 | 573 | createVO.setId(null); |
574 | 574 | } |
575 | 575 | |
576 | - validaBillOrder(createVO); | |
576 | + List<OrderBaseInfoDO> orderBaseInfoDOList = validaBillOrder(createVO); | |
577 | 577 | |
578 | 578 | InvoiceBillOrderDO invoiceBillOrderDO = buildInvoiceBillOrderDO(createVO); |
579 | 579 | |
580 | - boolean success= transactionHelper.run(() -> { | |
581 | - save(invoiceBillOrderDO); | |
580 | + List<OrderBaseInfoDO> containInvoiceOrderBaseInfoList=orderBaseInfoDOList.stream().map(x->{ | |
581 | + x.setInvoiceNo(createVO.getInvoiceNo()); | |
582 | + return x; | |
583 | + }).collect(Collectors.toList()); | |
582 | 584 | |
585 | + boolean success= transactionHelper.run(() -> { | |
586 | + save(invoiceBillOrderDO); | |
587 | + orderBaseInfoService.updateBatchById(containInvoiceOrderBaseInfoList); | |
583 | 588 | invoiceBillMappingService.saveBatch(buildInvoiceBillMappingDOS(createVO, invoiceBillOrderDO)); |
584 | 589 | return true; |
585 | 590 | }); |
... | ... | @@ -729,7 +734,7 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap |
729 | 734 | /** |
730 | 735 | * @param createVO |
731 | 736 | */ |
732 | - private void validaBillOrder(InvoiceBillCreateVO createVO) { | |
737 | + private List<OrderBaseInfoDO> validaBillOrder(InvoiceBillCreateVO createVO) { | |
733 | 738 | if (CollectionUtils.isEmpty(createVO.getOrderIds())) { |
734 | 739 | throw new BusinessException("请勾选订单!"); |
735 | 740 | } |
... | ... | @@ -781,6 +786,7 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap |
781 | 786 | if (CollectionUtils.isNotEmpty(invoiceBillMappingDOList)) { |
782 | 787 | throw new BusinessException("该勾选的订单已经绑定其他账单了!"); |
783 | 788 | } |
789 | + return orderBaseInfoDOList; | |
784 | 790 | } |
785 | 791 | |
786 | 792 | /** |
... | ... | @@ -951,6 +957,7 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap |
951 | 957 | */ |
952 | 958 | @Override |
953 | 959 | public ServerResult deleteById(InvoiceBillOrderQueryVO invoiceBillOrderQueryVO) { |
960 | + //其实是不能批量删除的,前端是一个一个删除按钮点击的,但是这里还是使用数组接受的。这里是传的一个id。 | |
954 | 961 | List<Long> ids = invoiceBillOrderQueryVO.getIds(); |
955 | 962 | if (CollUtil.isEmpty(ids)) { |
956 | 963 | return ServerResult.fail("ids 参数不能为空"); | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderFieldLockApplyServiceImpl.java
... | ... | @@ -441,36 +441,31 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
441 | 441 | queryWrapper.eq(Objects.nonNull(queryVO.getType()), OrderFieldLockApplyDO::getType, queryVO.getType()); |
442 | 442 | } |
443 | 443 | } |
444 | - /* //只针对于应收款的过滤信息。这两个搜索框只会在应收款和应付款中进行展示。 还没有测试行不行。 | |
445 | - if (StringUtils.isNotBlank(queryVO.getInvoiceNo())) { | |
446 | - String invoiceNos = queryVO.getInvoiceNo(); | |
447 | - // 防止空值或分割后的数组为空 | |
448 | - if (invoiceNos != null && !invoiceNos.trim().isEmpty()) { | |
449 | - String[] invoiceNoArray = invoiceNos.split(","); | |
450 | - // 确保数组不为空并过滤空白元素 | |
451 | - String condition = Arrays.stream(invoiceNoArray) | |
452 | - .filter(StringUtils::isNotBlank) // 过滤掉空白字符串 | |
453 | - .map(val -> "'" + val.trim() + "'") // 去掉多余空格并加单引号 | |
454 | - .collect(Collectors.joining(",")); | |
455 | - if (!condition.isEmpty()) { // 防止最终拼接的条件为空 | |
456 | - queryWrapper.apply("JSON_UNQUOTE(JSON_EXTRACT(fields, '$.invoiceNo')) IN (" + condition + ")"); | |
457 | - } | |
444 | + // 已测试,没问题。用途:在应收款和应付款中,通过输入invoiceNo和checkNo进行筛选查询。 变量名为invoice和checkNo。 | |
445 | + /* if (StringUtils.isNotBlank(queryVO.getInvoiceNo())) { | |
446 | + // 获取并修整 invoiceNo 字符串 | |
447 | + String invoiceNos = queryVO.getInvoiceNo().trim(); | |
448 | + // 检查处理后的字符串是否仍然有效 | |
449 | + if (!invoiceNos.isEmpty()) { | |
450 | + // 使用参数化查询避免 SQL 拼接问题 | |
451 | + queryWrapper.apply( | |
452 | + "JSON_UNQUOTE(JSON_EXTRACT(fields, '$.invoiceBillOrderDO.invoiceNo')) = {0}", | |
453 | + invoiceNos | |
454 | + ); | |
458 | 455 | } |
459 | 456 | } |
460 | -//只针对于应付款的过滤信息。 | |
457 | + | |
458 | +//只针对于应付款的过滤信息。 前端要设置搜索框的变量为checkNo。 | |
461 | 459 | if (StringUtils.isNotBlank(queryVO.getCheckNo())) { |
462 | - String checkNos = queryVO.getCheckNo(); | |
463 | - // 防止空值或分割后的数组为空 | |
464 | - if (checkNos != null && !checkNos.trim().isEmpty()) { | |
465 | - String[] checkNoArray = checkNos.split(","); | |
466 | - // 确保数组不为空并过滤空白元素 | |
467 | - String condition = Arrays.stream(checkNoArray) | |
468 | - .filter(StringUtils::isNotBlank) // 过滤掉空白字符串 | |
469 | - .map(val -> "'" + val.trim() + "'") // 去掉多余空格并加单引号 | |
470 | - .collect(Collectors.joining(",")); | |
471 | - if (!condition.isEmpty()) { // 防止最终拼接的条件为空 | |
472 | - queryWrapper.apply("JSON_UNQUOTE(JSON_EXTRACT(fields, '$.invoiceNo')) IN (" + condition + ")"); | |
473 | - } | |
460 | + // 获取并修整 checkNo字符串 | |
461 | + String checkNos = queryVO.getCheckNo().trim(); | |
462 | + // 检查处理后的字符串是否仍然有效 | |
463 | + if (!checkNos.isEmpty()) { | |
464 | + // 使用参数化查询避免 SQL 拼接问题 | |
465 | + queryWrapper.apply( | |
466 | + "JSON_UNQUOTE(JSON_EXTRACT(fields, '$.checkBillOrderDO.checkNo')) = {0}", | |
467 | + checkNos | |
468 | + ); | |
474 | 469 | } |
475 | 470 | }*/ |
476 | 471 | //由于不懂下面的代码,所以我只对我需要的需求进行判断,我只针对我需要的这种情况,其他情况下就不走这种情况。 | ... | ... |
src/main/java/com/order/erp/service/order/impl/ProducePaymentCheckBillOrderServiceImpl.java
... | ... | @@ -533,13 +533,17 @@ public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<Produce |
533 | 533 | if (Objects.nonNull(createVO.getId())) { |
534 | 534 | createVO.setId(null); |
535 | 535 | } |
536 | - validaBillOrder(createVO); | |
536 | + List<OrderBaseInfoDO> orderBaseInfoDOList = validaBillOrder(createVO); | |
537 | 537 | |
538 | 538 | ProducePaymentCheckBillOrderDO checkBillOrderDO = buildCheckBillOrderDO(createVO); |
539 | + List<OrderBaseInfoDO> containCheckOrderBaseInfoList = orderBaseInfoDOList.stream().map(x -> { | |
540 | + x.setCheckNo(createVO.getCheckNo()); | |
541 | + return x; | |
542 | + }).collect(Collectors.toList()); | |
539 | 543 | |
540 | 544 | Boolean success = transactionHelper.run(() -> { |
541 | 545 | save(checkBillOrderDO); |
542 | - | |
546 | + orderBaseInfoService.updateBatchById(containCheckOrderBaseInfoList); | |
543 | 547 | checkBillMappingService.saveBatch(buildCheckBillMappingDOS(createVO, checkBillOrderDO)); |
544 | 548 | return true; |
545 | 549 | }); |
... | ... | @@ -693,7 +697,7 @@ public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<Produce |
693 | 697 | /** |
694 | 698 | * @param createVO |
695 | 699 | */ |
696 | - private void validaBillOrder(ProducePaymentCheckBillCreateVO createVO) { | |
700 | + private List<OrderBaseInfoDO> validaBillOrder(ProducePaymentCheckBillCreateVO createVO) { | |
697 | 701 | if (CollectionUtils.isEmpty(createVO.getOrderIds())) { |
698 | 702 | throw new BusinessException("请勾选订单!"); |
699 | 703 | } |
... | ... | @@ -753,6 +757,7 @@ public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<Produce |
753 | 757 | throw new BusinessException("勾选订单的生产科不一致!"); |
754 | 758 | } |
755 | 759 | } |
760 | + return orderBaseInfoDOList; | |
756 | 761 | } |
757 | 762 | |
758 | 763 | /** | ... | ... |