| | |
| | | @PostMapping("/add") |
| | | @NotRepeatCommit(key = "param:arg[1]", value = 30000) |
| | | public AjaxResult add(@RequestBody ServiceFunddetail serviceFunddetail) { |
| | | // 2026-10-15:附件文件名规范二次校验(与前端 opo-web/src/utils/fileNameCheck.js 同口径, |
| | | // 目的是防止绕过前端直接调接口保存不合规附件名)。新增场景没有历史附件,用严格模式。 |
| | | String nameError = com.ruoyi.project.common.AttachmentNameValidator |
| | | .checkJsonList(serviceFunddetail.getInvoicefiles(), serviceFunddetail.getAnnexfiles()); |
| | | if (nameError != null) { |
| | | return AjaxResult.error("附件文件名不符合要求,无法保存:" + nameError); |
| | | } |
| | | boolean save = serviceFunddetailService.save(serviceFunddetail); |
| | | return AjaxResult.success(serviceFunddetail); |
| | | } |
| | |
| | | @NotRepeatCommit(key = "param:arg[1]", value = 30000) |
| | | public AjaxResult edit(@RequestBody ServiceFunddetail serviceFunddetail) { |
| | | log.info("修改的数据信息:{}", serviceFunddetail); |
| | | // 2026-10-15:附件文件名规范二次校验。修改场景按业务口径"只校验本次变更的附件": |
| | | // 保存前该明细已存在的历史附件名不参与校验,否则老单据(历史不合规名占比很高)改个金额都存不进去。 |
| | | java.util.Set<String> existingNames = new java.util.HashSet<>(); |
| | | if (serviceFunddetail.getId() != null) { |
| | | ServiceFunddetail oldDetail = serviceFunddetailService.getById(serviceFunddetail.getId()); |
| | | if (oldDetail != null) { |
| | | existingNames.addAll(com.ruoyi.project.common.AttachmentNameValidator |
| | | .collectNames(oldDetail.getInvoicefiles())); |
| | | existingNames.addAll(com.ruoyi.project.common.AttachmentNameValidator |
| | | .collectNames(oldDetail.getAnnexfiles())); |
| | | } |
| | | } |
| | | String nameError = com.ruoyi.project.common.AttachmentNameValidator |
| | | .checkJsonListForUpdate(existingNames, serviceFunddetail.getInvoicefiles(), |
| | | serviceFunddetail.getAnnexfiles()); |
| | | if (nameError != null) { |
| | | return AjaxResult.error("附件文件名不符合要求,无法保存:" + nameError); |
| | | } |
| | | return toAjax(serviceFunddetailService.updateById(serviceFunddetail)); |
| | | } |
| | | |