From 8c215c8be0f5076e8c95daf1b2203440ca7dfcad Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期五, 23 十月 2026 13:42:50 +0800
Subject: [PATCH] 修改了报销校验
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementdetailController.java | 72 ++++++++++++++++++++++++++++++++---
1 files changed, 65 insertions(+), 7 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementdetailController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementdetailController.java
index f966dea..ed619ef 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementdetailController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementdetailController.java
@@ -52,7 +52,7 @@
* 鏌ヨ鎶ラ攢鐢宠鏄庣粏鍒楄〃
*/
@ApiOperation("鏌ヨ鎶ラ攢鐢宠鏄庣粏鍒楄〃")
- //@PreAuthorize("@ss.hasPermi('project:reimbursementdetail:list')")
+ //// @PreAuthorize("@ss.hasPermi('project:reimbursementdetail:list')")
@GetMapping("/list")
public TableDataInfo list(ServiceReimbursementdetail serviceReimbursementdetail) {
startPage();
@@ -65,7 +65,7 @@
* 瀵煎嚭鎶ラ攢鐢宠鏄庣粏鍒楄〃
*/
@ApiOperation("瀵煎嚭鎶ラ攢鐢宠鏄庣粏鍒楄〃")
- //@PreAuthorize("@ss.hasPermi('project:reimbursementdetail:export')")
+ //// @PreAuthorize("@ss.hasPermi('project:reimbursementdetail:export')")
@Log(title = "鎶ラ攢鐢宠鏄庣粏", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ServiceReimbursementdetail serviceReimbursementdetail) {
@@ -87,7 +87,7 @@
* 鑾峰彇鎶ラ攢鐢宠鏄庣粏璇︾粏淇℃伅
*/
@ApiOperation("鑾峰彇鎶ラ攢鐢宠鏄庣粏璇︾粏淇℃伅")
- //@PreAuthorize("@ss.hasPermi('project:reimbursementdetail:query')")
+ //// @PreAuthorize("@ss.hasPermi('project:reimbursementdetail:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(serviceReimbursementdetailService.getById(id));
@@ -97,11 +97,26 @@
* 鏂板鎶ラ攢鐢宠鏄庣粏
*/
@ApiOperation("鏂板鎶ラ攢鐢宠鏄庣粏")
- //@PreAuthorize("@ss.hasPermi('project:reimbursementdetail:add')")
+ //// @PreAuthorize("@ss.hasPermi('project:reimbursementdetail:add')")
@Log(title = "鎶ラ攢鐢宠鏄庣粏", businessType = BusinessType.INSERT)
@PostMapping("/add")
@RepeatSubmit
public AjaxResult add(@RequestBody ServiceReimbursementdetailVO serviceReimbursementdetailVO) {
+ // 2026-10-15锛氶檮浠舵枃浠跺悕瑙勮寖浜屾鏍¢獙锛堜笌鍓嶇 opo-web/src/utils/fileNameCheck.js 鍚屽彛寰勶紝
+ // 鐩殑鏄槻姝㈢粫杩囧墠绔洿鎺ヨ皟鎺ュ彛淇濆瓨涓嶅悎瑙勯檮浠跺悕锛夈�傛柊澧炲満鏅病鏈夊巻鍙查檮浠讹紝鐢ㄤ弗鏍兼ā寮忋��
+ // 娉ㄦ剰锛歀ist 涓虹┖鏃跺繀椤诲洖閫�鏍¢獙瀛楃涓插瓧娈碉紙annexfiles / invoicefiles锛夛紝
+ // 鍚﹀垯鍙紶瀛楃涓插瓧娈靛氨鑳界粫杩囨牎楠岋紙鎺ュ彛灞傞潰鐨勭粫杩囧彛锛夈��
+ String invoiceJson = CollectionUtils.isEmpty(serviceReimbursementdetailVO.getInvoicefilesList())
+ ? serviceReimbursementdetailVO.getInvoicefiles()
+ : JSON.toJSONString(serviceReimbursementdetailVO.getInvoicefilesList());
+ String annexJson = CollectionUtils.isEmpty(serviceReimbursementdetailVO.getAnnexfilesList())
+ ? serviceReimbursementdetailVO.getAnnexfiles()
+ : JSON.toJSONString(serviceReimbursementdetailVO.getAnnexfilesList());
+ String nameError = com.ruoyi.project.common.AttachmentNameValidator
+ .checkJsonList(invoiceJson, annexJson);
+ if (nameError != null) {
+ return AjaxResult.error("闄勪欢鏂囦欢鍚嶄笉绗﹀悎瑕佹眰锛屾棤娉曚繚瀛橈細" + nameError);
+ }
ServiceReimbursementdetail serviceReimbursementdetail = DtoConversionUtils.sourceToTarget(serviceReimbursementdetailVO, ServiceReimbursementdetail.class);
//灏嗗墠绔紶鏉ョ殑闄勪欢闆嗗悎杞垚瀛楃涓�
if (!CollectionUtils.isEmpty(serviceReimbursementdetailVO.getAnnexfilesList())) {
@@ -118,11 +133,29 @@
* 淇敼鎶ラ攢鐢宠鏄庣粏
*/
@ApiOperation("淇敼鎶ラ攢鐢宠鏄庣粏")
- //@PreAuthorize("@ss.hasPermi('project:reimbursementdetail:edit')")
+ //// @PreAuthorize("@ss.hasPermi('project:reimbursementdetail:edit')")
@Log(title = "淇敼鐢宠鏄庣粏", businessType = BusinessType.UPDATE)
@PostMapping("/updateRDlList")
public AjaxResult updateRDlList(@RequestBody List<ServiceReimbursementdetail> serviceReimbursementdetails) {
for (ServiceReimbursementdetail serviceReimbursementdetail : serviceReimbursementdetails) {
+ // 2026-10-15锛氶檮浠舵枃浠跺悕瑙勮寖浜屾鏍¢獙锛堝彧鏍¢獙鏈鍙樻洿鐨勯檮浠讹紝鍘嗗彶闄勪欢鏀捐锛�
+ java.util.Set<String> existingNames = new java.util.HashSet<>();
+ if (serviceReimbursementdetail.getId() != null) {
+ ServiceReimbursementdetail oldDetail = serviceReimbursementdetailService
+ .getById(serviceReimbursementdetail.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, serviceReimbursementdetail.getInvoicefiles(),
+ serviceReimbursementdetail.getAnnexfiles());
+ if (nameError != null) {
+ return AjaxResult.error("闄勪欢鏂囦欢鍚嶄笉绗﹀悎瑕佹眰锛屾棤娉曚繚瀛橈細" + nameError);
+ }
serviceReimbursementdetailService.saveOrUpdate(serviceReimbursementdetail);
}
@@ -133,11 +166,36 @@
* 淇敼鎶ラ攢鐢宠鏄庣粏
*/
@ApiOperation("淇敼鎶ラ攢鐢宠鏄庣粏")
- //@PreAuthorize("@ss.hasPermi('project:reimbursementdetail:edit')")
+ //// @PreAuthorize("@ss.hasPermi('project:reimbursementdetail:edit')")
@Log(title = "鎶ラ攢鐢宠鏄庣粏", businessType = BusinessType.UPDATE)
@PostMapping("/reimbursementdetailEdit")
//@RepeatSubmit
public AjaxResult edit(@RequestBody ServiceReimbursementdetailVO serviceReimbursementdetailVO) {
+ // 2026-10-15锛氶檮浠舵枃浠跺悕瑙勮寖浜屾鏍¢獙锛堜笌鍓嶇 fileNameCheck 鍚屽彛寰勶紝闃叉缁曡繃鍓嶇锛夈��
+ // 淇敼鍦烘櫙鎸変笟鍔″彛寰�"鍙牎楠屾湰娆″彉鏇寸殑闄勪欢"锛氫繚瀛樺墠宸插瓨鍦ㄧ殑鍘嗗彶闄勪欢鍚嶄笉鍙備笌鏍¢獙锛岄伩鍏嶅崱浣忚�佸崟鎹��
+ java.util.Set<String> existingNames = new java.util.HashSet<>();
+ if (serviceReimbursementdetailVO.getId() != null) {
+ ServiceReimbursementdetail oldDetail = serviceReimbursementdetailService
+ .getById(serviceReimbursementdetailVO.getId());
+ if (oldDetail != null) {
+ existingNames.addAll(com.ruoyi.project.common.AttachmentNameValidator
+ .collectNames(oldDetail.getInvoicefiles()));
+ existingNames.addAll(com.ruoyi.project.common.AttachmentNameValidator
+ .collectNames(oldDetail.getAnnexfiles()));
+ }
+ }
+ // List 涓虹┖鏃跺洖閫�鏍¢獙瀛楃涓插瓧娈碉紙annexfiles / invoicefiles锛夛紝鍫典綇"鍙紶瀛楃涓插瓧娈�"鐨勭粫杩囧彛
+ String invoiceJson = CollectionUtils.isEmpty(serviceReimbursementdetailVO.getInvoicefilesList())
+ ? serviceReimbursementdetailVO.getInvoicefiles()
+ : JSON.toJSONString(serviceReimbursementdetailVO.getInvoicefilesList());
+ String annexJson = CollectionUtils.isEmpty(serviceReimbursementdetailVO.getAnnexfilesList())
+ ? serviceReimbursementdetailVO.getAnnexfiles()
+ : JSON.toJSONString(serviceReimbursementdetailVO.getAnnexfilesList());
+ String nameError = com.ruoyi.project.common.AttachmentNameValidator
+ .checkJsonListForUpdate(existingNames, invoiceJson, annexJson);
+ if (nameError != null) {
+ return AjaxResult.error("闄勪欢鏂囦欢鍚嶄笉绗﹀悎瑕佹眰锛屾棤娉曚繚瀛橈細" + nameError);
+ }
if (serviceReimbursementdetailVO.getTrafficexpense() == null) {
serviceReimbursementdetailVO.setTrafficexpense(new BigDecimal(0));
}
@@ -179,7 +237,7 @@
* 鍒犻櫎鎶ラ攢鐢宠鏄庣粏
*/
@ApiOperation("鍒犻櫎鎶ラ攢鐢宠鏄庣粏")
- //@PreAuthorize("@ss.hasPermi('project:reimbursementdetail:remove')")
+ //// @PreAuthorize("@ss.hasPermi('project:reimbursementdetail:remove')")
@Log(title = "鎶ラ攢鐢宠鏄庣粏", businessType = BusinessType.DELETE)
@GetMapping("/remove/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
--
Gitblit v1.9.3