|
|
@@ -74,6 +74,13 @@ public class InvoiceServiceImpl extends MPJBaseServiceImpl<InvoiceMapper, Invoic
|
|
|
// orderDetails 获取申请开票的订单
|
|
|
var userId = StpUtil.getLoginIdAsLong();
|
|
|
var orders = chargeOrderService.getChargeOrdersBySeqs(params.getStartChargeSeqs());
|
|
|
+
|
|
|
+ // 校验未完结的订单 orderStatus = 0
|
|
|
+ if (orders.stream().anyMatch(o -> o.getOrderStatus().equals(ChargeOrder.ORDER_STATUS_未知))) {
|
|
|
+ log.error("存在未知状态的订单:{}", orders.stream().filter(o -> o.getOrderStatus().equals(ChargeOrder.ORDER_STATUS_未知)).map(ChargeOrder::getStartChargeSeq).toArray());
|
|
|
+ throw new BusinessException("请勿勾选未完结的订单");
|
|
|
+ }
|
|
|
+
|
|
|
// 校验订单是已开票或者开票中
|
|
|
var invoiced = orders.stream().filter(o -> o.getInvoiceStatus().equals(ChargeOrder.INVOICE_STATUS_开票中) || o.getInvoiceStatus().equals(ChargeOrder.INVOICE_STATUS_已开票)).toList();
|
|
|
if (!invoiced.isEmpty()) {
|
|
|
@@ -81,7 +88,6 @@ public class InvoiceServiceImpl extends MPJBaseServiceImpl<InvoiceMapper, Invoic
|
|
|
throw new BusinessException("存在已开票或开票中的订单");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
var orderDetails = orders.stream().map(item -> new InvoiceOrderDetail()
|
|
|
.setStartChargeSeq(item.getStartChargeSeq())
|
|
|
.setTotalPower(item.getTotalPower()).setTotalMoney(item.getTotalMoney())
|