renkang
2025-01-24 d3767d594de66cb5f9d1294931acefea1866f783
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
package com.doumee.cloud.admin;
 
import com.doumee.api.BaseController;
import com.doumee.config.annotation.CloudRequiredPermission;
import com.doumee.config.annotation.LoginNoRequired;
import com.doumee.core.annotation.excel.ExcelExporter;
import com.doumee.core.annotation.pr.PreventRepeat;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
import com.doumee.dao.business.dto.YwSmsEmailBillCallDTO;
import com.doumee.dao.business.model.YwContractBill;
import com.doumee.dao.business.vo.YwContractBillCallDataVO;
import com.doumee.dao.business.vo.YwContractBillDataVO;
import com.doumee.service.business.YwContractBillService;
import com.doumee.service.business.impl.SmsEmailServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
 
/**
 * @author 江蹄蹄
 * @date 2024/11/19 16:07
 */
@Api(tags = "运维合同账单信息表")
@RestController
@RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/ywContractBill")
public class YwContractBillCloudController extends BaseController {
 
    @Autowired
    private YwContractBillService ywContractBillService;
 
    @Autowired
    private SmsEmailServiceImpl smsEmailService;
 
    @PreventRepeat
    @ApiOperation("新建")
    @PostMapping("/create")
    @CloudRequiredPermission("business:ywcontractbill:create")
    public ApiResponse create(@RequestBody YwContractBill ywContractBill,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywContractBill.setLoginUserInfo(this.getLoginUser(token));
        return ApiResponse.success(ywContractBillService.create(ywContractBill));
    }
 
    @ApiOperation("根据ID删除")
    @GetMapping("/delete/{id}")
    @CloudRequiredPermission("business:ywcontractbill:delete")
    public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywContractBillService.deleteById(id,this.getLoginUser(token));
        return ApiResponse.success(null);
    }
 
    @ApiOperation("批量删除")
    @GetMapping("/delete/batch")
    @CloudRequiredPermission("business:ywcontractbill:delete")
    public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        String [] idArray = ids.split(",");
        List<Integer> idList = new ArrayList<>();
        for (String id : idArray) {
            idList.add(Integer.valueOf(id));
        }
        ywContractBillService.deleteByIdInBatch(idList,this.getLoginUser(token));
        return ApiResponse.success(null);
    }
 
    @ApiOperation("根据ID修改")
    @PostMapping("/updateById")
    @CloudRequiredPermission("business:ywcontractbill:update")
    public ApiResponse updateById(@RequestBody YwContractBill ywContractBill,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywContractBill.setLoginUserInfo(this.getLoginUser(token));
        ywContractBillService.updateById(ywContractBill);
        return ApiResponse.success(null);
    }
 
    @ApiOperation("分页查询")
    @PostMapping("/page")
    @CloudRequiredPermission("business:ywcontractbill:query")
    public ApiResponse<PageData<YwContractBill>> findPage (@RequestBody PageWrap<YwContractBill> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token));
        return ApiResponse.success(ywContractBillService.findPage(pageWrap));
    }
 
 
    @ApiOperation("逾期账单")
    @PostMapping("/findPageForOverdue")
    @CloudRequiredPermission("business:ywcontractbill:query")
    public ApiResponse<PageData<YwContractBill>> findPageForOverdue (@RequestBody PageWrap<YwContractBill> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token));
        return ApiResponse.success(ywContractBillService.findPageForOverdue(pageWrap));
    }
 
 
    @ApiOperation("可退款账单")
    @PostMapping("/getCanBackBill")
    @CloudRequiredPermission("business:ywcontractbill:query")
    public ApiResponse<List<YwContractBill>> getCanBackBill (@RequestBody YwContractBill ywContractBill,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        return ApiResponse.success(ywContractBillService.getCanBackBill(ywContractBill));
    }
 
 
 
    @ApiOperation("导出Excel")
    @PostMapping("/exportExcel")
    @CloudRequiredPermission("business:ywcontractbill:exportExcel")
    public void exportExcel (@RequestBody PageWrap<YwContractBill> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token));
        ExcelExporter.build(YwContractBill.class).export(ywContractBillService.findPage(pageWrap).getRecords(), "运维合同账单信息表", response);
    }
 
    @ApiOperation("根据ID查询")
    @GetMapping("/{id}")
    @CloudRequiredPermission("business:ywcontractbill:query")
    public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        return ApiResponse.success(ywContractBillService.getDetail(id));
    }
 
 
    @LoginNoRequired
    @ApiOperation("生成账单编号")
    @GetMapping("/dealDayBillCode")
    public ApiResponse dealDayBillCode() {
        ywContractBillService.dealDayBillCode();
        return ApiResponse.success("生成成功");
    }
 
    @ApiOperation("获取待处理账单")
    @GetMapping("/getWaitDealList")
    @CloudRequiredPermission("business:ywcontractbill:query")
    public ApiResponse<YwContractBillDataVO> getWaitDealList(@RequestParam Integer contractId,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        return ApiResponse.success(ywContractBillService.getWaitDealList(contractId));
    }
 
 
    @ApiOperation("获取批量催缴数据")
    @PostMapping("/getNoticeCustomerData")
    @CloudRequiredPermission("business:ywcontractbill:query")
    public ApiResponse<List<YwContractBillCallDataVO>> getNoticeCustomerData(@RequestBody List<Integer> billIds,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        return ApiResponse.success(ywContractBillService.getNoticeCustomerData(billIds));
    }
 
 
    @ApiOperation("下载催费文件")
    @PostMapping("/downloadCallFeeDoc")
    @CloudRequiredPermission("business:ywcontractbill:query")
    public void downloadCallFeeDoc(@RequestBody List<Integer> billIds,@RequestHeader(Constants.HEADER_USER_TOKEN) String token,HttpServletResponse response) {
        ywContractBillService.downloadCallFeeDoc(billIds,getLoginUser(token),response);
    }
 
    @ApiOperation("发送短信与邮件")
    @PostMapping("/sendSmsEmail")
    @CloudRequiredPermission("business:ywcontractbill:query")
    public ApiResponse sendSmsEmail(@RequestBody List<YwSmsEmailBillCallDTO> ywSmsEmailBillCallDTOList, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywContractBillService.sendSmsEmail(ywSmsEmailBillCallDTOList,smsEmailService,getLoginUser(token));
        return ApiResponse.success(null);
    }
 
 
 
 
}