puzhibing
2024-01-26 4924df4e316fa1acf75bcf7240227deac767c357
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
@@ -3870,7 +3870,7 @@
                userIdList.add(mgtBasePlatformDto.getUserId());
            } else {
                MgtUserIdByDept mgtUserIdByDept = new MgtUserIdByDept();
                mgtUserIdByDept.setDeptId(mgtBasePlatformDto.getUserId());
                mgtUserIdByDept.setDeptId(mgtBasePlatformDto.getDeptId());
                mgtUserIdByDept = remoteConfigService.getUserIdByDept(mgtUserIdByDept).getData();
                userIdList = mgtUserIdByDept.getUserIdList();
            }
@@ -3903,8 +3903,10 @@
        MgtSimpleShopVo simpleShopVo;
        HashSet<String> set = new HashSet<>();
        // 遍历MgtMemberOrderPageVoList,获取shopId并添加到set中
        for (Long entity : shopIdList) {
            set.add(entity.toString());
        if(null != shopIdList){
            for (Long entity : shopIdList) {
                set.add(entity.toString());
            }
        }
        String joinedString = String.join(",", set);
        MgtBaseBathDto mgtBaseBathDto = new MgtBaseBathDto();
@@ -3944,63 +3946,25 @@
            List<Long> userIdList = new ArrayList<>();
            if (mgtBasePlatformDto.getUserId() != null) {
                userIdList.add(mgtBasePlatformDto.getUserId());
            }
            else {
                // 如果当前登陆人的可视权限是仅个人 只选择了部门也只能看自己的数据
                SysUser sysUser = SecurityUtils.getSysUser();
                if (sysUser.getDataScope().equals("5")){
                    userIdList.add(sysUser.getUserId());
                }else{
                    MgtUserIdByDept mgtUserIdByDept = new MgtUserIdByDept();
                    mgtUserIdByDept.setDeptId(mgtBasePlatformDto.getDeptId());
                    mgtUserIdByDept = remoteConfigService.getUserIdByDept(mgtUserIdByDept).getData();
                    userIdList = mgtUserIdByDept.getUserIdList();
                }
            } else {
                List<SysUser> data = remoteUserService.getUsersByDeptId(mgtBasePlatformDto.getDeptId()).getData();
                userIdList.addAll(data.stream().map(SysUser::getUserId).collect(Collectors.toList()));
            }
            if (!userIdList.isEmpty()) {
                mgtBasePlatformDto.setUserIdList(userIdList);
            }
        }else{
            // 没有选择筛选部门和员工 获取当前登陆人的可视权限
            SysUser sysUser = SecurityUtils.getSysUser();
            // 如果当前登陆人是查看个人数据
            Long userId1  = null;
            // 如果当前登陆人权限是查看部门数据
            List<Long> userList = new ArrayList<>();
            if (sysUser!=null){
                String dataScope = sysUser.getDataScope();
                if (!sysUser.getUserName().equals("admin")){
                    if (org.springframework.util.StringUtils.hasLength(dataScope)){
                        switch (dataScope){
                            case "3":
                                // 本部门数据 查询当前登陆人属于哪个部门 查询这个部门下所有员工关联的所有店铺
                                MgtUserIdByDept mgtUserIdByDept = new MgtUserIdByDept();
                                mgtUserIdByDept.setDeptId(sysUser.getDeptId());
                                mgtUserIdByDept = remoteConfigService.getUserIdByDept(mgtUserIdByDept).getData();
                                userList = mgtUserIdByDept.getUserIdList();
                                mgtBasePlatformDto.setDeptId(sysUser.getDeptId());
                                mgtBasePlatformDto.setUserIdList(userList);
                            case "5":
                                // 仅个人数据 查询当前登陆人关联店铺下的用户
                                userId1 = sysUser.getUserId();
                                userList.add(userId1);
                                mgtBasePlatformDto.setDeptId(sysUser.getDeptId());
                                mgtBasePlatformDto.setUserIdList(userList);
                                break;
                        }
                    }
                }
            }
        }
        //数据权限
        List<Long> userIdList = mgtBasePlatformDto.getUserIdList();
        List<Long> userIds = remoteUserService.getScopeOfAuthorityUserId();
        if(null != userIdList){
            userIdList.addAll(userIds);
        }else{
            userIdList = userIds;
        if(null != userIds){
            if(null != userIdList){
                userIdList.addAll(userIds);
            }else{
                userIdList = userIds;
            }
            mgtBasePlatformDto.setUserIdList(userIdList);
        }
        mgtBasePlatformDto.setUserIdList(userIdList);
        MgtTotalOrderTotalVo mgtTotalOrderTotalVo = new MgtTotalOrderTotalVo();
@@ -4236,6 +4200,9 @@
        List<Long> userIds = remoteUserService.getScopeOfAuthorityUserId();
        if(null != userIds){
            List<Long> userIdList = mgtBasePlatformDto.getUserIdList();
            if(null == userIdList){
                userIdList = new ArrayList<>();
            }
            userIdList.addAll(userIds);
            mgtBasePlatformDto.setUserIdList(userIdList);
        }
@@ -4250,6 +4217,7 @@
            shopIdList = new ArrayList<>();
            shopIdList.add(mgtBasePlatformDto.getShopId());
        }
        mgtBasePlatformDto.setShopIdList(shopIdList);
        //获取基础统计
        MgtPlTotalActivityTotalVo mgtTotalActivityTotalVo = orderMapper.getPlTotalActivityTotal(mgtBasePlatformDto);