|
@@ -1,10 +1,7 @@
|
|
|
package com.ym.mec.student.controller;
|
|
|
|
|
|
-import com.ym.mec.biz.dal.dao.OrganizationDao;
|
|
|
-import com.ym.mec.biz.dal.dao.SysConfigDao;
|
|
|
-import com.ym.mec.biz.dal.dao.TeacherCourseStatisticsDao;
|
|
|
-import com.ym.mec.biz.dal.dto.LuckStatisDto;
|
|
|
-import com.ym.mec.biz.dal.dto.OrderStatisDto;
|
|
|
+import com.ym.mec.biz.dal.dao.*;
|
|
|
+import com.ym.mec.biz.dal.dto.*;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
@@ -15,6 +12,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -36,8 +34,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.huifu.adapay.model.payment.PayChannelEnum;
|
|
|
import com.huifu.adapay.model.payment.Payment;
|
|
|
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
|
|
|
-import com.ym.mec.biz.dal.dto.VipBuyResultDto;
|
|
|
import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
|
import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
@@ -80,6 +76,8 @@ public class StudentOrderController extends BaseController {
|
|
|
private OrganizationDao organizationDao;
|
|
|
@Autowired
|
|
|
private TeacherCourseStatisticsDao teacherCourseStatisticsDao;
|
|
|
+ @Autowired
|
|
|
+ private CourseScheduleEvaluateDao courseScheduleEvaluateDao;
|
|
|
|
|
|
@PostMapping("/notify")
|
|
|
public Msg notify(@ModelAttribute Msg msg) throws Exception {
|
|
@@ -341,4 +339,96 @@ public class StudentOrderController extends BaseController {
|
|
|
luckStatisDto.setTotalMoney(totalMoney);
|
|
|
return succeed(luckStatisDto);
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping("/getPracticeGroupStatis")
|
|
|
+ public HttpResponseResult getPracticeGroupStatis() {
|
|
|
+ List<Organization> organs = organizationDao.findAllOrgans();
|
|
|
+ List<PracticeGroupsDto> hasReportNums = courseScheduleEvaluateDao.getHasReportNums();
|
|
|
+ List<PracticeGroupsDto> organMoneys = courseScheduleEvaluateDao.getOrganMoney();
|
|
|
+ List<PracticeGroupsDto> organPracticeGroups = courseScheduleEvaluateDao.getOrganPracticeGroups();
|
|
|
+ List<PracticeGroupsDto> practiceGroupsFrees = courseScheduleEvaluateDao.getPracticeGroupsFree();
|
|
|
+ List<PracticeGroupsDto> practiceGroupsBuys = courseScheduleEvaluateDao.getPracticeGroupsBuy();
|
|
|
+
|
|
|
+ List<PracticeGroupsDto> practiceGroups = new ArrayList<>();
|
|
|
+ for (Organization organ : organs) {
|
|
|
+ PracticeGroupsDto practiceGroupsDto = new PracticeGroupsDto();
|
|
|
+ practiceGroupsDto.setOrganName(organ.getName());
|
|
|
+ practiceGroupsDto.setOrganId(organ.getId());
|
|
|
+ //体验人数
|
|
|
+ for (PracticeGroupsDto practiceGroupsFree : practiceGroupsFrees) {
|
|
|
+ if (organ.getId().equals(practiceGroupsFree.getOrganId())) {
|
|
|
+ practiceGroupsDto.setTotalNums(practiceGroupsFree.getTotalNums());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //购买人数
|
|
|
+ for (PracticeGroupsDto practiceGroupsBuy : practiceGroupsBuys) {
|
|
|
+ if (organ.getId().equals(practiceGroupsBuy.getOrganId())) {
|
|
|
+ practiceGroupsDto.setBuyNums(practiceGroupsBuy.getBuyNums());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //已完成人数
|
|
|
+ for (PracticeGroupsDto organPracticeGroup : organPracticeGroups) {
|
|
|
+ if (organ.getId().equals(organPracticeGroup.getOrganId()) && organPracticeGroup.getBuyNums() >= organPracticeGroup.getTotalNums()) {
|
|
|
+ practiceGroupsDto.setOverNums(practiceGroupsDto.getOverNums() + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //已提交报告人数
|
|
|
+ for (PracticeGroupsDto hasReportNum : hasReportNums) {
|
|
|
+ if (organ.getId().equals(hasReportNum.getOrganId())) {
|
|
|
+ practiceGroupsDto.setReportNums(hasReportNum.getReportNums());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //成交金额
|
|
|
+ for (PracticeGroupsDto organMoney : organMoneys) {
|
|
|
+ practiceGroupsDto.setTotalMoney(organMoney.getTotalMoney());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(practiceGroupsDto.getTotalNums() >0 ){
|
|
|
+ double scale = new BigDecimal(practiceGroupsDto.getBuyNums()).multiply(new BigDecimal(100)).divide(new BigDecimal(practiceGroupsDto.getTotalNums()),2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ practiceGroupsDto.setBuyScale(scale);
|
|
|
+ }
|
|
|
+
|
|
|
+ practiceGroups.add(practiceGroupsDto);
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal totalMoney = BigDecimal.ZERO;
|
|
|
+ Integer totalNum = 0;
|
|
|
+ Integer buyNum = 0;
|
|
|
+ Integer overNum = 0;
|
|
|
+ Integer reportNum = 0;
|
|
|
+
|
|
|
+ Iterator<PracticeGroupsDto> iterator = practiceGroups.iterator();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ PracticeGroupsDto next = iterator.next();
|
|
|
+ if (next.getOrganName().equals("总部国际") || next.getOrganName().equals("阳光总部国际") || next.getOrganName().equals("武汉小学")) {
|
|
|
+ iterator.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ totalMoney = totalMoney.add(next.getTotalMoney());
|
|
|
+ totalNum += next.getTotalNums();
|
|
|
+ overNum += next.getOverNums();
|
|
|
+ buyNum += next.getBuyNums();
|
|
|
+ reportNum += next.getReportNums();
|
|
|
+ }
|
|
|
+ practiceGroups = practiceGroups.stream().sorted(Comparator.comparingDouble(PracticeGroupsDto::getBuyScale).reversed()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ practiceGroupStatisDto practiceGroupStatisDto = new practiceGroupStatisDto();
|
|
|
+ practiceGroupStatisDto.setPracticeGroupsDtoList(practiceGroups);
|
|
|
+ practiceGroupStatisDto.setTotalMoney(totalMoney);
|
|
|
+ practiceGroupStatisDto.setTotalNum(totalNum);
|
|
|
+ practiceGroupStatisDto.setBuyNum(buyNum);
|
|
|
+ practiceGroupStatisDto.setOverNum(overNum);
|
|
|
+ practiceGroupStatisDto.setReportNum(reportNum);
|
|
|
+
|
|
|
+ if(totalNum >0 ){
|
|
|
+ BigDecimal scale = new BigDecimal(buyNum).multiply(new BigDecimal(100)).divide(new BigDecimal(totalNum), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ practiceGroupStatisDto.setBuyScale(scale);
|
|
|
+ }
|
|
|
+
|
|
|
+ return succeed(practiceGroupStatisDto);
|
|
|
+ }
|
|
|
}
|