|
@@ -4,6 +4,7 @@ import com.ym.mec.biz.dal.dto.*;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.OrderTypeEnum;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
+import freemarker.template.utility.StringUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -492,18 +493,36 @@ public class StudentOrderController extends BaseController {
|
|
|
|
|
|
@GetMapping("/getPracticeStatis")
|
|
|
public HttpResponseResult getPracticeStatis() {
|
|
|
+ Date nowDate = new Date();
|
|
|
List<Organization> organs = organizationDao.findAllOrgans();
|
|
|
//除去禁止的体验人数
|
|
|
List<Practice4OrganDto> organTryNums = courseScheduleEvaluateDao.getTryNums();
|
|
|
List<Practice4OrganDto> organPracticeTryNums = courseScheduleEvaluateDao.getPracticeTryNums(null);
|
|
|
List<Practice4OrganDto> organVipTryNums = courseScheduleEvaluateDao.getVipTryNums();
|
|
|
String studentIds = organVipTryNums.stream().map(Practice4OrganDto::getStudentIds).collect(Collectors.joining(","));
|
|
|
- List<Practice4OrganDto> organPracticeAndVipTryNums = courseScheduleEvaluateDao.getPracticeTryNums(studentIds);
|
|
|
- List<Practice4OrganDto> practiceBuyNums = courseScheduleEvaluateDao.getPracticeBuyNums(new Date(), null, null);
|
|
|
- List<Practice4OrganDto> vipBuyNums = courseScheduleEvaluateDao.getVipBuyNums(new Date(), null);
|
|
|
-
|
|
|
- List<Practice4OrganDto> practiceAndVipBuyNums = courseScheduleEvaluateDao.getPracticeAndVipNums(new Date(), null);
|
|
|
- Date startTime = DateUtil.getFirstDayOfMonth(new Date());
|
|
|
+ List<Practice4OrganDto> organPracticeAndVipTryNums = new ArrayList<>();
|
|
|
+ if(!studentIds.isEmpty()) {
|
|
|
+ String[] studentIdsArr = studentIds.split(",");
|
|
|
+ int[] userIds = new int[studentIdsArr.length];
|
|
|
+ for (int i = 0; i < studentIdsArr.length; i++) {
|
|
|
+ userIds[i] = Integer.parseInt(studentIdsArr[i]);
|
|
|
+ }
|
|
|
+ organPracticeAndVipTryNums = courseScheduleEvaluateDao.getPracticeTryNums(userIds);
|
|
|
+ }
|
|
|
+ List<Practice4OrganDto> practiceBuyNums = courseScheduleEvaluateDao.getPracticeBuyNums(nowDate, null, null);
|
|
|
+ List<Practice4OrganDto> vipBuyNums = courseScheduleEvaluateDao.getVipBuyNums(nowDate, null);
|
|
|
+
|
|
|
+ List<Practice4OrganDto> practiceAndVipBuyNums = new ArrayList<>();
|
|
|
+ studentIds = vipBuyNums.stream().filter(practice4OrganDto -> practice4OrganDto.getOrganId() != null).map(Practice4OrganDto::getStudentIds).collect(Collectors.joining(","));
|
|
|
+ if (!studentIds.isEmpty()) {
|
|
|
+ String[] studentIdsArr = studentIds.split(",");
|
|
|
+ int[] userIds = new int[studentIdsArr.length];
|
|
|
+ for (int i = 0; i < studentIdsArr.length; i++) {
|
|
|
+ userIds[i] = Integer.parseInt(studentIdsArr[i]);
|
|
|
+ }
|
|
|
+ practiceAndVipBuyNums = courseScheduleEvaluateDao.getPracticeBuyNums(nowDate, null, userIds);
|
|
|
+ }
|
|
|
+ Date startTime = DateUtil.getFirstDayOfMonth(nowDate);
|
|
|
Date endTime = DateUtil.addMonths(startTime, 1);
|
|
|
|
|
|
|
|
@@ -517,13 +536,33 @@ public class StudentOrderController extends BaseController {
|
|
|
//本月总人数
|
|
|
List<Practice4OrganDto> nowMonthPracticeBuyNums = courseScheduleEvaluateDao.getPracticeBuyNums(startTime, endTime, null);
|
|
|
List<Practice4OrganDto> nowMonthVipBuyNums = courseScheduleEvaluateDao.getVipBuyNums(startTime, endTime);
|
|
|
- List<Practice4OrganDto> nowMonthPracticeAndVipBuyNums = courseScheduleEvaluateDao.getPracticeAndVipNums(startTime, endTime);
|
|
|
+ List<Practice4OrganDto> nowMonthPracticeAndVipBuyNums = new ArrayList<>();
|
|
|
+
|
|
|
+ studentIds = vipBuyNums.stream().filter(practice4OrganDto -> practice4OrganDto.getOrganId() != null).map(Practice4OrganDto::getStudentIds).collect(Collectors.joining(","));
|
|
|
+ if (!studentIds.isEmpty()) {
|
|
|
+ String[] studentIdsArr = studentIds.split(",");
|
|
|
+ int[] userIds = new int[studentIdsArr.length];
|
|
|
+ for (int i = 0; i < studentIdsArr.length; i++) {
|
|
|
+ userIds[i] = Integer.parseInt(studentIdsArr[i]);
|
|
|
+ }
|
|
|
+ nowMonthPracticeAndVipBuyNums = courseScheduleEvaluateDao.getPracticeBuyNums(startTime, endTime, userIds);
|
|
|
+ }
|
|
|
|
|
|
//上月总人数
|
|
|
Date lastMonthStartTime = DateUtil.addMonths(startTime, -1);
|
|
|
List<Practice4OrganDto> lastMonthPracticeBuyNums = courseScheduleEvaluateDao.getPracticeBuyNums(lastMonthStartTime, startTime, null);
|
|
|
List<Practice4OrganDto> lastMonthVipBuyNums = courseScheduleEvaluateDao.getVipBuyNums(lastMonthStartTime, startTime);
|
|
|
- List<Practice4OrganDto> lastMonthPracticeAndVipBuyNums = courseScheduleEvaluateDao.getPracticeAndVipNums(lastMonthStartTime, startTime);
|
|
|
+ List<Practice4OrganDto> lastMonthPracticeAndVipBuyNums = new ArrayList<>();
|
|
|
+
|
|
|
+ studentIds = vipBuyNums.stream().filter(practice4OrganDto -> practice4OrganDto.getOrganId() != null).map(Practice4OrganDto::getStudentIds).collect(Collectors.joining(","));
|
|
|
+ if (!studentIds.isEmpty()) {
|
|
|
+ String[] studentIdsArr = studentIds.split(",");
|
|
|
+ int[] userIds = new int[studentIdsArr.length];
|
|
|
+ for (int i = 0; i < studentIdsArr.length; i++) {
|
|
|
+ userIds[i] = Integer.parseInt(studentIdsArr[i]);
|
|
|
+ }
|
|
|
+ lastMonthPracticeAndVipBuyNums = courseScheduleEvaluateDao.getPracticeBuyNums(lastMonthStartTime, startTime, userIds);
|
|
|
+ }
|
|
|
|
|
|
List<Practice4OrganDto> practice4Organs = new ArrayList<>();
|
|
|
for (Organization organ : organs) {
|