|
@@ -3,6 +3,7 @@ package com.ym.mec.biz.service.impl;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.beust.jcommander.internal.Lists;
|
|
import com.microsvc.toolkit.common.response.paging.QueryInfo;
|
|
import com.microsvc.toolkit.common.response.paging.QueryInfo;
|
|
import com.ym.mec.biz.dal.dao.DegreeRegistrationDao;
|
|
import com.ym.mec.biz.dal.dao.DegreeRegistrationDao;
|
|
import com.ym.mec.biz.dal.dao.OrganizationDao;
|
|
import com.ym.mec.biz.dal.dao.OrganizationDao;
|
|
@@ -29,10 +30,7 @@ import com.ym.mec.biz.service.DegreeService;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
-import java.util.Arrays;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -103,6 +101,29 @@ public class DegreeServiceImpl extends ServiceImpl<DegreeMapper, Degree> impleme
|
|
|
|
|
|
List<Organization> organs = organizationService.findOrgans(organIds, tenantId);
|
|
List<Organization> organs = organizationService.findOrgans(organIds, tenantId);
|
|
|
|
|
|
|
|
+
|
|
|
|
+ // 考级ID集合
|
|
|
|
+ List<Long> degreeIds = degrees.stream().map(DegreeWrapper.Degree::getId).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ // 查询考级报名的订单
|
|
|
|
+ List<DegreeRegistration> registrations = degreeRegistrationDao.selectByDegreeId(degreeIds);
|
|
|
|
+
|
|
|
|
+ // 按考级ID分组
|
|
|
|
+ Map<Long, List<DegreeRegistration>> registrationMap = registrations.stream().collect(Collectors.groupingBy(DegreeRegistration::getDegreeId));
|
|
|
|
+
|
|
|
|
+ for (DegreeWrapper.Degree degree : degrees) {
|
|
|
|
+ List<DegreeRegistration> registrationList = registrationMap.get(degree.getId());
|
|
|
|
+ if (CollectionUtils.isEmpty(registrationList)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ List<Integer> userIds = registrationList.stream().map(DegreeRegistration::getUserId).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ degree.setRegisterTotal(userIds.size());
|
|
|
|
+
|
|
|
|
+ degree.setRegisterNum(new HashSet<>(userIds).size());
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
degrees.forEach(o -> {
|
|
degrees.forEach(o -> {
|
|
List<String> organNames = Arrays.stream(o.getOrganIds().split(","))
|
|
List<String> organNames = Arrays.stream(o.getOrganIds().split(","))
|
|
.filter(Objects::nonNull)
|
|
.filter(Objects::nonNull)
|
|
@@ -207,7 +228,7 @@ public class DegreeServiceImpl extends ServiceImpl<DegreeMapper, Degree> impleme
|
|
statistical.setRegisterNum(degree.getRegisterNum());
|
|
statistical.setRegisterNum(degree.getRegisterNum());
|
|
|
|
|
|
// 查询考级报名的订单
|
|
// 查询考级报名的订单
|
|
- List<DegreeRegistration> registrations = degreeRegistrationDao.selectByDegreeId(id);
|
|
|
|
|
|
+ List<DegreeRegistration> registrations = degreeRegistrationDao.selectByDegreeId(Lists.newArrayList(id));
|
|
|
|
|
|
if (CollectionUtils.isEmpty(registrations)) {
|
|
if (CollectionUtils.isEmpty(registrations)) {
|
|
return statistical;
|
|
return statistical;
|
|
@@ -221,6 +242,14 @@ public class DegreeServiceImpl extends ServiceImpl<DegreeMapper, Degree> impleme
|
|
return statistical;
|
|
return statistical;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 用户ID集合
|
|
|
|
+ List<Integer> userIds = registrations.stream().map(DegreeRegistration::getUserId).collect(Collectors.toList());
|
|
|
|
+ statistical.setRegisterTotal(userIds.size());
|
|
|
|
+
|
|
|
|
+ statistical.setRegisterNum(new HashSet<>(userIds).size());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
// 订单号集合
|
|
// 订单号集合
|
|
List<String> orderNos = registrations.stream().map(DegreeRegistration::getOrderNo).collect(Collectors.toList());
|
|
List<String> orderNos = registrations.stream().map(DegreeRegistration::getOrderNo).collect(Collectors.toList());
|
|
|
|
|