From 33ebb2eff576bde3de532d4be470737e8d1cc671 Mon Sep 17 00:00:00 2001
From: lizhanwei <Dana_Lee1016@126.com>
Date: 星期日, 22 三月 2020 12:00:37 +0800
Subject: [PATCH] 考试状态下 失败项目小于20分 不报语音

---
 app/src/main/java/safeluck/drive/evaluation/worker/TTSWorker.kt |  103 +++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 90 insertions(+), 13 deletions(-)

diff --git a/app/src/main/java/safeluck/drive/evaluation/worker/TTSWorker.kt b/app/src/main/java/safeluck/drive/evaluation/worker/TTSWorker.kt
index 84e7230..935c91c 100644
--- a/app/src/main/java/safeluck/drive/evaluation/worker/TTSWorker.kt
+++ b/app/src/main/java/safeluck/drive/evaluation/worker/TTSWorker.kt
@@ -10,6 +10,7 @@
 import safeluck.drive.evaluation.Constant
 import safeluck.drive.evaluation.DB.WorkRoomDataBase
 import safeluck.drive.evaluation.DB.failitems.FailedProj
+import safeluck.drive.evaluation.DB.failitems.FailedProj_select
 import safeluck.drive.evaluation.DB.failitems.LuKaoFailedProj
 import safeluck.drive.evaluation.bean.ExamPlatformData
 import safeluck.drive.evaluation.im.MessageProcessor
@@ -44,23 +45,99 @@
             MyLog.i("璇勫垽娑堟伅瑙f瀽涔嬪悗鐨剈tc=$utc")
         val sn = jsonObject["sn"].asInt
 
-            if (emp_id>1000){
-                var ttsStr=WorkRoomDataBase.getWorkRoomDataBase(applicationContext).criteriaIIIDao.queryItemForCriteriaIIINoLive(emp_id-1000)
-                ExamPlatformData.getInstance().tts.speak(ttsStr.getDeducting_reason() + if (ttsStr.getScore_deducting() == 100) "涓嶅悎鏍�" else "鎵�" +
-                        ttsStr.getScore_deducting() + "鍒�")
-                jkMessage0203.fail_item_id = ttsStr.item_id
-                        jkMessage0203.fail_score = ttsStr.score_deducting
-                jkMessage0203.fail_reason = ttsStr.deducting_reason
+
+            if(ExamPlatformData.getInstance().trainingMode == ExamPlatformData.EXAMING_MODE){
+                //鑰冭瘯妯″紡 鎬绘墸鍒嗗皬浜�80 鎵嶆姤瀛愬け璐ラ」鐩�
+                var totalDecutSocre:Int = 0;
+                if (emp_id>1000){
+                    var ttsStr=WorkRoomDataBase.getWorkRoomDataBase(applicationContext).criteriaIIIDao.queryItemForCriteriaIIINoLive(emp_id-1000)
+                    totalDecutSocre = ttsStr.score_deducting
+                    if (totalDecutSocre > ExamPlatformData.getInstance().MAX_SCORE_DUCT){
+                        ExamPlatformData.getInstance().tts.speak(ttsStr.getDeducting_reason() + if (ttsStr.getScore_deducting() == 100) "涓嶅悎鏍�" else "鎵�" +
+                                ttsStr.getScore_deducting() + "鍒�")
+                    }
+                }else{
+                    var ttsStr=WorkRoomDataBase.getWorkRoomDataBase(applicationContext).criteriaIDao.queryItemForCriteriaINoLive(emp_id)
+                    totalDecutSocre = ttsStr.score_deducting
+                    if (totalDecutSocre > ExamPlatformData.getInstance().MAX_SCORE_DUCT){
+                        ExamPlatformData.getInstance().tts.speak(ttsStr.getDeducting_reason() + if (ttsStr.getScore_deducting() == 100) "涓嶅悎鏍�" else "鎵�" +
+                                ttsStr.getScore_deducting() + "鍒�")
+                    }
+                }
+                if (totalDecutSocre>ExamPlatformData.getInstance().MAX_SCORE_DUCT){
+
+                }else{
+                    if (ExamPlatformData.getInstance().examType > ExamPlatformData.EXAM_TYPE_ChangKAO){
+                        //璺��
+                        var failedProjs = WorkRoomDataBase.getWorkRoomDataBase(applicationContext).luKaoFailProjDao.getAllFailProjIII(Constant.TEST_STU_ID)
+
+                        for (i in 0 until failedProjs.size){
+                            totalDecutSocre+=failedProjs[i].score_deducting
+                            if (totalDecutSocre>ExamPlatformData.getInstance().MAX_SCORE_DUCT){
+
+                                break;
+                            }
+                        }
+                        if (totalDecutSocre>ExamPlatformData.getInstance().MAX_SCORE_DUCT){
+                            for (i in 0 until failedProjs.size){
+                                //鎵�鏈夊瓨鍦ㄦ暟鎹簱閲岀殑澶辫触椤�
+                                var ttsStr=WorkRoomDataBase.getWorkRoomDataBase(applicationContext).criteriaIIIDao.queryItemForCriteriaIIINoLive(failedProjs[i].emp_id)
+                                    ExamPlatformData.getInstance().tts.speak(ttsStr.getDeducting_reason() + if (ttsStr.getScore_deducting() == 100) "涓嶅悎鏍�" else "鎵�" +
+                                            ttsStr.getScore_deducting() + "鍒�")
+                            }
+                            //鐜板湪澧炲姞鐨勪竴涓」鐩紝杩樻湭鎻掑叆鏁版嵁搴擄紱 emp_id>1000 璺�冪殑璇�
+                            var ttsStr=WorkRoomDataBase.getWorkRoomDataBase(applicationContext).criteriaIIIDao.queryItemForCriteriaIIINoLive(emp_id-1000)
+                            ExamPlatformData.getInstance().tts.speak(ttsStr.getDeducting_reason() + if (ttsStr.getScore_deducting() == 100) "涓嶅悎鏍�" else "鎵�" +
+                                    ttsStr.getScore_deducting() + "鍒�")
+                        }
+
+                    }else{
+                        //鍦鸿��
+                        var failedProjs = WorkRoomDataBase.getWorkRoomDataBase(applicationContext).failProjDao.getAllFailProjI(Constant.TEST_STU_ID)
+
+                        for (i in 0 until failedProjs.size){
+                            totalDecutSocre+=failedProjs[i].score_deducting
+                            if (totalDecutSocre>ExamPlatformData.getInstance().MAX_SCORE_DUCT){
+                                break;
+                            }
+                        }
+                        if (totalDecutSocre>ExamPlatformData.getInstance().MAX_SCORE_DUCT){
+                            for (i in 0 until failedProjs.size){
+                                //鎵�鏈夊瓨鍦ㄦ暟鎹簱閲岀殑澶辫触椤�
+                                var ttsStr=WorkRoomDataBase.getWorkRoomDataBase(applicationContext).criteriaIDao.queryItemForCriteriaINoLive(failedProjs[i].emp_id)
+                                ExamPlatformData.getInstance().tts.speak(ttsStr.getDeducting_reason() + if (ttsStr.getScore_deducting() == 100) "涓嶅悎鏍�" else "鎵�" +
+                                        ttsStr.getScore_deducting() + "鍒�")
+                            }
+                            //鐜板湪澧炲姞鐨勪竴涓」鐩紝杩樻湭鎻掑叆鏁版嵁搴擄紱 emp_id>1000 璺�冪殑璇�
+                            var ttsStr=WorkRoomDataBase.getWorkRoomDataBase(applicationContext).criteriaIDao.queryItemForCriteriaINoLive(emp_id)
+                            ExamPlatformData.getInstance().tts.speak(ttsStr.getDeducting_reason() + if (ttsStr.getScore_deducting() == 100) "涓嶅悎鏍�" else "鎵�" +
+                                    ttsStr.getScore_deducting() + "鍒�")
+                        }
+                    }
+                }
+
             }else{
-                var ttsStr=WorkRoomDataBase.getWorkRoomDataBase(applicationContext).criteriaIDao.queryItemForCriteriaINoLive(emp_id)
-                ExamPlatformData.getInstance().tts.speak(ttsStr.getDeducting_reason() + if (ttsStr.getScore_deducting() == 100) "涓嶅悎鏍�" else "鎵�" +
-                        ttsStr.getScore_deducting() + "鍒�")
-                jkMessage0203.fail_item_id =ttsStr.item_id
-                        jkMessage0203.fail_score = ttsStr.score_deducting
-                jkMessage0203.fail_reason = ttsStr.deducting_reason
+                //璁粌妯″紡鍏ㄩ儴鎶� 璇煶
+                if (emp_id>1000){
+                    var ttsStr=WorkRoomDataBase.getWorkRoomDataBase(applicationContext).criteriaIIIDao.queryItemForCriteriaIIINoLive(emp_id-1000)
+                    ExamPlatformData.getInstance().tts.speak(ttsStr.getDeducting_reason() + if (ttsStr.getScore_deducting() == 100) "涓嶅悎鏍�" else "鎵�" +
+                            ttsStr.getScore_deducting() + "鍒�")
+                    jkMessage0203.fail_item_id = ttsStr.item_id
+                    jkMessage0203.fail_score = ttsStr.score_deducting
+                    jkMessage0203.fail_reason = ttsStr.deducting_reason
+                }else{
+                    var ttsStr=WorkRoomDataBase.getWorkRoomDataBase(applicationContext).criteriaIDao.queryItemForCriteriaINoLive(emp_id)
+                    ExamPlatformData.getInstance().tts.speak(ttsStr.getDeducting_reason() + if (ttsStr.getScore_deducting() == 100) "涓嶅悎鏍�" else "鎵�" +
+                            ttsStr.getScore_deducting() + "鍒�")
+                    jkMessage0203.fail_item_id =ttsStr.item_id
+                    jkMessage0203.fail_score = ttsStr.score_deducting
+                    jkMessage0203.fail_reason = ttsStr.deducting_reason
+                }
             }
 
 
+
+
             if (!TextUtils.isEmpty(utc) && utc.length > 12) {
                 utc = utc.substring(0, 12)
             }

--
Gitblit v1.8.0