Merge pull request 'feat: 创建订单接口排除中科低空待支付与排队中的订单状态检查' (#70) from feature_dzc into test
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/70
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.Result;
|
||||||
import com.central.common.model.SysUser;
|
import com.central.common.model.SysUser;
|
||||||
import com.central.log.annotation.AuditLog;
|
import com.central.log.annotation.AuditLog;
|
||||||
|
import com.central.order.config.FeipaiConfig;
|
||||||
import com.central.order.enums.CommonStatus;
|
import com.central.order.enums.CommonStatus;
|
||||||
import com.central.order.enums.OrderStatus;
|
import com.central.order.enums.OrderStatus;
|
||||||
import com.central.order.feign.DeviceCenterService;
|
import com.central.order.feign.DeviceCenterService;
|
||||||
@@ -116,6 +117,9 @@ public class OrderController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IWeatherRuleValidator weatherRuleValidator;
|
private IWeatherRuleValidator weatherRuleValidator;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FeipaiConfig feipaiConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
*/
|
*/
|
||||||
@@ -200,6 +204,9 @@ public class OrderController {
|
|||||||
return new PageResult<>();
|
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());
|
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());
|
QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
|
||||||
if (qrCode != null){
|
if (qrCode != null){
|
||||||
if (qrCode.getStatus().equals(CommonStatus.UNABLE.getId())){
|
if (qrCode.getStatus().equals(CommonStatus.UNABLE.getId())){
|
||||||
return Result.failed("该二维码已过期");
|
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确定租户
|
// 智能租户分配:根据二维码ID确定租户
|
||||||
String determinedTenantId = orderTenantAllocationService.determineTenant(
|
String determinedTenantId = orderTenantAllocationService.determineTenant(
|
||||||
qrCode.getCodeId(), qrCode.getTenantId());
|
qrCode.getCodeId(), qrCode.getTenantId());
|
||||||
@@ -243,7 +250,7 @@ public class OrderController {
|
|||||||
|
|
||||||
// 天气规则校验(强制校验,不通过则拒绝创建订单)
|
// 天气规则校验(强制校验,不通过则拒绝创建订单)
|
||||||
String deviceSn = qrCode.getDeviceSn();
|
String deviceSn = qrCode.getDeviceSn();
|
||||||
Long tourismId = qrCode.getTourismId();
|
|
||||||
String tenantId = determinedTenantId;
|
String tenantId = determinedTenantId;
|
||||||
|
|
||||||
if (deviceSn != null && !deviceSn.isEmpty()) {
|
if (deviceSn != null && !deviceSn.isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user