| | |
| | | return storeId; |
| | | } |
| | | |
| | | /** |
| | | * 运营商统计的门店范围:平台(0)统计平台门店,其他值统计对应运营商门店。 |
| | | */ |
| | | /** 平台(0)或运营商统计均以门店的 operatorId 作为唯一归属依据。 */ |
| | | private List<TStore> listStatisticsStores(Integer operatorId, boolean enabledOnly) { |
| | | LambdaQueryWrapper<TStore> wrapper = new LambdaQueryWrapper<>(); |
| | | if (enabledOnly) { |
| | |
| | | } |
| | | if (operatorId == null) { |
| | | // 平台统计:所有门店总和,不按门店所属运营商过滤。 |
| | | } else if (Integer.valueOf(0).equals(operatorId)) { |
| | | wrapper.eq(TStore::getType, 1); |
| | | } else { |
| | | wrapper.eq(TStore::getType, 2).eq(TStore::getOperatorId, operatorId); |
| | | wrapper.eq(TStore::getOperatorId, operatorId); |
| | | } |
| | | return storeService.list(wrapper); |
| | | } |
| | |
| | | // 下游多处查询会在门店集合为空时忽略门店过滤。运营商没有任何门店时, |
| | | // 直接返回完整的零值结构,避免被误统计为全平台数据。 |
| | | if (operatorId != null && storeId == null |
| | | && listStatisticsStores(operatorId, false).isEmpty()) { |
| | | && storeService.count(new LambdaQueryWrapper<TStore>() |
| | | .eq(TStore::getOperatorId, operatorId) |
| | | .ne(TStore::getState, 3)) == 0) { |
| | | Map<String, Object> emptyIncomeData = buildIncomeStatistics(Collections.emptyList()); |
| | | emptyIncomeData.put("incomeTypeNet", buildIncomeTypeNet(Collections.emptyList(), null)); |
| | | Map<String, Object> emptyTicketIncome = new HashMap<>(); |
| | |
| | | // 门票饼图需要日/月/季/年卡拆分;此前该数据只在 type1 内部返回, |
| | | // 现随统一营收接口返回,供平台页直接使用。 |
| | | monthlyData.put("ticketIncome", getTicketIncome(time, operatorId, storeId)); |
| | | // 平台收入类型饼图还需要课程、订场分类明细。此前页面只能读取 type1 |
| | | // 的模板数据,筛选后 getIncomeData 缺少该字段,导致课程图显示为空。 |
| | | if (operatorId == null && storeId == null) { |
| | | Map<String, Object> platformTypeData = (Map<String, Object>) type1(time); |
| | | monthlyData.put("courseData", platformTypeData.get("courseData")); |
| | | monthlyData.put("siteData", platformTypeData.get("siteData")); |
| | | } |
| | | return monthlyData; |
| | | } |
| | | |
| | |
| | | @RequestMapping(value = "/userAndVipPt") |
| | | @ResponseBody |
| | | public Object userAndVipPt(Integer type) { |
| | | HashMap<String, Object> map = appUserClient.userAndVipYys(listStatisticsAppUserIds(null)); |
| | | // 平台用户统计按用户归属全量统计,不能以“已有消费记录”筛选, |
| | | // 否则会遗漏尚未在门店消费的新注册用户。 |
| | | HashMap<String, Object> map = appUserClient.userAndVipPt(1); |
| | | return map; |
| | | } |
| | | |
| | |
| | | @RequestMapping("/stuUserData") |
| | | @ResponseBody |
| | | public Object stuUserData() { |
| | | HashMap<String, Object> map = appUserClient.queryUserAgeYys(listStatisticsAppUserIds(null)); |
| | | // 平台地域/年龄统计按平台注册用户全量口径,不能仅取已有消费记录的用户。 |
| | | HashMap<String, Object> map = appUserClient.queryUserAge1(); |
| | | |
| | | return map; |
| | | } |