Pārlūkot izejas kodu

调试完成,并完善充电桩支付流程。

hy 3 gadi atpakaļ
vecāks
revīzija
234767f4a6
30 mainītis faili ar 1076 papildinājumiem un 182 dzēšanām
  1. 2 2
      app/src/main/AndroidManifest.xml
  2. 140 81
      app/src/main/java/com/electric/chargingpile/activity/ChargingStatusActivity.java
  3. 393 17
      app/src/main/java/com/electric/chargingpile/activity/ConfirmOrderActivity.java
  4. 2 1
      app/src/main/java/com/electric/chargingpile/activity/MainMapActivity.java
  5. 3 7
      app/src/main/java/com/electric/chargingpile/activity/UserInfoActivity.java
  6. 62 10
      app/src/main/java/com/electric/chargingpile/adapter/PreferentialAdapter.java
  7. 8 6
      app/src/main/java/com/electric/chargingpile/application/MainApplication.java
  8. 8 5
      app/src/main/java/com/electric/chargingpile/constant/UrlConstants.java
  9. 108 0
      app/src/main/java/com/electric/chargingpile/data/RedEnvelopeBean.java
  10. 51 0
      app/src/main/java/com/electric/chargingpile/util/Util.java
  11. 141 15
      app/src/main/java/com/electric/chargingpile/view/PreferentialDialog.java
  12. BIN
      app/src/main/res/drawable-hdpi/icon_car_user_certificate.png
  13. BIN
      app/src/main/res/drawable-hdpi/icon_publish_price.png
  14. BIN
      app/src/main/res/drawable-mdpi/icon_car_user_certificate.png
  15. BIN
      app/src/main/res/drawable-mdpi/icon_publish_price.png
  16. BIN
      app/src/main/res/drawable-xhdpi/icon_car_user_certificate.png
  17. BIN
      app/src/main/res/drawable-xhdpi/icon_publish_price.png
  18. BIN
      app/src/main/res/drawable-xxxhdpi/icon_car_user_certificate.png
  19. BIN
      app/src/main/res/drawable-xxxhdpi/icon_publish_price.png
  20. 1 1
      app/src/main/res/layout/activity_oder_details.xml
  21. 8 2
      app/src/main/res/layout/activity_submit_orders.xml
  22. 4 4
      app/src/main/res/layout/activity_user_center.xml
  23. 6 9
      app/src/main/res/layout/activity_user_info.xml
  24. 21 12
      app/src/main/res/layout/dialog_preferential.xml
  25. 2 1
      app/src/main/res/layout/item_text_checkbox.xml
  26. 2 0
      app/src/main/res/layout/recommend_charging_station_item.xml
  27. 25 8
      zxing/src/main/java/com/google/zxing/client/android/CaptureActivity.java
  28. 1 0
      zxing/src/main/java/com/google/zxing/client/android/constant/ChargingConstants.java
  29. 8 1
      zxing/src/main/java/com/google/zxing/client/android/constant/UrlConstants.java
  30. 80 0
      zxing/src/main/java/com/google/zxing/client/android/data/DelayedSettlementBean.java

+ 2 - 2
app/src/main/AndroidManifest.xml

@ -2,8 +2,8 @@
2 2
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 3
    xmlns:tools="http://schemas.android.com/tools"
4 4
    package="com.electric.chargingpile"
5
    android:versionCode="98"
6
    android:versionName="3.5.12">
5
    android:versionCode="99"
6
    android:versionName="3.5.13">
7 7
8 8
    <uses-permission android:name="android.permission.BLUETOOTH" />
9 9
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

+ 140 - 81
app/src/main/java/com/electric/chargingpile/activity/ChargingStatusActivity.java

@ -15,6 +15,7 @@ import android.os.Bundle;
15 15
import android.os.Handler;
16 16
import android.os.Message;
17 17
import android.provider.Settings;
18
import android.util.Log;
18 19
import android.view.KeyEvent;
19 20
import android.view.View;
20 21
import android.widget.ImageView;
@ -31,14 +32,18 @@ import com.electric.chargingpile.application.MainApplication;
31 32
import com.electric.chargingpile.constant.BaseConstants;
32 33
import com.electric.chargingpile.constant.ChargingConstants;
33 34
import com.electric.chargingpile.constant.UrlConstants;
35
import com.electric.chargingpile.data.CarOwnerCertificateBean;
34 36
import com.electric.chargingpile.data.ChargingBean;
37
import com.electric.chargingpile.entity.CarSeriesEntity;
35 38
import com.electric.chargingpile.manager.ProfileManager;
36 39
import com.electric.chargingpile.util.BarColorUtil;
40
import com.electric.chargingpile.util.DES3;
37 41
import com.electric.chargingpile.util.JsonUtils;
38 42
import com.electric.chargingpile.util.LoadingDialog;
39 43
import com.electric.chargingpile.util.NotificationsUtils;
40 44
import com.electric.chargingpile.util.ToastUtil;
41 45
import com.electric.chargingpile.view.CircleProgressBar;
46
import com.google.gson.Gson;
42 47
import com.google.zxing.client.android.CaptureActivity;
43 48
import com.squareup.picasso.Picasso;
44 49
import com.tencent.bugly.crashreport.CrashReport;
@ -46,8 +51,11 @@ import com.umeng.analytics.MobclickAgent;
46 51
import com.zhy.http.okhttp.OkHttpUtils;
47 52
import com.zhy.http.okhttp.callback.StringCallback;
48 53
54
import java.net.URLEncoder;
49 55
import java.text.SimpleDateFormat;
50 56
import java.util.Calendar;
57
import java.util.Date;
58
import java.util.List;
51 59
import java.util.TimeZone;
52 60
import java.util.Timer;
53 61
import java.util.TimerTask;
@ -338,81 +346,6 @@ public class ChargingStatusActivity extends Activity implements View.OnClickList
338 346
        return super.onKeyDown(keyCode, event);
339 347
    }
340 348
341
    private void pollingChargingStats() {
342
        try_count++;
343
        OkHttpUtils.get().url(UrlConstants.CHARGING_STATUS_URL)
344
                .addParams(ChargingConstants.USERID, MainApplication.userId)
345
                .addParams(ChargingConstants.PWD, MainApplication.userPassword)
346
                .addParams(ChargingConstants.ORDERID, orderId)
347
                .tag(this)
348
                .build()
349
                .connTimeOut(15000)
350
                .readTimeOut(15000)
351
                .execute(new StringCallback() {
352
                    @Override
353
                    public void onError(Call call, Exception e) {
354
//                        dismissDialog();
355
//                        ToastUtil.showToast(getApplicationContext(),"网络异常,请检查您的网络连接",Toast.LENGTH_SHORT);
356
                        CrashReport.postCatchedException(e);
357
                    }
358
359
                    @Override
360
                    public void onResponse(String response) {
361
                        LogUtils.e("polling=" + response);
362
                        String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
363
                        String rtnMsg = JsonUtils.getKeyResult(response, "rtnMsg");
364
                        if (null != rtnCode) {
365
                            if ("01".equals(rtnCode)) {
366
                                String data = JsonUtils.getKeyResult(response, "data");
367
                                chargingBean = JsonUtils.parseToObjectBean(data, ChargingBean.class);
368
                                int status = chargingBean.getStatus();
369
                                if (status >= 4) {
370
                                    if (mTimer != null) {
371
                                        mTimer.cancel();
372
                                        mTimer = null;
373
                                    }
374
                                    if (timer != null) {
375
                                        timer.cancel();
376
                                        timer = null;
377
                                    }
378
                                    dismissDialog();
379
                                    ToastUtil.showToast(getApplicationContext(), "本次充电已结束", Toast.LENGTH_SHORT);
380
                                    MainApplication.isAppStart = false;
381
                                    ProfileManager.getInstance().setAppStart(getApplicationContext(), MainApplication.isAppStart);
382
                                    Intent intent = new Intent(getApplicationContext(), OderDetailsActivity.class);
383
                                    intent.putExtra(BaseConstants.CHARGING_DATA, chargingBean);
384
                                    intent.putExtra(BaseConstants.ACTIVITY_URL, activity_url);
385
                                    startActivity(intent);
386
                                    finish();
387
388
                                } else {
389
                                    if (try_count < 6) {
390
                                        new Handler().postDelayed(new Runnable() {
391
                                            @Override
392
                                            public void run() {
393
                                                pollingChargingStats();
394
                                            }
395
                                        }, 2000);
396
                                    } else {
397
                                        dismissDialog();
398
                                        startActivity(new Intent(getApplicationContext(), DelayInfoActivity.class));
399
                                        finish();
400
                                    }
401
                                }
402
                            }
403
                            if ("02".equals(rtnCode)) {
404
                                dismissDialog();
405
                                startActivity(new Intent(getApplicationContext(), DelayInfoActivity.class));
406
                                finish();
407
                            } else {
408
//                                dismissDialog();
409
//                                ToastUtil.showToast(getApplicationContext(),rtnMsg,Toast.LENGTH_SHORT);
410
                            }
411
                        }
412
                    }
413
                });
414
    }
415
416 349
417 350
    private void chargingStatus() {
418 351
//        long appTime1 = System.currentTimeMillis() / 1000;
@ -605,7 +538,8 @@ public class ChargingStatusActivity extends Activity implements View.OnClickList
605 538
                    if (activity != null && !activity.isFinishing()) {
606 539
                        dialog.show();
607 540
                    }
608
                    pollingChargingStats();
541
                    chargingEnd2();
542
//                    pollingChargingStats();
609 543
                } else {
610 544
                    dismissDialog();
611 545
                    ToastUtil.showToast(getApplicationContext(), rtnMsg, Toast.LENGTH_SHORT);
@ -614,6 +548,89 @@ public class ChargingStatusActivity extends Activity implements View.OnClickList
614 548
        });
615 549
    }
616 550
551
    private void chargingEnd2() {
552
        if (activity != null && !activity.isFinishing()) {
553
            dialog.show();
554
        }
555
        Log.e("hyc","userId:"+MainApplication.userId);
556
        Log.e("hyc","userPassword:"+MainApplication.userPassword);
557
        Log.e("hyc","ORDERID:"+orderId);
558
        try_count++;
559
        OkHttpUtils.get()
560
                .url(UrlConstants.QUERY_NOT_CLOSE)
561
                .addParams(ChargingConstants.USERID, MainApplication.userId)
562
                .addParams(ChargingConstants.PWD, MainApplication.userPassword)
563
                .addParams(ChargingConstants.ORDERID, orderId)
564
                .build()
565
                .connTimeOut(15000)
566
                .readTimeOut(15000)
567
                .execute(new StringCallback() {
568
                    @Override
569
                    public void onError(Call call, Exception e) {
570
                        LogUtils.e();
571
                        ToastUtil.showToast(getApplicationContext(), "网络异常,请检查您的网络连接", Toast.LENGTH_SHORT);
572
                        CrashReport.postCatchedException(e);
573
574
                        Log.e(this.getClass().getName(),"chargingEnd2--onError--"+e.getMessage());
575
                    }
576
577
                    @Override
578
                    public void onResponse(String response) {
579
                        Log.e(this.getClass().getName()+"hyc ","chargingEnd2--response--"+response);
580
581
                        LogUtils.e("hyc end--" + response);
582
                        String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
583
                        String rtnMsg = JsonUtils.getKeyResult(response, "rtnMsg");
584
585
                        if (null != rtnCode) {
586
                            if ("01".equals(rtnCode)) {
587
                                String data = JsonUtils.getKeyResult(response, "data");
588
                                ChargingBean chargingBean = JsonUtils.parseToObjectBean(data, ChargingBean.class);
589
                                int status = chargingBean.getStatus();
590
                                if (status >= 2) {
591
                                    if (mTimer != null) {
592
                                        mTimer.cancel();
593
                                        mTimer = null;
594
                                    }
595
                                    if (timer != null) {
596
                                        timer.cancel();
597
                                        timer = null;
598
                                    }
599
                                    dismissDialog();
600
                                    ToastUtil.showToast(getApplicationContext(), "本次充电已结束", Toast.LENGTH_SHORT);
601
//                                    MainApplication.isAppStart = false;
602
//                                    ProfileManager.getInstance().setAppStart(getApplicationContext(), MainApplication.isAppStart);
603
                                    ConfirmOrderActivity.actionStart(ChargingStatusActivity.this,chargingBean,activity_url);
604
                                    finish();
605
606
                                } else {
607
                                    if (try_count < 6) {
608
                                        new Handler().postDelayed(new Runnable() {
609
                                            @Override
610
                                            public void run() {
611
                                                chargingEnd2();
612
                                            }
613
                                        }, 2000);
614
                                    } else {
615
                                        dismissDialog();
616
                                        startActivity(new Intent(getApplicationContext(), DelayInfoActivity.class));
617
                                        finish();
618
                                    }
619
                                }
620
                            }
621
                            if ("02".equals(rtnCode)) {
622
                                dismissDialog();
623
                                startActivity(new Intent(getApplicationContext(), DelayInfoActivity.class));
624
                                finish();
625
                            } else {
626
//                                dismissDialog();
627
                                ToastUtil.showToast(getApplicationContext(),rtnMsg,Toast.LENGTH_SHORT);
628
                            }
629
                        }
630
                    }
631
                });
632
    }
633
617 634
    private void dismissDialog() {
618 635
        if (activity != null && !activity.isFinishing()) {
619 636
            if (dialog.isShowing()) {
@ -713,11 +730,8 @@ public class ChargingStatusActivity extends Activity implements View.OnClickList
713 730
    protected void onResume() {
714 731
        super.onResume();
715 732
        MobclickAgent.onResume(this);
716
        if (MainApplication.userCertifiedModel.equals("")){
717
            layoutCarCertificate.setVisibility(View.VISIBLE);
718
        }else{
719
            layoutCarCertificate.setVisibility(View.GONE);
720
        }
733
734
        resumeUserCar();
721 735
        layoutCarCertificate.setOnClickListener(v->{
722 736
            Intent intent = new Intent(getApplicationContext(), CarOwnerCertificateActivity.class);
723 737
            startActivity(intent);
@ -785,6 +799,51 @@ public class ChargingStatusActivity extends Activity implements View.OnClickList
785 799
        }
786 800
        context.startActivity(intent);
787 801
    }
802
    private void resumeUserCar() {
803
        long tokenTime = System.currentTimeMillis() / 1000 - MainMapActivity.cha - 1;
804
        String token = null;
805
        try {
806
            token = DES3.encode(String.valueOf(tokenTime));
807
            token = URLEncoder.encode(token, "UTF-8");
808
        } catch (Exception e) {
809
            e.printStackTrace();
810
        }
811
        String url = MainApplication.url + "/zhannew/basic/web/index.php/car/my?userid=" + MainApplication.userId + "&order=1" + "&token=" + token;
812
        Log.e("TAG -- hyc", "getCarOwnerCertificateList: " + url);
813
        OkHttpUtils.get().url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
814
815
            @Override
816
            public void onError(Call call, Exception e) {
788 817
818
            }
789 819
820
            @Override
821
            public void onResponse(String response) {
822
                String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
823
                if ("01".equals(rtnCode)) {
824
                    String chexing = "";
825
                    String data = JsonUtils.getKeyResult(response, "data");
826
                    List<CarOwnerCertificateBean> list = JsonUtils.parseToObjectList(data, CarOwnerCertificateBean.class);
827
                    boolean certificated = false;
828
                    for (CarOwnerCertificateBean bean : list) {
829
                        if (bean.getStatus() != 2) { //排除意向车型,则证明用户已经车主认证过了
830
                            chexing = bean.getChexing();
831
                            certificated = true;
832
                            break;
833
                        }
834
                    }
835
                    if (certificated) {
836
                        Gson gson = new Gson();
837
                        CarSeriesEntity carSeriesEntity = gson.fromJson(chexing, CarSeriesEntity.class);
838
                        MainApplication.userCertifiedModel = carSeriesEntity.getSeriesName();
839
                    }
840
                }
841
                if (MainApplication.userCertifiedModel.equals("")){
842
                    layoutCarCertificate.setVisibility(View.VISIBLE);
843
                }else{
844
                    layoutCarCertificate.setVisibility(View.GONE);
845
                }
846
            }
847
        });
848
    }
790 849
}

+ 393 - 17
app/src/main/java/com/electric/chargingpile/activity/ConfirmOrderActivity.java

@ -2,9 +2,16 @@ package com.electric.chargingpile.activity;
2 2
3 3
import android.content.Context;
4 4
import android.content.Intent;
5
import android.graphics.Color;
5 6
import android.os.Bundle;
7
import android.os.Handler;
8
import android.text.TextUtils;
9
import android.util.Log;
6 10
import android.view.View;
11
import android.widget.ImageView;
7 12
import android.widget.RelativeLayout;
13
import android.widget.TextView;
14
import android.widget.Toast;
8 15
9 16
import androidx.annotation.Nullable;
10 17
import androidx.appcompat.app.AppCompatActivity;
@ -12,49 +19,204 @@ import androidx.fragment.app.Fragment;
12 19
import androidx.fragment.app.FragmentManager;
13 20
import androidx.fragment.app.FragmentTransaction;
14 21
22
import com.blankj.utilcode.util.LogUtils;
15 23
import com.electric.chargingpile.R;
24
import com.electric.chargingpile.application.MainApplication;
25
import com.electric.chargingpile.constant.BaseConstants;
26
import com.electric.chargingpile.constant.UrlConstants;
27
import com.electric.chargingpile.data.ChargingBean;
28
import com.electric.chargingpile.data.RedEnvelopeBean;
29
import com.electric.chargingpile.manager.ProfileManager;
30
import com.electric.chargingpile.util.JsonUtils;
31
import com.electric.chargingpile.util.LoadingDialog;
32
import com.electric.chargingpile.util.ToastUtil;
33
import com.electric.chargingpile.util.Util;
16 34
import com.electric.chargingpile.view.PreferentialDialog;
35
import com.google.gson.Gson;
36
import com.google.gson.reflect.TypeToken;
37
import com.google.zxing.client.android.constant.ChargingConstants;
38
import com.tencent.bugly.crashreport.CrashReport;
39
import com.zhy.http.okhttp.OkHttpUtils;
40
import com.zhy.http.okhttp.callback.StringCallback;
41
42
import java.util.List;
43
44
import okhttp3.Call;
17 45
18 46
/**
19 47
 * 确认订单
20 48
 * */
21 49
public class ConfirmOrderActivity extends AppCompatActivity implements View.OnClickListener {
22 50
23
    private RelativeLayout layoutRed;
51
    private RelativeLayout layoutRed,rl_end_info;
52
    private TextView tv_name,tv_charging_shifu,tv_charging_cost,tv_service_cost,tv_charging_hongbao,
53
            tv_zhuang_no,tv_charging_time,tv_charging_liang,tv_tishi,tv_gocomment;
54
    private ImageView default_hb,iv_back;
55
56
    private String mRedEnvelopeId=null;
57
    private String activeUrl;
58
    private ChargingBean mChargingBean;
59
    private LoadingDialog mDialog;
60
    private int try_count=0;
61
    private int delayedSettlementCount=0;
24 62
25 63
    @Override
26 64
    protected void onCreate(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
27 65
        super.onCreate(savedInstanceState);
28 66
        setContentView(R.layout.activity_submit_orders);
67
        mDialog = new LoadingDialog(this);
68
        mDialog.setCanceledOnTouchOutside(false);
69
70
        initIntent();
29 71
        initView();
72
        initData();
73
    }
74
75
    private void initIntent() {
76
        mChargingBean = (ChargingBean) getIntent().getSerializableExtra(BaseConstants.CHARGING_DATA);
77
        activeUrl = getIntent().getStringExtra(BaseConstants.ACTIVITY_URL);
78
        String orderId = getIntent().getStringExtra(ChargingConstants.ORDERID);
79
        if (!TextUtils.isEmpty(orderId)){
80
           requestDelayedSettlement(orderId);
81
        }
82
    }
83
84
    private void requestDelayedSettlement(String orderId) {
85
        delayedSettlementCount++;
86
        if (this != null && !this.isFinishing()) {
87
            mDialog.show();
88
        }
89
        Log.e("TAG", "requestDelayedSettlement: userid: "+MainApplication.userId );
90
        Log.e("TAG", "requestDelayedSettlement: pwd: "+ MainApplication.userPassword);
91
        Log.e("TAG", "requestDelayedSettlement: orderid: "+ orderId);
92
        OkHttpUtils.get()
93
                .url(UrlConstants.QUERY_NOT_CLOSE)
94
                .addParams(com.electric.chargingpile.constant.ChargingConstants.USERID, MainApplication.userId)
95
                .addParams(com.electric.chargingpile.constant.ChargingConstants.PWD, MainApplication.userPassword)
96
                .addParams(com.electric.chargingpile.constant.ChargingConstants.ORDERID, orderId)
97
                .build()
98
                .connTimeOut(15000)
99
                .readTimeOut(15000)
100
                .execute(new StringCallback() {
101
                    @Override
102
                    public void onError(Call call, Exception e) {
103
                        LogUtils.e();
104
                        ToastUtil.showToast(getApplicationContext(), "网络异常,请检查您的网络连接", Toast.LENGTH_SHORT);
105
                        CrashReport.postCatchedException(e);
106
107
                        Log.e(this.getClass().getName(),"requestDelayedSettlement--onError--"+e.getMessage());
108
109
                    }
110
111
                    @Override
112
                    public void onResponse(String response) {
113
                        LogUtils.e("hyc requestDelayedSettlement--" + response);
114
                        String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
115
                        String rtnMsg = JsonUtils.getKeyResult(response, "rtnMsg");
116
117
                        if (null != rtnCode) {
118
                            if ("01".equals(rtnCode)) {
119
                                String data = JsonUtils.getKeyResult(response, "data");
120
                                ChargingBean chargingBean = JsonUtils.parseToObjectBean(data, ChargingBean.class);
121
                                int status = chargingBean.getStatus();
122
                                if (status >= 2) {
123
                                    mChargingBean=chargingBean;
124
                                    dismissDialog();
125
                                    upDateView();
126
                                } else {
127
                                    if (delayedSettlementCount < 6) {
128
                                        new Handler().postDelayed(new Runnable() {
129
                                            @Override
130
                                            public void run() {
131
                                                requestDelayedSettlement(orderId);
132
                                            }
133
                                        }, 2000);
134
                                    } else {
135
                                        dismissDialog();
136
                                        startActivity(new Intent(getApplicationContext(), DelayInfoActivity.class));
137
                                        finish();
138
                                    }
139
                                }
140
                            }
141
                            if ("02".equals(rtnCode)) {
142
                                dismissDialog();
143
                                startActivity(new Intent(getApplicationContext(), DelayInfoActivity.class));
144
                                finish();
145
                            } else {
146
                                dismissDialog();
147
                                ToastUtil.showToast(getApplicationContext(),rtnMsg,Toast.LENGTH_SHORT);
148
                            }
149
                        }
150
151
                    }
152
                });
30 153
    }
31 154
32 155
    private void initView() {
156
        iv_back = findViewById(R.id.iv_back);
157
158
        tv_name=findViewById(R.id.tv_name);
159
        tv_charging_shifu=findViewById(R.id.tv_charging_shifu);
160
        tv_charging_cost=findViewById(R.id.tv_charging_cost);
161
        tv_service_cost=findViewById(R.id.tv_service_cost);
162
163
33 164
        layoutRed = findViewById(R.id.layoutRed);
165
//        default_hb = findViewById(R.id.default_hb);
166
        tv_charging_hongbao  = findViewById(R.id.tv_charging_hongbao);
167
168
        tv_zhuang_no=findViewById(R.id.tv_zhuang_no);
169
        tv_charging_time=findViewById(R.id.tv_charging_time);
170
        tv_charging_liang=findViewById(R.id.tv_charging_liang);
171
        tv_tishi=findViewById(R.id.tv_tishi);
172
        rl_end_info=findViewById(R.id.rl_end_info);
173
174
        tv_gocomment = findViewById(R.id.tv_gocomment);
175
176
        iv_back.setOnClickListener(this);
34 177
        layoutRed.setOnClickListener(this);
178
        tv_gocomment.setOnClickListener(this);
179
180
        upDateView();
181
35 182
    }
36 183
184
    private void upDateView() {
185
        if (mChargingBean!=null){
186
            tv_name.setText(mChargingBean.getZhanname());
187
            tv_charging_shifu.setText(mChargingBean.getUserMoney());
188
            tv_charging_cost.setText(mChargingBean.getElecMoney()+"元");
189
            tv_service_cost.setText(mChargingBean.getServiceMoney()+"元");
190
            tv_charging_hongbao.setText("默认已选择最大优惠 >");
37 191
38
    @Override
39
    public void onClick(View v) {
40
        switch (v.getId()){
41
            case R.id.layoutRed:
42
                FragmentManager fragmentManager = getSupportFragmentManager();
43
                FragmentTransaction ft = fragmentManager.beginTransaction();
44
                Fragment prev = fragmentManager.findFragmentByTag(PreferentialDialog.class.getName());
45
                if (prev != null) {
46
                    ft.remove(prev);
47
                }
192
            tv_zhuang_no.setText(mChargingBean.getStubId());
193
            tv_charging_time.setText(mChargingBean.getTimeCharge());
194
            tv_charging_liang.setText(mChargingBean.getPower()+"度");
48 195
49
                PreferentialDialog dialog= PreferentialDialog.newInstance();
50
                dialog.show(fragmentManager,PreferentialDialog.class.getName());
196
           /* if (TextUtils.isEmpty(mChargingBean.getEndInfo())) {
197
                rl_end_info.setVisibility(View.GONE);
198
            }else{
199
                tv_tishi.setText(mChargingBean.getEndInfo());
200
                rl_end_info.setVisibility(View.VISIBLE);
201
            }*/
202
        }
203
    }
51 204
52
                fragmentManager.executePendingTransactions();
53 205
206
    @Override
207
    public void onClick(View v) {
208
        switch (v.getId()){
209
            case R.id.layoutRed: //优惠券选择
210
//                default_hb.setVisibility(View.GONE);
211
                showPreferentialDialog();
54 212
                break;
55 213
            case R.id.tv_gocomment:
56
                Intent oderIntent = new Intent(this, OderDetailsActivity.class);
57
                startActivity(oderIntent);
214
                if (TextUtils.isEmpty(mRedEnvelopeId)){
215
                    pollingChargingStats();
216
217
                }else{
218
                    requestComment();
219
                }
58 220
                break;
59 221
            case R.id.iv_back:
60 222
                finish();
@ -62,8 +224,222 @@ public class ConfirmOrderActivity extends AppCompatActivity implements View.OnCl
62 224
        }
63 225
    }
64 226
65
    public static void actionStart(Context context){
227
    private void  requestComment() {
228
        if (this != null && !this.isFinishing()) {
229
            mDialog.show();
230
        }
231
        Log.e("TAG_hcy", "requestComment: "+mRedEnvelopeId);
232
        OkHttpUtils.get()
233
                .url(UrlConstants.SETTLEMENT)
234
                .addParams(ChargingConstants.USERID, MainApplication.userId)
235
                .addParams(ChargingConstants.PWD, MainApplication.userPassword)
236
                .addParams(ChargingConstants.ORDERID, mChargingBean.getOrderId())
237
                .addParams(ChargingConstants.HBID, mRedEnvelopeId)
238
                .build()
239
                .execute(new StringCallback() {
240
                    @Override
241
                    public void onError(Call call, Exception e) {
242
                        dismissDialog();
243
                        LogUtils.e();
244
                        ToastUtil.showToast(getApplicationContext(), "网络异常,请检查您的网络连接", Toast.LENGTH_SHORT);
245
                        CrashReport.postCatchedException(e);
246
247
                        Log.e(this.getClass().getName(),"requestComment--onError--"+e.getMessage());
248
                    }
249
250
                    @Override
251
                    public void onResponse(String response) {
252
                        LogUtils.e("SETTLEMENT=" + response);
253
                        String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
254
                        String rtnMsg = JsonUtils.getKeyResult(response, "rtnMsg");
255
                        dismissDialog();
256
                        if (null != rtnCode) {
257
                            if ("01".equals(rtnCode)) {
258
                                pollingChargingStats();
259
                            }
260
                        }
261
262
                    }
263
                });
264
265
    }
266
    private void pollingChargingStats() {
267
        try_count++;
268
        OkHttpUtils.get().url(UrlConstants.CHARGING_STATUS_URL)
269
                .addParams(com.electric.chargingpile.constant.ChargingConstants.USERID, MainApplication.userId)
270
                .addParams(com.electric.chargingpile.constant.ChargingConstants.PWD, MainApplication.userPassword)
271
                .addParams(com.electric.chargingpile.constant.ChargingConstants.ORDERID, mChargingBean.getOrderId())
272
                .tag(this)
273
                .build()
274
                .connTimeOut(15000)
275
                .readTimeOut(15000)
276
                .execute(new StringCallback() {
277
                    @Override
278
                    public void onError(Call call, Exception e) {
279
//                        dismissDialog();
280
//                        ToastUtil.showToast(getApplicationContext(),"网络异常,请检查您的网络连接",Toast.LENGTH_SHORT);
281
                        CrashReport.postCatchedException(e);
282
                    }
283
284
                    @Override
285
                    public void onResponse(String response) {
286
                        LogUtils.e("polling=" + response);
287
                        String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
288
                        String rtnMsg = JsonUtils.getKeyResult(response, "rtnMsg");
289
                        if (null != rtnCode) {
290
                            if ("01".equals(rtnCode)) {
291
                                String data = JsonUtils.getKeyResult(response, "data");
292
                                ChargingBean chargingBean = JsonUtils.parseToObjectBean(data, ChargingBean.class);
293
                                int status = chargingBean.getStatus();
294
                                if (status >= 4) {
295
//                                    if (mTimer != null) {
296
//                                        mTimer.cancel();
297
//                                        mTimer = null;
298
//                                    }
299
//                                    if (timer != null) {
300
//                                        timer.cancel();
301
//                                        timer = null;
302
//                                    }
303
                                    dismissDialog();
304
                                    ToastUtil.showToast(getApplicationContext(), "本次充电已结束", Toast.LENGTH_SHORT);
305
                                    MainApplication.isAppStart = false;
306
                                    ProfileManager.getInstance().setAppStart(getApplicationContext(), MainApplication.isAppStart);
307
                                    Intent intent = new Intent(getApplicationContext(), OderDetailsActivity.class);
308
                                    intent.putExtra(BaseConstants.CHARGING_DATA, chargingBean);
309
                                    intent.putExtra(BaseConstants.ACTIVITY_URL, activeUrl);
310
                                    startActivity(intent);
311
                                    finish();
312
313
                                } else {
314
                                    if (try_count < 6) {
315
                                        new Handler().postDelayed(new Runnable() {
316
                                            @Override
317
                                            public void run() {
318
                                                pollingChargingStats();
319
                                            }
320
                                        }, 2000);
321
                                    } else {
322
                                        dismissDialog();
323
                                        startActivity(new Intent(getApplicationContext(), DelayInfoActivity.class));
324
                                        finish();
325
                                    }
326
                                }
327
                            }
328
                            if ("02".equals(rtnCode)) {
329
                                dismissDialog();
330
                                startActivity(new Intent(getApplicationContext(), DelayInfoActivity.class));
331
                                finish();
332
                            } else {
333
//                                dismissDialog();
334
//                                ToastUtil.showToast(getApplicationContext(),rtnMsg,Toast.LENGTH_SHORT);
335
                            }
336
                        }
337
                    }
338
                });
339
    }
340
341
342
343
    private void showPreferentialDialog() {
344
        FragmentManager fragmentManager = getSupportFragmentManager();
345
        FragmentTransaction ft = fragmentManager.beginTransaction();
346
        Fragment prev = fragmentManager.findFragmentByTag(PreferentialDialog.class.getName());
347
        if (prev != null) {
348
            ft.remove(prev);
349
        }
350
        if (TextUtils.isEmpty(mChargingBean.getUserMoney())){
351
            Toast.makeText(this, "结算金额出现问题", Toast.LENGTH_SHORT).show();
352
            return ;
353
        }
354
        PreferentialDialog dialog= PreferentialDialog.newInstance(mChargingBean.getUserMoney());
355
        dialog.setListener(bean -> {
356
            if (bean!=null){
357
                String hongbao = Util.getRedEnvelopeName(bean);
358
                mRedEnvelopeId=bean.getId();
359
                tv_charging_hongbao.setText(hongbao+" >");
360
            }
361
        });
362
        dialog.show(fragmentManager,PreferentialDialog.class.getName());
363
        fragmentManager.executePendingTransactions();
364
    }
365
    private void dismissDialog() {
366
        if (this != null && !this.isFinishing()) {
367
            if (mDialog.isShowing()) {
368
                mDialog.dismiss();
369
            }
370
        }
371
    }
372
373
374
    private void initData() {
375
        OkHttpUtils.get()
376
                .url(com.google.zxing.client.android.constant.UrlConstants.RED_ENVELOPE_LIST)
377
                .addParams(ChargingConstants.USERID, MainApplication.userId)
378
                .addParams(ChargingConstants.PWD, MainApplication.userPassword)
379
                .build()
380
                .execute(new StringCallback() {
381
                    @Override
382
                    public void onError(Call call, Exception e) {
383
384
                    }
385
386
                    @Override
387
                    public void onResponse(String response) {
388
                        Log.d("HYC", "onResponse: " + response);
389
390
                        Gson gson = new Gson();
391
                        List<RedEnvelopeBean> datas = gson.fromJson(response, new TypeToken<List<RedEnvelopeBean>>() {
392
                        }.getType());
393
                        if (datas != null) {
394
                            removeData(datas);
395
                            if (datas.size()>0){
396
                                layoutRed.setEnabled(true);
397
                            }else{
398
                                layoutRed.setEnabled(false);
399
                                tv_charging_hongbao.setText("暂无红包/优惠券");
400
                                tv_charging_hongbao.setTextColor(Color.parseColor("#DDDDDD"));
401
                            }
402
                        }else{
403
                            layoutRed.setEnabled(false);
404
                            tv_charging_hongbao.setText("暂无红包/优惠券");
405
                            tv_charging_hongbao.setTextColor(Color.parseColor("#DDDDDD"));
406
407
                        }
408
                    }
409
                });
410
    }
411
412
    private void removeData(List<RedEnvelopeBean> datas) {
413
        String userMoney = mChargingBean.getUserMoney();
414
        if (TextUtils.isEmpty(userMoney)){
415
            return;
416
        }
417
        try {
418
            for (int i = datas.size() - 1; i >= 0; i--) {
419
                RedEnvelopeBean redEnvelopeBean = datas.get(i);
420
                double max_money = Double.parseDouble(redEnvelopeBean.getMax_money());
421
                double money = Double.parseDouble(userMoney);
422
                if (money < max_money) {
423
                    datas.remove(i);
424
                }
425
            }
426
        } catch (NumberFormatException e) {
427
            LogUtils.e("polling=" + e.getMessage());
428
        }
429
430
    }
431
432
    @Override
433
    protected void onDestroy() {
434
        super.onDestroy();
435
        try_count = 0;
436
        delayedSettlementCount = 0;
437
    }
438
439
    public static void actionStart(Context context, ChargingBean bean, String activeUrl){
66 440
        Intent intent = new Intent(context, ConfirmOrderActivity.class);
441
        intent.putExtra(BaseConstants.CHARGING_DATA,bean);
442
        intent.putExtra(BaseConstants.ACTIVITY_URL,activeUrl);
67 443
        context.startActivity(intent);
68 444
    }
69 445

+ 2 - 1
app/src/main/java/com/electric/chargingpile/activity/MainMapActivity.java

@ -131,6 +131,7 @@ import com.electric.chargingpile.util.ZhanDBHelper;
131 131
import com.electric.chargingpile.view.AlertDialogCommon;
132 132
import com.electric.chargingpile.view.AlertDialogUpdate;
133 133
import com.electric.chargingpile.view.NotRegisterDialog;
134
import com.electric.chargingpile.view.PreferentialDialog;
134 135
import com.electric.chargingpile.view.SlideAdView;
135 136
import com.electric.chargingpile.view.UpdateDialog;
136 137
import com.google.gson.Gson;
@ -908,7 +909,7 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
908 909
        }
909 910
910 911
        showPostDelayedDialog();
911
912
//        ConfirmOrderActivity.actionStart(this);
912 913
//        startActivity(new Intent(getApplication(), ChargingStatusActivity.class));
913 914
//        startActivity(new Intent(this, SkipUserInfoActivity.class));
914 915
    }

+ 3 - 7
app/src/main/java/com/electric/chargingpile/activity/UserInfoActivity.java

@ -1057,11 +1057,6 @@ public class UserInfoActivity extends Activity implements View.OnClickListener,
1057 1057
        super.onResume();
1058 1058
        MobclickAgent.onResume(this);
1059 1059
        getCarOwnerCertificateList(false);
1060
        String carIntentModel = ProfileManager.getInstance().getCarIntentModel(this);
1061
1062
        if (!TextUtils.isEmpty(carIntentModel)){
1063
            carModel.setText(carIntentModel);
1064
        }
1065 1060
    }
1066 1061
1067 1062
    @Override
@ -1106,6 +1101,7 @@ public class UserInfoActivity extends Activity implements View.OnClickListener,
1106 1101
            public void onResponse(String response) {
1107 1102
                loadDialog.dismiss();
1108 1103
                String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
1104
                Log.e(TAG, "onResponse: "+response );
1109 1105
                if ("01".equals(rtnCode)) {
1110 1106
                    String data = JsonUtils.getKeyResult(response, "data");
1111 1107
                    List<CarOwnerCertificateBean> list = JsonUtils.parseToObjectList(data, CarOwnerCertificateBean.class);
@ -1149,14 +1145,14 @@ public class UserInfoActivity extends Activity implements View.OnClickListener,
1149 1145
                        go_title.setText("认证车主");
1150 1146
                        go_desc.setText("审核中");
1151 1147
                        go_desc.setTextColor(Color.RED);
1152
                        go_cursor.setVisibility(View.GONE);
1148
                        go_cursor.setVisibility(View.INVISIBLE);
1153 1149
                    } else if (certificateStatus == 3) {
1154 1150
                        go_title.setText("认证车主");
1155 1151
                        if (carSeriesEntity != null) {
1156 1152
                            go_desc.setText(carSeriesEntity.getSeriesName());
1157 1153
                        }
1158 1154
                        go_desc.setTextColor(Color.parseColor("#0E0E0E"));
1159
                        go_cursor.setVisibility(View.GONE);
1155
                        go_cursor.setVisibility(View.INVISIBLE);
1160 1156
                    } else {
1161 1157
                        go_title.setText("认证车主");
1162 1158
                        go_desc.setText("去认证车主(得充电优惠券)");

+ 62 - 10
app/src/main/java/com/electric/chargingpile/adapter/PreferentialAdapter.java

@ -1,15 +1,19 @@
1 1
package com.electric.chargingpile.adapter;
2 2
3
import android.content.Context;
3 4
import android.view.LayoutInflater;
4 5
import android.view.View;
5 6
import android.view.ViewGroup;
6 7
import android.widget.CheckBox;
7 8
import android.widget.TextView;
9
import android.widget.Toast;
8 10
9 11
import androidx.annotation.NonNull;
10 12
import androidx.recyclerview.widget.RecyclerView;
11 13
12 14
import com.electric.chargingpile.R;
15
import com.electric.chargingpile.data.RedEnvelopeBean;
16
import com.electric.chargingpile.util.Util;
13 17
14 18
import org.jetbrains.annotations.NotNull;
15 19
@ -18,7 +22,33 @@ import java.util.List;
18 22
19 23
public class PreferentialAdapter extends RecyclerView.Adapter<PreferentialAdapter.ViewHodler> {
20 24
21
    private List<String> mDatas=new ArrayList<String>();
25
    private List<RedEnvelopeBean> mDatas = new ArrayList<RedEnvelopeBean>();
26
    private Context mContext;
27
28
    private int lastPosition = -1;
29
    private int currentPostion = -1;
30
    public PreferentialAdapter(Context context){
31
        mContext=context;
32
    }
33
34
35
    public List<RedEnvelopeBean> getmDatas() {
36
        return mDatas;
37
    }
38
39
    public void setDatas(List<RedEnvelopeBean> datas) {
40
        RedEnvelopeBean element = new RedEnvelopeBean();
41
        element.setId("nono");
42
        element.setType("-1");
43
        element.setCheck(true);
44
        if (datas == null){
45
            datas = new ArrayList<RedEnvelopeBean>();
46
        }
47
        this.mDatas = datas;
48
        mDatas.add(0, element);
49
        notifyDataSetChanged();
50
    }
51
22 52
    @NonNull
23 53
    @NotNull
24 54
    @Override
@ -29,23 +59,45 @@ public class PreferentialAdapter extends RecyclerView.Adapter<PreferentialAdapte
29 59
30 60
    @Override
31 61
    public void onBindViewHolder(@NonNull @NotNull ViewHodler holder, int position) {
32
       holder.checkBox.setChecked(false);
33
       holder.name.setText("优惠券" + position);
62
        RedEnvelopeBean bean = mDatas.get(position);
63
        if (bean != null) {
64
            String name = Util.getRedEnvelopeName(bean);
65
66
            holder.checkBox.setChecked(bean.isCheck());
67
            holder.name.setText(name);
68
69
70
            holder.itemView.setOnClickListener(v->{
71
                if (bean.isCheck()){
72
                    return;
73
                }
74
                selectPostioin(position);
75
            });
34 76
35
       holder.checkBox.setOnClickListener(v->{
36
           selectPostioin(position);
37
       });
77
            holder.checkBox.setOnClickListener(v -> {
78
                if (bean.isCheck()){
79
                    holder.checkBox.setChecked(bean.isCheck());
80
                    return;
81
                }
82
83
                selectPostioin(position);
84
            });
85
        }
38 86
    }
39 87
40 88
    @Override
41 89
    public int getItemCount() {
42
        return 30;
90
        return mDatas.size();
43 91
    }
44 92
45
    private void selectPostioin(int postioin){
46
        for (int i = 0; i < mDatas.size(); i++) {
47
            //将下标对应的bean类修改为true,其他的bean修改为false即可。
93
    private void selectPostioin(int postioin) {
94
        for (RedEnvelopeBean bean:mDatas) {
95
            bean.setCheck(false);
48 96
        }
97
        currentPostion=postioin;
98
        mDatas.get(postioin).setCheck(true);
99
        notifyDataSetChanged();
100
49 101
    }
50 102
51 103
    public static class ViewHodler extends RecyclerView.ViewHolder {

+ 8 - 6
app/src/main/java/com/electric/chargingpile/application/MainApplication.java

@ -37,6 +37,7 @@ import com.nostra13.universalimageloader.core.assist.ImageScaleType;
37 37
import com.tencent.bugly.crashreport.CrashReport;
38 38
import com.zhy.http.okhttp.OkHttpUtils;
39 39
import com.zhy.http.okhttp.callback.StringCallback;
40
import com.zhy.http.okhttp.log.LoggerInterceptor;
40 41

41 42
import java.io.BufferedReader;
42 43
import java.io.BufferedWriter;
@ -54,6 +55,7 @@ import java.util.Map;
54 55

55 56
import cn.jpush.android.api.JPushInterface;
56 57
import okhttp3.Call;
58
import okhttp3.OkHttpClient;
57 59

58 60

59 61
public class MainApplication extends MultiDexApplication {
@ -88,13 +90,13 @@ public class MainApplication extends MultiDexApplication {
88 90
    public static String firstPoint = "";
89 91
    public static Boolean firstSsyd;
90 92
    public static String password = "";
91
        public static String url = "http://59.110.68.162";// 充电桩测试环境
92
    public static String pic_url = "http://59.110.68.162/zhannew/uploadfile/";
93
//    public static String url = "http://cdz.evcharge.cc";// 充电桩正式环境
94
//    public static String pic_url = "http://cdz.evcharge.cc/zhannew/uploadfile/";
93
//        public static String url = "http://59.110.68.162";// 充电桩测试环境
94
//    public static String pic_url = "http://59.110.68.162/zhannew/uploadfile/";
95
    public static String url = "http://cdz.evcharge.cc";// 充电桩正式环境
96
    public static String pic_url = "http://cdz.evcharge.cc/zhannew/uploadfile/";
95 97

96
        public static String urlNew = "http://123.56.67.7:83/api/0300";// 一电测试环境
97
//    public static String urlNew = "https://api.touchev.com:83/api/0300";// 一电正式环境
98
//        public static String urlNew = "http://123.56.67.7:83/api/0300";// 一电测试环境
99
    public static String urlNew = "https://api.touchev.com:83/api/0300";// 一电正式环境
98 100

99 101

100 102
    //	public static String url = "https://cdz.d1ev.com";

+ 8 - 5
app/src/main/java/com/electric/chargingpile/constant/UrlConstants.java

@ -1,9 +1,12 @@
1 1
package com.electric.chargingpile.constant;
2 2
3 3
public interface UrlConstants {
4
    String HOST_URL = "http://cdz.evcharge.cc/zhannew/basic/web/index.php/";
5
    String USER_CHARGING_CHECK_URL = HOST_URL + "api/charge/check-user";
6
    String START_CHARGING_URL = HOST_URL + "api/charge/start";
7
    String CHARGING_STATUS_URL = HOST_URL + "api/charge/query";
8
    String STOP_CHARGING_URL = HOST_URL + "api/charge/close";
4
    String HOST_URL = com.google.zxing.client.android.constant.UrlConstants.HOST_URL;
5
    String USER_CHARGING_CHECK_URL = com.google.zxing.client.android.constant.UrlConstants.USER_CHARGING_CHECK_URL;
6
    String START_CHARGING_URL = com.google.zxing.client.android.constant.UrlConstants.START_CHARGING_URL;
7
    String CHARGING_STATUS_URL = com.google.zxing.client.android.constant.UrlConstants.CHARGING_STATUS_URL;
8
9
    String STOP_CHARGING_URL =com.google.zxing.client.android.constant.UrlConstants.STOP_CHARGING_URL;
10
    String SETTLEMENT = com.google.zxing.client.android.constant.UrlConstants.SETTLEMENT;
11
    String QUERY_NOT_CLOSE =com.google.zxing.client.android.constant.UrlConstants.QUERY_NOT_CLOSE;
9 12
}

+ 108 - 0
app/src/main/java/com/electric/chargingpile/data/RedEnvelopeBean.java

@ -0,0 +1,108 @@
1
package com.electric.chargingpile.data;
2
3
public class RedEnvelopeBean{
4
    /**
5
     * {
6
     *         "money":"5",
7
     *         "max_money":"20",
8
     *         "id":"41967",
9
     *         "end_time":"1606607999",
10
     *         "type":"3",
11
     *         "supplier":"",
12
     *         "title":"\u4f18\u8d28\u8bc4\u8bba"
13
     *     }
14
     *
15
     *    0邀请好友分享红包 1兑换 2注册赠送红包 3优质评论 4纠错奖励 5车主认证 6车主成交价 7服务费折扣 8订单折扣
16
     *    7,8的时候 money是百分值
17
     *
18
     * */
19
    private String money;
20
    private String max_money;
21
    private String id;
22
    private String end_time;
23
    private String type;
24
    private String supplier;
25
    private String title;
26
    private boolean isCheck;
27
28
    public boolean isCheck() {
29
        return isCheck;
30
    }
31
32
    public void setCheck(boolean check) {
33
        isCheck = check;
34
    }
35
36
    public RedEnvelopeBean() {
37
    }
38
39
    public String getMoney() {
40
        return money;
41
    }
42
43
    public void setMoney(String money) {
44
        this.money = money;
45
    }
46
47
    public String getMax_money() {
48
        return max_money;
49
    }
50
51
    public void setMax_money(String max_money) {
52
        this.max_money = max_money;
53
    }
54
55
    public String getId() {
56
        return id;
57
    }
58
59
    public void setId(String id) {
60
        this.id = id;
61
    }
62
63
    public String getEnd_time() {
64
        return end_time;
65
    }
66
67
    public void setEnd_time(String end_time) {
68
        this.end_time = end_time;
69
    }
70
71
    public String getType() {
72
        return type;
73
    }
74
75
    public void setType(String type) {
76
        this.type = type;
77
    }
78
79
    public String getSupplier() {
80
        return supplier;
81
    }
82
83
    public void setSupplier(String supplier) {
84
        this.supplier = supplier;
85
    }
86
87
    public String getTitle() {
88
        return title;
89
    }
90
91
    public void setTitle(String title) {
92
        this.title = title;
93
    }
94
95
    @Override
96
    public String toString() {
97
        return "RedEnvelopeBean{" +
98
                "money='" + money + '\'' +
99
                ", max_money='" + max_money + '\'' +
100
                ", id='" + id + '\'' +
101
                ", end_time='" + end_time + '\'' +
102
                ", type='" + type + '\'' +
103
                ", supplier='" + supplier + '\'' +
104
                ", title='" + title + '\'' +
105
                ", isCheck=" + isCheck +
106
                '}';
107
    }
108
}

+ 51 - 0
app/src/main/java/com/electric/chargingpile/util/Util.java

@ -20,6 +20,7 @@ import com.blankj.utilcode.util.StringUtils;
20 20
import com.electric.chargingpile.R;
21 21
import com.electric.chargingpile.activity.MainMapActivity;
22 22
import com.electric.chargingpile.application.MainApplication;
23
import com.electric.chargingpile.data.RedEnvelopeBean;
23 24
import com.electric.chargingpile.data.Zhan;
24 25
import com.electric.chargingpile.data.Zhuang;
25 26
import com.electric.chargingpile.manager.ProfileManager;
@ -598,4 +599,54 @@ public class Util {
598 599
            return false;
599 600
        }
600 601
    }
602

603
    public static String getRedEnvelopeName(RedEnvelopeBean bean) {
604
        String str="";
605
        if (bean.getType() == null){
606
            bean.setType("");
607
        }
608
        if (bean.getType().equals("7")){
609
            String format = getDisCount(bean);
610
            str="服务费"+format+"折";
611
        }else if (bean.getType().equals("8")){
612
            String format = getDisCount(bean);
613
            str="订单费"+format+"折";
614
        }else if (bean.getType().equals("-1")){
615
            str="不使用";
616
        }else if(bean.getType().equals("")){
617
            str="--";
618
        } else{
619
            str="满"+bean.getMax_money()+"减"+bean.getMoney();
620
        }
621

622
/*
623
        switch (bean.getType()) {
624
            case "-1":
625
                break;
626
            case "0":
627
            case "1":
628
            case "2":
629
            case "3":
630
            case "4":
631
            case "5":
632
            case "6":
633
                break;
634

635
            case "7": //服务费折扣
636
                break;
637
            case "8": //订单折扣
638
                break;
639
            default:
640
                str="--";
641
                break;
642
        }
643
*/
644
        return str;
645
    }
646

647
    private static String getDisCount(RedEnvelopeBean bean) {
648
        double money = Double.parseDouble(bean.getMoney());
649
        double discount = money / 10;
650
        return String.format("%.1f", discount);
651
    }
601 652
}

+ 141 - 15
app/src/main/java/com/electric/chargingpile/view/PreferentialDialog.java

@ -1,9 +1,11 @@
1 1
package com.electric.chargingpile.view;
2 2
3 3
import android.os.Bundle;
4
import android.util.Log;
4 5
import android.view.LayoutInflater;
5 6
import android.view.View;
6 7
import android.view.ViewGroup;
8
import android.widget.ProgressBar;
7 9
import android.widget.TextView;
8 10
9 11
import androidx.annotation.NonNull;
@ -11,22 +13,45 @@ import androidx.annotation.Nullable;
11 13
import androidx.recyclerview.widget.LinearLayoutManager;
12 14
import androidx.recyclerview.widget.RecyclerView;
13 15
16
import com.blankj.utilcode.util.LogUtils;
14 17
import com.electric.chargingpile.R;
15 18
import com.electric.chargingpile.adapter.PreferentialAdapter;
19
import com.electric.chargingpile.application.MainApplication;
20
import com.electric.chargingpile.data.RechargeData;
21
import com.electric.chargingpile.data.RedEnvelopeBean;
16 22
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
23
import com.google.gson.Gson;
24
import com.google.gson.reflect.TypeToken;
25
import com.google.zxing.client.android.constant.ChargingConstants;
26
import com.google.zxing.client.android.constant.UrlConstants;
27
import com.zhy.http.okhttp.OkHttpUtils;
28
import com.zhy.http.okhttp.builder.GetBuilder;
29
import com.zhy.http.okhttp.callback.StringCallback;
17 30
18 31
import org.jetbrains.annotations.NotNull;
32
33
import java.util.ArrayList;
34
import java.util.List;
35
36
import okhttp3.Call;
37
19 38
/**
20 39
 * 选择优惠类型
21
 * */
40
 */
22 41
public class PreferentialDialog extends BottomSheetDialogFragment {
23 42
24 43
    private RecyclerView recyclerView;
25 44
    private CompleteListener mListener;
45
    private PreferentialAdapter mAdapter;
46
    private TextView noPreferential;
47
    private String userMoney;   //用户费用
48
    private ProgressBar mProgressBar;
26 49
27
    public static  PreferentialDialog newInstance(){
50
    public static PreferentialDialog newInstance(String userMoney) {
28 51
        PreferentialDialog dialog = new PreferentialDialog();
29
        Bundle arguments = dialog.getArguments();
52
        Bundle arguments = new Bundle();
53
        arguments.putString("userMoney", userMoney);
54
        dialog.setArguments(arguments);
30 55
        return dialog;
31 56
    }
32 57
@ -42,29 +67,130 @@ public class PreferentialDialog extends BottomSheetDialogFragment {
42 67
    @org.jetbrains.annotations.Nullable
43 68
    @Override
44 69
    public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
45
        View rootView=inflater.inflate(R.layout.dialog_preferential,container,false);
46
        return rootView;
70
        return inflater.inflate(R.layout.dialog_preferential, container, false);
47 71
    }
48 72
49 73
    @Override
50 74
    public void onViewCreated(@NonNull @NotNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
51 75
        super.onViewCreated(view, savedInstanceState);
52
        TextView complete=view.findViewById(R.id.complete);
76
        initIntent();
77
        initView(view);
78
        initData();
79
80
    }
81
82
    private void initIntent() {
83
        Bundle arguments = getArguments();
84
        if (arguments != null) {
85
            userMoney = arguments.getString("userMoney");
86
        }
87
88
89
    }
90
91
    private void initData() {
92
        recyclerView.setVisibility(View.GONE);
93
        mProgressBar.setVisibility(View.VISIBLE);
94
        OkHttpUtils.get()
95
                .url(UrlConstants.RED_ENVELOPE_LIST)
96
                .addParams(ChargingConstants.USERID, MainApplication.userId)
97
                .addParams(ChargingConstants.PWD, MainApplication.userPassword)
98
                .build()
99
                .execute(new StringCallback() {
100
                    @Override
101
                    public void onError(Call call, Exception e) {
102
103
                        recyclerView.setVisibility(View.GONE);
104
                        mProgressBar.setVisibility(View.GONE);
105
                        noPreferential.setVisibility(View.GONE);
106
                    }
107
108
                    @Override
109
                    public void onResponse(String response) {
110
                        Log.d("HYC", "onResponse: " + response);
111
112
                        mProgressBar.setVisibility(View.GONE);
113
                        Gson gson = new Gson();
114
                        List<RedEnvelopeBean> datas = gson.fromJson(response, new TypeToken<List<RedEnvelopeBean>>() {
115
                        }.getType());
116
                        if (datas != null) {
117
                            removeData(datas);
118
                            if (datas.size() > 0) {
119
                                recyclerView.setVisibility(View.VISIBLE);
120
                                noPreferential.setVisibility(View.GONE);
121
                                mAdapter.setDatas(datas);
122
                            } else {
123
                                recyclerView.setVisibility(View.GONE);
124
                                noPreferential.setVisibility(View.VISIBLE);
125
                            }
126
                        } else {
127
                            recyclerView.setVisibility(View.GONE);
128
                            noPreferential.setVisibility(View.VISIBLE);
129
                        }
130
131
//                            recyclerView.setVisibility(View.VISIBLE);
132
//                            noPreferential.setVisibility(View.GONE);
133
//                        }else{
134
//                            recyclerView.setVisibility(View.GONE);
135
//                            noPreferential.setVisibility(View.VISIBLE);
136
//                        }
137
138
                    }
139
                });
140
    }
141
142
    private void removeData(List<RedEnvelopeBean> datas) {
143
        try {
144
            for (int i = datas.size() - 1; i >= 0; i--) {
145
                RedEnvelopeBean redEnvelopeBean = datas.get(i);
146
                double max_money = Double.parseDouble(redEnvelopeBean.getMax_money());
147
                double money = Double.parseDouble(userMoney);
148
                if (money < max_money) {
149
                    datas.remove(i);
150
                }
151
            }
152
        } catch (NumberFormatException e) {
153
            LogUtils.e("polling=" + e.getMessage());
154
        }
155
156
    }
157
158
    private void initView(@NotNull View view) {
159
        TextView complete = view.findViewById(R.id.complete);
160
        noPreferential = view.findViewById(R.id.noPreferential);
53 161
        recyclerView = view.findViewById(R.id.recyclerView);
162
        mProgressBar = view.findViewById(R.id.progressBar);
54 163
        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
55
        PreferentialAdapter adapter=new PreferentialAdapter();
56
        recyclerView.setAdapter(adapter);
57
        complete.setOnClickListener(v->{
58
            //获取adapter被选中的数据,并且返回回调给
59
            mListener.onComplete();
164
        mAdapter = new PreferentialAdapter(getActivity());
165
        recyclerView.setAdapter(mAdapter);
166
        complete.setOnClickListener(v -> {
167
            complete();
60 168
        });
61 169
    }
62 170
63
    public void setListener(CompleteListener listener){
64
        mListener=listener;
171
    private void complete() {
172
        RedEnvelopeBean bean = null;
173
        //获取adapter被选中的数据,并且返回回调给
174
        if (mAdapter.getmDatas() != null) {
175
            for (RedEnvelopeBean redEnvelopeBean : mAdapter.getmDatas()) {
176
                if (redEnvelopeBean.isCheck()) {
177
                    bean = redEnvelopeBean;
178
                }
179
            }
180
        }
181
182
        if (mListener != null) {
183
            mListener.onComplete(bean);
184
        }
185
        Log.e("hyc", "complete 红包类: " + bean);
186
        dismissAllowingStateLoss();
187
    }
188
189
    public void setListener(CompleteListener listener) {
190
        mListener = listener;
65 191
    }
66 192
67
    public interface CompleteListener{
68
        void onComplete();
193
    public interface CompleteListener {
194
        void onComplete(RedEnvelopeBean bean);
69 195
    }
70 196
}

BIN
app/src/main/res/drawable-hdpi/icon_car_user_certificate.png


BIN
app/src/main/res/drawable-hdpi/icon_publish_price.png


BIN
app/src/main/res/drawable-mdpi/icon_car_user_certificate.png


BIN
app/src/main/res/drawable-mdpi/icon_publish_price.png


BIN
app/src/main/res/drawable-xhdpi/icon_car_user_certificate.png


BIN
app/src/main/res/drawable-xhdpi/icon_publish_price.png


BIN
app/src/main/res/drawable-xxxhdpi/icon_car_user_certificate.png


BIN
app/src/main/res/drawable-xxxhdpi/icon_publish_price.png


+ 1 - 1
app/src/main/res/layout/activity_oder_details.xml

@ -146,7 +146,7 @@
146 146
                android:layout_height="wrap_content"
147 147
                android:layout_alignParentLeft="true"
148 148
                android:layout_marginLeft="15dp"
149
                android:text="红包减免"
149
                android:text="红包/优惠券减免"
150 150
                android:textColor="@color/juhuang"
151 151
                android:textSize="14sp" />
152 152

+ 8 - 2
app/src/main/res/layout/activity_submit_orders.xml

@ -1,6 +1,7 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3
    android:layout_width="match_parent"
4
    xmlns:tools="http://schemas.android.com/tools"
4 5
    android:background="@color/white"
5 6
    android:layout_height="match_parent">
6 7
    <RelativeLayout
@ -17,7 +18,7 @@
17 18
            android:layout_width="wrap_content"
18 19
            android:layout_height="wrap_content"
19 20
            android:layout_centerInParent="true"
20
            android:text="订单详情"
21
            android:text="确认订单"
21 22
            android:textColor="@color/ui_62"
22 23
            android:textSize="18sp" />
23 24
@ -144,13 +145,16 @@
144 145
                android:layout_marginLeft="15dp"
145 146
                android:text="红包/优惠券"
146 147
                android:textSize="14sp" />
148
<!--
147 149
            <ImageView
150
                android:id="@+id/default_hb"
148 151
                android:layout_marginTop="8dp"
149 152
                android:layout_alignStart="@+id/redEnvelope"
150 153
                android:src="@drawable/ic_default_orders"
151 154
                android:layout_below="@+id/redEnvelope"
152 155
                android:layout_width="wrap_content"
153 156
                android:layout_height="wrap_content"/>
157
-->
154 158
155 159
            <TextView
156 160
                android:layout_centerVertical="true"
@ -159,7 +163,7 @@
159 163
                android:layout_height="wrap_content"
160 164
                android:layout_alignParentRight="true"
161 165
                android:layout_marginRight="15dp"
162
                android:text="--"
166
                android:text="--123"
163 167
                android:textColor="@color/juhuang"
164 168
                android:textSize="14sp" />
165 169
@ -251,6 +255,8 @@
251 255
        </RelativeLayout>
252 256
253 257
        <RelativeLayout
258
            tools:visibility="visible"
259
            android:visibility="gone"
254 260
            android:id="@+id/rl_end_info"
255 261
            android:layout_width="match_parent"
256 262
            android:layout_height="wrap_content"

+ 4 - 4
app/src/main/res/layout/activity_user_center.xml

@ -32,6 +32,7 @@
32 32
        android:layout_height="250dp"
33 33
        android:layout_centerHorizontal="true"
34 34
        android:background="@drawable/bg_center">
35
<!--
35 36
        <TextView
36 37
            android:id="@+id/tv_mine"
37 38
            android:layout_marginTop="24dp"
@ -43,10 +44,10 @@
43 44
            android:textColor="@color/color_white"
44 45
            android:textSize="20sp"
45 46
            />
47
-->
46 48
47 49
        <RelativeLayout
48
            android:layout_marginTop="22dp"
49
            android:layout_below="@+id/tv_mine"
50
            android:layout_marginTop="64dp"
50 51
            android:id="@+id/ll_btn"
51 52
            android:layout_width="wrap_content"
52 53
            android:layout_height="wrap_content"
@ -160,9 +161,8 @@
160 161
161 162
162 163
        <com.zhy.autolayout.AutoRelativeLayout
163
            android:layout_marginTop="22dp"
164
            android:layout_marginTop="64dp"
164 165
            android:id="@+id/ll_noLogin"
165
            android:layout_below="@+id/tv_mine"
166 166
            android:layout_width="wrap_content"
167 167
            android:layout_height="wrap_content"
168 168
            android:orientation="horizontal"

+ 6 - 9
app/src/main/res/layout/activity_user_info.xml

@ -129,13 +129,10 @@
129 129
                <EditText
130 130
                    android:id="@+id/et_nickName"
131 131
                    android:layout_width="wrap_content"
132
                    android:layout_height="130px"
132
                    android:layout_height="130dp"
133 133
                    android:layout_alignParentTop="true"
134 134
                    android:layout_alignParentEnd="true"
135
136
                    android:layout_alignParentRight="true"
137
                    android:layout_marginEnd="15dp"
138
                    android:layout_marginRight="15dp"
135
                    android:layout_marginEnd="30dp"
139 136
                    android:background="@color/white"
140 137
                    android:gravity="center|right"
141 138
                    android:hint="请输入昵称"
@ -163,14 +160,14 @@
163 160
                    android:textSize="15sp" />
164 161
165 162
                <TextView
163
164
                    tools:text="dsadas"
166 165
                    android:id="@+id/phone"
167 166
                    android:layout_width="wrap_content"
168
                    android:layout_height="130px"
167
                    android:layout_height="130dp"
169 168
                    android:layout_alignParentTop="true"
170 169
                    android:layout_alignParentEnd="true"
171
                    android:layout_alignParentRight="true"
172
                    android:layout_marginEnd="15dp"
173
                    android:layout_marginRight="15dp"
170
                    android:layout_marginEnd="30dp"
174 171
                    android:background="@color/white"
175 172
                    android:gravity="center|right"
176 173
                    android:textColor="@color/ui_62"

+ 21 - 12
app/src/main/res/layout/dialog_preferential.xml

@ -15,19 +15,28 @@
15 15
        android:textColor="#ff0e0e0e"
16 16
        android:textSize="18sp"
17 17
        />
18
    <androidx.recyclerview.widget.RecyclerView
19
        android:id="@+id/recyclerView"
18
    <RelativeLayout
20 19
        android:layout_width="match_parent"
21
        android:layout_height="320dp"/>
22
    <TextView
23
        android:visibility="gone"
24
        android:gravity="center"
25
        android:text="暂无优惠券~"
26
        android:textColor="#ff9b9b9b"
27
        android:textSize="18sp"
28
        android:id="@+id/noPreferential"
29
        android:layout_width="match_parent"
30
        android:layout_height="320dp"/>
20
        android:layout_height="320dp">
21
        <androidx.recyclerview.widget.RecyclerView
22
            android:id="@+id/recyclerView"
23
            android:layout_width="match_parent"
24
            android:layout_height="320dp"/>
25
        <ProgressBar
26
            android:id="@+id/progressBar"
27
            android:layout_centerInParent="true"
28
            android:layout_width="wrap_content"
29
            android:layout_height="wrap_content"    />
30
        <TextView
31
            android:visibility="gone"
32
            android:gravity="center"
33
            android:text="暂无优惠券~"
34
            android:textColor="#ff9b9b9b"
35
            android:textSize="18sp"
36
            android:id="@+id/noPreferential"
37
            android:layout_width="match_parent"
38
            android:layout_height="320dp"/>
39
    </RelativeLayout>
31 40
    <TextView
32 41
        android:id="@+id/complete"
33 42
        android:layout_width="match_parent"

+ 2 - 1
app/src/main/res/layout/item_text_checkbox.xml

@ -1,6 +1,7 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3
    android:layout_width="match_parent"
4
    xmlns:tools="http://schemas.android.com/tools"
4 5
    android:padding="10dp"
5 6
    android:layout_height="wrap_content">
6 7
@ -10,7 +11,7 @@
10 11
        android:layout_weight="1"
11 12
        android:layout_width="0dp"
12 13
        android:layout_height="wrap_content"
13
        android:text="不使用"
14
        tools:text="不使用"
14 15
        android:textColor="@color/color_ff333333"
15 16
        android:textSize="14sp" />
16 17
    <CheckBox

+ 2 - 0
app/src/main/res/layout/recommend_charging_station_item.xml

@ -212,6 +212,8 @@
212 212
        </LinearLayout>
213 213
    </LinearLayout>
214 214
    <TextView
215
        android:ellipsize="end"
216
        android:lines="1"
215 217
        android:visibility="gone"
216 218
        android:id="@+id/parkingFee"
217 219
        android:layout_marginEnd="15dp"

+ 25 - 8
zxing/src/main/java/com/google/zxing/client/android/CaptureActivity.java

@ -65,6 +65,7 @@ import com.google.zxing.client.android.camera.CameraManager;
65 65
import com.google.zxing.client.android.clipboard.ClipboardInterface;
66 66
import com.google.zxing.client.android.constant.ChargingConstants;
67 67
import com.google.zxing.client.android.constant.UrlConstants;
68
import com.google.zxing.client.android.data.DelayedSettlementBean;
68 69
import com.google.zxing.client.android.data.OperatorPicsBean;
69 70
import com.google.zxing.client.android.dialog.SettleAccountsDialog;
70 71
import com.google.zxing.client.android.history.HistoryItem;
@ -571,13 +572,13 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
571 572
    @Override
572 573
    public void onActivityResult(int requestCode, int resultCode, Intent intent) {
573 574
        if (resultCode == RESULT_OK && requestCode == HISTORY_REQUEST_CODE && historyManager != null) {
574
            if (isSettleAccounts == 0){
575
//            if (isSettleAccounts == 0){
575 576
                int itemNumber = intent.getIntExtra(Intents.History.ITEM_NUMBER, -1);
576 577
                if (itemNumber >= 0) {
577 578
                    HistoryItem historyItem = historyManager.buildHistoryItem(itemNumber);
578 579
                    decodeOrStoreSavedBitmap(null, historyItem.getResult());
579 580
                }
580
            }
581
//            }
581 582
        }
582 583
    }
583 584
@ -1113,7 +1114,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
1113 1114
    }
1114 1115
1115 1116
    private void handlingOperations(String response, int interfaceType) {
1116
        LogUtils.e(interfaceType + "---" + response);
1117
        LogUtils.e(interfaceType + "hyc---" + response);
1117 1118
        String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
1118 1119
        String rtnMsg = JsonUtils.getKeyResult(response, "rtnMsg");
1119 1120
        switch (rtnCode) {
@ -1168,6 +1169,12 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
1168 1169
                }
1169 1170
                try305Count++;
1170 1171
                if (!CaptureActivity.this.isFinishing() && CaptureActivity.this != null) {
1172
                    String data = JsonUtils.getKeyResult(response, "data");
1173
                    Gson gson=new Gson();
1174
                    List<DelayedSettlementBean> datas = gson.fromJson(data, new TypeToken<List<DelayedSettlementBean>>() {
1175
                    }.getType());
1176
                    showSettleAccountsDialog(datas);
1177
/*
1171 1178
                    alertDialog.builder()
1172 1179
                            .setMsg(rtnMsg)
1173 1180
                            .setPositiveButton("联系客服", new View.OnClickListener() {
@ -1175,7 +1182,8 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
1175 1182
                                public void onClick(View v) {
1176 1183
                                    try305Count = 1;
1177 1184
                                    //tellTask();
1178
                                    wechatAlert();
1185
//                                    wechatAlert();
1186
                                    showSettleAccountsDialog();
1179 1187
                                }
1180 1188
                            }).setNegativeButton("取消", new View.OnClickListener() {
1181 1189
                        @Override
@ -1183,6 +1191,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
1183 1191
                            try305Count = 1;
1184 1192
                        }
1185 1193
                    }).show();
1194
*/
1186 1195
                }
1187 1196
                break;
1188 1197
            case "309":
@ -1395,23 +1404,31 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
1395 1404
        });
1396 1405
    }
1397 1406
1398
    private void showSettleAccountsDialog(){
1407
    private void showSettleAccountsDialog(final List<DelayedSettlementBean> datas){
1399 1408
        if (isDestroyed() ||isFinishing()) {
1400 1409
            return;
1401 1410
        }
1402
        isSettleAccounts=1;
1411
1403 1412
        new SettleAccountsDialog(this)
1404 1413
                .builder()
1405
                .setCancleOnClick(new View.OnClickListener() {
1414
                .setOpenOnClick(new View.OnClickListener() {
1406 1415
                    @Override
1407 1416
                    public void onClick(View v) {
1408
                        isSettleAccounts=1;
1417
                        try305Count = 1;
1418
                        if (datas!=null && datas.size()>0){
1419
                            Intent intent = new Intent();
1420
                            intent.setClassName("com.electric.chargingpile",
1421
                                    "com.electric.chargingpile.activity.ConfirmOrderActivity");
1422
                            intent.putExtra(ChargingConstants.ORDERID, datas.get(0).getOrder_id());
1423
                            startActivity(intent);
1424
                        }
1409 1425
                    }
1410 1426
                })
1411 1427
                .setCancleOnClick(new View.OnClickListener(){
1412 1428
1413 1429
                    @Override
1414 1430
                    public void onClick(View v) {
1431
                        try305Count = 1;
1415 1432
                        finish();
1416 1433
                    }
1417 1434
                })

+ 1 - 0
zxing/src/main/java/com/google/zxing/client/android/constant/ChargingConstants.java

@ -7,4 +7,5 @@ public interface ChargingConstants {
7 7
    String FLAG = "flag";
8 8
    String ORDERID = "orderid";
9 9
    String TYPE = "type";
10
    String HBID = "hbid";
10 11
}

+ 8 - 1
zxing/src/main/java/com/google/zxing/client/android/constant/UrlConstants.java

@ -2,8 +2,15 @@ package com.google.zxing.client.android.constant;
2 2
3 3
public interface UrlConstants {
4 4
    String HOST_URL = "http://cdz.evcharge.cc/zhannew/basic/web/index.php/";
5
//    String HOST_URL = "http://59.110.68.162/zhannew/basic/web/index.php/";
6
5 7
    String USER_CHARGING_CHECK_URL = HOST_URL + "api/charge/check-user";
6 8
    String START_CHARGING_URL = HOST_URL + "api/charge/start";
7 9
    String CHARGING_STATUS_URL = HOST_URL + "api/charge/query";
8
    String STOP_CHARGING_URL = HOST_URL + "api/charge/close";
10
    String STOP_CHARGING_URL = HOST_URL + "api/charge/close";//关闭充电
11
12
    String RED_ENVELOPE_LIST = HOST_URL + "/api/charge/hblist";//红包列表
13
    String SETTLEMENT = HOST_URL + "api/charge/settlement"; //选中红包时,提交结算时的接口
14
    String QUERY_NOT_CLOSE = HOST_URL + "api/charge/querynotclose";  //仅仅是查询接口状态,充电是否停止,state >= 2 则表示停止
15
9 16
}

+ 80 - 0
zxing/src/main/java/com/google/zxing/client/android/data/DelayedSettlementBean.java

@ -0,0 +1,80 @@
1
package com.google.zxing.client.android.data;
2
3
public class DelayedSettlementBean {
4
    private String id;
5
    private String company;
6
    private String third_party_id;
7
    private String user_id;
8
    private String third_id;
9
    private String settlement;
10
    private String order_id;
11
12
    public String getOrder_id() {
13
        return order_id;
14
    }
15
16
    public void setOrder_id(String order_id) {
17
        this.order_id = order_id;
18
    }
19
20
    @Override
21
    public String toString() {
22
        return "DelayedSettlementBean{" +
23
                "id='" + id + '\'' +
24
                ", company='" + company + '\'' +
25
                ", third_party_id='" + third_party_id + '\'' +
26
                ", user_id='" + user_id + '\'' +
27
                ", third_id='" + third_id + '\'' +
28
                ", settlement='" + settlement + '\'' +
29
                ", order_id='" + order_id + '\'' +
30
                '}';
31
    }
32
33
    public String getId() {
34
        return id;
35
    }
36
37
    public void setId(String id) {
38
        this.id = id;
39
    }
40
41
    public String getCompany() {
42
        return company;
43
    }
44
45
    public void setCompany(String company) {
46
        this.company = company;
47
    }
48
49
    public String getThird_party_id() {
50
        return third_party_id;
51
    }
52
53
    public void setThird_party_id(String third_party_id) {
54
        this.third_party_id = third_party_id;
55
    }
56
57
    public String getUser_id() {
58
        return user_id;
59
    }
60
61
    public void setUser_id(String user_id) {
62
        this.user_id = user_id;
63
    }
64
65
    public String getThird_id() {
66
        return third_id;
67
    }
68
69
    public void setThird_id(String third_id) {
70
        this.third_id = third_id;
71
    }
72
73
    public String getSettlement() {
74
        return settlement;
75
    }
76
77
    public void setSettlement(String settlement) {
78
        this.settlement = settlement;
79
    }
80
}