xuhy
2025-01-07 e29bb239dc2a5d4d0eee765d870522ad877e03e4
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
118
119
120
121
122
123
package com.stylefeng.guns.modular.api;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.common.constant.factory.PageFactory;
import com.stylefeng.guns.modular.system.model.LoginLog;
import com.stylefeng.guns.modular.system.model.TWithdrawal;
import com.stylefeng.guns.modular.system.service.ICarService;
import com.stylefeng.guns.modular.system.service.IDriverService;
import com.stylefeng.guns.modular.system.service.ITWithdrawalService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.LogWarpper;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
 
/**
 * 车辆相关控制器
 */
@RestController
@RequestMapping("/api/withdrawal")
public class TWithdrawalController  extends BaseController {
 
    @Autowired
    private IDriverService driverService;
    @Autowired
    private ITWithdrawalService withdrawalService;
    /**
     * 司机提现
     * @return
     */
    @ResponseBody
    @PostMapping("/addWithdrawal")
    @ApiOperation(value = "司机提现", tags = {"司机端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "收款人姓名", name = "receivePaymentName", required = true, dataType = "String"),
            @ApiImplicitParam(value = "收款账号", name = "receivePaymentAccount", required = true, dataType = "String"),
            @ApiImplicitParam(value = "提现方式 1=支付宝 2=银行卡", name = "withdrawalType", required = true, dataType = "int"),
            @ApiImplicitParam(value = "开户行", name = "openBank", required = true, dataType = "String"),
            @ApiImplicitParam(value = "提现金额", name = "withdrawalMoney", required = true, dataType = "BigDecimal"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil addWithdrawal(String receivePaymentName, String receivePaymentAccount, Integer withdrawalType,
                                    String openBank, BigDecimal withdrawalMoney, HttpServletRequest request){
        try {
            Integer uid = driverService.getUserIdFormRedis(request);
            if(null == uid){
                return ResultUtil.tokenErr();
            }
            withdrawalService.addWithdrawal(receivePaymentName, receivePaymentAccount, withdrawalType, openBank, withdrawalMoney, uid);
            return ResultUtil.success();
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
    /**
     * 提现查看详情
     * @return
     */
    @ResponseBody
    @PostMapping("/queryDetailById")
    @ApiOperation(value = "提现查看详情", tags = {"司机端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "提现id", name = "id", required = true, dataType = "int"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil queryDetailById(Integer id,HttpServletRequest request){
        try {
            Integer uid = driverService.getUserIdFormRedis(request);
            if(null == uid){
                return ResultUtil.tokenErr();
            }
            TWithdrawal tWithdrawal = withdrawalService.selectById(id);
            return ResultUtil.success(tWithdrawal);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
    /**
     * 提现查看分页列表
     * @return
     */
    @ResponseBody
    @PostMapping("/queryList")
    @ApiOperation(value = "提现查看分页列表", tags = {"司机端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil queryList(Integer pageNum,Integer size,HttpServletRequest request){
        try {
            Integer uid = driverService.getUserIdFormRedis(request);
            if(null == uid){
                return ResultUtil.tokenErr();
            }
//            Page<TWithdrawal> page = new PageFactory<TWithdrawal>().defaultPage();
//            List<Map<String, Object>> result = withdrawalService.queryList(page, uid);
//            page.setRecords((List<TWithdrawal>) new LogWarpper(result).warp());
//            return super.packForBT(page);
            List<TWithdrawal> list = withdrawalService.selectList(new EntityWrapper<TWithdrawal>().eq("driverId", uid));
            return ResultUtil.success(list);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
}