zqy
2024-07-15 e0bf75fedccd21ae9f91e9a5e6a4934dc8a269dd
分页查看分享&下载
11个文件已修改
194 ■■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/MapUtils.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZfDoctorService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -183,12 +183,12 @@
                System.out.println("2222222222222222222222222222222222/");
            infoUser.setFamilyId(mother.getFamilyId());
        }
//        else if (user.getSpouseId()!=null) {
//            ZInfoUser spouse = zInfoUserService.getById(user.getSpouseId());
//            System.out.println("33333333333333333333333333333333333333333/");
//            infoUser.setFamilyId(spouse.getFamilyId());
//            infoUser.setSpouseId(user.getSpouseId());
//        }
        else if (user.getSpouseId()!=null) {
            ZInfoUser spouse = zInfoUserService.getById(user.getSpouseId());
            System.out.println("33333333333333333333333333333333333333333/");
            infoUser.setFamilyId(spouse.getFamilyId());
            infoUser.setSpouseId(user.getSpouseId());
        }
        zInfoUserService.saveOrUpdate(infoUser);
        if(user.getSpouseId()!=null) {
@@ -280,13 +280,13 @@
            ZInfoUser mother = zInfoUserService.getById(userAll.getMid());
            if (father.getIsMyFamily() == 1)
                infoUser.setFamilyId(father.getFamilyId());
            if (mother.getIsMyFamily() == 1)
            else if (mother.getIsMyFamily() == 1)
                infoUser.setFamilyId(mother.getFamilyId());
        }
//        else {
//            ZInfoUser spouse = zInfoUserService.getById(userAll.getSpouseId());
//            infoUser.setFamilyId(spouse.getFamilyId());
//        }
        else {
            ZInfoUser spouse = zInfoUserService.getById(userAll.getSpouseId());
            infoUser.setFamilyId(spouse.getFamilyId());
        }
        //前端保证了角色不为空
     //   if(user.getRoleIds()[0]==102)
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java
@@ -230,6 +230,14 @@
            return AjaxResult.success(satisfyIds);
        }
    /**
     * 根据用户id判断是否是子孙 uid:长辈id,tpfid:我自己的zinfoid
     */
    @GetMapping("/uidUJd/{uid}/{tpfid}")
    public AjaxResult findByUidAndUid2(@PathVariable("uid") Long uid ,@PathVariable("tpfid")  Long tpfid){
        return AjaxResult.success( zInfoUserService.findByuid(uid,tpfid));
    }
    @GetMapping("/sex/{sex}")
    public AjaxResult findBySex(@PathVariable("sex")  Integer sex)
    {
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java
@@ -1,8 +1,10 @@
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;
@@ -15,10 +17,11 @@
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.PAGE_NUM;
import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE;
import static com.ruoyi.common.core.page.TableSupport.*;
@RestController
@RequestMapping("/ZfDoctorShare")
@@ -47,18 +50,19 @@
     */
    @PostMapping("/getInfoByUserId")
    public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){
        Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return zfDoctorService.selectListById(zfDoctorShareService.listByFidAid(zfDoctor),pageNum,pageSize);
        return  zfDoctorShareService.listByFidAid(zfDoctor,pageNo,pageSize) ;
    }
    /**
     * 用户自己查看别人分享的数据和分享人
     */
    @GetMapping("/getInfoByShareId")
    public AjaxResult empowerGetInfo2(){
        return zfDoctorShareService.listUserId();
    public AjaxResult empowerGetInfo2(@RequestBody ShareMore zfDoctor){
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        return zfDoctorShareService.listUserId(zfDoctor,pageNo ,pageSize);
    }
    /**
     * 根据userId和shareId收回已经授权给那些人
@@ -80,19 +84,10 @@
     * 展示下载分享的数据
     */
    @GetMapping("/all")
    public List<ZfDoctor> data(ZfDoctorDownload zfDoctorDownload){
        Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
    public AjaxResult data(ZfDoctorDownload zfDoctorDownload){
        Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        List<ZfDoctorDownload> as = zfDoctorDownloadService.selectDoctorList(zfDoctorDownload,pageNum,pageSize);
        List<ZfDoctor> bs = new ArrayList<>();
        for (ZfDoctorDownload a: as) {
            if (zfDoctorService.getById(a.getDownloadContent()) != null) {
                ZfDoctor ds = zfDoctorService.getById(a.getDownloadContent());
                ds.setShareId(a.getShareId());
                bs.add(ds);
            }
        }
        return bs;
      return zfDoctorDownloadService.selectDoctorList(zfDoctorDownload,pageNo ,pageSize);
    }
}
ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java
@@ -21,6 +21,11 @@
    public static final String PAGE_SIZE = "pageSize";
    /**
     * 当前页数
     */
    public static final String PAGE_NO = "pageNo";
    /**
     * 排序列
     */
    public static final String ORDER_BY_COLUMN = "orderByColumn";
ruoyi-common/src/main/java/com/ruoyi/common/utils/MapUtils.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.HashMap;
import java.util.List;
/**
 * @Version 1.0
@@ -28,4 +29,14 @@
        data.put("pageSize",pageResult.getSize());
        return data;
    }
    public static HashMap<String,Object> getResult(Page pageResult, List record){
        HashMap<String, Object> data = new HashMap<>();
        data.put("data",record);
        data.put("total",record.size());
        data.put("pageNo",pageResult.getCurrent());
        data.put("totalPage",pageResult.getTotal());
        data.put("pageSize",pageResult.getSize());
        return data;
    }
}
zhang-content/src/main/java/com/ruoyi/service/ZfDoctorDownloadService.java
@@ -12,7 +12,7 @@
    AjaxResult deleteData(Long[] ids);
    List<ZfDoctorDownload> selectDoctorList(ZfDoctorDownload zfDoctorDownload , Integer pageNum, Integer pageSize);
    AjaxResult selectDoctorList(ZfDoctorDownload zfDoctorDownload,Integer pageNo ,Integer pageSize);
}
zhang-content/src/main/java/com/ruoyi/service/ZfDoctorService.java
@@ -38,5 +38,5 @@
    AjaxResult listType();
    AjaxResult selectListById(List<Long> ids, Integer pageNum, Integer pageSize);
//    AjaxResult selectListById(List<Long> ids, Integer pageNum, Integer pageSize);
}
zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java
@@ -15,13 +15,13 @@
    AjaxResult saveZa(ShareMore zfDoctor);
    List<Long> listByFidAid(ShareMore zfDoctorInteger);
    AjaxResult listByFidAid(ShareMore zfDoctorInteger,Integer pageNo ,Integer pageSize);
    AjaxResult deleteZa(ShareMore zfDoctor);
    AjaxResult listByUserId();
    AjaxResult listUserId();
    AjaxResult listUserId(ShareMore zfDoctorInteger,Integer pageNo ,Integer pageSize);
    Long getShareId(ZfDoctorDownload zfDoctorDownload);
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java
@@ -1,11 +1,14 @@
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.ZfDoctorDownload;
import com.ruoyi.mapper.ZfDoctorDownloadMapper;
import com.ruoyi.service.*;
@@ -16,10 +19,8 @@
import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class ZfDoctorDownloadServiceImpl extends ServiceImpl<ZfDoctorDownloadMapper, ZfDoctorDownload> implements ZfDoctorDownloadService {
@@ -29,6 +30,10 @@
    @Resource
    ZfDoctorShareService zfDoctorShareService;
    @Resource
    ZfDoctorService zfDoctorService;
    @Resource
    ZInfoUserService zInfoUserService;
@@ -51,11 +56,25 @@
        return lqw;
    }
    @Override
    public List<ZfDoctorDownload> selectDoctorList(ZfDoctorDownload zfDoctorDownload , Integer pageNum, Integer pageSize) {
    public AjaxResult selectDoctorList(ZfDoctorDownload zfDoctorDownload,Integer pageNo ,Integer pageSize ) {
        ZInfoUser myself = zInfoUserService.getMyself();
        LambdaQueryWrapper<ZfDoctorDownload> lqw = buildCondition(zfDoctorDownload,myself.getUserId());
        List<ZfDoctorDownload> beanRecords = list(lqw);
        return new ArrayList<>(beanRecords);
        List<ZfDoctor> bs = new ArrayList<>();
        for (ZfDoctorDownload a: beanRecords) {
            if (zfDoctorService.getById(a.getDownloadContent()) != null) {
                ZfDoctor ds = zfDoctorService.getById(a.getDownloadContent());
                ds.setShareId(a.getShareId());
                bs.add(ds);
            }
        }
        List<ZfDoctor>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZfDoctor> zfDoctorPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getResult(zfDoctorPage, record);
        return AjaxResult.success(data);
    }
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java
@@ -439,31 +439,30 @@
        return lqw;
    }
    public LambdaQueryWrapper<ZfDoctor> buildCondition2(List<Long> ids) {
        LambdaQueryWrapper<ZfDoctor> lqw = new LambdaQueryWrapper<>();
            lqw.eq(ZfDoctor::getId, ids);
        return lqw;
    }
    @Override
    public AjaxResult selectListById(List<Long> ids, Integer pageNum, Integer pageSize) {
        List<ZfDoctor> lqw2 = new ArrayList<>();
        LambdaQueryWrapper<ZfDoctor> lqw = buildCondition2(ids);
        List<ZfDoctor> bb = list(lqw);
        System.out.println("15052222254"+bb);
        Page<ZfDoctor> zfDoctorPage = new Page<>(pageNum, pageSize);
        Page<ZfDoctor> pageResult = page(zfDoctorPage, lqw);
        List<ZfDoctor> beanRecords = pageResult.getRecords();//得到查询出来的数据
        System.out.println(beanRecords);
        HashMap<String, Object> data = MapUtils.getResult(pageResult, beanRecords);
        return AjaxResult.success(data);
//    public LambdaQueryWrapper<ZfDoctor> buildCondition2(List<Long> ids) {
//        LambdaQueryWrapper<ZfDoctor> lqw = new LambdaQueryWrapper<>();
//            lqw.eq(ZfDoctor::getId, ids);
//
//        return lqw;
//    }
//    @Override
//    public AjaxResult selectListById(List<Long> ids, Integer pageNum, Integer pageSize) {
//        List<ZfDoctor> lqw2 = new ArrayList<>();
//
//        LambdaQueryWrapper<ZfDoctor> lqw = buildCondition2(ids);
//        List<ZfDoctor> bb = list(lqw);
//        System.out.println("15052222254"+bb);
//
//        Page<ZfDoctor> zfDoctorPage = new Page<>(pageNum, pageSize);
//        Page<ZfDoctor> pageResult = page(zfDoctorPage, lqw);
//        List<ZfDoctor> beanRecords = pageResult.getRecords();//得到查询出来的数据
//        System.out.println(beanRecords);
//
//        HashMap<String, Object> data = MapUtils.getResult(pageResult, beanRecords);
//
//
//        return AjaxResult.success(data);
////    }
//        private List<Long> buildCondition1(){
//        List<ZfDoctorShare> authority1 = zfDoctorShareService.getAuthority();
@@ -481,4 +480,4 @@
//    }
}}
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java
@@ -21,6 +21,9 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import static com.alibaba.druid.sql.PagerUtils.limit;
@Slf4j
@Service
@@ -92,10 +95,10 @@
     * 根据UserId和分享人shareId查看已经授权给那些人那些数据
     */
    @Override
    public List<Long> listByFidAid(ShareMore zfDoctor) {
    public AjaxResult listByFidAid(ShareMore zfDoctor,Integer pageNo ,Integer pageSize) {
        //找到对应的赋予数据的用户以及数据内容
        Long [] shareIds = zfDoctor.getShareIds();
        List<Long> beanRecord3 = new ArrayList<>();
        List<ZfDoctor> beanRecord3 = new ArrayList<>();
        for (Long shareId : shareIds) {
            {
                LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
@@ -103,12 +106,18 @@
                        .eq(ZfDoctorShare::getUserId, getUserId());
                List<ZfDoctorShare> beanRecords = list(lqw);
                for (ZfDoctorShare beanRecord : beanRecords ) {
                    beanRecord3.add(beanRecord.getShareContent());
                    beanRecord3.add(zfDoctorService.getById(beanRecord.getShareContent()));
                }
            }
        }
        List<ZfDoctor>  record =  beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        return beanRecord3;
        int totalPage = (beanRecord3.size() -1) / pageSize +1;
        Page<ZfDoctor> zfDoctorPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getResult(zfDoctorPage, record);
        return AjaxResult.success(data);
    }
    @Override
@@ -153,7 +162,7 @@
     * 用户自己查看别人分享的数据==用户自己查看别人分享的数据和分享人
     */
    @Override
    public AjaxResult listUserId() {
    public AjaxResult listUserId(ShareMore zfDoctorInteger,Integer pageNo ,Integer pageSize) {
        //找到对应的赋予数据的用户以及数据内容
        List<ZfDoctor>  bs = new ArrayList<>();
        LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
@@ -165,7 +174,13 @@
            bs.add(bs2);
        }
        log.info("从数据库中查到的为:{}", bs);
        return AjaxResult.success(bs);
        List<ZfDoctor>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
        int totalPage = (bs.size() -1) / pageSize +1;
        Page<ZfDoctor> zfDoctorPage = new Page<>(pageNo, pageSize,totalPage);
        HashMap<String, Object> data = MapUtils.getResult(zfDoctorPage, record);
        return AjaxResult.success(data);
    }
    public Long getUserId(){