Commit 6c7aeb49ef99407e5f16f70c8b922c3068c8960d

Authored by Penley
1 parent db05839f

not clean report

... ... @@ -239,7 +239,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
239 239 Intent intent = new Intent(this, SocketService.class);
240 240 startService(intent);
241 241 // getTimeByCalendar();
242   -// presenter.getOrderInfo();
  242 + presenter.getOrderInfo();
243 243 // new Handler().postDelayed(new Runnable() {
244 244 // @Override
245 245 // public void run() {
... ... @@ -522,7 +522,10 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
522 522 @Override
523 523 public void prepareRoomQrCodeInfo(RoomQrCodeInfo info) {
524 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 531 private RoomInfo roomInfo;
... ...
... ... @@ -4,12 +4,15 @@ import android.app.Activity;
4 4 import android.os.Bundle;
5 5 import android.os.Handler;
6 6 import android.widget.ImageView;
  7 +
7 8 import com.gimi.common.cinema.model.MessageEvent;
8 9 import com.gimi.common.cinema.utils.QRCodeUtils;
9 10 import com.gimi.common.cinema.utils.SystemUtils;
10 11 import com.google.zxing.WriterException;
11 12 import com.qnbar.smc.utils.LightOperationUtils;
12 13 import com.xgimi.gimicinema.R;
  14 +import com.xgimi.gimicinema.presenter.QrCodeShowPresent;
  15 +
13 16 import org.greenrobot.eventbus.EventBus;
14 17 import org.greenrobot.eventbus.Subscribe;
15 18 import org.greenrobot.eventbus.ThreadMode;
... ... @@ -17,6 +20,7 @@ import org.greenrobot.eventbus.ThreadMode;
17 20 public class QrCodeShowActivity extends Activity {
18 21 public static final int KILL_SELF = 0x9983;
19 22 private Handler handler = new Handler();
  23 + private QrCodeShowPresent present;
20 24
21 25 @Override
22 26 protected void onCreate(Bundle savedInstanceState) {
... ... @@ -24,7 +28,11 @@ public class QrCodeShowActivity extends Activity {
24 28 setContentView(R.layout.activity_qr_code_show);
25 29 EventBus.getDefault().register(this);
26 30
  31 + present = new QrCodeShowPresent();
  32 +
27 33 final String qr = getIntent().getStringExtra("qr");
  34 + final String oderSn = getIntent().getStringExtra("order_sn");
  35 + final String roomSn = getIntent().getStringExtra("room_sn");
28 36 ImageView iv = (ImageView) findViewById(R.id.qrCodeIv);
29 37 try {
30 38 iv.setImageBitmap(QRCodeUtils.createQRCode(qr, 400));
... ... @@ -37,6 +45,8 @@ public class QrCodeShowActivity extends Activity {
37 45 LightOperationUtils.close();
38 46 LightOperationUtils.setLightValue(5);
39 47 new SystemUtils().closeFtLed(QrCodeShowActivity.this.getApplicationContext());
  48 + present.reportSleepStatus(oderSn, roomSn);
  49 + QrCodeShowActivity.this.finish();
40 50 }
41 51 }, 20 * 60 * 1000);
42 52 }
... ... @@ -44,6 +54,7 @@ public class QrCodeShowActivity extends Activity {
44 54 @Override
45 55 protected void onDestroy() {
46 56 super.onDestroy();
  57 + handler.removeCallbacks(null);
47 58 EventBus.getDefault().unregister(this);
48 59 }
49 60
... ...
... ... @@ -11,4 +11,6 @@ public interface IRoomInfoModel {
11 11 void getRoomQrCode(String orderSn, String roomSn, RoomInfoModelImpl.GetRoomQrCodeListener listener);
12 12
13 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 3 import android.content.Context;
4 4 import android.text.TextUtils;
5 5 import android.util.Log;
  6 +
6 7 import com.gimi.common.cinema.model.RoomInfo;
7 8 import com.gimi.common.cinema.model.RoomQrCodeInfo;
8 9 import com.gimi.common.cinema.model.RoomStatusInfo;
... ... @@ -24,6 +25,7 @@ public class RoomInfoModelImpl implements IRoomInfoModel {
24 25 private static final String ROOM_STATUS_BY_ROOM_SN_URL = ROOT_URL + "tcp/getRoomStatus?room_sn=";
25 26 private static final String ROOM_QRCODE_BY_ORDER_SN = ROOT_URL + "tcp/getEndQRCode?order_sn=";
26 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 30 @Override
29 31 public void getRoomInfo(String imei, boolean needUpdate, final GetRoomInfoListener listener) {
... ... @@ -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 181 public interface GetRoomInfoListener {
161 182 void onGetRoomInfoSuccess(RoomInfo info);
162 183
... ... @@ -182,4 +203,10 @@ public class RoomInfoModelImpl implements IRoomInfoModel {
182 203
183 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 93 mountSamba(context);
94 94 loadRecommend(context);
95 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 101 updateAppVersion(context);
102   - updateClazz(context);
  102 +// updateClazz(context);
103 103 updateDb(context);
104 104 updateRoomInfo(context);
105 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