From 5be62132d4654e16be0bcc7c1ab1304a307ada5c Mon Sep 17 00:00:00 2001 From: zqy <2522236926@qq.com> Date: 星期一, 05 八月 2024 20:17:40 +0800 Subject: [PATCH] 分享 --- zhang-content/src/main/java/com/ruoyi/service/ZfPetNoteSharService.java | 4 zhang-content/src/main/java/com/ruoyi/service/TravelDetailSharService.java | 4 zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetNoteDownServiceImpl.java | 145 +++++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelDetailShareController.java | 83 ++ zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountSharServiceImpl.java | 190 ++++++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelCountShareController.java | 81 ++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfpetShareController.java | 85 ++ zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailSharServiceImpl.java | 204 +++++++ zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetSharServiceImpl.java | 188 ++++++ zhang-content/src/main/java/com/ruoyi/service/TravelDetailDownlService.java | 3 /dev/null | 5 zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetDownServiceImpl.java | 145 +++++ zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountDownServiceImpl.java | 145 +++++ zhang-content/src/main/java/com/ruoyi/service/TravelCountSharService.java | 2 zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailDownServiceImpl.java | 158 +++++ zhang-content/src/main/java/com/ruoyi/service/ZfPetNoteDownlService.java | 3 ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetNoteShareController.java | 84 ++ zhang-content/src/main/java/com/ruoyi/service/TravelCountDownlService.java | 2 zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetNoteSharServiceImpl.java | 188 ++++++ 19 files changed, 1,701 insertions(+), 18 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelCountShareController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelCountShareController.java new file mode 100644 index 0000000..47b25b1 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelCountShareController.java @@ -0,0 +1,81 @@ +package com.ruoyi.web.controller.zhang; + +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.utils.ServletUtils; +import com.ruoyi.domain.ShareMore; +import com.ruoyi.domain.ZfDownload; +import com.ruoyi.service.*; +import com.ruoyi.service.impl.TravelCountDownServiceImpl; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +import static com.ruoyi.common.core.page.TableSupport.PAGE_NO; +import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE; + +@RestController +@RequestMapping("/travelCountShare") +public class TravelCountShareController extends BaseController { + @Resource + TravelCountSharService travelCountSharService; + + @Resource + TravelCountDownlService travelCountDownlService; + + @PostMapping("/share") + public AjaxResult share(@RequestBody ShareMore zfDoctor){ + zfDoctor.setSysMenuId(2056L); + return travelCountSharService.saveZa(zfDoctor); + } + + /** + * 鏍规嵁UserId鍜屽垎浜汉shareId鏌ョ湅宸茬粡鎺堟潈缁欓偅浜涗汉閭d簺鏁版嵁 + */ + @PostMapping("/getInfoByUserId") + public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){ + zfDoctor.setSysMenuId(2056L); + Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); + return travelCountSharService.listByFidAid(zfDoctor,pageNo,pageSize) ; + } + + /** + * 鐢ㄦ埛鑷繁鏌ョ湅鍒汉鍒嗕韩鐨勬暟鎹拰鍒嗕韩浜� + */ + @GetMapping("/getInfoByShareId") + public AjaxResult empowerGetInfo2(){ + Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); + return travelCountSharService.listUserId(pageNo ,pageSize); + } + /** + * 鏍规嵁userId鍜宻hareId鏀跺洖宸茬粡鎺堟潈缁欓偅浜涗汉 + */ + @PostMapping("/deleteInfoByUserId") + public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){ + zfDoctor.setSysMenuId(2056L); + return travelCountSharService.deleteZa(zfDoctor); + } + + /** + * 涓嬭浇鍒嗕韩鐨勬暟鎹� + */ + @PostMapping("/downloadDate") + public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){ + zfDownload.setSysMenuId(2056L); + return travelCountDownlService.addData(zfDownload); + } + + /** + * 灞曠ず涓嬭浇鍒嗕韩鐨勬暟鎹� + */ + @GetMapping("/all") + public AjaxResult data(ZfDownload zfDownload){ + zfDownload.setSysMenuId(2056L); + Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); + return travelCountDownlService.selectDoctorList(zfDownload,pageNo ,pageSize); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelDetailShareController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelDetailShareController.java new file mode 100644 index 0000000..4216171 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelDetailShareController.java @@ -0,0 +1,83 @@ +package com.ruoyi.web.controller.zhang; + +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.utils.ServletUtils; +import com.ruoyi.domain.ShareMore; +import com.ruoyi.domain.ZfDownload; +import com.ruoyi.service.TravelDetailDownlService; +import com.ruoyi.service.TravelDetailSharService; +import com.ruoyi.service.ZfPetDownlService; +import com.ruoyi.service.ZfPetSharService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +import static com.ruoyi.common.core.page.TableSupport.PAGE_NO; +import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE; + +@RestController +@RequestMapping("/travelDetailShare") +public class TravelDetailShareController extends BaseController { + @Resource + TravelDetailSharService travelDetailSharService; + + @Resource + TravelDetailDownlService travelDetailDownlService; + + @PostMapping("/share") + public AjaxResult share(@RequestBody ShareMore zfDoctor){ + zfDoctor.setSysMenuId(2055L); + return travelDetailSharService.saveZa(zfDoctor); + } + + /** + * 鏍规嵁UserId鍜屽垎浜汉shareId鏌ョ湅宸茬粡鎺堟潈缁欓偅浜涗汉閭d簺鏁版嵁 + */ + @PostMapping("/getInfoByUserId") + public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){ + zfDoctor.setSysMenuId(2055L); + Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); + return travelDetailSharService.listByFidAid(zfDoctor,pageNo,pageSize) ; + } + + /** + * 鐢ㄦ埛鑷繁鏌ョ湅鍒汉鍒嗕韩鐨勬暟鎹拰鍒嗕韩浜� + */ + @GetMapping("/getInfoByShareId") + public AjaxResult empowerGetInfo2(){ + Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); + return travelDetailSharService.listUserId(pageNo ,pageSize); + } + /** + * 鏍规嵁userId鍜宻hareId鏀跺洖宸茬粡鎺堟潈缁欓偅浜涗汉 + */ + @PostMapping("/deleteInfoByUserId") + public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){ + zfDoctor.setSysMenuId(2055L); + return travelDetailSharService.deleteZa(zfDoctor); + } + + /** + * 涓嬭浇鍒嗕韩鐨勬暟鎹� + */ + @PostMapping("/downloadDate") + public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){ + zfDownload.setSysMenuId(2055L); + return travelDetailDownlService.addData(zfDownload); + } + + /** + * 灞曠ず涓嬭浇鍒嗕韩鐨勬暟鎹� + */ + @GetMapping("/all") + public AjaxResult data(ZfDownload zfDownload){ + zfDownload.setSysMenuId(2055L); + Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); + return travelDetailDownlService.selectDoctorList(zfDownload,pageNo ,pageSize); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelSharController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelSharController.java deleted file mode 100644 index 7e9961d..0000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/TravelSharController.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.ruoyi.web.controller.zhang; - -public class TravelSharController { -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetNoteShareController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetNoteShareController.java new file mode 100644 index 0000000..98ecb3f --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetNoteShareController.java @@ -0,0 +1,84 @@ +package com.ruoyi.web.controller.zhang; + +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.utils.ServletUtils; +import com.ruoyi.domain.ShareMore; +import com.ruoyi.domain.ZfDownload; +import com.ruoyi.service.ZfPetNoteDownlService; +import com.ruoyi.service.ZfPetNoteSharService; +import com.ruoyi.service.impl.IZfPropertyDownloadServiceImpl; +import com.ruoyi.service.impl.IZfPropertyShareServiceImpl; +import com.ruoyi.service.impl.ZfPetDownServiceImpl; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +import static com.ruoyi.common.core.page.TableSupport.PAGE_NO; +import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE; + +@RestController +@RequestMapping("/family/zfPetNoteShare") +public class ZfPetNoteShareController extends BaseController { + @Resource + ZfPetNoteSharService zfPetNoteSharService; + + @Resource + ZfPetNoteDownlService zfPetNoteDownlService; + + @PostMapping("/share") + public AjaxResult share(@RequestBody ShareMore zfDoctor){ + zfDoctor.setSysMenuId(2061L); + return zfPetNoteSharService.saveZa(zfDoctor); + } + + /** + * 鏍规嵁UserId鍜屽垎浜汉shareId鏌ョ湅宸茬粡鎺堟潈缁欓偅浜涗汉閭d簺鏁版嵁 + */ + @PostMapping("/getInfoByUserId") + public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){ + zfDoctor.setSysMenuId(2061L); + Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); + return zfPetNoteSharService.listByFidAid(zfDoctor,pageNo,pageSize) ; + } + + /** + * 鐢ㄦ埛鑷繁鏌ョ湅鍒汉鍒嗕韩鐨勬暟鎹拰鍒嗕韩浜� + */ + @GetMapping("/getInfoByShareId") + public AjaxResult empowerGetInfo2(){ + Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); + return zfPetNoteSharService.listUserId(pageNo ,pageSize); + } + /** + * 鏍规嵁userId鍜宻hareId鏀跺洖宸茬粡鎺堟潈缁欓偅浜涗汉 + */ + @PostMapping("/deleteInfoByUserId") + public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){ + zfDoctor.setSysMenuId(2061L); + return zfPetNoteSharService.deleteZa(zfDoctor); + } + + /** + * 涓嬭浇鍒嗕韩鐨勬暟鎹� + */ + @PostMapping("/downloadDate") + public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){ + zfDownload.setSysMenuId(2061L); + return zfPetNoteDownlService.addData(zfDownload); + } + + /** + * 灞曠ず涓嬭浇鍒嗕韩鐨勬暟鎹� + */ + @GetMapping("/all") + public AjaxResult data(ZfDownload zfDownload){ + zfDownload.setSysMenuId(2061L); + Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); + return zfPetNoteDownlService.selectDoctorList(zfDownload,pageNo ,pageSize); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetSharController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetSharController.java deleted file mode 100644 index ff5a81b..0000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetSharController.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.ruoyi.web.controller.zhang; - -public class ZfPetSharController { -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfpetShareController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfpetShareController.java new file mode 100644 index 0000000..234f68e --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfpetShareController.java @@ -0,0 +1,85 @@ +package com.ruoyi.web.controller.zhang; + +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.utils.ServletUtils; +import com.ruoyi.domain.ShareMore; +import com.ruoyi.domain.ZfDownload; +import com.ruoyi.service.ZfPetDownlService; +import com.ruoyi.service.ZfPetNoteSharService; +import com.ruoyi.service.ZfPetSharService; +import com.ruoyi.service.impl.IZfPropertyDownloadServiceImpl; +import com.ruoyi.service.impl.IZfPropertyShareServiceImpl; +import com.ruoyi.service.impl.ZfPetDownServiceImpl; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +import static com.ruoyi.common.core.page.TableSupport.PAGE_NO; +import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE; + +@RestController +@RequestMapping("/family/zfPetShare") +public class ZfpetShareController extends BaseController { + @Resource + ZfPetSharService zfPetSharService; + + @Resource + ZfPetDownlService zfPetDownlService; + + @PostMapping("/share") + public AjaxResult share(@RequestBody ShareMore zfDoctor){ + zfDoctor.setSysMenuId(2022L); + return zfPetSharService.saveZa(zfDoctor); + } + + /** + * 鏍规嵁UserId鍜屽垎浜汉shareId鏌ョ湅宸茬粡鎺堟潈缁欓偅浜涗汉閭d簺鏁版嵁 + */ + @PostMapping("/getInfoByUserId") + public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){ + zfDoctor.setSysMenuId(2022L); + Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); + return zfPetSharService.listByFidAid(zfDoctor,pageNo,pageSize) ; + } + + /** + * 鐢ㄦ埛鑷繁鏌ョ湅鍒汉鍒嗕韩鐨勬暟鎹拰鍒嗕韩浜� + */ + @GetMapping("/getInfoByShareId") + public AjaxResult empowerGetInfo2(){ + Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); + return zfPetSharService.listUserId(pageNo ,pageSize); + } + /** + * 鏍规嵁userId鍜宻hareId鏀跺洖宸茬粡鎺堟潈缁欓偅浜涗汉 + */ + @PostMapping("/deleteInfoByUserId") + public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){ + zfDoctor.setSysMenuId(2022L); + return zfPetSharService.deleteZa(zfDoctor); + } + + /** + * 涓嬭浇鍒嗕韩鐨勬暟鎹� + */ + @PostMapping("/downloadDate") + public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){ + zfDownload.setSysMenuId(2022L); + return zfPetDownlService.addData(zfDownload); + } + + /** + * 灞曠ず涓嬭浇鍒嗕韩鐨勬暟鎹� + */ + @GetMapping("/all") + public AjaxResult data(ZfDownload zfDownload){ + zfDownload.setSysMenuId(2022L); + Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); + return zfPetDownlService.selectDoctorList(zfDownload,pageNo ,pageSize); + } +} diff --git a/zhang-content/src/main/java/com/ruoyi/service/TravelDownlService.java b/zhang-content/src/main/java/com/ruoyi/service/TravelCountDownlService.java similarity index 84% rename from zhang-content/src/main/java/com/ruoyi/service/TravelDownlService.java rename to zhang-content/src/main/java/com/ruoyi/service/TravelCountDownlService.java index e83ab3d..e87cc77 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/TravelDownlService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/TravelCountDownlService.java @@ -6,7 +6,7 @@ import com.ruoyi.domain.ZfDownload; import com.ruoyi.domain.ZfShare; -public interface TravelDownlService extends IService<ZfDownload> { +public interface TravelCountDownlService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); AjaxResult deleteData(Long[] ids); diff --git a/zhang-content/src/main/java/com/ruoyi/service/TravelSharService.java b/zhang-content/src/main/java/com/ruoyi/service/TravelCountSharService.java similarity index 91% rename from zhang-content/src/main/java/com/ruoyi/service/TravelSharService.java rename to zhang-content/src/main/java/com/ruoyi/service/TravelCountSharService.java index 41c04e1..21db45a 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/TravelSharService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/TravelCountSharService.java @@ -11,7 +11,7 @@ import java.util.List; -public interface TravelSharService extends IService<ZfShare> { +public interface TravelCountSharService extends IService<ZfShare> { List<ZfShare> getAuthority(); AjaxResult saveZa(ShareMore shareMore); diff --git a/zhang-content/src/main/java/com/ruoyi/service/TravelDownlService.java b/zhang-content/src/main/java/com/ruoyi/service/TravelDetailDownlService.java similarity index 78% copy from zhang-content/src/main/java/com/ruoyi/service/TravelDownlService.java copy to zhang-content/src/main/java/com/ruoyi/service/TravelDetailDownlService.java index e83ab3d..3fbd761 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/TravelDownlService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/TravelDetailDownlService.java @@ -4,9 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.ZfDownload; -import com.ruoyi.domain.ZfShare; -public interface TravelDownlService extends IService<ZfDownload> { +public interface TravelDetailDownlService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); AjaxResult deleteData(Long[] ids); diff --git a/zhang-content/src/main/java/com/ruoyi/service/TravelSharService.java b/zhang-content/src/main/java/com/ruoyi/service/TravelDetailSharService.java similarity index 79% copy from zhang-content/src/main/java/com/ruoyi/service/TravelSharService.java copy to zhang-content/src/main/java/com/ruoyi/service/TravelDetailSharService.java index 41c04e1..78f0f6e 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/TravelSharService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/TravelDetailSharService.java @@ -5,13 +5,11 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.ShareMore; import com.ruoyi.domain.ZfDownload; -import com.ruoyi.domain.ZfProperty; import com.ruoyi.domain.ZfShare; -import org.springframework.web.multipart.MultipartFile; import java.util.List; -public interface TravelSharService extends IService<ZfShare> { +public interface TravelDetailSharService extends IService<ZfShare> { List<ZfShare> getAuthority(); AjaxResult saveZa(ShareMore shareMore); diff --git a/zhang-content/src/main/java/com/ruoyi/service/TravelDownlService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfPetNoteDownlService.java similarity index 78% copy from zhang-content/src/main/java/com/ruoyi/service/TravelDownlService.java copy to zhang-content/src/main/java/com/ruoyi/service/ZfPetNoteDownlService.java index e83ab3d..39d43e3 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/TravelDownlService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfPetNoteDownlService.java @@ -4,9 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.ZfDownload; -import com.ruoyi.domain.ZfShare; -public interface TravelDownlService extends IService<ZfDownload> { +public interface ZfPetNoteDownlService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); AjaxResult deleteData(Long[] ids); diff --git a/zhang-content/src/main/java/com/ruoyi/service/TravelSharService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfPetNoteSharService.java similarity index 79% copy from zhang-content/src/main/java/com/ruoyi/service/TravelSharService.java copy to zhang-content/src/main/java/com/ruoyi/service/ZfPetNoteSharService.java index 41c04e1..2ead217 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/TravelSharService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfPetNoteSharService.java @@ -5,13 +5,11 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.ShareMore; import com.ruoyi.domain.ZfDownload; -import com.ruoyi.domain.ZfProperty; import com.ruoyi.domain.ZfShare; -import org.springframework.web.multipart.MultipartFile; import java.util.List; -public interface TravelSharService extends IService<ZfShare> { +public interface ZfPetNoteSharService extends IService<ZfShare> { List<ZfShare> getAuthority(); AjaxResult saveZa(ShareMore shareMore); 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 new file mode 100644 index 0000000..c06373b --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountDownServiceImpl.java @@ -0,0 +1,145 @@ + +package com.ruoyi.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.utils.MapUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.domain.TravelCount; +import com.ruoyi.domain.TravelDetail; +import com.ruoyi.domain.ZInfoUser; +import com.ruoyi.domain.ZfDownload; +import com.ruoyi.mapper.ZfDownloadMapper; +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.*; +import java.util.stream.Collectors; + +@Service +@Slf4j +public class TravelCountDownServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements TravelCountDownlService { + @Resource + EsService esService; + + @Resource + TravelCountSharService travelCountSharService; + + @Resource + TravelCountService travelCountService; + + + @Resource + ZInfoUserService zInfoUserService; + + @Resource + private RestHighLevelClient restHighLevelClient; + + private LambdaQueryWrapper<ZfDownload> buildCondition(ZfDownload zfDownload, Long userId) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ZfDownload::getDownloadId,userId); + lqw.orderByDesc(ZfDownload::getDownloadId); + lqw.like(zfDownload.getDownloadId() != null, ZfDownload::getDownloadId, zfDownload.getDownloadId()) + .like(zfDownload.getDownloadContent() != null, ZfDownload::getDownloadContent, zfDownload.getDownloadContent()) + .eq( ZfDownload::getSysMenuId, zfDownload.getSysMenuId()); + return lqw; + } + private LambdaQueryWrapper<ZfDownload> uniqueCondition(ZfDownload zfDownload) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfDownload.getDownloadId())), ZfDownload::getDownloadId, zfDownload.getDownloadId()) + .eq(StringUtils.isNotEmpty(String.valueOf(zfDownload.getDownloadContent())), ZfDownload::getDownloadContent, zfDownload.getDownloadContent()) + .eq(ZfDownload::getSysMenuId, zfDownload.getSysMenuId()); + return lqw; + } + + public Long getUserId() { + ZInfoUser myself = zInfoUserService.getMyself(); + return myself.getUserId(); + } + @Override + public AjaxResult addData(ZfDownload zfDownload) { + zfDownload.setDownloadId(getUserId()); + LambdaQueryWrapper<ZfDownload> lqw = uniqueCondition(zfDownload); + List<ZfDownload> list = list(lqw); + if (list.size() > 0) { + throw new RuntimeException("璇峰嬁閲嶅涓嬭浇鏁版嵁"); + } + + zfDownload.setDownloadId(getUserId()); + zfDownload.setShareId(travelCountSharService.getShareId(zfDownload)); + if (save(zfDownload)) { + EsModel esModel = new EsModel(); + Integer inte = zfDownload.getId().intValue(); + String uuid = UUID.randomUUID().toString().replace("-", ""); + esModel.setId(uuid); + esModel.setCtId(Long.valueOf(inte)); + esModel.setCtTableName("閫氳褰�"); + + esModel.setBy1(String.valueOf(zfDownload.getDownloadId())); + esModel.setBy2(String.valueOf(zfDownload.getDownloadContent())); + esModel.setBy3(String.valueOf(zfDownload.getShareId())); + //杩欓噷瀛樺偍鏌ヨ璇︽儏鐨勮矾寰� + esService.insertTable(esModel); + return AjaxResult.success(); + } else { + return AjaxResult.error(); + } + } + + @Override + public AjaxResult deleteData(Long[] ids) { + List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + + if (travelCountService.removeByIds(Arrays.asList(ids))) { + + //鍒犻櫎es涓殑鏁版嵁 + zfDownloads.stream().forEach(zfDoctorDownload -> { + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "閫氳褰曚笅杞�"); + + if (esModel != null) { + DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); + try { + restHighLevelClient.delete(deleteRequest, RequestOptions.DEFAULT); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + }); + return AjaxResult.success(); + } else { + return AjaxResult.error(); + } + } + + @Override + public AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo, Integer pageSize) { + ZInfoUser myself = zInfoUserService.getMyself(); + LambdaQueryWrapper<ZfDownload> lqw = buildCondition(zfDownload,myself.getUserId()); + List<ZfDownload> beanRecords = list(lqw); + List<TravelCount> bs = new ArrayList<>(); + for (ZfDownload a: beanRecords) { + if (travelCountService.getById(a.getDownloadContent()) != null) { + TravelCount ds = travelCountService.getById(a.getDownloadContent()); + ds.setShareId(a.getShareId().intValue()); + bs.add(ds); + } + } + List<TravelCount> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + + int totalPage = (bs.size() -1) / pageSize +1; + + Page<TravelCount> travelCountPage = new Page<>(pageNo, pageSize,totalPage); + HashMap<String, Object> data = MapUtils.getShareResult(travelCountPage, record,bs.size()); + return AjaxResult.success(data); + } + +} 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 new file mode 100644 index 0000000..9efee2b --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountSharServiceImpl.java @@ -0,0 +1,190 @@ + +package com.ruoyi.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.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 lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +@Service +@Slf4j +public class TravelCountSharServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements TravelCountSharService { + + + @Resource + TravelCountService travelCountService; + + @Resource + private ZInfoUserService zInfoUserService; + + private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getShareId())), ZfShare::getShareId, zfShare.getShareId()); + lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getShareContent())), ZfShare::getShareContent, zfShare.getShareContent()); + lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getSysMenuId())), ZfShare::getSysMenuId, zfShare.getSysMenuId()); + return lqw; + } + + @Override + public List<ZfShare> getAuthority() { + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,userId); + + return list(lqw); + } + + public Long getUserId(){ + ZInfoUser myself = zInfoUserService.getMyself(); + return myself.getUserId(); + + } + + public void addData(ZfShare za) + { + LambdaQueryWrapper<ZfShare> lqw = uniqueCondition(za); + List<ZfShare> list = list(lqw); + + if(list.size()>0){ + throw new RuntimeException("璇峰嬁鍒嗕韩閲嶅鏁版嵁"); + } + else { + save(za); + } + + } + + @Override + public AjaxResult saveZa(ShareMore shareMore) { + Long [] shareIds = shareMore.getShareIds(); + Long [] shareContents = shareMore.getShareContents(); + for (Long shareId : shareIds) { + for (Long shareContent : shareContents) { + ZfShare za = new ZfShare(); + za.setUserId(getUserId()); + za.setShareContent(shareContent); + za.setShareId(shareId); + za.setSysMenuId(2056L); + addData(za); + } + } + // Long [] + // if(bl) + return AjaxResult.success("鍒嗕韩鎴愬姛!"); + } + + @Override + public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { + Long [] shareIds = shareMore.getShareIds(); + List<TravelCount> beanRecord3 = new ArrayList<>(); + for (Long shareId : shareIds) { + { + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,shareId) + .eq(ZfShare::getSysMenuId,shareMore.getSysMenuId()) + .eq(ZfShare::getUserId, getUserId()); + List<ZfShare> beanRecords = list(lqw); + for (ZfShare beanRecord : beanRecords ) { + beanRecord3.add(travelCountService.getById(beanRecord.getShareContent())); + } + } + } + List<TravelCount> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + + int totalPage = (beanRecord3.size() -1) / pageSize +1; + + Page<TravelCount> travelCountPage = new Page<>(pageNo, pageSize,totalPage); + HashMap<String, Object> data = MapUtils.getShareResult(travelCountPage, 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) + { + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,shareId) + .eq(ZfShare::getShareContent, shareContent) + .eq(ZfShare::getSysMenuId, shareMore.getSysMenuId()) + .eq(ZfShare::getUserId, getUserId()); + + remove(lqw); + // addData(za); + } + return AjaxResult.success("鏁版嵁鏀跺洖鎴愬姛!"); + } + + @Override + public AjaxResult listByUserId() { + HashMap<Long,List<TravelCount>> bs = new HashMap<>(); + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,getUserId()); + lqw.eq(ZfShare::getSysMenuId,2056L); + List<ZfShare> beanRecords = list(lqw); + List<TravelCount> b1 = new ArrayList<>(); + for (ZfShare beanRecord : beanRecords ) { + b1.add(travelCountService.getById(beanRecord.getShareContent())); + bs.put(beanRecord.getUserId(),b1); + } + log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs); + return AjaxResult.success(bs); + } + + @Override + public AjaxResult listUserId(Integer pageNo, Integer pageSize) { + List<TravelCount> bs = new ArrayList<>(); + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,getUserId()); + lqw.eq(ZfShare::getSysMenuId,2056L); + List<ZfShare> beanRecords = list(lqw); + for (ZfShare beanRecord : beanRecords ) { + TravelCount bs2 = travelCountService.getById(beanRecord.getShareContent()); + bs2.setShareId(beanRecord.getUserId().intValue()); + bs.add(bs2); + } + log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs); + List<TravelCount> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + + int totalPage = (bs.size() -1) / pageSize +1; + + Page<TravelCount> travelCountPage = new Page<>(pageNo, pageSize,totalPage); + HashMap<String, Object> data = MapUtils.getShareResult(travelCountPage, record,bs.size()); + return AjaxResult.success(data); + } + + @Override + public Long getShareId(ZfDownload zfDownload) { + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId, zfDownload.getDownloadId()) + .eq(ZfShare::getShareContent, zfDownload.getDownloadContent()) + .eq(ZfShare::getSysMenuId, zfDownload.getSysMenuId()); + List<ZfShare> beanRecords = list(lqw); + if (beanRecords.size() != 0){ + return beanRecords.get(0).getUserId(); + } + else { + return null; + } + } +} 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 new file mode 100644 index 0000000..9dfafed --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailDownServiceImpl.java @@ -0,0 +1,158 @@ + +package com.ruoyi.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.utils.MapUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.domain.*; +import com.ruoyi.mapper.ZfDownloadMapper; +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.*; +import java.util.stream.Collectors; + +@Service +@Slf4j +public class TravelDetailDownServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements TravelDetailDownlService { + @Resource + EsService esService; + + @Resource + TravelDetailSharService travelDetailSharService; + + @Resource + TravelDetailService travelDetailService; + + + @Resource + ZInfoUserService zInfoUserService; + + @Resource + private RestHighLevelClient restHighLevelClient; + + private LambdaQueryWrapper<ZfDownload> buildCondition(ZfDownload zfDownload, Long userId) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ZfDownload::getDownloadId,userId); + lqw.orderByDesc(ZfDownload::getDownloadId); + lqw.like(zfDownload.getDownloadId() != null, ZfDownload::getDownloadId, zfDownload.getDownloadId()) + .like(zfDownload.getDownloadContent() != null, ZfDownload::getDownloadContent, zfDownload.getDownloadContent()) + .eq( ZfDownload::getSysMenuId, zfDownload.getSysMenuId()); + return lqw; + } + private LambdaQueryWrapper<ZfDownload> uniqueCondition(ZfDownload zfDownload) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfDownload.getDownloadId())), ZfDownload::getDownloadId, zfDownload.getDownloadId()) + .eq(StringUtils.isNotEmpty(String.valueOf(zfDownload.getDownloadContent())), ZfDownload::getDownloadContent, zfDownload.getDownloadContent()) + .eq(ZfDownload::getSysMenuId, zfDownload.getSysMenuId()); + return lqw; + } + + public Long getUserId() { + ZInfoUser myself = zInfoUserService.getMyself(); + return myself.getUserId(); + } + @Override + public AjaxResult addData(ZfDownload zfDownload) { + zfDownload.setDownloadId(getUserId()); + LambdaQueryWrapper<ZfDownload> lqw = uniqueCondition(zfDownload); + List<ZfDownload> list = list(lqw); + if (list.size() > 0) { + throw new RuntimeException("璇峰嬁閲嶅涓嬭浇鏁版嵁"); + } + + zfDownload.setDownloadId(getUserId()); + zfDownload.setShareId(travelDetailSharService.getShareId(zfDownload)); + if (save(zfDownload)) { + EsModel esModel = new EsModel(); + Integer inte = zfDownload.getId().intValue(); + String uuid = UUID.randomUUID().toString().replace("-", ""); + esModel.setId(uuid); + esModel.setCtId(Long.valueOf(inte)); + esModel.setCtTableName("閫氳褰�"); + + esModel.setBy1(String.valueOf(zfDownload.getDownloadId())); + esModel.setBy2(String.valueOf(zfDownload.getDownloadContent())); + esModel.setBy3(String.valueOf(zfDownload.getShareId())); + //杩欓噷瀛樺偍鏌ヨ璇︽儏鐨勮矾寰� + esService.insertTable(esModel); + + System.out.println(" vhuwtjghb/"+zfDownload.getDownloadId()); + TravelDetail travelDetail =travelDetailService.getById(zfDownload.getDownloadContent()); + if (travelDetail != null){ + Long id = travelDetail.getCid(); + if (id != null){ + zfDownload.setId(zfDownload.getId()+1); + zfDownload.setSysMenuId(2056L); + zfDownload.setDownloadContent(id); + List<ZfDownload> travelCount = list(uniqueCondition(zfDownload)); + System.out.println("nmfiwwugn419526/"+zfDownload); + System.out.println(travelCount); + if (travelCount.size() == 0){ + addData(zfDownload); + }}} + return AjaxResult.success(); + } else { + return AjaxResult.error(); + } + } + + + @Override + public AjaxResult deleteData(Long[] ids) { + List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + + if (travelDetailService.removeByIds(Arrays.asList(ids))) { + + //鍒犻櫎es涓殑鏁版嵁 + zfDownloads.stream().forEach(zfDoctorDownload -> { + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "閫氳褰曚笅杞�"); + + if (esModel != null) { + DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); + try { + restHighLevelClient.delete(deleteRequest, RequestOptions.DEFAULT); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + }); + return AjaxResult.success(); + } else { + return AjaxResult.error(); + } + } + + @Override + public AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo, Integer pageSize) { + ZInfoUser myself = zInfoUserService.getMyself(); + LambdaQueryWrapper<ZfDownload> lqw = buildCondition(zfDownload,myself.getUserId()); + List<ZfDownload> beanRecords = list(lqw); + List<TravelDetail> bs = new ArrayList<>(); + for (ZfDownload a: beanRecords) { + if (travelDetailService.getById(a.getDownloadContent()) != null) { + TravelDetail ds = travelDetailService.getById(a.getDownloadContent()); + ds.setShareId(a.getShareId().intValue()); + bs.add(ds); + } + } + List<TravelDetail> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + + int totalPage = (bs.size() -1) / pageSize +1; + + Page<TravelDetail> travelDetailPage = new Page<>(pageNo, pageSize,totalPage); + HashMap<String, Object> data = MapUtils.getShareResult(travelDetailPage, record,bs.size()); + return AjaxResult.success(data); + } + +} 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 new file mode 100644 index 0000000..84e0c50 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDetailSharServiceImpl.java @@ -0,0 +1,204 @@ + +package com.ruoyi.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.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 lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +@Service +@Slf4j +public class TravelDetailSharServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements TravelDetailSharService { + @Resource + TravelDetailService travelDetailService; + + @Resource + private ZInfoUserService zInfoUserService; + + @Resource + TravelCountSharService travelCountSharService; + + + private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getShareId())), ZfShare::getShareId, zfShare.getShareId()); + lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getShareContent())), ZfShare::getShareContent, zfShare.getShareContent()); + lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getSysMenuId())), ZfShare::getSysMenuId, zfShare.getSysMenuId()); + return lqw; + } + + @Override + public List<ZfShare> getAuthority() { + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,userId); + + return list(lqw); + } + + public Long getUserId(){ + ZInfoUser myself = zInfoUserService.getMyself(); + return myself.getUserId(); + + } + + public void addData(ZfShare za) + { + LambdaQueryWrapper<ZfShare> lqw = uniqueCondition(za); + List<ZfShare> list = list(lqw); + + if(list.size()>0){ + throw new RuntimeException("璇峰嬁鍒嗕韩閲嶅鏁版嵁"); + } + else { + save(za); + } + + } + + @Override + public AjaxResult saveZa(ShareMore shareMore) { + Long [] shareIds = shareMore.getShareIds(); + Long [] shareContents = shareMore.getShareContents(); + for (Long shareId : shareIds) { + for (Long shareContent : shareContents) { + ZfShare za = new ZfShare(); + za.setUserId(getUserId()); + za.setShareContent(shareContent); + za.setShareId(shareId); + za.setSysMenuId(2055L); + addData(za); + TravelDetail travelDetail =travelDetailService.getById(za.getShareContent()); + Long id = travelDetail.getCid(); + if (id != null){ + za.setId(za.getId()+1); + za.setSysMenuId(2056L); + za.setShareContent(id); + List<ZfShare> travelCount = list(uniqueCondition(za)); + System.out.println("nmfiwwugn419526/"+za); + System.out.println(travelCount); + if (travelCount.size() == 0){ + addData(za); + }} + } + } + // Long [] + // if(bl) + return AjaxResult.success("鍒嗕韩鎴愬姛!"); + } + + @Override + public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { + Long [] shareIds = shareMore.getShareIds(); + List<TravelDetail> beanRecord3 = new ArrayList<>(); + for (Long shareId : shareIds) { + { + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,shareId) + .eq(ZfShare::getSysMenuId,shareMore.getSysMenuId()) + .eq(ZfShare::getUserId, getUserId()); + List<ZfShare> beanRecords = list(lqw); + for (ZfShare beanRecord : beanRecords ) { + beanRecord3.add(travelDetailService.getById(beanRecord.getShareContent())); + } + } + } + List<TravelDetail> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + + int totalPage = (beanRecord3.size() -1) / pageSize +1; + + Page<TravelDetail> travelDetailPage = new Page<>(pageNo, pageSize,totalPage); + HashMap<String, Object> data = MapUtils.getShareResult(travelDetailPage, 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) + { + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,shareId) + .eq(ZfShare::getShareContent, shareContent) + .eq(ZfShare::getSysMenuId, shareMore.getSysMenuId()) + .eq(ZfShare::getUserId, getUserId()); + + remove(lqw); + // addData(za); + } + return AjaxResult.success("鏁版嵁鏀跺洖鎴愬姛!"); + } + + @Override + public AjaxResult listByUserId() { + HashMap<Long,List<TravelDetail>> bs = new HashMap<>(); + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,getUserId()); + lqw.eq(ZfShare::getSysMenuId,2055L); + List<ZfShare> beanRecords = list(lqw); + List<TravelDetail> b1 = new ArrayList<>(); + for (ZfShare beanRecord : beanRecords ) { + b1.add(travelDetailService.getById(beanRecord.getShareContent())); + bs.put(beanRecord.getUserId(),b1); + } + log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs); + return AjaxResult.success(bs); + } + + @Override + public AjaxResult listUserId(Integer pageNo, Integer pageSize) { + List<TravelDetail> bs = new ArrayList<>(); + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,getUserId()); + lqw.eq(ZfShare::getSysMenuId,2055L); + List<ZfShare> beanRecords = list(lqw); + for (ZfShare beanRecord : beanRecords ) { + TravelDetail bs2 = travelDetailService.getById(beanRecord.getShareContent()); + bs2.setShareId(beanRecord.getUserId().intValue()); + bs.add(bs2); + } + log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs); + List<TravelDetail> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + + int totalPage = (bs.size() -1) / pageSize +1; + + Page<TravelDetail> travelDetailPage = new Page<>(pageNo, pageSize,totalPage); + HashMap<String, Object> data = MapUtils.getShareResult(travelDetailPage, record,bs.size()); + return AjaxResult.success(data); + } + + @Override + public Long getShareId(ZfDownload zfDownload) { + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId, zfDownload.getDownloadId()) + .eq(ZfShare::getShareContent, zfDownload.getDownloadContent()) + .eq(ZfShare::getSysMenuId, zfDownload.getSysMenuId()); + List<ZfShare> beanRecords = list(lqw); + if (beanRecords.size() != 0){ + return beanRecords.get(0).getUserId(); + } + else { + return null; + } + } +} diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDownServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDownServiceImpl.java deleted file mode 100644 index 0d15312..0000000 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/TravelDownServiceImpl.java +++ /dev/null @@ -1,6 +0,0 @@ - -package com.ruoyi.service.impl; - -public class TravelDownServiceImpl { - -} diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/TravelSharServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelSharServiceImpl.java deleted file mode 100644 index fe44468..0000000 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/TravelSharServiceImpl.java +++ /dev/null @@ -1,51 +0,0 @@ - -package com.ruoyi.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.domain.ShareMore; -import com.ruoyi.domain.ZfDownload; -import com.ruoyi.domain.ZfProperty; -import com.ruoyi.domain.ZfShare; -import com.ruoyi.mapper.ZfShareMapper; -import com.ruoyi.service.TravelSharService; -import org.springframework.web.multipart.MultipartFile; - -import java.util.List; - -public class TravelSharServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements TravelSharService { - @Override - public List<ZfShare> getAuthority() { - return null; - } - - @Override - public AjaxResult saveZa(ShareMore shareMore) { - return null; - } - - @Override - public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { - return null; - } - - @Override - public AjaxResult deleteZa(ShareMore shareMore) { - return null; - } - - @Override - public AjaxResult listByUserId() { - return null; - } - - @Override - public AjaxResult listUserId(Integer pageNo, Integer pageSize) { - return null; - } - - @Override - public Long getShareId(ZfDownload zfDownload) { - return null; - } -} 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 new file mode 100644 index 0000000..ab6689f --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetDownServiceImpl.java @@ -0,0 +1,145 @@ + +package com.ruoyi.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.utils.MapUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.domain.ZInfoUser; +import com.ruoyi.domain.ZfDownload; +import com.ruoyi.domain.ZfPet; +import com.ruoyi.domain.ZfPetNote; +import com.ruoyi.mapper.ZfDownloadMapper; +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.*; +import java.util.stream.Collectors; + +@Service +@Slf4j +public class ZfPetDownServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements ZfPetDownlService { + @Resource + EsService esService; + + @Resource + ZfPetSharService zfPetSharService; + + @Resource + ZfPetService zfPetService; + + + @Resource + ZInfoUserService zInfoUserService; + + @Resource + private RestHighLevelClient restHighLevelClient; + + private LambdaQueryWrapper<ZfDownload> buildCondition(ZfDownload zfDownload, Long userId) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ZfDownload::getDownloadId,userId); + lqw.orderByDesc(ZfDownload::getDownloadId); + lqw.like(zfDownload.getDownloadId() != null, ZfDownload::getDownloadId, zfDownload.getDownloadId()) + .like(zfDownload.getDownloadContent() != null, ZfDownload::getDownloadContent, zfDownload.getDownloadContent()) + .eq( ZfDownload::getSysMenuId, zfDownload.getSysMenuId()); + return lqw; + } + private LambdaQueryWrapper<ZfDownload> uniqueCondition(ZfDownload zfDownload) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfDownload.getDownloadId())), ZfDownload::getDownloadId, zfDownload.getDownloadId()) + .eq(StringUtils.isNotEmpty(String.valueOf(zfDownload.getDownloadContent())), ZfDownload::getDownloadContent, zfDownload.getDownloadContent()) + .eq(ZfDownload::getSysMenuId, zfDownload.getSysMenuId()); + return lqw; + } + + public Long getUserId() { + ZInfoUser myself = zInfoUserService.getMyself(); + return myself.getUserId(); + } + @Override + public AjaxResult addData(ZfDownload zfDownload) { + zfDownload.setDownloadId(getUserId()); + LambdaQueryWrapper<ZfDownload> lqw = uniqueCondition(zfDownload); + List<ZfDownload> list = list(lqw); + if (list.size() > 0) { + throw new RuntimeException("璇峰嬁閲嶅涓嬭浇鏁版嵁"); + } + + zfDownload.setDownloadId(getUserId()); + zfDownload.setShareId(zfPetSharService.getShareId(zfDownload)); + if (save(zfDownload)) { + EsModel esModel = new EsModel(); + Integer inte = zfDownload.getId().intValue(); + String uuid = UUID.randomUUID().toString().replace("-", ""); + esModel.setId(uuid); + esModel.setCtId(Long.valueOf(inte)); + esModel.setCtTableName("閫氳褰�"); + + esModel.setBy1(String.valueOf(zfDownload.getDownloadId())); + esModel.setBy2(String.valueOf(zfDownload.getDownloadContent())); + esModel.setBy3(String.valueOf(zfDownload.getShareId())); + //杩欓噷瀛樺偍鏌ヨ璇︽儏鐨勮矾寰� + esService.insertTable(esModel); + return AjaxResult.success(); + } else { + return AjaxResult.error(); + } + } + + @Override + public AjaxResult deleteData(Long[] ids) { + List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + + if (zfPetService.removeByIds(Arrays.asList(ids))) { + + //鍒犻櫎es涓殑鏁版嵁 + zfDownloads.stream().forEach(zfDoctorDownload -> { + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "閫氳褰曚笅杞�"); + + if (esModel != null) { + DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); + try { + restHighLevelClient.delete(deleteRequest, RequestOptions.DEFAULT); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + }); + return AjaxResult.success(); + } else { + return AjaxResult.error(); + } + } + + @Override + public AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo, Integer pageSize) { + ZInfoUser myself = zInfoUserService.getMyself(); + LambdaQueryWrapper<ZfDownload> lqw = buildCondition(zfDownload,myself.getUserId()); + List<ZfDownload> beanRecords = list(lqw); + List<ZfPet> bs = new ArrayList<>(); + for (ZfDownload a: beanRecords) { + if (zfPetService.getById(a.getDownloadContent()) != null) { + ZfPet ds = zfPetService.getById(a.getDownloadContent()); + ds.setShareId(a.getShareId().intValue()); + bs.add(ds); + } + } + List<ZfPet> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + + 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()); + return AjaxResult.success(data); + } + +} diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetDownlServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetDownlServiceImpl.java deleted file mode 100644 index ea807ce..0000000 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetDownlServiceImpl.java +++ /dev/null @@ -1,5 +0,0 @@ - -package com.ruoyi.service.impl; - -public class ZfPetDownlServiceImpl { -} diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetNoteDownServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetNoteDownServiceImpl.java new file mode 100644 index 0000000..83f3d1c --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetNoteDownServiceImpl.java @@ -0,0 +1,145 @@ + +package com.ruoyi.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.utils.MapUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.domain.ZInfoUser; +import com.ruoyi.domain.ZfContact; +import com.ruoyi.domain.ZfDownload; +import com.ruoyi.domain.ZfPetNote; +import com.ruoyi.mapper.ZfDownloadMapper; +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.*; +import java.util.stream.Collectors; + +@Service +@Slf4j +public class ZfPetNoteDownServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements ZfPetNoteDownlService { + @Resource + EsService esService; + + @Resource + ZfPetNoteSharService zfPetNoteSharService; + + @Resource + ZfPetNoteService zfPetNoteService; + + + @Resource + ZInfoUserService zInfoUserService; + + @Resource + private RestHighLevelClient restHighLevelClient; + + private LambdaQueryWrapper<ZfDownload> buildCondition(ZfDownload zfDownload, Long userId) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.in(ZfDownload::getDownloadId,userId); + lqw.orderByDesc(ZfDownload::getDownloadId); + lqw.like(zfDownload.getDownloadId() != null, ZfDownload::getDownloadId, zfDownload.getDownloadId()) + .like(zfDownload.getDownloadContent() != null, ZfDownload::getDownloadContent, zfDownload.getDownloadContent()) + .eq( ZfDownload::getSysMenuId, zfDownload.getSysMenuId()); + return lqw; + } + private LambdaQueryWrapper<ZfDownload> uniqueCondition(ZfDownload zfDownload) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfDownload.getDownloadId())), ZfDownload::getDownloadId, zfDownload.getDownloadId()) + .eq(StringUtils.isNotEmpty(String.valueOf(zfDownload.getDownloadContent())), ZfDownload::getDownloadContent, zfDownload.getDownloadContent()) + .eq(ZfDownload::getSysMenuId, zfDownload.getSysMenuId()); + return lqw; + } + + public Long getUserId() { + ZInfoUser myself = zInfoUserService.getMyself(); + return myself.getUserId(); + } + @Override + public AjaxResult addData(ZfDownload zfDownload) { + zfDownload.setDownloadId(getUserId()); + LambdaQueryWrapper<ZfDownload> lqw = uniqueCondition(zfDownload); + List<ZfDownload> list = list(lqw); + if (list.size() > 0) { + throw new RuntimeException("璇峰嬁閲嶅涓嬭浇鏁版嵁"); + } + + zfDownload.setDownloadId(getUserId()); + zfDownload.setShareId(zfPetNoteSharService.getShareId(zfDownload)); + if (save(zfDownload)) { + EsModel esModel = new EsModel(); + Integer inte = zfDownload.getId().intValue(); + String uuid = UUID.randomUUID().toString().replace("-", ""); + esModel.setId(uuid); + esModel.setCtId(Long.valueOf(inte)); + esModel.setCtTableName("閫氳褰�"); + + esModel.setBy1(String.valueOf(zfDownload.getDownloadId())); + esModel.setBy2(String.valueOf(zfDownload.getDownloadContent())); + esModel.setBy3(String.valueOf(zfDownload.getShareId())); + //杩欓噷瀛樺偍鏌ヨ璇︽儏鐨勮矾寰� + esService.insertTable(esModel); + return AjaxResult.success(); + } else { + return AjaxResult.error(); + } + } + + @Override + public AjaxResult deleteData(Long[] ids) { + List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids)); + + if (zfPetNoteService.removeByIds(Arrays.asList(ids))) { + + //鍒犻櫎es涓殑鏁版嵁 + zfDownloads.stream().forEach(zfDoctorDownload -> { + EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "閫氳褰曚笅杞�"); + + if (esModel != null) { + DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); + try { + restHighLevelClient.delete(deleteRequest, RequestOptions.DEFAULT); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + }); + return AjaxResult.success(); + } else { + return AjaxResult.error(); + } + } + + @Override + public AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo, Integer pageSize) { + ZInfoUser myself = zInfoUserService.getMyself(); + LambdaQueryWrapper<ZfDownload> lqw = buildCondition(zfDownload,myself.getUserId()); + List<ZfDownload> beanRecords = list(lqw); + List<ZfPetNote> bs = new ArrayList<>(); + for (ZfDownload a: beanRecords) { + if (zfPetNoteService.getById(a.getDownloadContent()) != null) { + ZfPetNote ds = zfPetNoteService.getById(a.getDownloadContent()); + ds.setShareId(a.getShareId().intValue()); + bs.add(ds); + } + } + List<ZfPetNote> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + + int totalPage = (bs.size() -1) / pageSize +1; + + Page<ZfPetNote> zfPetNotePage = new Page<>(pageNo, pageSize,totalPage); + HashMap<String, Object> data = MapUtils.getShareResult(zfPetNotePage, record,bs.size()); + return AjaxResult.success(data); + } + +} diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetNoteSharServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetNoteSharServiceImpl.java new file mode 100644 index 0000000..5f9773f --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetNoteSharServiceImpl.java @@ -0,0 +1,188 @@ + +package com.ruoyi.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.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 lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +@Service +@Slf4j +public class ZfPetNoteSharServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements ZfPetNoteSharService { + @Resource + ZfPetNoteService zfPetNoteService; + + @Resource + private ZInfoUserService zInfoUserService; + + private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getShareId())), ZfShare::getShareId, zfShare.getShareId()); + lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getShareContent())), ZfShare::getShareContent, zfShare.getShareContent()); + lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getSysMenuId())), ZfShare::getSysMenuId, zfShare.getSysMenuId()); + return lqw; + } + + @Override + public List<ZfShare> getAuthority() { + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,userId); + + return list(lqw); + } + + public Long getUserId(){ + ZInfoUser myself = zInfoUserService.getMyself(); + return myself.getUserId(); + + } + + public void addData(ZfShare za) + { + LambdaQueryWrapper<ZfShare> lqw = uniqueCondition(za); + List<ZfShare> list = list(lqw); + + if(list.size()>0){ + throw new RuntimeException("璇峰嬁鍒嗕韩閲嶅鏁版嵁"); + } + else { + save(za); + } + + } + + @Override + public AjaxResult saveZa(ShareMore shareMore) { + Long [] shareIds = shareMore.getShareIds(); + Long [] shareContents = shareMore.getShareContents(); + for (Long shareId : shareIds) { + for (Long shareContent : shareContents) { + ZfShare za = new ZfShare(); + za.setUserId(getUserId()); + za.setShareContent(shareContent); + za.setShareId(shareId); + za.setSysMenuId(2061L); + addData(za); + } + } + // Long [] + // if(bl) + return AjaxResult.success("鍒嗕韩鎴愬姛!"); + } + + @Override + public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { + Long [] shareIds = shareMore.getShareIds(); + List<ZfPetNote> beanRecord3 = new ArrayList<>(); + for (Long shareId : shareIds) { + { + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,shareId) + .eq(ZfShare::getSysMenuId,shareMore.getSysMenuId()) + .eq(ZfShare::getUserId, getUserId()); + List<ZfShare> beanRecords = list(lqw); + for (ZfShare beanRecord : beanRecords ) { + beanRecord3.add(zfPetNoteService.getById(beanRecord.getShareContent())); + } + } + } + List<ZfPetNote> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + + int totalPage = (beanRecord3.size() -1) / pageSize +1; + + Page<ZfPetNote> zfPetNotePage = new Page<>(pageNo, pageSize,totalPage); + HashMap<String, Object> data = MapUtils.getShareResult(zfPetNotePage, 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) + { + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,shareId) + .eq(ZfShare::getShareContent, shareContent) + .eq(ZfShare::getSysMenuId, shareMore.getSysMenuId()) + .eq(ZfShare::getUserId, getUserId()); + + remove(lqw); + // addData(za); + } + return AjaxResult.success("鏁版嵁鏀跺洖鎴愬姛!"); + } + + @Override + public AjaxResult listByUserId() { + HashMap<Long,List<ZfPetNote>> bs = new HashMap<>(); + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,getUserId()); + lqw.eq(ZfShare::getSysMenuId,2061L); + List<ZfShare> beanRecords = list(lqw); + List<ZfPetNote> b1 = new ArrayList<>(); + for (ZfShare beanRecord : beanRecords ) { + b1.add(zfPetNoteService.getById(beanRecord.getShareContent())); + bs.put(beanRecord.getUserId(),b1); + } + log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs); + return AjaxResult.success(bs); + } + + @Override + public AjaxResult listUserId(Integer pageNo, Integer pageSize) { + List<ZfPetNote> bs = new ArrayList<>(); + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,getUserId()); + lqw.eq(ZfShare::getSysMenuId,2061L); + List<ZfShare> beanRecords = list(lqw); + for (ZfShare beanRecord : beanRecords ) { + ZfPetNote bs2 = zfPetNoteService.getById(beanRecord.getShareContent()); + bs2.setShareId(beanRecord.getUserId().intValue()); + bs.add(bs2); + } + log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs); + List<ZfPetNote> record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + + int totalPage = (bs.size() -1) / pageSize +1; + + Page<ZfPetNote> zfPetNotePage = new Page<>(pageNo, pageSize,totalPage); + HashMap<String, Object> data = MapUtils.getShareResult(zfPetNotePage, record,bs.size()); + return AjaxResult.success(data); + } + + @Override + public Long getShareId(ZfDownload zfDownload) { + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId, zfDownload.getDownloadId()) + .eq(ZfShare::getShareContent, zfDownload.getDownloadContent()) + .eq(ZfShare::getSysMenuId, zfDownload.getSysMenuId()); + List<ZfShare> beanRecords = list(lqw); + if (beanRecords.size() != 0){ + return beanRecords.get(0).getUserId(); + } + else { + return null; + } + } +} 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 280141b..3874756 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 @@ -1,6 +1,192 @@ package com.ruoyi.service.impl; -public class ZfPetSharServiceImpl { +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.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 lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +@Service +@Slf4j +public class ZfPetSharServiceImpl extends ServiceImpl<ZfShareMapper, ZfShare> implements ZfPetSharService { + + @Resource + ZfPetService zfPetService; + + @Resource + private ZInfoUserService zInfoUserService; + + private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getShareId())), ZfShare::getShareId, zfShare.getShareId()); + lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getShareContent())), ZfShare::getShareContent, zfShare.getShareContent()); + lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfShare.getSysMenuId())), ZfShare::getSysMenuId, zfShare.getSysMenuId()); + return lqw; + } + + @Override + public List<ZfShare> getAuthority() { + SysUser user = SecurityUtils.getLoginUser().getUser(); + Long userId = user.getUserId(); + + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,userId); + + return list(lqw); + } + + public Long getUserId(){ + ZInfoUser myself = zInfoUserService.getMyself(); + return myself.getUserId(); + + } + + public void addData(ZfShare za) + { + LambdaQueryWrapper<ZfShare> lqw = uniqueCondition(za); + List<ZfShare> list = list(lqw); + + if(list.size()>0){ + throw new RuntimeException("璇峰嬁鍒嗕韩閲嶅鏁版嵁"); + } + else { + save(za); + } + + } + + @Override + public AjaxResult saveZa(ShareMore shareMore) { + Long [] shareIds = shareMore.getShareIds(); + Long [] shareContents = shareMore.getShareContents(); + for (Long shareId : shareIds) { + for (Long shareContent : shareContents) { + ZfShare za = new ZfShare(); + za.setUserId(getUserId()); + za.setShareContent(shareContent); + za.setShareId(shareId); + za.setSysMenuId(2022L); + addData(za); + } + } + // Long [] + // if(bl) + return AjaxResult.success("鍒嗕韩鎴愬姛!"); + } + + @Override + public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) { + 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()) + .eq(ZfShare::getUserId, getUserId()); + List<ZfShare> beanRecords = list(lqw); + for (ZfShare beanRecord : beanRecords ) { + beanRecord3.add(zfPetService.getById(beanRecord.getShareContent())); + } + } + } + List<ZfPet> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList()); + + 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()); + + 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) + { + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,shareId) + .eq(ZfShare::getShareContent, shareContent) + .eq(ZfShare::getSysMenuId, shareMore.getSysMenuId()) + .eq(ZfShare::getUserId, getUserId()); + + remove(lqw); + // addData(za); + } + return AjaxResult.success("鏁版嵁鏀跺洖鎴愬姛!"); + } + + @Override + public AjaxResult listByUserId() { + HashMap<Long,List<ZfPet>> bs = new HashMap<>(); + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,getUserId()); + lqw.eq(ZfShare::getSysMenuId,2022L); + List<ZfShare> beanRecords = list(lqw); + List<ZfPet> b1 = new ArrayList<>(); + for (ZfShare beanRecord : beanRecords ) { + b1.add(zfPetService.getById(beanRecord.getShareContent())); + bs.put(beanRecord.getUserId(),b1); + } + log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs); + return AjaxResult.success(bs); + } + + @Override + public AjaxResult listUserId(Integer pageNo, Integer pageSize) { + List<ZfPet> bs = new ArrayList<>(); + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId,getUserId()); + lqw.eq(ZfShare::getSysMenuId,2022L); + List<ZfShare> beanRecords = list(lqw); + 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()); + + 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()); + return AjaxResult.success(data); + } + + @Override + public Long getShareId(ZfDownload zfDownload) { + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getShareId, zfDownload.getDownloadId()) + .eq(ZfShare::getShareContent, zfDownload.getDownloadContent()) + .eq(ZfShare::getSysMenuId, zfDownload.getSysMenuId()); + List<ZfShare> beanRecords = list(lqw); + if (beanRecords.size() != 0){ + return beanRecords.get(0).getUserId(); + } + else { + return null; + } + } } -- Gitblit v1.9.1