From 5c71fd8ce9c6cd48add347da85cc28c2fd83eede Mon Sep 17 00:00:00 2001
From: zqy <2522236926@qq.com>
Date: 星期日, 19 五月 2024 17:27:39 +0800
Subject: [PATCH] 修改bug

---
 zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java
index dca3b77..ae0f88d 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java
@@ -72,6 +72,11 @@
 //        return AjaxResult.success(data);
         //瑕佹煡鑷繁瀹跺涵鐨�
         ZInfoUser myself = zInfoUserService.getMyself();
+        if(myself==null)
+        {
+            //   System.out.println("ssssss");
+            return AjaxResult.success("鎮ㄦ病鍔犲叆鍒板搴旂殑瀹跺涵锛岃鑱旂郴绠$悊鍛�");
+        }
         Long familyId = myself.getFamilyId();
         //涔熻鏌ュ埆浜烘巿鏉冪殑
         List<ZAuthority> authority = zAuthorityService.getAuthority();
@@ -150,10 +155,16 @@
         }
         log.info("鏁版嵁鍒楄〃涓猴細{}", dataList);
 
+       for (ZfDoctor symptom : dataList){
+           if (symptom.getSymptom().length() == 0) {
+               throw new RuntimeException("鐥囩姸涓虹┖锛屽鍏ユ暟鎹け璐�");
+           }
+       }
+
+
         for (ZfDoctor zfDoctor : dataList) {
             zfDoctorService.addData(zfDoctor);
         }
-
         return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
 
     }
@@ -246,6 +257,10 @@
             //鍏堝埌es涓煡璇㈠埌瀵瑰簲閭f潯鏁版嵁鍦╡s鐨刬d
             EsModel esResult = esService.findByCtId(dataById.getId().intValue(), "瀹跺涵灏忓尰鐢�");
 
+            if (esResult == null){
+                return AjaxResult.success();
+            }
+
             //鎿嶄綔es淇敼鏁版嵁
             EsModel newModel = new EsModel();
             if(zfDoctor.getType()!=null){
@@ -337,11 +352,15 @@
             //鍒犻櫎es涓殑鏁版嵁
             zfDoctors.stream().forEach(zfDoctor -> {
                 EsModel esModel = esService.findByCtId(zfDoctor.getId().intValue(), "瀹跺涵灏忓尰鐢�");
-                DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId());
-                try {
-                    restHighLevelClient.delete(deleteRequest,RequestOptions.DEFAULT);
-                } catch (IOException e) {
-                    throw new RuntimeException(e);
+
+                if (esModel != null){
+                    DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId());
+                    try {
+                        restHighLevelClient.delete(deleteRequest,RequestOptions.DEFAULT);
+                    } catch (IOException e) {
+                        throw new RuntimeException(e);
+                    }
+
                 }
             });
             return AjaxResult.success();

--
Gitblit v1.9.1