fix(文件中心):实现平台租户自动分配订单,实现抽成订单金额的功能

This commit is contained in:
2025-08-04 19:14:34 +08:00
parent 9141be16d7
commit ea388107f8
@@ -101,6 +101,9 @@ public class OrderController {
@Autowired
private WxPayConfigFactory wxPayConfigFactory;
@Autowired
private OrderTenantAllocationService orderTenantAllocationService;
/**
* 列表
@@ -213,11 +216,21 @@ public class OrderController {
if (qrCode.getStatus().equals(CommonStatus.UNABLE.getId())){
return Result.failed("该二维码已过期");
}
order.setTenantId(qrCode.getTenantId());
// 智能租户分配:根据用户ID和二维码ID确定租户
String determinedTenantId = orderTenantAllocationService.determineTenant(
user.getId().toString(), order.getCodeId());
order.setTenantId(determinedTenantId);
//设置订单所属tenantId
order.setTourismId(qrCode.getTourismId());
order.setDeviceSn(qrCode.getDeviceSn());
order.setOrderAmount(qrCode.getPrice());
// 更新订单计数(用于下次分配)
orderTenantAllocationService.incrementOrderCount(
user.getId().toString(), order.getCodeId());
}else {
Assert.notNull(qrCode,"二维码不存在");
}