8d0b43e67b995cdb0aff1bd61R82">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
import com.electric.chargingpile.R;
20
import com.electric.chargingpile.R;
21
import com.electric.chargingpile.activity.MainMapActivity;
21
import com.electric.chargingpile.activity.MainMapActivity;
22
import com.electric.chargingpile.application.MainApplication;
22
import com.electric.chargingpile.application.MainApplication;
23
import com.electric.chargingpile.data.RedEnvelopeBean;
23
import com.electric.chargingpile.data.Zhan;
24
import com.electric.chargingpile.data.Zhan;
24
import com.electric.chargingpile.data.Zhuang;
25
import com.electric.chargingpile.data.Zhuang;
25
import com.electric.chargingpile.manager.ProfileManager;
26
import com.electric.chargingpile.manager.ProfileManager;
598
            return false;
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
package com.electric.chargingpile.view;
1
package com.electric.chargingpile.view;
2
2
3
import android.os.Bundle;
3
import android.os.Bundle;
4
import android.util.Log;
4
import android.view.LayoutInflater;
5
import android.view.LayoutInflater;
5
import android.view.View;
6
import android.view.View;
6
import android.view.ViewGroup;
7
import android.view.ViewGroup;
8
import android.widget.ProgressBar;
7
import android.widget.TextView;
9
import android.widget.TextView;
8
10
9
import androidx.annotation.NonNull;
11
import androidx.annotation.NonNull;
11
import androidx.recyclerview.widget.LinearLayoutManager;
13
import androidx.recyclerview.widget.LinearLayoutManager;
12
import androidx.recyclerview.widget.RecyclerView;
14
import androidx.recyclerview.widget.RecyclerView;
13
15
16
import com.blankj.utilcode.util.LogUtils;
14
import com.electric.chargingpile.R;
17
import com.electric.chargingpile.R;
15
import com.electric.chargingpile.adapter.PreferentialAdapter;
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
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
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
import org.jetbrains.annotations.NotNull;
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
public class PreferentialDialog extends BottomSheetDialogFragment {
41
public class PreferentialDialog extends BottomSheetDialogFragment {
23
42
24
    private RecyclerView recyclerView;
43
    private RecyclerView recyclerView;
25
    private CompleteListener mListener;
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
        PreferentialDialog dialog = new PreferentialDialog();
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
        return dialog;
55
        return dialog;
31
    }
56
    }
32
57
42
    @org.jetbrains.annotations.Nullable
67
    @org.jetbrains.annotations.Nullable
43
    @Override
68
    @Override
44
    public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
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
    @Override
73
    @Override
50
    public void onViewCreated(@NonNull @NotNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
74
    public void onViewCreated(@NonNull @NotNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
51
        super.onViewCreated(view, savedInstanceState);
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
        recyclerView = view.findViewById(R.id.recyclerView);
161
        recyclerView = view.findViewById(R.id.recyclerView);
162
        mProgressBar = view.findViewById(R.id.progressBar);
54
        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
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
                android:layout_height="wrap_content"
146
                android:layout_height="wrap_content"
147
                android:layout_alignParentLeft="true"
147
                android:layout_alignParentLeft="true"
148
                android:layout_marginLeft="15dp"
148
                android:layout_marginLeft="15dp"
149
                android:text="红包减免"
149
                android:text="红包/优惠券减免"
150
                android:textColor="@color/juhuang"
150
                android:textColor="@color/juhuang"
151
                android:textSize="14sp" />
151
                android:textSize="14sp" />
152
152

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

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

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

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

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

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

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

15
        android:textColor="#ff0e0e0e"
15
        android:textColor="#ff0e0e0e"
16
        android:textSize="18sp"
16
        android:textSize="18sp"
17
        />
17
        />
18
    <androidx.recyclerview.widget.RecyclerView
19
        android:id="@+id/recyclerView"
18
    <RelativeLayout
20
        android:layout_width="match_parent"
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
    <TextView
40
    <TextView
32
        android:id="@+id/complete"
41
        android:id="@+id/complete"
33
        android:layout_width="match_parent"
42
        android:layout_width="match_parent"

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

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

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

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

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

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

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

7
    String FLAG = "flag";
7
    String FLAG = "flag";
8
    String ORDERID = "orderid";
8
    String ORDERID = "orderid";
9
    String TYPE = "type";
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
2
3
public interface UrlConstants {
3
public interface UrlConstants {
4
    String HOST_URL = "http://cdz.evcharge.cc/zhannew/basic/web/index.php/";
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
    String USER_CHARGING_CHECK_URL = HOST_URL + "api/charge/check-user";
7
    String USER_CHARGING_CHECK_URL = HOST_URL + "api/charge/check-user";
6
    String START_CHARGING_URL = HOST_URL + "api/charge/start";
8
    String START_CHARGING_URL = HOST_URL + "api/charge/start";
7
    String CHARGING_STATUS_URL = HOST_URL + "api/charge/query";
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

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
}

robotvacuummops6577 - Gogs: Go Git Service