import android.widget.EditText;
|
32
|
32
|
import android.widget.ImageView;
|
|
33
|
import android.widget.LinearLayout;
|
33
|
34
|
import android.widget.PopupWindow;
|
34
|
35
|
import android.widget.RelativeLayout;
|
35
|
36
|
import android.widget.Spinner;
|
|
@ -44,7 +45,10 @@ import com.electric.chargingpile.application.MainApplication;
|
44
|
45
|
import com.electric.chargingpile.data.CarOwnerCertificateBean;
|
45
|
46
|
import com.electric.chargingpile.data.Cars;
|
46
|
47
|
import com.electric.chargingpile.data.Province;
|
|
48
|
import com.electric.chargingpile.entity.CarModelEntity;
|
47
|
49
|
import com.electric.chargingpile.entity.CarSeriesEntity;
|
|
50
|
import com.electric.chargingpile.event.CarIntentModelEvent;
|
|
51
|
import com.electric.chargingpile.event.CarModelEvent;
|
48
|
52
|
import com.electric.chargingpile.manager.ProfileManager;
|
49
|
53
|
import com.electric.chargingpile.util.ActivityManagerApplication;
|
50
|
54
|
import com.electric.chargingpile.util.BarColorUtil;
|
|
@ -56,6 +60,7 @@ import com.electric.chargingpile.util.LogUtils;
|
56
|
60
|
import com.electric.chargingpile.util.OkHttpUtil;
|
57
|
61
|
import com.electric.chargingpile.util.PhotoUtils;
|
58
|
62
|
import com.electric.chargingpile.util.StatusConstants;
|
|
63
|
import com.electric.chargingpile.util.ToastUtil;
|
59
|
64
|
import com.electric.chargingpile.util.UploadUtil;
|
60
|
65
|
import com.electric.chargingpile.view.CustomProgressDialog;
|
61
|
66
|
import com.electric.chargingpile.view.RoundImageView;
|
|
@ -66,6 +71,10 @@ import com.squareup.okhttp.Response;
|
66
|
71
|
import com.zhy.http.okhttp.OkHttpUtils;
|
67
|
72
|
import com.zhy.http.okhttp.callback.StringCallback;
|
68
|
73
|
|
|
74
|
import org.greenrobot.eventbus.EventBus;
|
|
75
|
import org.greenrobot.eventbus.Subscribe;
|
|
76
|
import org.greenrobot.eventbus.ThreadMode;
|
|
77
|
import org.jetbrains.annotations.NotNull;
|
69
|
78
|
import org.json.JSONArray;
|
70
|
79
|
import org.json.JSONException;
|
71
|
80
|
import org.json.JSONObject;
|
|
@ -128,15 +137,17 @@ public class SkipUserInfoActivity extends Activity implements View.OnClickListen
|
128
|
137
|
private SkipUserInfoActivity activity;
|
129
|
138
|
|
130
|
139
|
private LoadingDialog loadDialog;
|
131
|
|
// 1.去认证车主(获得充电优惠) > 2.认证车主 审核中 3.认证车主 宝马
|
132
|
|
private int certificateStatus = 0; // 1 去认证 2审核中 3认证车主
|
133
|
|
private RelativeLayout go_certificate;
|
|
140
|
// -2 -> 去认证, -1 -> 认证失败,0 -> 审核中,1 -> 表示通过审核,2 -> 表示意向车型。
|
|
141
|
private int certificateStatus = -2;
|
|
142
|
private LinearLayout go_certificate;
|
134
|
143
|
private TextView go_title;
|
135
|
144
|
private TextView go_desc;
|
136
|
145
|
private ImageView go_cursor;
|
137
|
|
private RelativeLayout carIntentModel;
|
|
146
|
private LinearLayout carIntentModel;
|
138
|
147
|
private TextView carModel;
|
139
|
148
|
|
|
149
|
private CarModelEntity mCarModelEntity;
|
|
150
|
|
140
|
151
|
@Override
|
141
|
152
|
protected void onCreate(Bundle savedInstanceState) {
|
142
|
153
|
super.onCreate(savedInstanceState);
|
|
@ -144,6 +155,8 @@ public class SkipUserInfoActivity extends Activity implements View.OnClickListen
|
144
|
155
|
mContext = this;
|
145
|
156
|
activity = this;
|
146
|
157
|
BarColorUtil.initStatusBarColor(SkipUserInfoActivity.this);
|
|
158
|
EventBus.getDefault().register(this);
|
|
159
|
|
147
|
160
|
initView();
|
148
|
161
|
getFromServer();
|
149
|
162
|
spinner();
|
|
@ -172,7 +185,7 @@ public class SkipUserInfoActivity extends Activity implements View.OnClickListen
|
172
|
185
|
rl_icon = (RelativeLayout) findViewById(R.id.rl_icon);
|
173
|
186
|
rl_icon.setOnClickListener(this);
|
174
|
187
|
|
175
|
|
carIntentModel = (RelativeLayout) findViewById(R.id.carIntentModel);
|
|
188
|
carIntentModel = findViewById(R.id.carIntentModel);
|
176
|
189
|
carIntentModel.setOnClickListener(this);
|
177
|
190
|
|
178
|
191
|
btn_sex = (ToggleButton) findViewById(R.id.sex_button);
|
|
@ -472,19 +485,19 @@ public class SkipUserInfoActivity extends Activity implements View.OnClickListen
|
472
|
485
|
shite("");
|
473
|
486
|
}
|
474
|
487
|
}).start();
|
|
488
|
if (mCarModelEntity!=null){
|
|
489
|
requestCarIntentModel();
|
|
490
|
}
|
475
|
491
|
createDialog();
|
476
|
492
|
}
|
477
|
493
|
break;
|
478
|
494
|
case R.id.go_certificate:
|
479
|
|
// 1 去认证 2审核中 3认证车主
|
480
|
|
if (certificateStatus == 0) {
|
|
495
|
if (certificateStatus == -2) {
|
481
|
496
|
getCarOwnerCertificateList(true);
|
482
|
|
} else if (certificateStatus == 1) {
|
483
|
|
startActivity(new Intent(getApplication(), CarOwnerCertificateActivity.class));
|
484
|
497
|
}
|
485
|
498
|
break;
|
486
|
|
case R.id.carIntentModel:
|
487
|
|
CarBrandActivity.actionStart(this,"2");
|
|
499
|
case R.id.carIntentModel:
|
|
500
|
CarBrandActivity.actionStart(this, "2");
|
488
|
501
|
break;
|
489
|
502
|
}
|
490
|
503
|
|
|
@ -627,14 +640,11 @@ public class SkipUserInfoActivity extends Activity implements View.OnClickListen
|
627
|
640
|
return result;
|
628
|
641
|
}
|
629
|
642
|
|
630
|
|
@Override
|
631
|
|
protected void onResume() {
|
632
|
|
super.onResume();
|
633
|
|
String carIntentModel = ProfileManager.getInstance().getCarIntentModel(this);
|
634
|
643
|
|
635
|
|
if (!TextUtils.isEmpty(carIntentModel)){
|
636
|
|
carModel.setText(carIntentModel);
|
637
|
|
}
|
|
644
|
@Override
|
|
645
|
protected void onDestroy() {
|
|
646
|
super.onDestroy();
|
|
647
|
EventBus.getDefault().unregister(this);
|
638
|
648
|
}
|
639
|
649
|
|
640
|
650
|
@Override
|
|
@ -925,6 +935,12 @@ public class SkipUserInfoActivity extends Activity implements View.OnClickListen
|
925
|
935
|
|
926
|
936
|
}
|
927
|
937
|
|
|
938
|
@Override
|
|
939
|
protected void onResume() {
|
|
940
|
super.onResume();
|
|
941
|
getCarOwnerCertificateList(false);
|
|
942
|
}
|
|
943
|
|
928
|
944
|
private void getCarOwnerCertificateList(Boolean showLoading) {
|
929
|
945
|
if (showLoading) {
|
930
|
946
|
loadDialog.show();
|
|
@ -958,48 +974,54 @@ public class SkipUserInfoActivity extends Activity implements View.OnClickListen
|
958
|
974
|
String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
|
959
|
975
|
if ("01".equals(rtnCode)) {
|
960
|
976
|
String data = JsonUtils.getKeyResult(response, "data");
|
961
|
|
List<CarOwnerCertificateBean> list = JsonUtils.parseToObjectList(data, CarOwnerCertificateBean.class);
|
|
977
|
List<CarOwnerCertificateBean> list = new ArrayList<>();
|
|
978
|
try {
|
|
979
|
list = JsonUtils.parseToObjectList(data, CarOwnerCertificateBean.class);
|
|
980
|
} catch (com.alibaba.fastjson.JSONException e) {
|
|
981
|
|
|
982
|
}
|
|
983
|
|
962
|
984
|
CarSeriesEntity carSeriesEntity = null;
|
963
|
|
// 1 去认证 2审核中 3认证车主
|
964
|
|
if (list.size() == 0) {
|
965
|
|
certificateStatus = 1;
|
966
|
|
} else {
|
967
|
|
certificateStatus = 2;
|
968
|
985
|
|
969
|
|
boolean isCertifiedOwner=true;//是否是已通过认证车主
|
970
|
|
boolean isVerified=true;//是否是已认证车主
|
971
|
|
boolean isCarIntendedModel=true;//是否是意向车型
|
|
986
|
if (list.size() != 0) {
|
|
987
|
|
|
988
|
boolean isCertifiedOwner = true;//是否是已通过认证车主
|
|
989
|
boolean isVerified = true;//是否是已认证车主
|
|
990
|
boolean isCarIntendedModel = true;//是否是意向车型
|
972
|
991
|
|
973
|
992
|
Gson gson = new Gson();
|
974
|
993
|
for (CarOwnerCertificateBean bean : list) {
|
975
|
994
|
//获取已通过车主认证车型
|
976
|
995
|
if (bean.getStatus() == 1 && bean.getMain() == 1 && isCertifiedOwner) {
|
977
|
|
certificateStatus = 3;
|
|
996
|
certificateStatus = 1;
|
978
|
997
|
carSeriesEntity = gson.fromJson(bean.getChexing(), CarSeriesEntity.class);
|
979
|
|
isCertifiedOwner=false;
|
|
998
|
isCertifiedOwner = false;
|
980
|
999
|
}
|
981
|
1000
|
//获取意向车型
|
982
|
|
if (bean.getStatus() == 2|| isCarIntendedModel){
|
983
|
|
|
|
1001
|
if (bean.getStatus() == 2 && isCarIntendedModel) {
|
984
|
1002
|
CarSeriesEntity entity = gson.fromJson(bean.getChexing(), CarSeriesEntity.class);
|
985
|
|
carModel.setText(entity.getSeriesName());
|
986
|
|
isCarIntendedModel=false;
|
|
1003
|
if (mCarModelEntity == null){
|
|
1004
|
carModel.setText(entity.getSeriesName());
|
|
1005
|
}
|
|
1006
|
isCarIntendedModel = false;
|
987
|
1007
|
}
|
988
|
1008
|
//已完成车主认证功能
|
989
|
|
if (bean.getStatus() != 2|| isVerified){
|
|
1009
|
if (bean.getStatus() != 2 && isVerified) {
|
|
1010
|
certificateStatus = bean.getStatus();
|
990
|
1011
|
CarSeriesEntity entity = gson.fromJson(bean.getChexing(), CarSeriesEntity.class);
|
991
|
|
MainApplication.userCertifiedModel=(entity.getSeriesName());
|
992
|
|
isVerified=false;
|
|
1012
|
MainApplication.userCertifiedModel = (entity.getSeriesName());
|
|
1013
|
isVerified = false;
|
|
1014
|
|
993
|
1015
|
}
|
994
|
1016
|
}
|
995
|
1017
|
}
|
996
|
1018
|
|
997
|
|
if (certificateStatus == 2) {
|
|
1019
|
if (certificateStatus == 0) {
|
998
|
1020
|
go_title.setText("认证车主");
|
999
|
1021
|
go_desc.setText("审核中");
|
1000
|
1022
|
go_desc.setTextColor(Color.RED);
|
1001
|
1023
|
go_cursor.setVisibility(View.GONE);
|
1002
|
|
} else if (certificateStatus == 3) {
|
|
1024
|
} else if (certificateStatus == 1) {
|
1003
|
1025
|
go_title.setText("认证车主");
|
1004
|
1026
|
if (carSeriesEntity != null) {
|
1005
|
1027
|
go_desc.setText(carSeriesEntity.getSeriesName());
|
|
@ -1013,7 +1035,7 @@ public class SkipUserInfoActivity extends Activity implements View.OnClickListen
|
1013
|
1035
|
go_cursor.setVisibility(View.VISIBLE);
|
1014
|
1036
|
}
|
1015
|
1037
|
|
1016
|
|
if (certificateStatus == 1 && showLoading) {
|
|
1038
|
if (certificateStatus == -2 && showLoading) {
|
1017
|
1039
|
startActivity(new Intent(getApplication(), CarOwnerCertificateActivity.class));
|
1018
|
1040
|
}
|
1019
|
1041
|
|
|
@ -1030,4 +1052,65 @@ public class SkipUserInfoActivity extends Activity implements View.OnClickListen
|
1030
|
1052
|
});
|
1031
|
1053
|
}
|
1032
|
1054
|
|
|
1055
|
/**
|
|
1056
|
* 意向车型Event
|
|
1057
|
*/
|
|
1058
|
@Subscribe(threadMode = ThreadMode.MAIN,sticky = true)
|
|
1059
|
public void onCarModelEvent(CarIntentModelEvent event) {
|
|
1060
|
if (event != null) {
|
|
1061
|
mCarModelEntity = event.getCarModelEntity();
|
|
1062
|
carModel.setText(mCarModelEntity.getSeriesName());
|
|
1063
|
EventBus.getDefault().removeStickyEvent(event);
|
|
1064
|
}
|
|
1065
|
}
|
|
1066
|
|
|
1067
|
|
|
1068
|
private void requestCarIntentModel() {
|
|
1069
|
|
|
1070
|
String url = MainApplication.url + "/zhannew/basic/web/index.php/car/add";
|
|
1071
|
|
|
1072
|
long tokenTime = System.currentTimeMillis() / 1000 - MainMapActivity.cha - 1;
|
|
1073
|
String token = null;
|
|
1074
|
try {
|
|
1075
|
token = DES3.encode(String.valueOf(tokenTime));
|
|
1076
|
} catch (Exception e) {
|
|
1077
|
e.printStackTrace();
|
|
1078
|
}
|
|
1079
|
Map<String, String> map = new HashMap<>();
|
|
1080
|
map.put("engine_number", "yixiang");
|
|
1081
|
map.put("plate_number", "意向");
|
|
1082
|
map.put("cartype", "自用");
|
|
1083
|
map.put("userid", MainApplication.userId);
|
|
1084
|
map.put("token", token);
|
|
1085
|
|
|
1086
|
Gson gson = new Gson();
|
|
1087
|
if (mCarModelEntity == null){
|
|
1088
|
return;
|
|
1089
|
}
|
|
1090
|
String chexing = gson.toJson(mCarModelEntity);
|
|
1091
|
map.put("chexing", chexing);
|
|
1092
|
|
|
1093
|
OkHttpUtils.post().params(map).url(url).build().execute(new StringCallback() {
|
|
1094
|
|
|
1095
|
@Override
|
|
1096
|
public void onError(Call call, Exception e) {
|
|
1097
|
loadDialog.dismiss();
|
|
1098
|
}
|
|
1099
|
|
|
1100
|
@Override
|
|
1101
|
public void onResponse(String response) {
|
|
1102
|
loadDialog.dismiss();
|
|
1103
|
String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
|
|
1104
|
if ("01".equals(rtnCode)) {
|
|
1105
|
ToastUtil.showToast(getApplicationContext(), "意向车型提交成功", Toast.LENGTH_SHORT);
|
|
1106
|
MainApplication.userCarIntentMode = mCarModelEntity.getSeriesName();
|
|
1107
|
carModel.setText(mCarModelEntity.getSeriesName());
|
|
1108
|
ProfileManager.getInstance().setCarIntentModel(SkipUserInfoActivity.this, mCarModelEntity.getSeriesName());
|
|
1109
|
} else {
|
|
1110
|
ToastUtil.showToast(getApplicationContext(), "意向车型提交失败,请重新提交", Toast.LENGTH_SHORT);
|
|
1111
|
}
|
|
1112
|
}
|
|
1113
|
});
|
|
1114
|
}
|
|
1115
|
|
1033
|
1116
|
}
|
|
@ -88,6 +88,7 @@ import java.net.HttpURLConnection;
|
88
|
88
|
import java.net.MalformedURLException;
|
89
|
89
|
import java.net.URL;
|
90
|
90
|
import java.net.URLEncoder;
|
|
91
|
import java.util.ArrayList;
|
91
|
92
|
import java.util.List;
|
92
|
93
|
|
93
|
94
|
import okhttp3.Call;
|
|
@ -1138,7 +1139,13 @@ public class UserCenterActivity extends Activity implements View.OnClickListener
|
1138
|
1139
|
String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
|
1139
|
1140
|
if ("01".equals(rtnCode)) {
|
1140
|
1141
|
String data = JsonUtils.getKeyResult(response, "data");
|
1141
|
|
List<CarOwnerCertificateBean> list = JsonUtils.parseToObjectList(data, CarOwnerCertificateBean.class);
|
|
1142
|
List<CarOwnerCertificateBean> list =new ArrayList<>();
|
|
1143
|
try{
|
|
1144
|
list = JsonUtils.parseToObjectList(data, CarOwnerCertificateBean.class);
|
|
1145
|
}catch (com.alibaba.fastjson.JSONException e){
|
|
1146
|
|
|
1147
|
}
|
|
1148
|
|
1142
|
1149
|
if ("price".equals(from)) {
|
1143
|
1150
|
if (list.size() == 0) {
|
1144
|
1151
|
new AlertDialogTwo(UserCenterActivity.this).builder()
|
|
@ -55,7 +55,10 @@ import com.electric.chargingpile.application.MainApplication;
|
55
|
55
|
import com.electric.chargingpile.data.CarOwnerCertificateBean;
|
56
|
56
|
import com.electric.chargingpile.data.Cars;
|
57
|
57
|
import com.electric.chargingpile.data.Province;
|
|
58
|
import com.electric.chargingpile.entity.CarModelEntity;
|
58
|
59
|
import com.electric.chargingpile.entity.CarSeriesEntity;
|
|
60
|
import com.electric.chargingpile.event.CarIntentModelEvent;
|
|
61
|
import com.electric.chargingpile.event.CarModelEvent;
|
59
|
62
|
import com.electric.chargingpile.manager.PreferenceManager;
|
60
|
63
|
import com.electric.chargingpile.manager.ProfileManager;
|
61
|
64
|
import com.electric.chargingpile.util.BarColorUtil;
|
|
@ -81,6 +84,9 @@ import com.umeng.analytics.MobclickAgent;
|
81
|
84
|
import com.zhy.http.okhttp.OkHttpUtils;
|
82
|
85
|
import com.zhy.http.okhttp.callback.StringCallback;
|
83
|
86
|
|
|
87
|
import org.greenrobot.eventbus.EventBus;
|
|
88
|
import org.greenrobot.eventbus.Subscribe;
|
|
89
|
import org.greenrobot.eventbus.ThreadMode;
|
84
|
90
|
import org.json.JSONArray;
|
85
|
91
|
import org.json.JSONException;
|
86
|
92
|
import org.json.JSONObject;
|
|
@ -145,8 +151,8 @@ public class UserInfoActivity extends Activity implements View.OnClickListener,
|
145
|
151
|
private Uri cropImageUri;
|
146
|
152
|
private static final int RC_CAMERA_PERM = 123;
|
147
|
153
|
private LoadingDialog loadDialog;
|
148
|
|
// 1.去认证车主(获得充电优惠) > 2.认证车主 审核中 3.认证车主 宝马
|
149
|
|
private int certificateStatus = 0; // 1 去认证 2审核中 3认证车主
|
|
154
|
// -2 -> 去认证, -1 -> 认证失败,0 -> 审核中,1 -> 表示通过审核,2 -> 表示意向车型。
|
|
155
|
private int certificateStatus = -2;
|
150
|
156
|
private LinearLayout go_certificate;
|
151
|
157
|
private TextView go_title;
|
152
|
158
|
private TextView go_desc;
|
|
@ -154,11 +160,14 @@ public class UserInfoActivity extends Activity implements View.OnClickListener,
|
154
|
160
|
private LinearLayout carIntentModel;
|
155
|
161
|
private TextView carModel;
|
156
|
162
|
|
|
163
|
private CarModelEntity mCarModelEntity;
|
|
164
|
|
157
|
165
|
@Override
|
158
|
166
|
protected void onCreate(Bundle savedInstanceState) {
|
159
|
167
|
super.onCreate(savedInstanceState);
|
160
|
168
|
BarColorUtil.initStatusBarColor(UserInfoActivity.this);
|
161
|
169
|
setContentView(R.layout.activity_user_info);
|
|
170
|
EventBus.getDefault().register(this);
|
162
|
171
|
dialog = new LoadingDialog(this);
|
163
|
172
|
dialog.setCanceledOnTouchOutside(false);
|
164
|
173
|
mContext = this;
|
|
@ -261,6 +270,13 @@ public class UserInfoActivity extends Activity implements View.OnClickListener,
|
261
|
270
|
if (userPhone.length() == 11) {
|
262
|
271
|
phone.setText(userPhone.substring(0, 3) + "****" + userPhone.substring(7, userPhone.length()));
|
263
|
272
|
}
|
|
273
|
|
|
274
|
// String carIntentModel = ProfileManager.getInstance().getCarIntentModel(this);
|
|
275
|
//
|
|
276
|
// if (!TextUtils.isEmpty(carIntentModel)){
|
|
277
|
// carModel.setText(carIntentModel);
|
|
278
|
// }
|
|
279
|
|
264
|
280
|
}
|
265
|
281
|
|
266
|
282
|
private void setIcon() {
|
|
@ -405,17 +421,20 @@ public class UserInfoActivity extends Activity implements View.OnClickListener,
|
405
|
421
|
shite("");
|
406
|
422
|
}
|
407
|
423
|
}).start();
|
|
424
|
if (mCarModelEntity!=null){
|
|
425
|
requestCarIntentModel();
|
|
426
|
}
|
|
427
|
|
408
|
428
|
dialog.show();
|
409
|
429
|
}
|
410
|
430
|
break;
|
411
|
431
|
|
412
|
432
|
case R.id.go_certificate:
|
413
|
433
|
// 1 去认证 2审核中 3认证车主
|
414
|
|
if (certificateStatus == 0) {
|
|
434
|
if (certificateStatus == -2) {
|
415
|
435
|
getCarOwnerCertificateList(true);
|
416
|
|
} else if (certificateStatus == 1) {
|
417
|
|
startActivity(new Intent(getApplication(), CarOwnerCertificateActivity.class));
|
418
|
436
|
}
|
|
437
|
|
419
|
438
|
break;
|
420
|
439
|
case R.id.carIntentModel:
|
421
|
440
|
CarBrandActivity.actionStart(this,"1");
|
|
@ -1068,6 +1087,7 @@ public class UserInfoActivity extends Activity implements View.OnClickListener,
|
1068
|
1087
|
@Override
|
1069
|
1088
|
protected void onDestroy() {
|
1070
|
1089
|
super.onDestroy();
|
|
1090
|
EventBus.getDefault().unregister(this);
|
1071
|
1091
|
}
|
1072
|
1092
|
|
1073
|
1093
|
private void getCarOwnerCertificateList(Boolean showLoading) {
|
|
@ -1085,6 +1105,7 @@ public class UserInfoActivity extends Activity implements View.OnClickListener,
|
1085
|
1105
|
}
|
1086
|
1106
|
|
1087
|
1107
|
String url = MainApplication.url + "/zhannew/basic/web/index.php/car/my?userid=" + MainApplication.userId + "&order=1" + "&token=" + token;
|
|
1108
|
// Log.e(TAG, "getCarOwnerCertificateList: "+url );
|
1088
|
1109
|
OkHttpUtils.get().url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
|
1089
|
1110
|
@Override
|
1090
|
1111
|
public void onError(Call call, Exception e) {
|
|
@ -1101,52 +1122,56 @@ public class UserInfoActivity extends Activity implements View.OnClickListener,
|
1101
|
1122
|
public void onResponse(String response) {
|
1102
|
1123
|
loadDialog.dismiss();
|
1103
|
1124
|
String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
|
1104
|
|
Log.e(TAG, "onResponse: "+response );
|
1105
|
1125
|
if ("01".equals(rtnCode)) {
|
1106
|
1126
|
String data = JsonUtils.getKeyResult(response, "data");
|
1107
|
|
List<CarOwnerCertificateBean> list = JsonUtils.parseToObjectList(data, CarOwnerCertificateBean.class);
|
|
1127
|
List<CarOwnerCertificateBean> list = new ArrayList<>();
|
|
1128
|
try {
|
|
1129
|
list = JsonUtils.parseToObjectList(data, CarOwnerCertificateBean.class);
|
|
1130
|
} catch (com.alibaba.fastjson.JSONException e) {
|
|
1131
|
|
|
1132
|
}
|
|
1133
|
|
1108
|
1134
|
CarSeriesEntity carSeriesEntity = null;
|
1109
|
|
// 1 去认证 2审核中 3认证车主
|
1110
|
|
if (list.size() == 0) {
|
1111
|
|
certificateStatus = 1;
|
1112
|
|
} else {
|
1113
|
|
certificateStatus = 2;
|
1114
|
|
boolean isCertifiedOwner=true;//是否是已通过认证车主
|
1115
|
|
boolean isVerified=true;//是否是已认证车主
|
1116
|
|
boolean isCarIntendedModel=true;//是否是意向车型
|
|
1135
|
|
|
1136
|
if (list.size() != 0) {
|
|
1137
|
|
|
1138
|
boolean isCertifiedOwner = true;//是否是已通过认证车主
|
|
1139
|
boolean isVerified = true;//是否是已认证车主
|
|
1140
|
boolean isCarIntendedModel = true;//是否是意向车型
|
|
1141
|
|
1117
|
1142
|
Gson gson = new Gson();
|
1118
|
1143
|
for (CarOwnerCertificateBean bean : list) {
|
1119
|
1144
|
//获取已通过车主认证车型
|
1120
|
1145
|
if (bean.getStatus() == 1 && bean.getMain() == 1 && isCertifiedOwner) {
|
1121
|
|
certificateStatus = 3;
|
|
1146
|
certificateStatus = 1;
|
1122
|
1147
|
carSeriesEntity = gson.fromJson(bean.getChexing(), CarSeriesEntity.class);
|
1123
|
|
isCertifiedOwner=false;
|
|
1148
|
isCertifiedOwner = false;
|
1124
|
1149
|
}
|
1125
|
1150
|
//获取意向车型
|
1126
|
|
if (bean.getStatus() == 2|| isCarIntendedModel){
|
1127
|
|
|
|
1151
|
if (bean.getStatus() == 2 && isCarIntendedModel) {
|
1128
|
1152
|
CarSeriesEntity entity = gson.fromJson(bean.getChexing(), CarSeriesEntity.class);
|
1129
|
|
carModel.setText(entity.getSeriesName());
|
1130
|
|
isCarIntendedModel=false;
|
|
1153
|
if (mCarModelEntity == null){
|
|
1154
|
carModel.setText(entity.getSeriesName());
|
|
1155
|
}
|
|
1156
|
isCarIntendedModel = false;
|
1131
|
1157
|
}
|
1132
|
|
|
1133
|
1158
|
//已完成车主认证功能
|
1134
|
|
if (bean.getStatus() != 2|| isVerified){
|
|
1159
|
if (bean.getStatus() != 2 && isVerified) {
|
|
1160
|
certificateStatus = bean.getStatus();
|
1135
|
1161
|
CarSeriesEntity entity = gson.fromJson(bean.getChexing(), CarSeriesEntity.class);
|
1136
|
|
MainApplication.userCertifiedModel=(entity.getSeriesName());
|
1137
|
|
isVerified=false;
|
1138
|
|
}
|
|
1162
|
MainApplication.userCertifiedModel = (entity.getSeriesName());
|
|
1163
|
isVerified = false;
|
1139
|
1164
|
|
|
1165
|
}
|
1140
|
1166
|
}
|
1141
|
|
|
1142
|
1167
|
}
|
1143
|
1168
|
|
1144
|
|
if (certificateStatus == 2) {
|
|
1169
|
if (certificateStatus == 0) {
|
1145
|
1170
|
go_title.setText("认证车主");
|
1146
|
1171
|
go_desc.setText("审核中");
|
1147
|
1172
|
go_desc.setTextColor(Color.RED);
|
1148
|
1173
|
go_cursor.setVisibility(View.INVISIBLE);
|
1149
|
|
} else if (certificateStatus == 3) {
|
|
1174
|
} else if (certificateStatus == 1) {
|
1150
|
1175
|
go_title.setText("认证车主");
|
1151
|
1176
|
if (carSeriesEntity != null) {
|
1152
|
1177
|
go_desc.setText(carSeriesEntity.getSeriesName());
|
|
@ -1160,7 +1185,7 @@ public class UserInfoActivity extends Activity implements View.OnClickListener,
|
1160
|
1185
|
go_cursor.setVisibility(View.VISIBLE);
|
1161
|
1186
|
}
|
1162
|
1187
|
|
1163
|
|
if (certificateStatus == 1 && showLoading) {
|
|
1188
|
if (certificateStatus == -2 && showLoading) {
|
1164
|
1189
|
startActivity(new Intent(getApplication(), CarOwnerCertificateActivity.class));
|
1165
|
1190
|
}
|
1166
|
1191
|
|
|
@ -1176,4 +1201,64 @@ public class UserInfoActivity extends Activity implements View.OnClickListener,
|
1176
|
1201
|
}
|
1177
|
1202
|
});
|
1178
|
1203
|
}
|
|
1204
|
/**
|
|
1205
|
* 意向车型Event
|
|
1206
|
*/
|
|
1207
|
@Subscribe(threadMode = ThreadMode.MAIN,sticky = true)
|
|
1208
|
public void onCarModelEvent(CarIntentModelEvent event) {
|
|
1209
|
if (event != null) {
|
|
1210
|
mCarModelEntity = event.getCarModelEntity();
|
|
1211
|
carModel.setText(mCarModelEntity.getSeriesName());
|
|
1212
|
EventBus.getDefault().removeStickyEvent(event);
|
|
1213
|
}
|
|
1214
|
}
|
|
1215
|
private void requestCarIntentModel() {
|
|
1216
|
String url = MainApplication.url + "/zhannew/basic/web/index.php/car/add";
|
|
1217
|
|
|
1218
|
long tokenTime = System.currentTimeMillis() / 1000 - MainMapActivity.cha - 1;
|
|
1219
|
String token = null;
|
|
1220
|
try {
|
|
1221
|
token = DES3.encode(String.valueOf(tokenTime));
|
|
1222
|
} catch (Exception e) {
|
|
1223
|
e.printStackTrace();
|
|
1224
|
}
|
|
1225
|
Map<String, String> map = new HashMap<>();
|
|
1226
|
map.put("engine_number", "yixiang");
|
|
1227
|
map.put("plate_number", "意向");
|
|
1228
|
map.put("cartype", "自用");
|
|
1229
|
map.put("userid", MainApplication.userId);
|
|
1230
|
map.put("token", token);
|
|
1231
|
|
|
1232
|
Gson gson = new Gson();
|
|
1233
|
if (mCarModelEntity == null){
|
|
1234
|
return;
|
|
1235
|
}
|
|
1236
|
String chexing = gson.toJson(mCarModelEntity);
|
|
1237
|
map.put("chexing", chexing);
|
|
1238
|
|
|
1239
|
|
|
1240
|
|
|
1241
|
OkHttpUtils.post().params(map).url(url).build().execute(new StringCallback() {
|
|
1242
|
|
|
1243
|
@Override
|
|
1244
|
public void onError(Call call, Exception e) {
|
|
1245
|
loadDialog.dismiss();
|
|
1246
|
}
|
|
1247
|
|
|
1248
|
@Override
|
|
1249
|
public void onResponse(String response) {
|
|
1250
|
loadDialog.dismiss();
|
|
1251
|
String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
|
|
1252
|
if ("01".equals(rtnCode)) {
|
|
1253
|
ToastUtil.showToast(getApplicationContext(), "意向车型提交成功", Toast.LENGTH_SHORT);
|
|
1254
|
MainApplication.userCarIntentMode = mCarModelEntity.getSeriesName();
|
|
1255
|
carModel.setText(mCarModelEntity.getSeriesName());
|
|
1256
|
ProfileManager.getInstance().setCarIntentModel(UserInfoActivity.this, mCarModelEntity.getSeriesName());
|
|
1257
|
} else {
|
|
1258
|
ToastUtil.showToast(getApplicationContext(), "意向车型提交失败,请重新提交", Toast.LENGTH_SHORT);
|
|
1259
|
}
|
|
1260
|
}
|
|
1261
|
});
|
|
1262
|
}
|
|
1263
|
|
1179
|
1264
|
}
|
|
@ -12,6 +12,7 @@ import android.util.Log;
|
12
|
12
|
|
13
|
13
|
import androidx.multidex.MultiDexApplication;
|
14
|
14
|
|
|
15
|
import com.alibaba.fastjson.JSONException;
|
15
|
16
|
import com.amap.api.maps.model.LatLng;
|
16
|
17
|
import com.blankj.utilcode.util.LogUtils;
|
17
|
18
|
import com.blankj.utilcode.util.Utils;
|
|
@ -90,13 +91,13 @@ public class MainApplication extends MultiDexApplication {
|
90
|
91
|
public static String firstPoint = "";
|
91
|
92
|
public static Boolean firstSsyd;
|
92
|
93
|
public static String password = "";
|
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/";
|
|
94
|
public static String url = "http://59.110.68.162";// 充电桩测试环境
|
|
95
|
public static String pic_url = "http://59.110.68.162/zhannew/uploadfile/";
|
|
96
|
// public static String url = "http://cdz.evcharge.cc";// 充电桩正式环境
|
|
97
|
// public static String pic_url = "http://cdz.evcharge.cc/zhannew/uploadfile/";
|
97
|
98
|
|
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";// 一电正式环境
|
|
99
|
public static String urlNew = "http://123.56.67.7:83/api/0300";// 一电测试环境
|
|
100
|
// public static String urlNew = "https://api.touchev.com:83/api/0300";// 一电正式环境
|
100
|
101
|
|
101
|
102
|
|
102
|
103
|
// public static String url = "https://cdz.d1ev.com";
|
|
@ -301,10 +302,17 @@ public class MainApplication extends MultiDexApplication {
|
301
|
302
|
@Override
|
302
|
303
|
public void onResponse(String response) {
|
303
|
304
|
String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
|
|
305
|
Log.e("TAG_hyc", "onResponse: "+response );
|
304
|
306
|
if ("01".equals(rtnCode)) {
|
305
|
307
|
String chexing = "";
|
306
|
308
|
String data = JsonUtils.getKeyResult(response, "data");
|
307
|
|
List<CarOwnerCertificateBean> list = JsonUtils.parseToObjectList(data, CarOwnerCertificateBean.class);
|
|
309
|
List<CarOwnerCertificateBean> list=new ArrayList<>();
|
|
310
|
try {
|
|
311
|
list = JsonUtils.parseToObjectList(data, CarOwnerCertificateBean.class);
|
|
312
|
}catch (JSONException e){
|
|
313
|
|
|
314
|
}
|
|
315
|
|
308
|
316
|
boolean certificated = false;
|
309
|
317
|
for (CarOwnerCertificateBean bean : list) {
|
310
|
318
|
if (bean.getStatus()!=2){ //排除意向车型,则证明用户已经车主认证过了
|
|
@ -10,7 +10,7 @@ public class CarOwnerCertificateBean implements Serializable {
|
10
|
10
|
private String chexing;
|
11
|
11
|
private String regdate;
|
12
|
12
|
private String cartype;
|
13
|
|
private int status; //状态为1 表示通过审核,状态为2表示意向车型。
|
|
13
|
private int status; //-1 -> 认证失败,0 -> 审核中,1 -> 表示通过审核,2 -> 表示意向车型。
|
14
|
14
|
private int main;
|
15
|
15
|
private String addTime;
|
16
|
16
|
private String errmsg;
|
|
@ -0,0 +1,20 @@
|
|
1
|
package com.electric.chargingpile.event;
|
|
2
|
|
|
3
|
import com.electric.chargingpile.entity.CarModelEntity;
|
|
4
|
import com.electric.chargingpile.entity.CarSeriesEntity;
|
|
5
|
|
|
6
|
public class CarIntentModelEvent {
|
|
7
|
private CarModelEntity carModelEntity;
|
|
8
|
|
|
9
|
public CarIntentModelEvent(CarModelEntity carModelEntity) {
|
|
10
|
this.carModelEntity = carModelEntity;
|
|
11
|
}
|
|
12
|
|
|
13
|
public CarModelEntity getCarModelEntity() {
|
|
14
|
return carModelEntity;
|
|
15
|
}
|
|
16
|
|
|
17
|
public void setCarModelEntity(CarModelEntity carModelEntity) {
|
|
18
|
this.carModelEntity = carModelEntity;
|
|
19
|
}
|
|
20
|
}
|
|
@ -172,7 +172,7 @@
|
172
|
172
|
android:background="@color/ui_line"
|
173
|
173
|
android:visibility="gone" />
|
174
|
174
|
|
175
|
|
<RelativeLayout
|
|
175
|
<LinearLayout
|
176
|
176
|
android:id="@+id/go_certificate"
|
177
|
177
|
android:layout_width="fill_parent"
|
178
|
178
|
android:layout_height="45dp"
|
|
@ -184,10 +184,13 @@
|
184
|
184
|
android:layout_height="match_parent"
|
185
|
185
|
android:gravity="center"
|
186
|
186
|
android:paddingLeft="15dp"
|
187
|
|
android:text="去认证车主(获得充电优惠)"
|
|
187
|
android:text="去认证车主"
|
188
|
188
|
android:textColor="@color/color_f9f9f9"
|
189
|
189
|
android:textSize="14dp" />
|
190
|
|
|
|
190
|
<View
|
|
191
|
android:layout_weight="1"
|
|
192
|
android:layout_width="0dp"
|
|
193
|
android:layout_height="wrap_content"/>
|
191
|
194
|
<TextView
|
192
|
195
|
android:id="@+id/go_desc"
|
193
|
196
|
android:layout_width="wrap_content"
|
|
@ -215,8 +218,8 @@
|
215
|
218
|
android:layout_marginRight="15dp"
|
216
|
219
|
android:src="@drawable/icon_more2_0" />
|
217
|
220
|
|
218
|
|
</RelativeLayout>
|
219
|
|
<RelativeLayout
|
|
221
|
</LinearLayout>
|
|
222
|
<LinearLayout
|
220
|
223
|
android:id="@+id/carIntentModel"
|
221
|
224
|
android:layout_width="fill_parent"
|
222
|
225
|
android:layout_height="45dp"
|
|
@ -231,21 +234,10 @@
|
231
|
234
|
android:textColor="@color/color_f9f9f9"
|
232
|
235
|
android:textSize="14sp"
|
233
|
236
|
/>
|
234
|
|
|
235
|
|
<TextView
|
236
|
|
android:layout_width="wrap_content"
|
237
|
|
android:layout_height="45dp"
|
238
|
|
android:layout_alignParentTop="true"
|
239
|
|
android:layout_alignParentEnd="true"
|
240
|
|
android:layout_alignParentRight="true"
|
241
|
|
android:layout_marginRight="15dp"
|
242
|
|
android:background="@color/white"
|
243
|
|
android:gravity="center|right"
|
244
|
|
android:singleLine="true"
|
245
|
|
android:textColor="@color/ui_62"
|
246
|
|
android:textColorHint="@color/ui_68"
|
247
|
|
android:textSize="15sp"
|
248
|
|
tools:text="审核中" />
|
|
237
|
<View
|
|
238
|
android:layout_weight="1"
|
|
239
|
android:layout_width="0dp"
|
|
240
|
android:layout_height="wrap_content"/>
|
249
|
241
|
<TextView
|
250
|
242
|
android:id="@+id/carModel"
|
251
|
243
|
android:layout_marginEnd="15dp"
|
|
@ -271,7 +263,7 @@
|
271
|
263
|
android:layout_marginRight="15dp"
|
272
|
264
|
android:src="@drawable/icon_more2_0" />
|
273
|
265
|
|
274
|
|
</RelativeLayout>
|
|
266
|
</LinearLayout>
|
275
|
267
|
|
276
|
268
|
<RelativeLayout
|
277
|
269
|
android:id="@+id/rl_select_car"
|
|
@ -252,7 +252,7 @@
|
252
|
252
|
/>
|
253
|
253
|
<ImageView
|
254
|
254
|
android:paddingEnd="14dp"
|
255
|
|
android:paddingStart="9dp"
|
|
255
|
android:paddingStart="9dp"
|
256
|
256
|
android:src="@drawable/icon_more2_0"
|
257
|
257
|
android:layout_width="wrap_content"
|
258
|
258
|
android:layout_height="match_parent"/>
|
|
@ -1,8 +1,8 @@
|
1
|
1
|
package com.google.zxing.client.android.constant;
|
2
|
2
|
|
3
|
3
|
public interface UrlConstants {
|
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/";
|
|
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
|
6
|
|
7
|
7
|
String USER_CHARGING_CHECK_URL = HOST_URL + "api/charge/check-user";
|
8
|
8
|
String START_CHARGING_URL = HOST_URL + "api/charge/start";
|