fuliqi
2024-10-23 d74864fb938883b9c2b69abaf8b3ff740f03d930
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
package com.ycl.platform.controller;
 
import annotation.Log;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ycl.platform.domain.entity.CalculateMoneyRule;
import com.ycl.platform.domain.entity.TContract;
import com.ycl.platform.domain.entity.TMonitor;
import com.ycl.platform.domain.query.ContractQuery;
import com.ycl.platform.domain.query.YwUnitQuery;
import com.ycl.platform.domain.vo.TMonitorVO;
import com.ycl.platform.service.ITContractService;
import com.ycl.system.AjaxResult;
import com.ycl.system.Result;
import com.ycl.system.controller.BaseController;
import com.ycl.system.page.TableDataInfo;
import enumeration.BusinessType;
import io.swagger.annotations.ApiOperation;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import org.glassfish.jaxb.core.v2.TODO;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import java.util.List;
 
/**
 * 【请填写功能名称】Controller
 *
 * @author ruoyi
 * @date 2024-03-12
 */
@RestController
@RequestMapping("/system/contract")
@AllArgsConstructor
public class ContractController extends BaseController {
 
    private final ITContractService tContractService;
 
    @PreAuthorize("@ss.hasPermi('system:contract:time')")
    @GetMapping("/time/{unitId}")
    @ApiOperation("获取该单位的合同时间范围")
    public Result timeRange(@PathVariable("unitId") Integer unitId) {
        return tContractService.timeRange(unitId);
    }
 
    @PreAuthorize("@ss.hasPermi('system:contract:list')")
    @GetMapping("/list")
    public Result page(ContractQuery query) {
        return tContractService.selectAll(query);
    }
 
    @PreAuthorize("@ss.hasPermi('system:contract:query')")
    @GetMapping("/selectMoneyRules")
    public AjaxResult selectMoneyRules(Integer contractId) {
        return success(tContractService.selectMoneyRules(contractId));
    }
 
    /**
     * 合同导入模板
     */
    @PreAuthorize("@ss.hasPermi('system:contract:importTemplate')")
    @Log(title = "导入模板", businessType = BusinessType.IMPORT)
    @PostMapping("/importTemplate")
    public void importTemplate(HttpServletResponse response) {
        tContractService.importTemplate(response);
    }
 
    /**
     * 合同导入
     *
     * @return 导入结果
     */
    @Log(title = "合同导入", businessType = BusinessType.IMPORT)
    @PreAuthorize("@ss.hasPermi('system:user:import')")
    @PostMapping("/importData")
    public AjaxResult importData(TContract tContract) {
        return tContractService.importData(tContract.getFile(), tContract);
    }
 
    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:contract:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(tContractService.getById(id));
    }
 
    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:contract:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TContract tContract) {
        return toAjax(tContractService.save(tContract));
    }
 
    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:contract:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TContract tContract) {
        return toAjax(tContractService.updateById(tContract));
    }
 
    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:contract:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(tContractService.removeById(ids));
    }
}