|
@@ -276,22 +276,18 @@ public class RouteServiceImpl implements RouteService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public CompletableFuture<String> saveRoute(Map mapValue) throws Exception {
|
|
public CompletableFuture<String> saveRoute(Map mapValue) throws Exception {
|
|
-
|
|
|
|
//获得起点的经纬度和code
|
|
//获得起点的经纬度和code
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
Date gateTime = dateFormat.parse(mapValue.get("resultOutGateTime").toString());
|
|
Date gateTime = dateFormat.parse(mapValue.get("resultOutGateTime").toString());
|
|
String searchPointJson = HTTPRequestUtils.sendGet("https://restapi.amap.com/v3/geocode/geo", "address=" + URLEncoder.encode(mapValue.get("shipperName").toString() == null ? "四川省达州钢铁集团有限责任公司" : mapValue.get("shipperName").toString(), "utf-8") + "&key=" + gaodeTonken);
|
|
String searchPointJson = HTTPRequestUtils.sendGet("https://restapi.amap.com/v3/geocode/geo", "address=" + URLEncoder.encode(mapValue.get("shipperName").toString() == null ? "四川省达州钢铁集团有限责任公司" : mapValue.get("shipperName").toString(), "utf-8") + "&key=" + gaodeTonken);
|
|
SearchPoint2 searchPoint = JSON.parseObject(searchPointJson, SearchPoint2.class);
|
|
SearchPoint2 searchPoint = JSON.parseObject(searchPointJson, SearchPoint2.class);
|
|
-
|
|
|
|
//创建收货地址 addressProvince 省份、addressDistrict 市区、addressTown 县镇 、addressDeliveryAddress 收货地址、 addressLongitude 收货地址经度、addressLatitude 收货地址纬度
|
|
//创建收货地址 addressProvince 省份、addressDistrict 市区、addressTown 县镇 、addressDeliveryAddress 收货地址、 addressLongitude 收货地址经度、addressLatitude 收货地址纬度
|
|
String searchPointJson2 = HTTPRequestUtils.sendGet("https://restapi.amap.com/v3/geocode/geo", "address=" + URLEncoder.encode(mapValue.get("receiveAddress").toString() == null ? "长沙市" : mapValue.get("receiveAddress").toString(), "utf-8") + "&key=" + gaodeTonken);
|
|
String searchPointJson2 = HTTPRequestUtils.sendGet("https://restapi.amap.com/v3/geocode/geo", "address=" + URLEncoder.encode(mapValue.get("receiveAddress").toString() == null ? "长沙市" : mapValue.get("receiveAddress").toString(), "utf-8") + "&key=" + gaodeTonken);
|
|
SearchPoint2 searchPoint2 = JSON.parseObject(searchPointJson2, SearchPoint2.class);
|
|
SearchPoint2 searchPoint2 = JSON.parseObject(searchPointJson2, SearchPoint2.class);
|
|
-
|
|
|
|
//入网验证
|
|
//入网验证
|
|
String netValidationResult = zhongJiaoXingLu.netValidation(mapValue.get("capacityNumber").toString());
|
|
String netValidationResult = zhongJiaoXingLu.netValidation(mapValue.get("capacityNumber").toString());
|
|
Map netValidationMap = (Map) JSONObject.parse(netValidationResult);
|
|
Map netValidationMap = (Map) JSONObject.parse(netValidationResult);
|
|
if (Integer.parseInt(netValidationMap.get("status").toString()) == 1001 && netValidationMap.get("result").toString().equals("yes")) {
|
|
if (Integer.parseInt(netValidationMap.get("status").toString()) == 1001 && netValidationMap.get("result").toString().equals("yes")) {
|
|
-
|
|
|
|
//运单生成之后保存
|
|
//运单生成之后保存
|
|
HashMap<String, String> redisMap = new HashMap<>();
|
|
HashMap<String, String> redisMap = new HashMap<>();
|
|
String location = searchPoint.getGeocodes().get(0).getLocation();
|
|
String location = searchPoint.getGeocodes().get(0).getLocation();
|
|
@@ -907,7 +903,13 @@ public class RouteServiceImpl implements RouteService {
|
|
@Override
|
|
@Override
|
|
public CurrentLocationResult getCurrentLocation(String capcityNumber) throws Exception {
|
|
public CurrentLocationResult getCurrentLocation(String capcityNumber) throws Exception {
|
|
String json = zhongJiaoXingLu.vLastLocationV3(capcityNumber);
|
|
String json = zhongJiaoXingLu.vLastLocationV3(capcityNumber);
|
|
- CurrentLocationResult currentLocationResult = JSONObject.parseObject(json,CurrentLocationResult.class);
|
|
|
|
|
|
+ CurrentLocationResult currentLocationResult = new CurrentLocationResult();
|
|
|
|
+ try {
|
|
|
|
+ currentLocationResult = JSONObject.parseObject(json, CurrentLocationResult.class);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ Map<String, Object> map = new HashMap<>(JSONObject.parseObject(json));
|
|
|
|
+ currentLocationResult.setStatus(Integer.parseInt(map.get("status").toString()));
|
|
|
|
+ }
|
|
try{
|
|
try{
|
|
if(currentLocationResult.getResult().getLat()!=null&¤tLocationResult.getResult().getLon()!=null){
|
|
if(currentLocationResult.getResult().getLat()!=null&¤tLocationResult.getResult().getLon()!=null){
|
|
Double[] lngLon = LngLonUtil.gps84_To_Gcj02((Double.valueOf(currentLocationResult.getResult().getLat()) / 600000), (Double.valueOf(currentLocationResult.getResult().getLon()) / 600000));
|
|
Double[] lngLon = LngLonUtil.gps84_To_Gcj02((Double.valueOf(currentLocationResult.getResult().getLat()) / 600000), (Double.valueOf(currentLocationResult.getResult().getLon()) / 600000));
|