puzhibing
2026-04-25 e3daeef349b6908a03749af2bfabb23f9ae4d658
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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("订单不存在");
    }
 
 
}