New file |
| | |
| | | package com.ycl.platform.controller; |
| | | |
| | | import annotation.Log; |
| | | import com.ycl.platform.domain.entity.CalculateRule; |
| | | import com.ycl.platform.service.ICalculateRuleService; |
| | | import com.ycl.system.AjaxResult; |
| | | import com.ycl.system.controller.BaseController; |
| | | import com.ycl.utils.poi.ExcelUtil; |
| | | import enumeration.BusinessType; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 核算规则(分)Controller |
| | | * |
| | | * @author ruoyi |
| | | * @date 2024-04-01 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/calculate/rule") |
| | | public class CalculateRuleController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ICalculateRuleService defaultRuleService; |
| | | |
| | | /** |
| | | * 查询违约规则列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:rule:list')") |
| | | @GetMapping("/list") |
| | | public AjaxResult list(CalculateRule calculateRule) |
| | | { |
| | | List<CalculateRule> list = defaultRuleService.selectDefaultRuleList(calculateRule); |
| | | return success(list); |
| | | } |
| | | |
| | | /** |
| | | * 根据合同id查询违约规则列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:rule:query')") |
| | | @GetMapping("/getRuleListByContractId") |
| | | public AjaxResult getRuleListByContractId(Integer contractId) |
| | | { |
| | | return success(defaultRuleService.getRuleListByContractId(contractId)); |
| | | } |
| | | |
| | | /** |
| | | * 根据运维单位查询违约规则列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:rule:query')") |
| | | @GetMapping("/getRuleListByUnitId") |
| | | public AjaxResult getRuleListByUnitId(Integer unitId) |
| | | { |
| | | return success(defaultRuleService.getRuleListByUnitId(unitId)); |
| | | } |
| | | |
| | | /** |
| | | * 导出违约规则列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:rule:export')") |
| | | @Log(title = "违约规则", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, CalculateRule calculateRule) |
| | | { |
| | | List<CalculateRule> list = defaultRuleService.selectDefaultRuleList(calculateRule); |
| | | ExcelUtil<CalculateRule> util = new ExcelUtil<CalculateRule>(CalculateRule.class); |
| | | util.exportExcel(response, list, "违约规则数据"); |
| | | } |
| | | |
| | | /** |
| | | * 获取违约规则详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:rule:query')") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | { |
| | | return success(defaultRuleService.selectDefaultRuleById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 新增违约规则 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:rule:add')") |
| | | @Log(title = "违约规则", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody CalculateRule calculateRule) |
| | | { |
| | | return toAjax(defaultRuleService.insertDefaultRule(calculateRule)); |
| | | } |
| | | |
| | | /** |
| | | * 修改违约规则 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:rule:edit')") |
| | | @Log(title = "违约规则", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody CalculateRule calculateRule) |
| | | { |
| | | return toAjax(defaultRuleService.updateDefaultRule(calculateRule)); |
| | | } |
| | | |
| | | /** |
| | | * 删除违约规则 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:rule:remove')") |
| | | @Log(title = "违约规则", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | | { |
| | | return toAjax(defaultRuleService.deleteDefaultRuleByIds(ids)); |
| | | } |
| | | } |