|
@@ -26,6 +26,7 @@ import com.yami.shop.dao.PointsRecordMapper;
|
|
import com.yami.shop.security.api.util.SecurityUtils;
|
|
import com.yami.shop.security.api.util.SecurityUtils;
|
|
import com.yami.shop.service.*;
|
|
import com.yami.shop.service.*;
|
|
import com.yami.shop.service.hb.IHBOrderService;
|
|
import com.yami.shop.service.hb.IHBOrderService;
|
|
|
|
+import com.yami.shop.utils.CullenUtils;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -67,6 +68,8 @@ public class OrderController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private IHBOrderService hbOrderService;
|
|
private IHBOrderService hbOrderService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private UserService userService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 生成订单
|
|
* 生成订单
|
|
@@ -74,6 +77,13 @@ public class OrderController {
|
|
@PostMapping("/confirm")
|
|
@PostMapping("/confirm")
|
|
@ApiOperation(value = "结算,生成订单信息", notes = "传入下单所需要的参数进行下单")
|
|
@ApiOperation(value = "结算,生成订单信息", notes = "传入下单所需要的参数进行下单")
|
|
public ResponseEntity<ShopCartOrderMergerDto> confirm(@Valid @RequestBody OrderParam orderParam) {
|
|
public ResponseEntity<ShopCartOrderMergerDto> confirm(@Valid @RequestBody OrderParam orderParam) {
|
|
|
|
+ String userId = SecurityUtils.getUser().getUserId();
|
|
|
|
+ User user = userService.getById(userId);
|
|
|
|
+ if (user==null){
|
|
|
|
+ throw new GlobalException("用户信息不存在...");
|
|
|
|
+ }
|
|
|
|
+ CullenUtils.validateDataThrowException(user.getChannelId()==null,"不支持非企业用户购买...");
|
|
|
|
+
|
|
if (orderParam.getOrderItem() == null) {
|
|
if (orderParam.getOrderItem() == null) {
|
|
orderParam.getBasketIds().forEach(basketId -> {
|
|
orderParam.getBasketIds().forEach(basketId -> {
|
|
Basket byId = basketService.getById(basketId);
|
|
Basket byId = basketService.getById(basketId);
|
|
@@ -95,7 +105,7 @@ public class OrderController {
|
|
throw new GlobalException("当前选择的规格库存不足!");
|
|
throw new GlobalException("当前选择的规格库存不足!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- String userId = SecurityUtils.getUser().getUserId();
|
|
|
|
|
|
+
|
|
// orderParam.setDvyType(1);
|
|
// orderParam.setDvyType(1);
|
|
|
|
|
|
// 订单的地址信息
|
|
// 订单的地址信息
|