From 5353570b86338a1ace5cdd7430b3fc8de81388c2 Mon Sep 17 00:00:00 2001
From: endian11 <Dana_Lee1016@126.com>
Date: 星期五, 14 八月 2020 18:14:01 +0800
Subject: [PATCH] 修改考试状态和 sendMap sendcar 。。考试状态按顺序发送
---
app/src/main/java/safeluck/drive/evaluation/util/DataInit.kt | 2 +-
app/src/main/java/safeluck/drive/evaluation/app.java | 20 ++++++++------------
BaseCommonLib/.gitignore | 1 +
BaseCommonLib/consumer-rules.pro | 0
app/src/main/java/safeluck/drive/evaluation/util/Utils.java | 5 +++++
BaseCommonLib/proguard-rules.pro | 21 +++++++++++++++++++++
app/src/main/java/safeluck/drive/evaluation/DB/exam_status/ExamStatusDao.java | 4 ++--
7 files changed, 38 insertions(+), 15 deletions(-)
diff --git a/BaseCommonLib/.gitignore b/BaseCommonLib/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/BaseCommonLib/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/BaseCommonLib/consumer-rules.pro b/BaseCommonLib/consumer-rules.pro
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/BaseCommonLib/consumer-rules.pro
diff --git a/BaseCommonLib/proguard-rules.pro b/BaseCommonLib/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/BaseCommonLib/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/app/src/main/java/safeluck/drive/evaluation/DB/exam_status/ExamStatusDao.java b/app/src/main/java/safeluck/drive/evaluation/DB/exam_status/ExamStatusDao.java
index 2bea80b..3d46c37 100644
--- a/app/src/main/java/safeluck/drive/evaluation/DB/exam_status/ExamStatusDao.java
+++ b/app/src/main/java/safeluck/drive/evaluation/DB/exam_status/ExamStatusDao.java
@@ -24,9 +24,9 @@
@Query("update exam_status set startExam =:startexam")
void updateStartExam(int startexam);
- @Query("select startExam from exam_status where map_id=1")
+ @Query("select startExam from exam_status where map_id=-1")
LiveData<Integer> getStartExam();
- @Query("select startExam from exam_status where map_id=1")
+ @Query("select startExam from exam_status where map_id=-1")
int getStartExamInt();
@Query("delete from exam_status where map_id >-1")
diff --git a/app/src/main/java/safeluck/drive/evaluation/app.java b/app/src/main/java/safeluck/drive/evaluation/app.java
index 07539dc..f159273 100644
--- a/app/src/main/java/safeluck/drive/evaluation/app.java
+++ b/app/src/main/java/safeluck/drive/evaluation/app.java
@@ -32,6 +32,7 @@
import org.json.JSONObject;
import java.util.Date;
+import java.util.concurrent.Executors;
import safeluck.drive.evaluation.DB.WorkRoomDataBase;
import safeluck.drive.evaluation.DB.appstatusdb.AppStatusWorker;
@@ -105,8 +106,9 @@
private void initData() {
CThreadPoolExecutor.runInBackground(()->{
- MyLog.i("寮�濮嬪垵濮嬪寲鏁版嵁鍙戦�佸湴鍥�/杞﹁締/mcu鍗囩骇鏂囦欢/鑰冭瘯鐘舵��");
+
int type = WorkRoomDataBase.getWorkRoomDataBase(getApplicationContext()).getExamStatusDao().getStartExamInt();
+ MyLog.i("寮�濮嬪垵濮嬪寲鏁版嵁鍙戦�佸湴鍥�/杞﹁締/mcu鍗囩骇鏂囦欢/鑰冭瘯鐘舵��="+type);
ExamPlatformData.getInstance().setExamType(type);
// OneTimeWorkRequest examStatausOutWorker = OneTimeWorkRequest.from(ExamStatusOutWorker.class);
sendMapInfo();
@@ -144,7 +146,7 @@
int enter_status = -1;
@Override
public void callBackMsg(final int cmd, String json) {
- String strConent = String.format("鏀跺埌鍛戒护[%d],Json鍐呭涓�%s", cmd, json);
+ String strConent = String.format("鏀跺埌鍛戒护[%d],Json鍐呭涓�%s,绾跨▼鍙�=%d,鏃堕棿=%s", cmd, json,Thread.currentThread().getId(),Utils.formatTimeYYMMDDHHmmSSSSS(System.currentTimeMillis()));
if (strConent.equalsIgnoreCase(lastStr)){
}else{
@@ -549,9 +551,7 @@
}
private void sendVechileInfo() {
- new Thread(new Runnable() {
- @Override
- public void run() {
+
String carPath = ExamPlatformData.getInstance().getCarModelPath();
if (!TextUtils.isEmpty(carPath)){
MyLog.i("浣跨敤鏇存柊鍚庣殑Car妯″瀷鍦板浘"+carPath);
@@ -575,14 +575,11 @@
});
}
- }
- }).start();
+
}
private void sendMapInfo(){
- new Thread(new Runnable() {
- @Override
- public void run() {
+
final String mapPath = ExamPlatformData.getInstance().getMapPath();
final String roadmapPath = ExamPlatformData.getInstance().getRoadMapPath();
@@ -638,8 +635,7 @@
});
}
- }
- }).start();
+
}
diff --git a/app/src/main/java/safeluck/drive/evaluation/util/DataInit.kt b/app/src/main/java/safeluck/drive/evaluation/util/DataInit.kt
index ae0cc4e..eab1039 100644
--- a/app/src/main/java/safeluck/drive/evaluation/util/DataInit.kt
+++ b/app/src/main/java/safeluck/drive/evaluation/util/DataInit.kt
@@ -62,7 +62,7 @@
fun sendExamLights(applicationContext: Context){
MyLog.i("鍙戦�佺伅鍏�")
- val examType = WorkRoomDataBase.getWorkRoomDataBase(applicationContext).examStatusDao.startExamInt;
+ val examType = ExamPlatformData.getInstance().examType
simulateNightBean.setExam(0)
val list = ExamPlatformData.getInstance().simulate_light_tips
diff --git a/app/src/main/java/safeluck/drive/evaluation/util/Utils.java b/app/src/main/java/safeluck/drive/evaluation/util/Utils.java
index 3733639..76649f3 100644
--- a/app/src/main/java/safeluck/drive/evaluation/util/Utils.java
+++ b/app/src/main/java/safeluck/drive/evaluation/util/Utils.java
@@ -560,6 +560,11 @@
return simpleDateFormat.format(begin_time);
}
+ public static String formatTimeYYMMDDHHmmSSSSS(long begin_time) {
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+
+ return simpleDateFormat.format(begin_time);
+ }
public static boolean isDigital(String str){
String regx = "^[0-9]*$";
--
Gitblit v1.8.0