Browse Source

优化清除报警逻辑

ccc 3 months ago
parent
commit
d37a9418d7

+ 4 - 0
BaseLibrary/src/main/java/com/hboxs/base_library/util/DrawableSelectorUtils.java

@@ -370,6 +370,10 @@ public class DrawableSelectorUtils {
             logoF = R.drawable.logo_qimitech;//qimi_tech
             width = R.dimen.dp_80;
             height = R.dimen.dp_40;
+        }else if ("7756".equals(logo)){
+            logoF = R.drawable.logo_magicjea;//magic_jea
+            width = R.dimen.dp_80;
+            height = R.dimen.dp_40;
         }
         ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
         layoutParams.width = UiUtil.getDimensionPixelRes(width);

BIN
BaseLibrary/src/main/res/drawable/logo_kasssplash.png


BIN
BaseLibrary/src/main/res/drawable/logo_magicjea.png


+ 50 - 35
app/src/main/java/com/bgy/autosale/RemoteSupportService.java

@@ -157,7 +157,7 @@ public class RemoteSupportService extends Service implements SendCallback {
     }
 
 
-// 在适当的地方调用以下代码开始执行
+    // 在适当的地方调用以下代码开始执行
     @Subscribe(threadMode = ThreadMode.MAIN)
     public void event(PaymentMessage messageEvent) {
         switch (messageEvent.getName()) {
@@ -204,7 +204,7 @@ public class RemoteSupportService extends Service implements SendCallback {
 
     @Subscribe(threadMode = ThreadMode.MAIN)
     public void event(ApiMessageEvent messageEvent) {
-        Log.d(TAG, "Service event: ApiMessageEvent"+messageEvent.getName());
+        Log.d(TAG, "Service event: ApiMessageEvent" + messageEvent.getName());
         switch (messageEvent.getName()) {
             case "statusType1":
                 //同步数据
@@ -256,23 +256,25 @@ public class RemoteSupportService extends Service implements SendCallback {
 //                updateEqeStatus((Integer) messageEvent.getData());
                 break;
             case "eliminate":
-                Constant.reasonKey="";
-                HashMap<String, String> params = new HashMap<>();
-                params.put("clientId", Heartbeat.deviceId);
-                addSubscriptionNew(NoPayOrderStringApi.api.eliminateClean(params),String.class,
-                        new HttpResultObserver<String>(view, getApplicationContext()) {
-                            @Override
-                            public void onNext(String s) {
-                                Log.d(TAG, "报警eliminateApionNext: " + s);
-                                LogUtils.logWrite("消除报警next");
-                            }
+                if (!Constant.reasonKey.equals("")) {
+                    Constant.reasonKey = "";
+                    HashMap<String, String> params = new HashMap<>();
+                    params.put("clientId", Heartbeat.deviceId);
+                    addSubscriptionNew(NoPayOrderStringApi.api.eliminateClean(params), String.class,
+                            new HttpResultObserver<String>(view, getApplicationContext()) {
+                                @Override
+                                public void onNext(String s) {
+                                    Log.d(TAG, "报警eliminateApionNext: " + s);
+                                    LogUtils.logWrite("消除报警next");
+                                }
 
-                            @Override
-                            public void onError(Throwable t) {
-                                super.onError(t);
-                                Log.d(TAG, "报警eliminateApi onError: "+t.getMessage());
-                            }
-                        });
+                                @Override
+                                public void onError(Throwable t) {
+                                    super.onError(t);
+                                    Log.d(TAG, "报警eliminateApi onError: " + t.getMessage());
+                                }
+                            });
+                }
                 break;
             case "dosugar":
 //                makingmarshmallows((String) messageEvent.getData());
@@ -447,7 +449,7 @@ public class RemoteSupportService extends Service implements SendCallback {
                     public void run() {
                         WeaverUtil.creditCardSessionComplete();
                     }
-                },  5000);
+                }, 5000);
                 break;
             case "humidification":
 //                startHumidification();
@@ -659,7 +661,7 @@ public class RemoteSupportService extends Service implements SendCallback {
                     new HttpResultNotActivityObserver<String>(view, getApplicationContext()) {
                         @Override
                         public void onNext(String data) {
-                            Log.d(TAG, "onNext:is_sleep1 "+data);
+                            Log.d(TAG, "onNext:is_sleep1 " + data);
 
                         }
 
@@ -685,7 +687,7 @@ public class RemoteSupportService extends Service implements SendCallback {
                             new HttpResultNotActivityObserver<String>(view, getApplicationContext()) {
                                 @Override
                                 public void onNext(String data) {
-                                    Log.d(TAG, "onNext:is_sleep "+data);
+                                    Log.d(TAG, "onNext:is_sleep " + data);
                                 }
 
                                 @Override
@@ -719,14 +721,15 @@ public class RemoteSupportService extends Service implements SendCallback {
 
     @Subscribe(threadMode = ThreadMode.MAIN)
     public void event(ErrorApiMessageEvent messageEvent) {
-        switch (messageEvent.getName()){
+        switch (messageEvent.getName()) {
             case Name.WARNING_ALARM:
-                Log.d(TAG, "event: WARNING_ALARM"+messageEvent.getData());
-                setError1(messageEvent.getId(), (String) messageEvent.getData(),messageEvent.getLevel());
+                Log.d(TAG, "event: WARNING_ALARM" + messageEvent.getData());
+                setError1(messageEvent.getId(), (String) messageEvent.getData(), messageEvent.getLevel());
                 break;
         }
 
     }
+
     //获取个推id
     private Timer timerGeTui;
     private TimerTask taskGeTui;
@@ -746,7 +749,7 @@ public class RemoteSupportService extends Service implements SendCallback {
                         stopGeTui();
                     }
                 } else {
-                    LogUtil.d(TAG, "run: cid1!=null"+Heartbeat.clientId);
+                    LogUtil.d(TAG, "run: cid1!=null" + Heartbeat.clientId);
 //                    stopGeTui();
                 }
 
@@ -851,6 +854,7 @@ public class RemoteSupportService extends Service implements SendCallback {
         };
         timerHeartbeat.schedule(taskHeartbeat, 30000, 1000 * 60 * 5);
     }
+
     private IView view;
 
     /**
@@ -912,7 +916,7 @@ public class RemoteSupportService extends Service implements SendCallback {
                     @Override
                     public void onNext(String s) {
                         Logger.i(TAG + "收到结果" + s);
-                        Log.d(TAG, "onNext: 测试  :"+ s);
+                        Log.d(TAG, "onNext: 测试  :" + s);
                         if (s.equals("心跳成功")) {
                             //  ToastUtil.showToast(UiUtil.getStringRes(R.string.heart_success));
                             LogUtil.d(TAG, "onNext: 心跳成功");
@@ -977,7 +981,9 @@ public class RemoteSupportService extends Service implements SendCallback {
 
         return super.onStartCommand(intent, flags, startId);
     }
+
     private CompositeDisposable mDisposables;
+
     /**
      * 检测心跳数据以及开始心跳
      */
@@ -995,6 +1001,7 @@ public class RemoteSupportService extends Service implements SendCallback {
             Logger.i(TAG + "系统管理id为空");
         }
     }
+
     protected void addSubscriptionNew(Observable observable, Class clazz, DisposableObserver observer) {
         if (mDisposables == null) {
             mDisposables = new CompositeDisposable();
@@ -1009,7 +1016,8 @@ public class RemoteSupportService extends Service implements SendCallback {
                 .subscribe(observer);
         mDisposables.add(observer);
     }
-    protected  void addSubscription(Observable observable, DisposableObserver observer) {
+
+    protected void addSubscription(Observable observable, DisposableObserver observer) {
         if (mDisposables == null) {
             mDisposables = new CompositeDisposable();
         }
@@ -1020,6 +1028,7 @@ public class RemoteSupportService extends Service implements SendCallback {
                 .subscribe(observer);
         mDisposables.add(observer);
     }
+
     private void stopHeartbeat() {
         if (timerHeartbeat != null) {
             taskHeartbeat.cancel();
@@ -1029,6 +1038,7 @@ public class RemoteSupportService extends Service implements SendCallback {
     }
 
     private boolean ampAddress = false;//记录地图是否上传成功 false表示没有 true表示成功了
+
     /**
      * 上传地址,经纬度
      */
@@ -1061,6 +1071,7 @@ public class RemoteSupportService extends Service implements SendCallback {
                     }
                 });
     }
+
     @SuppressLint("CheckResult")
     private void OrderStatusInquiry(String sn, int i) {
         LogUtils.logWrite("调用OrderStatusInquiry");
@@ -1171,7 +1182,7 @@ public class RemoteSupportService extends Service implements SendCallback {
         Log.d(TAG, "RemoteSupportServiceonDestroy: ");
     }
 
-    public void setError1(int key, String reason,String level) {
+    public void setError1(int key, String reason, String level) {
         long currentTime = System.currentTimeMillis();
         if (currentTime - Constant.lastProcessedTime < 3000) {
             return;
@@ -1196,18 +1207,18 @@ public class RemoteSupportService extends Service implements SendCallback {
             RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), json);
             //上传到服务器
             if (!Constant.reasonKey.equals(reason)) {
-                upError(body, 0,reason);
+                upError(body, 0, reason);
             }
         }
     }
 
-    private void upError(RequestBody body, int alarmErrorNumber,String reason) {
+    private void upError(RequestBody body, int alarmErrorNumber, String reason) {
         addSubscriptionNew(NoPayOrderStringApi.api.addAlarmRecord(body), String.class,
                 new HttpResultNotActivityObserver<String>(view, BaseApplication.getContext()) {
                     @Override
                     public void onNext(String o) {
-                        Log.d(TAG, "onNext报警测试1: "+o);
-                        Constant.reasonKey=reason;
+                        Log.d(TAG, "onNext报警测试1: " + o);
+                        Constant.reasonKey = reason;
                         if (o != null) {
                             Log.d("AddAlarmRecordApi3", "onNext: " + o);
                         }
@@ -1216,7 +1227,7 @@ public class RemoteSupportService extends Service implements SendCallback {
                     @Override
                     public void onError(Throwable t) {
                         super.onError(t);
-                        Log.d(TAG, "onNext报警测试2: "+t.getMessage());
+                        Log.d(TAG, "onNext报警测试2: " + t.getMessage());
                         if (t instanceof ApiException) {
                             ApiException a = (ApiException) t;
                             //后台返回
@@ -1229,7 +1240,7 @@ public class RemoteSupportService extends Service implements SendCallback {
                                     if (alarmErrorNumber >= 3) {//重试三次。
                                         return;
                                     }
-                                    upError(body, alarmErrorNumber + 1,Constant.reasonKey);
+                                    upError(body, alarmErrorNumber + 1, Constant.reasonKey);
                                     Log.d(TAG, "run: asdfasdfasdf");
                                     LogUtils.logWrite("报警了,但是上传失败,需要重新上传");
                                 }
@@ -1275,9 +1286,11 @@ public class RemoteSupportService extends Service implements SendCallback {
                     }
                 });
     }
+
     private void SetAnAlarm() {
-            setAlarmClock();
+        setAlarmClock();
     }
+
     public void setAlarmClock() {
         /**
          * 1. 用户点击添加的时候,那么我就开始设置闹钟。
@@ -1299,6 +1312,7 @@ public class RemoteSupportService extends Service implements SendCallback {
             }
         }
     }
+
     public int setAlarmClock(int number, AlarmClockBean alarmClockBean, String type, int alarmNumber) throws ParseException {
 
         for (int i = number; i < alarmNumber; i++) {//清除所有的闹钟
@@ -1386,6 +1400,7 @@ public class RemoteSupportService extends Service implements SendCallback {
         number = number + week.size();//累积。
         return number;
     }
+
     public void stopTimerAndTimerTask(Timer timer, TimerTask task) {
         if (timer != null) {
             task.cancel();

+ 1 - 1
app/src/main/java/com/bgy/autosale/payutil/MQService.java

@@ -1325,7 +1325,7 @@ public class MQService extends Service implements SendCallback,Callback<Result>
                 || "5769".equals(s) || "6894".equals(s) || "8123".equals(s) || "5217".equals(s) || "6431".equals(s)
                 || "7777".equals(s) || "8080".equals(s) || "6702".equals(s) || "7772".equals(s) || "7761".equals(s)
                 || "7773".equals(s) || "7774".equals(s) || "7786".equals(s) || "7775".equals(s)|| "7754".equals(s)
-                ||"0000".equals(s)|| "7764".equals(s)|| "5784".equals(s)|| "7749".equals(s)) {
+                ||"0000".equals(s)|| "7764".equals(s)|| "5784".equals(s)|| "7749".equals(s)|| "7756".equals(s)) {
             Hawk.put("logo", s);
             Hawk.get("logo", "7777");
         }

+ 1 - 0
app/src/main/java/com/bgy/autosale/ui/consumer/IceCreamFragment.java

@@ -2713,6 +2713,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
             carsPay(str());
         }
         if (pri == 0 && id == R.id.btn_discounts_code) {
+            Log.d(TAG, "getConfirmCodeSuccess: "+pri+":"+format);
             manualMake();
         }
     }

+ 1 - 1
app/src/main/java/com/bgy/autosale/ui/operator/fragments/SwitchFragment.java

@@ -460,7 +460,7 @@ public class SwitchFragment extends BaseFragment implements RadioGroup.OnChecked
             String s = etChanglog.getText().toString();
             if ("1".equals(s) ||"7772".equals(s)||"7770".equals(s)||"7777".equals(s)||"7761".equals(s)
                     ||"7773".equals(s)||"7774".equals(s)||"7786".equals(s)||"7775".equals(s)||"7754".equals(s)
-            ||"0000".equals(s)|| "7764".equals(s)|| "5784".equals(s)|| "7749".equals(s)) {
+            ||"0000".equals(s)|| "7764".equals(s)|| "5784".equals(s)|| "7749".equals(s)|| "7756".equals(s)) {
                 Hawk.put("logo", s);
                 Hawk.get("logo", "7777");
                 ToastUtil.showToast(UiUtil.getStringRes(R.string.xgwc));