Explorar o código

2024年1月18日17:48:18

纪新园 hai 1 ano
pai
achega
231591d610

+ 3 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/export/ExportOrderController.java

@@ -1351,6 +1351,9 @@ public class ExportOrderController extends BladeController {
 			.and(i -> i.apply("storage_quantity > purchase_quantity").or()
 				.apply("storage_quantity_pj > purchase_quantity_pj"))
 			.orderByDesc(Order::getCreateTime);//销售数量大于采购数量
+		if (!AuthUtil.getUserRole().contains("admin")) {
+			lambdaQueryWrapper.eq(Order::getBuyerId, AuthUtil.getUserId());
+		}
 		List<Order> orderList = orderService.list(lambdaQueryWrapper);
 		return R.data(orderList);
 	}

+ 14 - 10
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderServiceImpl.java

@@ -5954,6 +5954,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 		} else {
 			throw new RuntimeException("生成失败,未查到单据信息");
 		}
+		order_.setBuyerId(order.getBuyerId());
+		order_.setBuyerId(order.getBuyerId());
 		order_.setBillType("CG");
 		order_.setOrderItemsList(orderItemsListAll);
 		return R.data(order_);
@@ -8536,22 +8538,24 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 		List<OrderFees> orderFeesList = orderFeesService.list(new LambdaQueryWrapper<OrderFees>()
 			.eq(OrderFees::getIsDeleted, 0)
 			.eq(OrderFees::getTenantId, AuthUtil.getTenantId())
-			.eq(OrderFees::getFeesType, 1)
 			.eq(OrderFees::getPid, order.getId()));
 		if (CollectionUtils.isNotEmpty(orderFeesList)) {
-			BigDecimal amountCny = orderFeesList.stream().filter(e -> "CNY".equals(e.getCurrency())).map(OrderFees::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-			BigDecimal amountUsd = orderFeesList.stream().filter(e -> "USD".equals(e.getCurrency())).map(OrderFees::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+//			BigDecimal amountCnyC = orderFeesList.stream().filter(e -> "CNY".equals(e.getCurrency()) && 2 == e.getFeesType()).map(OrderFees::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+//			BigDecimal amountUsdC = orderFeesList.stream().filter(e -> "USD".equals(e.getCurrency()) && 2 == e.getFeesType()).map(OrderFees::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+			BigDecimal amountCnyD = orderFeesList.stream().filter(e -> "CNY".equals(e.getCurrency()) && 1 == e.getFeesType()).map(OrderFees::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+			BigDecimal amountUsdD = orderFeesList.stream().filter(e -> "USD".equals(e.getCurrency()) && 1 == e.getFeesType()).map(OrderFees::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
 			if ("CNY".equals(order.getCurrency())) {
-				amountUsd = amountUsd.multiply(order.getExchangeRate());
-				amount = amount.add(amountCny).add(amountUsd);
+//				amountUsdC = amountUsdC.multiply(order.getExchangeRate());
+				amountUsdD = amountUsdD.multiply(order.getExchangeRate());
+//				amount = amount.add(amountCnyD).add(amountUsdD).subtract(amountCnyC).subtract(amountUsdC);
+				amount = amount.add(amountCnyD).add(amountUsdD);
 			} else {
-				amountCny = amountCny.divide(order.getExchangeRate(), 2, BigDecimal.ROUND_HALF_UP);
-				amount = amount.add(amountUsd).add(amountCny);
+//				amountCnyC = amountCnyC.divide(order.getExchangeRate(), 2, BigDecimal.ROUND_HALF_UP);
+				amountCnyD = amountCnyD.divide(order.getExchangeRate(), 2, BigDecimal.ROUND_HALF_UP);
+//				amount = amount.add(amountCnyD).add(amountUsdD).subtract(amountCnyC).subtract(amountUsdC);
+				amount = amount.add(amountCnyD).add(amountUsdD);
 			}
 		}
-		if (order.getThisUsedProfit() != null) {
-			amount = amount.subtract(order.getThisUsedProfit());
-		}
 		price = amount;
 		Items items = new Items();
 		items.setBelongToCorpId(order.getBelongToCorpId());