From 68b49efb4da346edb42a5d8ebb39af47207402bd Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期一, 12 十月 2026 11:14:13 +0800
Subject: [PATCH] 修改了报销校验

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceExternalpersonController.java |   56 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceExternalpersonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceExternalpersonController.java
index ee96a20..b3f73bb 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceExternalpersonController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceExternalpersonController.java
@@ -6,6 +6,7 @@
 
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.project.domain.BaseOnlyvalue;
+import com.ruoyi.project.domain.ServiceDonatebaseinfo;
 import com.ruoyi.project.service.IBaseOnlyvalueService;
 import com.ruoyi.web.controller.common.OnlyValueCommon;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -50,9 +51,10 @@
     /**
      * 鏌ヨ澶栧洿鍗曚綅浜哄憳鍒楄〃
      */
-    //@PreAuthorize("@ss.hasPermi('project:externalperson:list')")
+    //// @PreAuthorize("@ss.hasPermi('project:externalperson:list')")
     @GetMapping("/list")
     public TableDataInfo list(ServiceExternalperson serviceExternalperson) {
+        logger.info("璇㈠鍥村崟浣嶄汉鍛樺垪琛ㄧ殑鍏ュ弬涓� 锛歿}", serviceExternalperson);
         startPage();
         List<ServiceExternalperson> list = serviceExternalpersonService.queryList(serviceExternalperson);
         return getDataTable(list);
@@ -61,7 +63,7 @@
     /**
      * 瀵煎嚭澶栧洿鍗曚綅浜哄憳鍒楄〃
      */
-    //@PreAuthorize("@ss.hasPermi('project:externalperson:export')")
+    //// @PreAuthorize("@ss.hasPermi('project:externalperson:export')")
     @Log(title = "澶栧洿鍗曚綅浜哄憳", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(ServiceExternalperson serviceExternalperson) {
@@ -73,7 +75,7 @@
     /**
      * 鑾峰彇澶栧洿鍗曚綅浜哄憳璇︾粏淇℃伅
      */
-    //@PreAuthorize("@ss.hasPermi('project:externalperson:query')")
+    //// @PreAuthorize("@ss.hasPermi('project:externalperson:query')")
     @GetMapping(value = "/{id}")
     public AjaxResult getInfo(@PathVariable("id") Long id) {
         return AjaxResult.success(serviceExternalpersonService.getById(id));
@@ -82,24 +84,40 @@
     /**
      * 鏂板澶栧洿鍗曚綅浜哄憳
      */
-    //@PreAuthorize("@ss.hasPermi('project:externalperson:add')")
+    //// @PreAuthorize("@ss.hasPermi('project:externalperson:add')")
     @Log(title = "澶栧洿鍗曚綅浜哄憳", businessType = BusinessType.INSERT)
     @PostMapping("/add")
     @RepeatSubmit
     public AjaxResult add(@RequestBody ServiceExternalperson serviceExternalperson) {
+       //鏍¢獙浜哄憳绫诲瀷銆佽韩浠借瘉
+        String usertype = serviceExternalperson.getUsertype();
+
+        if (usertype == null || usertype.isEmpty())
+        {
+            return AjaxResult.error("鏂板浜哄憳闇�瑕佺‘瀹氫汉鍛樼被鍨�!");
+        }
+        // UserType 鑷� 2026-09-27 璧蜂负澶氬�煎瓧娈碉紙閫楀彿鍒嗛殧锛夛紝鍗曚綅鍒ゆ柇鏀逛负"鍖呭惈 org"
+        if (!hasUserType(usertype, "org")){
+            String idcardno = serviceExternalperson.getIdcardno();
+            List<ServiceExternalperson> existpsersons = serviceExternalpersonService.getInfoByIDCardNo(idcardno);
+            if (existpsersons.size() > 0) {
+                return AjaxResult.error("鏂板浜哄憳韬唤璇�" + idcardno + "宸插瓨鍦�,浜哄憳淇℃伅涓嶈兘閲嶅娣诲姞!");
+            }
+        }
+
         if (StringUtils.isEmpty(serviceExternalperson.getUserno())) {
             String zj = onlyValueCommon.addOnlyValue("zj");
             String formattedNumber = String.format("%05d", zj);
             serviceExternalperson.setUserno(formattedNumber);
         }
-        boolean save = serviceExternalpersonService.save(serviceExternalperson);
+        boolean save1 = serviceExternalpersonService.save(serviceExternalperson);
         return AjaxResult.success(serviceExternalperson);
     }
 
     /**
      * 淇敼澶栧洿鍗曚綅浜哄憳
      */
-    //@PreAuthorize("@ss.hasPermi('project:externalperson:edit')")
+    //// @PreAuthorize("@ss.hasPermi('project:externalperson:edit')")
     @Log(title = "澶栧洿鍗曚綅浜哄憳", businessType = BusinessType.UPDATE)
     @PostMapping("/editZJInfo")
     @RepeatSubmit
@@ -110,7 +128,7 @@
     /**
      * 鍒犻櫎澶栧洿鍗曚綅浜哄憳
      */
-    //@PreAuthorize("@ss.hasPermi('project:externalperson:remove')")
+    //// @PreAuthorize("@ss.hasPermi('project:externalperson:remove')")
     @Log(title = "澶栧洿鍗曚綅浜哄憳", businessType = BusinessType.DELETE)
     @GetMapping("/remove/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids) {
@@ -126,4 +144,28 @@
     public AjaxResult getInfoByUserNo(@PathVariable("userno") String userno) {
         return AjaxResult.success(serviceExternalpersonService.getInfoByUserNo(userno));
     }
+
+    @GetMapping(value = "/getInfoByIDCardNo/{idcardno}")
+    public AjaxResult getInfoByIDCardNo(@PathVariable("idcardno") String idcardno) {
+        return AjaxResult.success(serviceExternalpersonService.getInfoByIDCardNo(idcardno));
+    }
+
+    /**
+     * 鍒ゆ柇浜哄憳绫诲瀷锛堝鍊硷紝閫楀彿鍒嗛殧锛変腑鏄惁鍖呭惈鎸囧畾绫诲瀷
+     *
+     * @param usertype 浜哄憳绫诲瀷锛屽 "zzry,performance"锛涘吋瀹规敼閫犲墠鐨勫崟鍊�
+     * @param code     瀛楀吀 sys_UserType 鐨勫彇鍊硷紝濡� "org"
+     * @return 鏄惁鍖呭惈
+     */
+    private static boolean hasUserType(String usertype, String code) {
+        if (usertype == null || usertype.isEmpty()) {
+            return false;
+        }
+        for (String item : usertype.split(",")) {
+            if (code.equals(item.trim())) {
+                return true;
+            }
+        }
+        return false;
+    }
 }

--
Gitblit v1.9.3