liyg 2 年之前
父節點
當前提交
34dc850806

+ 15 - 5
src/main/java/com/steerinfo/dil/controller/OffSiteTransportationController.java

@@ -100,14 +100,14 @@ public class OffSiteTransportationController extends BaseRESTfulController {
         //运输订单号:orderNumber、车牌号:capacityNumber、出厂时间:resultOutGateTime、预警开关:turnOf、发货地址:shipperName、收货地址:receiveAddress
         //初始化请求参数
         //判断订单是否可以查看路径
-        int watch = offSiteTransportationService.checkOrder(orderNumber);
-        if (watch==1){
+//        int watch = offSiteTransportationService.checkOrder(orderNumber);
+//        if (watch==1){
             HashMap<String,Object> mapValue=new HashMap<>();
             mapValue.put("orderNumber",orderNumber);
             return success(routeService.fullPathVisualization(mapValue).get());
-        }else {
-            return failed("-1");
-        }
+//        }else {
+//            return failed("-1");
+//        }
 
     }
 
@@ -562,4 +562,14 @@ public class OffSiteTransportationController extends BaseRESTfulController {
         PageListAdd pageList = columnDataUtil.tableColumnData(apiId, filter,list);
         return success(pageList);
     }
+
+    @GetMapping("/getLocationForAddress")
+    public RESTfulResult getAddress(@RequestParam("address") String address) {
+        try{
+            return success(routeService.getLocationForAddress(address));
+        }catch (Exception e){
+            e.printStackTrace();
+            return failed("没有查询到地址!请检查输入");
+        }
+    }
 }

+ 4 - 0
src/main/java/com/steerinfo/route/mapper/TmstruckReceiptResultChildMapper.java

@@ -5,9 +5,13 @@ import com.steerinfo.route.model.TmstruckReceiptResultChild;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.math.BigDecimal;
+import java.util.Map;
 
 @Mapper
 public interface TmstruckReceiptResultChildMapper extends IBaseMapper<TmstruckReceiptResultChild, BigDecimal> {
     //获取主键最大值
     BigDecimal selectMaxId();
+
+    //查询收货地址等信息
+    Map<String,Object> getAddress(Map<String,Object> map);
 }

+ 3 - 0
src/main/java/com/steerinfo/route/service/RouteService.java

@@ -4,6 +4,7 @@ import com.steerinfo.route.vo.Map.RouteVo;
 import com.steerinfo.route.vo.currentLocation.CurrentLocation;
 import com.steerinfo.route.vo.currentLocation.CurrentLocationResult;
 
+import java.io.UnsupportedEncodingException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.CompletableFuture;
@@ -18,4 +19,6 @@ public interface RouteService {
     public CompletableFuture<RouteVo> fullPathVisualizationByCarNumber(HashMap mapValue) throws Exception;
 
     CurrentLocationResult getCurrentLocation(String capcityNumber) throws Exception;
+
+    Map<String,Object> getLocationForAddress(String address) throws UnsupportedEncodingException;
 }

+ 28 - 2
src/main/java/com/steerinfo/route/service/impl/RouteServiceImpl.java

@@ -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;
+    }
 }

+ 34 - 0
src/main/resources/com/steerinfo/route/mapper/TmstruckReceiptResultChildMapper.xml

@@ -344,4 +344,38 @@
   <select id="selectMaxId"  resultType="java.math.BigDecimal">
     select max(CHILD_ID) from TMSTRUCK_RECEIPT_RESULT_CHILD
   </select>
+    <select id="getAddress" resultType="java.util.Map">
+      SELECT distinct
+        OO.ORDER_NUMBER "orderNumber",
+        R_CARRIER.CARRIER_NAME "carrierName",
+        RCA.CAPACITY_NUMBER "capacityNumber",
+        RS.SHIPPER_NAME "shipperName",
+        RC.CONSIGNEE_COMPANY_NAME "consigneeName",
+        ASOM.SALE_ORDER_CONSIGNEE_TEL "consigneeTel",
+        RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT ||
+        RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS "addressPlace",
+        ASOM.SALE_DATE_OF_RECEIPT "deadLine",
+        OO.DRIVER_TEL "capacityTel"
+      FROM AMS_SALE_ORDER ASO
+             LEFT JOIN RMS_CONSIGNEE RC
+                       ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
+             LEFT JOIN RMS_SHIPPER RS
+                       ON RS.SHIPPER_ID = ASO.SHIPPER_ID
+             LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
+                       ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
+             LEFT JOIN RMS_RECEIVE_PLACE RRP
+                       ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
+             LEFT JOIN RMS_RECEIVE_ADDRESS RRA
+                       ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
+             LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
+                       ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
+             LEFT JOIN RMS_CARRIER R_CARRIER
+                       ON R_CARRIER.CARRIER_ID = ADSO.CARRIER_ID
+             LEFT JOIN OMSTRUCK_ORDER OO
+                       ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
+             LEFT JOIN RMS_CAPACITY RCA
+                       ON RCA.CAPACITY_ID = OO.CAPACITY_ID
+      WHERE OO.ORDER_STATUS = 5
+        AND RCA.CAPACITY_NUMBER=#{capacityNumber}
+    </select>
 </mapper>