|
@@ -2,6 +2,7 @@ package com.steerinfo.dil.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.steerinfo.dil.gaode.SearchPoint2;
|
|
|
import com.steerinfo.dil.service.ITmstruckLeaveFactoryResultService;
|
|
|
import com.steerinfo.dil.service.ITmstruckReceiptResultService;
|
|
|
import com.steerinfo.dil.service.impl.OffSiteTransportationServiceImpl;
|
|
@@ -30,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.http.MediaType;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import org.springframework.web.multipart.MultipartRequest;
|
|
@@ -67,6 +69,7 @@ public class OffSiteTransportationController extends BaseRESTfulController {
|
|
|
private String suffix;
|
|
|
@Autowired
|
|
|
private RedisTemplate redisTemplate;
|
|
|
+ private String gaodeTonken = "6488b963467353c2837c955cbb03104f";
|
|
|
|
|
|
@Autowired
|
|
|
ITmstruckReceiptResultService tmstruckReceiptResultService;
|
|
@@ -359,18 +362,22 @@ public class OffSiteTransportationController extends BaseRESTfulController {
|
|
|
String netValidationResult = zhongJiaoXingLu.netValidation(capacityNumber);
|
|
|
Map netValidationMap = (Map) JSONObject.parse(netValidationResult);
|
|
|
if (Integer.parseInt(netValidationMap.get("status").toString())==1001&&netValidationMap.get("result").toString().equals("yes")){
|
|
|
- String searchPointJson = 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);
|
|
|
+ String searchPointJson = HTTPRequestUtils.sendGet("https://restapi.amap.com/v3/geocode/geo", "address="+ URLEncoder.encode("四川省达州钢铁集团有限责任公司","utf-8")+"&key="+gaodeTonken);
|
|
|
+ SearchPoint2 searchPoint= (SearchPoint2) DataConversionTool.jsonToBean(searchPointJson, SearchPoint2.class);
|
|
|
+ String searchPointJson2 = HTTPRequestUtils.sendGet("https://restapi.amap.com/v3/geocode/geo", "address="+URLEncoder.encode("四川省达州钢铁集团有限责任公司","utf-8")+"&key="+gaodeTonken);
|
|
|
+ SearchPoint2 searchPoint2= (SearchPoint2) DataConversionTool.jsonToBean(searchPointJson2, SearchPoint2.class);
|
|
|
//运单生成之后保存
|
|
|
HashMap<String,String> redisMap=new HashMap<>();
|
|
|
- String startLon=searchPoint.getResult().getLocation().getLng().toString().length()>9?searchPoint.getResult().getLocation().getLng().toString().substring(0,9):searchPoint.getResult().getLocation().getLng().toString();
|
|
|
- String startLat=searchPoint.getResult().getLocation().getLat().toString().length()>9?searchPoint.getResult().getLocation().getLat().toString().substring(0,8):searchPoint.getResult().getLocation().getLat().toString();
|
|
|
- redisMap.put("startLonlat", startLon+","+startLat);
|
|
|
- String endLon= searchPoint2.getResult().getLocation().getLng().toString().length()>9?searchPoint2.getResult().getLocation().getLng().toString().substring(0,9):searchPoint2.getResult().getLocation().getLng().toString();
|
|
|
- String endLat= searchPoint2.getResult().getLocation().getLat().toString().length()>9?searchPoint2.getResult().getLocation().getLat().toString().substring(0,8):searchPoint2.getResult().getLocation().getLat().toString();
|
|
|
- redisMap.put("endLonlat",endLon+","+endLat);
|
|
|
+ String location = searchPoint.getGeocodes().get(0).getLocation();
|
|
|
+ String[] split = StringUtils.split(location, ",");
|
|
|
+ String Lng = split[0];
|
|
|
+ String Lat = split[1];
|
|
|
+ redisMap.put("startLonlat", Lng.substring(0, 9) + "," + Lat.substring(0, 8));
|
|
|
+ String location2 = searchPoint2.getGeocodes().get(0).getLocation();
|
|
|
+ String[] split2 = StringUtils.split(location2, ",");
|
|
|
+ String Lng2 = split2[0];
|
|
|
+ String Lat2 = split2[1];
|
|
|
+ redisMap.put("endLonlat", Lng2.substring(0, 9) + "," + Lat2.substring(0, 8));
|
|
|
redisMap.put("vclN", capacityNumber);
|
|
|
redisMap.put("vco","2");
|
|
|
SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:ss:mm");
|