Browse Source

add 福袋活动统计

周箭河 5 years ago
parent
commit
2013351aca

+ 9 - 4
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDao.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.dao;
 
+import com.ym.mec.biz.dal.dto.OrderStatisDto;
 import com.ym.mec.biz.dal.dto.SporadicChargeInfoDto;
 import com.ym.mec.biz.dal.dto.StudentPaymentOrderExportDto;
 import com.ym.mec.biz.dal.dto.UserGoodsDto;
@@ -28,8 +29,8 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
      */
     List<Goods> queryApplyGoodsList(@Param("musicGroupId") String musicGroupId, @Param("type") OrderDetailTypeEnum type);
 
-	List<StudentPaymentOrder> queryByCondition(@Param("groupType") GroupType groupType, @Param("musicGroupId") String musicGroupId,
-			@Param("userId") Integer userId, @Param("status") DealStatusEnum status, @Param("type") OrderTypeEnum type);
+    List<StudentPaymentOrder> queryByCondition(@Param("groupType") GroupType groupType, @Param("musicGroupId") String musicGroupId,
+                                               @Param("userId") Integer userId, @Param("status") DealStatusEnum status, @Param("type") OrderTypeEnum type);
 
     /**
      * @Author: Joburgess
@@ -57,7 +58,7 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
      * 根据学生vip课获取非失败缴费订单
      */
     List<StudentPaymentOrder> findNotFailedOrderByStudentVipGroup(@Param("vipGroupId") Long vipGroupId,
-                                                            @Param("userId") Integer userId);
+                                                                  @Param("userId") Integer userId);
 
     /**
      * @param musicGroupId: 乐团编号/vip课编号
@@ -188,15 +189,19 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
 
     /**
      * 获取零星收费订单列表
+     *
      * @param queryInfo
      * @return
      */
-    List<SporadicChargeInfoDto> sporadicQueryPage( Map<String, Object> queryInfo);
+    List<SporadicChargeInfoDto> sporadicQueryPage(Map<String, Object> queryInfo);
 
     /**
      * COUNT零星收费订单列表
+     *
      * @param params
      * @return
      */
     int countSporadicPage(Map<String, Object> params);
+
+    List<OrderStatisDto> getLuckStatis();
 }

+ 34 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/LuckStatisDto.java

@@ -0,0 +1,34 @@
+package com.ym.mec.biz.dal.dto;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+public class LuckStatisDto {
+    private List<OrderStatisDto> orderStatisDtoList;
+    private Integer totalNum;
+    private BigDecimal totalMoney;
+
+    public List<OrderStatisDto> getOrderStatisDtoList() {
+        return orderStatisDtoList;
+    }
+
+    public void setOrderStatisDtoList(List<OrderStatisDto> orderStatisDtoList) {
+        this.orderStatisDtoList = orderStatisDtoList;
+    }
+
+    public Integer getTotalNum() {
+        return totalNum;
+    }
+
+    public void setTotalNum(Integer totalNum) {
+        this.totalNum = totalNum;
+    }
+
+    public BigDecimal getTotalMoney() {
+        return totalMoney;
+    }
+
+    public void setTotalMoney(BigDecimal totalMoney) {
+        this.totalMoney = totalMoney;
+    }
+}

+ 33 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/OrderStatisDto.java

@@ -0,0 +1,33 @@
+package com.ym.mec.biz.dal.dto;
+
+import java.math.BigDecimal;
+
+public class OrderStatisDto {
+    private String organName;
+    private Integer nums;
+    private BigDecimal money;
+
+    public String getOrganName() {
+        return organName;
+    }
+
+    public void setOrganName(String organName) {
+        this.organName = organName;
+    }
+
+    public Integer getNums() {
+        return nums;
+    }
+
+    public void setNums(Integer nums) {
+        this.nums = nums;
+    }
+
+    public BigDecimal getMoney() {
+        return money;
+    }
+
+    public void setMoney(BigDecimal money) {
+        this.money = money;
+    }
+}

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

@@ -489,4 +489,14 @@
             AND spo.status_ = #{payStatus}
         </if>
     </sql>
+
+    <resultMap id="luckStatis" type="com.ym.mec.biz.dal.dto.OrderStatisDto">
+        <result property="organName" column="organName"/>
+        <result property="nums" column="nums"/>
+        <result property="money" column="money"/>
+    </resultMap>
+    <select id="getLuckStatis" resultMap="luckStatis">
+        SELECT o.name_ organName, SUM(spo.actual_amount_) money ,COUNT(spo.id_) nums FROM student_payment_order spo LEFT JOIN organization o ON o.id_=spo.organ_id_
+        WHERE spo.type_='LUCK' AND spo.status_='SUCCESS' GROUP BY spo.organ_id_
+    </select>
 </mapper>

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

@@ -1,6 +1,8 @@
 package com.ym.mec.student.controller;
 
 import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.dto.LuckStatisDto;
+import com.ym.mec.biz.dal.dto.OrderStatisDto;
 import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
 import com.ym.mec.biz.service.*;
 import io.swagger.annotations.Api;
@@ -291,4 +293,20 @@ public class StudentOrderController extends BaseController {
             e.printStackTrace();
         }
     }
+
+    @GetMapping("/getLuckStatis")
+    public LuckStatisDto getLuckStatis(){
+        List<OrderStatisDto> orders = studentPaymentOrderDao.getLuckStatis();
+        BigDecimal totalMoney = BigDecimal.ZERO;
+        Integer totalNum = 0;
+        for (OrderStatisDto order : orders) {
+            totalMoney = totalMoney.add(order.getMoney());
+            totalNum += order.getNums();
+        }
+        LuckStatisDto luckStatisDto = new LuckStatisDto();
+        luckStatisDto.setOrderStatisDtoList(orders);
+        luckStatisDto.setTotalNum(totalNum);
+        luckStatisDto.setTotalMoney(totalMoney);
+        return  luckStatisDto;
+    }
 }