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 | 79 ++++++++++++++++++++++++++++++++++++--- 1 files changed, 72 insertions(+), 7 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 b801735..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; @@ -22,7 +27,9 @@ @Slf4j @Service -public class ZfCollectionDownloadServiceImpl extends ServiceImpl<ZfShareMapper, ZfShare> implements ZfCollectionShareService { + +public class ZfCollectionShaServiceImpl extends ServiceImpl<ZfShareMapper, ZfShare> implements ZfCollectionShareService { + @Resource @@ -30,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<>(); @@ -80,7 +92,10 @@ za.setUserId(getUserId()); za.setShareContent(shareContent); za.setShareId(shareId); - za.setSysMenuId(2002L); + + za.setSysMenuId(2018L); + + addData(za); } } @@ -109,8 +124,12 @@ int totalPage = (beanRecord3.size() -1) / pageSize +1; - Page<ZfCollection> zfPropertyPage = new Page<>(pageNo, pageSize,totalPage); - HashMap<String, Object> data = MapUtils.getShareResult(zfPropertyPage, record,beanRecord3.size()); + + Page<ZfCollection> zfCollectionPage = new Page<>(pageNo, pageSize,totalPage); + HashMap<String, Object> data = MapUtils.getShareResult(zfCollectionPage, record,beanRecord3.size()); + + + return AjaxResult.success(data); } @@ -139,7 +158,10 @@ HashMap<Long,List<ZfCollection>> bs = new HashMap<>(); LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); lqw.eq(ZfShare::getShareId,getUserId()); - lqw.eq(ZfShare::getSysMenuId,2002L); + + lqw.eq(ZfShare::getSysMenuId,2018L); + + List<ZfShare> beanRecords = list(lqw); List<ZfCollection> b1 = new ArrayList<>(); for (ZfShare beanRecord : beanRecords ) { @@ -155,7 +177,9 @@ List<ZfCollection> bs = new ArrayList<>(); LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); lqw.eq(ZfShare::getShareId,getUserId()); - lqw.eq(ZfShare::getSysMenuId,2002L); + + lqw.eq(ZfShare::getSysMenuId,2018L); + List<ZfShare> beanRecords = list(lqw); for (ZfShare beanRecord : beanRecords ) { ZfCollection bs2 = zfCollectionService.getById(beanRecord.getShareContent()); @@ -167,7 +191,10 @@ int totalPage = (bs.size() -1) / pageSize +1; - Page<ZfProperty> zfCollectionPage = new Page<>(pageNo, pageSize,totalPage); + + Page<ZfCollection> zfCollectionPage = new Page<>(pageNo, pageSize,totalPage); + + HashMap<String, Object> data = MapUtils.getShareResult(zfCollectionPage, record,bs.size()); return AjaxResult.success(data); } @@ -186,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