浏览代码

系统收费首页经营报表

zouxuan 4 年之前
父节点
当前提交
56e5ed0502

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -1870,7 +1870,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @param classGroupIds
      * @return
      */
-    int queryPreCourseListByClassGroupIds(List<Integer> classGroupIds);
+    int queryPreCourseListByClassGroupIds(@Param("classGroupIds") List<Integer> classGroupIds);
 
     /**
      * 获取预排课程列表

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/IndexBaseMonthDataDao.java

@@ -289,6 +289,12 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
                                                             @Param("endDate") String endDate,
                                                             @Param("organIds") List<Integer> organIds);
 
+    List<IndexBaseMonthData> getTotalAmountDataWithTimelyDetails(@Param("startDate") String startDate,
+                                                                 @Param("endDate") String endDate,
+                                                                 @Param("organIds") List<Integer> organIds,
+                                                                 @Param("orderType") String orderType,
+                                                                 @Param("notOrderType") List<String> notOrderType);
+
     int countStudentErrorLeave(@Param("organIdList") Set<Integer> organIdList, @Param("format") String format, @Param("classGroupIds") List<Long> classGroupIds);
 
     int countStudentErrorLeave1(Map<String, Object> params);

+ 22 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/IndexBaseMonthData.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.entity;
 
 import com.ym.mec.biz.dal.enums.IndexDataType;
+import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -16,6 +17,9 @@ public class IndexBaseMonthData {
 	/**  */
 	private java.util.Date month;
 
+	/**  */
+	private String monthStr;
+
 	private String title;
 	
 	/** 分部编号 */
@@ -32,12 +36,30 @@ public class IndexBaseMonthData {
 
 	private IndexDataType dataType;
 
+	private OrderTypeEnum orderType;
+
 	private String extendInfo;
 
 	private Date createTime;
 
 	private Date updateTime;
 
+	public String getMonthStr() {
+		return monthStr;
+	}
+
+	public void setMonthStr(String monthStr) {
+		this.monthStr = monthStr;
+	}
+
+	public OrderTypeEnum getOrderType() {
+		return orderType;
+	}
+
+	public void setOrderType(OrderTypeEnum orderType) {
+		this.orderType = orderType;
+	}
+
 	public IndexBaseMonthData() {
 	}
 

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/IndexDataType.java

@@ -43,6 +43,13 @@ public enum IndexDataType implements BaseEnum<String, IndexDataType> {
     FINANCE_AMOUNT("FINANCE_AMOUNT","现金收入", false, false),
     TOTAL_AMOUNT("TOTAL_AMOUNT","总收入", false, false),
 
+    //经营数据详情
+    APPLY_AMOUNT("APPLY_AMOUNT","报名缴费收入", false, false),
+    RENEW_AMOUNT("RENEW_AMOUNT","乐团续费收入", false, false),
+    VIP_AMOUNT("VIP_AMOUNT","VIP课收入", false, false),
+    PRACTICE_AMOUNT("PRACTICE_AMOUNT","网管课收入", false, false),
+    OTHER_AMOUNT("OTHER_AMOUNT","其他收入", false, false),
+
     //业务数据
     HOMEWORK_CREATE_RATE("HOMEWORK_CREATE_RATE","作业布置率", true, true),
     HOMEWORK_SUBMIT_RATE("HOMEWORK_SUBMIT_RATE","作业提交率", true, true),

+ 18 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -150,8 +150,25 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			typeDateMap.put(IndexDataType.FINANCE_BALANCE_AMOUNT,indexBaseMonthDataDao.getFinanceBalanceDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds)));
 			typeDateMap.put(FINANCE_AMOUNT,indexBaseMonthDataDao.getFinanceActualDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds)));
 			List<IndexBaseMonthData> totalAmountDataWithTimely = indexBaseMonthDataDao.getTotalAmountDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds));
-
 			typeDateMap.put(IndexDataType.TOTAL_AMOUNT,totalAmountDataWithTimely);
+			//经营报表细化
+			List<String> orderTypeList = new ArrayList<>();
+			orderTypeList.add("APPLY");
+			orderTypeList.add("RENEW");
+			orderTypeList.add("SMALL_CLASS_TO_BUY");
+			orderTypeList.add("DOUBLE_ELEVEN2020");
+			orderTypeList.add("PRACTICE_GROUP_BUY");
+			orderTypeList.add("PRACTICE_GROUP_RENEW");
+			List<IndexBaseMonthData> applyAmount = indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),"APPLY",null);
+			typeDateMap.put(APPLY_AMOUNT,applyAmount);
+			List<IndexBaseMonthData> renewAmount = indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),"RENEW",null);
+			typeDateMap.put(RENEW_AMOUNT,renewAmount);
+			List<IndexBaseMonthData> vipAmount = indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),"SMALL_CLASS_TO_BUY,DOUBLE_ELEVEN2020",null);
+			typeDateMap.put(VIP_AMOUNT,vipAmount);
+			List<IndexBaseMonthData> practiceAmount = indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),"PRACTICE_GROUP_BUY,PRACTICE_GROUP_RENEW",null);
+			typeDateMap.put(PRACTICE_AMOUNT,practiceAmount);
+			List<IndexBaseMonthData> otherAmount = indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),null,orderTypeList);
+			typeDateMap.put(OTHER_AMOUNT,otherAmount);
 		}
 
 

+ 28 - 0
mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml

@@ -9,11 +9,13 @@
 	<resultMap type="com.ym.mec.biz.dal.entity.IndexBaseMonthData" id="IndexBaseMonthData">
 		<result column="id_" property="id" />
 		<result column="month_" property="month" />
+		<result column="month_" property="monthStr" />
 		<result column="organ_id_" property="organId" />
 		<result column="total_num_" property="totalNum" />
 		<result column="activate_num_" property="activateNum" />
 		<result column="percent_" property="percent" />
 		<result column="data_type_" property="dataType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+		<result column="type_" property="orderType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 		<result column="extend_info_" property="extendInfo"/>
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
@@ -1329,6 +1331,32 @@
 		</if>
 		GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
 	</select>
+	<select id="getTotalAmountDataWithTimelyDetails" resultMap="IndexBaseMonthData">
+		SELECT spo.organ_id_,SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
+		                         CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) total_num_,
+			   SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
+		CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) activate_num_,
+			   SUM(CASE WHEN spo.actual_amount_ IS NULL THEN 0 ELSE spo.actual_amount_ END +
+		CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) percent_,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_,spo.type_
+		FROM student_payment_order spo
+		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
+		<if test="orderType != null">
+			AND FIND_IN_SET(spo.type_,#{orderType})
+		</if>
+		<if test="notOrderType != null">
+			AND spo.type_ NOT IN
+			<foreach collection="notOrderType" open="(" close=")" item="item" separator=",">
+				#{item}
+			</foreach>
+		</if>
+		<if test="organIds!=null and organIds.size()>0">
+			AND spo.organ_id_ IN
+			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+				#{organId}
+			</foreach>
+		</if>
+		GROUP BY spo.type_,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
+	</select>
 
 	<sql id="queryTeacherServeInfoCondition">
 		<where>