liujie
2023-04-06 30cb1d32796a1b482d44bd424fdfe28c26b87be9
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
package com.stylefeng.guns.modular.system.controller;
 
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.service.ITPriceService;
import com.stylefeng.guns.modular.system.utils.tips.ErrorTip;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.ITOrderService;
import com.stylefeng.guns.modular.system.utils.tips.SuccessTip;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.cache.CacheProperties;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
 
@Controller
@Api(tags = "财务信息")
@RequestMapping("/api/tFinance")
public class FinanceController {
 
 
    @Autowired
    private ITOrderService orderService;
 
 
    @ApiOperation(value = "卡车公司-应收报表列表",notes="卡车公司-应收报表列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "time", value = "时间 (时间 - 时间)", required = false, dataType = "String"),
            @ApiImplicitParam(name = "name", value = "名称", required = false, dataType = "String"),
    })
    @PostMapping(value = "/list")
    @ResponseBody
    public Object list(int pageNumber,int pageSize,String time,String name) {
        Page<ReceivableVo> receivableVoPage = new Page<>(pageNumber, pageSize);
        return new SuccessTip(orderService.getReceivable(receivableVoPage,time,name));
    }
 
 
    @ApiOperation(value = "应付报表列表",notes="应付报表列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "time", value = "时间 (时间 - 时间)", required = false, dataType = "String"),
            @ApiImplicitParam(name = "name", value = "名称", required = false, dataType = "String"),
    })
    @PostMapping(value = "/payList")
    @ResponseBody
    public Object payList(int pageNumber,int pageSize,String time,String name) {
        Page<ShouldPayVo> receivableVoPage = new Page<>(pageNumber, pageSize);
 
        return new SuccessTip(orderService.getPayList(receivableVoPage,time,name));
    }
 
    @ApiOperation(value = "应收款票据列表",notes="应收款票据列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "time", value = "时间 (时间 - 时间)", required = false, dataType = "String"),
            @ApiImplicitParam(name = "name", value = "名称", required = false, dataType = "String"),
            @ApiImplicitParam(name = "invoicesId", value = "invoicesId", required = false, dataType = "Integer"),
            @ApiImplicitParam(name = "orderId", value = "orderId", required = false, dataType = "Integer"),
            @ApiImplicitParam(name = "state", value = "1未支付完 2已支付", required = false, dataType = "Integer"),
    })
    @PostMapping(value = "/listOfReceivables")
    @ResponseBody
    public Object listOfReceivables(int pageNumber,int pageSize,String time,String name,Integer invoicesId,Integer orderId,Integer state) {
        Page<ReceivablesList> receivableVoPage = new Page<>(pageNumber, pageSize);
        List<ReceivablesList> receivablesLists = orderService.listOfReceivables(receivableVoPage, time, name, invoicesId, orderId, state);
        receivableVoPage.setRecords(receivablesLists);
        return new SuccessTip(receivableVoPage);
    }
 
    @ApiOperation(value = "应收款票据详情",notes="应收款票据详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(name = "number", value = "订单id", required = true, dataType = "Long"),
    })
    @GetMapping(value = "/listOfReceivablesInfo")
    @ResponseBody
    public Object listOfReceivablesInfo(Long number) {
        return new SuccessTip(orderService.listOfReceivablesInfoOne(number));
    }
 
    @ApiOperation(value = "应收款票据详情--编辑",notes="应收款票据详情--编辑")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(name = "number", value = "订单id", required = true, dataType = "Long"),
    })
    @GetMapping(value = "/listOfReceivablesInfoUpdate")
    @ResponseBody
    public Object listOfReceivablesInfoUpdate(Long number) {
        return new SuccessTip(orderService.listOfReceivablesInfo(number));
    }
 
    @Resource
    private ITPriceService priceService;
 
    @ApiOperation(value = "应收款票据详情--添加价格",notes="应收款票据详情--添加价格")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(name = "number", value = "订单id", required = true, dataType = "Long"),
            @ApiImplicitParam(name = "type", value = "价格类型名称", required = true, dataType = "String"),
            @ApiImplicitParam(name = "price", value = "价格", required = true, dataType = "Double"),
    })
    @GetMapping(value = "/addPrice")
    @ResponseBody
    public Object addPrice(Long number,String type,Double price) {
        TPrice tPrice = new TPrice();
        tPrice.setOrderId(number);
        tPrice.setType(type);
        BigDecimal bigDecimal = new BigDecimal(price);
        tPrice.setPrice(bigDecimal);
        tPrice.setCarPrice(bigDecimal);
        tPrice.setCreateTime(new Date());
        tPrice.setState("1");
        try {
            priceService.insert(tPrice);
            return new SuccessTip();
        }catch (Exception e){
            e.printStackTrace();
        }
       return new ErrorTip(500,"ERROR");
    }
 
    @ApiOperation(value = "应收款票据详情--编辑价格",notes="应收款票据详情--编辑价格")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(name = "id", value = "价格id", required = true, dataType = "int"),
            @ApiImplicitParam(name = "type", value = "价格类型名称", required = false, dataType = "String"),
            @ApiImplicitParam(name = "price", value = "价格", required = false, dataType = "Double"),
    })
    @GetMapping(value = "/updatePrice")
    @ResponseBody
    public Object updatePrice(int id,String type,Double price) {
        TPrice tPrice = priceService.selectById(id);
        if(ToolUtil.isNotEmpty(type)){
            tPrice.setType(type);
        }
        if(ToolUtil.isNotEmpty(price)){
            BigDecimal bigDecimal = new BigDecimal(price);
            tPrice.setPrice(bigDecimal);
            tPrice.setCarPrice(bigDecimal);
        }
        try {
            priceService.updateById(tPrice);
            return new SuccessTip();
        }catch (Exception e){
            e.printStackTrace();
        }
        return new ErrorTip(500,"ERROR");
    }
 
    @ApiOperation(value = "应收款票据详情--删除价格",notes="应收款票据详情--删除价格")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(name = "id", value = "价格id", required = true, dataType = "int"),
    })
    @GetMapping(value = "/delPrice")
    @ResponseBody
    public Object delPrice(int id) {
        try {
            priceService.deleteById(id);
            return new SuccessTip();
        }catch (Exception e){
            e.printStackTrace();
        }
        return new ErrorTip(500,"ERROR");
    }
 
    @ApiOperation(value = "应付款票据列表",notes="应付款票据列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "time", value = "时间 (时间 - 时间)", required = false, dataType = "String"),
            @ApiImplicitParam(name = "name", value = "名称", required = false, dataType = "String"),
            @ApiImplicitParam(name = "billId", value = "billId", required = false, dataType = "Integer"),
            @ApiImplicitParam(name = "orderId", value = "orderId", required = false, dataType = "Integer"),
            @ApiImplicitParam(name = "state", value = "1未支付完 2已支付", required = false, dataType = "Integer"),
    })
    @GetMapping(value = "/listOfPay")
    @ResponseBody
    public Object listOfPay(int pageNumber,int pageSize,String time,String name,Integer billId,Integer orderId,Integer state) {
        Page<PayList> receivableVoPage = new Page<>(pageNumber, pageSize);
        List<PayList> payLists = orderService.listOfPay(receivableVoPage, time, name, billId, orderId, state);
        receivableVoPage.setRecords(payLists);
        return new SuccessTip(receivableVoPage);
    }
 
    @ApiOperation(value = "应付款票据详情",notes="应付款票据详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(name = "number", value = "订单id", required = true, dataType = "Long"),
    })
    @GetMapping(value = "/listOPayInfo")
    @ResponseBody
    public Object listOPayInfo(Long number) {
        return new SuccessTip(orderService.listOPayInfo(number));
    }
 
    @ApiOperation(value = "应收款票据-Receive a payment",notes="应收款票据-Receive a payment")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(name = "number", value = "票据号", required = true, dataType = "String"),
    })
    @GetMapping(value = "/receivePayment")
    @ResponseBody
    public Object receivePayment(@RequestParam String number) {
        TOrder tOrder = orderService.selectOne(new EntityWrapper<TOrder>().eq("invoice_number", number).eq("status", 1));
        tOrder.setPayStatus(1);
        tOrder.setSuccessTime(new Date());
        boolean b = orderService.updateById(tOrder);
 
        return new SuccessTip();
    }
 
 
//        @ApiOperation(value = "是否同意付款卡车公司",notes="是否同意付款卡车公司")
//        @ApiImplicitParams({
//                @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
//        })
//        @PostMapping(value = "/agreeOfPayment")
//        @ResponseBody
//        public Object confirmationOfPayment(@RequestBody PaymentReq req) {
//            return new SuccessTip(orderService.confirmationOfPayment(req
//                    .getNumber(),req.getType(),req.getRemark()));
//        }
 
 
//
//    @ApiOperation(value = "卡车公司付款确认",notes="卡车公司付款确认")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
//            @ApiImplicitParam(name = "number", value = "订单id", required = true, dataType = "Long"),
//    })
//    @GetMapping(value = "/confirmationOfPayment")
//    @ResponseBody
//    public Object confirmationOfPayment(@RequestParam Long number) {
//        return new SuccessTip(orderService.agreeOfPayment(number));
//    }
 
 
 
}