zqy
2025-01-10 f89ec4f39d08069d62c81062ca02a5507b24a622
修改bug
4个文件已修改
162 ■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfShareDataController.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZfShareDataService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteServiceImpl.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfShareDataServiceImpl.java 86 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfShareDataController.java
@@ -3,7 +3,9 @@
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZfShareOther;
import com.ruoyi.domain.ZfShareData;
@@ -37,7 +39,12 @@
     */
    @GetMapping("/all")
    public List<ZfShareOther> listAll(ZfShareData zfShareData) {
        List<ZfShareData> zfShareData2 = zfShareDataService.selectList();
        SysUser user = SecurityUtils.getLoginUser().getUser();
        Long userId = user.getUserId();
        zfShareData.setUserId(userId.intValue());
        List<ZfShareData> zfShareData2 = zfShareDataService.selectList(zfShareData);
        List<ZfShareOther> zfShareOtherList = new ArrayList<>();
        for (ZfShareData zfShareData1 :zfShareData2){
            System.out.println("1111111111111111111111");
zhang-content/src/main/java/com/ruoyi/service/ZfShareDataService.java
@@ -1,5 +1,6 @@
package com.ruoyi.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ZfDoctor;
@@ -12,7 +13,7 @@
public interface ZfShareDataService extends IService<ZfShareData> {
    List<ZfShareData> selectList();
    List<ZfShareData> selectList(ZfShareData zfShareData);
    List<ZfShareData> selectByIds(Long[] ids);
@@ -26,4 +27,14 @@
    List<ZfShareData> getShareId(Long id);
    Long getSource(Long userId);
    Long getEnd(Long userId);
    List<Long> getAllPerson(List<Long> userIds);
    List<ZfShareData> getByShareId(List<Long> id);
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZSelfNoteServiceImpl.java
@@ -72,30 +72,37 @@
        return lqw;
    }
//    public List<ZfShareData> getAllByShareId(ZfShareData zfShareData1){
//        SysUser user = SecurityUtils.getLoginUser().getUser();
//        Long userId = user.getUserId();
//
//        ZfShareData zfShareData = new ZfShareData();
//        zfShareData.setUserId(userId.intValue());
//        List<ZfShareData> zfShareDataList = zfShareDataService.selectList(zfShareData);
//        zfShareData.setUserId(zfShareData1.getUserId());
//        zfShareDataList.addAll(zfShareDataService.selectList(zfShareData));
//        return zfShareDataList;
//    }
    public List<Long> getAll(){
        SysUser user = SecurityUtils.getLoginUser().getUser();
        Long userId = user.getUserId();
        List<ZfShareData> shareId = zfShareDataService.getShareId(userId);
        List<ZfShareData> zfShareDataList = zfShareDataService.selectList();
        Long source = zfShareDataService.getSource(userId);
        List<Long> allList = zfShareDataService.getAllPerson(Collections.singletonList(source));
        allList.add(source);
        List<Long> collect = allList.stream().distinct().collect(Collectors.toList());
        List<Long> all = new ArrayList<>();
        all.add(userId);
        if(shareId.size() >0 ) {
            if (shareId.get(0).getMasterAccount() == 0 || shareId.get(0).getMasterAccount() == userId.intValue()) {
                all.add(shareId.get(0).getUserId().longValue());
            }
            else {
                all.clear();
                all.add(0L);
                return all;
            }
        }
        if (zfShareDataList.size()>0 && (zfShareDataList.get(0).getMasterAccount() == 0 || zfShareDataList.get(0).getMasterAccount() == userId.intValue())){
            for (ZfShareData zfShareOther: zfShareDataList) {
                all.add(zfShareOther.getSharedId().longValue());
            }
        }
        if(collect.size() > 1 ) {
            Integer masterAccount = zfShareDataService.getByShareId(collect).get(0).getMasterAccount();
            if (masterAccount != 0 || masterAccount != userId.intValue()) {
                all.clear();
            }
            all.addAll(collect);
        }
        return all;
    }
@@ -107,14 +114,13 @@
        LambdaQueryWrapper<ZSelfNote> lqw = buildCondition(zSelfNote);
        SysUser user = SecurityUtils.getLoginUser().getUser();
        Long userId = user.getUserId();
        List<ZfShareData> zfShareOtherList = zfShareDataService.selectList();
        List<ZfShareData> shareId = zfShareDataService.getShareId(userId);
        if (list(lqw).size()==0) {
        List<Long> all = getAll();
        if (all.contains(userId)) {
            List<ZfShareData> byShareId = zfShareDataService.getByShareId(all);
            Integer masterAccount = 0;
            if(zfShareOtherList.size()>0 ){
             masterAccount = zfShareOtherList.get(0).getMasterAccount();}
            if(shareId.size()>0){
                masterAccount = shareId.get(0).getMasterAccount();
            if(byShareId.size()>0){
                masterAccount = byShareId.get(0).getMasterAccount();
            }
            ZInfoUser infoBysysId = zInfoUserService.getInfoBysysId(masterAccount.longValue());
            if (infoBysysId !=null)
zhang-content/src/main/java/com/ruoyi/service/impl/ZfShareDataServiceImpl.java
@@ -1,11 +1,9 @@
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.domain.*;
import com.ruoyi.mapper.ZfShareDataMapper;
import com.ruoyi.service.EsService;
@@ -19,10 +17,8 @@
import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class ZfShareDataServiceImpl extends ServiceImpl<ZfShareDataMapper, ZfShareData> implements ZfShareDataService {
@@ -34,11 +30,8 @@
    private RestHighLevelClient restHighLevelClient;
    @Resource
    private ZfClanService zfClanService;
    @Resource
    private EsService esSer;
    private LambdaQueryWrapper<ZfShareData> buildCondition(Long userId) {
        LambdaQueryWrapper<ZfShareData> lqw = new LambdaQueryWrapper<>();
        lqw.orderByDesc(ZfShareData::getId);
@@ -54,7 +47,7 @@
    }
    @Override
    public List<ZfShareData> selectList() {
    public List<ZfShareData> selectList(ZfShareData zfShareData) {
        LambdaQueryWrapper<ZfShareData> lqw = buildCondition(getUserId());
        return list(lqw);
@@ -75,7 +68,7 @@
        return myself.getUserId();
    }
    @Override
    public Long getSource(Long userId){
        LambdaQueryWrapper<ZfShareData> lqw = new LambdaQueryWrapper<>();
        lqw.orderByDesc(ZfShareData::getId);
@@ -85,6 +78,16 @@
        }
        return getSource(list(lqw).get(0).getUserId().longValue());
    }
    @Override
    public Long getEnd(Long userId){
        LambdaQueryWrapper<ZfShareData> lqw1 = new LambdaQueryWrapper<>();
        lqw1.eq(ZfShareData::getUserId,userId);
        if (list(lqw1).size() == 0){
            return userId;
        }
        return getEnd(list(lqw1).get(list(lqw1).size()-1).getSharedId().longValue());
    }
    @Override
    public AjaxResult addData(Long[] userIds) {
@@ -129,22 +132,61 @@
        }
    }
    private LambdaQueryWrapper<ZfShareData> selectByUserId(List<Long> userId) {
        LambdaQueryWrapper<ZfShareData> lqw = new LambdaQueryWrapper<>();
        lqw.in(ZfShareData::getSharedId,userId);
        return lqw;
    }
    private LambdaQueryWrapper<ZfShareData> selectBySharedId(List<Long> userId) {
        LambdaQueryWrapper<ZfShareData> lqw = new LambdaQueryWrapper<>();
        lqw.in(ZfShareData::getUserId,userId);
        return lqw;
    }
    @Override
    public List<Long> getAllPerson(List<Long> userIds){
        List<ZfShareData> lists = new ArrayList<>(list(selectByUserId(userIds)));
        lists.addAll(list(selectBySharedId(userIds)));
        if (userIds.contains(getEnd(getSource(userIds.get(0))))){
            return userIds;
        }
        return getAllPerson(lists.stream().map(ZfShareData::getSharedId).map(Integer::longValue).collect(Collectors.toList()));
    }
    @Override
    public AjaxResult setAdmin(Long userId,Long id) {
        List<ZfShareData> list = list(buildCondition(getSource(userId)));
        list.addAll(getShareId(userId));
        for (ZfShareData zfShareData1:list){
        Long source = getSource(userId);
        List<Long> all = getAllPerson(Collections.singletonList(source));
        List<Long> collect = all.stream().distinct().collect(Collectors.toList());
        collect.add(source);
        List<ZfShareData> list = list(selectByUserId(collect));
        list.addAll(list(selectBySharedId(collect)));
        List<ZfShareData> collect1 = list.stream().distinct().collect(Collectors.toList());
        for (ZfShareData zfShareData1:collect1){
            zfShareData1.setMasterAccount(id.intValue());
            updateById(zfShareData1);
        }
        return AjaxResult.success();
    }
    @Override
    public AjaxResult allUser(Long id) {
        List<ZfShareData> list = list(buildCondition(getSource(id)));
        list.addAll(getShareId(id));
        for (ZfShareData zfShareData1:list){
        Long source = getSource(id);
        List<Long> all = getAllPerson(Collections.singletonList(source));
        List<Long> collect = all.stream().distinct().collect(Collectors.toList());
        collect.add(source);
        List<ZfShareData> list = list(selectByUserId(collect));
        list.addAll(list(selectBySharedId(collect)));
        List<ZfShareData> collect1 = list.stream().distinct().collect(Collectors.toList());
        for (ZfShareData zfShareData1:collect1){
            zfShareData1.setMasterAccount(0);
            updateById(zfShareData1);
        }
@@ -158,4 +200,12 @@
        lqw.eq(ZfShareData::getSharedId,id);
        return list(lqw);
    }
    @Override
    public List<ZfShareData> getByShareId(List<Long> id) {
        LambdaQueryWrapper<ZfShareData> lqw = new LambdaQueryWrapper<>();
        lqw.orderByDesc(ZfShareData::getId);
        lqw.in(ZfShareData::getSharedId,id);
        return list(lqw);
    }
}