| | |
| | | DistanceMapParam t = new DistanceMapParam(); |
| | | t.setId(cm.getCustomerId()); |
| | | DistanceMapParam param = getParamByCustomerIds( cm.getCustomerId(),distanceMapParamList); |
| | | if(param!=null){//如果之前已经获取过 |
| | | if(param!=null && t.getDistance()>0){//如果之前已经获取过 |
| | | t = param; |
| | | }else{ |
| | | //如果未规划,按照直线距离 |
| | |
| | | int index =0; |
| | | for(JkSketchCustomer c : customers){ |
| | | if(index ==0){ |
| | | lineDistance+= Constants.formatLongNum(c.getStartDistance()); |
| | | if(c.getStartDistance() >0){ |
| | | lineDistance+= Constants.formatLongNum(c.getStartDistance()); |
| | | }else{ |
| | | lineDistance += DistanceCalculator.calculateDistanceDecinal(c.getLatitude(),c.getLongitude(),cLatitude,cLongitude); |
| | | } |
| | | } |
| | | if(index == customers.size()-1){ |
| | | lineDistance+= Constants.formatLongNum(c.getEndDistance()); |
| | | if(c.getEndDistance() >0){ |
| | | lineDistance+= Constants.formatLongNum(c.getEndDistance()); |
| | | }else{ |
| | | lineDistance += DistanceCalculator.calculateDistanceDecinal(c.getLatitude(),c.getLongitude(),cLatitude,cLongitude); |
| | | } |
| | | break; |
| | | } |
| | | DistanceMapParam param = getParamByCustomerIds( customers.get(index+1).getCustomerId(),getListFromJsonStr(c.getDistanceJson())); |
| | | lineDistance += param.getDistance(); |
| | | JkSketchCustomer end = customers.get(index+1); |
| | | DistanceMapParam param1 = getParamByCustomerIds(end.getCustomerId(),getListFromJsonStr(c.getDistanceJson())); |
| | | if(param1 !=null && param1.getDistance()>0){ |
| | | lineDistance += param1.getDistance(); |
| | | }else{ |
| | | lineDistance += DistanceCalculator.calculateDistanceDecinal(c.getLatitude(),c.getLongitude(),end.getLatitude(),end.getLongitude()); |
| | | } |
| | | index++; |
| | | /* for(JkSketchCustomer cm : customers){ |
| | | DistanceMapParam param = getParamByCustomerIds( cm.getCustomerId(),getListFromJsonStr(c.getDistanceJson())); |