Bläddra i källkod

学生评价列表导出增加学生评分

周箭河 5 år sedan
förälder
incheckning
159813c86a

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleEvaluateDao.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.dto.PracticeGroupsDto;
 import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
+import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 
@@ -85,9 +86,17 @@ public interface CourseScheduleEvaluateDao extends BaseDAO<Long, CourseScheduleE
 
     /**
      * 查询当天是否已有报告
+     *
      * @param classGroupIds
      * @param nowDate
      * @return
      */
     List<CourseScheduleEvaluate> hasReportList(@Param("classGroupIds") List<Integer> classGroupIds, @Param("nowDate") Date nowDate);
+
+    /**
+     * 获取当月成交金额,人数
+     * @param type
+     * @return
+     */
+    List<PracticeGroupsDto> getMonthOrganMoney(@Param("type") OrderTypeEnum type);
 }

+ 36 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/PracticeGroupsDto.java

@@ -12,6 +12,10 @@ public class PracticeGroupsDto {
     private Integer renewNums = 0;
     private BigDecimal totalMoney = BigDecimal.ZERO;
     private Double buyScale =  0.00;
+    private Integer monthBuyNums = 0;
+    private Integer monthRenewNums = 0;
+    private BigDecimal monthBuyMoney = BigDecimal.ZERO;
+    private BigDecimal monthRenewMoney= BigDecimal.ZERO;
 
     public String getOrganName() {
         return organName;
@@ -84,4 +88,36 @@ public class PracticeGroupsDto {
     public void setRenewNums(Integer renewNums) {
         this.renewNums = renewNums;
     }
+
+    public Integer getMonthBuyNums() {
+        return monthBuyNums;
+    }
+
+    public void setMonthBuyNums(Integer monthBuyNums) {
+        this.monthBuyNums = monthBuyNums;
+    }
+
+    public Integer getMonthRenewNums() {
+        return monthRenewNums;
+    }
+
+    public void setMonthRenewNums(Integer monthRenewNums) {
+        this.monthRenewNums = monthRenewNums;
+    }
+
+    public BigDecimal getMonthBuyMoney() {
+        return monthBuyMoney;
+    }
+
+    public void setMonthBuyMoney(BigDecimal monthBuyMoney) {
+        this.monthBuyMoney = monthBuyMoney;
+    }
+
+    public BigDecimal getMonthRenewMoney() {
+        return monthRenewMoney;
+    }
+
+    public void setMonthRenewMoney(BigDecimal monthRenewMoney) {
+        this.monthRenewMoney = monthRenewMoney;
+    }
 }

+ 36 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/practiceGroupStatisDto.java

@@ -12,6 +12,10 @@ public class practiceGroupStatisDto {
     private Integer overNum = 0;
     private Integer reportNum = 0;
     private BigDecimal buyScale;
+    private Integer monthBuyNums = 0;
+    private Integer monthRenewNums = 0;
+    private BigDecimal monthBuyMoney = BigDecimal.ZERO;
+    private BigDecimal monthRenewMoney= BigDecimal.ZERO;
 
     public practiceGroupStatisDto() {
     }
@@ -79,4 +83,36 @@ public class practiceGroupStatisDto {
     public void setRenewNum(Integer renewNum) {
         this.renewNum = renewNum;
     }
+
+    public Integer getMonthBuyNums() {
+        return monthBuyNums;
+    }
+
+    public void setMonthBuyNums(Integer monthBuyNums) {
+        this.monthBuyNums = monthBuyNums;
+    }
+
+    public Integer getMonthRenewNums() {
+        return monthRenewNums;
+    }
+
+    public void setMonthRenewNums(Integer monthRenewNums) {
+        this.monthRenewNums = monthRenewNums;
+    }
+
+    public BigDecimal getMonthBuyMoney() {
+        return monthBuyMoney;
+    }
+
+    public void setMonthBuyMoney(BigDecimal monthBuyMoney) {
+        this.monthBuyMoney = monthBuyMoney;
+    }
+
+    public BigDecimal getMonthRenewMoney() {
+        return monthRenewMoney;
+    }
+
+    public void setMonthRenewMoney(BigDecimal monthRenewMoney) {
+        this.monthRenewMoney = monthRenewMoney;
+    }
 }

+ 10 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleEvaluateMapper.xml

@@ -271,4 +271,14 @@
           AND be_renew_group_id_ >= 1
         GROUP BY organ_id_
     </select>
+
+    <!-- 获取当月成交金额,续费人数(新增人数) -->
+    <select id="getMonthOrganMoney" resultMap="PracticeGroupsOrgan">
+        SELECT SUM(actual_amount_) total_money_, count(distinct user_id_) buy_nums_, organ_id_
+        FROM student_payment_order
+        WHERE type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+          AND status_ = 'SUCCESS'
+          AND DATE_FORMAT(create_time_, '%Y%m') = DATE_FORMAT(now(), '%Y%m')
+        GROUP BY organ_id_
+    </select>
 </mapper>

+ 26 - 0
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.student.controller;
 
+import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -370,6 +371,8 @@ public class StudentOrderController extends BaseController {
         List<PracticeGroupsDto> practiceGroupsFrees = courseScheduleEvaluateDao.getPracticeGroupsFree();
         List<PracticeGroupsDto> practiceGroupsBuys = courseScheduleEvaluateDao.getPracticeGroupsBuy();
         List<PracticeGroupsDto> practiceGroupsRenews = courseScheduleEvaluateDao.getPracticeGroupsRenew();
+        List<PracticeGroupsDto> monthOrganBuyMoneys = courseScheduleEvaluateDao.getMonthOrganMoney(OrderTypeEnum.PRACTICE_GROUP_BUY);
+        List<PracticeGroupsDto> monthOrganRenewMoneys = courseScheduleEvaluateDao.getMonthOrganMoney(OrderTypeEnum.PRACTICE_GROUP_RENEW);
 
         List<PracticeGroupsDto> practiceGroups = new ArrayList<>();
         for (Organization organ : organs) {
@@ -418,6 +421,17 @@ public class StudentOrderController extends BaseController {
                     break;
                 }
             }
+            //当月新增金额和人数
+            for (PracticeGroupsDto monthOrganBuyMoney : monthOrganBuyMoneys) {
+                practiceGroupsDto.setMonthBuyMoney(monthOrganBuyMoney.getTotalMoney());
+                practiceGroupsDto.setMonthBuyNums(monthOrganBuyMoney.getBuyNums());
+            }
+
+            //当月续费金额和人数
+            for (PracticeGroupsDto monthOrganRenewMoney : monthOrganRenewMoneys) {
+                practiceGroupsDto.setMonthRenewNums(monthOrganRenewMoney.getBuyNums());
+                practiceGroupsDto.setMonthRenewMoney(monthOrganRenewMoney.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();
@@ -433,6 +447,10 @@ public class StudentOrderController extends BaseController {
         Integer renewNum = 0;
         Integer overNum = 0;
         Integer reportNum = 0;
+        Integer monthBuyNums = 0;
+        Integer monthRenewNums = 0;
+        BigDecimal monthBuyMoney = BigDecimal.ZERO;
+        BigDecimal monthRenewMoney= BigDecimal.ZERO;
 
         Iterator<PracticeGroupsDto> iterator = practiceGroups.iterator();
         while (iterator.hasNext()) {
@@ -447,6 +465,10 @@ public class StudentOrderController extends BaseController {
             buyNum += next.getBuyNums();
             reportNum += next.getReportNums();
             renewNum += next.getRenewNums();
+            monthBuyNums += next.getMonthBuyNums();
+            monthRenewNums += next.getMonthRenewNums();
+            monthBuyMoney  = monthBuyMoney.add(next.getMonthBuyMoney());
+            monthRenewMoney = monthRenewMoney.add(next.getMonthRenewMoney());
         }
         practiceGroups = practiceGroups.stream().sorted(Comparator.comparingDouble(PracticeGroupsDto::getBuyScale).reversed()).collect(Collectors.toList());
 
@@ -458,6 +480,10 @@ public class StudentOrderController extends BaseController {
         practiceGroupStatisDto.setRenewNum(renewNum);
         practiceGroupStatisDto.setOverNum(overNum);
         practiceGroupStatisDto.setReportNum(reportNum);
+        practiceGroupStatisDto.setMonthBuyNums(monthBuyNums);
+        practiceGroupStatisDto.setMonthBuyMoney(monthBuyMoney);
+        practiceGroupStatisDto.setMonthRenewNums(monthRenewNums);
+        practiceGroupStatisDto.setMonthRenewMoney(monthRenewMoney);
 
         if(totalNum >0 ){
             BigDecimal scale = new BigDecimal(buyNum).multiply(new BigDecimal(100)).divide(new BigDecimal(totalNum), 2, BigDecimal.ROUND_HALF_UP);