彭雪彬
2025-07-14 eb77373d92f01e51b98bda8fae66315ed9a4394d
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package com.oying.modules.rider.rest;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.oying.modules.rider.domain.*;
import com.oying.modules.rider.domain.dto.RiderIncomeDetailQueryCriteria;
import com.oying.modules.rider.domain.dto.RiderOrderRecordQueryCriteria;
import com.oying.modules.rider.domain.dto.RiderWithdrawalRecordQueryCriteria;
import com.oying.modules.rider.service.*;
import com.oying.modules.rider.utils.Constants;
import com.oying.utils.PageResult;
import com.oying.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
 
 
/**
 * @author pxb
 * @date 2025-06-18
 **/
@RestController
@RequiredArgsConstructor
@Api(tags = "骑手小程序:骑手微信小程序接口")
@RequestMapping("/api/wx/rider")
public class WxRiderController {
 
    private final RiderIncomeDetailService riderIncomeDetailService;
 
    private final RiderWalletInfoService riderWalletInfoService;
 
    private final RiderWithdrawalRecordService riderWithdrawalRecordService;
 
    private final RiderInfoService riderInfoService;
 
    private final RiderOrderRecordService riderOrderRecordService;
 
 
    @GetMapping("getRiderSourceInfo/{riderId}")
    @ApiOperation("查询第三方数据骑手信息")
    @PreAuthorize("@el.check('riderInfo:list')")
    public ResponseEntity<?> getRiderSourceInfo(@PathVariable String riderId) {
        RiderInfo riderInfo = riderInfoService.getRiderSourceInfo(riderId);
        return ResponseEntity.ok(R.success(riderInfo));
    }
 
    @GetMapping("syncRiderSourceInfo/{sourcePlatform}")
    @ApiOperation("同步查询第三方骑手信息 LY")
    @PreAuthorize("@el.check('riderInfo:edit')")
    public ResponseEntity<?> syncRiderSourceInfo(@PathVariable String sourcePlatform) {
        riderInfoService.syncRiderSourceInfo(sourcePlatform);
        return ResponseEntity.ok(R.success());
    }
 
    @GetMapping("getRiderWalletInfo/{riderId}")
    @ApiOperation("查询骑手钱包信息")
    @PreAuthorize("@el.check('riderWalletInfo:list')")
    public ResponseEntity<?> getRiderWalletInfo(@PathVariable String riderId) {
        RiderWalletInfo riderWalletInfo = riderWalletInfoService.getRiderWalletInfo(riderId);
        return ResponseEntity.ok(R.success(riderWalletInfo));
    }
 
    @GetMapping("getRiderIncomeDetail")
    @ApiOperation("查询骑手订单收入明细分页")
    @PreAuthorize("@el.check('riderIncomeDetail:list')")
    public ResponseEntity<?> getRiderIncomeDetail(RiderIncomeDetailQueryCriteria criteria) {
        Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
        PageResult<RiderIncomeDetail> riderIncomeDetails = riderIncomeDetailService.queryAll(criteria, page);
        return ResponseEntity.ok(R.success(riderIncomeDetails));
    }
 
    @GetMapping("getRiderWithdrawalRecord")
    @ApiOperation("查询骑手提现记录分页")
    @PreAuthorize("@el.check('riderWithdrawalRecord:list')")
    public ResponseEntity<?> getRiderWithdrawalRecord(RiderWithdrawalRecordQueryCriteria criteria) {
        Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
        PageResult<RiderWithdrawalRecord> riderIncomeDetails = riderWithdrawalRecordService.queryAll(criteria, page);
        return ResponseEntity.ok(R.success(riderIncomeDetails));
    }
 
    @GetMapping("getRiderOrderRecord")
    @ApiOperation("查询骑手订单记录分页")
    @PreAuthorize("@el.check('riderOrderRecord:list')")
    public ResponseEntity<?> getRiderOrderRecord(RiderOrderRecordQueryCriteria criteria) {
        Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
        PageResult<RiderOrderRecord> riderOrderRecordPageResult = riderOrderRecordService.queryAll(criteria, page);
        return ResponseEntity.ok(R.success(riderOrderRecordPageResult));
    }
 
 
    @GetMapping("riderGrabOrder/{orderNum}")
    @ApiOperation("骑手接单")
    @PreAuthorize("@el.check('riderOrderRecord:list')")
    public ResponseEntity<?> riderGrabOrder(@PathVariable String orderNum) {
        // 订单号不能为空
        if (orderNum == null || orderNum.equals("")) {
            return ResponseEntity.ok(R.fail(Constants.HTTP_CODE_FAIL, "订单号不能为空"));
        }
        R result = riderOrderRecordService.riderGrabOrder(orderNum);
        return ResponseEntity.ok(result);
    }
 
    @GetMapping("riderCancelOrder/{orderNum}")
    @ApiOperation("骑手取消接单")
    @PreAuthorize("@el.check('riderOrderRecord:list')")
    public ResponseEntity<?> riderCancelOrder(@PathVariable String orderNum) {
        // 订单号不能为空
        if (orderNum == null || orderNum.equals("")) {
            return ResponseEntity.ok(R.fail(Constants.HTTP_CODE_FAIL, "订单号不能为空"));
        }
        R result = riderOrderRecordService.riderCancelOrder(orderNum);
        return ResponseEntity.ok(R.success(result));
    }
 
}