package com.xiaopeng.order.controller;
|
|
|
import com.xiaopeng.api.model.order.XpOrder;
|
import com.xiaopeng.api.model.order.XpOrderWaypoint;
|
import com.xiaopeng.common.core.domain.R;
|
import com.xiaopeng.order.service.IXpOrderService;
|
import com.xiaopeng.order.service.IXpOrderWaypointService;
|
import com.xiaopeng.unifiedverification.interceptor.XpClientCheck;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.context.annotation.Lazy;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.annotation.Resource;
|
|
@RestController
|
@Api(tags = "订单途经点")
|
@RequiredArgsConstructor(onConstructor_ = @Lazy)
|
public class XpOrderWaypointController {
|
|
|
@Resource
|
private final IXpOrderWaypointService xpOrderWaypointService;
|
private final IXpOrderService xpOrderService;
|
|
/**
|
* 添加订单途径点
|
*/
|
@PostMapping("/api/v1/mini-program/orderWaypoint/save")
|
@ApiOperation(value = "添加订单途径点", tags = {"小程序-添加订单途径点"})
|
@XpClientCheck(checkToken = false, checkOtpToken = true)
|
public R save(@Validated @RequestBody XpOrderWaypoint entity) {
|
XpOrder xpOrder = xpOrderService.getById(entity.getOrderId());
|
if(xpOrder == null){
|
return R.fail("订单不存在");
|
}
|
entity.setId(null);
|
boolean b = xpOrderWaypointService.save(entity);
|
if(b){
|
return R.ok();
|
}
|
return R.fail("订单不存在");
|
}
|
|
|
}
|