Commit 6c7aeb49ef99407e5f16f70c8b922c3068c8960d

Authored by Penley
1 parent db05839f

not clean report

@@ -239,7 +239,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -239,7 +239,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
239 Intent intent = new Intent(this, SocketService.class); 239 Intent intent = new Intent(this, SocketService.class);
240 startService(intent); 240 startService(intent);
241 // getTimeByCalendar(); 241 // getTimeByCalendar();
242 -// presenter.getOrderInfo(); 242 + presenter.getOrderInfo();
243 // new Handler().postDelayed(new Runnable() { 243 // new Handler().postDelayed(new Runnable() {
244 // @Override 244 // @Override
245 // public void run() { 245 // public void run() {
@@ -522,7 +522,10 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -522,7 +522,10 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
522 @Override 522 @Override
523 public void prepareRoomQrCodeInfo(RoomQrCodeInfo info) { 523 public void prepareRoomQrCodeInfo(RoomQrCodeInfo info) {
524 this.info = info; 524 this.info = info;
525 - startActivity(new Intent(this, QrCodeShowActivity.class).putExtra("qr", info.getData().getCode())); 525 + startActivity(new Intent(this, QrCodeShowActivity.class)
  526 + .putExtra("qr", info.getData().getCode())
  527 + .putExtra("room_sn",roomInfo.getData().getRoom_sn())
  528 + .putExtra("order_sn",roomStatusInfo.getData().getOrder_sn()));
526 } 529 }
527 530
528 private RoomInfo roomInfo; 531 private RoomInfo roomInfo;
@@ -4,12 +4,15 @@ import android.app.Activity; @@ -4,12 +4,15 @@ import android.app.Activity;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.os.Handler; 5 import android.os.Handler;
6 import android.widget.ImageView; 6 import android.widget.ImageView;
  7 +
7 import com.gimi.common.cinema.model.MessageEvent; 8 import com.gimi.common.cinema.model.MessageEvent;
8 import com.gimi.common.cinema.utils.QRCodeUtils; 9 import com.gimi.common.cinema.utils.QRCodeUtils;
9 import com.gimi.common.cinema.utils.SystemUtils; 10 import com.gimi.common.cinema.utils.SystemUtils;
10 import com.google.zxing.WriterException; 11 import com.google.zxing.WriterException;
11 import com.qnbar.smc.utils.LightOperationUtils; 12 import com.qnbar.smc.utils.LightOperationUtils;
12 import com.xgimi.gimicinema.R; 13 import com.xgimi.gimicinema.R;
  14 +import com.xgimi.gimicinema.presenter.QrCodeShowPresent;
  15 +
13 import org.greenrobot.eventbus.EventBus; 16 import org.greenrobot.eventbus.EventBus;
14 import org.greenrobot.eventbus.Subscribe; 17 import org.greenrobot.eventbus.Subscribe;
15 import org.greenrobot.eventbus.ThreadMode; 18 import org.greenrobot.eventbus.ThreadMode;
@@ -17,6 +20,7 @@ import org.greenrobot.eventbus.ThreadMode; @@ -17,6 +20,7 @@ import org.greenrobot.eventbus.ThreadMode;
17 public class QrCodeShowActivity extends Activity { 20 public class QrCodeShowActivity extends Activity {
18 public static final int KILL_SELF = 0x9983; 21 public static final int KILL_SELF = 0x9983;
19 private Handler handler = new Handler(); 22 private Handler handler = new Handler();
  23 + private QrCodeShowPresent present;
20 24
21 @Override 25 @Override
22 protected void onCreate(Bundle savedInstanceState) { 26 protected void onCreate(Bundle savedInstanceState) {
@@ -24,7 +28,11 @@ public class QrCodeShowActivity extends Activity { @@ -24,7 +28,11 @@ public class QrCodeShowActivity extends Activity {
24 setContentView(R.layout.activity_qr_code_show); 28 setContentView(R.layout.activity_qr_code_show);
25 EventBus.getDefault().register(this); 29 EventBus.getDefault().register(this);
26 30
  31 + present = new QrCodeShowPresent();
  32 +
27 final String qr = getIntent().getStringExtra("qr"); 33 final String qr = getIntent().getStringExtra("qr");
  34 + final String oderSn = getIntent().getStringExtra("order_sn");
  35 + final String roomSn = getIntent().getStringExtra("room_sn");
28 ImageView iv = (ImageView) findViewById(R.id.qrCodeIv); 36 ImageView iv = (ImageView) findViewById(R.id.qrCodeIv);
29 try { 37 try {
30 iv.setImageBitmap(QRCodeUtils.createQRCode(qr, 400)); 38 iv.setImageBitmap(QRCodeUtils.createQRCode(qr, 400));
@@ -37,6 +45,8 @@ public class QrCodeShowActivity extends Activity { @@ -37,6 +45,8 @@ public class QrCodeShowActivity extends Activity {
37 LightOperationUtils.close(); 45 LightOperationUtils.close();
38 LightOperationUtils.setLightValue(5); 46 LightOperationUtils.setLightValue(5);
39 new SystemUtils().closeFtLed(QrCodeShowActivity.this.getApplicationContext()); 47 new SystemUtils().closeFtLed(QrCodeShowActivity.this.getApplicationContext());
  48 + present.reportSleepStatus(oderSn, roomSn);
  49 + QrCodeShowActivity.this.finish();
40 } 50 }
41 }, 20 * 60 * 1000); 51 }, 20 * 60 * 1000);
42 } 52 }
@@ -44,6 +54,7 @@ public class QrCodeShowActivity extends Activity { @@ -44,6 +54,7 @@ public class QrCodeShowActivity extends Activity {
44 @Override 54 @Override
45 protected void onDestroy() { 55 protected void onDestroy() {
46 super.onDestroy(); 56 super.onDestroy();
  57 + handler.removeCallbacks(null);
47 EventBus.getDefault().unregister(this); 58 EventBus.getDefault().unregister(this);
48 } 59 }
49 60
@@ -11,4 +11,6 @@ public interface IRoomInfoModel { @@ -11,4 +11,6 @@ public interface IRoomInfoModel {
11 void getRoomQrCode(String orderSn, String roomSn, RoomInfoModelImpl.GetRoomQrCodeListener listener); 11 void getRoomQrCode(String orderSn, String roomSn, RoomInfoModelImpl.GetRoomQrCodeListener listener);
12 12
13 void reportOpenDoorStatus(String orderSn, RoomInfoModelImpl.OpenDoorStatusListener listener); 13 void reportOpenDoorStatus(String orderSn, RoomInfoModelImpl.OpenDoorStatusListener listener);
  14 +
  15 + void reportSleepSysStatus(String orderSn,String roomSn, RoomInfoModelImpl.SleepSysStatusListener listener);
14 } 16 }
@@ -3,6 +3,7 @@ package com.xgimi.gimicinema.model; @@ -3,6 +3,7 @@ package com.xgimi.gimicinema.model;
3 import android.content.Context; 3 import android.content.Context;
4 import android.text.TextUtils; 4 import android.text.TextUtils;
5 import android.util.Log; 5 import android.util.Log;
  6 +
6 import com.gimi.common.cinema.model.RoomInfo; 7 import com.gimi.common.cinema.model.RoomInfo;
7 import com.gimi.common.cinema.model.RoomQrCodeInfo; 8 import com.gimi.common.cinema.model.RoomQrCodeInfo;
8 import com.gimi.common.cinema.model.RoomStatusInfo; 9 import com.gimi.common.cinema.model.RoomStatusInfo;
@@ -24,6 +25,7 @@ public class RoomInfoModelImpl implements IRoomInfoModel { @@ -24,6 +25,7 @@ public class RoomInfoModelImpl implements IRoomInfoModel {
24 private static final String ROOM_STATUS_BY_ROOM_SN_URL = ROOT_URL + "tcp/getRoomStatus?room_sn="; 25 private static final String ROOM_STATUS_BY_ROOM_SN_URL = ROOT_URL + "tcp/getRoomStatus?room_sn=";
25 private static final String ROOM_QRCODE_BY_ORDER_SN = ROOT_URL + "tcp/getEndQRCode?order_sn="; 26 private static final String ROOM_QRCODE_BY_ORDER_SN = ROOT_URL + "tcp/getEndQRCode?order_sn=";
26 private static final String ROOM_REPORT_ROOM_STATUS = ROOT_URL + "tcp/reportRoomStatus?order_sn="; 27 private static final String ROOM_REPORT_ROOM_STATUS = ROOT_URL + "tcp/reportRoomStatus?order_sn=";
  28 + private static final String ROOM_REPORT_SLEEP_STATUS = ROOT_URL + "tcp/recvSleepCmdTimeout?order_sn=";
27 29
28 @Override 30 @Override
29 public void getRoomInfo(String imei, boolean needUpdate, final GetRoomInfoListener listener) { 31 public void getRoomInfo(String imei, boolean needUpdate, final GetRoomInfoListener listener) {
@@ -157,6 +159,25 @@ public class RoomInfoModelImpl implements IRoomInfoModel { @@ -157,6 +159,25 @@ public class RoomInfoModelImpl implements IRoomInfoModel {
157 }); 159 });
158 } 160 }
159 161
  162 + @Override
  163 + public void reportSleepSysStatus(String orderSn, String roomSn, final SleepSysStatusListener listener) {
  164 + Log.d("room-info", "request:reportSleepSysStatus,url = " + ROOM_QRCODE_BY_ORDER_SN + orderSn);
  165 + OkHttpClientManager.getAsyn(ROOM_REPORT_SLEEP_STATUS + orderSn + "&room_sn=" + roomSn,
  166 + new OkHttpClientManager.ResultCallback<String>() {
  167 + @Override
  168 + public void onError(Request request, Exception e) {
  169 + Log.d("room-info", request.toString() + "," + e.getMessage());
  170 + listener.onSleepSuccess();
  171 + }
  172 +
  173 + @Override
  174 + public void onResponse(String response) {
  175 + Log.d("room-info", "reportSleepSysStatus:" + response);
  176 + listener.onSleepFailure();
  177 + }
  178 + });
  179 + }
  180 +
160 public interface GetRoomInfoListener { 181 public interface GetRoomInfoListener {
161 void onGetRoomInfoSuccess(RoomInfo info); 182 void onGetRoomInfoSuccess(RoomInfo info);
162 183
@@ -182,4 +203,10 @@ public class RoomInfoModelImpl implements IRoomInfoModel { @@ -182,4 +203,10 @@ public class RoomInfoModelImpl implements IRoomInfoModel {
182 203
183 void onOpenDoorFailure(); 204 void onOpenDoorFailure();
184 } 205 }
  206 +
  207 + public interface SleepSysStatusListener {
  208 + void onSleepSuccess();
  209 +
  210 + void onSleepFailure();
  211 + }
185 } 212 }
@@ -93,13 +93,13 @@ public class MainPresenter extends BasePresenter @@ -93,13 +93,13 @@ public class MainPresenter extends BasePresenter
93 mountSamba(context); 93 mountSamba(context);
94 loadRecommend(context); 94 loadRecommend(context);
95 loadClassification(context); 95 loadClassification(context);
96 - getVideoAdsPath(context); 96 +// getVideoAdsPath(context);
97 97
98 - updatePoster(context);  
99 - updateVideoInfo(context);  
100 - updateAgentInfo(context); 98 +// updatePoster(context);
  99 +// updateVideoInfo(context);
  100 +// updateAgentInfo(context);
101 updateAppVersion(context); 101 updateAppVersion(context);
102 - updateClazz(context); 102 +// updateClazz(context);
103 updateDb(context); 103 updateDb(context);
104 updateRoomInfo(context); 104 updateRoomInfo(context);
105 // mainView.showMsg("abc"); 105 // mainView.showMsg("abc");
  1 +package com.xgimi.gimicinema.presenter;
  2 +
  3 +import android.util.Log;
  4 +
  5 +import com.xgimi.gimicinema.model.IRoomInfoModel;
  6 +import com.xgimi.gimicinema.model.RoomInfoModelImpl;
  7 +
  8 +/**
  9 + * Created by wugian on 2017/5/2
  10 + */
  11 +
  12 +public class QrCodeShowPresent {
  13 + IRoomInfoModel roomInfoModel;
  14 +
  15 + public QrCodeShowPresent() {
  16 + roomInfoModel = new RoomInfoModelImpl();
  17 + }
  18 +
  19 + public void reportSleepStatus(String orderSn, String roomSn) {
  20 + roomInfoModel.reportSleepSysStatus(orderSn, roomSn, new RoomInfoModelImpl.SleepSysStatusListener() {
  21 + @Override
  22 + public void onSleepSuccess() {
  23 + Log.d("room-info", "onSleepSuccess");
  24 + }
  25 +
  26 + @Override
  27 + public void onSleepFailure() {
  28 + Log.d("room-info", "onSleepFailure");
  29 + }
  30 + });
  31 + }
  32 +}
Please register or login to post a comment