From b02beccf4567068cb47a3f1181a00039456c872d Mon Sep 17 00:00:00 2001
From: zqy <2522236926@qq.com>
Date: 星期三, 06 八月 2025 15:37:20 +0800
Subject: [PATCH] 用户修改姓名和电话同步修改uaid

---
 zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionShaServiceImpl.java |   52 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionShaServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionShaServiceImpl.java
index 143bdfd..8acca20 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionShaServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionShaServiceImpl.java
@@ -4,6 +4,7 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.EsModel;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.utils.MapUtils;
 import com.ruoyi.common.utils.SecurityUtils;
@@ -12,9 +13,13 @@
 import com.ruoyi.mapper.ZfShareMapper;
 import com.ruoyi.service.*;
 import lombok.extern.slf4j.Slf4j;
+import org.elasticsearch.action.delete.DeleteRequest;
+import org.elasticsearch.client.RequestOptions;
+import org.elasticsearch.client.RestHighLevelClient;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -32,6 +37,11 @@
 
     @Resource
     private ZInfoUserService zInfoUserService;
+    @Resource
+    private RestHighLevelClient restHighLevelClient;
+
+    @Resource
+    EsService esService;
 
     private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) {
         LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
@@ -85,7 +95,6 @@
 
                 za.setSysMenuId(2018L);
 
-                za.setSysMenuId(2002L);
 
                 addData(za);
             }
@@ -152,7 +161,6 @@
 
         lqw.eq(ZfShare::getSysMenuId,2018L);
 
-        lqw.eq(ZfShare::getSysMenuId,2002L);
 
         List<ZfShare> beanRecords = list(lqw);
         List<ZfCollection> b1 = new ArrayList<>();
@@ -171,8 +179,6 @@
         lqw.eq(ZfShare::getShareId,getUserId());
 
         lqw.eq(ZfShare::getSysMenuId,2018L);
-
-        lqw.eq(ZfShare::getSysMenuId,2002L);
 
         List<ZfShare> beanRecords = list(lqw);
         for (ZfShare beanRecord : beanRecords ) {
@@ -207,4 +213,42 @@
             return null;
         }
     }
+
+    @Override
+    public Boolean deleteByContentId(Long[] ids) {
+        List<Long> id = new ArrayList<>();
+
+        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
+        lqw.in(ids != null, ZfShare::getShareContent,  ids)
+                .eq(ZfShare::getSysMenuId, 2018L);
+
+        List<ZfShare> zfShares = list(lqw);
+        if (zfShares.size() == 0){
+            return true;
+        }
+        for (ZfShare zfShare: zfShares) {
+            id.add(zfShare.getId());
+        }
+
+        System.out.println(id);
+        if (removeByIds(id)) {
+            //鍒犻櫎es涓殑鏁版嵁
+            zfShares.forEach(zfDoctorDownload -> {
+                EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "鏀惰棌鍜岃崳瑾夊垎浜垹闄�");
+                if (esModel != null) {
+                    DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId());
+                    System.out.println(deleteRequest);
+                    try {
+                        restHighLevelClient.delete(deleteRequest, RequestOptions.DEFAULT);
+                    } catch (IOException e) {
+                        throw new RuntimeException(e);
+                    }
+                }
+            });
+            return true;
+        } else {
+            return false;
+        }
+
+    }
 }

--
Gitblit v1.9.1