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中 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(); } 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 != userIds){ if(null != userIdList){ userIdList.addAll(userIds); }else{ userIdList = userIds; } 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); ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -751,7 +751,7 @@ <select id="boardOrderTotal" resultType="com.ruoyi.system.api.domain.vo.MgtBulletinBoardVo"> SELECT IFNULL(SUM(CASE WHEN order_status = 3 THEN (CASE WHEN null = change_receivable_money or 0 = change_receivable_money THEN receivable_money ELSE change_receivable_money) ELSE 0 END),0) salesTotal, IFNULL(SUM(CASE WHEN order_status = 3 THEN (CASE WHEN null = change_receivable_money or 0 = change_receivable_money THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) salesTotal, IFNULL(SUM(CASE WHEN order_status = 2 THEN 1 ELSE 0 END),0) UnUseOrderTotal, IFNULL(SUM(CASE WHEN order_from = 2 THEN 1 ELSE 0 END),0) activityOrderTotal FROM t_order @@ -763,7 +763,7 @@ #{item} </foreach> ) or ( order_from = 1 and shop_id in order_from != 2 and shop_id in <foreach collection="shopIds" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/management/MgtShopController.java
@@ -31,6 +31,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; import java.rmi.server.ServerCloneException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -170,6 +171,13 @@ } } } if(null != mgtShopPageDto.getDeptId()){ R<List<SysUser>> r = sysUserService.getUsersByDeptId(mgtShopPageDto.getDeptId()); List<Long> collect = r.getData().stream().map(SysUser::getUserId).collect(Collectors.toList()); List<Shop> shops = shopService.getShopBySysUserIds(collect); scope.addAll(shops.stream().map(Shop::getShopId).collect(Collectors.toList())); } Page<MgtShopPageVo> page = new Page<>(); page.setSize(mgtShopPageDto.getPageSize()); page.setCurrent(mgtShopPageDto.getPageNum()); @@ -223,6 +231,12 @@ } } } if(null != mgtShopPageDto.getDeptId()){ R<List<SysUser>> r = sysUserService.getUsersByDeptId(mgtShopPageDto.getDeptId()); List<Long> collect = r.getData().stream().map(SysUser::getUserId).collect(Collectors.toList()); List<Shop> shops = shopService.getShopBySysUserIds(collect); scope.addAll(shops.stream().map(Shop::getShopId).collect(Collectors.toList())); } List<MgtShopPageVo> mgtShopPageVoList = shopService.pageMgtShop(page,mgtShopPageDto,scope); ExcelUtil<MgtShopPageVo> util = new ExcelUtil<MgtShopPageVo>(MgtShopPageVo.class); util.exportExcel(response, mgtShopPageVoList, "商户列表"); ruoyi-modules/ruoyi-shop/src/main/resources/mapper/shop/ShopMapper.xml
@@ -349,6 +349,9 @@ <if test="param.recommendPerson!=null and param.recommendPerson!=''"> AND ts.recommend_person = #{param.recommendPerson} </if> <if test="param.belongUserId != null"> AND ts.belong_user_id = #{param.belongUserId} </if> <if test="param.belongUserIds != null and param.belongUserIds.size() > 0"> AND ts.belong_user_id in <foreach collection="param.belongUserIds" item="item" index="index" separator="," open="(" close=")"> ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/sys/SysUserController.java
@@ -99,8 +99,10 @@ */ @PostMapping("/getUsersByDeptId") R<List<SysUser>> getUsersByDeptId(@RequestBody Long deptId){ List<SysUser> list = userService.list(new QueryWrapper<SysUser>().eq("dept_id", deptId).eq("del_flag", 0)); return R.ok(list); SysUser sysUser = new SysUser(); sysUser.setDeptId(deptId); List<SysUser> sysUsers = userService.selectUserList(sysUser); return R.ok(sysUsers); }