Bläddra i källkod

Merge branch 'master' of lhm/ich-android into master

李慧明 3 år sedan
förälder
incheckning
a425eb3335
80 ändrade filer med 915 tillägg och 335 borttagningar
  1. 5 4
      app/src/main/AndroidManifest.xml
  2. 3 2
      app/src/main/java/com/emato/ich/MainActivity.java
  3. 3 0
      app/src/main/java/com/emato/ich/api/ICSPApi.java
  4. 7 3
      app/src/main/java/com/emato/ich/api/ICSPClient.java
  5. 4 2
      app/src/main/java/com/emato/ich/api/ICSPResponseCodeEnum.java
  6. 4 0
      app/src/main/java/com/emato/ich/api/LoggingInterceptor.java
  7. 9 0
      app/src/main/java/com/emato/ich/contant/ExceptionType.java
  8. 7 4
      app/src/main/java/com/emato/ich/contant/ICSPConstant.java
  9. 3 0
      app/src/main/java/com/emato/ich/contant/ScanGunConstant.java
  10. 18 8
      app/src/main/java/com/emato/ich/crash/BootBroadcastReceiver.java
  11. 5 0
      app/src/main/java/com/emato/ich/crash/CrashApplication.java
  12. 7 4
      app/src/main/java/com/emato/ich/crash/UncaughtExceptionHandlerImpl.java
  13. 3 0
      app/src/main/java/com/emato/ich/data/CabinetTypeEnum.java
  14. 1 1
      app/src/main/java/com/emato/ich/data/DecisionEnum.java
  15. 1 0
      app/src/main/java/com/emato/ich/data/Result.java
  16. 1 0
      app/src/main/java/com/emato/ich/data/SQLiteOpenHelperImpl.java
  17. 8 8
      app/src/main/java/com/emato/ich/device/DeviceControl.java
  18. 14 0
      app/src/main/java/com/emato/ich/entity/Message.java
  19. 3 0
      app/src/main/java/com/emato/ich/entity/vo/CabinetInfoVo.java
  20. 3 0
      app/src/main/java/com/emato/ich/entity/vo/ConfirmOrderVo.java
  21. 58 0
      app/src/main/java/com/emato/ich/entity/vo/ExceptionVo.java
  22. 3 1
      app/src/main/java/com/emato/ich/entity/vo/PreparedOrderResponseVo.java
  23. 3 0
      app/src/main/java/com/emato/ich/entity/vo/PreparedOrderVo.java
  24. 4 0
      app/src/main/java/com/emato/ich/entity/vo/ResponseData.java
  25. 3 0
      app/src/main/java/com/emato/ich/entity/vo/ResponseTokenVo.java
  26. 3 0
      app/src/main/java/com/emato/ich/entity/vo/ShellVo.java
  27. 3 0
      app/src/main/java/com/emato/ich/entity/vo/TakeParcelVo.java
  28. 37 31
      app/src/main/java/com/emato/ich/fragment/ChooseCabinetFragment.java
  29. 44 36
      app/src/main/java/com/emato/ich/fragment/ExceptionFragment.java
  30. 50 42
      app/src/main/java/com/emato/ich/fragment/InputInfoFragment.java
  31. 4 1
      app/src/main/java/com/emato/ich/fragment/MainFragment.java
  32. 111 5
      app/src/main/java/com/emato/ich/fragment/SendFragment.java
  33. 29 21
      app/src/main/java/com/emato/ich/fragment/SendInfoConfirmFragment.java
  34. 4 1
      app/src/main/java/com/emato/ich/fragment/SendMainFragment.java
  35. 4 1
      app/src/main/java/com/emato/ich/fragment/SendSuccessFragment.java
  36. 32 28
      app/src/main/java/com/emato/ich/fragment/TakeCodeFragment.java
  37. 1 1
      app/src/main/java/com/emato/ich/fragment/TakeFragment.java
  38. 35 27
      app/src/main/java/com/emato/ich/fragment/TakeSuccessFragment.java
  39. 4 1
      app/src/main/java/com/emato/ich/local/LocalStorage.java
  40. 1 1
      app/src/main/java/com/emato/ich/message/ICHPublishClient.java
  41. 1 1
      app/src/main/java/com/emato/ich/message/ICHSubscribeClient.java
  42. 3 1
      app/src/main/java/com/emato/ich/message/ICHTopic.java
  43. 1 0
      app/src/main/java/com/emato/ich/service/MqttMessageService.java
  44. 12 8
      app/src/main/java/com/emato/ich/update/APKAutoUpdate.java
  45. 7 2
      app/src/main/java/com/emato/ich/update/APKUpdateDownload.java
  46. 5 1
      app/src/main/java/com/emato/ich/update/CustomUpdateConfigProvider.java
  47. 4 1
      app/src/main/java/com/emato/ich/update/InstallListener.java
  48. 5 2
      app/src/main/java/com/emato/ich/update/InstallResultReceiver.java
  49. 5 0
      app/src/main/java/com/emato/ich/update/OnDownloadListener.java
  50. 41 7
      app/src/main/java/com/emato/ich/update/PackageManagerCompat.java
  51. 19 1
      app/src/main/java/com/emato/ich/update/UpdateService.java
  52. 4 1
      app/src/main/java/com/emato/ich/utils/BaseUtils.java
  53. 7 0
      app/src/main/java/com/emato/ich/utils/ButtonUtils.java
  54. 24 0
      app/src/main/java/com/emato/ich/utils/DateUtils.java
  55. 5 1
      app/src/main/java/com/emato/ich/utils/FileUtils.java
  56. 4 1
      app/src/main/java/com/emato/ich/utils/JacksonUtils.java
  57. 50 0
      app/src/main/java/com/emato/ich/utils/Log.java
  58. 33 2
      app/src/main/java/com/emato/ich/utils/LoggingUtils.java
  59. 3 0
      app/src/main/java/com/emato/ich/utils/Md5Utils.java
  60. 6 1
      app/src/main/java/com/emato/ich/utils/ResourceUtils.java
  61. 3 0
      app/src/main/java/com/emato/ich/utils/StringUtils.java
  62. 16 1
      app/src/main/java/com/emato/ich/utils/TimeOutUtils.java
  63. 8 0
      app/src/main/java/com/emato/ich/utils/ToastUtils.java
  64. 2 0
      app/src/main/java/com/emato/ich/utils/WaitingDialogUtils.java
  65. BIN
      app/src/main/res/drawable/already_send.png
  66. BIN
      app/src/main/res/drawable/continue_send.png
  67. BIN
      app/src/main/res/drawable/continue_take.png
  68. BIN
      app/src/main/res/drawable/exception_handler.png
  69. BIN
      app/src/main/res/drawable/exit_account.png
  70. BIN
      app/src/main/res/drawable/none_send.png
  71. BIN
      app/src/main/res/drawable/re_open.png
  72. 13 1
      app/src/main/res/layout/fragment_input_info.xml
  73. 13 1
      app/src/main/res/layout/fragment_send.xml
  74. 32 36
      app/src/main/res/layout/fragment_send_info_confirm.xml
  75. 6 12
      app/src/main/res/layout/fragment_send_success.xml
  76. 14 2
      app/src/main/res/layout/fragment_take_code.xml
  77. 13 17
      app/src/main/res/layout/fragment_take_success.xml
  78. 4 0
      app/src/main/res/values-night/themes.xml
  79. 6 2
      app/src/main/res/values/colors.xml
  80. 4 0
      app/src/main/res/values/themes.xml

+ 5 - 4
app/src/main/AndroidManifest.xml

@@ -62,12 +62,13 @@
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </receiver>
-        <receiver
-            android:name="com.emato.ich.update.InstallResultReceiver"
-            android:enabled="true"
-            android:exported="true">
+        <receiver android:name="com.emato.ich.update.InstallResultReceiver">
             <intent-filter>
                 <action android:name="android.content.pm.extra.STATUS"/>
+                <action android:name="android.intent.action.PACKAGE_ADDED" />
+                <action android:name="android.intent.action.PACKAGE_REMOVED" />
+                <action android:name="android.intent.action.PACKAGE_REPLACED" />
+                <data android:scheme="package" />
             </intent-filter>
         </receiver>
 <!--        <receiver android:name=".update.InstallResultReceiver">-->

+ 3 - 2
app/src/main/java/com/emato/ich/MainActivity.java

@@ -31,7 +31,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import androidx.appcompat.app.AppCompatActivity;
 
 import android.provider.SyncStateContract;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 import android.view.KeyEvent;
 
 import androidx.navigation.NavController;
@@ -160,7 +160,7 @@ public class MainActivity extends AppCompatActivity  {
                         .build()
                         .update();
 
-//                XUpdate.newBuild(this)
+//                XUpdate.newBuild(getApplicationContext())
 //                        .updateUrl(ICSPApi.GET_UPDATE_PATH.getUrl())
 //                        .isAutoMode(true) // 如果需要完全无人干预,自动更新,需要root权限【静默安装需要】
 //                        .update();
@@ -365,6 +365,7 @@ public class MainActivity extends AppCompatActivity  {
         failedMsg.setPort(message.getPort());
         failedMsg.setScene(message.getScene());
         failedMsg.setSection(message.getSection());
+        failedMsg.setMsgId(message.getMsgId());
         mqttMessage.setQos(1);
         mqttMessage.setPayload(objectMapper.writeValueAsBytes(failedMsg));
 

+ 3 - 0
app/src/main/java/com/emato/ich/api/ICSPApi.java

@@ -2,6 +2,9 @@ package com.emato.ich.api;
 
 import com.emato.ich.contant.ICSPConstant;
 
+/**
+ * ICSP-SERVER 接口地址
+ */
 public enum  ICSPApi {
 
     /**

+ 7 - 3
app/src/main/java/com/emato/ich/api/ICSPClient.java

@@ -1,6 +1,6 @@
 package com.emato.ich.api;
 
-import android.util.Log;
+import com.emato.ich.utils.Log;
 
 import com.emato.ich.entity.vo.ConfirmOrderVo;
 import com.emato.ich.entity.vo.PreparedOrderVo;
@@ -12,6 +12,7 @@ import com.emato.ich.utils.LoggingUtils;
 import com.emato.ich.utils.StringUtils;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.zhy.http.okhttp.OkHttpUtils;
 
 import java.io.IOException;
 import java.util.Objects;
@@ -24,6 +25,9 @@ import okhttp3.Request;
 import okhttp3.RequestBody;
 import okhttp3.Response;
 
+/**
+ * 请求ICSP-SERVER的客户端
+ */
 public class ICSPClient {
 
     private static final String TAG = ICSPClient.class.getName();
@@ -249,8 +253,8 @@ public class ICSPClient {
     }
 
     static class ICSPClientInnerClass{
-
-        private static final OkHttpClient CLIENT = new OkHttpClient.Builder().connectTimeout(60, TimeUnit.SECONDS)
+        // 重试 超时时间1min 读取超时1min
+        private static final OkHttpClient CLIENT = new OkHttpClient.Builder().retryOnConnectionFailure(true).connectTimeout(60, TimeUnit.SECONDS)
                 .readTimeout(60, TimeUnit.SECONDS).build();
 
     }

+ 4 - 2
app/src/main/java/com/emato/ich/api/ICSPResponseCodeEnum.java

@@ -1,14 +1,16 @@
 package com.emato.ich.api;
 
 import android.content.Context;
-import android.view.View;
 
 import com.emato.ich.entity.vo.ResponseData;
 import com.emato.ich.utils.ToastUtils;
-import com.google.android.material.snackbar.Snackbar;
 
 import java.util.Arrays;
 
+/**
+ * ICSP-SERVER返回枚举
+ * 已废弃
+ */
 public enum ICSPResponseCodeEnum {
 
     OK("0", ""),

+ 4 - 0
app/src/main/java/com/emato/ich/api/LoggingInterceptor.java

@@ -8,6 +8,10 @@ import okhttp3.Interceptor;
 import okhttp3.Request;
 import okhttp3.Response;
 
+/**
+ * okhttp请求响应日志拦截器
+ * 已废弃
+ */
 public class LoggingInterceptor implements Interceptor {
     public static final String TAG = "Http_log";
 

+ 9 - 0
app/src/main/java/com/emato/ich/contant/ExceptionType.java

@@ -0,0 +1,9 @@
+package com.emato.ich.contant;
+
+public class ExceptionType {
+
+    public static final String BIZ_ERROR = "biz_error";
+
+    public static final String CRASH_ERROR = "app_crash";
+
+}

+ 7 - 4
app/src/main/java/com/emato/ich/contant/ICSPConstant.java

@@ -1,11 +1,14 @@
 package com.emato.ich.contant;
 
+/**
+ * ICSP-SERVER  EMQ-X  地址
+ */
 public class ICSPConstant {
 
-    public static final String ICSP_SERVICE = "http://icsp-api.ds-bay.com";
+//    public static final String ICSP_SERVICE = "http://icsp-api.ds-bay.com";
 //    public static final String ICSP_SERVICE = "http://68rfyvi.nat.ipyingshe.com";
-//    public static final String ICSP_SERVICE = "http://icsp-testend.ds-bay.com";         // 测试+开发
+    public static final String ICSP_SERVICE = "http://icsp-testend.ds-bay.com";         // 测试+开发
 
-    public static final String MQTT_SERVER_ADDRESS = "tcp://8.135.102.238:1883";
-//    public static final String MQTT_SERVER_ADDRESS = "tcp://183.3.221.143:1883";
+//    public static final String MQTT_SERVER_ADDRESS = "tcp://8.135.102.238:1883";
+    public static final String MQTT_SERVER_ADDRESS = "tcp://183.3.221.143:1883";
 }

+ 3 - 0
app/src/main/java/com/emato/ich/contant/ScanGunConstant.java

@@ -3,6 +3,9 @@ package com.emato.ich.contant;
 import java.util.ArrayList;
 import java.util.List;
 
+/**
+ * 扫描枪需要过滤的值的正则表达式
+ */
 public class ScanGunConstant {
 
     private static final List<String> patterns = new ArrayList<>();

+ 18 - 8
app/src/main/java/com/emato/ich/crash/BootBroadcastReceiver.java

@@ -5,22 +5,32 @@ import android.content.Context;
 import android.content.Intent;
 
 import com.emato.ich.MainActivity;
+import com.emato.ich.utils.Log;
 
+/**
+ * 系统启动广播接收器
+ */
 public class BootBroadcastReceiver extends BroadcastReceiver {
     static final String ACTION = "android.intent.action.BOOT_COMPLETED";
+    private static final String TAG = BootBroadcastReceiver.class.getName();
 
     @Override
     public void onReceive(Context context, Intent intent) {
         if (intent.getAction().equals(ACTION)) {
-            // 开机启动的Activity
-            Intent activityIntent = new Intent(context, MainActivity.class);
-            activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-            // 启动Activity
-            context.startActivity(activityIntent);
-            //2.如果自启动Activity
-            context.startActivity(activityIntent);
-            //3.如果自启动服务
+            try {
+                // 开机启动的Activity
+                Intent activityIntent = new Intent(context, MainActivity.class);
+                activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                // 启动Activity
+                context.startActivity(activityIntent);
+                //2.如果自启动Activity
+                context.startActivity(activityIntent);
+                Log.i(TAG, "=========================>应用断点重启完成! ");
+                //3.如果自启动服务
 //            context.startService(intent);
+            } catch (Exception e) {
+                Log.e(TAG, "=========================>应用断点重启失败! ", e);
+            }
         }
     }
 }

+ 5 - 0
app/src/main/java/com/emato/ich/crash/CrashApplication.java

@@ -27,6 +27,10 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
+/**
+ * 继承Application的CrashApplication
+ * 程序崩溃后可以做相关操作
+ */
 public class CrashApplication extends Application {
     private final List<Activity> mActivityList = new ArrayList<>();
     private static final String TAG = CrashApplication.class.getName();
@@ -42,6 +46,7 @@ public class CrashApplication extends Application {
     @Override
     public void onCreate() {
         super.onCreate();
+        // 初始化未捕获异常处理器
         UncaughtExceptionHandlerImpl.getInstance().init(getApplicationContext(), BuildConfig.DEBUG, true, 1000, MainActivity.class);
 
 //        XUpdate.get()

+ 7 - 4
app/src/main/java/com/emato/ich/crash/UncaughtExceptionHandlerImpl.java

@@ -10,7 +10,7 @@ import android.content.pm.PackageManager;
 import android.os.Build;
 import android.os.Environment;
 import android.os.Looper;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 import android.widget.Toast;
 
 import com.emato.ich.MainActivity;
@@ -36,6 +36,9 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
+/**
+ * 未捕获的异常处理器
+ */
 public class UncaughtExceptionHandlerImpl implements Thread.UncaughtExceptionHandler {
 
     private static final String TAG = UncaughtExceptionHandlerImpl.class.getName();
@@ -79,7 +82,7 @@ public class UncaughtExceptionHandlerImpl implements Thread.UncaughtExceptionHan
 
     @SuppressLint("WrongConstant")
     public void uncaughtException(Thread thread, Throwable ex) {
-        LoggingUtils.sendErrorLog("系统异常: 崩溃异常! ", ex);
+        LoggingUtils.sendAppErrorLog("系统异常: 崩溃异常! ", ex);
 
         if (!this.handleException(ex) && this.mDefaultHandler != null) {
             this.mDefaultHandler.uncaughtException(thread, ex);
@@ -88,7 +91,7 @@ public class UncaughtExceptionHandlerImpl implements Thread.UncaughtExceptionHan
                 Thread.sleep(1000L);
             } catch (InterruptedException var6) {
                 Log.e(TAG, "error 出现未知异常: ", var6);
-                LoggingUtils.sendErrorLog("系统异常: 线程中断异常! ", var6);
+                LoggingUtils.sendAppErrorLog("系统异常: 线程中断异常! ", var6);
             }
 
             if (this.mIsRestartApp) {
@@ -166,7 +169,7 @@ public class UncaughtExceptionHandlerImpl implements Thread.UncaughtExceptionHan
             try {
                 field.setAccessible(true);
                 this.infos.put(field.getName(), field.get((Object)null).toString());
-                Log.d(TAG, field.getName() + " : " + field.get((Object)null));
+                Log.i(TAG, field.getName() + " : " + field.get((Object)null));
             } catch (Exception var8) {
                 Log.e(TAG, "an error occured when collect crash info", var8);
                 LoggingUtils.sendErrorLog("业务异常: an error occured when collect crash info! ", var8);

+ 3 - 0
app/src/main/java/com/emato/ich/data/CabinetTypeEnum.java

@@ -1,5 +1,8 @@
 package com.emato.ich.data;
 
+/**
+ * 柜子类型枚举
+ */
 public enum CabinetTypeEnum {
     MINI("mini"),
     SMALL("small"),

+ 1 - 1
app/src/main/java/com/emato/ich/data/DecisionEnum.java

@@ -1,7 +1,7 @@
 package com.emato.ich.data;
 
 /**
- * 订单状态
+ * 订单状态枚举
  */
 public enum  DecisionEnum {
 

+ 1 - 0
app/src/main/java/com/emato/ich/data/Result.java

@@ -3,6 +3,7 @@ package com.emato.ich.data;
 /**
  * A generic class that holds a result success w/ data or an error exception.
  */
+@Deprecated
 public class Result<T> {
     // hide the private constructor to limit subclass types (Success, Error)
     private Result() {

+ 1 - 0
app/src/main/java/com/emato/ich/data/SQLiteOpenHelperImpl.java

@@ -12,6 +12,7 @@ import androidx.annotation.Nullable;
  * 实例化后调用getWritableDatabase()就会创建数据库文件
  * 如何查看? 把数据库文件导出来, 使用SQLite工具即可打开, Android SDK安装目录下的platform-tools目录里就有
  */
+@Deprecated
 public class SQLiteOpenHelperImpl extends SQLiteOpenHelper {
 
     public SQLiteOpenHelperImpl(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) {

+ 8 - 8
app/src/main/java/com/emato/ich/device/DeviceControl.java

@@ -1,6 +1,6 @@
 package com.emato.ich.device;
 
-import android.util.Log;
+import com.emato.ich.utils.Log;
 
 import com.cherry.sdk.controller.InitDevice;
 import com.cherry.sdk.controller.MoternDeviceController;
@@ -53,10 +53,10 @@ public class DeviceControl {
      * 函数用途:查询锁版版本
      */
     public static void queryVersion(int section, CmdCallback cmdCallback) {
-        Log.d(TAG, new Date() + "查询锁版本开始");
+        Log.i(TAG, new Date() + "查询锁版本开始");
         DeviceResult result = new DeviceResult();
         initedInstance.queryVersion(section, cmdCallback);
-        Log.d(TAG, new Date() + "查询锁版本结束");
+        Log.i(TAG, new Date() + "查询锁版本结束");
     }
 
     /**
@@ -293,8 +293,8 @@ public class DeviceControl {
         initedInstance.hotSection(2, 1, new CmdCallback() {
             @Override
             public void onMessage(int i, String... strings) {
-                Log.d(TAG, new Date() + "onMessage: " + i);
-                Log.d(TAG, new Date() + "onMessage: " + Arrays.asList(strings));
+                Log.i(TAG, new Date() + "onMessage: " + i);
+                Log.i(TAG, new Date() + "onMessage: " + Arrays.asList(strings));
             }
         });
         return false;
@@ -311,7 +311,7 @@ public class DeviceControl {
         initedInstance.degasLocker(2, 1, 1, new CmdCallback() {
             @Override
             public void onMessage(int i, String... strings) {
-                Log.d(TAG, "onMessage: " + i);
+                Log.i(TAG, "onMessage: " + i);
             }
         });
         return false;
@@ -343,8 +343,8 @@ public class DeviceControl {
     @Deprecated
     public static String relayOpt(int section, int port, int opt){
         initedInstance.relayOpt(section, port, opt, (i, s) -> {
-            Log.d(TAG, "relayOpt: " + i);
-            Log.d(TAG, "relayOpt: " + Arrays.asList(s));
+            Log.i(TAG, "relayOpt: " + i);
+            Log.i(TAG, "relayOpt: " + Arrays.asList(s));
         });
         return "";
     }

+ 14 - 0
app/src/main/java/com/emato/ich/entity/Message.java

@@ -1,9 +1,14 @@
 package com.emato.ich.entity;
 
+/**
+ * Message
+ */
 public class Message {
 
     private int messageId;
 
+    private String msgId;
+
     private String clientId;
 
     private String cmd;
@@ -100,10 +105,19 @@ public class Message {
         this.remark = remark;
     }
 
+    public String getMsgId() {
+        return msgId;
+    }
+
+    public void setMsgId(String msgId) {
+        this.msgId = msgId;
+    }
+
     @Override
     public String toString() {
         return "Message{" +
                 "messageId=" + messageId +
+                ", msgId='" + msgId + '\'' +
                 ", clientId='" + clientId + '\'' +
                 ", cmd='" + cmd + '\'' +
                 ", datetime='" + datetime + '\'' +

+ 3 - 0
app/src/main/java/com/emato/ich/entity/vo/CabinetInfoVo.java

@@ -2,6 +2,9 @@ package com.emato.ich.entity.vo;
 
 import com.emato.ich.data.CabinetTypeEnum;
 
+/**
+ * ICSP-SERVER返回的柜子信息
+ */
 public class CabinetInfoVo {
 
     private String type;

+ 3 - 0
app/src/main/java/com/emato/ich/entity/vo/ConfirmOrderVo.java

@@ -1,5 +1,8 @@
 package com.emato.ich.entity.vo;
 
+/**
+ * 提交给ICSP-SERVER的确认下单信息
+ */
 public class ConfirmOrderVo {
 
     private String orderSn;

+ 58 - 0
app/src/main/java/com/emato/ich/entity/vo/ExceptionVo.java

@@ -0,0 +1,58 @@
+package com.emato.ich.entity.vo;
+
+
+/**
+ * 异常信息
+ */
+public class ExceptionVo {
+
+    private String reportType;
+
+    private String reportData;
+
+    private String clientId;
+
+    private String reportTime;
+
+    public String getReportType() {
+        return reportType;
+    }
+
+    public void setReportType(String reportType) {
+        this.reportType = reportType;
+    }
+
+    public String getReportData() {
+        return reportData;
+    }
+
+    public void setReportData(String reportData) {
+        this.reportData = reportData;
+    }
+
+    public String getClientId() {
+        return clientId;
+    }
+
+    public void setClientId(String clientId) {
+        this.clientId = clientId;
+    }
+
+    public String getReportTime() {
+        return reportTime;
+    }
+
+    public void setReportTime(String reportTime) {
+        this.reportTime = reportTime;
+    }
+
+    @Override
+    public String toString() {
+        return "ExceptionVo{" +
+                "reportType='" + reportType + '\'' +
+                ", reportData='" + reportData + '\'' +
+                ", clientId='" + clientId + '\'' +
+                ", reportTime='" + reportTime + '\'' +
+                '}';
+    }
+}

+ 3 - 1
app/src/main/java/com/emato/ich/entity/vo/PreparedOrderResponseVo.java

@@ -1,6 +1,8 @@
 package com.emato.ich.entity.vo;
 
-
+/**
+ * 预下单后ICSP-SERVER的响应信息
+ */
 public class PreparedOrderResponseVo {
 
     private String orderSn;

+ 3 - 0
app/src/main/java/com/emato/ich/entity/vo/PreparedOrderVo.java

@@ -1,5 +1,8 @@
 package com.emato.ich.entity.vo;
 
+/**
+ * 提交给ICSP-SERVER的预下单信息
+ */
 public class PreparedOrderVo {
 
     /**

+ 4 - 0
app/src/main/java/com/emato/ich/entity/vo/ResponseData.java

@@ -1,5 +1,9 @@
 package com.emato.ich.entity.vo;
 
+/**
+ * 统一的响应体
+ * @param <T>
+ */
 public class ResponseData<T> {
 
     private String code;

+ 3 - 0
app/src/main/java/com/emato/ich/entity/vo/ResponseTokenVo.java

@@ -1,5 +1,8 @@
 package com.emato.ich.entity.vo;
 
+/**
+ * 响应的token
+ */
 public class ResponseTokenVo {
 
     private String token;

+ 3 - 0
app/src/main/java/com/emato/ich/entity/vo/ShellVo.java

@@ -3,6 +3,9 @@ package com.emato.ich.entity.vo;
 import java.util.Arrays;
 import java.util.List;
 
+/**
+ * ICSP-SERVER响应的Shell信息
+ */
 public class ShellVo {
 
     private String msgId;

+ 3 - 0
app/src/main/java/com/emato/ich/entity/vo/TakeParcelVo.java

@@ -1,5 +1,8 @@
 package com.emato.ich.entity.vo;
 
+/**
+ * 取件的响应
+ */
 public class TakeParcelVo {
 
     private String pickUp;

+ 37 - 31
app/src/main/java/com/emato/ich/fragment/ChooseCabinetFragment.java

@@ -3,7 +3,7 @@ package com.emato.ich.fragment;
 import android.annotation.SuppressLint;
 import android.os.Bundle;
 import android.os.CountDownTimer;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -48,6 +48,9 @@ import okhttp3.Call;
 import okhttp3.Callback;
 import okhttp3.Response;
 
+/**
+ * 选择柜子页面
+ */
 public class ChooseCabinetFragment extends Fragment {
 
     private static final String TAG = ChooseCabinetFragment.class.getName();
@@ -149,8 +152,7 @@ public class ChooseCabinetFragment extends Fragment {
                                 LoggingUtils.sendErrorLog("业务异常: 获取柜子剩余信息未知错误! ", e);
                             }
                         } else {
-                            ToastUtils.make(getContext(), "获取柜子剩余信息出错!请重新进入此页面!");
-                            LoggingUtils.sendErrorLog("业务异常: 获取柜子剩余信息出错!请重新进入此页面! ", null);
+                            ToastUtils.make(getContext(), "服务器异常!请稍后重试!");
                         }
                     });
                 }
@@ -244,37 +246,41 @@ public class ChooseCabinetFragment extends Fragment {
                                 ((MainActivity) getActivity()).runOnUiThread(() -> {
                                     try {
                                         String responseStr = ICSPClient.isSuccessfulAndParseResponse(response);
-                                        ObjectMapper objectMapper = JacksonUtils.objectmapper;
-                                        ResponseData<PreparedOrderResponseVo> responseData = objectMapper.readValue(responseStr, new TypeReference<ResponseData<PreparedOrderResponseVo>>() {});
-                                        // 响应信息
-                                        if (responseData.getCode().equals(ICSPResponseCodeEnum.OK.getCode())) {
-                                            PreparedOrderResponseVo data = responseData.getData();
-                                            if (null != data) {
-                                                data.setOrderSn(preparedOrderResponse.getOrderSn());
-                                                data.setCollectorPhone(preparedOrderResponse.getCollectorPhone());
-                                                String mailNo = inputInfoBundle.getString("takeNo");
-                                                bundle.putString("preparedOrderResponse", objectMapper.writeValueAsString(data));
-                                                bundle.putString("takeNo", mailNo);
-                                                bundle.putString("section_type", data.getLockerName());
-
-                                                // 跳转到确认投递
-                                                try {
-                                                    MainActivity activity = (MainActivity) getActivity();
-                                                    activity.getBundleMap().put(InputInfoFragment.class.getName(), bundle);
-                                                    activity.getBundleMap().remove(ExceptionFragment.class.getName());
-                                                    timer.cancel();
-                                                    NavHostFragment.findNavController(ChooseCabinetFragment.this)
-                                                            .navigate(R.id.action_chooseCabinetFragment_to_sendInfoConfirmFragment);
-                                                } catch (RuntimeException e) {
-                                                    Log.e(TAG, "onResponse: InputInfoFragment页面获取SendInfoConfirmFragment传值错误! ", e);
-                                                    LoggingUtils.sendErrorLog("业务异常: InputInfoFragment页面获取SendInfoConfirmFragment传值错误! ", e);
+                                        if (!StringUtils.isNullOrEmpty(responseStr)) {
+                                            ObjectMapper objectMapper = JacksonUtils.objectmapper;
+                                            ResponseData<PreparedOrderResponseVo> responseData = objectMapper.readValue(responseStr, new TypeReference<ResponseData<PreparedOrderResponseVo>>() {});
+                                            // 响应信息
+                                            if (responseData.getCode().equals(ICSPResponseCodeEnum.OK.getCode())) {
+                                                PreparedOrderResponseVo data = responseData.getData();
+                                                if (null != data) {
+                                                    data.setOrderSn(preparedOrderResponse.getOrderSn());
+                                                    data.setCollectorPhone(preparedOrderResponse.getCollectorPhone());
+                                                    String mailNo = inputInfoBundle.getString("takeNo");
+                                                    bundle.putString("preparedOrderResponse", objectMapper.writeValueAsString(data));
+                                                    bundle.putString("takeNo", mailNo);
+                                                    bundle.putString("section_type", data.getLockerName());
+
+                                                    // 跳转到确认投递
+                                                    try {
+                                                        MainActivity activity = (MainActivity) getActivity();
+                                                        activity.getBundleMap().put(InputInfoFragment.class.getName(), bundle);
+                                                        activity.getBundleMap().remove(ExceptionFragment.class.getName());
+                                                        timer.cancel();
+                                                        NavHostFragment.findNavController(ChooseCabinetFragment.this)
+                                                                .navigate(R.id.action_chooseCabinetFragment_to_sendInfoConfirmFragment);
+                                                    } catch (RuntimeException e) {
+                                                        Log.e(TAG, "onResponse: InputInfoFragment页面获取SendInfoConfirmFragment传值错误! ", e);
+                                                        LoggingUtils.sendErrorLog("业务异常: InputInfoFragment页面获取SendInfoConfirmFragment传值错误! ", e);
+                                                    }
                                                 }
+                                            } else {
+                                                ICSPResponseCodeEnum.responseHint(getContext(), responseData);
+                                                RuntimeException exception = new RuntimeException("系统异常");
+                                                Log.e(TAG, "onResponse: ICSP返回码: " + responseData.getCode() + ", 返回信息: " + responseData.getMsg(), exception);
+                                                LoggingUtils.sendErrorLog("业务异常: ICSP返回码: " + responseData.getCode() + ", 返回信息: " + responseData.getMsg(), exception);
                                             }
                                         } else {
-                                            ICSPResponseCodeEnum.responseHint(getContext(), responseData);
-                                            RuntimeException exception = new RuntimeException("系统异常");
-                                            Log.e(TAG, "onResponse: ICSP返回码: " + responseData.getCode() + ", 返回信息: " + responseData.getMsg(), exception);
-                                            LoggingUtils.sendErrorLog("业务异常: ICSP返回码: " + responseData.getCode() + ", 返回信息: " + responseData.getMsg(), exception);
+                                            ToastUtils.make(getContext(), "服务器异常!请稍后重试!");
                                         }
                                     } catch (JsonProcessingException e) {
                                         Log.e(TAG, "onResponse: 预下单转换成JSON出错! ", e);

+ 44 - 36
app/src/main/java/com/emato/ich/fragment/ExceptionFragment.java

@@ -2,7 +2,7 @@ package com.emato.ich.fragment;
 
 import android.os.Bundle;
 import android.os.CountDownTimer;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -27,6 +27,7 @@ import com.emato.ich.utils.BaseUtils;
 import com.emato.ich.utils.ButtonUtils;
 import com.emato.ich.utils.JacksonUtils;
 import com.emato.ich.utils.LoggingUtils;
+import com.emato.ich.utils.StringUtils;
 import com.emato.ich.utils.TimeOutUtils;
 import com.emato.ich.utils.ToastUtils;
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -40,6 +41,9 @@ import okhttp3.Call;
 import okhttp3.Callback;
 import okhttp3.Response;
 
+/**
+ * 异常处理页面
+ */
 public class ExceptionFragment extends Fragment {
 
     private static final String TAG = ExceptionFragment.class.getName();
@@ -232,46 +236,50 @@ public class ExceptionFragment extends Fragment {
                                     ResponseData responseData = null;
                                     try {
                                         String parseResponse = ICSPClient.isSuccessfulAndParseResponse(response);
-                                        try {
-                                            responseData = objectMapper.readValue(parseResponse, ResponseData.class);
-                                            // TODO 处理异常
-                                            if (responseData != null && responseData.getCode().equals(ICSPResponseCodeEnum.OK.getCode())) {
-                                                String code = responseData.getCode();
-                                                Object data = responseData.getData();
-                                                Log.i(TAG, "onResponse: 响应码: " + code + ", 响应消息: " + responseData.getMsg());
-                                                switch (decisionEnum) {
-                                                    case CANCEL_11:
-                                                        // 未投递 取消
-                                                    case CANCEL_12:
-                                                        // 拿出快递 取消
-                                                        // 清空session, 跳转到主页
-                                                        LocalStorage.getInstance().cleanSession(((MainActivity) getActivity()));
-                                                        timer.cancel();
-                                                        NavHostFragment.findNavController(ExceptionFragment.this)
-                                                                .navigate(R.id.action_exceptionFragment_to_sendSuccessFragment);
-                                                        break;
-                                                    case REOPEN_01:
-                                                        // 大小不合适
+                                        if (!StringUtils.isNullOrEmpty(parseResponse)) {
+                                            try {
+                                                responseData = objectMapper.readValue(parseResponse, ResponseData.class);
+                                                // TODO 处理异常
+                                                if (responseData != null && responseData.getCode().equals(ICSPResponseCodeEnum.OK.getCode())) {
+                                                    String code = responseData.getCode();
+                                                    Object data = responseData.getData();
+                                                    Log.i(TAG, "onResponse: 响应码: " + code + ", 响应消息: " + responseData.getMsg());
+                                                    switch (decisionEnum) {
+                                                        case CANCEL_11:
+                                                            // 未投递 取消
+                                                        case CANCEL_12:
+                                                            // 拿出快递 取消
+                                                            // 清空session, 跳转到主页
+                                                            LocalStorage.getInstance().cleanSession(((MainActivity) getActivity()));
+                                                            timer.cancel();
+                                                            NavHostFragment.findNavController(ExceptionFragment.this)
+                                                                    .navigate(R.id.action_exceptionFragment_to_sendSuccessFragment);
+                                                            break;
+                                                        case REOPEN_01:
+                                                            // 大小不合适
 
-                                                        break;
-                                                    case REOPEN_02:
-                                                        // 门没开换柜门
+                                                            break;
+                                                        case REOPEN_02:
+                                                            // 门没开换柜门
 
-                                                        break;
-                                                    case REOPEN_03:
-                                                        // 门没开再开一次
+                                                            break;
+                                                        case REOPEN_03:
+                                                            // 门没开再开一次
 
-                                                        break;
-                                                    default:
-                                                        break;
+                                                            break;
+                                                        default:
+                                                            break;
+                                                    }
+                                                } else {
+                                                    ICSPResponseCodeEnum.responseHint(getContext(), responseData);
+                                                    Log.w(TAG, "onResponse: " + responseData.getMsg());
                                                 }
-                                            } else {
-                                                ICSPResponseCodeEnum.responseHint(getContext(), responseData);
-                                                Log.w(TAG, "onResponse: " + responseData.getMsg());
+                                            } catch (JsonProcessingException e) {
+                                                Log.e(TAG, "onResponse: 处理异常场景: " + decisionEnum.getMsg() + ", 解析响应信息时出错! ", e);
+                                                LoggingUtils.sendErrorLog("业务异常: 处理异常场景: " + decisionEnum.getMsg() + ", 解析响应信息时出错! ", e);
                                             }
-                                        } catch (JsonProcessingException e) {
-                                            Log.e(TAG, "onResponse: 处理异常场景: " + decisionEnum.getMsg() + ", 解析响应信息时出错! ", e);
-                                            LoggingUtils.sendErrorLog("业务异常: 处理异常场景: " + decisionEnum.getMsg() + ", 解析响应信息时出错! ", e);
+                                        } else {
+                                            ToastUtils.make(getContext(), "服务器异常!请稍后重试!");
                                         }
                                     } catch (RuntimeException e) {
                                         Log.e(TAG, "onResponse: 处理\"" + decisionEnum.getMsg() + "\"问题时出错! 返回码: " + responseData.getCode() + ", 错误消息: " + responseData.getMsg(), e);

+ 50 - 42
app/src/main/java/com/emato/ich/fragment/InputInfoFragment.java

@@ -3,7 +3,7 @@ package com.emato.ich.fragment;
 import android.os.Bundle;
 import android.os.CountDownTimer;
 import android.text.Editable;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -118,7 +118,7 @@ public class InputInfoFragment extends Fragment {
                         public void onFailure(@NotNull Call call, @NotNull IOException e) {
                             // 请求失败
                             Log.e(TAG, "onFailure: 请求oms获取手机号失败! 网络异常! ", e);
-                            LoggingUtils.sendErrorLog("请求oms获取手机号失败! 网络异常! ", e);
+                            LoggingUtils.sendErrorLog("业务异常: 请求oms获取手机号失败! 网络异常! ", e);
                             ToastUtils.make(getContext(), "服务器异常! 请手动输入!");
                             mailNoLock.set(1);
                         }
@@ -128,26 +128,30 @@ public class InputInfoFragment extends Fragment {
 
                             getActivity().runOnUiThread(() -> {
                                 String parseResponse = ICSPClient.isSuccessfulAndParseResponse(response);
-                                try {
-                                    ResponseData<PreparedOrderResponseVo> responseData = new ObjectMapper().readValue(parseResponse, new TypeReference<ResponseData<PreparedOrderResponseVo>>() {
-                                    });
-
-                                    PreparedOrderResponseVo data = responseData.getData();
-                                    if (null != responseData && ICSPResponseCodeEnum.OK.getCode().equals(responseData.getCode())) {
-                                        String collectorPhone = data.getCollectorPhone();
-                                        binding.delivererPhoneConfirm.setText(collectorPhone);
-                                    }
+                                if (!StringUtils.isNullOrEmpty(parseResponse)) {
+                                    try {
+                                        ResponseData<PreparedOrderResponseVo> responseData = new ObjectMapper().readValue(parseResponse, new TypeReference<ResponseData<PreparedOrderResponseVo>>() {
+                                        });
+
+                                        PreparedOrderResponseVo data = responseData.getData();
+                                        if (null != responseData && ICSPResponseCodeEnum.OK.getCode().equals(responseData.getCode())) {
+                                            String collectorPhone = data.getCollectorPhone();
+                                            binding.delivererPhoneConfirm.setText(collectorPhone);
+                                        }
 
-                                    ICSPResponseCodeEnum.responseHint(getContext(), responseData);
+                                        ICSPResponseCodeEnum.responseHint(getContext(), responseData);
 
-                                } catch (JsonProcessingException e) {
-                                    Log.e(TAG, "onResponse: 服务器响应错误! 自动获取用户手机号失败! ", e);
-                                    ToastUtils.make(getContext(), "网络异常! 请手动输入手机号! ");
-                                    LoggingUtils.sendErrorLog("业务异常: 服务器响应错误! 自动获取用户手机号失败! ", e);
-                                } catch (RuntimeException e) {
-                                    Log.e(TAG, "onResponse: 获取用户手机号未知错误! ", e);
-                                    ToastUtils.make(getContext(), "未查询到手机号! 请手动输入! ");
-                                    LoggingUtils.sendErrorLog("业务异常: 获取用户手机号未知错误! ", e);
+                                    } catch (JsonProcessingException e) {
+                                        Log.e(TAG, "onResponse: 服务器响应错误! 自动获取用户手机号失败! ", e);
+                                        ToastUtils.make(getContext(), "网络异常! 请手动输入手机号! ");
+                                        LoggingUtils.sendErrorLog("业务异常: 服务器响应错误! 自动获取用户手机号失败! ", e);
+                                    } catch (RuntimeException e) {
+                                        Log.e(TAG, "onResponse: 获取用户手机号未知错误! ", e);
+                                        ToastUtils.make(getContext(), "未查询到手机号! 请手动输入! ");
+                                        LoggingUtils.sendErrorLog("业务异常: 获取用户手机号未知错误! ", e);
+                                    }
+                                } else {
+                                    ToastUtils.make(getContext(), "服务器异常!请稍后重试!");
                                 }
                                 mailNoLock.set(1);
                             });
@@ -202,31 +206,35 @@ public class InputInfoFragment extends Fragment {
                             ((MainActivity) getActivity()).runOnUiThread(() -> {
                                 try {
                                     String responseStr = ICSPClient.isSuccessfulAndParseResponse(response);
-                                    ObjectMapper objectMapper = JacksonUtils.objectmapper;
-                                    ResponseData<PreparedOrderResponseVo> responseData = objectMapper.readValue(responseStr, new TypeReference<ResponseData<PreparedOrderResponseVo>>() {});
-                                    data = responseData.getData();
-                                    // 响应信息
-                                    if (responseData.getCode().equals(ICSPResponseCodeEnum.OK.getCode())) {
-                                        bundle.putString("preparedOrderResponse", objectMapper.writeValueAsString(data));
-                                        bundle.putString("takeNo", mailNo);
-                                        bundle.putString("sectionType", finalSectionType);
-
-                                        // 跳转到确认投递
-                                        try {
-                                            MainActivity activity = (MainActivity) getActivity();
-                                            activity.getBundleMap().put(InputInfoFragment.class.getName(), bundle);
-                                        } catch (RuntimeException e) {
-                                            Log.e(TAG, "onResponse: InputInfoFragment页面获取SendInfoConfirmFragment传值错误! ", e);
-                                            LoggingUtils.sendErrorLog("业务异常: InputInfoFragment页面获取SendInfoConfirmFragment传值错误! ", e);
+                                    if (!StringUtils.isNullOrEmpty(responseStr)) {
+                                        ObjectMapper objectMapper = JacksonUtils.objectmapper;
+                                        ResponseData<PreparedOrderResponseVo> responseData = objectMapper.readValue(responseStr, new TypeReference<ResponseData<PreparedOrderResponseVo>>() {});
+                                        data = responseData.getData();
+                                        // 响应信息
+                                        if (responseData.getCode().equals(ICSPResponseCodeEnum.OK.getCode())) {
+                                            bundle.putString("preparedOrderResponse", objectMapper.writeValueAsString(data));
+                                            bundle.putString("takeNo", mailNo);
+                                            bundle.putString("sectionType", finalSectionType);
+
+                                            // 跳转到确认投递
+                                            try {
+                                                MainActivity activity = (MainActivity) getActivity();
+                                                activity.getBundleMap().put(InputInfoFragment.class.getName(), bundle);
+                                            } catch (RuntimeException e) {
+                                                Log.e(TAG, "onResponse: InputInfoFragment页面获取SendInfoConfirmFragment传值错误! ", e);
+                                                LoggingUtils.sendErrorLog("业务异常: InputInfoFragment页面获取SendInfoConfirmFragment传值错误! ", e);
+                                            }
+                                            timer.cancel();
+                                            NavHostFragment.findNavController(InputInfoFragment.this).navigate(R.id.action_inputInfoFragment_to_sendInfoConfirmFragment);
+                                        } else {
+                                            RuntimeException exception = new RuntimeException("系统异常");
+                                            Log.e(TAG, "onResponse: ICSP返回码: " + responseData.getCode() + ", 返回信息: " + responseData.getMsg(), exception);
+                                            LoggingUtils.sendErrorLog("业务异常: ICSP返回码: " + responseData.getCode() + ", 返回信息: " + responseData.getMsg(), exception);
                                         }
-                                        timer.cancel();
-                                        NavHostFragment.findNavController(InputInfoFragment.this).navigate(R.id.action_inputInfoFragment_to_sendInfoConfirmFragment);
+                                        ToastUtils.make(getContext(), responseData.getMsg());
                                     } else {
-                                        RuntimeException exception = new RuntimeException("系统异常");
-                                        Log.e(TAG, "onResponse: ICSP返回码: " + responseData.getCode() + ", 返回信息: " + responseData.getMsg(), exception);
-                                        LoggingUtils.sendErrorLog("业务异常: ICSP返回码: " + responseData.getCode() + ", 返回信息: " + responseData.getMsg(), exception);
+                                        ToastUtils.make(getContext(), "服务器异常!请稍后重试!");
                                     }
-                                    ToastUtils.make(getContext(), responseData.getMsg());
                                 } catch (JsonProcessingException e) {
                                     Log.e(TAG, "onResponse: 预下单转换成JSON出错! ", e);
                                     LoggingUtils.sendErrorLog("业务异常: 预下单转换成JSON出错! ", e);

+ 4 - 1
app/src/main/java/com/emato/ich/fragment/MainFragment.java

@@ -2,7 +2,7 @@ package com.emato.ich.fragment;
 
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -29,6 +29,9 @@ import okhttp3.Call;
 import okhttp3.Callback;
 import okhttp3.Response;
 
+/**
+ * 主页
+ */
 public class MainFragment extends Fragment {
 
     private static final String TAG = MainFragment.class.getName();

+ 111 - 5
app/src/main/java/com/emato/ich/fragment/SendFragment.java

@@ -3,7 +3,7 @@ package com.emato.ich.fragment;
 import android.os.Bundle;
 import android.os.CountDownTimer;
 import android.text.Editable;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -42,6 +42,9 @@ import okhttp3.Call;
 import okhttp3.Callback;
 import okhttp3.Response;
 
+/**
+ * 投递员登录页面
+ */
 public class SendFragment extends Fragment {
 
     private static final String TAG = SendFragment.class.getName();
@@ -133,8 +136,7 @@ public class SendFragment extends Fragment {
                                 }
                             } else {
                                 // 登录失败
-                                ToastUtils.make(getContext(), "登录失败!手机号或密码错误!");
-                                LoggingUtils.sendErrorLog("业务异常: 登录失败!手机号或密码错误!", null);
+                                ToastUtils.make(getContext(), "服务异常!请稍后重试!");
                             }
                         });
                     }
@@ -164,42 +166,92 @@ public class SendFragment extends Fragment {
             binding.editTextTextPersonName4.setOnFocusChangeListener((view1, hasFocus) -> {
                 if (hasFocus) {
                     binding.inputButton0.setOnClickListener(v -> {
+                        int length = binding.editTextTextPersonName4.getText().length();
+                        if (length >= 11) {
+                            ToastUtils.make(getContext(), "手机号不能超过11位! ");
+                            return;
+                        }
                         int start = binding.editTextTextPersonName4.getSelectionStart();
                         binding.editTextTextPersonName4.getText().insert(start, "0");
                     });
                     binding.inputButton1.setOnClickListener(v -> {
+                        int length = binding.editTextTextPersonName4.getText().length();
+                        if (length >= 11) {
+                            ToastUtils.make(getContext(), "手机号不能超过11位! ");
+                            return;
+                        }
                         int start = binding.editTextTextPersonName4.getSelectionStart();
                         binding.editTextTextPersonName4.getText().insert(start, "1");
                     });
                     binding.inputButton2.setOnClickListener(v -> {
+                        int length = binding.editTextTextPersonName4.getText().length();
+                        if (length >= 11) {
+                            ToastUtils.make(getContext(), "手机号不能超过11位! ");
+                            return;
+                        }
                         int start = binding.editTextTextPersonName4.getSelectionStart();
                         binding.editTextTextPersonName4.getText().insert(start, "2");
                     });
                     binding.inputButton3.setOnClickListener(v -> {
+                        int length = binding.editTextTextPersonName4.getText().length();
+                        if (length >= 11) {
+                            ToastUtils.make(getContext(), "手机号不能超过11位! ");
+                            return;
+                        }
                         int start = binding.editTextTextPersonName4.getSelectionStart();
                         binding.editTextTextPersonName4.getText().insert(start, "3");
                     });
                     binding.inputButton4.setOnClickListener(v -> {
+                        int length = binding.editTextTextPersonName4.getText().length();
+                        if (length >= 11) {
+                            ToastUtils.make(getContext(), "手机号不能超过11位! ");
+                            return;
+                        }
                         int start = binding.editTextTextPersonName4.getSelectionStart();
                         binding.editTextTextPersonName4.getText().insert(start, "4");
                     });
                     binding.inputButton5.setOnClickListener(v -> {
+                        int length = binding.editTextTextPersonName4.getText().length();
+                        if (length >= 11) {
+                            ToastUtils.make(getContext(), "手机号不能超过11位! ");
+                            return;
+                        }
                         int start = binding.editTextTextPersonName4.getSelectionStart();
                         binding.editTextTextPersonName4.getText().insert(start, "5");
                     });
                     binding.inputButton6.setOnClickListener(v -> {
+                        int length = binding.editTextTextPersonName4.getText().length();
+                        if (length >= 11) {
+                            ToastUtils.make(getContext(), "手机号不能超过11位! ");
+                            return;
+                        }
                         int start = binding.editTextTextPersonName4.getSelectionStart();
                         binding.editTextTextPersonName4.getText().insert(start, "6");
                     });
                     binding.inputButton7.setOnClickListener(v -> {
+                        int length = binding.editTextTextPersonName4.getText().length();
+                        if (length >= 11) {
+                            ToastUtils.make(getContext(), "手机号不能超过11位! ");
+                            return;
+                        }
                         int start = binding.editTextTextPersonName4.getSelectionStart();
                         binding.editTextTextPersonName4.getText().insert(start, "7");
                     });
                     binding.inputButton8.setOnClickListener(v -> {
+                        int length = binding.editTextTextPersonName4.getText().length();
+                        if (length >= 11) {
+                            ToastUtils.make(getContext(), "手机号不能超过11位! ");
+                            return;
+                        }
                         int start = binding.editTextTextPersonName4.getSelectionStart();
                         binding.editTextTextPersonName4.getText().insert(start, "8");
                     });
                     binding.inputButton9.setOnClickListener(v -> {
+                        int length = binding.editTextTextPersonName4.getText().length();
+                        if (length >= 11) {
+                            ToastUtils.make(getContext(), "手机号不能超过11位! ");
+                            return;
+                        }
                         int start = binding.editTextTextPersonName4.getSelectionStart();
                         binding.editTextTextPersonName4.getText().insert(start, "9");
                     });
@@ -213,7 +265,7 @@ public class SendFragment extends Fragment {
                     });
                     // 长按删除
                     binding.inputButtonCancel.setOnLongClickListener(v -> {
-                        binding.editTextTextPersonName5.getText().clear();
+                        binding.editTextTextPersonName4.getText().clear();
                         return false;
                     });
                 }
@@ -224,42 +276,92 @@ public class SendFragment extends Fragment {
         binding.editTextTextPersonName5.setOnFocusChangeListener((view1, hasFocus) -> {
             if (hasFocus) {
                 binding.inputButton0.setOnClickListener(v -> {
+                    int length = binding.editTextTextPersonName5.getText().length();
+                    if (length >= 16) {
+                        ToastUtils.make(getContext(), "密码最多不能超过16位! ");
+                        return;
+                    }
                     int start = binding.editTextTextPersonName5.getSelectionStart();
                     binding.editTextTextPersonName5.getText().insert(start, "0");
                 });
                 binding.inputButton1.setOnClickListener(v -> {
+                    int length = binding.editTextTextPersonName5.getText().length();
+                    if (length >= 16) {
+                        ToastUtils.make(getContext(), "密码最多不能超过16位! ");
+                        return;
+                    }
                     int start = binding.editTextTextPersonName5.getSelectionStart();
                     binding.editTextTextPersonName5.getText().insert(start, "1");
                 });
                 binding.inputButton2.setOnClickListener(v -> {
+                    int length = binding.editTextTextPersonName5.getText().length();
+                    if (length >= 16) {
+                        ToastUtils.make(getContext(), "密码最多不能超过16位! ");
+                        return;
+                    }
                     int start = binding.editTextTextPersonName5.getSelectionStart();
                     binding.editTextTextPersonName5.getText().insert(start, "2");
                 });
                 binding.inputButton3.setOnClickListener(v -> {
+                    int length = binding.editTextTextPersonName5.getText().length();
+                    if (length >= 16) {
+                        ToastUtils.make(getContext(), "密码最多不能超过16位! ");
+                        return;
+                    }
                     int start = binding.editTextTextPersonName5.getSelectionStart();
                     binding.editTextTextPersonName5.getText().insert(start, "3");
                 });
                 binding.inputButton4.setOnClickListener(v -> {
+                    int length = binding.editTextTextPersonName5.getText().length();
+                    if (length >= 16) {
+                        ToastUtils.make(getContext(), "密码最多不能超过16位! ");
+                        return;
+                    }
                     int start = binding.editTextTextPersonName5.getSelectionStart();
                     binding.editTextTextPersonName5.getText().insert(start, "4");
                 });
                 binding.inputButton5.setOnClickListener(v -> {
+                    int length = binding.editTextTextPersonName5.getText().length();
+                    if (length >= 16) {
+                        ToastUtils.make(getContext(), "密码最多不能超过16位! ");
+                        return;
+                    }
                     int start = binding.editTextTextPersonName5.getSelectionStart();
                     binding.editTextTextPersonName5.getText().insert(start, "5");
                 });
                 binding.inputButton6.setOnClickListener(v -> {
+                    int length = binding.editTextTextPersonName5.getText().length();
+                    if (length >= 16) {
+                        ToastUtils.make(getContext(), "密码最多不能超过16位! ");
+                        return;
+                    }
                     int start = binding.editTextTextPersonName5.getSelectionStart();
                     binding.editTextTextPersonName5.getText().insert(start, "6");
                 });
                 binding.inputButton7.setOnClickListener(v -> {
+                    int length = binding.editTextTextPersonName5.getText().length();
+                    if (length >= 16) {
+                        ToastUtils.make(getContext(), "密码最多不能超过16位! ");
+                        return;
+                    }
                     int start = binding.editTextTextPersonName5.getSelectionStart();
                     binding.editTextTextPersonName5.getText().insert(start, "7");
                 });
                 binding.inputButton8.setOnClickListener(v -> {
+                    int length = binding.editTextTextPersonName5.getText().length();
+                    if (length >= 16) {
+                        ToastUtils.make(getContext(), "密码最多不能超过16位! ");
+                        return;
+                    }
                     int start = binding.editTextTextPersonName5.getSelectionStart();
                     binding.editTextTextPersonName5.getText().insert(start, "8");
                 });
                 binding.inputButton9.setOnClickListener(v -> {
+                    int length = binding.editTextTextPersonName5.getText().length();
+                    if (length >= 16) {
+                        ToastUtils.make(getContext(), "密码最多不能超过16位! ");
+                        return;
+                    }
                     int start = binding.editTextTextPersonName5.getSelectionStart();
                     binding.editTextTextPersonName5.getText().insert(start, "9");
                 });
@@ -290,7 +392,11 @@ public class SendFragment extends Fragment {
 
 
         // 默认选中密码输入
-        binding.editTextTextPersonName5.requestFocus();
+        if (!StringUtils.isNullOrEmpty(binding.editTextTextPersonName4.getText().toString())) {
+            binding.editTextTextPersonName5.requestFocus();
+        } else {
+            binding.editTextTextPersonName4.requestFocus();
+        }
     }
 
     @Override

+ 29 - 21
app/src/main/java/com/emato/ich/fragment/SendInfoConfirmFragment.java

@@ -3,7 +3,7 @@ package com.emato.ich.fragment;
 import android.app.AlertDialog;
 import android.os.Bundle;
 import android.os.CountDownTimer;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -27,6 +27,7 @@ import com.emato.ich.utils.BaseUtils;
 import com.emato.ich.utils.ButtonUtils;
 import com.emato.ich.utils.JacksonUtils;
 import com.emato.ich.utils.LoggingUtils;
+import com.emato.ich.utils.StringUtils;
 import com.emato.ich.utils.TimeOutUtils;
 import com.emato.ich.utils.ToastUtils;
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -40,6 +41,9 @@ import okhttp3.Call;
 import okhttp3.Callback;
 import okhttp3.Response;
 
+/**
+ * 投递信息确认页面
+ */
 public class SendInfoConfirmFragment extends Fragment {
 
     private FragmentSendInfoConfirmBinding binding;
@@ -129,27 +133,31 @@ public class SendInfoConfirmFragment extends Fragment {
                 public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
                     getActivity().runOnUiThread(() -> {
                         String parseResponse = ICSPClient.isSuccessfulAndParseResponse(response);
-                        ObjectMapper objectMapper = JacksonUtils.objectmapper;
-                        try {
-                            ResponseData responseData = objectMapper.readValue(parseResponse, ResponseData.class);
-                            String code = responseData.getCode();
-                            if (code.equals(ICSPResponseCodeEnum.OK.getCode())) {
-                                // TODO 确认投递成功逻辑处理
-                                ToastUtils.make(getContext(), "投递成功!");
-                                timer.cancel();
-                                NavHostFragment.findNavController(SendInfoConfirmFragment.this)
-                                        .navigate(R.id.action_sendInfoConfirmFragment_to_sendSuccessFragment);
-                            } else {
-                                // TODO 确认投递失败逻辑处理
-                                ToastUtils.make(getContext(), responseData.getMsg());
-                                Log.w(TAG, "onResponse: " + responseData.getMsg());
+                        if (!StringUtils.isNullOrEmpty(parseResponse)) {
+                            ObjectMapper objectMapper = JacksonUtils.objectmapper;
+                            try {
+                                ResponseData responseData = objectMapper.readValue(parseResponse, ResponseData.class);
+                                String code = responseData.getCode();
+                                if (code.equals(ICSPResponseCodeEnum.OK.getCode())) {
+                                    // TODO 确认投递成功逻辑处理
+                                    ToastUtils.make(getContext(), "投递成功!");
+                                    timer.cancel();
+                                    NavHostFragment.findNavController(SendInfoConfirmFragment.this)
+                                            .navigate(R.id.action_sendInfoConfirmFragment_to_sendSuccessFragment);
+                                } else {
+                                    // TODO 确认投递失败逻辑处理
+                                    ToastUtils.make(getContext(), responseData.getMsg());
+                                    Log.w(TAG, "onResponse: " + responseData.getMsg());
+                                }
+                            } catch (JsonProcessingException e) {
+                                Log.e(TAG, "onResponse: 确认投递解析响应信息失败!", e);
+                                LoggingUtils.sendErrorLog("业务异常: 确认投递解析响应信息失败! ", e);
+                            } catch (RuntimeException e) {
+                                Log.e(TAG, "onResponse: 投递失败! ", e);
+                                LoggingUtils.sendErrorLog("业务异常: 投递失败! 未知异常! ", e);
                             }
-                        } catch (JsonProcessingException e) {
-                            Log.e(TAG, "onResponse: 确认投递解析响应信息失败!", e);
-                            LoggingUtils.sendErrorLog("业务异常: 确认投递解析响应信息失败! ", e);
-                        } catch (RuntimeException e) {
-                            Log.e(TAG, "onResponse: 投递失败! ", e);
-                            LoggingUtils.sendErrorLog("业务异常: 投递失败! 未知异常! ", e);
+                        } else {
+                            ToastUtils.make(getContext(), "服务器异常! 请稍后重试!");
                         }
                     });
                 }

+ 4 - 1
app/src/main/java/com/emato/ich/fragment/SendMainFragment.java

@@ -2,7 +2,7 @@ package com.emato.ich.fragment;
 
 import android.os.Bundle;
 import android.os.CountDownTimer;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -21,6 +21,9 @@ import com.emato.ich.utils.TimeOutUtils;
 
 import org.jetbrains.annotations.NotNull;
 
+/**
+ * 投递员主页
+ */
 public class SendMainFragment extends Fragment {
 
     private FragmentSendMainBinding binding;

+ 4 - 1
app/src/main/java/com/emato/ich/fragment/SendSuccessFragment.java

@@ -2,7 +2,7 @@ package com.emato.ich.fragment;
 
 import android.os.Bundle;
 import android.os.CountDownTimer;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -22,6 +22,9 @@ import com.emato.ich.utils.TimeOutUtils;
 
 import org.jetbrains.annotations.NotNull;
 
+/**
+ * 投递成功页面
+ */
 public class SendSuccessFragment extends Fragment {
 
     private static final String TAG = SendSuccessFragment.class.getName();

+ 32 - 28
app/src/main/java/com/emato/ich/fragment/TakeCodeFragment.java

@@ -4,7 +4,7 @@ import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.CountDownTimer;
 import android.text.Editable;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 import android.view.Gravity;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -245,36 +245,40 @@ public class TakeCodeFragment extends Fragment {
                         // TODO 返回锁板和锁id, 开柜门
                         getActivity().runOnUiThread(() -> {
                             String parseResponse = ICSPClient.isSuccessfulAndParseResponse(response);
-                            try {
-                                ObjectMapper objectMapper = JacksonUtils.objectmapper;
-                                ResponseData<PreparedOrderResponseVo> responseData = null;
+                            if (!StringUtils.isNullOrEmpty(parseResponse)) {
                                 try {
-                                    responseData = objectMapper.readValue(parseResponse, new TypeReference<ResponseData<PreparedOrderResponseVo>>() {
-                                    });
-                                    ToastUtils.make(getContext(), responseData.getMsg());
-                                } catch (JsonProcessingException e) {
-                                    Log.e(TAG, "onResponse: 解析取件开门响应信息失败! ", e);
-                                    LoggingUtils.sendErrorLog("业务异常: 解析取件开门响应信息失败! ", e);
+                                    ObjectMapper objectMapper = JacksonUtils.objectmapper;
+                                    ResponseData<PreparedOrderResponseVo> responseData = null;
+                                    try {
+                                        responseData = objectMapper.readValue(parseResponse, new TypeReference<ResponseData<PreparedOrderResponseVo>>() {
+                                        });
+                                        ToastUtils.make(getContext(), responseData.getMsg());
+                                    } catch (JsonProcessingException e) {
+                                        Log.e(TAG, "onResponse: 解析取件开门响应信息失败! ", e);
+                                        LoggingUtils.sendErrorLog("业务异常: 解析取件开门响应信息失败! ", e);
+                                    } catch (RuntimeException e) {
+                                        Log.e(TAG, "onResponse: 未知错误! ", e);
+                                        ToastUtils.make(getContext(), "未知错误!");
+                                        LoggingUtils.sendErrorLog("业务异常: 解析取件开门响应信息失败! 未知错误!  ", e);
+                                    }
+                                    if (null != responseData && responseData.getCode().equals(ICSPResponseCodeEnum.OK.getCode())) {
+                                        // 开门
+                                        Log.i(TAG, "onResponse: 取件成功! ");
+                                        ToastUtils.make(getContext(), "取件成功!");
+                                        Bundle bundle = new Bundle();
+                                        bundle.putString("takeParcelCode", takeParcelCode);
+                                        bundle.putString("takeCabinetNo", responseData.getData().getLockerName());
+                                        ((MainActivity) getActivity()).getBundleMap().put(TakeCodeFragment.class.getName(), bundle);
+                                        timer.cancel();
+                                        NavHostFragment.findNavController(TakeCodeFragment.this).navigate(R.id.action_takeCodeFragment_to_takeSuccessFragment);
+                                    }
                                 } catch (RuntimeException e) {
-                                    Log.e(TAG, "onResponse: 未知错误! ", e);
-                                    ToastUtils.make(getContext(), "未知错误!");
-                                    LoggingUtils.sendErrorLog("业务异常: 解析取件开门响应信息失败! 未知错误!  ", e);
+                                    Log.e(TAG, "onResponse: 取件失败! ", e);
+                                    ToastUtils.make(getContext(), "取件失败!");
+                                    LoggingUtils.sendErrorLog("业务异常: 取件失败! ", e);
                                 }
-                                if (null != responseData && responseData.getCode().equals(ICSPResponseCodeEnum.OK.getCode())) {
-                                    // 开门
-                                    Log.i(TAG, "onResponse: 取件成功! ");
-                                    ToastUtils.make(getContext(), "取件成功!");
-                                    Bundle bundle = new Bundle();
-                                    bundle.putString("takeParcelCode", takeParcelCode);
-                                    bundle.putString("takeCabinetNo", responseData.getData().getLockerName());
-                                    ((MainActivity) getActivity()).getBundleMap().put(TakeCodeFragment.class.getName(), bundle);
-                                    timer.cancel();
-                                    NavHostFragment.findNavController(TakeCodeFragment.this).navigate(R.id.action_takeCodeFragment_to_takeSuccessFragment);
-                                }
-                            } catch (RuntimeException e) {
-                                Log.e(TAG, "onResponse: 取件失败! ", e);
-                                ToastUtils.make(getContext(), "取件失败!");
-                                LoggingUtils.sendErrorLog("业务异常: 取件失败! ", e);
+                            } else {
+                                ToastUtils.make(getContext(), "服务器异常! 请稍后重试!");
                             }
                         });
                     }

+ 1 - 1
app/src/main/java/com/emato/ich/fragment/TakeFragment.java

@@ -3,7 +3,7 @@ package com.emato.ich.fragment;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.CountDownTimer;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;

+ 35 - 27
app/src/main/java/com/emato/ich/fragment/TakeSuccessFragment.java

@@ -2,7 +2,7 @@ package com.emato.ich.fragment;
 
 import android.os.Bundle;
 import android.os.CountDownTimer;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -26,6 +26,7 @@ import com.emato.ich.utils.BaseUtils;
 import com.emato.ich.utils.ButtonUtils;
 import com.emato.ich.utils.JacksonUtils;
 import com.emato.ich.utils.LoggingUtils;
+import com.emato.ich.utils.StringUtils;
 import com.emato.ich.utils.TimeOutUtils;
 import com.emato.ich.utils.ToastUtils;
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -40,6 +41,9 @@ import okhttp3.Call;
 import okhttp3.Callback;
 import okhttp3.Response;
 
+/**
+ * 取件成功提示页面
+ */
 public class TakeSuccessFragment extends Fragment {
 
     private static final String TAG = TakeSuccessFragment.class.getName();
@@ -154,35 +158,39 @@ public class TakeSuccessFragment extends Fragment {
                     // TODO 返回锁板和锁id, 开柜门
                     getActivity().runOnUiThread(() -> {
                         String parseResponse = ICSPClient.isSuccessfulAndParseResponse(response);
-                        try {
-                            ObjectMapper objectMapper = JacksonUtils.objectmapper;
-                            ResponseData<PreparedOrderResponseVo> responseData = null;
+                        if (!StringUtils.isNullOrEmpty(parseResponse)) {
                             try {
-                                responseData = objectMapper.readValue(parseResponse, new TypeReference<ResponseData<PreparedOrderResponseVo>>() {
-                                });
-                                ToastUtils.make(getContext(), responseData.getMsg());
-                            } catch (JsonProcessingException e) {
-                                Log.e(TAG, "onResponse: 解析取件开门响应信息失败! ", e);
-                                LoggingUtils.sendErrorLog("业务异常: 解析取件开门响应信息失败! ", e);
+                                ObjectMapper objectMapper = JacksonUtils.objectmapper;
+                                ResponseData<PreparedOrderResponseVo> responseData = null;
+                                try {
+                                    responseData = objectMapper.readValue(parseResponse, new TypeReference<ResponseData<PreparedOrderResponseVo>>() {
+                                    });
+                                    ToastUtils.make(getContext(), responseData.getMsg());
+                                } catch (JsonProcessingException e) {
+                                    Log.e(TAG, "onResponse: 解析取件开门响应信息失败! ", e);
+                                    LoggingUtils.sendErrorLog("业务异常: 解析取件开门响应信息失败! ", e);
+                                } catch (RuntimeException e) {
+                                    Log.e(TAG, "onResponse: 未知错误! ", e);
+                                    ToastUtils.make(getContext(), "未知错误!");
+                                    LoggingUtils.sendErrorLog("业务异常: 解析取件开门响应信息失败! 未知错误! ", e);
+                                }
+                                if (null != responseData && responseData.getCode().equals(ICSPResponseCodeEnum.OK.getCode())) {
+                                    // 开门
+                                    Log.i(TAG, "onResponse: 取件成功! ");
+                                    ToastUtils.make(getContext(), "取件成功!");
+                                    PreparedOrderResponseVo data = responseData.getData();
+                                    binding.openCabinetHintNo.setText(data.getLockerName());
+                                    finalActivity.getBundleMap().remove(TakeCodeFragment.class.getName());
+                                } else {
+                                    ToastUtils.make(getContext(), responseData.getMsg());
+                                }
                             } catch (RuntimeException e) {
-                                Log.e(TAG, "onResponse: 未知错误! ", e);
-                                ToastUtils.make(getContext(), "未知错误!");
-                                LoggingUtils.sendErrorLog("业务异常: 解析取件开门响应信息失败! 未知错误! ", e);
+                                Log.e(TAG, "onResponse: 取件失败! ", e);
+                                ToastUtils.make(getContext(), "取件失败!");
+                                LoggingUtils.sendErrorLog("业务异常: 取件失败! 未知错误! ", e);
                             }
-                            if (null != responseData && responseData.getCode().equals(ICSPResponseCodeEnum.OK.getCode())) {
-                                // 开门
-                                Log.i(TAG, "onResponse: 取件成功! ");
-                                ToastUtils.make(getContext(), "取件成功!");
-                                PreparedOrderResponseVo data = responseData.getData();
-                                binding.openCabinetHintNo.setText(data.getLockerName());
-                                finalActivity.getBundleMap().remove(TakeCodeFragment.class.getName());
-                            } else {
-                                ToastUtils.make(getContext(), responseData.getMsg());
-                            }
-                        } catch (RuntimeException e) {
-                            Log.e(TAG, "onResponse: 取件失败! ", e);
-                            ToastUtils.make(getContext(), "取件失败!");
-                            LoggingUtils.sendErrorLog("业务异常: 取件失败! 未知错误! ", e);
+                        } else {
+                            ToastUtils.make(getContext(), "服务器异常! 请稍后重试!");
                         }
                     });
                 }

+ 4 - 1
app/src/main/java/com/emato/ich/local/LocalStorage.java

@@ -8,6 +8,9 @@ import com.emato.ich.utils.StringUtils;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
+/**
+ * 本地SESSION
+ */
 public class LocalStorage {
 
     private final Session SESSION = new Session();
@@ -71,7 +74,7 @@ public class LocalStorage {
 
         private long time;
 
-        private int expiryTime = 15;
+        private int expiryTime = 30;
 
         /**
          * 新增字段 只能做一次异常处理, 点击异常处理的 异常事件按钮 后该值为false

+ 1 - 1
app/src/main/java/com/emato/ich/message/ICHPublishClient.java

@@ -1,6 +1,6 @@
 package com.emato.ich.message;
 
-import android.util.Log;
+import com.emato.ich.utils.Log;
 
 import com.emato.ich.contant.ICSPConstant;
 import com.emato.ich.utils.BaseUtils;

+ 1 - 1
app/src/main/java/com/emato/ich/message/ICHSubscribeClient.java

@@ -1,6 +1,6 @@
 package com.emato.ich.message;
 
-import android.util.Log;
+import com.emato.ich.utils.Log;
 
 import com.emato.ich.contant.ICSPConstant;
 import com.emato.ich.utils.BaseUtils;

+ 3 - 1
app/src/main/java/com/emato/ich/message/ICHTopic.java

@@ -1,6 +1,8 @@
 package com.emato.ich.message;
 
-// ICH项目需要的topic
+/**
+ * ICH项目需要的topic
+ */
 public class ICHTopic {
 
     public static String CLIENT_ID = "";

+ 1 - 0
app/src/main/java/com/emato/ich/service/MqttMessageService.java

@@ -1,6 +1,7 @@
 package com.emato.ich.service;
 
 //
+@Deprecated
 public class MqttMessageService {
 
 

+ 12 - 8
app/src/main/java/com/emato/ich/update/APKAutoUpdate.java

@@ -6,7 +6,7 @@ import android.content.Intent;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageInstaller;
 import android.content.pm.PackageManager;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -14,6 +14,10 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
+/**
+ * 自动安装类
+ */
+@Deprecated
 public class APKAutoUpdate {
 
     private static final String TAG = APKAutoUpdate.class.getName();
@@ -23,7 +27,7 @@ public class APKAutoUpdate {
      * 全部替换安装
      * @return
      */
-    public static Boolean installApk(Context mContext, String apkFilePath, OnInstallListener listener) {
+    public static Boolean installApk(Context mContext, String apkFilePath, InstallListener listener) {
         File apkFile = new File(apkFilePath);
         if (!apkFile.exists()) {
             return null;
@@ -34,7 +38,7 @@ public class APKAutoUpdate {
             String packageName = packageInfo.packageName;
             int versionCode = packageInfo.versionCode;
             String versionName = packageInfo.versionName;
-            Log.d(TAG, "packageName=" + packageName + ", versionCode=" + versionCode + ", versionName=" + versionName);
+            Log.i(TAG, "packageName=" + packageName + ", versionCode=" + versionCode + ", versionName=" + versionName);
         }
 
         PackageInstaller packageInstaller = mContext.getPackageManager().getPackageInstaller();
@@ -50,10 +54,10 @@ public class APKAutoUpdate {
             e.printStackTrace();
         }
 
-        Log.d(TAG, "sessionId---->" + mSessionId);
+        Log.i(TAG, "sessionId---->" + mSessionId);
         if (mSessionId != -1) {
             boolean copySuccess = onTransformApkFile(mContext, apkFilePath, mSessionId, listener);
-            Log.d(TAG, "copySuccess---->" + copySuccess);
+            Log.i(TAG, "copySuccess---->" + copySuccess);
             if (copySuccess) {
                 execInstallAPP(mContext, mSessionId, listener);
             }
@@ -69,7 +73,7 @@ public class APKAutoUpdate {
      * @param apkFilePath
      * @return
      */
-    private static boolean onTransformApkFile(Context mContext, String apkFilePath, int mSessionId, OnInstallListener listener) {
+    private static boolean onTransformApkFile(Context mContext, String apkFilePath, int mSessionId, InstallListener listener) {
         InputStream in = null;
         OutputStream out = null;
         PackageInstaller.Session session = null;
@@ -86,7 +90,7 @@ public class APKAutoUpdate {
                 out.write(buffer, 0, c);
             }
             session.fsync(out);
-            Log.d(TAG, "streamed " + total + " bytes");
+            Log.i(TAG, "streamed " + total + " bytes");
             success = true;
         } catch (IOException e) {
             e.printStackTrace();
@@ -113,7 +117,7 @@ public class APKAutoUpdate {
      * 执行安装并通知安装结果
      *
      */
-    private static void execInstallAPP(Context mContext, int mSessionId, OnInstallListener listener) {
+    private static void execInstallAPP(Context mContext, int mSessionId, InstallListener listener) {
         PackageInstaller.Session session = null;
         try {
             session = mContext.getPackageManager().getPackageInstaller().openSession(mSessionId);

+ 7 - 2
app/src/main/java/com/emato/ich/update/APKUpdateDownload.java

@@ -3,7 +3,7 @@ package com.emato.ich.update;
 
 import android.app.Activity;
 import android.content.Context;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 
 import com.emato.ich.api.ICSPClient;
 import com.emato.ich.utils.BaseUtils;
@@ -21,6 +21,11 @@ import okhttp3.Call;
 import okhttp3.Callback;
 import okhttp3.Response;
 
+/**
+ * 自动更新下载类
+ * 已废弃
+ */
+@Deprecated
 public class APKUpdateDownload {
 
     private static final String TAG = APKUpdateDownload.class.getName();
@@ -46,7 +51,7 @@ public class APKUpdateDownload {
                 // 文件路径
                 String absolutePath = file.getAbsolutePath();
                 // 需要自动安装并重启
-                APKAutoUpdate.installApk(context, absolutePath, new OnInstallListener() {
+                APKAutoUpdate.installApk(context, absolutePath, new InstallListener() {
                     @Override
                     public void onInstallException(Exception e) {
                         Log.e(TAG, "onInstallException: 安装出现异常! " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()), e);

+ 5 - 1
app/src/main/java/com/emato/ich/update/CustomUpdateConfigProvider.java

@@ -1,7 +1,7 @@
 package com.emato.ich.update;
 
 import android.content.Context;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 
 import androidx.annotation.NonNull;
 
@@ -12,6 +12,9 @@ import com.xuexiang.xupdate.utils.UpdateUtils;
 
 import org.jetbrains.annotations.NotNull;
 
+/**
+ * 自定义的XUpdate配置提供者
+ */
 public class CustomUpdateConfigProvider implements IUpdateConfigProvider {
 
     private static final String TAG = CustomUpdateConfigProvider.class.getName();
@@ -27,6 +30,7 @@ public class CustomUpdateConfigProvider implements IUpdateConfigProvider {
                 .setIsAutoMode(true)                                                  // 设置自动更新
                 .setParam("versionCode", UpdateUtils.getVersionCode(context))         // 设置默认公共请求参数
                 .setParam("appKey", context.getPackageName())
+                .setOnInstallListener(new PackageManagerCompat())                     // 自定义的下载器
                 .setOnUpdateFailureListener(error -> {
                     Log.i(TAG, "onCreate: =====================>自动更新失败! " + error.getCode() + ", " + error.getDetailMsg());
                 })

+ 4 - 1
app/src/main/java/com/emato/ich/update/OnInstallListener.java → app/src/main/java/com/emato/ich/update/InstallListener.java

@@ -1,6 +1,9 @@
 package com.emato.ich.update;
 
-public interface OnInstallListener {
+/**
+ * 安装回调
+ */
+public interface InstallListener {
 
     /**
      * 安装异常回调

+ 5 - 2
app/src/main/java/com/emato/ich/update/InstallResultReceiver.java

@@ -7,14 +7,17 @@ import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageInstaller;
 import android.os.Build;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 
+/**
+ * 接收安装成功后的广播接收器
+ */
 public class InstallResultReceiver extends BroadcastReceiver {
 
     private static final String TAG = InstallResultReceiver.class.getName();
     @Override
     public void onReceive(Context context, Intent intent) {
-        Log.d(TAG, "onReceive: "+intent.getIntExtra(PackageInstaller.EXTRA_STATUS,PackageInstaller.STATUS_FAILURE));
+        Log.i(TAG, "onReceive: "+intent.getIntExtra(PackageInstaller.EXTRA_STATUS,PackageInstaller.STATUS_FAILURE));
 
         Intent intent1 = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
         PendingIntent restartIntent = PendingIntent.getActivity(context, 0, intent1, PendingIntent.FLAG_ONE_SHOT);

+ 5 - 0
app/src/main/java/com/emato/ich/update/OnDownloadListener.java

@@ -2,6 +2,11 @@ package com.emato.ich.update;
 
 import java.io.File;
 
+/**
+ * 下载回调
+ * 已废弃
+ */
+@Deprecated
 public interface OnDownloadListener {
 
     /**

+ 41 - 7
app/src/main/java/com/emato/ich/update/PackageManagerCompat.java

@@ -9,12 +9,18 @@ import android.content.pm.PackageInstaller;
 import android.content.pm.PackageManager;
 import android.net.Uri;
 import android.os.Build;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 
+import androidx.annotation.NonNull;
 import androidx.annotation.RequiresApi;
 
 import com.emato.ich.MainActivity;
 import com.emato.ich.utils.LoggingUtils;
+import com.emato.ich.utils.StringUtils;
+import com.xuexiang.xupdate.entity.DownloadEntity;
+import com.xuexiang.xupdate.listener.OnInstallListener;
+
+import org.jetbrains.annotations.NotNull;
 
 import java.io.BufferedReader;
 import java.io.Closeable;
@@ -28,8 +34,12 @@ import java.io.OutputStream;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.concurrent.atomic.AtomicBoolean;
 
-public class PackageManagerCompat {
+/**
+ * 自定义的安装类
+ */
+public class PackageManagerCompat implements OnInstallListener {
 
     private static final String TAG = PackageManagerCompat.class.getName();
 
@@ -57,7 +67,7 @@ public class PackageManagerCompat {
     }*/
 
     @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
-    public static void install(Context context, String apkFilePath, PackageManager packageManager, OnInstallListener listener) {
+    public static void install(Context context, String apkFilePath, PackageManager packageManager, InstallListener listener) {
         try {
             Log.i(TAG, "install: 应用程序开始安装! " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
             File apkFile = new File(apkFilePath);
@@ -95,7 +105,7 @@ public class PackageManagerCompat {
 
     @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
     private static boolean copyInstallFile(PackageInstaller packageInstaller,
-                                           int sessionId, String apkFilePath, OnInstallListener listener) {
+                                           int sessionId, String apkFilePath, InstallListener listener) {
         InputStream in = null;
         OutputStream out = null;
         PackageInstaller.Session session = null;
@@ -124,7 +134,7 @@ public class PackageManagerCompat {
     }
 
     @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
-    private static void execInstallCommand(Context context, PackageInstaller packageInstaller, int sessionId, OnInstallListener listener) {
+    private static void execInstallCommand(Context context, PackageInstaller packageInstaller, int sessionId, InstallListener listener) {
         PackageInstaller.Session session = null;
         try {
             session = packageInstaller.openSession(sessionId);
@@ -138,7 +148,7 @@ public class PackageManagerCompat {
             closeQuietly(session, listener);
         }
     }
-    private static void closeQuietly(Closeable c, OnInstallListener listener) {
+    private static void closeQuietly(Closeable c, InstallListener listener) {
         if (c != null) {
             try {
                 c.close();
@@ -155,7 +165,7 @@ public class PackageManagerCompat {
         Log.i(TAG, "restartApp: 应用程序重启中! 日期=====>" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
         try {
             Intent intent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
-            if (intent.getAction().equals("android.intent.action.PACKAGE_REPLACED")) {
+            if (intent != null && !StringUtils.isNullOrEmpty(intent.getAction()) && intent.getAction().equals("android.intent.action.PACKAGE_REPLACED")) {
                 Intent intent1 = new Intent(context, MainActivity.class);
                 intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 context.startActivity(intent1);
@@ -177,4 +187,28 @@ public class PackageManagerCompat {
 //        }
         Log.i(TAG, "restartApp: 应用程序重启完成! 日期=====>" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
     }
+
+    @Override
+    public boolean onInstallApk(@NonNull @NotNull Context context, @NonNull @NotNull File apkFile, @NonNull @NotNull DownloadEntity downloadEntity) {
+        AtomicBoolean flag = new AtomicBoolean(true);
+        install(context, apkFile.getAbsolutePath(), context.getPackageManager(), new InstallListener(){
+
+            @Override
+            public void onInstallException(Exception e) {
+                Log.e(TAG, "onInstallException: 安装失败! ", e);
+                flag.set(false);
+            }
+
+            @Override
+            public void onInstallSuccess() {
+                restartApp(context);
+            }
+        });
+        return flag.get();
+    }
+
+    @Override
+    public void onInstallApkSuccess() {
+        Log.i(TAG, "onInstallApkSuccess: 安装成功! ");
+    }
 }

+ 19 - 1
app/src/main/java/com/emato/ich/update/UpdateService.java

@@ -1,6 +1,6 @@
 package com.emato.ich.update;
 
-import android.util.Log;
+import com.emato.ich.utils.Log;
 
 import androidx.annotation.NonNull;
 
@@ -27,6 +27,11 @@ import okhttp3.OkHttpClient;
 import okhttp3.Request;
 import okhttp3.Response;
 
+/**
+ * XUpdate需要的更新服务
+ * 已废弃  使用了XUpdateAPI新的方法
+ */
+@Deprecated
 public class UpdateService implements IUpdateHttpService {
 
     private static final String TAG = UpdateService.class.getName();
@@ -60,6 +65,12 @@ public class UpdateService implements IUpdateHttpService {
         return map;
     }
 
+    /**
+     * 调用服务器获取更新所需的参数
+     * @param url                   url
+     * @param params                请求参数
+     * @param callBack              回调
+     */
     @Override
     public void asyncPost(@NonNull @NotNull String url, @NonNull @NotNull Map<String, Object> params, @NonNull @NotNull Callback callBack) {
 
@@ -84,6 +95,13 @@ public class UpdateService implements IUpdateHttpService {
 
     }
 
+    /**
+     * XUpdate调用的下载回调
+     * @param url               url
+     * @param path              文件路径
+     * @param fileName          文件名
+     * @param callback          回调
+     */
     @Override
     public void download(@NonNull @NotNull String url, @NonNull @NotNull String path, @NonNull @NotNull String fileName, @NonNull @NotNull DownloadCallback callback) {
 

+ 4 - 1
app/src/main/java/com/emato/ich/utils/BaseUtils.java

@@ -13,7 +13,7 @@ import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 import android.text.InputType;
 import android.text.TextUtils;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 import android.view.View;
 import android.view.inputmethod.InputMethodManager;
 import android.widget.EditText;
@@ -34,6 +34,9 @@ import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicReference;
 
+/**
+ * 基础工具类
+ */
 public class BaseUtils {
 
     private static final String TAG = "BaseUtils";

+ 7 - 0
app/src/main/java/com/emato/ich/utils/ButtonUtils.java

@@ -1,9 +1,16 @@
 package com.emato.ich.utils;
 
+/**
+ * 按钮工具类
+ */
 public class ButtonUtils {
 
     private static long lastClickTime;
 
+    /**
+     * 防止同时点击按钮出现NPE
+     * @return    是否是点的最快的
+     */
     public synchronized static boolean isFastClick() {
         long time = System.currentTimeMillis();
         if (time - lastClickTime < 500) {

+ 24 - 0
app/src/main/java/com/emato/ich/utils/DateUtils.java

@@ -0,0 +1,24 @@
+package com.emato.ich.utils;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * 时间工具类
+ */
+public class DateUtils {
+
+    private static final DateFormat df = SimpleDateFormat.getDateTimeInstance();
+
+    /**
+     * 格式化时间
+     * @param date      时间
+     * @return          时间字符串
+     */
+    public static String formatDate(Date date) {
+
+        return df.format(date);
+    }
+
+}

+ 5 - 1
app/src/main/java/com/emato/ich/utils/FileUtils.java

@@ -2,7 +2,7 @@ package com.emato.ich.utils;
 
 
 import android.content.Context;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -11,12 +11,16 @@ import java.io.IOException;
 
 /**
  * 默认会找/data/data/包名/file目录下的文件
+ *
+ * 文件读写工具类, 暂时废弃
+ *
  * MODE:
  *   MODE_PRIVATE: 默认操作模式, 代表是有数据,写入会覆盖写入       0
  *   MODE_APPEND: 会校验文件是否存在, 存在则追加写入, 不存在则创建  32768
  *   MODE_WORLD_READABLE: 当前文件可以被其他应用读取             1
  *   MODE_WORLD_WRITEABLE: 当前文件可以被其他应用写入            2
  */
+@Deprecated
 public class FileUtils {
 
     public static final String TAG = "FileUtils";

+ 4 - 1
app/src/main/java/com/emato/ich/utils/JacksonUtils.java

@@ -1,12 +1,15 @@
 package com.emato.ich.utils;
 
-import android.util.Log;
+import com.emato.ich.utils.Log;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
 import java.nio.charset.StandardCharsets;
 
+/**
+ * Jackson工具类
+ */
 public class JacksonUtils {
 
     public static final ObjectMapper objectmapper = new ObjectMapper();

+ 50 - 0
app/src/main/java/com/emato/ich/utils/Log.java

@@ -0,0 +1,50 @@
+package com.emato.ich.utils;
+
+import java.util.Date;
+
+/**
+ * 包装了原生的日志类
+ * 新增了时间的输出
+ */
+public class Log {
+
+    public static void i (String tag, String msg) {
+        android.util.Log.i(tag, addDateTime(msg));
+    }
+
+    public static void i (String tag, String msg, Throwable ex) {
+        android.util.Log.i(tag, addDateTime(msg), ex);
+    }
+
+    public static void w (String tag, String msg) {
+        android.util.Log.w(tag, addDateTime(msg));
+    }
+
+    public static void w (String tag, String msg, Throwable ex) {
+        android.util.Log.w(tag, addDateTime(msg), ex);
+    }
+
+    public static void w (String tag, Throwable ex) {
+        android.util.Log.w(tag, ex);
+    }
+
+    public static void e (String tag, String msg, Throwable ex) {
+        android.util.Log.w(tag, addDateTime(msg), ex);
+    }
+
+    public static void d (String tag, String msg) {
+        android.util.Log.d(tag, addDateTime(msg));
+    }
+
+    public static void d (String tag, String msg, Throwable ex) {
+        android.util.Log.d(tag, addDateTime(msg), ex);
+    }
+
+    public static void e (String tag, String msg) {
+        android.util.Log.w(tag, addDateTime(msg));
+    }
+
+    private static String addDateTime(String msg){
+        return "[" + Thread.currentThread().getName() + "] " + DateUtils.formatDate(new Date()) + " ===> " + msg;
+    }
+}

+ 33 - 2
app/src/main/java/com/emato/ich/utils/LoggingUtils.java

@@ -1,24 +1,55 @@
 package com.emato.ich.utils;
 
+import com.emato.ich.contant.ExceptionType;
+import com.emato.ich.entity.vo.ExceptionVo;
 import com.emato.ich.message.ICHPublishClient;
 import com.emato.ich.message.ICHTopic;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
 
 import org.eclipse.paho.client.mqttv3.MqttMessage;
 
 import java.io.ByteArrayOutputStream;
+import java.util.Date;
 
+/**
+ * 异常日志处理工具类
+ */
 public class LoggingUtils {
 
 
     public static void sendErrorLog(String cause, Throwable throwable){
 
+        MqttMessage mqttMessage = wrapMessage((cause + ": " + (getStackTrace(throwable).toString())), ExceptionType.BIZ_ERROR);
+        ICHPublishClient.getInstance().publish(String.format(ICHTopic.ERROR_LOG_REPORT, BaseUtils.getClientId()), mqttMessage);
+    }
+
+    public static void sendAppErrorLog(String cause, Throwable throwable){
+
+        MqttMessage mqttMessage = wrapMessage((cause + ": " + (getStackTrace(throwable).toString())), ExceptionType.CRASH_ERROR);
+        ICHPublishClient.getInstance().publish(String.format(ICHTopic.ERROR_LOG_REPORT, BaseUtils.getClientId()), mqttMessage);
+    }
+
+    private static MqttMessage wrapMessage(String cause, String type) {
+        ExceptionVo exceptionVo = new ExceptionVo();
+        exceptionVo.setClientId(BaseUtils.getClientId());
+        exceptionVo.setReportData(cause);
+        exceptionVo.setReportType(type);
+        exceptionVo.setReportTime(DateUtils.formatDate(new Date()));
         // TODO 发送异常信息
         MqttMessage mqttMessage = new MqttMessage();
         mqttMessage.setQos(1);
-        mqttMessage.setPayload((cause + ": " + (getStackTrace(throwable).toString())).getBytes());
-        ICHPublishClient.getInstance().publish(String.format(ICHTopic.ERROR_LOG_REPORT, BaseUtils.getClientId()), mqttMessage);
+        byte[] bytes = null;
+        try {
+            bytes = JacksonUtils.objectmapper.writeValueAsBytes(exceptionVo);
+        } catch (JsonProcessingException e) {
+            e.printStackTrace();
+        }
+        mqttMessage.setPayload(bytes);
+        return mqttMessage;
     }
 
+
     private static ByteArrayOutputStream getStackTrace(Throwable t) {
         ByteArrayOutputStream buf = new java.io.ByteArrayOutputStream();
         t.printStackTrace(new java.io.PrintWriter(buf, true));

+ 3 - 0
app/src/main/java/com/emato/ich/utils/Md5Utils.java

@@ -2,6 +2,9 @@ package com.emato.ich.utils;
 
 import java.security.MessageDigest;
 
+/**
+ * MD5工具类
+ */
 public class Md5Utils {
 
     /**

+ 6 - 1
app/src/main/java/com/emato/ich/utils/ResourceUtils.java

@@ -1,7 +1,7 @@
 package com.emato.ich.utils;
 
 import android.content.res.AssetManager;
-import android.util.Log;
+import com.emato.ich.utils.Log;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -13,6 +13,11 @@ import java.io.InputStreamReader;
 import java.io.Reader;
 import java.nio.charset.StandardCharsets;
 
+/**
+ * XUpdate测试使用的工具类
+ * 读取update_test.json 模拟服务器返回更新需要的参数
+ */
+@Deprecated
 public class ResourceUtils {
 
     private static final String TAG = ResourceUtils.class.getName();

+ 3 - 0
app/src/main/java/com/emato/ich/utils/StringUtils.java

@@ -1,5 +1,8 @@
 package com.emato.ich.utils;
 
+/**
+ * 字符串工具类
+ */
 public class StringUtils {
 
     public static boolean isNullOrEmpty(String s) {

+ 16 - 1
app/src/main/java/com/emato/ich/utils/TimeOutUtils.java

@@ -20,9 +20,19 @@ import com.emato.ich.fragment.TakeFragment;
 import com.emato.ich.fragment.TakeSuccessFragment;
 import com.emato.ich.local.LocalStorage;
 
-
+/**
+ * 页面倒计时工具类
+ */
 public class TimeOutUtils {
 
+    /**
+     * 倒计时
+     * @param mainActivity      activity
+     * @param fragment          fragment
+     * @param textView          倒计时显示的控件
+     * @param time              时间
+     * @return                  计时器
+     */
     public static CountDownTimer timeout(MainActivity mainActivity, Fragment fragment, TextView textView, int time){
         // TODO 需要action 每一个Fragment都需要一个跳转Main的action  需要判断是哪个Fragment
         return new CountDownTimer(time * 1000, 1000) {
@@ -43,6 +53,11 @@ public class TimeOutUtils {
         };
     }
 
+    /**
+     * 根据Fragment来跳转
+     * @param fragment      fragment
+     * @return              跳转所对应的action id
+     */
     private static int getFragmentAction(Fragment fragment) {
 
         if (fragment instanceof ChooseCabinetFragment) {

+ 8 - 0
app/src/main/java/com/emato/ich/utils/ToastUtils.java

@@ -10,6 +10,9 @@ import android.widget.Toast;
 
 import com.emato.ich.R;
 
+/**
+ * 弹出框工具类
+ */
 public class ToastUtils {
 
     private static Toast mToast;
@@ -22,6 +25,11 @@ public class ToastUtils {
         }
     };
 
+    /**
+     * 弹出框
+     * @param context       程序上下文
+     * @param msg           弹出信息
+     */
     public static void make(Context context, String msg) {
         LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
         //自定义布局

+ 2 - 0
app/src/main/java/com/emato/ich/utils/WaitingDialogUtils.java

@@ -5,7 +5,9 @@ import android.content.Context;
 
 /**
  * 加载框
+ * 已废弃
  */
+@Deprecated
 public class WaitingDialogUtils {
 
     private static ProgressDialog progressDialog;

BIN
app/src/main/res/drawable/already_send.png


BIN
app/src/main/res/drawable/continue_send.png


BIN
app/src/main/res/drawable/continue_take.png


BIN
app/src/main/res/drawable/exception_handler.png


BIN
app/src/main/res/drawable/exit_account.png


BIN
app/src/main/res/drawable/none_send.png


BIN
app/src/main/res/drawable/re_open.png


+ 13 - 1
app/src/main/res/layout/fragment_input_info.xml

@@ -32,6 +32,7 @@
         android:layout_x="228dp"
         android:layout_y="399dp"
         android:text="@string/number_8"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -41,6 +42,7 @@
         android:layout_x="177dp"
         android:layout_y="339dp"
         android:text="@string/number_1"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -50,7 +52,8 @@
         android:layout_x="228dp"
         android:layout_y="339dp"
         android:text="@string/number_2"
-        android:textSize="10dp" />
+        android:textSize="10dp"
+        android:textColor="@color/black"/>
 
     <Button
         android:id="@+id/input_button3"
@@ -59,6 +62,7 @@
         android:layout_x="279dp"
         android:layout_y="339dp"
         android:text="@string/number_3"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -68,6 +72,7 @@
         android:layout_x="228dp"
         android:layout_y="369dp"
         android:text="@string/number_5"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -77,6 +82,7 @@
         android:layout_x="177dp"
         android:layout_y="369dp"
         android:text="@string/number_4"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -87,6 +93,7 @@
         android:layout_y="429dp"
         android:text="@string/cancel_btn"
         android:textSize="12sp"
+        android:textColor="@color/black"
         android:textStyle="bold" />
 
     <Button
@@ -96,6 +103,7 @@
         android:layout_x="177dp"
         android:layout_y="429dp"
         android:text="@string/number_0"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -106,6 +114,7 @@
         android:layout_y="459dp"
         android:text="@string/confirm_btn"
         android:textSize="12dp"
+        android:textColor="@color/black"
         android:theme="@style/Theme.ButtonStyle.CONFIRM" />
 
     <Button
@@ -115,6 +124,7 @@
         android:layout_x="279dp"
         android:layout_y="369dp"
         android:text="@string/number_6"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -124,6 +134,7 @@
         android:layout_x="279dp"
         android:layout_y="399dp"
         android:text="@string/number_9"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <EditText
@@ -145,6 +156,7 @@
         android:layout_x="177dp"
         android:layout_y="399dp"
         android:text="@string/number_7"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <TextView

+ 13 - 1
app/src/main/res/layout/fragment_send.xml

@@ -37,6 +37,7 @@
         android:layout_x="175dp"
         android:layout_y="411dp"
         android:text="@string/number_7"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -46,6 +47,7 @@
         android:layout_x="175dp"
         android:layout_y="351dp"
         android:text="@string/number_1"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -55,7 +57,8 @@
         android:layout_x="226dp"
         android:layout_y="351dp"
         android:text="@string/number_2"
-        android:textSize="10dp" />
+        android:textSize="10dp"
+        android:textColor="@color/black" />
 
     <Button
         android:id="@+id/input_button3"
@@ -64,6 +67,7 @@
         android:layout_x="277dp"
         android:layout_y="351dp"
         android:text="@string/number_3"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -73,6 +77,7 @@
         android:layout_x="226dp"
         android:layout_y="381dp"
         android:text="@string/number_5"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -81,6 +86,7 @@
         android:layout_height="40dp"
         android:layout_x="175dp"
         android:layout_y="381dp"
+        android:textColor="@color/black"
         android:text="@string/number_4"
         android:textSize="10dp" />
 
@@ -92,6 +98,7 @@
         android:layout_y="441dp"
         android:text="@string/cancel_btn"
         android:textSize="12sp"
+        android:textColor="@color/black"
         android:textStyle="bold" />
 
     <Button
@@ -100,6 +107,7 @@
         android:layout_height="40dp"
         android:layout_x="175dp"
         android:layout_y="441dp"
+        android:textColor="@color/black"
         android:text="@string/number_0"
         android:textSize="10dp" />
 
@@ -111,6 +119,7 @@
         android:layout_y="471dp"
         android:text="@string/confirm_btn"
         android:textSize="10dp"
+        android:textColor="@color/black"
         android:theme="@style/Theme.ButtonStyle.CONFIRM" />
 
     <Button
@@ -118,6 +127,7 @@
         android:layout_width="48dp"
         android:layout_height="40dp"
         android:layout_x="277dp"
+        android:textColor="@color/black"
         android:layout_y="381dp"
         android:text="@string/number_6"
         android:textSize="10dp" />
@@ -129,6 +139,7 @@
         android:layout_x="277dp"
         android:layout_y="411dp"
         android:text="@string/number_9"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <EditText
@@ -150,6 +161,7 @@
         android:layout_x="226dp"
         android:layout_y="411dp"
         android:text="@string/number_8"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <TextView

+ 32 - 36
app/src/main/res/layout/fragment_send_info_confirm.xml

@@ -35,90 +35,86 @@
         android:layout_width="200dp"
         android:layout_height="50dp"
         android:layout_x="81dp"
-        android:layout_y="386dp"
+        android:layout_y="366dp"
         android:gravity="center"
         android:text="@string/open_cabinet_hint"
-        android:textSize="15dp" />
+        android:textSize="12dp" />
 
     <TextView
         android:id="@+id/take_no_hint"
         android:layout_width="100dp"
         android:layout_height="40dp"
         android:layout_x="81dp"
-        android:layout_y="436dp"
+        android:layout_y="406dp"
         android:gravity="center"
         android:text="@string/take_no_hint"
-        android:textSize="15dp" />
+        android:textSize="12dp" />
 
     <TextView
         android:id="@+id/take_no"
         android:layout_width="100dp"
         android:layout_height="40dp"
-        android:layout_x="181dp"
-        android:layout_y="436dp"
+        android:layout_x="161dp"
+        android:layout_y="406dp"
         android:gravity="center"
         android:text="@string/take_no"
-        android:textSize="15dp" />
+        android:textSize="10dp" />
 
     <TextView
         android:id="@+id/take_number"
         android:layout_width="100dp"
         android:layout_height="40dp"
-        android:layout_x="181dp"
-        android:layout_y="476dp"
+        android:layout_x="151dp"
+        android:layout_y="436dp"
         android:gravity="center"
         android:text="@string/take_number"
-        android:textSize="15dp" />
+        android:textSize="10dp" />
 
     <TextView
         android:id="@+id/open_cabinet_no"
         android:layout_width="200dp"
         android:layout_height="50dp"
         android:layout_x="81dp"
-        android:layout_y="336dp"
+        android:layout_y="326dp"
         android:gravity="center"
         android:text="@string/open_cabinet_no"
         android:textColor="@color/cardview_dark_background"
         android:textSize="40dp" />
 
     <Button
-        android:id="@+id/already_send"
-        android:layout_width="80dp"
-        android:layout_height="40dp"
-        android:layout_x="81dp"
-        android:layout_y="516dp"
-        android:background="@drawable/button_radius"
-        android:text="@string/already_send"
-        android:textSize="12dp" />
+        android:id="@+id/none_send"
+        android:layout_width="66dp"
+        android:layout_height="60dp"
+        android:layout_x="206dp"
+        android:layout_y="484dp"
+        android:background="@drawable/none_send"
+        android:theme="@style/Theme.ButtonStyle.RED"/>
 
     <Button
-        android:id="@+id/none_send"
-        android:layout_width="80dp"
-        android:layout_height="40dp"
-        android:layout_x="201dp"
-        android:layout_y="516dp"
-        android:background="@drawable/button_radius"
-        android:text="@string/none_send"
-        android:textSize="12dp" />
+        android:id="@+id/already_send"
+        android:layout_width="70dp"
+        android:layout_height="60dp"
+        android:layout_x="93dp"
+        android:layout_y="484dp"
+        android:background="@drawable/already_send"
+        android:theme="@style/Theme.ButtonStyle.GREEN"/>
 
     <TextView
         android:id="@+id/take_number_hint"
         android:layout_width="100dp"
         android:layout_height="40dp"
         android:layout_x="81dp"
-        android:layout_y="476dp"
+        android:layout_y="436dp"
         android:gravity="center"
         android:text="@string/take_number_hint"
-        android:textSize="15dp" />
+        android:textSize="12dp" />
 
-    <Button
+    <ImageButton
         android:id="@+id/exception_btn"
-        android:layout_width="80dp"
+        android:layout_width="100dp"
         android:layout_height="40dp"
-        android:layout_x="-15dp"
-        android:layout_y="285dp"
-        android:background="@drawable/button_radius"
-        android:text="@string/exception_btn"
-        android:textSize="8dp" />
+        android:layout_x="-12dp"
+        android:layout_y="286dp"
+        android:background="@drawable/exception_handler" />
 
 </AbsoluteLayout>

+ 6 - 12
app/src/main/res/layout/fragment_send_success.xml

@@ -30,26 +30,20 @@
         android:text="@string/send_success"
         android:textSize="35dp" />
 
-    <Button
+    <ImageButton
         android:id="@+id/continue_send_btn"
         android:layout_width="100dp"
-        android:layout_height="50dp"
+        android:layout_height="45dp"
         android:layout_x="74dp"
         android:layout_y="431dp"
-        android:background="@drawable/button_radius"
-        android:theme="@style/Theme.ButtonStyle.GREEN"
-        android:text="@string/continue_send"
-        android:textSize="15dp" />
+        android:background="@drawable/continue_send" />
 
-    <Button
+    <ImageButton
         android:id="@+id/exit_account_btn"
         android:layout_width="100dp"
-        android:layout_height="50dp"
+        android:layout_height="45dp"
         android:layout_x="194dp"
         android:layout_y="431dp"
-        android:background="@drawable/button_radius"
-        android:theme="@style/Theme.ButtonStyle.GREEN"
-        android:text="@string/exit_account"
-        android:textSize="15dp" />
+        android:background="@drawable/exit_account" />
 
 </AbsoluteLayout>

+ 14 - 2
app/src/main/res/layout/fragment_take_code.xml

@@ -41,6 +41,7 @@
         android:layout_x="232dp"
         android:layout_y="467dp"
         android:text="@string/cancel_btn"
+        android:textColor="@color/black"
         android:textSize="12sp"
         android:textStyle="bold" />
 
@@ -51,6 +52,7 @@
         android:layout_x="182dp"
         android:layout_y="407dp"
         android:text="@string/number_4"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <EditText
@@ -67,11 +69,12 @@
 
     <Button
         android:id="@+id/take_input_button2"
-        android:layout_width="48dp"
+        android:layout_width="50dp"
         android:layout_height="40dp"
-        android:layout_x="232dp"
+        android:layout_x="230dp"
         android:layout_y="377dp"
         android:text="@string/number_2"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -81,6 +84,7 @@
         android:layout_x="182dp"
         android:layout_y="437dp"
         android:text="@string/number_7"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -90,6 +94,7 @@
         android:layout_x="282dp"
         android:layout_y="437dp"
         android:text="@string/number_9"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -99,6 +104,7 @@
         android:layout_x="282dp"
         android:layout_y="407dp"
         android:text="@string/number_6"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -108,6 +114,7 @@
         android:layout_x="282dp"
         android:layout_y="377dp"
         android:text="@string/number_3"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -116,6 +123,7 @@
         android:layout_height="40dp"
         android:layout_x="232dp"
         android:layout_y="437dp"
+        android:textColor="@color/black"
         android:text="@string/number_8"
         android:textSize="10dp" />
 
@@ -126,6 +134,7 @@
         android:layout_x="232dp"
         android:layout_y="407dp"
         android:text="@string/number_5"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <ImageButton
@@ -143,6 +152,7 @@
         android:layout_x="182dp"
         android:layout_y="467dp"
         android:text="@string/number_0"
+        android:textColor="@color/black"
         android:textSize="10dp" />
 
     <Button
@@ -153,6 +163,7 @@
         android:layout_y="497dp"
         android:text="@string/confirm_btn"
         android:textSize="10dp"
+        android:textColor="@color/black"
         android:theme="@style/Theme.ButtonStyle.CONFIRM" />
 
     <Button
@@ -161,6 +172,7 @@
         android:layout_height="40dp"
         android:layout_x="182dp"
         android:layout_y="377dp"
+        android:textColor="@color/black"
         android:text="@string/number_1"
         android:textSize="10dp" />
 

+ 13 - 17
app/src/main/res/layout/fragment_take_success.xml

@@ -32,16 +32,6 @@
         android:layout_y="562dp"
         android:background="@drawable/return_main" />
 
-    <Button
-        android:id="@+id/re_open_cabinet_btn"
-        android:layout_width="80dp"
-        android:layout_height="40dp"
-        android:layout_x="89dp"
-        android:layout_y="498dp"
-        android:background="@drawable/button_radius"
-        android:text="@string/re_open_cabinet"
-        android:textSize="10dp" />
-
     <TextView
         android:id="@+id/open_cabinet_count_down_hint"
         android:layout_width="200dp"
@@ -62,14 +52,20 @@
         android:textSize="50dp"
         android:textStyle="bold" />
 
-    <Button
+    <ImageButton
         android:id="@+id/continue_take_btn"
-        android:layout_width="80dp"
+        android:layout_width="100dp"
+        android:layout_height="40dp"
+        android:layout_x="200dp"
+        android:layout_y="495dp"
+        android:background="@drawable/continue_take" />
+
+    <ImageButton
+        android:id="@+id/re_open_cabinet_btn"
+        android:layout_width="100dp"
         android:layout_height="40dp"
-        android:layout_x="209dp"
-        android:layout_y="498dp"
-        android:background="@drawable/button_radius"
-        android:text="@string/continue_take"
-        android:textSize="10dp" />
+        android:layout_x="80dp"
+        android:layout_y="495dp"
+        android:background="@drawable/re_open" />
 
 </AbsoluteLayout>

+ 4 - 0
app/src/main/res/values-night/themes.xml

@@ -41,6 +41,10 @@
     <style name="Theme.ButtonStyle.GREEN" parent="Theme.MaterialComponents.Light.NoActionBar">
         <item name="colorPrimary">@color/confirm_btn</item>
     </style>
+    <!--  未投递  -->
+    <style name="Theme.ButtonStyle.RED" parent="Theme.MaterialComponents.Light.NoActionBar">
+        <item name="colorPrimary">@color/none_send_btn</item>
+    </style>
     <!-- 确认按钮 -->
     <style name="Theme.ButtonStyle.CONFIRM" parent="Theme.MaterialComponents.Light.NoActionBar">
         <item name="colorPrimary">@color/input_confirm</item>

+ 6 - 2
app/src/main/res/values/colors.xml

@@ -6,18 +6,20 @@
     <color name="purple_700">#c9dd22</color>
     <color name="teal_200">#FF03DAC5</color>
     <color name="teal_700">#FF018786</color>
+
+    <!--  自定义键盘字体颜色  -->
     <color name="black">#000000</color>
     <color name="white">#FFFFFFFF</color>
     <!--  键盘按钮  -->
     <!--    <color name="send_btn">#75FF90</color>-->
-    <color name="send_btn">#9bdf46</color>
+    <color name="send_btn">#f9f3e6</color>
     <color name="take_btn">#EBBA3A</color>
     <color name="main_label_bg">#4E4C4D</color>
     <!--  选择柜子类型背景颜色  -->
     <color name="choose_cabinet_view">#9DDA99</color>
     <!--  确认键  -->
 <!--    <color name="input_confirm">#20E45E</color>-->
-    <color name="input_confirm">#e9f679</color>
+    <color name="input_confirm">#e2dcd5</color>
     <!--  主页按钮以及大按钮  -->
     <color name="confirm_btn">#25a55f</color>
     <!--  返回按钮  -->
@@ -27,4 +29,6 @@
     <color name="status_bar_color">#798E91</color>
     <!--  异常页面边框颜色  -->
     <color name="exception_solid_color">#cccccc</color>
+
+    <color name="none_send_btn">#f00</color>
 </resources>

+ 4 - 0
app/src/main/res/values/themes.xml

@@ -41,6 +41,10 @@
     <style name="Theme.ButtonStyle.GREEN" parent="Theme.MaterialComponents.Light.NoActionBar">
         <item name="colorPrimary">@color/confirm_btn</item>
     </style>
+    <!--  未投递  -->
+    <style name="Theme.ButtonStyle.RED" parent="Theme.MaterialComponents.Light.NoActionBar">
+        <item name="colorPrimary">@color/none_send_btn</item>
+    </style>
     <!-- 确认按钮 -->
     <style name="Theme.ButtonStyle.CONFIRM" parent="Theme.MaterialComponents.Light.NoActionBar">
         <item name="colorPrimary">@color/input_confirm</item>