Ver código fonte

Merge remote-tracking branch 'origin/master'

zouxuan 4 anos atrás
pai
commit
e141e9d831

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

@@ -104,6 +104,8 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
     int countLessThenThreeClassGroupNum(@Param("organIds") Set<Integer> organIds);
     List<String> getLessThenThreeMusicGroup(@Param("organIds") Set<Integer> organIds);
 
-    int countNoPaymentStudentnum(@Param("organIds") Set<Integer> organIds);
+    int countNoPaymentStudentNum(@Param("organIds") Set<Integer> organIds);
     List<String> getNoPaymentMusicGroup(@Param("organIds") Set<Integer> organIds);
+
+    int countApplyForQuitGroupNum(@Param("organIds") Set<Integer> organIds);
 }

+ 21 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -138,7 +138,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		//运营数据
 		saveData(indexBaseMonthDataDao.getSchoolData(month), month, IndexDataType.SCHOOL);
 		saveData(indexBaseMonthDataDao.getMusicData(month), month, IndexDataType.MUSIC_GROUP_NUM);
-		saveData(indexBaseMonthDataDao.getMusicStudentData(month, null), month, IndexDataType.MUSIC_GROUP_STUDENT);
+		saveData(indexBaseMonthDataDao.getMusicStudentData(month, "ALL"), month, IndexDataType.MUSIC_GROUP_STUDENT);
 		saveData(indexBaseMonthDataDao.getOtherStudentData(month), month, IndexDataType.OTHER_STUDENT);
 
 		//业务数据
@@ -161,7 +161,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		saveData(indexBaseMonthDataDao.getTeacherData(month, null, true), month, IndexDataType.DIMISSION_NUM);
 
 		//学员变动
-		saveData(indexBaseMonthDataDao.getMusicStudentData(month, "ALL"), month, IndexDataType.NEWLY_STUDENT_NUM);
+		saveData(indexBaseMonthDataDao.getMusicStudentData(month, null), month, IndexDataType.NEWLY_STUDENT_NUM);
 		saveData(indexBaseMonthDataDao.getMusicStudentData(month, "QUIT"), month, IndexDataType.QUIT_MUSIC_GROUP_STUDENT_NUM);
 		saveData(indexBaseMonthDataDao.getMusicGroupPreRegistrationStudentData(month), month, IndexDataType.STUDENT_CONVERSION_PRE_STUDENT_NUM);
 		saveData(indexBaseMonthDataDao.getMusicGroupStudentFromPreData(month, null), month, IndexDataType.STUDENT_CONVERSION_STUDENT_NUM);
@@ -185,7 +185,10 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		List<IndexBaseMonthData> convertData = new ArrayList<>();
 
 		Map<IndexDataType, IndexBaseDto> typeDataMap = result.stream().collect(Collectors.toMap(IndexBaseDto::getDataType, i -> i, (i1, i2) -> i1));
-		List<IndexBaseMonthData> preStudentNum = typeDataMap.get(IndexDataType.STUDENT_CONVERSION_PRE_STUDENT_NUM).getIndexMonthData();
+		List<IndexBaseMonthData> preStudentNum = new ArrayList<>();
+		if(typeDataMap.containsKey(IndexDataType.STUDENT_CONVERSION_PRE_STUDENT_NUM)){
+			preStudentNum = typeDataMap.get(IndexDataType.STUDENT_CONVERSION_PRE_STUDENT_NUM).getIndexMonthData();
+		}
 
 		IndexBaseMonthData preStudentNumData = new IndexBaseMonthData();
 		preStudentNumData.setMonth(currentMonth);
@@ -195,7 +198,10 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		preStudentNumData.setActivateNum(preStudentNum.stream().map(IndexBaseMonthData::getActivateNum).reduce(BigDecimal.ZERO, BigDecimal::add));
 		preStudentNumData.setPercent(preStudentNumData.getActivateNum());
 
-		List<IndexBaseMonthData> studentNum = typeDataMap.get(IndexDataType.STUDENT_CONVERSION_STUDENT_NUM).getIndexMonthData();
+		List<IndexBaseMonthData> studentNum = new ArrayList<>();
+		if(typeDataMap.containsKey(IndexDataType.STUDENT_CONVERSION_STUDENT_NUM)){
+			studentNum = typeDataMap.get(IndexDataType.STUDENT_CONVERSION_STUDENT_NUM).getIndexMonthData();
+		}
 
 		IndexBaseMonthData studentNumData = new IndexBaseMonthData();
 		studentNumData.setMonth(currentMonth);
@@ -204,7 +210,10 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		studentNumData.setTotalNum(studentNum.stream().map(IndexBaseMonthData::getTotalNum).reduce(BigDecimal.ZERO, BigDecimal::add));
 		studentNumData.setActivateNum(studentNum.stream().map(IndexBaseMonthData::getActivateNum).reduce(BigDecimal.ZERO, BigDecimal::add));
 
-		List<IndexBaseMonthData> paymentStudentNum = typeDataMap.get(IndexDataType.STUDENT_CONVERSION_PAYMENT_STUDENT_NUM).getIndexMonthData();
+		List<IndexBaseMonthData> paymentStudentNum = new ArrayList<>();
+		if(typeDataMap.containsKey(IndexDataType.STUDENT_CONVERSION_PAYMENT_STUDENT_NUM)){
+			paymentStudentNum = typeDataMap.get(IndexDataType.STUDENT_CONVERSION_PAYMENT_STUDENT_NUM).getIndexMonthData();
+		}
 
 		IndexBaseMonthData paymentStudentNumData = new IndexBaseMonthData();
 		paymentStudentNumData.setMonth(currentMonth);
@@ -213,7 +222,10 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		paymentStudentNumData.setTotalNum(paymentStudentNum.stream().map(IndexBaseMonthData::getTotalNum).reduce(BigDecimal.ZERO, BigDecimal::add));
 		paymentStudentNumData.setActivateNum(paymentStudentNum.stream().map(IndexBaseMonthData::getActivateNum).reduce(BigDecimal.ZERO, BigDecimal::add));
 
-		List<IndexBaseMonthData> convertStudentNum = typeDataMap.get(IndexDataType.STUDENT_CONVERSION_VIP_PRACTICE_STUDENT_NUM).getIndexMonthData();
+		List<IndexBaseMonthData> convertStudentNum = new ArrayList<>();
+		if(typeDataMap.containsKey(IndexDataType.STUDENT_CONVERSION_VIP_PRACTICE_STUDENT_NUM)){
+			convertStudentNum = typeDataMap.get(IndexDataType.STUDENT_CONVERSION_VIP_PRACTICE_STUDENT_NUM).getIndexMonthData();
+		}
 
 		IndexBaseMonthData convertStudentNumData = new IndexBaseMonthData();
 		convertStudentNumData.setMonth(currentMonth);
@@ -289,7 +301,9 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 
 		result.add(new IndexErrInfoDto(IndexErrorType.HIGH_CLASS_STUDENT_LESS_THAN_THREE, IndexErrorType.HIGH_CLASS_STUDENT_LESS_THAN_THREE.getMsg(), indexBaseMonthDataDao.countLessThenThreeClassGroupNum(organIds), indexBaseMonthDataDao.getLessThenThreeMusicGroup(organIds)));
 
-		result.add(new IndexErrInfoDto(IndexErrorType.STUDENT_NOT_PAYMENT, IndexErrorType.STUDENT_NOT_PAYMENT.getMsg(), indexBaseMonthDataDao.countNoPaymentStudentnum(organIds), indexBaseMonthDataDao.getNoPaymentMusicGroup(organIds)));
+		result.add(new IndexErrInfoDto(IndexErrorType.STUDENT_NOT_PAYMENT, IndexErrorType.STUDENT_NOT_PAYMENT.getMsg(), indexBaseMonthDataDao.countNoPaymentStudentNum(organIds), indexBaseMonthDataDao.getNoPaymentMusicGroup(organIds)));
+
+		result.add(new IndexErrInfoDto(IndexErrorType.STUDENT_APPLY_FOR_QUIT_MUSIC_GROUP, IndexErrorType.STUDENT_APPLY_FOR_QUIT_MUSIC_GROUP.getMsg(), indexBaseMonthDataDao.countApplyForQuitGroupNum(organIds),  null));
 
 		return result;
 	}

+ 23 - 11
mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml

@@ -150,8 +150,7 @@
 			del_flag_=0
 		  	AND organ_id_ IS NOT NULL
 			AND user_type_ LIKE '%STUDENT%'
-			AND YEAR(create_time_)=YEAR(CONCAT(#{month}, '-01'))
-			AND MONTH(create_time_)&lt;=MONTH(CONCAT(#{month}, '-01'))
+		  	AND DATE_FORMAT(create_time_, '%Y-%m')&lt;=#{month}
 		GROUP BY organ_id_
 		ORDER BY organ_id_;
 	</select>
@@ -162,14 +161,14 @@
 			CONCAT(#{month}, '-01') month_,
 			<choose>
 				<when test="type == 'submit'">
-					SUM(sees.expect_exercises_num_) total_num_,
+					SUM(sees.actual_exercises_num_) total_num_,
 					SUM(sees.exercises_reply_num_) activate_num_,
-					TRUNCATE(SUM(sees.exercises_reply_num_)/SUM(sees.expect_exercises_num_)*100, 2) percent_
+					TRUNCATE(SUM(sees.exercises_reply_num_)/SUM(sees.actual_exercises_num_)*100, 2) percent_
 				</when>
 				<when test="type == 'comment'">
-					SUM(sees.expect_exercises_num_) total_num_,
-					SUM(sees.exercises_reply_num_) activate_num_,
-					TRUNCATE(SUM(sees.exercises_reply_num_)/SUM(sees.expect_exercises_num_)*100, 2) percent_
+					SUM(sees.exercises_reply_num_) total_num_,
+					SUM(sees.exercises_message_num_) activate_num_,
+					TRUNCATE(SUM(sees.exercises_message_num_)/SUM(sees.exercises_reply_num_)*100, 2) percent_
 				</when>
 				<otherwise>
 					SUM(sees.expect_exercises_num_) total_num_,
@@ -182,7 +181,7 @@
 		WHERE su.del_flag_=0
 			AND su.organ_id_ IS NOT NULL
 			AND YEAR(sees.monday_)=YEAR(CONCAT(#{month}, '-01'))
-			AND MONTH(sees.monday_)&lt;=MONTH(CONCAT(#{month}, '-01'))
+			AND MONTH(sees.monday_)=MONTH(CONCAT(#{month}, '-01'))
 		GROUP BY su.organ_id_
 		ORDER BY su.organ_id_
 	</select>
@@ -320,10 +319,10 @@
 			COUNT( DISTINCT s.user_id_ ) percent_
 		FROM
 			course_schedule_student_payment s
-				LEFT JOIN course_schedule m ON s.course_schedule_id_=m.id_
+			LEFT JOIN course_schedule m ON s.course_schedule_id_=m.id_
 		WHERE
 			m.del_flag_ = 0
-			AND m.is_lock_ = 0
+			AND (m.is_lock_ = 0 OR m.is_lock_ IS NULL)
 			AND m.organ_id_ IS NOT NULL
 			AND m.group_type_ IN ('VIP', 'PRACTICE')
 			<if test="month!=null and month!=''">
@@ -470,7 +469,7 @@
 			COUNT( DISTINCT cgsm.user_id_ )&lt;3
 	</select>
 
-	<select id="countNoPaymentStudentnum" resultType="java.lang.String">
+	<select id="countNoPaymentStudentNum" resultType="int">
 		SELECT
 			DISTINCT mgpcd.user_id_
 		FROM
@@ -507,4 +506,17 @@
 				</foreach>
 			</if>
 	</select>
+
+	<select id="countApplyForQuitGroupNum" resultType="int">
+		SELECT COUNT(mgq.id_) FROM music_group_quit mgq
+			LEFT JOIN music_group mg ON mgq.music_group_id_=mg.id_
+		WHERE mg.status_='PROGRESS'
+		  AND mgq.status_='PROCESSING'
+		<if test="organIds!=null and organIds.size()>0">
+			AND mg.organ_id_ IN
+			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+				#{organId}
+			</foreach>
+		</if>
+	</select>
 </mapper>