|
@@ -9,6 +9,7 @@ import com.steerinfo.dil.service.impl.OffSiteTransportationServiceImpl;
|
|
|
import com.steerinfo.dil.util.PageListAdd;
|
|
|
import com.steerinfo.framework.controller.RESTfulResult;
|
|
|
import com.steerinfo.framework.service.pagehelper.PageHelper;
|
|
|
+import com.steerinfo.route.mapper.TmstruckReceiptResultChildMapper;
|
|
|
import com.steerinfo.route.service.RouteService;
|
|
|
import com.steerinfo.route.threeRequest.ZhongJiaoXingLu;
|
|
|
import com.steerinfo.route.util.DataConversionTool;
|
|
@@ -33,6 +34,7 @@ import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.text.SimpleDateFormat;
|
|
@@ -52,6 +54,8 @@ public class RouteServiceImpl implements RouteService {
|
|
|
private ITmstruckLeaveFactoryResultService tmstruckLeaveFactoryResultService;
|
|
|
@Autowired
|
|
|
private OffSiteTransportationServiceImpl offSiteTransportationService;
|
|
|
+ @Autowired
|
|
|
+ private TmstruckReceiptResultChildMapper tmstruckReceiptResultChildMapper;
|
|
|
@Value("${str.tengxun.key}")
|
|
|
private String key;
|
|
|
@Value("${redis.prefix.order}")
|
|
@@ -767,10 +771,16 @@ public class RouteServiceImpl implements RouteService {
|
|
|
}
|
|
|
@Override
|
|
|
public CompletableFuture<RouteVo> fullPathVisualizationByCarNumber(HashMap mapValue) throws Exception {
|
|
|
-
|
|
|
String searchPointJson = HTTPRequestUtils.sendGet("https://apis.map.qq.com/ws/geocoder/v1/", "address="+URLEncoder.encode("四川省达州钢铁集团有限责任公司","utf-8")+"&key=WDTBZ-A5VKJ-UDLFI-KYJY6-WTP2S-A6B4Y");
|
|
|
+ String searchPointJson2;
|
|
|
+ //查询当前运单收货地址,作为终点地址,如果没有,则用默认地址,即四川省达川区
|
|
|
+ Map<String,Object> details = tmstruckReceiptResultChildMapper.getAddress(mapValue);
|
|
|
+ if(details!=null && details.get("addressPlace")!=null){
|
|
|
+ searchPointJson2 = HTTPRequestUtils.sendGet("https://apis.map.qq.com/ws/geocoder/v1/", "address="+URLEncoder.encode(details.get("addressPlace").toString(),"utf-8")+"&key=WDTBZ-A5VKJ-UDLFI-KYJY6-WTP2S-A6B4Y");
|
|
|
+ }else{
|
|
|
+ searchPointJson2 = HTTPRequestUtils.sendGet("https://apis.map.qq.com/ws/geocoder/v1/", "address="+URLEncoder.encode("四川省达川区","utf-8")+"&key=WDTBZ-A5VKJ-UDLFI-KYJY6-WTP2S-A6B4Y");
|
|
|
+ }
|
|
|
SearchPoint searchPoint= (SearchPoint) DataConversionTool.jsonToBean(searchPointJson, SearchPoint.class);
|
|
|
- String searchPointJson2 = HTTPRequestUtils.sendGet("https://apis.map.qq.com/ws/geocoder/v1/", "address="+URLEncoder.encode("四川省达川区","utf-8")+"&key=WDTBZ-A5VKJ-UDLFI-KYJY6-WTP2S-A6B4Y");
|
|
|
SearchPoint searchPoint2= (SearchPoint) DataConversionTool.jsonToBean(searchPointJson2, SearchPoint.class);
|
|
|
//运单生成之后保存
|
|
|
HashMap<String,String> redisMap=new HashMap<>();
|
|
@@ -880,4 +890,20 @@ public class RouteServiceImpl implements RouteService {
|
|
|
}
|
|
|
return currentLocationResult;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getLocationForAddress(String address) throws UnsupportedEncodingException {
|
|
|
+ Map<String,Object> map=new HashMap<>();
|
|
|
+ String searchPointJson = HTTPRequestUtils.sendGet("https://apis.map.qq.com/ws/geocoder/v1/", "address="+URLEncoder.encode(address,"utf-8")+"&key=WDTBZ-A5VKJ-UDLFI-KYJY6-WTP2S-A6B4Y");
|
|
|
+ SearchPoint searchPoint= JSON.parseObject(searchPointJson,SearchPoint.class);
|
|
|
+ String lon=searchPoint.getResult().getLocation().getLng().toString().length()>9?searchPoint.getResult().getLocation().getLng().toString().substring(0,9):searchPoint.getResult().getLocation().getLng().toString();
|
|
|
+ String lat=searchPoint.getResult().getLocation().getLat().toString().length()>9?searchPoint.getResult().getLocation().getLat().toString().substring(0,8):searchPoint.getResult().getLocation().getLat().toString();
|
|
|
+ map.put("location", lon+","+lat);
|
|
|
+ Double [] arr=LngLonUtil.gps84_To_Gcj02(Double.parseDouble(lon),Double.parseDouble(lat));
|
|
|
+ map.put("lon",arr[0]);
|
|
|
+ map.put("lat",arr[1]);
|
|
|
+ map.put("title",searchPoint.getResult().getTitle());
|
|
|
+ map.put("address",searchPoint.getResult().getAddress_components().getProvince()+searchPoint.getResult().getAddress_components().getCity()+searchPoint.getResult().getAddress_components().getDistrict());
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|