From ca054d1db9256bc8d367486b0d78e89cd4fd7fdb Mon Sep 17 00:00:00 2001 From: zqy <2522236926@qq.com> Date: 星期二, 22 十月 2024 20:41:10 +0800 Subject: [PATCH] 删除时会连着分享和下载的数据一起删掉 --- zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountSharServiceImpl.java | 48 + zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomySharServiceImpl.java | 46 + zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailSharServiceImpl.java | 47 + zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactShraServiceImpl.java | 129 ++- ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSecretController.java | 11 zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java | 2 zhang-content/src/main/java/com/ruoyi/service/ZfEquipShareService.java | 2 ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSelfNoteController.java | 13 zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java | 10 zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventDownloadServiceImpl.java | 31 zhang-content/src/main/java/com/ruoyi/service/ZSecretShareService.java | 3 zhang-content/src/main/java/com/ruoyi/service/ZfPetDownlService.java | 2 ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelDetailController.java | 11 zhang-content/src/main/java/com/ruoyi/service/ZSecretDownloadService.java | 2 zhang-content/src/main/java/com/ruoyi/service/ZfEconomyDownlService.java | 2 zhang-content/src/main/java/com/ruoyi/service/impl/ZPropertyShareServiceImpl.java | 130 ++- ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZPropertyController.java | 11 zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetServiceImpl.java | 9 zhang-content/src/main/java/com/ruoyi/service/ZfEconomyShaService.java | 2 zhang-content/src/main/java/com/ruoyi/service/ZHonorDownloadService.java | 2 zhang-content/src/main/java/com/ruoyi/service/ZfCleanShareService.java | 1 zhang-content/src/main/java/com/ruoyi/service/TravelDetailDownlService.java | 2 zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java | 2 zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyShareServiceImpl.java | 49 + zhang-content/src/main/java/com/ruoyi/service/impl/ZSecretDownloadServiceImpl.java | 27 zhang-content/src/main/java/com/ruoyi/service/ZfEventShareService.java | 2 zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteDownloadServiceImpl.java | 27 zhang-content/src/main/java/com/ruoyi/service/TravelCountSharService.java | 3 zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailDownServiceImpl.java | 27 zhang-content/src/main/java/com/ruoyi/service/ZIdeaDownloadService.java | 2 zhang-content/src/main/java/com/ruoyi/service/TravelCountDownlService.java | 2 zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactDownlServiceImpl.java | 25 zhang-content/src/main/java/com/ruoyi/service/ZPropertyShareService.java | 2 zhang-content/src/main/java/com/ruoyi/service/TravelDetailSharService.java | 3 zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java | 11 zhang-content/src/main/java/com/ruoyi/service/ZPropertyDownloadService.java | 2 zhang-content/src/main/java/com/ruoyi/service/ZIdeaShareService.java | 3 zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanDownloadServiceImpl.java | 27 zhang-content/src/main/java/com/ruoyi/service/ZfEquipDownloadService.java | 2 zhang-content/src/main/java/com/ruoyi/service/ZfPetSharService.java | 2 zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorDownloadServiceImpl.java | 27 zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventShareServiceImpl.java | 54 + zhang-content/src/main/java/com/ruoyi/service/ZHonorShareService.java | 3 ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorController.java | 11 ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelCountController.java | 12 zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java | 10 zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipDownloadServiceImpl.java | 27 zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java | 27 zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyDownlServiceImpl.java | 27 zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyDownloadServiceImpl.java | 25 zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipShareServiceImpl.java | 55 + zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountDownServiceImpl.java | 27 ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSelfNoteShareController.java | 10 zhang-content/src/main/java/com/ruoyi/service/ZfCleanDownloadService.java | 2 zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java | 7 zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanServiceImpl.java | 10 zhang-content/src/main/java/com/ruoyi/service/ZfCollectionDownloadService.java | 2 zhang-content/src/main/java/com/ruoyi/service/impl/ZPropertyDownloadServiceImpl.java | 26 zhang-content/src/main/java/com/ruoyi/service/impl/ZIdeaDownloadServiceImpl.java | 25 zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java | 10 zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionShaServiceImpl.java | 48 + zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetSharServiceImpl.java | 127 ++- zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java | 11 zhang-content/src/main/java/com/ruoyi/service/ZfContactShraService.java | 1 zhang-content/src/main/java/com/ruoyi/service/ZSelfNoteDownloadService.java | 2 zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetDownServiceImpl.java | 27 zhang-content/src/main/java/com/ruoyi/service/ZSelfNoteShareService.java | 2 zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteShareServiceImpl.java | 51 + zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactServiceImpl.java | 9 zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanShareServiceImpl.java | 47 + zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java | 51 + ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventShareController.java | 2 zhang-content/src/main/java/com/ruoyi/service/ZfCollectionShareService.java | 1 zhang-content/src/main/java/com/ruoyi/service/impl/ZSecretShareServiceImpl.java | 47 + ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZIdeaController.java | 14 zhang-content/src/main/java/com/ruoyi/service/ZfContactDownlService.java | 2 zhang-content/src/main/java/com/ruoyi/service/ZfEventDownloadService.java | 2 zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorShareServiceImpl.java | 50 + zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailServiceImpl.java | 25 zhang-content/src/main/java/com/ruoyi/service/IZfPropertyDownloadService.java | 2 zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionDownlServiceImpl.java | 25 zhang-content/src/main/java/com/ruoyi/service/impl/ZIdeaShareServiceImpl.java | 50 + zhang-content/src/main/java/com/ruoyi/service/IZfPropertyShareService.java | 2 83 files changed, 1,457 insertions(+), 272 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelCountController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelCountController.java index 3f68808..617b656 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelCountController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelCountController.java @@ -12,7 +12,10 @@ import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.domain.TravelCount; +import com.ruoyi.service.TravelCountDownlService; import com.ruoyi.service.TravelCountService; +import com.ruoyi.service.TravelCountSharService; +import com.ruoyi.service.TravelDetailSharService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -41,6 +44,12 @@ @Autowired private TravelCountService travelCountService; + + @Autowired + private TravelCountDownlService travelCountDownlService; + + @Autowired + private TravelCountSharService travelCountSharService; @GetMapping("/all") public AjaxResult listAll(TravelCount travelCount, String happenStartTime, String happenEndTime) throws ParseException { @@ -134,6 +143,9 @@ @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { + if (! (travelCountDownlService.deleteData(ids) && travelCountSharService.deleteByContentId(ids) ) ){ + return AjaxResult.error(); + } travelCountService.removeData(Arrays.asList(ids)); return AjaxResult.success(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelDetailController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelDetailController.java index aaaaa1b..36f07d5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelDetailController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelDetailController.java @@ -3,6 +3,8 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.TravelDetail; +import com.ruoyi.service.TravelCountSharService; +import com.ruoyi.service.TravelDetailDownlService; import com.ruoyi.service.TravelDetailService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -25,6 +27,12 @@ @Autowired TravelDetailService travelDetailService; + + @Autowired + TravelDetailDownlService travelDetailDownlService; + + @Autowired + TravelCountSharService travelCountSharService; @GetMapping("/{cid}") public AjaxResult getDataByCid(@PathVariable("cid") Long cid,TravelDetail travelDetail){ @@ -55,6 +63,9 @@ @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { + if (! (travelDetailDownlService.deleteData(ids) && travelCountSharService.deleteByContentId(ids) ) ){ + return AjaxResult.error(); + } travelDetailService.removeByIds(Arrays.asList(ids)); return AjaxResult.success(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorController.java index 6e909fe..e946234 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorController.java @@ -11,7 +11,9 @@ import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.domain.ZHonor; +import com.ruoyi.service.ZHonorDownloadService; import com.ruoyi.service.ZHonorService; +import com.ruoyi.service.ZHonorShareService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -39,6 +41,12 @@ public class ZHonorController extends BaseController { @Autowired private ZHonorService zHonorService; + + @Autowired + private ZHonorDownloadService zHonorDownloadService; + + @Autowired + private ZHonorShareService zHonorShareService; /** * 鏌ヨ鎵�鏈夎褰� @@ -128,6 +136,9 @@ @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { + if (! (zHonorDownloadService.deleteData(ids) && zHonorShareService.deleteByContentId(ids) ) ){ + return AjaxResult.error(); + } return toAjax(zHonorService.removeByIds(Arrays.asList(ids))); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZIdeaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZIdeaController.java index ff7e7a5..efb67bd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZIdeaController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZIdeaController.java @@ -9,7 +9,10 @@ import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.domain.ZIdea; +import com.ruoyi.service.ZIdeaDownloadService; import com.ruoyi.service.ZIdeaService; +import com.ruoyi.service.ZIdeaShareService; +import com.ruoyi.service.ZPropertyDownloadService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -38,6 +41,13 @@ @Autowired private ZIdeaService zIdeaService; + + @Autowired + private ZIdeaDownloadService zIdeaDownloadService; + + @Autowired + private ZIdeaShareService zIdeaShareService; + /** * 鏌ヨ鎵�鏈夎褰� @@ -132,6 +142,10 @@ @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { + + if (! (zIdeaDownloadService.deleteData(ids) && zIdeaShareService.deleteByContentId(ids) ) ){ + return AjaxResult.error(); + } return toAjax(zIdeaService.removeByIds(Arrays.asList(ids))); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZPropertyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZPropertyController.java index 1aacbf0..f8f393f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZPropertyController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZPropertyController.java @@ -10,7 +10,9 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.domain.ZProperty; import com.ruoyi.domain.ZfEconomy; +import com.ruoyi.service.ZPropertyDownloadService; import com.ruoyi.service.ZPropertyService; +import com.ruoyi.service.ZPropertyShareService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -38,6 +40,12 @@ public class ZPropertyController extends BaseController { @Autowired private ZPropertyService zPropertyService; + + @Autowired + private ZPropertyDownloadService zPropertyDownloadService; + + @Autowired + private ZPropertyShareService zPropertyShareService; /** * 鏌ヨ鎵�鏈夎褰� @@ -137,6 +145,9 @@ @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { + if (! (zPropertyDownloadService.deleteData(ids) && zPropertyShareService.deleteByContentId(ids) ) ){ + return AjaxResult.error(); + } return toAjax(zPropertyService.removeByIds(Arrays.asList(ids))); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSecretController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSecretController.java index 9ceeac3..c75e147 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSecretController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSecretController.java @@ -9,7 +9,9 @@ import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.domain.ZSecret; +import com.ruoyi.service.ZSecretDownloadService; import com.ruoyi.service.ZSecretService; +import com.ruoyi.service.ZSecretShareService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -37,6 +39,12 @@ public class ZSecretController extends BaseController { @Autowired private ZSecretService zSecretService; + + @Autowired + private ZSecretShareService zSecretShareService; + + @Autowired + private ZSecretDownloadService zSecretDownloadService; /** * 鏌ヨ鎵�鏈夎褰� @@ -136,6 +144,9 @@ @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { + if (! (zSecretDownloadService.deleteData(ids) && zSecretShareService.deleteByContentId(ids) ) ){ + return AjaxResult.error(); + } return toAjax(zSecretService.removeByIds(Arrays.asList(ids))); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSelfNoteController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSelfNoteController.java index c998d5d..f1c76e1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSelfNoteController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSelfNoteController.java @@ -9,12 +9,15 @@ import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.domain.ZSelfNote; +import com.ruoyi.service.ZSelfNoteDownloadService; import com.ruoyi.service.ZSelfNoteService; +import com.ruoyi.service.ZSelfNoteShareService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.websocket.server.PathParam; import java.util.Arrays; @@ -38,6 +41,13 @@ public class ZSelfNoteController extends BaseController { @Autowired private ZSelfNoteService zSelfNoteService; + + @Autowired + private ZSelfNoteShareService zSelfNoteShareService; + + @Autowired + private ZSelfNoteDownloadService zSelfNoteDownloadService; + /** * 鏌ヨ鎵�鏈夎褰� @@ -132,6 +142,9 @@ @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { + if (! (zSelfNoteDownloadService.deleteData(ids) && zSelfNoteShareService.deleteByContentId(ids) ) ){ + return AjaxResult.error(); + } return toAjax(zSelfNoteService.removeByIds(Arrays.asList(ids))); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSelfNoteShareController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSelfNoteShareController.java index a5c8a15..a472284 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSelfNoteShareController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSelfNoteShareController.java @@ -26,7 +26,7 @@ @PostMapping("/share") public AjaxResult share(@RequestBody ShareMore zfDoctor){ - zfDoctor.setSysMenuId(2062L); + zfDoctor.setSysMenuId(2010L); return zSelfNoteShareService.saveZa(zfDoctor); } @@ -35,7 +35,7 @@ */ @PostMapping("/getInfoByUserId") public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){ - zfDoctor.setSysMenuId(2062L); + zfDoctor.setSysMenuId(2010L); Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); return zSelfNoteShareService.listByFidAid(zfDoctor,pageNo,pageSize) ; @@ -55,7 +55,7 @@ */ @PostMapping("/deleteInfoByUserId") public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){ - zfDoctor.setSysMenuId(2062L); + zfDoctor.setSysMenuId(2010L); return zSelfNoteShareService.deleteZa(zfDoctor); } @@ -64,7 +64,7 @@ */ @PostMapping("/downloadDate") public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){ - zfDownload.setSysMenuId(2062L); + zfDownload.setSysMenuId(2010L); return zSelfNoteDownloadService.addData(zfDownload); } @@ -73,7 +73,7 @@ */ @GetMapping("/all") public AjaxResult data(ZfDownload zfDownload){ - zfDownload.setSysMenuId(2062L); + zfDownload.setSysMenuId(2010L); Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); return zSelfNoteDownloadService.selectDoctorList(zfDownload,pageNo ,pageSize); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventShareController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventShareController.java index 4d0bd76..b1e9860 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventShareController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventShareController.java @@ -1,8 +1,10 @@ package com.ruoyi.web.controller.zhang; +import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.domain.ShareMore; import com.ruoyi.domain.ZfDownload; diff --git a/zhang-content/src/main/java/com/ruoyi/service/IZfPropertyDownloadService.java b/zhang-content/src/main/java/com/ruoyi/service/IZfPropertyDownloadService.java index 8610bf1..2b1378b 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/IZfPropertyDownloadService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/IZfPropertyDownloadService.java @@ -7,7 +7,7 @@ public interface IZfPropertyDownloadService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); - AjaxResult deleteData(Long[] ids); + Boolean deleteData(Long[] ids); AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/IZfPropertyShareService.java b/zhang-content/src/main/java/com/ruoyi/service/IZfPropertyShareService.java index 1f39965..0ada2e2 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/IZfPropertyShareService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/IZfPropertyShareService.java @@ -22,4 +22,6 @@ AjaxResult listUserId(Integer pageNo ,Integer pageSize); Long getShareId(ZfDownload zfDownload); + + Boolean deleteByContentId(Long[] ids); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/TravelCountDownlService.java b/zhang-content/src/main/java/com/ruoyi/service/TravelCountDownlService.java index e87cc77..475e2a7 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/TravelCountDownlService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/TravelCountDownlService.java @@ -9,7 +9,7 @@ public interface TravelCountDownlService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); - AjaxResult deleteData(Long[] ids); + Boolean deleteData(Long[] ids); AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); diff --git a/zhang-content/src/main/java/com/ruoyi/service/TravelCountSharService.java b/zhang-content/src/main/java/com/ruoyi/service/TravelCountSharService.java index 21db45a..5576e1f 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/TravelCountSharService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/TravelCountSharService.java @@ -26,4 +26,7 @@ Long getShareId(ZfDownload zfDownload); + Boolean deleteByContentId(Long[] ids); + + } diff --git a/zhang-content/src/main/java/com/ruoyi/service/TravelDetailDownlService.java b/zhang-content/src/main/java/com/ruoyi/service/TravelDetailDownlService.java index 3fbd761..3771c46 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/TravelDetailDownlService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/TravelDetailDownlService.java @@ -8,7 +8,7 @@ public interface TravelDetailDownlService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); - AjaxResult deleteData(Long[] ids); + Boolean deleteData(Long[] ids); AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); diff --git a/zhang-content/src/main/java/com/ruoyi/service/TravelDetailSharService.java b/zhang-content/src/main/java/com/ruoyi/service/TravelDetailSharService.java index 78f0f6e..a5ddf90 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/TravelDetailSharService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/TravelDetailSharService.java @@ -24,4 +24,7 @@ Long getShareId(ZfDownload zfDownload); + Boolean deleteByContentId(Long[] ids); + + } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZHonorDownloadService.java b/zhang-content/src/main/java/com/ruoyi/service/ZHonorDownloadService.java index 6f26a7b..a943627 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZHonorDownloadService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZHonorDownloadService.java @@ -7,7 +7,7 @@ public interface ZHonorDownloadService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); - AjaxResult deleteData(Long[] ids); + Boolean deleteData(Long[] ids); AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZHonorShareService.java b/zhang-content/src/main/java/com/ruoyi/service/ZHonorShareService.java index 7f3eab6..48519d7 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZHonorShareService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZHonorShareService.java @@ -22,4 +22,7 @@ AjaxResult listUserId(Integer pageNo ,Integer pageSize); Long getShareId(ZfDownload zfDownload); + + Boolean deleteByContentId(Long[] ids); + } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZIdeaDownloadService.java b/zhang-content/src/main/java/com/ruoyi/service/ZIdeaDownloadService.java index ff354d6..f840f67 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZIdeaDownloadService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZIdeaDownloadService.java @@ -7,7 +7,7 @@ public interface ZIdeaDownloadService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); - AjaxResult deleteData(Long[] ids); + Boolean deleteData(Long[] ids); AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZIdeaShareService.java b/zhang-content/src/main/java/com/ruoyi/service/ZIdeaShareService.java index adadb27..242f607 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZIdeaShareService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZIdeaShareService.java @@ -25,4 +25,7 @@ AjaxResult selectShareUserInfo(Integer user_id, Long menuId); + + Boolean deleteByContentId(Long[] ids); + } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZPropertyDownloadService.java b/zhang-content/src/main/java/com/ruoyi/service/ZPropertyDownloadService.java index 1746db7..b1379e2 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZPropertyDownloadService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZPropertyDownloadService.java @@ -7,7 +7,7 @@ public interface ZPropertyDownloadService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); - AjaxResult deleteData(Long[] ids); + Boolean deleteData(Long[] ids); AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZPropertyShareService.java b/zhang-content/src/main/java/com/ruoyi/service/ZPropertyShareService.java index 56047a8..25e1834 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZPropertyShareService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZPropertyShareService.java @@ -22,4 +22,6 @@ AjaxResult listUserId(Integer pageNo ,Integer pageSize); Long getShareId(ZfDownload zfDownload); + + Boolean deleteByContentId(Long[] ids); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZSecretDownloadService.java b/zhang-content/src/main/java/com/ruoyi/service/ZSecretDownloadService.java index d92081a..16e2c27 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZSecretDownloadService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZSecretDownloadService.java @@ -7,7 +7,7 @@ public interface ZSecretDownloadService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); - AjaxResult deleteData(Long[] ids); + Boolean deleteData(Long[] ids); AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZSecretShareService.java b/zhang-content/src/main/java/com/ruoyi/service/ZSecretShareService.java index 3f12848..ccf542a 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZSecretShareService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZSecretShareService.java @@ -22,4 +22,7 @@ AjaxResult listUserId(Integer pageNo ,Integer pageSize); Long getShareId(ZfDownload zfDownload); + + Boolean deleteByContentId(Long[] ids); + } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZSelfNoteDownloadService.java b/zhang-content/src/main/java/com/ruoyi/service/ZSelfNoteDownloadService.java index 5997917..0130fe7 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZSelfNoteDownloadService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZSelfNoteDownloadService.java @@ -7,7 +7,7 @@ public interface ZSelfNoteDownloadService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); - AjaxResult deleteData(Long[] ids); + Boolean deleteData(Long[] ids); AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZSelfNoteShareService.java b/zhang-content/src/main/java/com/ruoyi/service/ZSelfNoteShareService.java index b37f470..85f6e0a 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZSelfNoteShareService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZSelfNoteShareService.java @@ -22,4 +22,6 @@ AjaxResult listUserId(Integer pageNo ,Integer pageSize); Long getShareId(ZfDownload zfDownload); + + Boolean deleteByContentId(Long[] ids); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfCleanDownloadService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfCleanDownloadService.java index 0cd6a63..c3b78e3 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfCleanDownloadService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfCleanDownloadService.java @@ -8,7 +8,7 @@ public interface ZfCleanDownloadService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); - AjaxResult deleteData(Long[] ids); + Boolean deleteData(Long[] ids); AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfCleanShareService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfCleanShareService.java index 3486ac6..37ce3ee 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfCleanShareService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfCleanShareService.java @@ -26,4 +26,5 @@ Long getShareId(ZfDownload zfDownload); + Boolean deleteByContentId(Long[] ids); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfCollectionDownloadService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfCollectionDownloadService.java index 9ec9328..ba6cec5 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfCollectionDownloadService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfCollectionDownloadService.java @@ -8,7 +8,7 @@ public interface ZfCollectionDownloadService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); - AjaxResult deleteData(Long[] ids); + Boolean deleteData(Long[] ids); AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfCollectionShareService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfCollectionShareService.java index 9e96927..43a0d83 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfCollectionShareService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfCollectionShareService.java @@ -26,4 +26,5 @@ Long getShareId(ZfDownload zfDownload); + Boolean deleteByContentId(Long[] ids); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfContactDownlService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfContactDownlService.java index 975a3be..d5b50f8 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfContactDownlService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfContactDownlService.java @@ -8,7 +8,7 @@ public interface ZfContactDownlService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); - AjaxResult deleteData(Long[] ids); + Boolean deleteData(Long[] ids); AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfContactShraService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfContactShraService.java index 5caed30..7d4f6d4 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfContactShraService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfContactShraService.java @@ -26,4 +26,5 @@ Long getShareId(ZfDownload zfDownload); + Boolean deleteByContentId(Long[] ids); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java index 05129a0..2857f25 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java @@ -8,7 +8,7 @@ public interface ZfDoctorDownloadService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); - AjaxResult deleteData(Long[] ids); + Boolean deleteData(Long[] ids); AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java index e5a3de5..b69cbe7 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java @@ -24,5 +24,5 @@ Long getShareId(ZfDownload zfDownload); - + Boolean deleteByContentId(Long[] ids); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfEconomyDownlService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfEconomyDownlService.java index 3e54420..d55ab68 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfEconomyDownlService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfEconomyDownlService.java @@ -8,7 +8,7 @@ public interface ZfEconomyDownlService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); - AjaxResult deleteData(Long[] ids); + Boolean deleteData(Long[] ids); AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfEconomyShaService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfEconomyShaService.java index d0f0abd..08f4f94 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfEconomyShaService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfEconomyShaService.java @@ -27,4 +27,6 @@ Long getShareId(ZfDownload zfDownload); + Boolean deleteByContentId(Long[] ids); + } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfEquipDownloadService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfEquipDownloadService.java index 8a1fdb9..84a0128 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfEquipDownloadService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfEquipDownloadService.java @@ -8,7 +8,7 @@ public interface ZfEquipDownloadService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); - AjaxResult deleteData(Long[] ids); + Boolean deleteData(Long[] ids); AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfEquipShareService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfEquipShareService.java index cf21f04..dc4ac22 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfEquipShareService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfEquipShareService.java @@ -27,4 +27,6 @@ Long getShareId(ZfDownload zfDownload); + Boolean deleteByContentId(Long[] ids); + } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfEventDownloadService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfEventDownloadService.java index f0d130a..077afea 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfEventDownloadService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfEventDownloadService.java @@ -7,7 +7,7 @@ public interface ZfEventDownloadService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); - AjaxResult deleteData(Long[] ids); + Boolean deleteData(Long[] ids); AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfEventShareService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfEventShareService.java index f3ab8d2..a3e9c73 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfEventShareService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfEventShareService.java @@ -22,4 +22,6 @@ AjaxResult listUserId(Integer pageNo ,Integer pageSize); Long getShareId(ZfDownload zfDownload); + + Boolean deleteByContentId(Long[] ids); } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfPetDownlService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfPetDownlService.java index e63bc0b..45a298f 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfPetDownlService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfPetDownlService.java @@ -8,7 +8,7 @@ public interface ZfPetDownlService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); - AjaxResult deleteData(Long[] ids); + Boolean deleteData(Long[] ids); AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfPetSharService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfPetSharService.java index 9283a21..9b69e34 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfPetSharService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfPetSharService.java @@ -27,4 +27,6 @@ Long getShareId(ZfDownload zfDownload); + Boolean deleteByContentId(Long[] ids); + } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyDownloadServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyDownloadServiceImpl.java index 51d6644..0c4429f 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyDownloadServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyDownloadServiceImpl.java @@ -94,14 +94,27 @@ } @Override - public AjaxResult deleteData(Long[] ids) { - List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + public Boolean deleteData(Long[] ids) { + List<Long> id = new ArrayList<>(); - if (iZfPropertyShareService.removeByIds(Arrays.asList(ids))) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfDownload::getDownloadContent, ids) + .eq(ZfDownload::getSysMenuId, 2002L); + + List<ZfDownload> zfDownloads = list(lqw); + System.out.println("111111111111111111111111111111111111111111111111111111"+zfDownloads); + if (zfDownloads.size() == 0){ + return true; + } + for (ZfDownload zfDownload: zfDownloads) { + id.add(zfDownload.getId()); + } + + if (removeByIds(id)) { //鍒犻櫎es涓殑鏁版嵁 zfDownloads.stream().forEach(zfDoctorDownload -> { - EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "瀹跺涵灏忓尰鐢熶笅杞�"); + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "瀹跺涵璧勪骇绠$悊鍒犻櫎"); if (esModel != null) { DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); @@ -112,9 +125,9 @@ } } }); - return AjaxResult.success(); + return true; } else { - return AjaxResult.error(); + return false; } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java index 0c73e22..0903b1e 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java @@ -65,6 +65,12 @@ @Resource RestHighLevelClient restHighLevelClient; + @Resource + private IZfPropertyDownloadService zfPropertyDownloadService; + + @Resource + private IZfPropertyShareService iZfPropertyShareService; + // private LambdaQueryWrapper<ZfProperty> buildCondition(ZfProperty zfProperty) { // LambdaQueryWrapper<ZfProperty> lqw = new LambdaQueryWrapper<>(); @@ -567,6 +573,9 @@ List<ZfProperty> zfPropertys = listByIds(Arrays.asList(ids)); + if (! (zfPropertyDownloadService.deleteData(ids) && iZfPropertyShareService.deleteByContentId(ids) ) ){ + return AjaxResult.error(); + } if (zfPropertyService.removeByIds(Arrays.asList(ids))) { //鍒犻櫎es涓殑鏁版嵁 @@ -581,6 +590,8 @@ throw new RuntimeException(e); }} }); + System.out.println("15165132165346153246153"); + return AjaxResult.success(); }else { return AjaxResult.error(); diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyShareServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyShareServiceImpl.java index f4dd082..b6e251a 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyShareServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyShareServiceImpl.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; @@ -31,6 +36,12 @@ @Resource private ZInfoUserService zInfoUserService; + + @Resource + private RestHighLevelClient restHighLevelClient; + + @Resource + EsService esService; private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); @@ -187,4 +198,42 @@ return null; } } + + @Override + public Boolean deleteByContentId(Long[] ids) { + System.out.println("5555555555555555555555555555555555555555555555555555555555555555"); + List<Long> id = new ArrayList<>(); + + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfShare::getShareContent, ids) + .eq(ZfShare::getSysMenuId, 2002L); + + 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; + } + } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountDownServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountDownServiceImpl.java index a997596..d44a52b 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountDownServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountDownServiceImpl.java @@ -115,14 +115,29 @@ } @Override - public AjaxResult deleteData(Long[] ids) { - List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + public Boolean deleteData(Long[] ids) { + List<Long> id = new ArrayList<>(); - if (travelCountService.removeByIds(Arrays.asList(ids))) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfDownload::getDownloadContent, ids) + .eq(ZfDownload::getSysMenuId, 2056L); + + List<ZfDownload> zfDownloads = list(lqw); + System.out.println(zfDownloads); + if (zfDownloads.size() == 0){ + return true; + } + for (ZfDownload zfDownload: zfDownloads) { + id.add(zfDownload.getId()); + } + + System.out.println(id); + + if (removeByIds(id)) { //鍒犻櫎es涓殑鏁版嵁 zfDownloads.stream().forEach(zfDoctorDownload -> { - EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "閫氳褰曚笅杞�"); + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "鏃呮父缁熻琛ㄤ笅杞藉垹闄�"); if (esModel != null) { DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); @@ -133,9 +148,9 @@ } } }); - return AjaxResult.success(); + return true; } else { - return AjaxResult.error(); + return false; } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountSharServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountSharServiceImpl.java index f602551..b2c65b2 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountSharServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountSharServiceImpl.java @@ -5,6 +5,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; @@ -13,9 +14,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; @@ -37,6 +42,12 @@ @Resource TravelDetailService travelDetailService; + + @Resource + private RestHighLevelClient restHighLevelClient; + + @Resource + EsService esService; private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); @@ -232,4 +243,41 @@ 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, 2056L); + + 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; + } + } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailDownServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailDownServiceImpl.java index 9dfafed..72e51a4 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailDownServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailDownServiceImpl.java @@ -109,14 +109,29 @@ @Override - public AjaxResult deleteData(Long[] ids) { - List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + public Boolean deleteData(Long[] ids) { + List<Long> id = new ArrayList<>(); - if (travelDetailService.removeByIds(Arrays.asList(ids))) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfDownload::getDownloadContent, ids) + .eq(ZfDownload::getSysMenuId, 2055L); + + List<ZfDownload> zfDownloads = list(lqw); + System.out.println(zfDownloads); + if (zfDownloads.size() == 0){ + return true; + } + for (ZfDownload zfDownload: zfDownloads) { + id.add(zfDownload.getId()); + } + + System.out.println(id); + + if (removeByIds(id)) { //鍒犻櫎es涓殑鏁版嵁 zfDownloads.stream().forEach(zfDoctorDownload -> { - EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "閫氳褰曚笅杞�"); + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "鏃呮父璐圭敤琛ㄤ笅杞藉垹闄�"); if (esModel != null) { DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); @@ -127,9 +142,9 @@ } } }); - return AjaxResult.success(); + return true; } else { - return AjaxResult.error(); + return false; } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailServiceImpl.java index bc7e65a..cf3ae99 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailServiceImpl.java @@ -3,13 +3,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ruoyi.domain.TravelCount; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.TravelDetail; -import com.ruoyi.domain.ZfCollection; import com.ruoyi.mapper.TravelDetailMapper; +import com.ruoyi.service.TravelDetailDownlService; import com.ruoyi.service.TravelDetailService; +import com.ruoyi.service.TravelDetailSharService; import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; /** @@ -22,6 +25,11 @@ */ @Service public class TravelDetailServiceImpl extends ServiceImpl<TravelDetailMapper, TravelDetail> implements TravelDetailService { + @Resource + private TravelDetailDownlService travelDetailDownlService; + + @Resource + private TravelDetailSharService travelDetailSharService; @Override public List<TravelDetail> getDataByCid(Long cid,TravelDetail travelDetail) { @@ -43,11 +51,24 @@ @Override public void removeBatchByCid(List<Long> cid) { + List<TravelDetail> lqw1 = new ArrayList<>(); + + for (Long c : cid) { LambdaQueryWrapper<TravelDetail> lqw = new LambdaQueryWrapper<>(); lqw.eq(TravelDetail::getCid,c); + lqw1.addAll(list(lqw)); remove(lqw); } + if (lqw1.size() == 0) return; + Long[] id = new Long[lqw1.size()]; + for (int i = 0; i < lqw1.size(); i++) { + id[i] = lqw1.get(i).getId(); + } + travelDetailDownlService.deleteData(id) ; + travelDetailSharService.deleteByContentId(id) ; + + } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailSharServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailSharServiceImpl.java index 7c38c96..b623013 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailSharServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailSharServiceImpl.java @@ -5,6 +5,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; @@ -13,9 +14,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; @@ -33,6 +38,11 @@ @Resource TravelCountSharService travelCountSharService; + @Resource + private RestHighLevelClient restHighLevelClient; + + @Resource + EsService esService; private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); @@ -201,4 +211,41 @@ 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, 2055L); + + 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; + } + } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorDownloadServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorDownloadServiceImpl.java index 1fef431..62239ac 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorDownloadServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorDownloadServiceImpl.java @@ -96,14 +96,29 @@ } @Override - public AjaxResult deleteData(Long[] ids) { - List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + public Boolean deleteData(Long[] ids) { + List<Long> id = new ArrayList<>(); - if (zHonorShareService.removeByIds(Arrays.asList(ids))) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfDownload::getDownloadContent, ids) + .eq(ZfDownload::getSysMenuId, 2030L); + + List<ZfDownload> zfDownloads = list(lqw); + System.out.println(zfDownloads); + if (zfDownloads.size() == 0){ + return true; + } + for (ZfDownload zfDownload: zfDownloads) { + id.add(zfDownload.getId()); + } + + System.out.println(id); + + if (removeByIds(id)) { //鍒犻櫎es涓殑鏁版嵁 zfDownloads.stream().forEach(zfDoctorDownload -> { - EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "璇佷功鑽h��璧勮川涓嬭浇"); + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "璇佷功鑽h��璧勮川涓嬭浇鍒犻櫎"); if (esModel != null) { DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); @@ -114,9 +129,9 @@ } } }); - return AjaxResult.success(); + return true; } else { - return AjaxResult.error(); + return false; } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorShareServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorShareServiceImpl.java index 27c972d..8bc943c 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorShareServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorShareServiceImpl.java @@ -5,6 +5,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.domain.*; import com.ruoyi.mapper.ZfShareMapper; import com.ruoyi.service.*; +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; @@ -29,6 +34,12 @@ @Resource private ZInfoUserService zInfoUserService; + + @Resource + private RestHighLevelClient restHighLevelClient; + + @Resource + EsService esService; private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); @@ -138,7 +149,7 @@ HashMap<Long,List<ZHonor>> bs = new HashMap<>(); LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); lqw.eq(ZfShare::getShareId,getUserId()); - lqw.eq(ZfShare::getSysMenuId,2053L); + lqw.eq(ZfShare::getSysMenuId,2030L); List<ZfShare> beanRecords = list(lqw); List<ZHonor> b1 = new ArrayList<>(); for (ZfShare beanRecord : beanRecords ) { @@ -154,7 +165,7 @@ List<ZHonor> bs = new ArrayList<>(); LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); lqw.eq(ZfShare::getShareId,getUserId()); - lqw.eq(ZfShare::getSysMenuId,2053L); + lqw.eq(ZfShare::getSysMenuId,2030L); List<ZfShare> beanRecords = list(lqw); for (ZfShare beanRecord : beanRecords ) { ZHonor bs2 = zHonorService.getById(beanRecord.getShareContent()); @@ -185,7 +196,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, 2030L); + + 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; + } + } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZIdeaDownloadServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZIdeaDownloadServiceImpl.java index 8afb8b2..d25e779 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZIdeaDownloadServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZIdeaDownloadServiceImpl.java @@ -95,10 +95,25 @@ } @Override - public AjaxResult deleteData(Long[] ids) { - List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + public Boolean deleteData(Long[] ids) { - if (zIdeaShareService.removeByIds(Arrays.asList(ids))) { + List<Long> id = new ArrayList<>(); + + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfDownload::getDownloadContent, ids) + .eq(ZfDownload::getSysMenuId, 2027L); + + List<ZfDownload> zfDownloads = list(lqw); + System.out.println(zfDownloads); + if (zfDownloads.size() == 0){ + return true; + } + for (ZfDownload zfDownload: zfDownloads) { + id.add(zfDownload.getId()); + } + + System.out.println(id); + if (removeByIds(id)) { //鍒犻櫎es涓殑鏁版嵁 zfDownloads.stream().forEach(zfDoctorDownload -> { @@ -113,9 +128,9 @@ } } }); - return AjaxResult.success(); + return true; } else { - return AjaxResult.error(); + return false; } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZIdeaShareServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZIdeaShareServiceImpl.java index 48ab898..b80f54a 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZIdeaShareServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZIdeaShareServiceImpl.java @@ -5,19 +5,22 @@ 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; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.domain.*; import com.ruoyi.mapper.ZfShareMapper; +import com.ruoyi.service.*; import com.ruoyi.service.ZIdeaShareService; -import com.ruoyi.service.ZInfoUserService; -import com.ruoyi.service.ZIdeaService; -import com.ruoyi.service.ZIdeaShareService; +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; @@ -33,6 +36,12 @@ private ZfShareMapper zfShareMapper; @Resource private ZInfoUserService zInfoUserService; + + @Resource + private RestHighLevelClient restHighLevelClient; + + @Resource + EsService esService; private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); @@ -197,5 +206,40 @@ return AjaxResult.success(zInfoUsers); } + @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, 2027L); + + 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; + } + } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZPropertyDownloadServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZPropertyDownloadServiceImpl.java index d8519b2..45a0673 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZPropertyDownloadServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZPropertyDownloadServiceImpl.java @@ -95,14 +95,28 @@ } @Override - public AjaxResult deleteData(Long[] ids) { - List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + public Boolean deleteData(Long[] ids) { + List<Long> id = new ArrayList<>(); - if (zPropertyShareService.removeByIds(Arrays.asList(ids))) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfDownload::getDownloadContent, ids) + .eq(ZfDownload::getSysMenuId, 2026L); + + List<ZfDownload> zfDownloads = list(lqw); + System.out.println(zfDownloads); + if (zfDownloads.size() == 0){ + return true; + } + for (ZfDownload zfDownload: zfDownloads) { + id.add(zfDownload.getId()); + } + + System.out.println(id); + if (removeByIds(id) ){ //鍒犻櫎es涓殑鏁版嵁 zfDownloads.stream().forEach(zfDoctorDownload -> { - EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "涓汉璐骇涓嬭浇"); + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "涓汉璐骇涓嬭浇鍒犻櫎"); if (esModel != null) { DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); @@ -113,9 +127,9 @@ } } }); - return AjaxResult.success(); + return true; } else { - return AjaxResult.error(); + return false; } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZPropertyShareServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZPropertyShareServiceImpl.java index bde7ff2..206839f 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZPropertyShareServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZPropertyShareServiceImpl.java @@ -4,20 +4,23 @@ 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; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.domain.*; import com.ruoyi.mapper.ZfShareMapper; -import com.ruoyi.service.ZPropertyService; -import com.ruoyi.service.ZPropertyShareService; -import com.ruoyi.service.ZInfoUserService; +import com.ruoyi.service.*; import com.ruoyi.service.ZPropertyShareService; 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; @@ -27,13 +30,19 @@ @Service public class ZPropertyShareServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements ZPropertyShareService { - @Resource ZPropertyService zPropertyService; @Resource private ZInfoUserService zInfoUserService; + + @Resource + private RestHighLevelClient restHighLevelClient; + + @Resource + EsService esService; + private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); @@ -49,26 +58,24 @@ Long userId = user.getUserId(); LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfShare::getShareId,userId); + lqw.eq(ZfShare::getShareId, userId); return list(lqw); } - public Long getUserId(){ + public Long getUserId() { ZInfoUser myself = zInfoUserService.getMyself(); return myself.getUserId(); } - public void addData(ZfShare za) - { + public void addData(ZfShare za) { LambdaQueryWrapper<ZfShare> lqw = uniqueCondition(za); List<ZfShare> list = list(lqw); - if(list.size()>0){ + if (list.size() > 0) { throw new RuntimeException("璇峰嬁鍒嗕韩閲嶅鏁版嵁"); - } - else { + } else { save(za); } @@ -76,8 +83,8 @@ @Override public AjaxResult saveZa(ShareMore shareMore) { - Long [] shareIds = shareMore.getShareIds(); - Long [] shareContents = shareMore.getShareContents(); + Long[] shareIds = shareMore.getShareIds(); + Long[] shareContents = shareMore.getShareContents(); for (Long shareId : shareIds) { for (Long shareContent : shareContents) { ZfShare za = new ZfShare(); @@ -95,39 +102,38 @@ @Override public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { - Long [] shareIds = shareMore.getShareIds(); + Long[] shareIds = shareMore.getShareIds(); List<ZProperty> beanRecord3 = new ArrayList<>(); for (Long shareId : shareIds) { { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfShare::getShareId,shareId) - .eq(ZfShare::getSysMenuId,shareMore.getSysMenuId()) + lqw.eq(ZfShare::getShareId, shareId) + .eq(ZfShare::getSysMenuId, shareMore.getSysMenuId()) .eq(ZfShare::getUserId, getUserId()); List<ZfShare> beanRecords = list(lqw); - for (ZfShare beanRecord : beanRecords ) { + for (ZfShare beanRecord : beanRecords) { beanRecord3.add(zPropertyService.getById(beanRecord.getShareContent())); } } } - List<ZProperty> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + List<ZProperty> record = beanRecord3.stream().skip((pageNo - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); - int totalPage = (beanRecord3.size() -1) / pageSize +1; + int totalPage = (beanRecord3.size() - 1) / pageSize + 1; - Page<ZProperty> zPropertyPage = new Page<>(pageNo, pageSize,totalPage); - HashMap<String, Object> data = MapUtils.getShareResult(zPropertyPage, record,beanRecord3.size()); + Page<ZProperty> zPropertyPage = new Page<>(pageNo, pageSize, totalPage); + HashMap<String, Object> data = MapUtils.getShareResult(zPropertyPage, record, beanRecord3.size()); return AjaxResult.success(data); } @Override public AjaxResult deleteZa(ShareMore shareMore) { - Long [] shareIds = shareMore.getShareIds(); - Long [] shareContents = shareMore.getShareContents(); - for(Long shareId : shareIds) - for(Long shareContent: shareContents) - { + Long[] shareIds = shareMore.getShareIds(); + Long[] shareContents = shareMore.getShareContents(); + for (Long shareId : shareIds) + for (Long shareContent : shareContents) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfShare::getShareId,shareId) + lqw.eq(ZfShare::getShareId, shareId) .eq(ZfShare::getShareContent, shareContent) .eq(ZfShare::getSysMenuId, shareMore.getSysMenuId()) .eq(ZfShare::getUserId, getUserId()); @@ -140,15 +146,15 @@ @Override public AjaxResult listByUserId() { - HashMap<Long,List<ZProperty>> bs = new HashMap<>(); + HashMap<Long, List<ZProperty>> bs = new HashMap<>(); LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfShare::getShareId,getUserId()); - lqw.eq(ZfShare::getSysMenuId,2026L); + lqw.eq(ZfShare::getShareId, getUserId()); + lqw.eq(ZfShare::getSysMenuId, 2026L); List<ZfShare> beanRecords = list(lqw); List<ZProperty> b1 = new ArrayList<>(); - for (ZfShare beanRecord : beanRecords ) { + for (ZfShare beanRecord : beanRecords) { b1.add(zPropertyService.getById(beanRecord.getShareContent())); - bs.put(beanRecord.getUserId(),b1); + bs.put(beanRecord.getUserId(), b1); } log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs); return AjaxResult.success(bs); @@ -156,23 +162,23 @@ @Override public AjaxResult listUserId(Integer pageNo, Integer pageSize) { - List<ZProperty> bs = new ArrayList<>(); + List<ZProperty> bs = new ArrayList<>(); LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfShare::getShareId,getUserId()); - lqw.eq(ZfShare::getSysMenuId,2026L); + lqw.eq(ZfShare::getShareId, getUserId()); + lqw.eq(ZfShare::getSysMenuId, 2026L); List<ZfShare> beanRecords = list(lqw); - for (ZfShare beanRecord : beanRecords ) { + for (ZfShare beanRecord : beanRecords) { ZProperty bs2 = zPropertyService.getById(beanRecord.getShareContent()); bs2.setShareId(beanRecord.getUserId().intValue()); bs.add(bs2); } log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs); - List<ZProperty> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + List<ZProperty> record = bs.stream().skip((pageNo - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); - int totalPage = (bs.size() -1) / pageSize +1; + int totalPage = (bs.size() - 1) / pageSize + 1; - Page<ZProperty> zPropertyPage = new Page<>(pageNo, pageSize,totalPage); - HashMap<String, Object> data = MapUtils.getShareResult(zPropertyPage, record,bs.size()); + Page<ZProperty> zPropertyPage = new Page<>(pageNo, pageSize, totalPage); + HashMap<String, Object> data = MapUtils.getShareResult(zPropertyPage, record, bs.size()); return AjaxResult.success(data); } @@ -183,11 +189,47 @@ .eq(ZfShare::getShareContent, zfDownload.getDownloadContent()) .eq(ZfShare::getSysMenuId, zfDownload.getSysMenuId()); List<ZfShare> beanRecords = list(lqw); - if (beanRecords.size() != 0){ + if (beanRecords.size() != 0) { return beanRecords.get(0).getUserId(); - } - else { + } else { 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, 2026L); + + 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; + } + } +} \ No newline at end of file diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZSecretDownloadServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZSecretDownloadServiceImpl.java index 3bfb25d..63ab418 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZSecretDownloadServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZSecretDownloadServiceImpl.java @@ -95,14 +95,29 @@ } @Override - public AjaxResult deleteData(Long[] ids) { - List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + public Boolean deleteData(Long[] ids) { + List<Long> id = new ArrayList<>(); - if (zSecretShareService.removeByIds(Arrays.asList(ids))) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfDownload::getDownloadContent, ids) + .eq(ZfDownload::getSysMenuId, 2031L); + + List<ZfDownload> zfDownloads = list(lqw); + System.out.println(zfDownloads); + if (zfDownloads.size() == 0){ + return true; + } + for (ZfDownload zfDownload: zfDownloads) { + id.add(zfDownload.getId()); + } + + System.out.println(id); + + if (removeByIds(id)) { //鍒犻櫎es涓殑鏁版嵁 zfDownloads.stream().forEach(zfDoctorDownload -> { - EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "闅愮涓嬭浇"); + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "闅愮涓嬭浇鍒犻櫎"); if (esModel != null) { DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); @@ -113,9 +128,9 @@ } } }); - return AjaxResult.success(); + return true; } else { - return AjaxResult.error(); + return false; } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZSecretShareServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZSecretShareServiceImpl.java index 2a52012..2e2f6b8 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZSecretShareServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZSecretShareServiceImpl.java @@ -5,18 +5,24 @@ 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; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.domain.*; import com.ruoyi.mapper.ZfShareMapper; +import com.ruoyi.service.EsService; import com.ruoyi.service.ZInfoUserService; import com.ruoyi.service.ZSecretService; import com.ruoyi.service.ZSecretShareService; +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 +38,11 @@ @Resource private ZInfoUserService zInfoUserService; + @Resource + private RestHighLevelClient restHighLevelClient; + + @Resource + EsService esService; private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getShareId())), ZfShare::getShareId, zfShare.getShareId()); @@ -187,6 +198,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, 2031L); + + 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; + } + } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteDownloadServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteDownloadServiceImpl.java index 866f892..1226359 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteDownloadServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteDownloadServiceImpl.java @@ -95,14 +95,29 @@ } @Override - public AjaxResult deleteData(Long[] ids) { - List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + public Boolean deleteData(Long[] ids) { + List<Long> id = new ArrayList<>(); - if (zSelfNoteShareService.removeByIds(Arrays.asList(ids))) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfDownload::getDownloadContent, ids) + .eq(ZfDownload::getSysMenuId, 2010L); + + List<ZfDownload> zfDownloads = list(lqw); + System.out.println(zfDownloads); + if (zfDownloads.size() == 0){ + return true; + } + for (ZfDownload zfDownload: zfDownloads) { + id.add(zfDownload.getId()); + } + + System.out.println(id); + + if (removeByIds(id)) { //鍒犻櫎es涓殑鏁版嵁 zfDownloads.stream().forEach(zfDoctorDownload -> { - EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "涓汉璁颁簨鏈笅杞�"); + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "涓汉璁颁簨鏈笅杞藉垹闄�"); if (esModel != null) { DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); @@ -113,9 +128,9 @@ } } }); - return AjaxResult.success(); + return true; } else { - return AjaxResult.error(); + return false; } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteShareServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteShareServiceImpl.java index 673e8ff..6bc2da6 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteShareServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteShareServiceImpl.java @@ -5,19 +5,22 @@ 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; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.domain.*; import com.ruoyi.mapper.ZfShareMapper; -import com.ruoyi.service.ZSelfNoteService; +import com.ruoyi.service.*; import com.ruoyi.service.ZSelfNoteShareService; -import com.ruoyi.service.ZInfoUserService; -import com.ruoyi.service.ZSelfNoteShareService; +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 +35,13 @@ @Resource private ZInfoUserService zInfoUserService; + + @Resource + private RestHighLevelClient restHighLevelClient; + + @Resource + EsService esService; + private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); @@ -189,6 +199,41 @@ } } + @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, 2010L); + 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; + } + + } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanDownloadServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanDownloadServiceImpl.java index a159960..538694c 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanDownloadServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanDownloadServiceImpl.java @@ -95,14 +95,29 @@ } @Override - public AjaxResult deleteData(Long[] ids) { - List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + public Boolean deleteData(Long[] ids) { + List<Long> id = new ArrayList<>(); - if (zfCleanShareService.removeByIds(Arrays.asList(ids))) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfDownload::getDownloadContent, ids) + .eq(ZfDownload::getSysMenuId, 2020L); + + List<ZfDownload> zfDownloads = list(lqw); + System.out.println(zfDownloads); + if (zfDownloads.size() == 0){ + return true; + } + for (ZfDownload zfDownload: zfDownloads) { + id.add(zfDownload.getId()); + } + + System.out.println(id); + + if (removeByIds(id)) { //鍒犻櫎es涓殑鏁版嵁 zfDownloads.stream().forEach(zfDoctorDownload -> { - EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "淇濇磥鏀剁撼涓嬭浇"); + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "淇濇磥鏀剁撼涓嬭浇鍒犻櫎"); if (esModel != null) { DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); @@ -113,9 +128,9 @@ } } }); - return AjaxResult.success(); + return true; } else { - return AjaxResult.error(); + return false; } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanServiceImpl.java index 89172ef..43e18f0 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanServiceImpl.java @@ -62,6 +62,12 @@ @Resource RestHighLevelClient restHighLevelClient; + @Resource + ZfCleanShareService zfCleanShareService; + + @Resource + ZfCleanDownloadService zfCleanDownloadService; + private LambdaQueryWrapper<ZfClean> buildCondition(ZfClean zfClean,List<Long> familyIdList) { LambdaQueryWrapper<ZfClean> lqw = new LambdaQueryWrapper<>(); lqw.orderByDesc(ZfClean::getCreateTime); @@ -605,7 +611,9 @@ } List<ZfClean> zfCleans = listByIds(Arrays.asList(ids)); - + if (! (zfCleanDownloadService.deleteData(ids) && zfCleanShareService.deleteByContentId(ids) ) ){ + return AjaxResult.error(); + } if (zfCleanService.removeByIds(Arrays.asList(ids))) { //鍒犻櫎es涓殑鏁版嵁 diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanShareServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanShareServiceImpl.java index 26a7f64..a9b5389 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanShareServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanShareServiceImpl.java @@ -5,6 +5,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,10 +13,14 @@ import com.ruoyi.domain.*; import com.ruoyi.mapper.ZfShareMapper; import com.ruoyi.service.*; +import org.elasticsearch.action.delete.DeleteRequest; +import org.elasticsearch.client.RequestOptions; +import org.elasticsearch.client.RestHighLevelClient; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -31,6 +36,12 @@ @Resource private ZInfoUserService zInfoUserService; + + @Resource + private RestHighLevelClient restHighLevelClient; + + @Resource + EsService esService; private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); @@ -188,6 +199,42 @@ } } + @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, 2020L); + + 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; + } + } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionDownlServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionDownlServiceImpl.java index 5ec6d08..2120092 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionDownlServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionDownlServiceImpl.java @@ -94,14 +94,27 @@ } @Override - public AjaxResult deleteData(Long[] ids) { - List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + public Boolean deleteData(Long[] ids) { - if (zfCollectionShareService.removeByIds(Arrays.asList(ids))) { + List<Long> id = new ArrayList<>(); + + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfDownload::getDownloadContent, ids) + .eq(ZfDownload::getSysMenuId, 2018L); + + List<ZfDownload> zfDownloads = list(lqw); + System.out.println(zfDownloads); + if (zfDownloads.size() == 0){ + return true; + } + for (ZfDownload zfDownload: zfDownloads) { + id.add(zfDownload.getId()); + } + if (removeByIds(id)) { //鍒犻櫎es涓殑鏁版嵁 zfDownloads.stream().forEach(zfDoctorDownload -> { - EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "鏀惰棌涓庤崳鑰�"); + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "鏀惰棌涓庤崳鑰�涓嬭浇鐨勫垹闄�"); if (esModel != null) { DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); @@ -112,9 +125,9 @@ } } }); - return AjaxResult.success(); + return true; } else { - return AjaxResult.error(); + return false; } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java index 7d61d5b..c53783f 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java @@ -63,6 +63,12 @@ @Resource RestHighLevelClient restHighLevelClient; + @Resource + ZfCollectionShareService zfCollectionShareService; + + @Resource + ZfCollectionDownloadService zfCollectionDownloadService; + private LambdaQueryWrapper<ZfCollection> buildCondition(ZfCollection zfCollection,List<Long> familyIdList) { LambdaQueryWrapper<ZfCollection> lqw = new LambdaQueryWrapper<>(); lqw.orderByDesc(ZfCollection::getCreateTime); @@ -579,7 +585,9 @@ } List<ZfCollection> zfCollections = listByIds(Arrays.asList(ids)); - + if (! ( zfCollectionDownloadService.deleteData(ids) && zfCollectionShareService.deleteByContentId(ids) ) ){ + return AjaxResult.error(); + } if (zfCollectionService.removeByIds(Arrays.asList(ids))) { //鍒犻櫎es涓殑鏁版嵁 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 c894889..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<>(); @@ -203,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; + } + + } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactDownlServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactDownlServiceImpl.java index 8ca6782..8c1a2e1 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactDownlServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactDownlServiceImpl.java @@ -94,10 +94,25 @@ } @Override - public AjaxResult deleteData(Long[] ids) { - List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + public Boolean deleteData(Long[] ids) { + List<Long> id = new ArrayList<>(); - if (zfContactShraService.removeByIds(Arrays.asList(ids))) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfDownload::getDownloadContent, ids) + .eq(ZfDownload::getSysMenuId, 2021L); + + List<ZfDownload> zfDownloads = list(lqw); + System.out.println(zfDownloads); + if (zfDownloads.size() == 0){ + return true; + } + for (ZfDownload zfDownload: zfDownloads) { + id.add(zfDownload.getId()); + } + + System.out.println(id); + + if (removeByIds(id)) { //鍒犻櫎es涓殑鏁版嵁 zfDownloads.stream().forEach(zfDoctorDownload -> { @@ -112,9 +127,9 @@ } } }); - return AjaxResult.success(); + return true; } else { - return AjaxResult.error(); + return false; } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactServiceImpl.java index adad208..bf259f9 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactServiceImpl.java @@ -57,6 +57,12 @@ @Resource RestHighLevelClient restHighLevelClient; + @Resource + ZfContactShraServiceImpl zfContactShraService; + + @Resource + ZfContactDownlService zfContactDownlService; + private LambdaQueryWrapper<ZfContact> buildCondition(ZfContact zfContact,List<Long> familyIdList) { LambdaQueryWrapper<ZfContact> lqw = new LambdaQueryWrapper<>(); @@ -594,6 +600,9 @@ List<ZfContact> zfContacts = listByIds(Arrays.asList(ids)); + if (! (zfContactDownlService.deleteData(ids) && zfContactShraService.deleteByContentId(ids) ) ){ + return AjaxResult.error(); + } if (zfContactService.removeByIds(Arrays.asList(ids))) { //鍒犻櫎es涓殑鏁版嵁 diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactShraServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactShraServiceImpl.java index d1d1cb5..c34f8bd 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactShraServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfContactShraServiceImpl.java @@ -5,20 +5,22 @@ 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; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.domain.*; import com.ruoyi.mapper.ZfShareMapper; -import com.ruoyi.service.ZInfoUserService; -import com.ruoyi.service.ZfCollectionService; -import com.ruoyi.service.ZfContactService; -import com.ruoyi.service.ZfContactShraService; +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 +34,12 @@ @Resource private ZInfoUserService zInfoUserService; + + @Resource + private RestHighLevelClient restHighLevelClient; + + @Resource + EsService esService; private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); @@ -47,26 +55,24 @@ Long userId = user.getUserId(); LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfShare::getShareId,userId); + lqw.eq(ZfShare::getShareId, userId); return list(lqw); } - public Long getUserId(){ + public Long getUserId() { ZInfoUser myself = zInfoUserService.getMyself(); return myself.getUserId(); } - public void addData(ZfShare za) - { + public void addData(ZfShare za) { LambdaQueryWrapper<ZfShare> lqw = uniqueCondition(za); List<ZfShare> list = list(lqw); - if(list.size()>0){ + if (list.size() > 0) { throw new RuntimeException("璇峰嬁鍒嗕韩閲嶅鏁版嵁"); - } - else { + } else { save(za); } @@ -74,8 +80,8 @@ @Override public AjaxResult saveZa(ShareMore shareMore) { - Long [] shareIds = shareMore.getShareIds(); - Long [] shareContents = shareMore.getShareContents(); + Long[] shareIds = shareMore.getShareIds(); + Long[] shareContents = shareMore.getShareContents(); for (Long shareId : shareIds) { for (Long shareContent : shareContents) { ZfShare za = new ZfShare(); @@ -93,39 +99,38 @@ @Override public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { - Long [] shareIds = shareMore.getShareIds(); + Long[] shareIds = shareMore.getShareIds(); List<ZfContact> beanRecord3 = new ArrayList<>(); for (Long shareId : shareIds) { { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfShare::getShareId,shareId) - .eq(ZfShare::getSysMenuId,shareMore.getSysMenuId()) + lqw.eq(ZfShare::getShareId, shareId) + .eq(ZfShare::getSysMenuId, shareMore.getSysMenuId()) .eq(ZfShare::getUserId, getUserId()); List<ZfShare> beanRecords = list(lqw); - for (ZfShare beanRecord : beanRecords ) { + for (ZfShare beanRecord : beanRecords) { beanRecord3.add(zfContactService.getById(beanRecord.getShareContent())); } } } - List<ZfContact> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + List<ZfContact> record = beanRecord3.stream().skip((pageNo - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); - int totalPage = (beanRecord3.size() -1) / pageSize +1; + int totalPage = (beanRecord3.size() - 1) / pageSize + 1; - Page<ZfContact> zfContactPage = new Page<>(pageNo, pageSize,totalPage); - HashMap<String, Object> data = MapUtils.getShareResult(zfContactPage, record,beanRecord3.size()); + Page<ZfContact> zfContactPage = new Page<>(pageNo, pageSize, totalPage); + HashMap<String, Object> data = MapUtils.getShareResult(zfContactPage, record, beanRecord3.size()); return AjaxResult.success(data); } @Override public AjaxResult deleteZa(ShareMore shareMore) { - Long [] shareIds = shareMore.getShareIds(); - Long [] shareContents = shareMore.getShareContents(); - for(Long shareId : shareIds) - for(Long shareContent: shareContents) - { + Long[] shareIds = shareMore.getShareIds(); + Long[] shareContents = shareMore.getShareContents(); + for (Long shareId : shareIds) + for (Long shareContent : shareContents) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfShare::getShareId,shareId) + lqw.eq(ZfShare::getShareId, shareId) .eq(ZfShare::getShareContent, shareContent) .eq(ZfShare::getSysMenuId, shareMore.getSysMenuId()) .eq(ZfShare::getUserId, getUserId()); @@ -138,15 +143,15 @@ @Override public AjaxResult listByUserId() { - HashMap<Long,List<ZfContact>> bs = new HashMap<>(); + HashMap<Long, List<ZfContact>> bs = new HashMap<>(); LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfShare::getShareId,getUserId()); - lqw.eq(ZfShare::getSysMenuId,2021L); + lqw.eq(ZfShare::getShareId, getUserId()); + lqw.eq(ZfShare::getSysMenuId, 2021L); List<ZfShare> beanRecords = list(lqw); List<ZfContact> b1 = new ArrayList<>(); - for (ZfShare beanRecord : beanRecords ) { + for (ZfShare beanRecord : beanRecords) { b1.add(zfContactService.getById(beanRecord.getShareContent())); - bs.put(beanRecord.getUserId(),b1); + bs.put(beanRecord.getUserId(), b1); } log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs); return AjaxResult.success(bs); @@ -154,23 +159,23 @@ @Override public AjaxResult listUserId(Integer pageNo, Integer pageSize) { - List<ZfContact> bs = new ArrayList<>(); + List<ZfContact> bs = new ArrayList<>(); LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfShare::getShareId,getUserId()); - lqw.eq(ZfShare::getSysMenuId,2021L); + lqw.eq(ZfShare::getShareId, getUserId()); + lqw.eq(ZfShare::getSysMenuId, 2021L); List<ZfShare> beanRecords = list(lqw); - for (ZfShare beanRecord : beanRecords ) { + for (ZfShare beanRecord : beanRecords) { ZfContact bs2 = zfContactService.getById(beanRecord.getShareContent()); bs2.setShareId(beanRecord.getUserId().intValue()); bs.add(bs2); } log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs); - List<ZfContact> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + List<ZfContact> record = bs.stream().skip((pageNo - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); - int totalPage = (bs.size() -1) / pageSize +1; + int totalPage = (bs.size() - 1) / pageSize + 1; - Page<ZfContact> zfCollectionPage = new Page<>(pageNo, pageSize,totalPage); - HashMap<String, Object> data = MapUtils.getShareResult(zfCollectionPage, record,bs.size()); + Page<ZfContact> zfCollectionPage = new Page<>(pageNo, pageSize, totalPage); + HashMap<String, Object> data = MapUtils.getShareResult(zfCollectionPage, record, bs.size()); return AjaxResult.success(data); } @@ -181,12 +186,50 @@ .eq(ZfShare::getShareContent, zfDownload.getDownloadContent()) .eq(ZfShare::getSysMenuId, zfDownload.getSysMenuId()); List<ZfShare> beanRecords = list(lqw); - if (beanRecords.size() != 0){ + if (beanRecords.size() != 0) { return beanRecords.get(0).getUserId(); - } - else { + } else { 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, 2021L); + + 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; + } + } + } + + diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java index fe33a72..89d6c90 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java @@ -110,14 +110,29 @@ } } @Override - public AjaxResult deleteData(Long[] ids) { - List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + public Boolean deleteData(Long[] ids) { + List<Long> id = new ArrayList<>(); - if (zfDoctorShareService.removeByIds(Arrays.asList(ids))) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfDownload::getDownloadContent, ids) + .eq(ZfDownload::getSysMenuId, 2019L); + + List<ZfDownload> zfDownloads = list(lqw); + System.out.println(zfDownloads); + if (zfDownloads.size() == 0){ + return true; + } + for (ZfDownload zfDownload: zfDownloads) { + id.add(zfDownload.getId()); + } + + System.out.println(id); + + if (removeByIds(id)) { //鍒犻櫎es涓殑鏁版嵁 zfDownloads.stream().forEach(zfDoctorDownload -> { - EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "瀹跺涵灏忓尰鐢熶笅杞�"); + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "瀹跺涵灏忓尰鐢熶笅杞藉垹闄�"); if (esModel != null) { DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); @@ -128,9 +143,9 @@ } } }); - return AjaxResult.success(); + return true; } else { - return AjaxResult.error(); + return false; } } 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 7007a8e..9f006b2 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 @@ -62,6 +62,9 @@ @Resource ZfDoctorShareService zfDoctorShareService; + @Resource + ZfDoctorDownloadService zfDoctorDownloadService; + @Override public AjaxResult selectDoctorList(ZfDoctor zfDoctor, Integer pageNum, Integer pageSize) { @@ -383,7 +386,9 @@ } } List<ZfDoctor> zfDoctors = listByIds(Arrays.asList(ids)); - + if (! (zfDoctorDownloadService.deleteData(ids) && zfDoctorShareService.deleteByContentId(ids) ) ){ + return AjaxResult.error(); + } if (zfDoctorService.removeByIds(Arrays.asList(ids))) { //鍒犻櫎es涓殑鏁版嵁 diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java index 96d6a4f..a7e0b9a 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java @@ -4,19 +4,25 @@ 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; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.domain.*; import com.ruoyi.mapper.ZfShareMapper; +import com.ruoyi.service.EsService; import com.ruoyi.service.ZInfoUserService; import com.ruoyi.service.ZfDoctorService; import com.ruoyi.service.ZfDoctorShareService; 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 +38,13 @@ @Resource private ZInfoUserService zInfoUserService; + + @Resource + private RestHighLevelClient restHighLevelClient; + + @Resource + EsService esService; + private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); @@ -212,4 +225,42 @@ } } + @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, 2019L); + + 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; + } + + } + } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyDownlServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyDownlServiceImpl.java index dd814a1..1a272f2 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyDownlServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyDownlServiceImpl.java @@ -96,14 +96,29 @@ } @Override - public AjaxResult deleteData(Long[] ids) { - List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + public Boolean deleteData(Long[] ids) { + List<Long> id = new ArrayList<>(); - if (zfEconomyShaService.removeByIds(Arrays.asList(ids))) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfDownload::getDownloadContent, ids) + .eq(ZfDownload::getSysMenuId, 2023L); + + List<ZfDownload> zfDownloads = list(lqw); + System.out.println(zfDownloads); + if (zfDownloads.size() == 0){ + return true; + } + for (ZfDownload zfDownload: zfDownloads) { + id.add(zfDownload.getId()); + } + + System.out.println(id); + + if (removeByIds(id)) { //鍒犻櫎es涓殑鏁版嵁 zfDownloads.stream().forEach(zfDoctorDownload -> { - EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "瀹跺涵鏀舵敮鍙拌处涓嬭浇"); + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "瀹跺涵鏀舵敮鍙拌处涓嬭浇鍒犻櫎"); if (esModel != null) { DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); @@ -114,9 +129,9 @@ } } }); - return AjaxResult.success(); + return true; } else { - return AjaxResult.error(); + return false; } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java index af831b6..ed0a153 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java @@ -59,6 +59,12 @@ @Resource RestHighLevelClient restHighLevelClient; + @Resource + ZfEconomyShaService zfEconomyShaService; + + @Resource + ZfEconomyDownlService zfEconomyDownlService; + private LambdaQueryWrapper<ZfEconomy> buildCondition(ZfEconomy zfEconomy,List<Long> familyIdList) { LambdaQueryWrapper<ZfEconomy> lqw = new LambdaQueryWrapper<>(); lqw.orderByDesc(ZfEconomy::getCreateTime); @@ -549,7 +555,9 @@ } } List<ZfEconomy> zfEconomys = listByIds(Arrays.asList(ids)); - + if (! (zfEconomyDownlService.deleteData(ids) && zfEconomyShaService.deleteByContentId(ids) ) ){ + return AjaxResult.error(); + } if (zfEconomyService.removeByIds(Arrays.asList(ids))) { //鍒犻櫎es涓殑鏁版嵁 diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomySharServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomySharServiceImpl.java index 59f4d15..45c76a9 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomySharServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomySharServiceImpl.java @@ -5,6 +5,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; @@ -13,9 +14,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; @@ -29,6 +34,12 @@ @Resource private ZInfoUserService zInfoUserService; + + @Resource + private RestHighLevelClient restHighLevelClient; + + @Resource + EsService esService; private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); @@ -185,5 +196,40 @@ 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, 2023L); + + 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; + } + } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipDownloadServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipDownloadServiceImpl.java index 1d08847..e925f03 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipDownloadServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipDownloadServiceImpl.java @@ -96,14 +96,29 @@ } @Override - public AjaxResult deleteData(Long[] ids) { - List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + public Boolean deleteData(Long[] ids) { + List<Long> id = new ArrayList<>(); - if (zfEquipShareService.removeByIds(Arrays.asList(ids))) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfDownload::getDownloadContent, ids) + .eq(ZfDownload::getSysMenuId, 2017L); + + List<ZfDownload> zfDownloads = list(lqw); + System.out.println(zfDownloads); + if (zfDownloads.size() == 0){ + return true; + } + for (ZfDownload zfDownload: zfDownloads) { + id.add(zfDownload.getId()); + } + System.out.println("15102120202121212122222222221"); + System.out.println(id); + if (removeByIds(id)) { + System.out.println("4535468486525852"); //鍒犻櫎es涓殑鏁版嵁 zfDownloads.stream().forEach(zfDoctorDownload -> { - EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "瀹跺涵璁惧涓嬭浇"); + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "瀹跺涵璁惧涓嬭浇鍒犻櫎" ); if (esModel != null) { DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); @@ -114,9 +129,9 @@ } } }); - return AjaxResult.success(); + return true; } else { - return AjaxResult.error(); + return false; } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipShareServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipShareServiceImpl.java index b6c144e..f3ea927 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipShareServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipShareServiceImpl.java @@ -5,20 +5,22 @@ 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; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.domain.*; import com.ruoyi.mapper.ZfShareMapper; -import com.ruoyi.service.ZInfoUserService; -import com.ruoyi.service.ZfEconomyService; -import com.ruoyi.service.ZfEquipShareService; -import com.ruoyi.service.ZfEquipmentService; +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 +34,14 @@ @Resource private ZInfoUserService zInfoUserService; + + @Resource + private RestHighLevelClient restHighLevelClient; + + @Resource + EsService esService; + + private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); @@ -189,4 +199,41 @@ } } + @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, 2017L); + + 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; + } + } + } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java index efac001..dcdcb16 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java @@ -56,6 +56,12 @@ @Resource private RestHighLevelClient restHighLevelClient; + @Resource + private ZfEquipShareService zfEquipShareService; + + @Resource + private ZfEquipDownloadService zfEquipDownloadService; + private LambdaQueryWrapper<ZfEquipment> buildCondition(ZfEquipment zfEquipment,List<Long> familyIdList) { LambdaQueryWrapper<ZfEquipment> lqw = new LambdaQueryWrapper<>(); lqw.orderByDesc(ZfEquipment::getCreateTime); @@ -589,6 +595,9 @@ } List<ZfEquipment> zfEquipments = listByIds(Arrays.asList(ids)); + if (! (zfEquipDownloadService.deleteData(ids) && zfEquipShareService.deleteByContentId(ids) ) ){ + return AjaxResult.error(); + } if (zfEquipmentService.removeByIds(Arrays.asList(ids))) { @@ -604,6 +613,7 @@ } } }); + return AjaxResult.success(); }else { return AjaxResult.error(); diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventDownloadServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventDownloadServiceImpl.java index 22e1f7f..1a19e33 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventDownloadServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventDownloadServiceImpl.java @@ -81,7 +81,7 @@ String uuid = UUID.randomUUID().toString().replace("-", ""); esModel.setId(uuid); esModel.setCtId(Long.valueOf(inte)); - esModel.setCtTableName("瀹跺涵灏忓尰鐢�"); + esModel.setCtTableName("瀹跺ぇ浜嬭"); esModel.setBy1(String.valueOf(zfDownload.getDownloadId())); esModel.setBy2(String.valueOf(zfDownload.getDownloadContent())); @@ -95,17 +95,30 @@ } @Override - public AjaxResult deleteData(Long[] ids) { - List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + public Boolean deleteData(Long[] ids) { + List<Long> id = new ArrayList<>(); - if (zfEventShareService.removeByIds(Arrays.asList(ids))) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfDownload::getDownloadContent, ids) + .eq(ZfDownload::getSysMenuId, 2013L); + List<ZfDownload> zfDownloads = list(lqw); + System.out.println(zfDownloads); + if (zfDownloads.size() == 0){ + return true; + } + for (ZfDownload zfDownload: zfDownloads) { + id.add(zfDownload.getId()); + } + + System.out.println(id); + if (removeByIds(id)) { //鍒犻櫎es涓殑鏁版嵁 - zfDownloads.stream().forEach(zfDoctorDownload -> { - EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "瀹跺涵灏忓尰鐢熶笅杞�"); - + zfDownloads.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) { @@ -113,9 +126,9 @@ } } }); - return AjaxResult.success(); + return true; } else { - return AjaxResult.error(); + return false; } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java index 5a592e5..aab45cf 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java @@ -55,6 +55,12 @@ private EsService esSer; @Resource + private ZfEventDownloadService zfEventDownloadService; + + @Resource + private ZfEventShareService zfEventShareService; + + @Resource private RestHighLevelClient restHighLevelClient; private LambdaQueryWrapper<ZfEvent> buildCondition(ZfEvent zfEvent,List<Long> familyIdList) { LambdaQueryWrapper<ZfEvent> lqw = new LambdaQueryWrapper<>(); @@ -567,9 +573,11 @@ } List<ZfEvent> zfEvents = listByIds(Arrays.asList(ids)); + if (! (zfEventDownloadService.deleteData(ids) && zfEventShareService.deleteByContentId(ids) ) ){ + return AjaxResult.error(); + } if (zfEventService.removeByIds(Arrays.asList(ids))) { - //鍒犻櫎es涓殑鏁版嵁 zfEvents.stream().forEach(zfEvent -> { EsModel esModel = esSer.findByCtId(zfEvent.getId(), "瀹跺ぇ浜嬭"); @@ -583,6 +591,7 @@ } }); + return AjaxResult.success(); }else { return AjaxResult.error(); diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventShareServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventShareServiceImpl.java index 437c54f..3811740 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventShareServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventShareServiceImpl.java @@ -4,20 +4,22 @@ 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; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.domain.*; import com.ruoyi.mapper.ZfShareMapper; -import com.ruoyi.service.ZInfoUserService; -import com.ruoyi.service.ZfDoctorShareService; -import com.ruoyi.service.ZfEventService; -import com.ruoyi.service.ZfEventShareService; +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; @@ -36,6 +38,12 @@ @Resource private ZInfoUserService zInfoUserService; + + @Resource + private RestHighLevelClient restHighLevelClient; + + @Resource + EsService esService; private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { @@ -193,4 +201,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, 2013L); + + 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; + } + + } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetDownServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetDownServiceImpl.java index ab6689f..ffc1698 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetDownServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetDownServiceImpl.java @@ -96,14 +96,29 @@ } @Override - public AjaxResult deleteData(Long[] ids) { - List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + public Boolean deleteData(Long[] ids) { + List<Long> id = new ArrayList<>(); - if (zfPetService.removeByIds(Arrays.asList(ids))) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ids != null, ZfDownload::getDownloadContent, ids) + .eq(ZfDownload::getSysMenuId, 2022L); + + List<ZfDownload> zfDownloads = list(lqw); + System.out.println(zfDownloads); + if (zfDownloads.size() == 0){ + return true; + } + for (ZfDownload zfDownload: zfDownloads) { + id.add(zfDownload.getId()); + } + + System.out.println(id); + + if (removeByIds(id)) { //鍒犻櫎es涓殑鏁版嵁 zfDownloads.stream().forEach(zfDoctorDownload -> { - EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "閫氳褰曚笅杞�"); + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "閫氳褰曚笅杞藉垹闄�"); if (esModel != null) { DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); @@ -114,9 +129,9 @@ } } }); - return AjaxResult.success(); + return true; } else { - return AjaxResult.error(); + return false; } } diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetServiceImpl.java index fe2ba31..c70526e 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetServiceImpl.java @@ -49,6 +49,12 @@ @Resource ZAuthorityService zAuthorityService; + + @Resource + ZfPetSharService zfPetSharService; + + @Resource + ZfPetDownlService zfPetDownlService; @Override public AjaxResult selectDataList(ZfPet zfPet, Integer pageNum, Integer pageSize) { // LambdaQueryWrapper<ZfPet> lqw = buildCondition(zfPet); @@ -266,6 +272,9 @@ throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�"); } } + if (! (zfPetDownlService.deleteData(ids) && zfPetSharService.deleteByContentId(ids) ) ){ + return AjaxResult.error(); + } if (zfPetService.removeByIds(Arrays.asList(ids))) { return AjaxResult.success(); diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetSharServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetSharServiceImpl.java index 3874756..37e53b4 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetSharServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetSharServiceImpl.java @@ -5,20 +5,22 @@ 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; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.domain.*; import com.ruoyi.mapper.ZfShareMapper; -import com.ruoyi.service.TravelDetailService; -import com.ruoyi.service.ZInfoUserService; -import com.ruoyi.service.ZfPetService; -import com.ruoyi.service.ZfPetSharService; +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; @@ -34,6 +36,12 @@ @Resource private ZInfoUserService zInfoUserService; + @Resource + private RestHighLevelClient restHighLevelClient; + + @Resource + EsService esService; + private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getShareId())), ZfShare::getShareId, zfShare.getShareId()); @@ -48,26 +56,24 @@ Long userId = user.getUserId(); LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfShare::getShareId,userId); + lqw.eq(ZfShare::getShareId, userId); return list(lqw); } - public Long getUserId(){ + public Long getUserId() { ZInfoUser myself = zInfoUserService.getMyself(); return myself.getUserId(); } - public void addData(ZfShare za) - { + public void addData(ZfShare za) { LambdaQueryWrapper<ZfShare> lqw = uniqueCondition(za); List<ZfShare> list = list(lqw); - if(list.size()>0){ + if (list.size() > 0) { throw new RuntimeException("璇峰嬁鍒嗕韩閲嶅鏁版嵁"); - } - else { + } else { save(za); } @@ -75,8 +81,8 @@ @Override public AjaxResult saveZa(ShareMore shareMore) { - Long [] shareIds = shareMore.getShareIds(); - Long [] shareContents = shareMore.getShareContents(); + Long[] shareIds = shareMore.getShareIds(); + Long[] shareContents = shareMore.getShareContents(); for (Long shareId : shareIds) { for (Long shareContent : shareContents) { ZfShare za = new ZfShare(); @@ -94,39 +100,38 @@ @Override public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { - Long [] shareIds = shareMore.getShareIds(); + Long[] shareIds = shareMore.getShareIds(); List<ZfPet> beanRecord3 = new ArrayList<>(); for (Long shareId : shareIds) { { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfShare::getShareId,shareId) - .eq(ZfShare::getSysMenuId,shareMore.getSysMenuId()) + lqw.eq(ZfShare::getShareId, shareId) + .eq(ZfShare::getSysMenuId, shareMore.getSysMenuId()) .eq(ZfShare::getUserId, getUserId()); List<ZfShare> beanRecords = list(lqw); - for (ZfShare beanRecord : beanRecords ) { + for (ZfShare beanRecord : beanRecords) { beanRecord3.add(zfPetService.getById(beanRecord.getShareContent())); } } } - List<ZfPet> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + List<ZfPet> record = beanRecord3.stream().skip((pageNo - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); - int totalPage = (beanRecord3.size() -1) / pageSize +1; + int totalPage = (beanRecord3.size() - 1) / pageSize + 1; - Page<ZfPet> zfPetPage = new Page<>(pageNo, pageSize,totalPage); - HashMap<String, Object> data = MapUtils.getShareResult(zfPetPage, record,beanRecord3.size()); + Page<ZfPet> zfPetPage = new Page<>(pageNo, pageSize, totalPage); + HashMap<String, Object> data = MapUtils.getShareResult(zfPetPage, record, beanRecord3.size()); return AjaxResult.success(data); } @Override public AjaxResult deleteZa(ShareMore shareMore) { - Long [] shareIds = shareMore.getShareIds(); - Long [] shareContents = shareMore.getShareContents(); - for(Long shareId : shareIds) - for(Long shareContent: shareContents) - { + Long[] shareIds = shareMore.getShareIds(); + Long[] shareContents = shareMore.getShareContents(); + for (Long shareId : shareIds) + for (Long shareContent : shareContents) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfShare::getShareId,shareId) + lqw.eq(ZfShare::getShareId, shareId) .eq(ZfShare::getShareContent, shareContent) .eq(ZfShare::getSysMenuId, shareMore.getSysMenuId()) .eq(ZfShare::getUserId, getUserId()); @@ -139,15 +144,15 @@ @Override public AjaxResult listByUserId() { - HashMap<Long,List<ZfPet>> bs = new HashMap<>(); + HashMap<Long, List<ZfPet>> bs = new HashMap<>(); LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfShare::getShareId,getUserId()); - lqw.eq(ZfShare::getSysMenuId,2022L); + lqw.eq(ZfShare::getShareId, getUserId()); + lqw.eq(ZfShare::getSysMenuId, 2022L); List<ZfShare> beanRecords = list(lqw); List<ZfPet> b1 = new ArrayList<>(); - for (ZfShare beanRecord : beanRecords ) { + for (ZfShare beanRecord : beanRecords) { b1.add(zfPetService.getById(beanRecord.getShareContent())); - bs.put(beanRecord.getUserId(),b1); + bs.put(beanRecord.getUserId(), b1); } log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs); return AjaxResult.success(bs); @@ -155,23 +160,23 @@ @Override public AjaxResult listUserId(Integer pageNo, Integer pageSize) { - List<ZfPet> bs = new ArrayList<>(); + List<ZfPet> bs = new ArrayList<>(); LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfShare::getShareId,getUserId()); - lqw.eq(ZfShare::getSysMenuId,2022L); + lqw.eq(ZfShare::getShareId, getUserId()); + lqw.eq(ZfShare::getSysMenuId, 2022L); List<ZfShare> beanRecords = list(lqw); - for (ZfShare beanRecord : beanRecords ) { + for (ZfShare beanRecord : beanRecords) { ZfPet bs2 = zfPetService.getById(beanRecord.getShareContent()); bs2.setShareId(beanRecord.getUserId().intValue()); bs.add(bs2); } log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs); - List<ZfPet> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + List<ZfPet> record = bs.stream().skip((pageNo - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); - int totalPage = (bs.size() -1) / pageSize +1; + int totalPage = (bs.size() - 1) / pageSize + 1; - Page<ZfPet> zfPetPage = new Page<>(pageNo, pageSize,totalPage); - HashMap<String, Object> data = MapUtils.getShareResult(zfPetPage, record,bs.size()); + Page<ZfPet> zfPetPage = new Page<>(pageNo, pageSize, totalPage); + HashMap<String, Object> data = MapUtils.getShareResult(zfPetPage, record, bs.size()); return AjaxResult.success(data); } @@ -182,11 +187,47 @@ .eq(ZfShare::getShareContent, zfDownload.getDownloadContent()) .eq(ZfShare::getSysMenuId, zfDownload.getSysMenuId()); List<ZfShare> beanRecords = list(lqw); - if (beanRecords.size() != 0){ + if (beanRecords.size() != 0) { return beanRecords.get(0).getUserId(); - } - else { + } else { 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, 2022L); + + 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