瀏覽代碼

管乐迷需求迭代

zouxuan 2 年之前
父節點
當前提交
a29f7c8af8

+ 3 - 52
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/IndexBaseMonthDataDao.java

@@ -1,9 +1,6 @@
 package com.ym.mec.biz.dal.dao;
 
-import com.ym.mec.biz.dal.dto.CloudTeacherActiveTargetDto;
-import com.ym.mec.biz.dal.dto.OrganVipGroupCategoryCourseNumDto;
-import com.ym.mec.biz.dal.dto.StudentErrorLeaveDto;
-import com.ym.mec.biz.dal.dto.StudentLeaveCourseDto;
+import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.IndexBaseMonthData;
 import com.ym.mec.biz.dal.entity.IndexErrInfoDto;
 import com.ym.mec.biz.dal.enums.*;
@@ -353,22 +350,6 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
                                                             @Param("endDate") String endDate,
                                                             @Param("organIds") List<Integer> organIds,@Param("tenantId") Integer tenantId);
 
-    List<IndexBaseMonthData> getFinanceBalanceDataWithTimelyByCoop(@Param("startDate") String startDate,
-                                                                   @Param("endDate") String endDate,
-                                                                   @Param("organId") Integer organId);
-
-    List<IndexBaseMonthData> getOrganFinanceBalanceDataWithTimelyByCoop(@Param("startDate") String startDate,
-                                                                        @Param("endDate") String endDate,
-                                                                        @Param("organId") Integer organId);
-
-    List<IndexBaseMonthData> getFinanceActualDataWithTimelyByCoop(@Param("startDate") String startDate,
-                                                                  @Param("endDate") String endDate,
-                                                                  @Param("organId") Integer organId);
-
-    List<IndexBaseMonthData> getOrganFinanceActualDataWithTimelyByCoop(@Param("startDate") String startDate,
-                                                                       @Param("endDate") String endDate,
-                                                                       @Param("organId") Integer organId);
-
     /**
      * @describe 各分部教师服务指标异常
      * @author Joburgess
@@ -419,38 +400,6 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
                                                             @Param("classGroupIds") List<Long> classGroupIds,
                                                             @Param("tenantId") Integer tenantId);
 
-    List<IndexBaseMonthData> getTotalAmountDataWithTimelyByCoop(@Param("startDate") String startDate,
-                                                                @Param("endDate") String endDate,
-                                                                @Param("organId") Integer organId);
-    List<IndexBaseMonthData> getOrganTotalAmountDataWithTimelyByCoop(@Param("startDate") String startDate,
-                                                                     @Param("endDate") String endDate,
-                                                                     @Param("organId") Integer organId);
-
-    List<IndexBaseMonthData> getTotalAmountDataWithTimelyDetailsByCoop(@Param("startDate") String startDate,
-                                                                 @Param("endDate") String endDate,
-                                                                 @Param("organId") Integer organId,
-                                                                 @Param("orderType") String orderType,
-                                                                 @Param("notOrderType") List<String> notOrderType);
-    List<IndexBaseMonthData> getOrganTotalAmountDataWithTimelyDetailsByCoop(@Param("startDate") String startDate,
-                                                                 @Param("endDate") String endDate,
-                                                                 @Param("organId") Integer organId,
-                                                                 @Param("orderType") String orderType,
-                                                                 @Param("notOrderType") List<String> notOrderType);
-
-    List<IndexBaseMonthData> getVipAmountDataWithTimelyDetailsByCoop(@Param("startDate") String startDate,
-                                                                     @Param("endDate") String endDate,
-                                                                     @Param("organId") Integer organId);
-    List<IndexBaseMonthData> getOrganVipAmountDataWithTimelyDetailsByCoop(@Param("startDate") String startDate,
-                                                                          @Param("endDate") String endDate,
-                                                                          @Param("organId") Integer organId);
-
-    List<IndexBaseMonthData> getOtherAmountDataWithTimelyDetailsByCoop(@Param("startDate") String startDate,
-                                                                 @Param("endDate") String endDate,
-                                                                 @Param("organId") Integer organId);
-    List<IndexBaseMonthData> getOrganOtherAmountDataWithTimelyDetailsByCoop(@Param("startDate") String startDate,
-                                                                 @Param("endDate") String endDate,
-                                                                 @Param("organId") Integer organId);
-
     int countStudentErrorLeave1(Map<String, Object> params);
 
     List<StudentErrorLeaveDto> queryStudentErrorLeave(Map<String, Object> params);
@@ -496,4 +445,6 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
 
     //待续费学员提醒
     int getWaitRenewInfo(@Param("organIdList") Set<Integer> organIdList);
+
+    List<DecimalMapDto> indexCoop(@Param("organId") Integer organId, @Param("startTime") String startTime, @Param("endTime") String endTime);
 }

+ 25 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/DecimalMapDto.java

@@ -0,0 +1,25 @@
+package com.ym.mec.biz.dal.dto;
+
+import java.math.BigDecimal;
+
+public class DecimalMapDto {
+    private String name;
+
+    private BigDecimal amount = BigDecimal.ZERO;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+}

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/IndexBaseMonthDataService.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.service;
 
+import com.ym.mec.biz.dal.dto.DecimalMapDto;
 import com.ym.mec.biz.dal.dto.EduOrganStudentDataDto;
 import com.ym.mec.biz.dal.dto.IndexBaseDto;
 import com.ym.mec.biz.dal.dto.IndexErrorDataExportDto;
@@ -20,6 +21,8 @@ public interface IndexBaseMonthDataService extends BaseService<Long, IndexBaseMo
 
     List<IndexBaseDto> getIndexBaseData(IndexDataQueryInfo indexDataQueryInfo);
 
+    List<DecimalMapDto> indexCoop(Integer organId, String startTime, String endTime);
+
     void indexBaseDataTask(Integer tenantId, String month, Set<IndexDataType> dataTypes);
 
     Map<String, Object> getIndexErrData(String organId, IndexErrorType errorType);

+ 8 - 50
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -165,13 +165,8 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		//按分部汇总
 		if((CollectionUtils.isEmpty(dataTypes) || dataTypes.contains(ORGAN_FINANCE_BALANCE_AMOUNT.getCode()) ||
 				dataTypes.contains(ORGAN_FINANCE_AMOUNT.getCode())) && organIds != null){
-			if(StringUtils.equals(queryInfo.getSearchType(),"COOP")){
-				//经营数据查询
-				this.syncOperationCoop(startDate1,endDate1,Integer.parseInt(queryInfo.getOrganId()),result,typeDateMap);
-			}else {
-				//经营数据查询
-				this.syncOperation(startDate1,endDate1,arrayList,tenantId,result,typeDateMap);
-			}
+			//经营数据查询
+			this.syncOperation(startDate1,endDate1,arrayList,tenantId,result,typeDateMap);
 		}
 
 		if(CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(MUSIC_GROUP_COURSE.getCode())||dataTypes.contains(VIP_GROUP_COURSE.getCode())
@@ -363,7 +358,12 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		return result;
 	}
 
-	//异步处理经营数据查询
+    @Override
+    public List<DecimalMapDto> indexCoop(Integer organId,String startTime,String endTime) {
+        return indexBaseMonthDataDao.indexCoop(organId,startTime,endTime);
+    }
+
+    //异步处理经营数据查询
 	public void syncOperation(String startDate1,String endDate1,List<Integer> arrayList,Integer tenantId,List<IndexBaseDto> indexBaseDtoList,Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap){
 		CompletableFuture future1 = this.async(() -> {
 			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_RENEW_AMOUNT,indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,"RENEW",null,tenantId)));
@@ -404,48 +404,6 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		future5.join();future6.join();future7.join();future8.join();
 	}
 
-	//异步处理经营数据查询
-	public void syncOperationCoop(String startDate1,String endDate1,Integer organId,List<IndexBaseDto> indexBaseDtoList,Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap){
-//		CompletableFuture future1 = this.async(() -> {
-//			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_RENEW_AMOUNT,indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetailsByCoop(startDate1, endDate1, organId,"RENEW",null)));
-//			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_VIP_AMOUNT,indexBaseMonthDataDao.getOrganVipAmountDataWithTimelyDetailsByCoop(startDate1, endDate1, organId)));
-//		});
-//		CompletableFuture future2 = this.async(() -> {
-//			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_PRACTICE_AMOUNT,indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetailsByCoop(startDate1, endDate1, organId,"PRACTICE_GROUP_BUY,PRACTICE_GROUP_RENEW",null)));
-//			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_OTHER_AMOUNT,indexBaseMonthDataDao.getOrganOtherAmountDataWithTimelyDetailsByCoop(startDate1, endDate1, organId)));
-//		});
-//		CompletableFuture future3 = this.async(() -> {
-//			indexBaseDtoList.add(this.getIndexBaseDto(IndexDataType.ORGAN_TOTAL_AMOUNT,indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyByCoop(startDate1, endDate1, organId)));
-//			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_APPLY_AMOUNT,indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetailsByCoop(startDate1, endDate1, organId,"APPLY,ADD_STUDENT",null)));
-//		});
-//		CompletableFuture future4 = this.async(() -> {
-//			indexBaseDtoList.add(this.getIndexBaseDto(IndexDataType.ORGAN_FINANCE_BALANCE_AMOUNT,indexBaseMonthDataDao.getOrganFinanceBalanceDataWithTimelyByCoop(startDate1, endDate1, organId)));
-//			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_FINANCE_AMOUNT,indexBaseMonthDataDao.getOrganFinanceActualDataWithTimelyByCoop(startDate1, endDate1, organId)));
-//		});
-
-		CompletableFuture future5 = this.async(()->{
-			typeDateMap.put(IndexDataType.FINANCE_BALANCE_AMOUNT,indexBaseMonthDataDao.getFinanceBalanceDataWithTimelyByCoop(startDate1, endDate1, organId));
-			typeDateMap.put(FINANCE_AMOUNT,indexBaseMonthDataDao.getFinanceActualDataWithTimelyByCoop(startDate1, endDate1, organId));
-		});
-		CompletableFuture future6 = this.async(()->{
-			List<IndexBaseMonthData> renewAmount = indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetailsByCoop(startDate1, endDate1, organId,"RENEW",null);
-			typeDateMap.put(RENEW_AMOUNT,renewAmount);
-			List<IndexBaseMonthData> vipAmount = indexBaseMonthDataDao.getVipAmountDataWithTimelyDetailsByCoop(startDate1, endDate1, organId);
-			typeDateMap.put(VIP_AMOUNT,vipAmount);
-		});
-		CompletableFuture future7 = this.async(()->{
-			typeDateMap.put(IndexDataType.TOTAL_AMOUNT,indexBaseMonthDataDao.getTotalAmountDataWithTimelyByCoop(startDate1, endDate1, organId));
-			typeDateMap.put(APPLY_AMOUNT,indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetailsByCoop(startDate1, endDate1, organId,"APPLY,ADD_STUDENT",null));
-		});
-		CompletableFuture future8 = this.async(()->{
-			typeDateMap.put(PRACTICE_AMOUNT,indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetailsByCoop(startDate1, endDate1, organId,"PRACTICE_GROUP_BUY,PRACTICE_GROUP_RENEW",null));
-			typeDateMap.put(OTHER_AMOUNT,indexBaseMonthDataDao.getOtherAmountDataWithTimelyDetailsByCoop(startDate1, endDate1, organId));
-		});
-//		future1.join();future2.join();future3.join();future4.join();
-		future5.join();future6.join();future7.join();future8.join();
-	}
-
-
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public void indexBaseDataTask(Integer tenantId, String dayStr, Set<IndexDataType> dataTypes) {

+ 12 - 225
mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml

@@ -1694,231 +1694,6 @@
 		GROUP BY o.id_ ORDER BY percent_ DESC
 	</select>
 
-	<select id="getFinancePayDataWithTimelyByCoop"  resultMap="IndexBaseMonthData">
-		SELECT SUM(fe.amount_) total_num_,SUM(fe.amount_) activate_num_,SUM(fe.amount_) percent_,cop.organ_id_,DATE_FORMAT(fe.create_time_,'%Y-%m-%d') month_
-		FROM financial_expenditure fe
-				 left join (select sr.user_id_,mg.cooperation_organ_id_ organ_id_,co.name_ organ_name_ from
-			(select * from student_registration where id_ IN (select MAX(id_) from student_registration group by user_id_)) sr
-				left join music_group mg ON mg.id_ = sr.music_group_id_
-				left join cooperation_organ co ON co.id_ = mg.cooperation_organ_id_
-							where mg.organ_id_ = #{organId} group by sr.user_id_,mg.cooperation_organ_id_) cop ON cop.user_id_ = fe.apply_user_id_
-		WHERE DATE_FORMAT(fe.create_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
-		  AND del_flag_ = 0 AND fe.apply_user_id_ = cop.user_id_
-		GROUP BY DATE_FORMAT(fe.create_time_,'%Y-%m-%d')
-	</select>
-
-	<select id="getOrganFinancePayDataWithTimelyByCoop"  resultMap="IndexBaseMonthData">
-		SELECT SUM(fe.amount_) percent_,cop.organ_id_,cop.organ_name_
-		FROM financial_expenditure fe
-		left join (select sr.user_id_,mg.cooperation_organ_id_ organ_id_,co.name_ organ_name_ from
-		(select * from student_registration where id_ IN (select MAX(id_) from student_registration group by user_id_)) sr
-		left join music_group mg ON mg.id_ = sr.music_group_id_
-		left join cooperation_organ co ON co.id_ = mg.cooperation_organ_id_
-		where mg.organ_id_ = #{organId} group by sr.user_id_,mg.cooperation_organ_id_) cop ON cop.user_id_ = fe.apply_user_id_
-		WHERE DATE_FORMAT(fe.create_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate} AND fe.del_flag_ = 0
-		AND fe.apply_user_id_ = cop.user_id_
-		GROUP BY cop.organ_id_ ORDER BY percent_ DESC
-	</select>
-
-	<select id="getFinanceBalanceDataWithTimelyByCoop" resultMap="IndexBaseMonthData">
-		SELECT cop.organ_id_,SUM(CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) total_num_,
-			   SUM(CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) activate_num_,
-			   SUM(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_
-		FROM student_payment_order spo
-		<include refid="cooperationSql"/>
-		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
-		AND cop.user_id_ = spo.user_id_
-		GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
-	</select>
-
-	<select id="getOrganFinanceBalanceDataWithTimelyByCoop" resultMap="IndexBaseMonthData">
-		SELECT SUM(CASE WHEN spo.balance_payment_amount_ IS NULL THEN 0 ELSE spo.balance_payment_amount_ END) percent_,
-		cop.organ_id_,cop.organ_name_
-		FROM student_payment_order spo
-		<include refid="cooperationSql"/>
-		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
-		AND cop.user_id_ = spo.user_id_
-		GROUP BY cop.organ_id_ ORDER BY percent_ DESC
-	</select>
-
-	<select id="getFinanceActualDataWithTimelyByCoop" resultMap="IndexBaseMonthData">
-		SELECT cop.organ_id_,SUM(spo.actual_amount_) total_num_,
-			   SUM(spo.actual_amount_) activate_num_,
-			   SUM(spo.actual_amount_) percent_,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_
-		FROM student_payment_order spo
-		<include refid="cooperationSql"/>
-		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
-		AND cop.user_id_ = spo.user_id_
-		GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
-	</select>
-
-	<select id="getOrganFinanceActualDataWithTimelyByCoop" resultMap="IndexBaseMonthData">
-		SELECT SUM(spo.actual_amount_) percent_,cop.organ_id_,cop.organ_name_
-		FROM student_payment_order spo
-		<include refid="cooperationSql"/>
-		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
-		AND cop.user_id_ = spo.user_id_
-		GROUP BY cop.organ_id_ ORDER BY percent_ DESC
-	</select>
-
-	<sql id="cooperationSql">
-		left join (select sr.user_id_,mg.cooperation_organ_id_ organ_id_,co.name_ organ_name_ from
-		(select * from student_registration where id_ IN (select MAX(id_) from student_registration group by user_id_)) sr
-		left join music_group mg ON mg.id_ = sr.music_group_id_
-		left join cooperation_organ co ON co.id_ = mg.cooperation_organ_id_
-		 where mg.organ_id_ = #{organId} group by sr.user_id_,mg.cooperation_organ_id_) cop ON cop.user_id_ = spo.user_id_
-	</sql>
-
-	<select id="getTotalAmountDataWithTimelyByCoop" resultMap="IndexBaseMonthData">
-		SELECT cop.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_
-		FROM student_payment_order spo
-		<include refid="cooperationSql"/>
-		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
-		  AND cop.user_id_ = spo.user_id_
-		GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
-	</select>
-
-	<select id="getOrganTotalAmountDataWithTimelyByCoop" resultMap="IndexBaseMonthData">
-		SELECT 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_,
-		cop.organ_id_,cop.organ_name_
-		FROM student_payment_order spo
-		<include refid="cooperationSql"/>
-		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
-		GROUP BY cop.organ_id_ ORDER BY percent_ DESC
-	</select>
-
-	<select id="getTotalAmountDataWithTimelyDetailsByCoop" 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_
-		FROM student_payment_order spo
-		<include refid="cooperationSql"/>
-		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>
-		GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
-	</select>
-
-	<select id="getOrganTotalAmountDataWithTimelyDetailsByCoop" resultMap="IndexBaseMonthData">
-		SELECT 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_,
-		cop.organ_id_,cop.organ_name_
-		FROM student_payment_order spo
-		<include refid="cooperationSql"/>
-		AND 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>
-		GROUP BY cop.organ_id_ ORDER BY percent_ DESC
-	</select>
-
-	<select id="getVipAmountDataWithTimelyDetailsByCoop" resultMap="IndexBaseMonthData">
-		SELECT c.organ_id_,SUM(c.total_num_) total_num_,SUM(c.total_num_) activate_num_,SUM(c.total_num_) percent_,month_ FROM (
-		SELECT cop.organ_id_,SUM(CASE WHEN spod.price_ IS NULL THEN 0 ELSE spod.price_ END) total_num_,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_
-		FROM student_payment_order spo
-		<include refid="cooperationSql"/>
-		LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
-		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
-		AND spo.type_ = 'DEGREE' AND spod.type_ IN ('THEORY_COURSE','VIP')
-		GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
-		UNION ALL
-		SELECT cop.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_
-		,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_
-		FROM student_payment_order spo
-		<include refid="cooperationSql"/>
-		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
-		AND spo.type_ = 'SMALL_CLASS_TO_BUY'
-		GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
-		)c GROUP BY DATE_FORMAT(c.month_,'%Y-%m-%d')
-	</select>
-
-	<select id="getOrganVipAmountDataWithTimelyDetailsByCoop" resultMap="IndexBaseMonthData">
-		SELECT c.organ_id_,c.organ_name_,SUM(c.total_num_) percent_ FROM
-		(SELECT cop.organ_id_,cop.organ_name_,SUM(CASE WHEN spod.price_ IS NULL THEN 0 ELSE spod.price_ END) total_num_
-		FROM student_payment_order spo
-		<include refid="cooperationSql"/>
-		LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
-		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
-		AND spo.type_ = 'DEGREE' AND spod.type_ IN ('THEORY_COURSE','VIP')
-		GROUP BY cop.organ_id_
-		UNION ALL
-		SELECT cop.organ_id_,cop.organ_name_,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_
-		FROM student_payment_order spo
-		<include refid="cooperationSql"/>
-		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
-		AND spo.type_ = 'SMALL_CLASS_TO_BUY'
-		GROUP BY cop.organ_id_
-		)c
-		GROUP BY c.organ_id_ ORDER BY percent_ DESC
-	</select>
-
-	<select id="getOtherAmountDataWithTimelyDetailsByCoop" resultMap="IndexBaseMonthData">
-		SELECT c.organ_id_,SUM(c.total_num_) total_num_,SUM(c.total_num_) activate_num_,SUM(c.total_num_) percent_,month_,c.type_ order_type_ FROM (
-		SELECT cop.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_
-		   ,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_,spo.type_
-		FROM student_payment_order spo
-		<include refid="cooperationSql"/>
-		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
-		AND spo.type_ NOT IN ('APPLY','RENEW','PRACTICE_GROUP_BUY','PRACTICE_GROUP_RENEW','SMALL_CLASS_TO_BUY','DEGREE')
-		GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d'),spo.type_
-		UNION ALL
-		SELECT cop.organ_id_,SUM(CASE WHEN spod.price_ IS NULL THEN 0 ELSE spod.price_ END) total_num_,DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') month_,spo.type_
-		FROM student_payment_order spo
-		<include refid="cooperationSql"/>
-		LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
-		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
-		AND spo.type_ = 'DEGREE' AND spod.type_ = 'DEGREE_REGISTRATION'
-		GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d'),spo.type_
-		)c GROUP BY DATE_FORMAT(c.month_,'%Y-%m-%d'),c.type_
-	</select>
-
-	<select id="getOrganOtherAmountDataWithTimelyDetailsByCoop" resultMap="IndexBaseMonthData">
-		SELECT c.organ_id_,c.organ_name_,SUM(c.total_num_) percent_ FROM
-		(
-		SELECT cop.organ_id_,cop.organ_name_,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_,spo.type_
-		FROM student_payment_order spo
-		<include refid="cooperationSql"/>
-		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
-		AND spo.type_ NOT IN ('APPLY','RENEW','PRACTICE_GROUP_BUY','PRACTICE_GROUP_RENEW','SMALL_CLASS_TO_BUY','DEGREE')
-		GROUP BY cop.organ_id_,spo.type_
-		UNION ALL
-		SELECT cop.organ_id_,cop.organ_name_,SUM(CASE WHEN spod.price_ IS NULL THEN 0 ELSE spod.price_ END) total_num_,spo.type_
-		FROM student_payment_order spo
-		<include refid="cooperationSql"/>
-		LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
-		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
-		AND spo.type_ = 'DEGREE' AND spod.type_ = 'DEGREE_REGISTRATION'
-		GROUP BY cop.organ_id_,spo.type_
-		)c
-		GROUP BY c.organ_id_ ORDER BY percent_ DESC
-	</select>
-
 	<sql id="queryTeacherServeInfoCondition">
 		<where>
 			 sees.tenant_id_ = #{tenantId}
@@ -2404,4 +2179,16 @@
 			</foreach>
 		</if>
 	</select>
+	<select id="indexCoop" resultType="com.ym.mec.biz.dal.dto.DecimalMapDto">
+		SELECT cop.organ_name_ name,SUM(spo.expect_amount_) amount
+		FROM student_payment_order spo
+				 left join (select sr.user_id_,mg.cooperation_organ_id_ organ_id_,co.name_ organ_name_ from
+			(select * from student_registration where id_ IN (select MAX(id_) from student_registration group by user_id_)) sr
+				left join music_group mg ON mg.id_ = sr.music_group_id_
+				left join cooperation_organ co ON co.id_ = mg.cooperation_organ_id_
+							where mg.organ_id_ = #{organId} group by sr.user_id_,mg.cooperation_organ_id_) cop ON cop.user_id_ = spo.user_id_
+		WHERE spo.status_ = 'SUCCESS' AND DATE_FORMAT(spo.pay_time_,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
+		  AND cop.user_id_ = spo.user_id_
+		GROUP BY cop.organ_id_ order by amount DESC
+	</select>
 </mapper>

+ 5 - 7
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -1206,16 +1206,14 @@
         group by su.organ_id_
     </select>
     <select id="countCloudTeacherSumDetail" resultType="java.lang.Integer">
-        select COUNT(distinct stm.teacher_id_)
+        select COUNT(DISTINCT stm.teacher_id_)
         from student_teacher_mapper stm
         left join (select distinct sr.user_id_ from music_group mg
         left join student_registration sr ON mg.id_ = sr.music_group_id_
         where mg.status_ IN ('PROGRESS','PAUSE') AND sr.music_group_status_ = 'NORMAL') mg ON mg.user_id_ = stm.student_id_
         left join student s ON mg.user_id_ = s.user_id_
-        where s.membership_end_time_ >= NOW() AND stm.teacher_type_ = 'NORMAL'
-        <if test="queryInfo.organId != null and queryInfo.organId != ''">
-            AND FIND_IN_SET(su.organ_id_,#{queryInfo.organId})
-        </if>
+        left JOIN teacher t ON t.id_ = stm.teacher_id_
+        where s.membership_end_time_ >= NOW() AND stm.teacher_type_ = 'NORMAL' AND t.organ_id_ = #{organId}
     </select>
     <select id="queryCloudTeacherSumDetail" resultMap="CloudTeacherSumDto">
         select su.real_name_ teacher_name_,COUNT(distinct s.user_id_) normal_num_,COUNT(distinct smcr.user_id_) train_student_num_,
@@ -1229,9 +1227,9 @@
         left join student_registration sr ON mg.id_ = sr.music_group_id_
         where mg.status_ IN ('PROGRESS','PAUSE') AND sr.music_group_status_ = 'NORMAL') mg ON mg.user_id_ = stm.student_id_
         left join student s ON mg.user_id_ = s.user_id_
-        left join (select smcr.user_id_,ROUND(SUM(smcr.train_time_)/60/#{queryInfo.weekBetween}) train_time_ from sys_music_compare_week_data smcr
+        left join (select smcr.user_id_,ROUND(SUM(smcr.train_time_)/60/#{weekBetween}) train_time_ from sys_music_compare_week_data smcr
         where monday_ IN
-        <foreach collection="queryInfo.mondays" separator="," open="(" close=")" item="monday">
+        <foreach collection="mondays" separator="," open="(" close=")" item="monday">
             #{monday}
         </foreach>
         group by smcr.user_id_) smcr ON s.user_id_ = smcr.user_id_

+ 5 - 0
mec-web/src/main/java/com/ym/mec/web/controller/IndexController.java

@@ -3,6 +3,7 @@ package com.ym.mec.web.controller;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dto.DecimalMapDto;
 import com.ym.mec.biz.dal.dto.EduOrganStudentDataDto;
 import com.ym.mec.biz.dal.enums.IndexErrorType;
 import com.ym.mec.biz.dal.page.IndexDataQueryInfo;
@@ -109,6 +110,10 @@ public class IndexController extends BaseController {
 		queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
 		return succeed(indexService.getIndexBaseData(queryInfo));
 	}
+	@GetMapping("/indexCoop")
+	public HttpResponseResult<List<DecimalMapDto>> indexCoop(Integer organId, String startTime, String endTime){
+		return succeed(indexService.indexCoop(organId,startTime,endTime));
+	}
 
 	@GetMapping("/hasIndexErrData")
 	public HttpResponseResult hasIndexErrData(String organId){