feat: 创建订单接口排除中科低空待支付与排队中的订单状态检查
This commit is contained in:
+15
-8
@@ -12,6 +12,7 @@ import com.central.common.model.PageResult;
|
||||
import com.central.common.model.Result;
|
||||
import com.central.common.model.SysUser;
|
||||
import com.central.log.annotation.AuditLog;
|
||||
import com.central.order.config.FeipaiConfig;
|
||||
import com.central.order.enums.CommonStatus;
|
||||
import com.central.order.enums.OrderStatus;
|
||||
import com.central.order.feign.DeviceCenterService;
|
||||
@@ -116,6 +117,9 @@ public class OrderController {
|
||||
@Autowired
|
||||
private IWeatherRuleValidator weatherRuleValidator;
|
||||
|
||||
@Autowired
|
||||
private FeipaiConfig feipaiConfig;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@@ -200,6 +204,9 @@ public class OrderController {
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
private boolean isFeipaiTourism(Long tourismId) {
|
||||
return feipaiConfig.getTourismIds() != null && feipaiConfig.getTourismIds().contains(tourismId);
|
||||
}
|
||||
|
||||
// 创建订单--》
|
||||
// 返回前端订单信息--》
|
||||
@@ -216,18 +223,18 @@ public class OrderController {
|
||||
|
||||
order.setUserId(user.getId());
|
||||
|
||||
|
||||
List<Order> userOrderList = orderService.getOrderCountByStatusAndUser(user.getId(),OrderStatus.PAID.getId(),OrderStatus.UNPAID.getId());
|
||||
if (!userOrderList.isEmpty()){
|
||||
return Result.failed("已存在订单,请前往订单页确认,请勿重复下单");
|
||||
}
|
||||
|
||||
QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
|
||||
if (qrCode != null){
|
||||
if (qrCode.getStatus().equals(CommonStatus.UNABLE.getId())){
|
||||
return Result.failed("该二维码已过期");
|
||||
}
|
||||
|
||||
Long tourismId = qrCode.getTourismId();
|
||||
if (!isFeipaiTourism(tourismId)) {
|
||||
List<Order> userOrderList = orderService.getOrderCountByStatusAndUser(user.getId(),OrderStatus.PAID.getId(),OrderStatus.UNPAID.getId());
|
||||
if (!userOrderList.isEmpty()){
|
||||
return Result.failed("已存在订单,请前往订单页确认,请勿重复下单");
|
||||
}
|
||||
}
|
||||
// 智能租户分配:根据二维码ID确定租户
|
||||
String determinedTenantId = orderTenantAllocationService.determineTenant(
|
||||
qrCode.getCodeId(), qrCode.getTenantId());
|
||||
@@ -243,7 +250,7 @@ public class OrderController {
|
||||
|
||||
// 天气规则校验(强制校验,不通过则拒绝创建订单)
|
||||
String deviceSn = qrCode.getDeviceSn();
|
||||
Long tourismId = qrCode.getTourismId();
|
||||
|
||||
String tenantId = determinedTenantId;
|
||||
|
||||
if (deviceSn != null && !deviceSn.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user