From e37d2ce605787d75fe4fc851c87e7b6c02c9b2d8 Mon Sep 17 00:00:00 2001 From: zqy <2522236926@qq.com> Date: 星期六, 09 十一月 2024 17:14:51 +0800 Subject: [PATCH] 我的分享和收藏 --- zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java | 3 zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java | 8 ++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ShareACollectionController.java | 31 +++++++ zhang-content/src/main/java/com/ruoyi/constant/MenuAuthority.java | 2 ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java | 6 + zhang-content/src/main/java/com/ruoyi/service/ShareACollectionService.java | 15 +++ zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java | 18 ++-- ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java | 4 zhang-content/pom.xml | 8 ++ zhang-content/src/main/java/com/ruoyi/service/impl/ShareACollectionServiceImpl.java | 138 ++++++++++++++++++++++++++++++++++ zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java | 4 + 11 files changed, 222 insertions(+), 15 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ShareACollectionController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ShareACollectionController.java new file mode 100644 index 0000000..ca23988 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ShareACollectionController.java @@ -0,0 +1,31 @@ +package com.ruoyi.web.controller.zhang; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.service.ShareACollectionService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +@RestController +public class ShareACollectionController { + + @Resource + ShareACollectionService shareACollectionService; + /** + * 鑾峰彇鎴戝垎浜粰鍒汉鐨勬暟鎹紙鎵�鏈夋ā鍧楋級 + */ + @GetMapping("/share/all") + public AjaxResult allShareByUserId(Long userId){ + return shareACollectionService.allMyShare(userId); + } + + /** + * 鑾峰彇鎴戜笅杞界殑鏁版嵁锛堟墍鏈夋ā鍧楋級 + */ + @GetMapping("/collection/all") + public AjaxResult allDownloadByUserId(Long userId){ + return shareACollectionService.allMyDownload(userId); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java index b762e93..f09797d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java @@ -387,8 +387,8 @@ } /** - // * 鍒嗕韩缁欏叾浠栧鏃忔暟鎹紝閫氳繃杈撳叆鍚嶅瓧鏌ユ壘鎵�鏈夌殑鍚屽悕鐢ㄦ埛鍜屽鏃忓彿 - // */ + * 鍒嗕韩缁欏叾浠栧鏃忔暟鎹紝閫氳繃杈撳叆鍚嶅瓧鏌ユ壘鎵�鏈夌殑鍚屽悕鐢ㄦ埛鍜屽鏃忓彿 + */ @PostMapping("/byName") public AjaxResult listByNickNameDate(@RequestBody ZInfoUser zInfoUser) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java index cd26d0c..8a04b2a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java @@ -4,8 +4,7 @@ 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.domain.*; import com.ruoyi.service.ZInfoUserService; import com.ruoyi.service.ZfDoctorDownloadService; import com.ruoyi.service.ZfDoctorService; @@ -14,6 +13,9 @@ import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + import static com.ruoyi.common.core.page.TableSupport.*; @RestController diff --git a/zhang-content/pom.xml b/zhang-content/pom.xml index 12643cd..afce09a 100644 --- a/zhang-content/pom.xml +++ b/zhang-content/pom.xml @@ -81,6 +81,14 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>11</source> + <target>11</target> + </configuration> + </plugin> </plugins> </build> diff --git a/zhang-content/src/main/java/com/ruoyi/constant/MenuAuthority.java b/zhang-content/src/main/java/com/ruoyi/constant/MenuAuthority.java index 4e20265..cde6e6d 100644 --- a/zhang-content/src/main/java/com/ruoyi/constant/MenuAuthority.java +++ b/zhang-content/src/main/java/com/ruoyi/constant/MenuAuthority.java @@ -1,6 +1,6 @@ package com.ruoyi.constant; -import org.omg.CORBA.PUBLIC_MEMBER; +//import org.omg.CORBA.PUBLIC_MEMBER; /** * @Author Jinquan_Ou diff --git a/zhang-content/src/main/java/com/ruoyi/service/ShareACollectionService.java b/zhang-content/src/main/java/com/ruoyi/service/ShareACollectionService.java new file mode 100644 index 0000000..b237ae8 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/service/ShareACollectionService.java @@ -0,0 +1,15 @@ +package com.ruoyi.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.domain.ZfShare; + + + + +public interface ShareACollectionService extends IService<ZfShare> { + + AjaxResult allMyDownload(Long userId); + + AjaxResult allMyShare(Long userId); +} 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 2857f25..a1465dc 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java @@ -4,6 +4,8 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.ZfDownload; +import java.util.List; + public interface ZfDoctorDownloadService extends IService<ZfDownload> { AjaxResult addData(ZfDownload zfDownload); @@ -12,5 +14,7 @@ AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize); + List<ZfDownload> getByUserId(Long userId); + } 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 b69cbe7..005eb68 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.ShareMore; +import com.ruoyi.domain.ZfDoctor; import com.ruoyi.domain.ZfDownload; import com.ruoyi.domain.ZfShare; @@ -10,7 +11,7 @@ public interface ZfDoctorShareService extends IService<ZfShare> { - List<ZfShare> getAuthority(); + List<ZfShare> getByUserId(); AjaxResult saveZa(ShareMore zfDoctor); diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ShareACollectionServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ShareACollectionServiceImpl.java new file mode 100644 index 0000000..1f0da30 --- /dev/null +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ShareACollectionServiceImpl.java @@ -0,0 +1,138 @@ +package com.ruoyi.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.domain.*; +import com.ruoyi.mapper.ZfShareMapper; +import com.ruoyi.service.*; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; + +@Service +public class ShareACollectionServiceImpl extends ServiceImpl<ZfShareMapper, ZfShare> implements ShareACollectionService { + + @Resource + private ZfEventService zfEventService; + + @Resource + private IZfPropertyService iZfPropertyService; + + @Resource + private ZfEquipmentService zfEquipmentService; + + @Resource + private ZfCollectionService zfCollectionService; + + @Resource + private ZfDoctorService zfDoctorService; + + @Resource + private ZfCleanService zfCleanService; + + @Resource + private ZfContactService zfContactService; + + @Resource + private ZfPetService zfPetService; + + @Resource + private ZfEconomyService zfEconomyService; + + @Resource + private ZSelfNoteService zSelfNoteService; + + @Resource + private ZPropertyService zPropertyService; + + @Resource + private ZIdeaService zIdeaService; + + @Resource + private TravelCountService travelCountService; + + @Resource + private TravelDetailService travelDetailService; + + @Resource + private ZHonorService zHonorService; + + @Resource + private ZSecretService zSecretService; + + @Resource + private ZfDoctorDownloadService zfDoctorDownloadService; + + @Override + public AjaxResult allMyDownload(Long userId) { + List<ZfDownload> byUserId = zfDoctorDownloadService.getByUserId(userId); + Map<Long,List<Long>> menuAconId =byUserId.stream().collect(Collectors.groupingBy(ZfDownload::getSysMenuId,Collectors.mapping(ZfDownload::getDownloadContent,Collectors.toList()))); + return AjaxResult.success(all(menuAconId)); + } + + + public List<ZfShare> getByUserId(Long userId) { + LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfShare::getUserId, userId); + + return list(lqw); + } + public Map<Long, Object> all(Map<Long,List<Long>> menuAconId){ + Set<Long> key = menuAconId.keySet(); + Map<Long, Object> an = new HashMap<>(); + if (key.contains(2013L)) + an.put(2013L,zfEventService.selectByIds(menuAconId.get(2013L).toArray(Long[]::new))); + if (key.contains(2002L)) + an.put(2002L,iZfPropertyService.selectByIds(menuAconId.get(2002L).toArray(Long[]::new))); + if (key.contains(2017L)) + an.put(2017L,zfEquipmentService.selectByIds(menuAconId.get(2017L).toArray(Long[]::new))); + if (key.contains(2018L)) + an.put(2018L,zfCollectionService.selectByIds(menuAconId.get(2018L).toArray(Long[]::new))); + if (key.contains(2019L)) + an.put(2019L,zfDoctorService.selectByIds(menuAconId.get(2019L).toArray(Long[]::new))); + if (key.contains(2020L)) + an.put(2020L,zfCleanService.selectByIds(menuAconId.get(2020L).toArray(Long[]::new))); + if (key.contains(2021L)) + an.put(2021L,zfContactService.selectByIds(menuAconId.get(2021L).toArray(Long[]::new))); + if (key.contains(2022L)) + an.put(2022L,zfPetService.selectByIds(menuAconId.get(2022L).toArray(Long[]::new))); + if (key.contains(2023L)) + an.put(2023L,zfEconomyService.selectByIds(menuAconId.get(2023L).toArray(Long[]::new))); + if (key.contains(2010L)) + an.put(2010L,zSelfNoteService.selectByIds(menuAconId.get(2010L).toArray(Long[]::new))); + if (key.contains(2026L)) + an.put(2026L,zPropertyService.selectByIds(menuAconId.get(2026L).toArray(Long[]::new))); + if (key.contains(2027L)) + an.put(2027L,zIdeaService.selectByIds(menuAconId.get(2027L).toArray(Long[]::new))); + if (key.contains(2030L)) + an.put(2030L,zHonorService.selectByIds(menuAconId.get(2030L).toArray(Long[]::new))); + if (key.contains(2031L)) + an.put(2031L,zSecretService.selectByIds(menuAconId.get(2031L).toArray(Long[]::new))); + if (key.contains(2031L)) + an.put(2031L,zSecretService.selectByIds(menuAconId.get(2031L).toArray(Long[]::new))); + if (key.contains(2056L)) { + List<TravelCount> travelCounts = new ArrayList<>(); + for (Long id : menuAconId.get(2056L)) { + travelCounts.add(travelCountService.getById(id)); + } + an.put(2056L,travelCounts); + } + if (key.contains(2055L)) { + List<TravelDetail> travelDetails = new ArrayList<>(); + for (Long id : menuAconId.get(2055L)) { + travelDetails.add(travelDetailService.getById(id)); + } + an.put(2055L,travelDetails.stream().collect(Collectors.groupingBy(TravelDetail::getCid))); + } + return an; + } + + @Override + public AjaxResult allMyShare(Long userId) { + Map<Long,List<Long>> menuAconId = getByUserId(userId).stream().collect(Collectors.groupingBy(ZfShare::getSysMenuId,Collectors.mapping(ZfShare::getShareContent,Collectors.toList()))); + return AjaxResult.success(all(menuAconId)); + } +} 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 89d6c90..3209fbe 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 @@ -10,6 +10,7 @@ import com.ruoyi.domain.ZInfoUser; import com.ruoyi.domain.ZfDoctor; import com.ruoyi.domain.ZfDownload; +import com.ruoyi.domain.ZfShare; import com.ruoyi.mapper.ZfDownloadMapper; import com.ruoyi.service.*; import org.elasticsearch.action.delete.DeleteRequest; @@ -154,4 +155,11 @@ ZInfoUser myself = zInfoUserService.getMyself(); return myself.getUserId(); } + + @Override + public List<ZfDownload> getByUserId(Long userId) { + LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZfDownload::getDownloadId, userId); + return list(lqw); + } } 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 a7e0b9a..6c1927b 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 @@ -11,10 +11,7 @@ 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 com.ruoyi.service.*; import lombok.extern.slf4j.Slf4j; import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.client.RequestOptions; @@ -23,12 +20,12 @@ import javax.annotation.Resource; import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; +import java.util.stream.Stream; import static com.alibaba.druid.sql.PagerUtils.limit; +import static com.ruoyi.constant.MenuAuthority.DOCTOR_LIST_UPDATE; @Slf4j @Service @@ -45,6 +42,9 @@ @Resource EsService esService; + @Resource + private ZfEventService zfEventService; + private LambdaQueryWrapper<ZfShare> uniqueCondition(ZfShare zfShare) { LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); @@ -57,12 +57,12 @@ @Override - public List<ZfShare> getAuthority() { + public List<ZfShare> getByUserId() { SysUser user = SecurityUtils.getLoginUser().getUser(); Long userId = user.getUserId(); LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfShare::getShareId,userId); + lqw.eq(ZfShare::getUserId,userId); return list(lqw); } -- Gitblit v1.9.1