Преглед на файлове

分时价格显示修改

huyuguo преди 4 години
родител
ревизия
6cf845b016

+ 28 - 4
app/src/main/java/com/electric/chargingpile/activity/SearchActivity.java

@ -66,6 +66,7 @@ import com.zhy.http.okhttp.callback.StringCallback;
66 66

67 67
import java.net.URISyntaxException;
68 68
import java.util.ArrayList;
69
import java.util.Arrays;
69 70
import java.util.Calendar;
70 71
import java.util.HashMap;
71 72
import java.util.List;
@ -85,8 +86,8 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
85 86
    private List<HistoryInfo> historyInfoList = new ArrayList<HistoryInfo>();
86 87
    private HistoryInfo history;
87 88

88
    private List<RecommendZhan> pointList = new ArrayList<>();
89
    public static List<RecommendZhan> pointAllList = new ArrayList<>();
89
    private List<RecommendZhan> pointList = new ArrayList<RecommendZhan>();
90
    public static List<RecommendZhan> pointAllList = new ArrayList<RecommendZhan>();
90 91

91 92
    private Map<String, String> map;
92 93

@ -779,8 +780,8 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
779 780
                            double service_free = 0;
780 781
                            double charge_free = 0;
781 782
                            try {
782
                                service_free = Double.valueOf(bean.getService_free());
783
                                charge_free = Double.valueOf(bean.getCharge_free());
783
                                service_free = Double.valueOf(bean.getServicefee());
784
                                charge_free = Double.valueOf(bean.getDianfee());
784 785
                            } catch (Exception e) {
785 786
                                e.printStackTrace();
786 787
                            }
@ -971,9 +972,32 @@ public class SearchActivity extends Activity implements OnClickListener, Inputti
971 972

972 973
                                double d = AMapUtils.calculateLineDistance(center, ll);
973 974
                                point.setDistance(Util.getDistance(d));
975
                                point.setDistanceDouble(d);
974 976
                                pointAllList.add(point);
975 977
                            }
976 978

979
                            int size = pointAllList.size();
980
                            if (size > 0) {
981
                                RecommendZhan[] tempList = new RecommendZhan[size];
982
                                for (int i=0;i<size;i++) {
983
                                    tempList[i] = pointAllList.get(i);
984
                                }
985
                                Arrays.sort(tempList, (b1, b2) -> {
986
                                    if (b1.getDistanceDouble() > b2.getDistanceDouble()) {
987
                                        return 1;
988
                                    } else if (b1.getDistanceDouble() < b2.getDistanceDouble()) {
989
                                        return -1;
990
                                    } else {
991
                                        return 0;
992
                                    }
993
                                });
994

995
                                pointAllList.clear();
996
                                for (RecommendZhan zhan: tempList) {
997
                                    pointAllList.add(zhan);
998
                                }
999
                            }
1000

977 1001
                            for (RecommendZhan point : pointAllList) {
978 1002
                                pointList.add(point);
979 1003
                                if (pointList.size() >= 5) {

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

@ -330,8 +330,8 @@ public class SearchAllActivity extends AppCompatActivity {
330 330
                            double service_free = 0;
331 331
                            double charge_free = 0;
332 332
                            try {
333
                                service_free = Double.valueOf(bean.getService_free());
334
                                charge_free = Double.valueOf(bean.getCharge_free());
333
                                service_free = Double.valueOf(bean.getServicefee());
334
                                charge_free = Double.valueOf(bean.getDianfee());
335 335
                            } catch (Exception e) {
336 336
                                e.printStackTrace();
337 337
                            }

+ 18 - 0
app/src/main/java/com/electric/chargingpile/data/PileData.java

@ -237,6 +237,24 @@ public class PileData implements Serializable {
237 237
        private String end;
238 238
        private String service_free;
239 239
        private String charge_free;
240
        private String dianfee;
241
        private String servicefee;
242
243
        public String getDianfee() {
244
            return dianfee;
245
        }
246
247
        public void setDianfee(String dianfee) {
248
            this.dianfee = dianfee;
249
        }
250
251
        public String getServicefee() {
252
            return servicefee;
253
        }
254
255
        public void setServicefee(String servicefee) {
256
            this.servicefee = servicefee;
257
        }
240 258
241 259
        public String getStart() {
242 260
            return start;

+ 9 - 0
app/src/main/java/com/electric/chargingpile/data/RecommendZhan.java

@ -41,6 +41,7 @@ public class RecommendZhan {
41 41
    private String zhan_id;
42 42
    private String charge_cost_way2;
43 43
    private String distance;
44
    private double distanceDouble;
44 45
    private double distanceNum;
45 46
    private double score;
46 47
    private String pile_status;
@ -56,6 +57,14 @@ public class RecommendZhan {
56 57
    private String stop_cost;
57 58
    private String fenshi_is;
58 59
60
    public double getDistanceDouble() {
61
        return distanceDouble;
62
    }
63
64
    public void setDistanceDouble(double distanceDouble) {
65
        this.distanceDouble = distanceDouble;
66
    }
67
59 68
    public String getFenshi_info() {
60 69
        return fenshi_info;
61 70
    }