| | |
| | | import com.ycl.system.AjaxResult; |
| | | import com.ycl.system.controller.BaseController; |
| | | import com.ycl.system.page.TableDataInfo; |
| | | import com.ycl.utils.DateUtils; |
| | | import com.ycl.utils.poi.ExcelUtil; |
| | | import enumeration.BusinessType; |
| | | import enumeration.general.AuditingStatus; |
| | | 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.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 合同打分Controller |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/contract/score") |
| | | public class ContractScoreController extends BaseController |
| | | { |
| | | public class ContractScoreController extends BaseController { |
| | | @Autowired |
| | | private IContractScoreService defaultScoreService; |
| | | |
| | |
| | | * 查询合同打分列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('platform:score:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ContractScore contractScore) |
| | | { |
| | | @PostMapping("/list") |
| | | public TableDataInfo list(@RequestBody ContractScore contractScore) { |
| | | startPage(); |
| | | List<ContractScore> list = defaultScoreService.selectDefaultScoreList(contractScore); |
| | | return getDataTable(list); |
| | |
| | | * 导出合同打分列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('platform:score:export')") |
| | | @Log(title = "合同打分", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ContractScore contractScore) |
| | | { |
| | | public void export(HttpServletResponse response, ContractScore contractScore) { |
| | | List<ContractScore> list = defaultScoreService.selectDefaultScoreList(contractScore); |
| | | ExcelUtil<ContractScore> util = new ExcelUtil<ContractScore>(ContractScore.class); |
| | | ExcelUtil<ContractScore> util = new ExcelUtil<>(ContractScore.class); |
| | | util.exportExcel(response, list, "合同打分数据"); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('platform:score:query')") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | { |
| | | return success(defaultScoreService.selectDefaultScoreById(id)); |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | ContractScore contractScore = defaultScoreService.getById(id); |
| | | contractScore.setRuleIdsArray(Arrays.stream(contractScore.getRuleIds().split(",")).map(Long::parseLong).toArray(Long[]::new)); |
| | | return success(contractScore); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PreAuthorize("@ss.hasPermi('platform:score:add')") |
| | | @Log(title = "合同打分", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody ContractScore contractScore) |
| | | { |
| | | return toAjax(defaultScoreService.insertDefaultScore(contractScore)); |
| | | public AjaxResult add(@RequestBody ContractScore contractScore) { |
| | | contractScore.setCreateUserId(getUserId()); |
| | | contractScore.setCreateUser(getUsername()); |
| | | contractScore.setAuditingStatus(AuditingStatus.WAIT); |
| | | contractScore.setDeleted("0"); |
| | | contractScore.setRuleIds(Arrays.stream(contractScore.getRuleIdsArray()).map(String::valueOf).collect(Collectors.joining(","))); |
| | | return toAjax(defaultScoreService.save(contractScore)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PreAuthorize("@ss.hasPermi('platform:score:edit')") |
| | | @Log(title = "合同打分", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody ContractScore contractScore) |
| | | { |
| | | return toAjax(defaultScoreService.updateDefaultScore(contractScore)); |
| | | public AjaxResult edit(@RequestBody ContractScore contractScore) { |
| | | contractScore.setRuleIds(Arrays.stream(contractScore.getRuleIdsArray()).map(String::valueOf).collect(Collectors.joining(","))); |
| | | return toAjax(defaultScoreService.updateById(contractScore)); |
| | | } |
| | | |
| | | /** |
| | | * 合同打分审核 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('platform:score:audit')") |
| | | @Log(title = "合同打分审核", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/auditing") |
| | | public AjaxResult audit(@RequestBody ContractScore contractScore) { |
| | | contractScore.setRuleIds(Arrays.stream(contractScore.getRuleIdsArray()).map(String::valueOf).collect(Collectors.joining(","))); |
| | | contractScore.setAuditingTime(DateUtils.getNowDate()); |
| | | contractScore.setAuditingUser(getUsername()); |
| | | contractScore.setAuditingUserId(getUserId()); |
| | | return toAjax(defaultScoreService.updateById(contractScore)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('platform:score:remove')") |
| | | @Log(title = "合同打分", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | | { |
| | | return toAjax(defaultScoreService.deleteDefaultScoreByIds(ids)); |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) { |
| | | return toAjax(defaultScoreService.removeBatchByIds(Arrays.asList(ids))); |
| | | } |
| | | } |