Browse Source

代码修改

huyuguo 5 years ago
parent
commit
243cec858a

+ 30 - 19
app/src/main/java/com/electric/chargingpile/activity/CarOwnerCertificateActivity.java

230
            }
230
            }
231
231
232
232
233
234
            if ("自用".equals(carOwnerCertificateBean.getCartype())) {
233
            if ("自用".equals(carOwnerCertificateBean.getCartype())) {
235
                drivingLicenseType = "自用";
234
                drivingLicenseType = "自用";
236
                driving_license_type_first.setCompoundDrawables(selected, null, null, null);
235
                driving_license_type_first.setCompoundDrawables(selected, null, null, null);
254
        if (showLoading)
253
        if (showLoading)
255
            loadDialog.show();
254
            loadDialog.show();
256
        // https://www.jianshu.com/p/10382cc71127
255
        // https://www.jianshu.com/p/10382cc71127
257
        String url = "https://api.touchev.com:83/car/api/v1000/brand/list.do";
258
//        String url = "http://car.d1ev.com/car/api/v1000/brand/list.do";
259
        OkHttpUtils.get().url(url).build().connTimeOut(5000).readTimeOut(5000).execute(new StringCallback() {
256
//        String url = "https://api.touchev.com:83/car/api/v1000/brand/list.do";
257
        String url = "http://car.d1ev.com/car/api/v1000/brand/list.do";
258
        OkHttpUtils.get().url(url).build().connTimeOut(30000).readTimeOut(30000).execute(new StringCallback() {
260
            @Override
259
            @Override
261
            public void onError(Call call, Exception e) {
260
            public void onError(Call call, Exception e) {
262
                Toast.makeText(getApplicationContext(), "网络不给力,请检查网络状态", Toast.LENGTH_SHORT).show();
261
                Toast.makeText(getApplicationContext(), "网络不给力,请检查网络状态", Toast.LENGTH_SHORT).show();
498
        drivingLicenseBase64Data = "data:image/png;base64," + base64;
497
        drivingLicenseBase64Data = "data:image/png;base64," + base64;
499
        insertDialog.setMessage("正在识别行驶证");
498
        insertDialog.setMessage("正在识别行驶证");
500
        insertDialog.show();
499
        insertDialog.show();
501
        long appTime = System.currentTimeMillis() / 1000;
502
        long updateTime = appTime - MainMapActivity.cha - 1;
500
501
        long tokenTime = System.currentTimeMillis() / 1000 - MainMapActivity.cha - 1;
503
        String token = null;
502
        String token = null;
504
        try {
503
        try {
505
            token = URLEncoder.encode(DES3.encode(String.valueOf(updateTime)));
504
            token = DES3.encode(String.valueOf(tokenTime));
506
        } catch (Exception e) {
505
        } catch (Exception e) {
507
            e.printStackTrace();
506
            e.printStackTrace();
508
        }
507
        }
544
            return;
543
            return;
545
        }
544
        }
546
545
547
//        if (drivingLicenseBase64Data == null) {
548
//            ToastUtil.showToast(this, "请上传行驶证首页" + drivingLicenseType, Toast.LENGTH_SHORT);
549
//            return;
550
//        }
546
        if (drivingLicenseBase64Data == null) {
547
            ToastUtil.showToast(this, "请上传行驶证首页" + drivingLicenseType, Toast.LENGTH_SHORT);
548
            return;
549
        }
550
551
        if (TextUtils.isEmpty(plate_num.getText().toString().trim())) {
552
            ToastUtil.showToast(this, "请输入车牌号", Toast.LENGTH_SHORT);
553
            return;
554
        }
555
556
        if (TextUtils.isEmpty(engine_num.getText().toString().trim())) {
557
            ToastUtil.showToast(this, "请输入发动机号", Toast.LENGTH_SHORT);
558
            return;
559
        }
560
561
        if (TextUtils.isEmpty(register_date.getText().toString().trim())) {
562
            ToastUtil.showToast(this, "请输入注册日期", Toast.LENGTH_SHORT);
563
            return;
564
        }
565
551
566
552
        insertDialog.setMessage("数据提交中");
567
        insertDialog.setMessage("数据提交中");
553
        insertDialog.show();
568
        insertDialog.show();
570
        map.put("cartype", drivingLicenseType);
585
        map.put("cartype", drivingLicenseType);
571
        map.put("userid", MainApplication.userId);
586
        map.put("userid", MainApplication.userId);
572
587
573
        long appTime11 = System.currentTimeMillis() / 1000;
574
        long updatetime1 = appTime11 - MainMapActivity.cha - 5;
575
        String token1 = String.valueOf(updatetime1);
576
        String encode_token = null;
577
588
        long tokenTime = System.currentTimeMillis() / 1000 - MainMapActivity.cha - 1;
589
        String token = null;
578
        try {
590
        try {
579
            encode_token = DES3.encode(token1);
591
            token = DES3.encode(String.valueOf(tokenTime));
580
        } catch (Exception e) {
592
        } catch (Exception e) {
581
            e.printStackTrace();
593
            e.printStackTrace();
582
        }
594
        }
583
        String replace = URLEncoder.encode(encode_token);
584
        map.put("token", replace);
585
595
596
        map.put("token", token);
586
//        OkHttpUtils.postString().url(url).content(new Gson().toJson(map)).mediaType(MediaType.parse("application/json; charset=utf-8"))
597
//        OkHttpUtils.postString().url(url).content(new Gson().toJson(map)).mediaType(MediaType.parse("application/json; charset=utf-8"))
587
        OkHttpUtils.post().params(map).url(url).build().execute(new StringCallback() {
598
        OkHttpUtils.post().params(map).url(url).build().execute(new StringCallback() {
588
            @Override
599
            @Override

+ 6 - 9
app/src/main/java/com/electric/chargingpile/activity/CarOwnerCertificateListActivity.java

110
    private void deleteCarOwnerCertificate(int id) {
110
    private void deleteCarOwnerCertificate(int id) {
111
        loadDialog.show();
111
        loadDialog.show();
112
112
113
        long appTime = System.currentTimeMillis() / 1000;
114
        long updateTime = appTime - MainMapActivity.cha - 1;
113
        long tokenTime = System.currentTimeMillis() / 1000 - MainMapActivity.cha - 1;
115
        String token = null;
114
        String token = null;
116
        try {
115
        try {
117
            token = URLEncoder.encode(DES3.encode(String.valueOf(updateTime)));
116
            token = DES3.encode(String.valueOf(tokenTime));
118
        } catch (Exception e) {
117
        } catch (Exception e) {
119
            e.printStackTrace();
118
            e.printStackTrace();
120
        }
119
        }
148
    private void setCarOwnerCertificateMain(int id) {
147
    private void setCarOwnerCertificateMain(int id) {
149
        loadDialog.show();
148
        loadDialog.show();
150
149
151
        long appTime = System.currentTimeMillis() / 1000;
152
        long updateTime = appTime - MainMapActivity.cha - 1;
150
        long tokenTime = System.currentTimeMillis() / 1000 - MainMapActivity.cha - 1;
153
        String token = null;
151
        String token = null;
154
        try {
152
        try {
155
            token = URLEncoder.encode(DES3.encode(String.valueOf(updateTime)));
153
            token = DES3.encode(String.valueOf(tokenTime));
156
        } catch (Exception e) {
154
        } catch (Exception e) {
157
            e.printStackTrace();
155
            e.printStackTrace();
158
        }
156
        }
181
    }
179
    }
182
180
183
    private void getCarOwnerCertificateList() {
181
    private void getCarOwnerCertificateList() {
184
        long appTime = System.currentTimeMillis() / 1000;
185
        long updateTime = appTime - MainMapActivity.cha - 1;
182
        long tokenTime = System.currentTimeMillis() / 1000 - MainMapActivity.cha - 1;
186
        String token = null;
183
        String token = null;
187
        try {
184
        try {
188
            token = URLEncoder.encode(DES3.encode(String.valueOf(updateTime)));
185
            token = DES3.encode(String.valueOf(tokenTime));
189
        } catch (Exception e) {
186
        } catch (Exception e) {
190
            e.printStackTrace();
187
            e.printStackTrace();
191
        }
188
        }

+ 9 - 1
app/src/main/java/com/electric/chargingpile/activity/UserCenterActivity.java

1066
1066
1067
    private void getCarOwnerCertificateList(String from) {
1067
    private void getCarOwnerCertificateList(String from) {
1068
        loadDialog.show();
1068
        loadDialog.show();
1069
        String url = MainApplication.url + "/zhannew/basic/web/index.php/car/my?userid=" + MainApplication.userId;
1069
        long tokenTime = System.currentTimeMillis() / 1000 - MainMapActivity.cha - 1;
1070
        String token = null;
1071
        try {
1072
            token = DES3.encode(String.valueOf(tokenTime));
1073
        } catch (Exception e) {
1074
            e.printStackTrace();
1075
        }
1076
1077
        String url = MainApplication.url + "/zhannew/basic/web/index.php/car/my?userid=" + MainApplication.userId + "&token=" + token;
1070
        OkHttpUtils.get().url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
1078
        OkHttpUtils.get().url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
1071
            @Override
1079
            @Override
1072
            public void onError(Call call, Exception e) {
1080
            public void onError(Call call, Exception e) {

+ 5 - 5
app/src/main/res/layout/activity_car_owner_certificate.xml

165
                    android:id="@+id/driving_license_text_view"
165
                    android:id="@+id/driving_license_text_view"
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:text="上传行驶证首页(选填)"
168
                    android:text="上传行驶证首页"
169
                    android:textColor="#3D5545"
169
                    android:textColor="#3D5545"
170
                    android:textSize="14sp"
170
                    android:textSize="14sp"
171
                    app:layout_constraintBottom_toBottomOf="parent"
171
                    app:layout_constraintBottom_toBottomOf="parent"
206
                    <TextView
206
                    <TextView
207
                        android:layout_width="90dp"
207
                        android:layout_width="90dp"
208
                        android:layout_height="wrap_content"
208
                        android:layout_height="wrap_content"
209
                        android:text="车牌号"
209
                        android:text="*车牌号"
210
                        android:textColor="#0D1120"
210
                        android:textColor="#0D1120"
211
                        android:textSize="14sp"
211
                        android:textSize="14sp"
212
                        android:textStyle="bold" />
212
                        android:textStyle="bold" />
238
                    <TextView
238
                    <TextView
239
                        android:layout_width="90dp"
239
                        android:layout_width="90dp"
240
                        android:layout_height="wrap_content"
240
                        android:layout_height="wrap_content"
241
                        android:text="发动机号"
241
                        android:text="*发动机号"
242
                        android:textColor="#0D1120"
242
                        android:textColor="#0D1120"
243
                        android:textSize="14sp"
243
                        android:textSize="14sp"
244
                        android:textStyle="bold" />
244
                        android:textStyle="bold" />
270
                    <TextView
270
                    <TextView
271
                        android:layout_width="90dp"
271
                        android:layout_width="90dp"
272
                        android:layout_height="wrap_content"
272
                        android:layout_height="wrap_content"
273
                        android:text="注册日期"
273
                        android:text="*注册日期"
274
                        android:textColor="#0D1120"
274
                        android:textColor="#0D1120"
275
                        android:textSize="14sp"
275
                        android:textSize="14sp"
276
                        android:textStyle="bold" />
276
                        android:textStyle="bold" />
281
                        android:layout_height="match_parent"
281
                        android:layout_height="match_parent"
282
                        android:layout_weight="1"
282
                        android:layout_weight="1"
283
                        android:background="@null"
283
                        android:background="@null"
284
                        android:hint="请输入注册日期"
284
                        android:hint="*请输入注册日期"
285
                        android:inputType="text"
285
                        android:inputType="text"
286
                        android:textColor="#0D1120"
286
                        android:textColor="#0D1120"
287
                        android:textColorHint="#CBCBCB"
287
                        android:textColorHint="#CBCBCB"