zqy
2024-08-12 ffbf5aeb0804d37ed53a43701981c535102e06c0
个人模块分享
12个文件已修改
50个文件已添加
4622 ■■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZAbroadShareController.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZAutobiographyShareController.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZCertificateShareController.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZExperienceShareController.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorShareController.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZIdeaShareController.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZPropertyShareController.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSecretShareController.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSelfNoteShareController.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfCleanShareController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfRelationShareController.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZAbroad.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZAutobiography.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZCertificate.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZExperience.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZHonor.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZIdea.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZProperty.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZSecret.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZSelfNote.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfRelation.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZAbroadDownloadService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZAbroadShareService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZAutobiographyDownloadService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZAutobiographyShareService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZCertificateDownloadService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZCertificateShareService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZExperienceDownloadService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZExperienceShareService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZHonorDownloadService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZHonorShareService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZIdeaDownloadService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZIdeaShareService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZPropertyDownloadService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZPropertyShareService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZSecretDownloadService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZSecretShareService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZSelfNoteDownloadService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZSelfNoteShareService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZfRelationDownloadService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZfRelationShareService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZAbroadDownloadServiceImpl.java 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZAbroadShareServiceImpl.java 191 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZAutobiographyDownloadServiceImpl.java 145 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZAutobiographyShareServiceImpl.java 194 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZCertificateDownloadServiceImpl.java 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZCertificateShareServiceImpl.java 194 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZExperienceDownloadServiceImpl.java 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZExperienceShareServiceImpl.java 194 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorDownloadServiceImpl.java 145 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorShareServiceImpl.java 191 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZIdeaDownloadServiceImpl.java 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZIdeaShareServiceImpl.java 193 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZPropertyDownloadServiceImpl.java 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZPropertyShareServiceImpl.java 193 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZSecretDownloadServiceImpl.java 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZSecretShareServiceImpl.java 193 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteDownloadServiceImpl.java 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteShareServiceImpl.java 194 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipDownloadServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfRelationDownloadServiceImpl.java 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfRelationShareServiceImpl.java 193 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZAbroadShareController.java
New file
@@ -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.ZAbroadDownloadService;
import com.ruoyi.service.ZAbroadShareService;
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("/zAbroadShare")
public class ZAbroadShareController extends BaseController {
    @Resource
    ZAbroadDownloadService zAbroadDownloadService;
    @Resource
    ZAbroadShareService zAbroadShareService;
    @PostMapping("/share")
    public AjaxResult share(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(20105L);
        return zAbroadShareService.saveZa(zfDoctor);
    }
    /**
     * 根据UserId和分享人shareId查看已经授权给那些人那些数据
     */
    @PostMapping("/getInfoByUserId")
    public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(20105L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return  zAbroadShareService.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 zAbroadShareService.listUserId(pageNo ,pageSize);
    }
    /**
     * 根据userId和shareId收回已经授权给那些人
     */
    @PostMapping("/deleteInfoByUserId")
    public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(20105L);
        return zAbroadShareService.deleteZa(zfDoctor);
    }
    /**
     * 下载分享的数据
     */
    @PostMapping("/downloadDate")
    public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){
        zfDownload.setSysMenuId(20105L);
        return zAbroadDownloadService.addData(zfDownload);
    }
    /**
     * 展示下载分享的数据
     */
    @GetMapping("/all")
    public AjaxResult data(ZfDownload zfDownload){
        zfDownload.setSysMenuId(20105L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return zAbroadDownloadService.selectDoctorList(zfDownload,pageNo ,pageSize);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZAutobiographyShareController.java
New file
@@ -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.ZAutobiographyDownloadService;
import com.ruoyi.service.ZAutobiographyShareService;
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("/zAutobiographyShare")
public class ZAutobiographyShareController extends BaseController {
    @Resource
    ZAutobiographyDownloadService zAutobiographyDownloadService;
    @Resource
    ZAutobiographyShareService zAutobiographyShareService;
    @PostMapping("/share")
    public AjaxResult share(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(20106L);
        return zAutobiographyShareService.saveZa(zfDoctor);
    }
    /**
     * 根据UserId和分享人shareId查看已经授权给那些人那些数据
     */
    @PostMapping("/getInfoByUserId")
    public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(20106L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return  zAutobiographyShareService.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 zAutobiographyShareService.listUserId(pageNo ,pageSize);
    }
    /**
     * 根据userId和shareId收回已经授权给那些人
     */
    @PostMapping("/deleteInfoByUserId")
    public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(20106L);
        return zAutobiographyShareService.deleteZa(zfDoctor);
    }
    /**
     * 下载分享的数据
     */
    @PostMapping("/downloadDate")
    public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){
        zfDownload.setSysMenuId(20106L);
        return zAutobiographyDownloadService.addData(zfDownload);
    }
    /**
     * 展示下载分享的数据
     */
    @GetMapping("/all")
    public AjaxResult data(ZfDownload zfDownload){
        zfDownload.setSysMenuId(20106L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return zAutobiographyDownloadService.selectDoctorList(zfDownload,pageNo ,pageSize);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZCertificateShareController.java
New file
@@ -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.ZCertificateDownloadService;
import com.ruoyi.service.ZCertificateShareService;
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("/zCertificateShare")
public class ZCertificateShareController extends BaseController {
    @Resource
    ZCertificateDownloadService zCertificateDownloadService;
    @Resource
    ZCertificateShareService zCertificateShareService;
    @PostMapping("/share")
    public AjaxResult share(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(20104L);
        return zCertificateShareService.saveZa(zfDoctor);
    }
    /**
     * 根据UserId和分享人shareId查看已经授权给那些人那些数据
     */
    @PostMapping("/getInfoByUserId")
    public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(20104L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return  zCertificateShareService.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 zCertificateShareService.listUserId(pageNo ,pageSize);
    }
    /**
     * 根据userId和shareId收回已经授权给那些人
     */
    @PostMapping("/deleteInfoByUserId")
    public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(20104L);
        return zCertificateShareService.deleteZa(zfDoctor);
    }
    /**
     * 下载分享的数据
     */
    @PostMapping("/downloadDate")
    public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){
        zfDownload.setSysMenuId(20104L);
        return zCertificateDownloadService.addData(zfDownload);
    }
    /**
     * 展示下载分享的数据
     */
    @GetMapping("/all")
    public AjaxResult data(ZfDownload zfDownload){
        zfDownload.setSysMenuId(20104L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return zCertificateDownloadService.selectDoctorList(zfDownload,pageNo ,pageSize);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZExperienceShareController.java
New file
@@ -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.ZExperienceDownloadService;
import com.ruoyi.service.ZExperienceShareService;
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("/zExperienceShare")
public class ZExperienceShareController extends BaseController {
    @Resource
    ZExperienceDownloadService zExperienceDownloadService;
    @Resource
    ZExperienceShareService zExperienceShareService;
    @PostMapping("/share")
    public AjaxResult share(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(20102L);
        return zExperienceShareService.saveZa(zfDoctor);
    }
    /**
     * 根据UserId和分享人shareId查看已经授权给那些人那些数据
     */
    @PostMapping("/getInfoByUserId")
    public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(20102L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return  zExperienceShareService.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 zExperienceShareService.listUserId(pageNo ,pageSize);
    }
    /**
     * 根据userId和shareId收回已经授权给那些人
     */
    @PostMapping("/deleteInfoByUserId")
    public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(20102L);
        return zExperienceShareService.deleteZa(zfDoctor);
    }
    /**
     * 下载分享的数据
     */
    @PostMapping("/downloadDate")
    public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){
        zfDownload.setSysMenuId(20102L);
        return zExperienceDownloadService.addData(zfDownload);
    }
    /**
     * 展示下载分享的数据
     */
    @GetMapping("/all")
    public AjaxResult data(ZfDownload zfDownload){
        zfDownload.setSysMenuId(20102L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return zExperienceDownloadService.selectDoctorList(zfDownload,pageNo ,pageSize);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorShareController.java
New file
@@ -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.ZHonorDownloadService;
import com.ruoyi.service.ZHonorShareService;
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("/zHonorShare")
public class ZHonorShareController extends BaseController {
    @Resource
    ZHonorDownloadService zHonorDownloadService;
    @Resource
    ZHonorShareService zHonorShareService;
    @PostMapping("/share")
    public AjaxResult share(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2053L);
        return zHonorShareService.saveZa(zfDoctor);
    }
    /**
     * 根据UserId和分享人shareId查看已经授权给那些人那些数据
     */
    @PostMapping("/getInfoByUserId")
    public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2053L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return  zHonorShareService.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 zHonorShareService.listUserId(pageNo ,pageSize);
    }
    /**
     * 根据userId和shareId收回已经授权给那些人
     */
    @PostMapping("/deleteInfoByUserId")
    public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2053L);
        return zHonorShareService.deleteZa(zfDoctor);
    }
    /**
     * 下载分享的数据
     */
    @PostMapping("/downloadDate")
    public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){
        zfDownload.setSysMenuId(2053L);
        return zHonorDownloadService.addData(zfDownload);
    }
    /**
     * 展示下载分享的数据
     */
    @GetMapping("/all")
    public AjaxResult data(ZfDownload zfDownload){
        zfDownload.setSysMenuId(2053L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return zHonorDownloadService.selectDoctorList(zfDownload,pageNo ,pageSize);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZIdeaShareController.java
New file
@@ -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.ZIdeaDownloadService;
import com.ruoyi.service.ZIdeaShareService;
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("/zIdeaShare")
public class ZIdeaShareController extends BaseController {
    @Resource
    ZIdeaDownloadService zIdeaDownloadService;
    @Resource
    ZIdeaShareService zIdeaShareService;
    @PostMapping("/share")
    public AjaxResult share(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2027L);
        return zIdeaShareService.saveZa(zfDoctor);
    }
    /**
     * 根据UserId和分享人shareId查看已经授权给那些人那些数据
     */
    @PostMapping("/getInfoByUserId")
    public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2027L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return  zIdeaShareService.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 zIdeaShareService.listUserId(pageNo ,pageSize);
    }
    /**
     * 根据userId和shareId收回已经授权给那些人
     */
    @PostMapping("/deleteInfoByUserId")
    public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2027L);
        return zIdeaShareService.deleteZa(zfDoctor);
    }
    /**
     * 下载分享的数据
     */
    @PostMapping("/downloadDate")
    public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){
        zfDownload.setSysMenuId(2027L);
        return zIdeaDownloadService.addData(zfDownload);
    }
    /**
     * 展示下载分享的数据
     */
    @GetMapping("/all")
    public AjaxResult data(ZfDownload zfDownload){
        zfDownload.setSysMenuId(2027L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return zIdeaDownloadService.selectDoctorList(zfDownload,pageNo ,pageSize);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZPropertyShareController.java
New file
@@ -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.ZPropertyDownloadService;
import com.ruoyi.service.ZPropertyShareService;
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("/zPropertyShare")
public class ZPropertyShareController extends BaseController {
    @Resource
    ZPropertyDownloadService zPropertyDownloadService;
    @Resource
    ZPropertyShareService zPropertyShareService;
    @PostMapping("/share")
    public AjaxResult share(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2026L);
        return zPropertyShareService.saveZa(zfDoctor);
    }
    /**
     * 根据UserId和分享人shareId查看已经授权给那些人那些数据
     */
    @PostMapping("/getInfoByUserId")
    public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2026L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return  zPropertyShareService.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 zPropertyShareService.listUserId(pageNo ,pageSize);
    }
    /**
     * 根据userId和shareId收回已经授权给那些人
     */
    @PostMapping("/deleteInfoByUserId")
    public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2026L);
        return zPropertyShareService.deleteZa(zfDoctor);
    }
    /**
     * 下载分享的数据
     */
    @PostMapping("/downloadDate")
    public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){
        zfDownload.setSysMenuId(2026L);
        return zPropertyDownloadService.addData(zfDownload);
    }
    /**
     * 展示下载分享的数据
     */
    @GetMapping("/all")
    public AjaxResult data(ZfDownload zfDownload){
        zfDownload.setSysMenuId(2026L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return zPropertyDownloadService.selectDoctorList(zfDownload,pageNo ,pageSize);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSecretShareController.java
New file
@@ -0,0 +1,82 @@
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.ZSecretDownloadService;
import com.ruoyi.service.ZfCleanDownloadService;
import com.ruoyi.service.ZSecretShareService;
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("/zSecretShare")
public class ZSecretShareController extends BaseController {
    @Resource
    ZSecretDownloadService zSecretDownloadService;
    @Resource
    ZSecretShareService zSecretShareService;
    @PostMapping("/share")
    public AjaxResult share(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2031L);
        return zSecretShareService.saveZa(zfDoctor);
    }
    /**
     * 根据UserId和分享人shareId查看已经授权给那些人那些数据
     */
    @PostMapping("/getInfoByUserId")
    public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2031L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return  zSecretShareService.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 zSecretShareService.listUserId(pageNo ,pageSize);
    }
    /**
     * 根据userId和shareId收回已经授权给那些人
     */
    @PostMapping("/deleteInfoByUserId")
    public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2031L);
        return zSecretShareService.deleteZa(zfDoctor);
    }
    /**
     * 下载分享的数据
     */
    @PostMapping("/downloadDate")
    public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){
        zfDownload.setSysMenuId(2031L);
        return zSecretDownloadService.addData(zfDownload);
    }
    /**
     * 展示下载分享的数据
     */
    @GetMapping("/all")
    public AjaxResult data(ZfDownload zfDownload){
        zfDownload.setSysMenuId(2031L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return zSecretDownloadService.selectDoctorList(zfDownload,pageNo ,pageSize);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZSelfNoteShareController.java
New file
@@ -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.ZSelfNoteDownloadService;
import com.ruoyi.service.ZSelfNoteShareService;
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("/zSelfNoteShare")
public class ZSelfNoteShareController extends BaseController {
    @Resource
    ZSelfNoteDownloadService zSelfNoteDownloadService;
    @Resource
    ZSelfNoteShareService zSelfNoteShareService;
    @PostMapping("/share")
    public AjaxResult share(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2010L);
        return zSelfNoteShareService.saveZa(zfDoctor);
    }
    /**
     * 根据UserId和分享人shareId查看已经授权给那些人那些数据
     */
    @PostMapping("/getInfoByUserId")
    public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){
        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) ;
    }
    /**
     * 用户自己查看别人分享的数据和分享人
     */
    @GetMapping("/getInfoByShareId")
    public AjaxResult empowerGetInfo2(){
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return zSelfNoteShareService.listUserId(pageNo ,pageSize);
    }
    /**
     * 根据userId和shareId收回已经授权给那些人
     */
    @PostMapping("/deleteInfoByUserId")
    public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2010L);
        return zSelfNoteShareService.deleteZa(zfDoctor);
    }
    /**
     * 下载分享的数据
     */
    @PostMapping("/downloadDate")
    public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){
        zfDownload.setSysMenuId(2010L);
        return zSelfNoteDownloadService.addData(zfDownload);
    }
    /**
     * 展示下载分享的数据
     */
    @GetMapping("/all")
    public AjaxResult data(ZfDownload zfDownload){
        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);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfCleanShareController.java
@@ -18,10 +18,10 @@
import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE;
@RestController
@RequestMapping("/zfCleanShare")
@RequestMapping("/zfHonorShare")
public class ZfCleanShareController extends BaseController {
    @Resource
    ZfCleanDownloadService zfCleanDownloadController;
    ZfCleanDownloadService zfCleanDownloadService;
    @Resource
    ZfCleanShareService zfCleanShareService;
@@ -67,7 +67,7 @@
    @PostMapping("/downloadDate")
    public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){
        zfDownload.setSysMenuId(2020L);
        return zfCleanDownloadController.addData(zfDownload);
        return zfCleanDownloadService.addData(zfDownload);
    }
    /**
@@ -78,6 +78,6 @@
        zfDownload.setSysMenuId(2020L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return zfCleanDownloadController.selectDoctorList(zfDownload,pageNo ,pageSize);
        return zfCleanDownloadService.selectDoctorList(zfDownload,pageNo ,pageSize);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfRelationShareController.java
New file
@@ -0,0 +1,82 @@
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.ZfRelationDownloadService;
import com.ruoyi.service.ZfRelationShareService;
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("/zfRelationShare")
public class ZfRelationShareController extends BaseController {
    @Resource
    ZfRelationDownloadService zfrelationDownloadService;
    @Resource
    ZfRelationShareService zfRelationShareService;
    @PostMapping("/share")
    public AjaxResult share(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(20103L);
        return zfRelationShareService.saveZa(zfDoctor);
    }
    /**
     * 根据UserId和分享人shareId查看已经授权给那些人那些数据
     */
    @PostMapping("/getInfoByUserId")
    public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(20103L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return  zfRelationShareService.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 zfRelationShareService.listUserId(pageNo ,pageSize);
    }
    /**
     * 根据userId和shareId收回已经授权给那些人
     */
    @PostMapping("/deleteInfoByUserId")
    public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(20103L);
        return zfRelationShareService.deleteZa(zfDoctor);
    }
    /**
     * 下载分享的数据
     */
    @PostMapping("/downloadDate")
    public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){
        zfDownload.setSysMenuId(20103L);
        return zfrelationDownloadService.addData(zfDownload);
    }
    /**
     * 展示下载分享的数据
     */
    @GetMapping("/all")
    public AjaxResult data(ZfDownload zfDownload){
        zfDownload.setSysMenuId(20103L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return zfrelationDownloadService.selectDoctorList(zfDownload,pageNo ,pageSize);
    }
}
zhang-content/src/main/java/com/ruoyi/domain/ZAbroad.java
@@ -61,5 +61,8 @@
    @Excel(name="结束日期",dateFormat = "yyyy-MM-dd")
    private Date endTime;
    /**
     * 分享人
     */
    private Integer shareId;
}
zhang-content/src/main/java/com/ruoyi/domain/ZAutobiography.java
@@ -49,5 +49,8 @@
     */
    private String ageEnd;
    /**
     * 分享人
     */
    private Integer shareId;
}
zhang-content/src/main/java/com/ruoyi/domain/ZCertificate.java
@@ -73,6 +73,9 @@
    @Excel(name = "持有情况")
    private String ownStatus;
    /**
     * 分享人
     */
    private Integer shareId;
}
zhang-content/src/main/java/com/ruoyi/domain/ZExperience.java
@@ -63,5 +63,8 @@
    @Excel(name = "证明人名字")
    private String witness;
    /**
     * 分享人
     */
    private Integer shareId;
}
zhang-content/src/main/java/com/ruoyi/domain/ZHonor.java
@@ -96,5 +96,10 @@
     */
    private String url;
    /**
     * 分享人
     */
    private Integer shareId;
}
zhang-content/src/main/java/com/ruoyi/domain/ZIdea.java
@@ -91,4 +91,8 @@
    private Date createTime;
    /**
     * 分享人
     */
    private Integer shareId;
}
zhang-content/src/main/java/com/ruoyi/domain/ZProperty.java
@@ -103,5 +103,8 @@
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date happenEndTime;
    /**
     * 分享人
     */
    private Integer shareId;
}
zhang-content/src/main/java/com/ruoyi/domain/ZSecret.java
@@ -114,5 +114,8 @@
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date happenEndTime;
    /**
     * 分享人
     */
    private Integer shareId;
}
zhang-content/src/main/java/com/ruoyi/domain/ZSelfNote.java
@@ -85,4 +85,8 @@
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date happenEndTime;
    /**
     * 分享人
     */
    private Integer shareId;
}
zhang-content/src/main/java/com/ruoyi/domain/ZfRelation.java
@@ -31,4 +31,9 @@
    private String otherPosition;
    private String otherPolitical;
    /**
     * 分享人
     */
    private Integer shareId;
}
zhang-content/src/main/java/com/ruoyi/service/ZAbroadDownloadService.java
New file
@@ -0,0 +1,13 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZfDownload;
public interface ZAbroadDownloadService extends IService<ZfDownload> {
    AjaxResult addData(ZfDownload zfDownload);
    AjaxResult deleteData(Long[] ids);
    AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize);
}
zhang-content/src/main/java/com/ruoyi/service/ZAbroadShareService.java
New file
@@ -0,0 +1,25 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ShareMore;
import com.ruoyi.domain.ZfDownload;
import com.ruoyi.domain.ZfShare;
import java.util.List;
public interface ZAbroadShareService extends IService<ZfShare> {
    List<ZfShare> getAuthority();
    AjaxResult saveZa(ShareMore shareMore);
    AjaxResult listByFidAid(ShareMore shareMore,Integer pageNo ,Integer pageSize);
    AjaxResult deleteZa(ShareMore shareMore);
    AjaxResult listByUserId();
    AjaxResult listUserId(Integer pageNo ,Integer pageSize);
    Long getShareId(ZfDownload zfDownload);
}
zhang-content/src/main/java/com/ruoyi/service/ZAutobiographyDownloadService.java
New file
@@ -0,0 +1,13 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZfDownload;
public interface ZAutobiographyDownloadService extends IService<ZfDownload> {
    AjaxResult addData(ZfDownload zfDownload);
    AjaxResult deleteData(Long[] ids);
    AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize);
}
zhang-content/src/main/java/com/ruoyi/service/ZAutobiographyShareService.java
New file
@@ -0,0 +1,25 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ShareMore;
import com.ruoyi.domain.ZfDownload;
import com.ruoyi.domain.ZfShare;
import java.util.List;
public interface ZAutobiographyShareService extends IService<ZfShare> {
    List<ZfShare> getAuthority();
    AjaxResult saveZa(ShareMore shareMore);
    AjaxResult listByFidAid(ShareMore shareMore,Integer pageNo ,Integer pageSize);
    AjaxResult deleteZa(ShareMore shareMore);
    AjaxResult listByUserId();
    AjaxResult listUserId(Integer pageNo ,Integer pageSize);
    Long getShareId(ZfDownload zfDownload);
}
zhang-content/src/main/java/com/ruoyi/service/ZCertificateDownloadService.java
New file
@@ -0,0 +1,13 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZfDownload;
public interface ZCertificateDownloadService extends IService<ZfDownload> {
    AjaxResult addData(ZfDownload zfDownload);
    AjaxResult deleteData(Long[] ids);
    AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize);
}
zhang-content/src/main/java/com/ruoyi/service/ZCertificateShareService.java
New file
@@ -0,0 +1,25 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ShareMore;
import com.ruoyi.domain.ZfDownload;
import com.ruoyi.domain.ZfShare;
import java.util.List;
public interface ZCertificateShareService extends IService<ZfShare> {
    List<ZfShare> getAuthority();
    AjaxResult saveZa(ShareMore shareMore);
    AjaxResult listByFidAid(ShareMore shareMore,Integer pageNo ,Integer pageSize);
    AjaxResult deleteZa(ShareMore shareMore);
    AjaxResult listByUserId();
    AjaxResult listUserId(Integer pageNo ,Integer pageSize);
    Long getShareId(ZfDownload zfDownload);
}
zhang-content/src/main/java/com/ruoyi/service/ZExperienceDownloadService.java
New file
@@ -0,0 +1,13 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZfDownload;
public interface ZExperienceDownloadService extends IService<ZfDownload> {
    AjaxResult addData(ZfDownload zfDownload);
    AjaxResult deleteData(Long[] ids);
    AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize);
}
zhang-content/src/main/java/com/ruoyi/service/ZExperienceShareService.java
New file
@@ -0,0 +1,25 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ShareMore;
import com.ruoyi.domain.ZfDownload;
import com.ruoyi.domain.ZfShare;
import java.util.List;
public interface ZExperienceShareService extends IService<ZfShare> {
    List<ZfShare> getAuthority();
    AjaxResult saveZa(ShareMore shareMore);
    AjaxResult listByFidAid(ShareMore shareMore,Integer pageNo ,Integer pageSize);
    AjaxResult deleteZa(ShareMore shareMore);
    AjaxResult listByUserId();
    AjaxResult listUserId(Integer pageNo ,Integer pageSize);
    Long getShareId(ZfDownload zfDownload);
}
zhang-content/src/main/java/com/ruoyi/service/ZHonorDownloadService.java
New file
@@ -0,0 +1,13 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZfDownload;
public interface ZHonorDownloadService extends IService<ZfDownload> {
    AjaxResult addData(ZfDownload zfDownload);
    AjaxResult deleteData(Long[] ids);
    AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize);
}
zhang-content/src/main/java/com/ruoyi/service/ZHonorShareService.java
New file
@@ -0,0 +1,25 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ShareMore;
import com.ruoyi.domain.ZfDownload;
import com.ruoyi.domain.ZfShare;
import java.util.List;
public interface ZHonorShareService extends IService<ZfShare> {
    List<ZfShare> getAuthority();
    AjaxResult saveZa(ShareMore shareMore);
    AjaxResult listByFidAid(ShareMore shareMore,Integer pageNo ,Integer pageSize);
    AjaxResult deleteZa(ShareMore shareMore);
    AjaxResult listByUserId();
    AjaxResult listUserId(Integer pageNo ,Integer pageSize);
    Long getShareId(ZfDownload zfDownload);
}
zhang-content/src/main/java/com/ruoyi/service/ZIdeaDownloadService.java
New file
@@ -0,0 +1,13 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZfDownload;
public interface ZIdeaDownloadService extends IService<ZfDownload> {
    AjaxResult addData(ZfDownload zfDownload);
    AjaxResult deleteData(Long[] ids);
    AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize);
}
zhang-content/src/main/java/com/ruoyi/service/ZIdeaShareService.java
New file
@@ -0,0 +1,25 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ShareMore;
import com.ruoyi.domain.ZfDownload;
import com.ruoyi.domain.ZfShare;
import java.util.List;
public interface ZIdeaShareService extends IService<ZfShare> {
    List<ZfShare> getAuthority();
    AjaxResult saveZa(ShareMore shareMore);
    AjaxResult listByFidAid(ShareMore shareMore,Integer pageNo ,Integer pageSize);
    AjaxResult deleteZa(ShareMore shareMore);
    AjaxResult listByUserId();
    AjaxResult listUserId(Integer pageNo ,Integer pageSize);
    Long getShareId(ZfDownload zfDownload);
}
zhang-content/src/main/java/com/ruoyi/service/ZPropertyDownloadService.java
New file
@@ -0,0 +1,13 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZfDownload;
public interface ZPropertyDownloadService extends IService<ZfDownload> {
    AjaxResult addData(ZfDownload zfDownload);
    AjaxResult deleteData(Long[] ids);
    AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize);
}
zhang-content/src/main/java/com/ruoyi/service/ZPropertyShareService.java
New file
@@ -0,0 +1,25 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ShareMore;
import com.ruoyi.domain.ZfDownload;
import com.ruoyi.domain.ZfShare;
import java.util.List;
public interface ZPropertyShareService extends IService<ZfShare> {
    List<ZfShare> getAuthority();
    AjaxResult saveZa(ShareMore shareMore);
    AjaxResult listByFidAid(ShareMore shareMore,Integer pageNo ,Integer pageSize);
    AjaxResult deleteZa(ShareMore shareMore);
    AjaxResult listByUserId();
    AjaxResult listUserId(Integer pageNo ,Integer pageSize);
    Long getShareId(ZfDownload zfDownload);
}
zhang-content/src/main/java/com/ruoyi/service/ZSecretDownloadService.java
New file
@@ -0,0 +1,13 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZfDownload;
public interface ZSecretDownloadService extends IService<ZfDownload> {
    AjaxResult addData(ZfDownload zfDownload);
    AjaxResult deleteData(Long[] ids);
    AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize);
}
zhang-content/src/main/java/com/ruoyi/service/ZSecretShareService.java
New file
@@ -0,0 +1,25 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ShareMore;
import com.ruoyi.domain.ZfDownload;
import com.ruoyi.domain.ZfShare;
import java.util.List;
public interface ZSecretShareService extends IService<ZfShare> {
    List<ZfShare> getAuthority();
    AjaxResult saveZa(ShareMore shareMore);
    AjaxResult listByFidAid(ShareMore shareMore,Integer pageNo ,Integer pageSize);
    AjaxResult deleteZa(ShareMore shareMore);
    AjaxResult listByUserId();
    AjaxResult listUserId(Integer pageNo ,Integer pageSize);
    Long getShareId(ZfDownload zfDownload);
}
zhang-content/src/main/java/com/ruoyi/service/ZSelfNoteDownloadService.java
New file
@@ -0,0 +1,13 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZfDownload;
public interface ZSelfNoteDownloadService extends IService<ZfDownload> {
    AjaxResult addData(ZfDownload zfDownload);
    AjaxResult deleteData(Long[] ids);
    AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize);
}
zhang-content/src/main/java/com/ruoyi/service/ZSelfNoteShareService.java
New file
@@ -0,0 +1,25 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ShareMore;
import com.ruoyi.domain.ZfDownload;
import com.ruoyi.domain.ZfShare;
import java.util.List;
public interface ZSelfNoteShareService extends IService<ZfShare> {
    List<ZfShare> getAuthority();
    AjaxResult saveZa(ShareMore shareMore);
    AjaxResult listByFidAid(ShareMore shareMore,Integer pageNo ,Integer pageSize);
    AjaxResult deleteZa(ShareMore shareMore);
    AjaxResult listByUserId();
    AjaxResult listUserId(Integer pageNo ,Integer pageSize);
    Long getShareId(ZfDownload zfDownload);
}
zhang-content/src/main/java/com/ruoyi/service/ZfRelationDownloadService.java
New file
@@ -0,0 +1,13 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZfDownload;
public interface ZfRelationDownloadService extends IService<ZfDownload> {
    AjaxResult addData(ZfDownload zfDownload);
    AjaxResult deleteData(Long[] ids);
    AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize);
}
zhang-content/src/main/java/com/ruoyi/service/ZfRelationShareService.java
New file
@@ -0,0 +1,25 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ShareMore;
import com.ruoyi.domain.ZfDownload;
import com.ruoyi.domain.ZfShare;
import java.util.List;
public interface ZfRelationShareService extends IService<ZfShare> {
    List<ZfShare> getAuthority();
    AjaxResult saveZa(ShareMore shareMore);
    AjaxResult listByFidAid(ShareMore shareMore,Integer pageNo ,Integer pageSize);
    AjaxResult deleteZa(ShareMore shareMore);
    AjaxResult listByUserId();
    AjaxResult listUserId(Integer pageNo ,Integer pageSize);
    Long getShareId(ZfDownload zfDownload);
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZAbroadDownloadServiceImpl.java
New file
@@ -0,0 +1,144 @@
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.ZAbroad;
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;
@Slf4j
@Service
public class ZAbroadDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements ZAbroadDownloadService {
    @Resource
    EsService esService;
    @Resource
    ZAbroadShareService zAbroadShareService;
    @Resource
    ZAbroadService zAbroadService;
    @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(zAbroadShareService.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 (zAbroadShareService.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<ZAbroad> bs = new ArrayList<>();
        for (ZfDownload a: beanRecords) {
            if (zAbroadService.getById(a.getDownloadContent()) != null) {
                ZAbroad ds = zAbroadService.getById(a.getDownloadContent());
                ds.setShareId(a.getShareId().intValue());
                bs.add(ds);
            }
        }
        List<ZAbroad>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZAbroad> zAbroadPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zAbroadPage, record,bs.size());
        return AjaxResult.success(data);
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZAbroadShareServiceImpl.java
New file
@@ -0,0 +1,191 @@
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 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
public class ZAbroadShareServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements ZAbroadShareService {
    @Resource
    ZAbroadService zAbroadService;
    @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(20105L);
                addData(za);
            }
        }
        //  Long []
        //  if(bl)
        return AjaxResult.success("分享成功!");
    }
    @Override
    public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) {
        Long [] shareIds = shareMore.getShareIds();
        List<ZAbroad> 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(zAbroadService.getById(beanRecord.getShareContent()));
                }
            }
        }
        List<ZAbroad>  record =  beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (beanRecord3.size() -1) / pageSize +1;
        Page<ZAbroad> zAbroadPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zAbroadPage, 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<ZAbroad>>  bs = new HashMap<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,20105L);
        List<ZfShare> beanRecords = list(lqw);
        List<ZAbroad> b1 = new ArrayList<>();
        for (ZfShare beanRecord : beanRecords ) {
            b1.add(zAbroadService.getById(beanRecord.getShareContent()));
            bs.put(beanRecord.getUserId(),b1);
        }
//        log.info("从数据库中查到的为:{}", bs);
        return AjaxResult.success(bs);
    }
    @Override
    public AjaxResult listUserId(Integer pageNo, Integer pageSize) {
        List<ZAbroad>  bs = new ArrayList<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,20105L);
        List<ZfShare> beanRecords = list(lqw);
        for (ZfShare beanRecord : beanRecords ) {
            ZAbroad bs2 = zAbroadService.getById(beanRecord.getShareContent());
            bs2.setShareId(beanRecord.getUserId().intValue());
            bs.add(bs2);
        }
//        log.info("从数据库中查到的为:{}", bs);
        List<ZAbroad>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZAbroad> zAbroadPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zAbroadPage, 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;
        }
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZAutobiographyDownloadServiceImpl.java
New file
@@ -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.ZAutobiography;
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;
@Slf4j
@Service
public class ZAutobiographyDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements ZAutobiographyDownloadService {
    @Resource
    EsService esService;
    @Resource
    ZAutobiographyShareService zAutobiographyShareService;
    @Resource
    ZAutobiographyService zAutobiographyService;
    @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(zAutobiographyShareService.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 (zAutobiographyShareService.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<ZAutobiography> bs = new ArrayList<>();
        for (ZfDownload a: beanRecords) {
            if (zAutobiographyService.getById(a.getDownloadContent()) != null) {
                ZAutobiography ds = zAutobiographyService.getById(a.getDownloadContent());
                ds.setShareId(a.getShareId().intValue());
                bs.add(ds);
            }
        }
        List<ZAutobiography>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZAutobiography> zAutobiographyPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zAutobiographyPage, record,bs.size());
        return AjaxResult.success(data);
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZAutobiographyShareServiceImpl.java
New file
@@ -0,0 +1,194 @@
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.ZAutobiographyShareService;
import com.ruoyi.service.ZAutobiographyService;
import com.ruoyi.service.ZAutobiographyShareService;
import com.ruoyi.service.ZInfoUserService;
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
public class ZAutobiographyShareServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements ZAutobiographyShareService {
    @Resource
    ZAutobiographyService zAutobiographyService;
    @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(20106L);
                addData(za);
            }
        }
        //  Long []
        //  if(bl)
        return AjaxResult.success("分享成功!");
    }
    @Override
    public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) {
        Long [] shareIds = shareMore.getShareIds();
        List<ZAutobiography> 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(zAutobiographyService.getById(beanRecord.getShareContent()));
                }
            }
        }
        List<ZAutobiography>  record =  beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (beanRecord3.size() -1) / pageSize +1;
        Page<ZAutobiography> zAutobiographyPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zAutobiographyPage, 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<ZAutobiography>>  bs = new HashMap<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,20106L);
        List<ZfShare> beanRecords = list(lqw);
        List<ZAutobiography> b1 = new ArrayList<>();
        for (ZfShare beanRecord : beanRecords ) {
            b1.add(zAutobiographyService.getById(beanRecord.getShareContent()));
            bs.put(beanRecord.getUserId(),b1);
        }
//        log.info("从数据库中查到的为:{}", bs);
        return AjaxResult.success(bs);
    }
    @Override
    public AjaxResult listUserId(Integer pageNo, Integer pageSize) {
        List<ZAutobiography>  bs = new ArrayList<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,20106L);
        List<ZfShare> beanRecords = list(lqw);
        for (ZfShare beanRecord : beanRecords ) {
            ZAutobiography bs2 = zAutobiographyService.getById(beanRecord.getShareContent());
            bs2.setShareId(beanRecord.getUserId().intValue());
            bs.add(bs2);
        }
//        log.info("从数据库中查到的为:{}", bs);
        List<ZAutobiography>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZAutobiography> zAutobiographyPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zAutobiographyPage, 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;
        }
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZCertificateDownloadServiceImpl.java
New file
@@ -0,0 +1,144 @@
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.ZCertificate;
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;
@Slf4j
@Service
public class ZCertificateDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements ZCertificateDownloadService {
    @Resource
    EsService esService;
    @Resource
    ZCertificateShareService zCertificateShareService;
    @Resource
    ZCertificateService zCertificateService;
    @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(zCertificateShareService.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 (zCertificateShareService.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<ZCertificate> bs = new ArrayList<>();
        for (ZfDownload a: beanRecords) {
            if (zCertificateService.getById(a.getDownloadContent()) != null) {
                ZCertificate ds = zCertificateService.getById(a.getDownloadContent());
                ds.setShareId(a.getShareId().intValue());
                bs.add(ds);
            }
        }
        List<ZCertificate>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZCertificate> zCertificatePage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zCertificatePage, record,bs.size());
        return AjaxResult.success(data);
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZCertificateShareServiceImpl.java
New file
@@ -0,0 +1,194 @@
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.ZCertificateShareService;
import com.ruoyi.service.ZCertificateService;
import com.ruoyi.service.ZCertificateShareService;
import com.ruoyi.service.ZInfoUserService;
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
public class ZCertificateShareServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements ZCertificateShareService {
    @Resource
    ZCertificateService zCertificateService;
    @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(20104L);
                addData(za);
            }
        }
        //  Long []
        //  if(bl)
        return AjaxResult.success("分享成功!");
    }
    @Override
    public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) {
        Long [] shareIds = shareMore.getShareIds();
        List<ZCertificate> 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(zCertificateService.getById(beanRecord.getShareContent()));
                }
            }
        }
        List<ZCertificate>  record =  beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (beanRecord3.size() -1) / pageSize +1;
        Page<ZCertificate> zCertificatePage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zCertificatePage, 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<ZCertificate>>  bs = new HashMap<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,20104L);
        List<ZfShare> beanRecords = list(lqw);
        List<ZCertificate> b1 = new ArrayList<>();
        for (ZfShare beanRecord : beanRecords ) {
            b1.add(zCertificateService.getById(beanRecord.getShareContent()));
            bs.put(beanRecord.getUserId(),b1);
        }
//        log.info("从数据库中查到的为:{}", bs);
        return AjaxResult.success(bs);
    }
    @Override
    public AjaxResult listUserId(Integer pageNo, Integer pageSize) {
        List<ZCertificate>  bs = new ArrayList<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,20104L);
        List<ZfShare> beanRecords = list(lqw);
        for (ZfShare beanRecord : beanRecords ) {
            ZCertificate bs2 = zCertificateService.getById(beanRecord.getShareContent());
            bs2.setShareId(beanRecord.getUserId().intValue());
            bs.add(bs2);
        }
//        log.info("从数据库中查到的为:{}", bs);
        List<ZCertificate>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZCertificate> zCertificatePage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zCertificatePage, 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;
        }
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZExperienceDownloadServiceImpl.java
New file
@@ -0,0 +1,144 @@
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.ZExperience;
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;
@Slf4j
@Service
public class ZExperienceDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements ZExperienceDownloadService {
    @Resource
    EsService esService;
    @Resource
    ZExperienceShareService zExperienceShareService;
    @Resource
    ZExperienceService zExperienceService;
    @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(zExperienceShareService.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 (zExperienceShareService.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<ZExperience> bs = new ArrayList<>();
        for (ZfDownload a: beanRecords) {
            if (zExperienceService.getById(a.getDownloadContent()) != null) {
                ZExperience ds = zExperienceService.getById(a.getDownloadContent());
                ds.setShareId(a.getShareId().intValue());
                bs.add(ds);
            }
        }
        List<ZExperience>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZExperience> zExperiencePage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zExperiencePage, record,bs.size());
        return AjaxResult.success(data);
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZExperienceShareServiceImpl.java
New file
@@ -0,0 +1,194 @@
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.ZExperienceShareService;
import com.ruoyi.service. ZExperienceService;
import com.ruoyi.service. ZExperienceShareService;
import com.ruoyi.service.ZInfoUserService;
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
public class ZExperienceShareServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements ZExperienceShareService {
    @Resource
     ZExperienceService  zExperienceService;
    @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(20102L);
                addData(za);
            }
        }
        //  Long []
        //  if(bl)
        return AjaxResult.success("分享成功!");
    }
    @Override
    public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) {
        Long [] shareIds = shareMore.getShareIds();
        List< ZExperience> 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( zExperienceService.getById(beanRecord.getShareContent()));
                }
            }
        }
        List< ZExperience>  record =  beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (beanRecord3.size() -1) / pageSize +1;
        Page< ZExperience>  zExperiencePage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult( zExperiencePage, 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< ZExperience>>  bs = new HashMap<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,20102L);
        List<ZfShare> beanRecords = list(lqw);
        List< ZExperience> b1 = new ArrayList<>();
        for (ZfShare beanRecord : beanRecords ) {
            b1.add( zExperienceService.getById(beanRecord.getShareContent()));
            bs.put(beanRecord.getUserId(),b1);
        }
//        log.info("从数据库中查到的为:{}", bs);
        return AjaxResult.success(bs);
    }
    @Override
    public AjaxResult listUserId(Integer pageNo, Integer pageSize) {
        List< ZExperience>  bs = new ArrayList<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,20102L);
        List<ZfShare> beanRecords = list(lqw);
        for (ZfShare beanRecord : beanRecords ) {
             ZExperience bs2 =  zExperienceService.getById(beanRecord.getShareContent());
            bs2.setShareId(beanRecord.getUserId().intValue());
            bs.add(bs2);
        }
//        log.info("从数据库中查到的为:{}", bs);
        List< ZExperience>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page< ZExperience> zExperiencePage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zExperiencePage, 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;
        }
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorDownloadServiceImpl.java
New file
@@ -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.ZHonor;
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZfDownload;
import com.ruoyi.domain.ZHonor;
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;
@Slf4j
@Service
public class ZHonorDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements ZHonorDownloadService {
    @Resource
    EsService esService;
    @Resource
    ZHonorShareService zHonorShareService;
    @Resource
    ZHonorService zHonorService;
    @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(zHonorShareService.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 (zHonorShareService.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<ZHonor> bs = new ArrayList<>();
        for (ZfDownload a: beanRecords) {
            if (zHonorService.getById(a.getDownloadContent()) != null) {
                ZHonor ds = zHonorService.getById(a.getDownloadContent());
                ds.setShareId(a.getShareId().intValue());
                bs.add(ds);
            }
        }
        List<ZHonor>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZHonor> zHonorPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zHonorPage, record,bs.size());
        return AjaxResult.success(data);
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorShareServiceImpl.java
New file
@@ -0,0 +1,191 @@
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 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
public class ZHonorShareServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements ZHonorShareService {
    @Resource
    ZHonorService zHonorService;
    @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(2053L);
                addData(za);
            }
        }
        //  Long []
        //  if(bl)
        return AjaxResult.success("分享成功!");
    }
    @Override
    public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) {
        Long [] shareIds = shareMore.getShareIds();
        List<ZHonor> 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(zHonorService.getById(beanRecord.getShareContent()));
                }
            }
        }
        List<ZHonor>  record =  beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (beanRecord3.size() -1) / pageSize +1;
        Page<ZHonor> zHonorPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zHonorPage, 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<ZHonor>>  bs = new HashMap<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,2053L);
        List<ZfShare> beanRecords = list(lqw);
        List<ZHonor> b1 = new ArrayList<>();
        for (ZfShare beanRecord : beanRecords ) {
            b1.add(zHonorService.getById(beanRecord.getShareContent()));
            bs.put(beanRecord.getUserId(),b1);
        }
//        log.info("从数据库中查到的为:{}", bs);
        return AjaxResult.success(bs);
    }
    @Override
    public AjaxResult listUserId(Integer pageNo, Integer pageSize) {
        List<ZHonor>  bs = new ArrayList<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,2053L);
        List<ZfShare> beanRecords = list(lqw);
        for (ZfShare beanRecord : beanRecords ) {
            ZHonor bs2 = zHonorService.getById(beanRecord.getShareContent());
            bs2.setShareId(beanRecord.getUserId().intValue());
            bs.add(bs2);
        }
//        log.info("从数据库中查到的为:{}", bs);
        List<ZHonor>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZHonor> zfCleanPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zfCleanPage, 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;
        }
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZIdeaDownloadServiceImpl.java
New file
@@ -0,0 +1,144 @@
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.ZIdea;
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;
@Slf4j
@Service
public class ZIdeaDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements ZIdeaDownloadService {
    @Resource
    EsService esService;
    @Resource
    ZIdeaShareService zIdeaShareService;
    @Resource
    ZIdeaService zIdeaService;
    @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(zIdeaShareService.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 (zIdeaShareService.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<ZIdea> bs = new ArrayList<>();
        for (ZfDownload a: beanRecords) {
            if (zIdeaService.getById(a.getDownloadContent()) != null) {
                ZIdea ds = zIdeaService.getById(a.getDownloadContent());
                ds.setShareId(a.getShareId().intValue());
                bs.add(ds);
            }
        }
        List<ZIdea>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZIdea> zIdeaPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zIdeaPage, record,bs.size());
        return AjaxResult.success(data);
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZIdeaShareServiceImpl.java
New file
@@ -0,0 +1,193 @@
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.ZIdeaShareService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZIdeaService;
import com.ruoyi.service.ZIdeaShareService;
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
public class ZIdeaShareServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements ZIdeaShareService {
    @Resource
    ZIdeaService zIdeaService;
    @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(2027L);
                addData(za);
            }
        }
        //  Long []
        //  if(bl)
        return AjaxResult.success("分享成功!");
    }
    @Override
    public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) {
        Long [] shareIds = shareMore.getShareIds();
        List<ZIdea> 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(zIdeaService.getById(beanRecord.getShareContent()));
                }
            }
        }
        List<ZIdea>  record =  beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (beanRecord3.size() -1) / pageSize +1;
        Page<ZIdea> zIdeaPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zIdeaPage, 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<ZIdea>>  bs = new HashMap<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,2027L);
        List<ZfShare> beanRecords = list(lqw);
        List<ZIdea> b1 = new ArrayList<>();
        for (ZfShare beanRecord : beanRecords ) {
            b1.add(zIdeaService.getById(beanRecord.getShareContent()));
            bs.put(beanRecord.getUserId(),b1);
        }
//        log.info("从数据库中查到的为:{}", bs);
        return AjaxResult.success(bs);
    }
    @Override
    public AjaxResult listUserId(Integer pageNo, Integer pageSize) {
        List<ZIdea>  bs = new ArrayList<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,2027L);
        List<ZfShare> beanRecords = list(lqw);
        for (ZfShare beanRecord : beanRecords ) {
            ZIdea bs2 = zIdeaService.getById(beanRecord.getShareContent());
            bs2.setShareId(beanRecord.getUserId().intValue());
            bs.add(bs2);
        }
//        log.info("从数据库中查到的为:{}", bs);
        List<ZIdea>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZIdea> zIdeaPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zIdeaPage, 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;
        }
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZPropertyDownloadServiceImpl.java
New file
@@ -0,0 +1,144 @@
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.ZProperty;
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;
@Slf4j
@Service
public class ZPropertyDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements ZPropertyDownloadService {
    @Resource
    EsService esService;
    @Resource
    ZPropertyShareService zPropertyShareService;
    @Resource
    ZPropertyService zPropertyService;
    @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(zPropertyShareService.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 (zPropertyShareService.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<ZProperty> bs = new ArrayList<>();
        for (ZfDownload a: beanRecords) {
            if (zPropertyService.getById(a.getDownloadContent()) != null) {
                ZProperty ds = zPropertyService.getById(a.getDownloadContent());
                ds.setShareId(a.getShareId().intValue());
                bs.add(ds);
            }
        }
        List<ZProperty>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        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());
        return AjaxResult.success(data);
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZPropertyShareServiceImpl.java
New file
@@ -0,0 +1,193 @@
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.ZPropertyService;
import com.ruoyi.service.ZPropertyShareService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZPropertyShareService;
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;
@Slf4j
@Service
public class ZPropertyShareServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements ZPropertyShareService {
    @Resource
    ZPropertyService zPropertyService;
    @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(2026L);
                addData(za);
            }
        }
        //  Long []
        //  if(bl)
        return AjaxResult.success("分享成功!");
    }
    @Override
    public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) {
        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())
                        .eq(ZfShare::getUserId, getUserId());
                List<ZfShare> beanRecords = list(lqw);
                for (ZfShare beanRecord : beanRecords ) {
                    beanRecord3.add(zPropertyService.getById(beanRecord.getShareContent()));
                }
            }
        }
        List<ZProperty>  record =  beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        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());
        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<ZProperty>>  bs = new HashMap<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,2026L);
        List<ZfShare> beanRecords = list(lqw);
        List<ZProperty> b1 = new ArrayList<>();
        for (ZfShare beanRecord : beanRecords ) {
            b1.add(zPropertyService.getById(beanRecord.getShareContent()));
            bs.put(beanRecord.getUserId(),b1);
        }
        log.info("从数据库中查到的为:{}", bs);
        return AjaxResult.success(bs);
    }
    @Override
    public AjaxResult listUserId(Integer pageNo, Integer pageSize) {
        List<ZProperty>  bs = new ArrayList<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,2026L);
        List<ZfShare> beanRecords = list(lqw);
        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());
        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());
        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;
        }
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZSecretDownloadServiceImpl.java
New file
@@ -0,0 +1,144 @@
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.ZSecret;
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;
@Slf4j
@Service
public class ZSecretDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements ZSecretDownloadService {
    @Resource
    EsService esService;
    @Resource
    ZSecretShareService zSecretShareService;
    @Resource
    ZSecretService zSecretService;
    @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(zSecretShareService.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 (zSecretShareService.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<ZSecret> bs = new ArrayList<>();
        for (ZfDownload a: beanRecords) {
            if (zSecretService.getById(a.getDownloadContent()) != null) {
                ZSecret ds = zSecretService.getById(a.getDownloadContent());
                ds.setShareId(a.getShareId().intValue());
                bs.add(ds);
            }
        }
        List<ZSecret>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZSecret> zSecretPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zSecretPage, record,bs.size());
        return AjaxResult.success(data);
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZSecretShareServiceImpl.java
New file
@@ -0,0 +1,193 @@
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.ZInfoUserService;
import com.ruoyi.service.ZSecretService;
import com.ruoyi.service.ZSecretShareService;
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
public class ZSecretShareServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements ZSecretShareService {
    @Resource
    ZSecretService zSecretService;
    @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(2031L);
                addData(za);
            }
        }
        //  Long []
        //  if(bl)
        return AjaxResult.success("分享成功!");
    }
    @Override
    public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) {
        Long [] shareIds = shareMore.getShareIds();
        List<ZSecret> 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(zSecretService.getById(beanRecord.getShareContent()));
                }
            }
        }
        List<ZSecret>  record =  beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (beanRecord3.size() -1) / pageSize +1;
        Page<ZSecret> zSecretPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zSecretPage, 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<ZSecret>>  bs = new HashMap<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,2031L);
        List<ZfShare> beanRecords = list(lqw);
        List<ZSecret> b1 = new ArrayList<>();
        for (ZfShare beanRecord : beanRecords ) {
            b1.add(zSecretService.getById(beanRecord.getShareContent()));
            bs.put(beanRecord.getUserId(),b1);
        }
//        log.info("从数据库中查到的为:{}", bs);
        return AjaxResult.success(bs);
    }
    @Override
    public AjaxResult listUserId(Integer pageNo, Integer pageSize) {
        List<ZSecret>  bs = new ArrayList<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,2031L);
        List<ZfShare> beanRecords = list(lqw);
        for (ZfShare beanRecord : beanRecords ) {
            ZSecret bs2 = zSecretService.getById(beanRecord.getShareContent());
            bs2.setShareId(beanRecord.getUserId().intValue());
            bs.add(bs2);
        }
//        log.info("从数据库中查到的为:{}", bs);
        List<ZSecret>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZSecret> zSecretPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zSecretPage, 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;
        }
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteDownloadServiceImpl.java
New file
@@ -0,0 +1,144 @@
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.ZSelfNote;
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;
@Slf4j
@Service
public class ZSelfNoteDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements ZSelfNoteDownloadService {
    @Resource
    EsService esService;
    @Resource
    ZSelfNoteShareService zSelfNoteShareService;
    @Resource
    ZSelfNoteService zSelfNoteService;
    @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(zSelfNoteShareService.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 (zSelfNoteShareService.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<ZSelfNote> bs = new ArrayList<>();
        for (ZfDownload a: beanRecords) {
            if (zSelfNoteService.getById(a.getDownloadContent()) != null) {
                ZSelfNote ds = zSelfNoteService.getById(a.getDownloadContent());
                ds.setShareId(a.getShareId().intValue());
                bs.add(ds);
            }
        }
        List<ZSelfNote>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZSelfNote> zSelfNotePage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zSelfNotePage, record,bs.size());
        return AjaxResult.success(data);
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteShareServiceImpl.java
New file
@@ -0,0 +1,194 @@
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.ZSelfNoteService;
import com.ruoyi.service.ZSelfNoteShareService;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZSelfNoteShareService;
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
public class ZSelfNoteShareServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements ZSelfNoteShareService {
    @Resource
    ZSelfNoteService zSelfNoteService;
    @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(2010L);
                addData(za);
            }
        }
        //  Long []
        //  if(bl)
        return AjaxResult.success("分享成功!");
    }
    @Override
    public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) {
        Long [] shareIds = shareMore.getShareIds();
        List<ZSelfNote> 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(zSelfNoteService.getById(beanRecord.getShareContent()));
                }
            }
        }
        List<ZSelfNote>  record =  beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (beanRecord3.size() -1) / pageSize +1;
        Page<ZSelfNote> zSelfNotePage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zSelfNotePage, 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<ZSelfNote>>  bs = new HashMap<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,2010L);
        List<ZfShare> beanRecords = list(lqw);
        List<ZSelfNote> b1 = new ArrayList<>();
        for (ZfShare beanRecord : beanRecords ) {
            b1.add(zSelfNoteService.getById(beanRecord.getShareContent()));
            bs.put(beanRecord.getUserId(),b1);
        }
//        log.info("从数据库中查到的为:{}", bs);
        return AjaxResult.success(bs);
    }
    @Override
    public AjaxResult listUserId(Integer pageNo, Integer pageSize) {
        List<ZSelfNote>  bs = new ArrayList<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,2010L);
        List<ZfShare> beanRecords = list(lqw);
        for (ZfShare beanRecord : beanRecords ) {
            ZSelfNote bs2 = zSelfNoteService.getById(beanRecord.getShareContent());
            bs2.setShareId(beanRecord.getUserId().intValue());
            bs.add(bs2);
        }
//        log.info("从数据库中查到的为:{}", bs);
        List<ZSelfNote>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZSelfNote> zSelfNotePage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zSelfNotePage, 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;
        }
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipDownloadServiceImpl.java
@@ -32,7 +32,7 @@
    EsService esService;
    @Resource
    ZfEquipShareServiceImpl zfEquipShareService;
    ZfEquipShareService zfEquipShareService;
    @Resource
    ZfEquipmentService zfEquipmentService;
zhang-content/src/main/java/com/ruoyi/service/impl/ZfRelationDownloadServiceImpl.java
New file
@@ -0,0 +1,144 @@
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.ZfRelation;
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;
@Slf4j
@Service
public class ZfRelationDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper,ZfDownload> implements ZfRelationDownloadService {
    @Resource
    EsService esService;
    @Resource
    ZfRelationShareService zfRelationShareService;
    @Resource
    ZfRelationService zfRelationService;
    @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(zfRelationShareService.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 (zfRelationShareService.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<ZfRelation> bs = new ArrayList<>();
        for (ZfDownload a: beanRecords) {
            if (zfRelationService.getById(a.getDownloadContent()) != null) {
                ZfRelation ds = zfRelationService.getById(a.getDownloadContent());
                ds.setShareId(a.getShareId().intValue());
                bs.add(ds);
            }
        }
        List<ZfRelation>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZfRelation> zfRelationPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zfRelationPage, record,bs.size());
        return AjaxResult.success(data);
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZfRelationShareServiceImpl.java
New file
@@ -0,0 +1,193 @@
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.ZfRelationService;
import com.ruoyi.service.ZfRelationShareService;
import com.ruoyi.service.ZInfoUserService;
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
public class ZfRelationShareServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements ZfRelationShareService {
    @Resource
    ZfRelationService zfRelationService;
    @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(20103L);
                addData(za);
            }
        }
        //  Long []
        //  if(bl)
        return AjaxResult.success("分享成功!");
    }
    @Override
    public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) {
        Long [] shareIds = shareMore.getShareIds();
        List<ZfRelation> 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(zfRelationService.getById(beanRecord.getShareContent()));
                }
            }
        }
        List<ZfRelation>  record =  beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (beanRecord3.size() -1) / pageSize +1;
        Page<ZfRelation> zfRelationPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zfRelationPage, 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<ZfRelation>>  bs = new HashMap<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,20103L);
        List<ZfShare> beanRecords = list(lqw);
        List<ZfRelation> b1 = new ArrayList<>();
        for (ZfShare beanRecord : beanRecords ) {
            b1.add(zfRelationService.getById(beanRecord.getShareContent()));
            bs.put(beanRecord.getUserId(),b1);
        }
//        log.info("从数据库中查到的为:{}", bs);
        return AjaxResult.success(bs);
    }
    @Override
    public AjaxResult listUserId(Integer pageNo, Integer pageSize) {
        List<ZfRelation>  bs = new ArrayList<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,20103L);
        List<ZfShare> beanRecords = list(lqw);
        for (ZfShare beanRecord : beanRecords ) {
            ZfRelation bs2 = zfRelationService.getById(beanRecord.getShareContent());
            bs2.setShareId(beanRecord.getUserId().intValue());
            bs.add(bs2);
        }
//        log.info("从数据库中查到的为:{}", bs);
        List<ZfRelation>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZfRelation> zfRelationPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zfRelationPage, 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;
        }
    }
}