huminmin
6 天以前 d06ef3f44d6dc19dae223ab420165369ea13cc16
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
package com.ruoyi.purchase.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.purchase.dto.PaymentHistoryRecordVo;
import com.ruoyi.purchase.dto.PaymentLedgerDto;
import com.ruoyi.purchase.dto.PaymentRegistrationDto;
import com.ruoyi.purchase.pojo.PaymentRegistration;
import com.ruoyi.purchase.service.IPaymentRegistrationService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
 
import jakarta.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
 
/**
 * 付款登记Controller
 *
 * @author ruoyi
 * @date 2025-05-15
 */
@RestController
@RequestMapping("/purchase/paymentRegistration")
@AllArgsConstructor
public class PaymentRegistrationController extends BaseController {
    private IPaymentRegistrationService paymentRegistrationService;
 
    /**
     * 查询付款登记列表
     */
//    @PreAuthorize("@ss.hasPermi('system:registration:list')")
    @GetMapping("/list")
    public TableDataInfo list(PaymentRegistrationDto paymentRegistrationDto) {
        startPage();
        List<PaymentRegistrationDto> list = paymentRegistrationService.selectPaymentRegistrationList(paymentRegistrationDto);
        return getDataTable(list);
    }
 
    /**
     * 导出付款流水列表
     */
    @Log(title = "导出付款流水列表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PaymentRegistrationDto paymentRegistrationDto)
    {
        Page page = new Page<>(-1,-1);
        IPage<PaymentRegistrationDto> paymentRegistrationDtoIPage = paymentHistoryListPage(page, paymentRegistrationDto);
        ExcelUtil<PaymentRegistrationDto> util = new ExcelUtil<PaymentRegistrationDto>(PaymentRegistrationDto.class);
        util.exportExcel(response, paymentRegistrationDtoIPage.getRecords(), "导出付款流水列表");
    }
 
    /**
     * 获取付款登记详细信息
     */
    @GetMapping(value = "/{id}")
    public R<?> getInfo(@PathVariable("id") Long id) {
        return R.ok(paymentRegistrationService.selectPaymentRegistrationById(id));
    }
 
    /**
     * 新增付款登记
     */
    @Log(title = "付款登记", businessType = BusinessType.INSERT)
    @PostMapping
    @Transactional(rollbackFor = Exception.class)
    public R<?> add(@RequestBody List<PaymentRegistration>  paymentRegistration) {
        paymentRegistrationService.insertPaymentRegistration(paymentRegistration);
        return R.ok();
    }
 
    /**
     * 修改付款登记
     */
    @Log(title = "付款登记", businessType = BusinessType.UPDATE)
    @PutMapping
    @Transactional(rollbackFor = Exception.class)
    public R<?> edit(@RequestBody PaymentRegistration paymentRegistration) {
        paymentRegistrationService.updatePaymentRegistration(paymentRegistration);
        return R.ok();
    }
 
    /**
     * 删除付款登记
     */
    @Log(title = "付款登记", businessType = BusinessType.DELETE)
    @DeleteMapping("/del")
    public R<?> remove(@RequestBody Long[] ids) {
        paymentRegistrationService.deletePaymentRegistrationByIds(ids);
        return R.ok();
    }
 
    /**
     * 删除付款登记
     */
    @Log(title = "付款登记", businessType = BusinessType.DELETE)
    @DeleteMapping("/delete")
    public R<?> delete(@RequestBody Long[] ids) {
        paymentRegistrationService.delete(ids);
        return R.ok();
    }
 
    /**
     * 获取付款登记详细信息
     */
    @GetMapping(value = "/byPurchaseId/{id}")
    public R<?> getPurchaseInfo(@PathVariable("id") Long id) {
        return R.ok(paymentRegistrationService.selectPaymentRegistrationByPurchaseId(id));
    }
 
    /**
     * 获取付款登记详细信息
     */
    @GetMapping(value = "/paymentLedgerList")
    public R<?> paymentLedgerList(PaymentLedgerDto paymentLedgerDto, Page page,
                                        Integer detailPageNum,
                                        Integer detailPageSize) {
        IPage<Map<String, Object>> mapIPage = paymentRegistrationService.selectPaymentLedgerList(paymentLedgerDto, page, detailPageNum, detailPageSize);
        return R.ok(mapIPage);
    }
 
    /**
     * 供应商往来分页接口
     */
    @GetMapping("/supplierNameListPage")
    public R<?> supplierNameListPage(PaymentLedgerDto paymentLedgerDto, Page page){
        return R.ok(paymentRegistrationService.supplierNameListPage(page,paymentLedgerDto));
    }
 
    /**
     * 供应商往来分页接口
     */
    @GetMapping("/supplierNameListPageDetails")
    public R<?> supplierNameListPageDetails(PaymentLedgerDto paymentLedgerDto){
        return R.ok(paymentRegistrationService.supplierNameListPageDetails(paymentLedgerDto));
    }
 
    /**
     * 获取本月应付信息
     */
    @GetMapping(value = "/paymentMonthList")
    public R<?> paymentMonthList() {
        return R.ok(paymentRegistrationService.paymentMonthList());
    }
 
    /**
     * 查询付款登记列表
     *
     * @param paymentRegistrationDto 付款登记
     * @return 付款登记集合
     */
    @GetMapping("/paymentHistoryList")
    public TableDataInfo paymentHistoryList(PaymentRegistrationDto paymentRegistrationDto) {
        startPage();
        List<PaymentRegistrationDto> list = paymentRegistrationService.paymentHistoryList(paymentRegistrationDto);
        return getDataTable(list);
    }
 
    /**
     * 查询供应商往来记录
     * @param supplierId
     * @return
     */
    @GetMapping("/getPaymentRecordList/{supplierId}")
    public R<?> getPaymentRecordList(@PathVariable Long supplierId) {
        List<PaymentHistoryRecordVo> paymentRecordList = paymentRegistrationService.getPaymentRecordList(supplierId);
        return R.ok(paymentRecordList);
    }
 
    /**
     * 查询付款登记列表
     *
     * @param paymentRegistrationDto 付款登记
     * @return 付款登记集合
     */
    @GetMapping("/paymentHistoryListPage")
    public IPage<PaymentRegistrationDto> paymentHistoryListPage(Page page, PaymentRegistrationDto paymentRegistrationDto) {
        return paymentRegistrationService.paymentHistoryListPage(page,paymentRegistrationDto);
    }
}