zqy
2024-07-30 c35d9c6311b6f9ef75b49559a5c6db75e0a43ac6
修改bug&分享
15个文件已修改
7个文件已添加
2 文件已重命名
2个文件已删除
801 ■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventShareController.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ShareMore.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfAncestor.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfDownload.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfShare.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/mapper/ZfDoctorDownloadMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/mapper/ZfDoctorShareMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/mapper/ZfDownloadMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/mapper/ZfShareMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZfAncestorService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZfEventDownloadService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZfEventShareService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java 78 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventDownloadServiceImpl.java 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventShareServiceImpl.java 196 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -1,5 +1,6 @@
package com.ruoyi.web.controller.system;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -17,6 +18,9 @@
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfAncestorService;
import com.ruoyi.service.ZfFamilyService;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.mapper.SysUserRoleMapper;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -73,6 +77,9 @@
    @Resource
    private ZfAncestorService zfAncestorService;
    @Resource
    private SysUserRoleMapper sysUserRoleMapper;
    /**
     * 获取用户列表
     */
@@ -158,6 +165,9 @@
  //      System.out.println(user.getFamilyId());
     //   System.out.println("[[[[]]]]]]");
        Long userId = user.getSysId();
        SysUserRole sysUserRole=sysUserRoleMapper.selectUserById(userId);
        if (sysUserRole.getRoleId() == 102){
        ZInfoUser infoUser = new ZInfoUser();
        infoUser.setUserId(user.getUserId());
        infoUser.setOldName(user.getUserName());
@@ -168,6 +178,8 @@
        infoUser.setSex(Integer.valueOf(user.getSex()));
//        infoUser.setFamilyId(user.getFamilyId());
        infoUser.setSysId(user.getSysId());
        if(user.getSpouseId()!=null) {
            infoUser.setSpouseId(user.getSpouseId());
        }
@@ -207,7 +219,7 @@
            zu.setUserId(user.getSpouseId());
            zu.setSpouseId(infoUser.getUserId());
            zInfoUserService.updateById(zu);
        }
        }}
      //  zInfoUserService.update(infoUser);
             //   .saveOrUpdate(infoUser);
@@ -252,10 +264,18 @@
        user.setCreateBy(getUsername());
        user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
        userService.insertUser(user);
        //写到用户与角色对应的表
        SysUserRole sysUserRole = new SysUserRole();
        sysUserRole.setUserId(user.getUserId());
        sysUserRole.setRoleId(user.getRoleId());
        List<SysUserRole> sysUserRoles = new ArrayList<>();
        sysUserRoles.add(sysUserRole);
        sysUserRoleMapper.batchUserRole(sysUserRoles);
        //写入到 新建立的信息表里面
//        ZfFamily zfFamily = zfFamilyService.getByFamId(userAll.getFamilyId());
        if (userAll.getRoleId() == 102){
        ZInfoUser infoUser = new ZInfoUser();
        infoUser.setSysId(user.getUserId());
     //   infoUser.setUserId(user.getUserId());
@@ -312,6 +332,7 @@
        // infoUser.setRoleName(user.g);
      //  if(userAll.getFamilyId()!=-1) {
        if(userAll.getRoleId()==102) {
            infoUser.setRoleId(3L);
            zInfoUserService.save(infoUser);
@@ -322,7 +343,7 @@
                zu.setSpouseId(infoUser.getUserId());
                zInfoUserService.updateById(zu);
            }
        }
        }}
        //    zInfoUserService.saveOrUpdate(infoUser);
//            LambdaQueryWrapper<ZInfoUser> lqw = new LambdaQueryWrapper<>();
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java
@@ -90,7 +90,7 @@
    public void updateAncestor(ZfAncestor zfAncestor){
        SysUser us = new SysUser();
         Long userId = zInfoUserService.getInfoBysysId(zfAncestor.getSysId()).getUserId();
        Long userId = zInfoUserService.getInfoBysysId(zfAncestor.getSysId()).getUserId();
        us.setUserId(zfAncestor.getSysId());
        us.setUserName(zfAncestor.getName());
@@ -120,8 +120,10 @@
    @PutMapping
    public AjaxResult edit(@RequestBody ZfAncestor zfAncestor) {
        zfAncestorService.update(zfAncestor);
        ZfAncestor spouseSex = zfAncestorService.update(zfAncestor);
        updateAncestor(zfAncestor);
        if (spouseSex.getId() != null)
        updateAncestor(spouseSex);
        return  AjaxResult.success();
    }
@@ -137,7 +139,10 @@
        Long sysId = zfAncestorService.addData(zfAncestor);
        zfAncestor.setSpouseId(sysId.intValue());
        zfAncestor.setSysId(addAncestor(zfAncestor));
        zfAncestorService.updateById(zfAncestor);
            zfAncestorService.updateById(zfAncestor);
        return AjaxResult.success();
    }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java
@@ -1,14 +1,11 @@
package com.ruoyi.web.controller.zhang;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.MapUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.domain.ShareMore;
import com.ruoyi.domain.ZfDoctor;
import com.ruoyi.domain.ZfDoctorDownload;
import com.ruoyi.domain.ZfDownload;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfDoctorDownloadService;
import com.ruoyi.service.ZfDoctorService;
@@ -16,10 +13,6 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import static com.ruoyi.common.core.page.TableSupport.*;
@@ -42,6 +35,7 @@
     */
    @PostMapping("/share")
    public AjaxResult share(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2019L);
        return zfDoctorShareService.saveZa(zfDoctor);
    }
@@ -50,6 +44,7 @@
     */
    @PostMapping("/getInfoByUserId")
    public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2019L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return  zfDoctorShareService.listByFidAid(zfDoctor,pageNo,pageSize) ;
@@ -69,6 +64,7 @@
     */
    @PostMapping("/deleteInfoByUserId")
    public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2019L);
        return zfDoctorShareService.deleteZa(zfDoctor);
    }
@@ -76,18 +72,20 @@
     * 下载分享的数据
     */
    @PostMapping("/downloadDate")
    public AjaxResult ifDownLoad(@RequestBody ZfDoctorDownload zfDoctorDownload){
        return zfDoctorDownloadService.addData(zfDoctorDownload);
    public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){
        zfDownload.setSysMenuId(2019L);
        return zfDoctorDownloadService.addData(zfDownload);
    }
    /**
     * 展示下载分享的数据
     */
    @GetMapping("/all")
    public AjaxResult data(ZfDoctorDownload zfDoctorDownload){
    public AjaxResult data(ZfDownload zfDownload){
        zfDownload.setSysMenuId(2019L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
      return zfDoctorDownloadService.selectDoctorList(zfDoctorDownload,pageNo ,pageSize);
      return zfDoctorDownloadService.selectDoctorList(zfDownload,pageNo ,pageSize);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventShareController.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.ZfEventDownloadService;
import com.ruoyi.service.ZfEventShareService;
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("/familyShare")
public class ZfEventShareController extends BaseController {
    @Resource
    ZfEventShareService zfEventShareService;
    @Resource
    ZfEventDownloadService zfEventDownloadService;
    @PostMapping("/share")
    public AjaxResult share(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2013L);
        return zfEventShareService.saveZa(zfDoctor);
    }
    /**
     * 根据UserId和分享人shareId查看已经授权给那些人那些数据
     */
    @PostMapping("/getInfoByUserId")
    public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2013L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return  zfEventShareService.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 zfEventShareService.listUserId(pageNo ,pageSize);
    }
    /**
     * 根据userId和shareId收回已经授权给那些人
     */
    @PostMapping("/deleteInfoByUserId")
    public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){
        zfDoctor.setSysMenuId(2013L);
        return zfEventShareService.deleteZa(zfDoctor);
    }
    /**
     * 下载分享的数据
     */
    @PostMapping("/downloadDate")
    public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){
        zfDownload.setSysMenuId(2013L);
        return zfEventDownloadService.addData(zfDownload);
    }
    /**
     * 展示下载分享的数据
     */
    @GetMapping("/all")
    public AjaxResult data(ZfDownload zfDownload){
        zfDownload.setSysMenuId(2013L);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return zfEventDownloadService.selectDoctorList(zfDownload,pageNo ,pageSize);
    }
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java
@@ -19,6 +19,8 @@
     */
    public int deleteUserRoleByUserId(Long userId);
    public SysUserRole selectUserById(Long userId);
    /**
     * 批量删除用户和角色关联
     * 
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -296,6 +296,7 @@
    @Override
    public boolean registerUser(SysUser user)
    {
        System.out.println(user);
        return userMapper.insertUser(user) > 0;
    }
@@ -311,9 +312,9 @@
    {
        Long userId = user.getUserId();
        // 删除用户与角色关联
        userRoleMapper.deleteUserRoleByUserId(userId);
        // 新增用户与角色管理
        insertUserRole(user);
//        userRoleMapper.deleteUserRoleByUserId(userId);
//        // 新增用户与角色管理
//        insertUserRole(user);
        // 删除用户与岗位关联
        userPostMapper.deleteUserPostByUserId(userId);
        // 新增用户与岗位管理
ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
@@ -9,6 +9,10 @@
        <result property="roleId"     column="role_id"      />
    </resultMap>
    <select id="selectUserById" resultType="SysUserRole" >
        select * from sys_user_role where user_id=#{userId}
    </select>
    <delete id="deleteUserRoleByUserId" parameterType="Long">
        delete from sys_user_role where user_id=#{userId}
    </delete>
zhang-content/src/main/java/com/ruoyi/domain/ShareMore.java
@@ -24,4 +24,9 @@
     * 分享的内容
     */
    private Long[] shareContents;
    /**
     * 分享的模块
     */
    private Long sysMenuId;
}
zhang-content/src/main/java/com/ruoyi/domain/ZfAncestor.java
@@ -45,11 +45,11 @@
     */
    private Integer status;
    /**
     * 是否本家
     */
    private Integer isMyFamily;
//    /**
//     * 是否本家
//     */
//    private Integer isMyFamily;
//
    /**
     *配偶id
     */
zhang-content/src/main/java/com/ruoyi/domain/ZfDownload.java
File was renamed from zhang-content/src/main/java/com/ruoyi/domain/ZfDoctorDownload.java
@@ -7,17 +7,31 @@
import lombok.Data;
@Data
@TableName("zf_doctor_download")
public class ZfDoctorDownload {
@TableName("zf_download")
public class ZfDownload {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 下载人
     */
    private Long downloadId;
    /**
     * 下载内容
     */
    private Long downloadContent;
    /**
     * 分享人
     */
    private Long shareId;
    /**
     * 模块id
     */
    private Long sysMenuId;
}
zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java
@@ -92,4 +92,9 @@
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date happenTime;
    /**
     * 分享人id
     */
    private Integer shareId;
}
zhang-content/src/main/java/com/ruoyi/domain/ZfShare.java
File was renamed from zhang-content/src/main/java/com/ruoyi/domain/ZfDoctorShare.java
@@ -8,8 +8,8 @@
import java.io.Serializable;
@Data
@TableName("zf_doctor_share")
public class ZfDoctorShare implements Serializable {
@TableName("zf_share")
public class ZfShare implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
@@ -30,6 +30,12 @@
     */
    private Long shareContent;
    /**
     * 分享的内容
     */
    private Long sysMenuId;
}
zhang-content/src/main/java/com/ruoyi/mapper/ZfDoctorDownloadMapper.java
File was deleted
zhang-content/src/main/java/com/ruoyi/mapper/ZfDoctorShareMapper.java
File was deleted
zhang-content/src/main/java/com/ruoyi/mapper/ZfDownloadMapper.java
New file
@@ -0,0 +1,7 @@
package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.ZfDownload;
public interface ZfDownloadMapper extends BaseMapper<ZfDownload> {
}
zhang-content/src/main/java/com/ruoyi/mapper/ZfShareMapper.java
New file
@@ -0,0 +1,9 @@
package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.ZfShare;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ZfShareMapper extends BaseMapper<ZfShare> {
}
zhang-content/src/main/java/com/ruoyi/service/ZfAncestorService.java
@@ -16,6 +16,6 @@
    AjaxResult deleteData(Integer clanId, Integer id);
    void update(ZfAncestor zfAncestor);
    ZfAncestor update(ZfAncestor zfAncestor);
}
zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java
@@ -2,17 +2,15 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZfDoctorDownload;
import java.util.List;
import com.ruoyi.domain.ZfDownload;
public interface ZfDoctorDownloadService extends IService<ZfDoctorDownload> {
    AjaxResult addData(ZfDoctorDownload zfDoctorDownload);
public interface ZfDoctorDownloadService extends IService<ZfDownload> {
    AjaxResult addData(ZfDownload zfDownload);
    AjaxResult deleteData(Long[] ids);
    AjaxResult selectDoctorList(ZfDoctorDownload zfDoctorDownload,Integer pageNo ,Integer pageSize);
    AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize);
}
zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java
@@ -3,15 +3,14 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ShareMore;
import com.ruoyi.domain.ZfDoctor;
import com.ruoyi.domain.ZfDoctorDownload;
import com.ruoyi.domain.ZfDoctorShare;
import com.ruoyi.domain.ZfDownload;
import com.ruoyi.domain.ZfShare;
import java.util.List;
public interface ZfDoctorShareService extends IService<ZfDoctorShare> {
public interface ZfDoctorShareService extends IService<ZfShare> {
    List<ZfDoctorShare> getAuthority();
    List<ZfShare> getAuthority();
    AjaxResult saveZa(ShareMore zfDoctor);
@@ -23,7 +22,7 @@
    AjaxResult listUserId(Integer pageNo ,Integer pageSize);
    Long getShareId(ZfDoctorDownload zfDoctorDownload);
    Long getShareId(ZfDownload zfDownload);
}
zhang-content/src/main/java/com/ruoyi/service/ZfEventDownloadService.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 ZfEventDownloadService 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/ZfEventShareService.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 ZfEventShareService  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/ZfAncestorServiceImpl.java
@@ -203,22 +203,35 @@
    }
    @Override
    public void update(ZfAncestor zfAncestor) {
    public ZfAncestor update(ZfAncestor zfAncestor) {
        LambdaQueryWrapper<ZfAncestor> lqw = uniqueCondition(zfAncestor);
        List<ZfAncestor> list = list(lqw);
        System.out.println(list);
//        System.out.println(list);
        ZInfoUser updateDate =zInfoUserService.getInfoBysysId(zfAncestor.getSysId());
        ZfAncestor zfAncestor1 = new ZfAncestor();
        ZfAncestor zfAncestor2 = new ZfAncestor();
        zfAncestor1.setId(list.get(0).getId());
        zfAncestor1.setName(zfAncestor.getName());
        if((updateDate.getSpouseId() != null || updateDate.getSpouseId() != 0) && zfAncestor.getSex() !=null){
        System.out.println(updateDate);
        if (zfAncestor.getSex() != null){
        if(updateDate.getSpouseId() != null && updateDate.getSpouseId() != 0){
            Long spouseId=updateDate.getSpouseId();
            if (zInfoUserService.getById(spouseId).getSex().equals(zfAncestor.getSex())){
                throw new RuntimeException("祖先两位不能为同性");}
            zfAncestor.setSex(zfAncestor.getSex());}
                Long spouseSysId = zInfoUserService.getById(spouseId).getSysId();
                zfAncestor2.setSysId(spouseSysId);
                Integer spId = list(uniqueCondition(zfAncestor2)).get(0).getId();
                zfAncestor2.setId(spId);
                zfAncestor2.setSex(zfAncestor.getSex() == 0? 1: 0);
                System.out.println(zfAncestor2);
                zfAncestorService.updateById(zfAncestor2);
            }}
            zfAncestor1.setSex(zfAncestor.getSex());}
//        System.out.println("1841vdndigrrr"+zfAncestor1);
            zfAncestorService.updateById(zfAncestor1);
        return zfAncestor2;
    }
    /**
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java
@@ -9,8 +9,8 @@
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZfDoctor;
import com.ruoyi.domain.ZfDoctorDownload;
import com.ruoyi.mapper.ZfDoctorDownloadMapper;
import com.ruoyi.domain.ZfDownload;
import com.ruoyi.mapper.ZfDownloadMapper;
import com.ruoyi.service.*;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.client.RequestOptions;
@@ -23,7 +23,7 @@
import java.util.stream.Collectors;
@Service
public class ZfDoctorDownloadServiceImpl extends ServiceImpl<ZfDoctorDownloadMapper, ZfDoctorDownload> implements ZfDoctorDownloadService {
public class ZfDoctorDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper, ZfDownload> implements ZfDoctorDownloadService {
    @Resource
    EsService esService;
@@ -41,27 +41,29 @@
    @Resource
    private RestHighLevelClient restHighLevelClient;
    private LambdaQueryWrapper<ZfDoctorDownload> buildCondition(ZfDoctorDownload zfDoctorDownload,Long userId) {
        LambdaQueryWrapper<ZfDoctorDownload> lqw = new LambdaQueryWrapper<>();
        lqw.in(ZfDoctorDownload::getDownloadId,userId);
        lqw.orderByDesc(ZfDoctorDownload::getDownloadId);
        lqw.like(zfDoctorDownload.getDownloadId() != null, ZfDoctorDownload::getDownloadId, zfDoctorDownload.getDownloadId())
            .like(zfDoctorDownload.getDownloadContent() != null, ZfDoctorDownload::getDownloadContent, zfDoctorDownload.getDownloadContent());
    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<ZfDoctorDownload> uniqueCondition(ZfDoctorDownload zfDoctorDownload) {
        LambdaQueryWrapper<ZfDoctorDownload> lqw = new LambdaQueryWrapper<>();
        lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfDoctorDownload.getDownloadId())), ZfDoctorDownload::getDownloadId, zfDoctorDownload.getDownloadId())
            .eq(StringUtils.isNotEmpty(String.valueOf(zfDoctorDownload.getDownloadContent())), ZfDoctorDownload::getDownloadContent, zfDoctorDownload.getDownloadContent());
    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;
    }
    @Override
    public AjaxResult selectDoctorList(ZfDoctorDownload zfDoctorDownload,Integer pageNo ,Integer pageSize ) {
    public AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize ) {
        ZInfoUser myself = zInfoUserService.getMyself();
        LambdaQueryWrapper<ZfDoctorDownload> lqw = buildCondition(zfDoctorDownload,myself.getUserId());
        List<ZfDoctorDownload> beanRecords = list(lqw);
        LambdaQueryWrapper<ZfDownload> lqw = buildCondition(zfDownload,myself.getUserId());
        List<ZfDownload> beanRecords = list(lqw);
        List<ZfDoctor> bs = new ArrayList<>();
        for (ZfDoctorDownload a: beanRecords) {
        for (ZfDownload a: beanRecords) {
            if (zfDoctorService.getById(a.getDownloadContent()) != null) {
                ZfDoctor ds = zfDoctorService.getById(a.getDownloadContent());
                ds.setShareId(a.getShareId());
@@ -79,27 +81,27 @@
    @Override
    public AjaxResult addData(ZfDoctorDownload zfDoctorDownload) {
    zfDoctorDownload.setDownloadId(getUserId());
    LambdaQueryWrapper<ZfDoctorDownload> lqw = uniqueCondition(zfDoctorDownload);
    List<ZfDoctorDownload> list = list(lqw);
    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("请勿新增重复数据");
        throw new RuntimeException("请勿重复下载数据");
    }
        zfDoctorDownload.setDownloadId(getUserId());
        zfDoctorDownload.setShareId(zfDoctorShareService.getShareId(zfDoctorDownload));
        if (save(zfDoctorDownload)) {
        zfDownload.setDownloadId(getUserId());
        zfDownload.setShareId(zfDoctorShareService.getShareId(zfDownload));
        if (save(zfDownload)) {
        EsModel esModel = new EsModel();
        Integer inte = zfDoctorDownload.getId().intValue();
        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(zfDoctorDownload.getDownloadId()));
        esModel.setBy2(String.valueOf(zfDoctorDownload.getDownloadContent()));
        esModel.setBy3(String.valueOf(zfDoctorDownload.getShareId()));
        esModel.setBy1(String.valueOf(zfDownload.getDownloadId()));
        esModel.setBy2(String.valueOf(zfDownload.getDownloadContent()));
        esModel.setBy3(String.valueOf(zfDownload.getShareId()));
        //这里存储查询详情的路径
        esService.insertTable(esModel);
        return AjaxResult.success();
@@ -109,12 +111,12 @@
}
    @Override
    public AjaxResult deleteData(Long[] ids) {
        List<ZfDoctorDownload> zfDoctorDownloads = listByIds(Arrays.asList(ids));
        List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids));
        if (zfDoctorShareService.removeByIds(Arrays.asList(ids))) {
            //删除es中的数据
            zfDoctorDownloads.stream().forEach(zfDoctorDownload -> {
            zfDownloads.stream().forEach(zfDoctorDownload -> {
                EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "家庭小医生下载");
                if (esModel != null) {
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java
@@ -1,6 +1,5 @@
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -10,7 +9,7 @@
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ZfDoctorShareMapper;
import com.ruoyi.mapper.ZfShareMapper;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfDoctorService;
import com.ruoyi.service.ZfDoctorShareService;
@@ -27,26 +26,27 @@
@Slf4j
@Service
public class ZfDoctorShareServiceImpl extends ServiceImpl<ZfDoctorShareMapper, ZfDoctorShare> implements ZfDoctorShareService {
public class ZfDoctorShareServiceImpl extends ServiceImpl<ZfShareMapper, ZfShare> implements ZfDoctorShareService {
    @Resource
    private ZfDoctorService zfDoctorService;
    @Resource
    private ZInfoUserService zInfoUserService;
    private LambdaQueryWrapper<ZfDoctorShare> uniqueCondition(ZfDoctorShare zfDoctorShare) {
        LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfDoctorShare.getShareId())), ZfDoctorShare::getShareId, zfDoctorShare.getShareId());
        lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfDoctorShare.getShareContent())), ZfDoctorShare::getShareContent, zfDoctorShare.getShareContent());
    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<ZfDoctorShare> getAuthority() {
    public List<ZfShare> getAuthority() {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        Long userId = user.getUserId();
        LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfDoctorShare::getShareId,userId);
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,userId);
        return list(lqw);
    }
@@ -54,10 +54,10 @@
    @Resource
    ZfDoctorShareService zfDoctorShareService;
    public void addData(ZfDoctorShare za)
    public void addData(ZfShare za)
    {
        LambdaQueryWrapper<ZfDoctorShare> lqw = uniqueCondition(za);
        List<ZfDoctorShare> list = list(lqw);
        LambdaQueryWrapper<ZfShare> lqw = uniqueCondition(za);
        List<ZfShare> list = list(lqw);
        if(list.size()>0){
            throw new RuntimeException("请勿分享重复数据");
@@ -76,10 +76,11 @@
        Long [] shareContents =  zfDoctor.getShareContents();
        for (Long shareId : shareIds) {
            for (Long shareContent : shareContents) {
                ZfDoctorShare za = new ZfDoctorShare();
                ZfShare za = new ZfShare();
                za.setUserId(getUserId());
                za.setShareContent(shareContent);
                za.setShareId(shareId);
                za.setSysMenuId(2019L);
                addData(za);
            }
        }
@@ -101,11 +102,12 @@
        List<ZfDoctor> beanRecord3 = new ArrayList<>();
        for (Long shareId : shareIds) {
            {
                LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
                lqw.eq(ZfDoctorShare::getShareId,shareId)
                        .eq(ZfDoctorShare::getUserId, getUserId());
                List<ZfDoctorShare> beanRecords = list(lqw);
                for (ZfDoctorShare beanRecord : beanRecords ) {
                LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
                lqw.eq(ZfShare::getShareId,shareId)
                    .eq(ZfShare::getSysMenuId,zfDoctor.getSysMenuId())
                        .eq(ZfShare::getUserId, getUserId());
                List<ZfShare> beanRecords = list(lqw);
                for (ZfShare beanRecord : beanRecords ) {
                    beanRecord3.add(zfDoctorService.getById(beanRecord.getShareContent()));
                }
            }
@@ -127,10 +129,11 @@
        for(Long shareId : shareIds)
            for(Long shareContent: shareContents)
            {
                LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
                lqw.eq(ZfDoctorShare::getShareId,shareId)
                        .eq(ZfDoctorShare::getShareContent, shareContent)
                        .eq(ZfDoctorShare::getUserId, getUserId());
                LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
                lqw.eq(ZfShare::getShareId,shareId)
                        .eq(ZfShare::getShareContent, shareContent)
                        .eq(ZfShare::getSysMenuId, zfDoctor.getSysMenuId())
                        .eq(ZfShare::getUserId, getUserId());
                zfDoctorShareService.remove(lqw);
                //   addData(za);
@@ -146,11 +149,12 @@
    public AjaxResult listByUserId() {
        //找到对应的赋予数据的用户以及数据内容
        HashMap<Long,List<ZfDoctor>>  bs = new HashMap<>();
        LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfDoctorShare::getShareId,getUserId());
        List<ZfDoctorShare> beanRecords = list(lqw);
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,2019L);
        List<ZfShare> beanRecords = list(lqw);
        List<ZfDoctor> b1 = new ArrayList<>();
        for (ZfDoctorShare beanRecord : beanRecords ) {
        for (ZfShare beanRecord : beanRecords ) {
                b1.add(zfDoctorService.getById(beanRecord.getShareContent()));
                bs.put(beanRecord.getUserId(),b1);
        }
@@ -165,10 +169,11 @@
    public AjaxResult listUserId(Integer pageNo ,Integer pageSize) {
        //找到对应的赋予数据的用户以及数据内容
        List<ZfDoctor>  bs = new ArrayList<>();
        LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfDoctorShare::getShareId,getUserId());
        List<ZfDoctorShare> beanRecords = list(lqw);
        for (ZfDoctorShare beanRecord : beanRecords ) {
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,2019L);
        List<ZfShare> beanRecords = list(lqw);
        for (ZfShare beanRecord : beanRecords ) {
            ZfDoctor bs2 = zfDoctorService.getById(beanRecord.getShareContent());
            bs2.setShareId(beanRecord.getUserId());
            bs.add(bs2);
@@ -189,11 +194,12 @@
    }
    @Override
    public Long getShareId(ZfDoctorDownload zfDoctorDownload){
        LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfDoctorShare::getShareId,zfDoctorDownload.getDownloadId())
                .eq(ZfDoctorShare::getShareContent,zfDoctorDownload.getDownloadContent());
        List<ZfDoctorShare> beanRecords = list(lqw);
    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();
        }
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventDownloadServiceImpl.java
New file
@@ -0,0 +1,143 @@
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.ZfDoctor;
import com.ruoyi.domain.ZfDownload;
import com.ruoyi.domain.ZfEvent;
import com.ruoyi.mapper.ZfDownloadMapper;
import com.ruoyi.service.*;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class ZfEventDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper, ZfDownload> implements ZfEventDownloadService {
    @Resource
    EsService esService;
    @Resource
    ZfEventShareService zfEventShareService;
    @Resource
    ZfEventService zfEventService;
    @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(zfEventShareService.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 (zfEventShareService.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<ZfEvent> bs = new ArrayList<>();
        for (ZfDownload a: beanRecords) {
            if (zfEventService.getById(a.getDownloadContent()) != null) {
                ZfEvent ds = zfEventService.getById(a.getDownloadContent());
                ds.setShareId(a.getShareId().intValue());
                bs.add(ds);
            }
        }
        List<ZfEvent>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZfEvent> zfEventPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zfEventPage, record,bs.size());
        return AjaxResult.success(data);
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventShareServiceImpl.java
New file
@@ -0,0 +1,196 @@
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.ZfDoctorShareService;
import com.ruoyi.service.ZfEventService;
import com.ruoyi.service.ZfEventShareService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
@Service
@Slf4j
public class ZfEventShareServiceImpl extends ServiceImpl<ZfShareMapper,ZfShare> implements ZfEventShareService {
    @Resource
    ZfEventShareService zfEventShareService;
    @Resource
    ZfEventService zfEventService;
    @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 {
            zfEventShareService.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(2013L);
                addData(za);
            }
        }
        //  Long []
        //  if(bl)
        return AjaxResult.success("分享成功!");
    }
    @Override
    public AjaxResult listByFidAid(ShareMore shareMore, Integer pageNo, Integer pageSize) {
        Long [] shareIds = shareMore.getShareIds();
        List<ZfEvent> 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(zfEventService.getById(beanRecord.getShareContent()));
                }
            }
        }
        List<ZfEvent>  record =  beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (beanRecord3.size() -1) / pageSize +1;
        Page<ZfEvent> zfEventPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zfEventPage, 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());
                zfEventShareService.remove(lqw);
                //   addData(za);
            }
        return AjaxResult.success("数据收回成功!");
    }
    @Override
    public AjaxResult listByUserId() {
        HashMap<Long,List<ZfEvent>>  bs = new HashMap<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,2013L);
        List<ZfShare> beanRecords = list(lqw);
        List<ZfEvent> b1 = new ArrayList<>();
        for (ZfShare beanRecord : beanRecords ) {
            b1.add(zfEventService.getById(beanRecord.getShareContent()));
            bs.put(beanRecord.getUserId(),b1);
        }
        log.info("从数据库中查到的为:{}", bs);
        return AjaxResult.success(bs);
    }
    @Override
    public AjaxResult listUserId(Integer pageNo, Integer pageSize) {
        List<ZfEvent>  bs = new ArrayList<>();
        LambdaQueryWrapper<ZfShare> lqw = new LambdaQueryWrapper<>();
        lqw.eq(ZfShare::getShareId,getUserId());
        lqw.eq(ZfShare::getSysMenuId,2013L);
        List<ZfShare> beanRecords = list(lqw);
        for (ZfShare beanRecord : beanRecords ) {
            ZfEvent bs2 = zfEventService.getById(beanRecord.getShareContent());
            bs2.setShareId(beanRecord.getUserId().intValue());
            bs.add(bs2);
        }
        log.info("从数据库中查到的为:{}", bs);
        List<ZfEvent>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZfEvent> zfEventPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getShareResult(zfEventPage, 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;
        }
    }
}