Browse Source

Merge branch 'music_score'

Joburgess 4 years ago
parent
commit
3557bbd117

+ 7 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SoundCheckHandler.java

@@ -36,10 +36,8 @@ import java.util.concurrent.ConcurrentHashMap;
 @Service
 public class SoundCheckHandler implements WebSocketEventHandler {
 
-    private static final double COMPARE_FREQUENCY = 525;
-
     /** 校音数据 */
-    private Map<String, Integer> userSoundCheckInfo = new ConcurrentHashMap<>();
+    private Map<String, Double> userSoundCheckInfo = new ConcurrentHashMap<>();
 
     public SoundCheckHandler() {
         WebSocketHandler.regist(WebsocketTypeEnum.SOUND_CHECK, this);
@@ -57,7 +55,11 @@ public class SoundCheckHandler implements WebSocketEventHandler {
                 userSoundCheckInfo.remove(phone);
                 break;
             default:
-                userSoundCheckInfo.put(phone, 0);
+                userSoundCheckInfo.put(phone, (double) 442);
+                JSONObject body = (JSONObject) message.getBody();
+                if(body.containsKey("frequency")){
+                    userSoundCheckInfo.put(phone, body.getDoubleValue("frequency"));
+                }
                 break;
         }
     }
@@ -73,7 +75,7 @@ public class SoundCheckHandler implements WebSocketEventHandler {
                 if(pitchDetectionResult.getPitch()<=0){
                     return;
                 }
-                double normalCents = PitchConverter.hertzToAbsoluteCent(COMPARE_FREQUENCY);
+                double normalCents = PitchConverter.hertzToAbsoluteCent(userSoundCheckInfo.get(phone));
                 double recordCents = PitchConverter.hertzToAbsoluteCent(pitchDetectionResult.getPitch());
                 if(Math.abs(normalCents - recordCents)<3){
                     WebSocketHandler.sendTextMessage(phone, WebSocketInfo.success("checkDone"));

+ 5 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SoundCompareHandler.java

@@ -440,7 +440,11 @@ public class SoundCompareHandler implements WebSocketEventHandler {
                     musicXmlInfo.setAvgFrequency(avgPitch.floatValue());
                     intonationRight = score>70;
 
-                    integrityValidNum = measureSoundPitchInfos.stream().filter(pitch -> Math.abs((pitch.getFrequency()-musicXmlInfo.getFrequency()))<5).count();
+                    if(score>0){
+                        integrityValidNum = measureSoundPitchInfos.stream().filter(pitch -> Math.abs((pitch.getFrequency()-musicXmlInfo.getFrequency()))<5).count();
+                    }else{
+                        integrityValidNum = 0;
+                    }
                 }
                 //完成度
                 if(integrityValidNum > compareNum){

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

@@ -1708,6 +1708,7 @@
 				<if test="dayStr!=null and dayStr!=''">
 					AND DATE(cssp.create_time_)&lt;= #{dayStr}
 				</if>)) t
+		WHERE t.user_id_ NOT IN (SELECT user_id_ FROM student WHERE subject_id_list_ REGEXP '21|25|26|27|28|29')
 		GROUP BY t.organ_id_
 	</select>
 

+ 3 - 2
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -797,6 +797,7 @@
                  AND cs.status_='NOT_START'
                  AND su.del_flag_ = 0
                  AND su.organ_id_ = #{organId})) t
+        WHERE t.user_id_ NOT IN (SELECT user_id_ FROM student WHERE subject_id_list_ REGEXP '21|25|26|27|28|29')
     </select>
 
     <select id="getOrgansTotalStudentNum" resultType="int">
@@ -843,7 +844,7 @@
         cssp.group_type_ IN ('VIP', 'PRACTICE')
         AND cs.status_='NOT_START')) t
         LEFT JOIN sys_user su ON t.user_id_=su.id_
-        WHERE su.del_flag_=0
+        WHERE su.del_flag_=0 AND t.user_id_ NOT IN (SELECT user_id_ FROM student WHERE subject_id_list_ REGEXP '21|25|26|27|28|29')
 <!--        <if test="organIds!=null and organIds.size()>0">-->
 <!--            AND su.organ_id_ IN-->
 <!--            <foreach collection="organIds" item="organId" open="(" close=")" separator=",">-->
@@ -1026,7 +1027,7 @@
 
     <sql id="queryCloudStudyStudentDataCondition">
         <where>
-            su.del_flag_=0
+            su.del_flag_=0 AND t.user_id_ NOT IN (SELECT user_id_ FROM student WHERE subject_id_list_ REGEXP '21|25|26|27|28|29')
             <if test="organId!=null">
                 AND su.organ_id_=#{organId}
             </if>