puzhibing
2024-01-24 a2b83e708f265bf80e8c448cd4c3ca3dc09216d8
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
@@ -3870,6 +3870,17 @@
                mgtBasePlatformDto.setUserIdList(userIdList);
            }
        }
        //数据权限
        List<Long> userIdList = mgtBasePlatformDto.getUserIdList();
        List<Long> userIds = remoteUserService.getScopeOfAuthorityUserId();
        if(null != userIdList){
            userIdList.addAll(userIds);
        }else{
            userIdList = userIds;
        }
        mgtBasePlatformDto.setUserIdList(userIdList);
        List<Long> shopIdList = new ArrayList<>();
        if(mgtBasePlatformDto.getShopId()!=null){
            shopIdList.add(mgtBasePlatformDto.getShopId());
@@ -3933,6 +3944,17 @@
                mgtBasePlatformDto.setUserIdList(userIdList);
            }
        }
        //数据权限
        List<Long> userIdList = mgtBasePlatformDto.getUserIdList();
        List<Long> userIds = remoteUserService.getScopeOfAuthorityUserId();
        if(null != userIdList){
            userIdList.addAll(userIds);
        }else{
            userIdList = userIds;
        }
        mgtBasePlatformDto.setUserIdList(userIdList);
        MgtTotalOrderTotalVo mgtTotalOrderTotalVo = new MgtTotalOrderTotalVo();
        mgtTotalOrderTotalVo.setOrderTotal(0);
        mgtTotalOrderTotalVo.setOnlineTotal(0);
@@ -4160,6 +4182,7 @@
        if(mgtBasePlatformDto.getActivityFrom()!=null&&mgtBasePlatformDto.getActivityFrom()==2){
            return totalActivityTotalVo;
        }
        List<Long> shopIdList = remoteShopService.listShopIdByPlTotal(mgtBasePlatformDto).getData();
        if (StringUtils.isNotBlank(mgtBasePlatformDto.getShopProvinceCode()) || StringUtils.isNotBlank(mgtBasePlatformDto.getShopCityCode()) || StringUtils.isNotBlank(mgtBasePlatformDto.getShopAreaCode())) {
            if(shopIdList==null||shopIdList.isEmpty()){
@@ -4169,6 +4192,15 @@
        if(mgtBasePlatformDto.getShopId()!=null){
            shopIdList = new ArrayList<>();
            shopIdList.add(mgtBasePlatformDto.getShopId());
        }
        //数据权限
        List<Long> userIds = remoteUserService.getScopeOfAuthorityUserId();
        List<Shop> shopList = remoteShopService.getShopBySysUserIds(userIds);
        List<Long> collect = shopList.stream().map(Shop::getShopId).collect(Collectors.toList());
        if(null != shopIdList){
            shopIdList.addAll(collect);
        }else{
            shopIdList = collect;
        }
        mgtBasePlatformDto.setShopIdList(shopIdList);
        //获取基础统计
@@ -4347,52 +4379,6 @@
            totalActivityTotalVo.setOrderTotalValue(orderTotalValue);
            totalActivityTotalVo.setOrderMoneyValue(orderMoneyValue);
        }
        //参与人数  2023-09-06 另开接口
        /*List<MgtMapIntTotalVo> joinList = orderMapper.getMgtActivityMemberTotal(mgtBasePlatformDto);
        // 将查询结果转为Map
        Map<String, Integer> mgtMapIntTotalVoMap = new HashMap<>();
        if (joinList != null && !joinList.isEmpty()) {
            mgtMapIntTotalVoMap = joinList.stream()
                    .collect(Collectors.toMap(MgtMapIntTotalVo::getMapKey, MgtMapIntTotalVo::getMapValue));
        }
        // 获取日期范围
        List<String> dateList = getDateRange(mgtBasePlatformDto.getStartDate(), mgtBasePlatformDto.getEndDate());
        int size = dateList.size();
        // 创建日期和成员总数的数组
        String[] joinMemberTotalKey = new String[size];
        Integer[] joinMemberTotalValue = new Integer[size];
        // 遍历日期列表,设置日期和成员总数的数组
        String str;
        Integer value;
        for (int i = 0; i < size; i++) {
            str = dateList.get(i);
            joinMemberTotalKey[i] = str;
            value = mgtMapIntTotalVoMap.get(str);
            joinMemberTotalValue[i] = (value != null) ? value : 0;
        }
        totalActivityTotalVo.setJoinMemberTotalKey(joinMemberTotalKey);
        totalActivityTotalVo.setJoinMemberTotalValue(joinMemberTotalValue);
        //获客人数
        List<MgtMapIntTotalVo> getList = orderMapper.getMgtActivityGetMemberTotal(mgtBasePlatformDto);
        // 将查询结果转为Map
        Map<String, Integer> getMemberMap = new HashMap<>();
        if (getList != null && !getList.isEmpty()) {
            getMemberMap = getList.stream()
                    .collect(Collectors.toMap(MgtMapIntTotalVo::getMapKey, MgtMapIntTotalVo::getMapValue));
        }
        // 创建日期和成员总数的数组
        String[] getMemberTotalKey = new String[size];
        Integer[] getMemberTotalValue = new Integer[size];
        // 遍历日期列表,设置日期和成员总数的数组
        for (int i = 0; i < size; i++) {
            str = dateList.get(i);
            getMemberTotalKey[i] = str;
            value = getMemberMap.get(str);
            getMemberTotalValue[i] = (value != null) ? value : 0;
        }
        totalActivityTotalVo.setGetMemberTotalKey(getMemberTotalKey);
        totalActivityTotalVo.setGetMemberTotalValue(getMemberTotalValue);*/
        return totalActivityTotalVo;
    }
@@ -4408,24 +4394,6 @@
        if(mgtBasePlatformDto.getActivityFrom()!=null&&mgtBasePlatformDto.getActivityFrom()==2){
            return totalActivityTotalVo;
        }
        /*if(mgtBasePlatformDto.getActivityType()!=null&&mgtBasePlatformDto.getActivityType()!=1){
            return new MgtPlTotalActivityTotalVo();
        }*/
        //获取需要关联的用户id集合
        /*if (mgtBasePlatformDto.getDeptId() != null) {
            List<Long> userIdList = new ArrayList<>();
            if (mgtBasePlatformDto.getUserId() != null) {
                userIdList.add(mgtBasePlatformDto.getUserId());
            } else {
                MgtUserIdByDept mgtUserIdByDept = new MgtUserIdByDept();
                mgtUserIdByDept.setDeptId(mgtBasePlatformDto.getUserId());
                mgtUserIdByDept = remoteConfigService.getUserIdByDept(mgtUserIdByDept).getData();
                userIdList = mgtUserIdByDept.getUserIdList();
            }
            if (!userIdList.isEmpty()) {
                mgtBasePlatformDto.setUserIdList(userIdList);
            }
        }*/
        List<Long> shopIdList = remoteShopService.listShopIdByPlTotal(mgtBasePlatformDto).getData();
        log.info("shopIdList1-----"+shopIdList.toString());
@@ -4440,6 +4408,15 @@
        if(mgtBasePlatformDto.getShopId()!=null){
            shopIdList = new ArrayList<>();
            shopIdList.add(mgtBasePlatformDto.getShopId());
        }
        List<Long> userIds = remoteUserService.getScopeOfAuthorityUserId();
        List<Shop> shopList = remoteShopService.getShopBySysUserIds(userIds);
        List<Long> collect = shopList.stream().map(Shop::getShopId).collect(Collectors.toList());
        if(null != shopIdList){
            shopIdList.addAll(collect);
        }else{
            shopIdList = collect;
        }
        mgtBasePlatformDto.setShopIdList(shopIdList);
        if(mgtBasePlatformDto.getAgeType()!=null){
@@ -4493,24 +4470,6 @@
        if(mgtBasePlatformDto.getActivityFrom()!=null&&mgtBasePlatformDto.getActivityFrom()==2){
            return totalActivityTotalVo;
        }
        /*if(mgtBasePlatformDto.getActivityType()!=null&&mgtBasePlatformDto.getActivityType()!=1){
            return new MgtPlTotalActivityTotalVo();
        }*/
        //获取需要关联的用户id集合
        /*if (mgtBasePlatformDto.getDeptId() != null) {
            List<Long> userIdList = new ArrayList<>();
            if (mgtBasePlatformDto.getUserId() != null) {
                userIdList.add(mgtBasePlatformDto.getUserId());
            } else {
                MgtUserIdByDept mgtUserIdByDept = new MgtUserIdByDept();
                mgtUserIdByDept.setDeptId(mgtBasePlatformDto.getUserId());
                mgtUserIdByDept = remoteConfigService.getUserIdByDept(mgtUserIdByDept).getData();
                userIdList = mgtUserIdByDept.getUserIdList();
            }
            if (!userIdList.isEmpty()) {
                mgtBasePlatformDto.setUserIdList(userIdList);
            }
        }*/
        List<Long> shopIdList = remoteShopService.listShopIdByPlTotal(mgtBasePlatformDto).getData();
        if (StringUtils.isNotBlank(mgtBasePlatformDto.getShopProvinceCode()) || StringUtils.isNotBlank(mgtBasePlatformDto.getShopCityCode()) || StringUtils.isNotBlank(mgtBasePlatformDto.getShopAreaCode())) {
            if(shopIdList==null||shopIdList.isEmpty()){
@@ -4521,6 +4480,15 @@
            shopIdList = new ArrayList<>();
            shopIdList.add(mgtBasePlatformDto.getShopId());
        }
        //数据权限
        List<Long> userIds = remoteUserService.getScopeOfAuthorityUserId();
        List<Shop> shopList = remoteShopService.getShopBySysUserIds(userIds);
        List<Long> collect = shopList.stream().map(Shop::getShopId).collect(Collectors.toList());
        if(null != shopIdList){
            shopIdList.addAll(collect);
        }else{
            shopIdList = collect;
        }
        mgtBasePlatformDto.setShopIdList(shopIdList);
        if(mgtBasePlatformDto.getAgeType()!=null){
            List<Long> userIdList = remoteMemberService.listUserIdByAgeType(mgtBasePlatformDto.getAgeType()).getData();