Tiroble 3 年之前
父節點
當前提交
759f8f1c99

+ 13 - 0
src/main/java/com/steerinfo/dil/controller/OffSiteTransportationController.java

@@ -15,6 +15,7 @@ import com.steerinfo.route.threeRequest.ZhongJiaoXingLu;
 import com.steerinfo.route.util.DataConversionTool;
 import com.steerinfo.route.util.DataConversionTool;
 import com.steerinfo.route.util.HTTPRequestUtils;
 import com.steerinfo.route.util.HTTPRequestUtils;
 import com.steerinfo.route.vo.FullPathVisualizationTo.ViewVisualization;
 import com.steerinfo.route.vo.FullPathVisualizationTo.ViewVisualization;
+import com.steerinfo.route.vo.Map.RouteVo;
 import com.steerinfo.route.vo.ResultWarn;
 import com.steerinfo.route.vo.ResultWarn;
 import com.steerinfo.route.vo.resultJson.SearchPoint;
 import com.steerinfo.route.vo.resultJson.SearchPoint;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
@@ -430,4 +431,16 @@ public class OffSiteTransportationController extends BaseRESTfulController {
         PageListAdd pageList = columnDataUtil.tableColumnData(apiId,transportAbnormalInfo,transportAbnormalInfo1);
         PageListAdd pageList = columnDataUtil.tableColumnData(apiId,transportAbnormalInfo,transportAbnormalInfo1);
         return success(pageList);
         return success(pageList);
     }
     }
+    @ApiOperation(value="查询路径")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "mapValue", value = "查询条件", required = false, dataType = "HashMap")
+    })
+    @PostMapping("/fullPathVisualizationByCarNumber")
+    public RouteVo fullPathVisualizationByCarNumber(@RequestBody HashMap mapValue) throws Exception {
+
+        CompletableFuture<RouteVo> createOrder =routeService.fullPathVisualizationByCarNumber(mapValue);
+
+        return createOrder.get();
+    }
+
 }
 }

+ 10 - 0
src/main/java/com/steerinfo/dil/controller/TestController.java

@@ -4,6 +4,7 @@ import com.steerinfo.dil.service.ITmstruckLeaveFactoryResultService;
 import com.steerinfo.dil.service.impl.TmstruckMeasureCommissionServiceImpl;
 import com.steerinfo.dil.service.impl.TmstruckMeasureCommissionServiceImpl;
 import com.steerinfo.dil.util.BaseRESTfulController;
 import com.steerinfo.dil.util.BaseRESTfulController;
 import com.steerinfo.route.service.impl.RouteServiceImpl;
 import com.steerinfo.route.service.impl.RouteServiceImpl;
+import com.steerinfo.route.vo.Map.RouteVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
+import java.util.concurrent.CompletableFuture;
 
 
 @RestController
 @RestController
 public class TestController extends BaseRESTfulController {
 public class TestController extends BaseRESTfulController {
@@ -57,4 +59,12 @@ public class TestController extends BaseRESTfulController {
         return tmstruckMeasureCommissionService.addMaoMeasureCommission(map);
         return tmstruckMeasureCommissionService.addMaoMeasureCommission(map);
     }
     }
 
 
+    @PostMapping("/fullPathVisualizationByCarNumber")
+    public RouteVo fullPathVisualizationByCarNumber(@RequestBody HashMap mapValue) throws Exception {
+
+        CompletableFuture<RouteVo> createOrder =routeService.fullPathVisualizationByCarNumber(mapValue);
+
+        return createOrder.get();
+    }
+
 }
 }

+ 3 - 0
src/main/java/com/steerinfo/dil/service/OffSiteTransportationService.java

@@ -1,10 +1,12 @@
 package com.steerinfo.dil.service;
 package com.steerinfo.dil.service;
 
 
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.controller.RESTfulResult;
+import com.steerinfo.route.vo.Map.RouteVo;
 
 
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
+import java.util.concurrent.CompletableFuture;
 
 
 public interface OffSiteTransportationService {
 public interface OffSiteTransportationService {
     List<Map<String, Object>> getInTransitTransportation(Map<String, Object> mapValue);
     List<Map<String, Object>> getInTransitTransportation(Map<String, Object> mapValue);
@@ -29,4 +31,5 @@ public interface OffSiteTransportationService {
     List<Map<String, Object>> getHaveAbnormalTruckOrderInfo(Map<String, Object> mapValue);
     List<Map<String, Object>> getHaveAbnormalTruckOrderInfo(Map<String, Object> mapValue);
 
 
     List<Map<String, Object>> getTransportAbnormalInfo(Map<String, Object> mapValue);
     List<Map<String, Object>> getTransportAbnormalInfo(Map<String, Object> mapValue);
+
 }
 }

+ 4 - 0
src/main/java/com/steerinfo/dil/service/impl/OffSiteTransportationServiceImpl.java

@@ -13,6 +13,7 @@ import com.steerinfo.route.mapper.TmstruckArrivalResultMapper;
 import com.steerinfo.route.model.TmstruckReceiptResultChild;
 import com.steerinfo.route.model.TmstruckReceiptResultChild;
 import com.steerinfo.route.service.ITmstruckReceiptResultChildService;
 import com.steerinfo.route.service.ITmstruckReceiptResultChildService;
 import com.steerinfo.route.service.impl.RouteServiceImpl;
 import com.steerinfo.route.service.impl.RouteServiceImpl;
+import com.steerinfo.route.vo.Map.RouteVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -23,6 +24,8 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+
 @Service
 @Service
 public class OffSiteTransportationServiceImpl implements OffSiteTransportationService {
 public class OffSiteTransportationServiceImpl implements OffSiteTransportationService {
     @Autowired
     @Autowired
@@ -153,6 +156,7 @@ public class OffSiteTransportationServiceImpl implements OffSiteTransportationSe
         return offSiteTransportationMapper.getTransportAbnormalInfo(mapValue);
         return offSiteTransportationMapper.getTransportAbnormalInfo(mapValue);
     }
     }
 
 
+
     public synchronized int addTransportationAlarm(TmstruckAbnormalResult tmstruckAbnormalResult,String tripId) {
     public synchronized int addTransportationAlarm(TmstruckAbnormalResult tmstruckAbnormalResult,String tripId) {
         long id;
         long id;
         if(tmstruckAbnormalResultMapper.selectMaxId()==null){
         if(tmstruckAbnormalResultMapper.selectMaxId()==null){

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

@@ -13,4 +13,6 @@ public interface RouteService {
 
 
     public CompletableFuture<String> saveRequstionDate(Map mapValue) throws Exception;
     public CompletableFuture<String> saveRequstionDate(Map mapValue) throws Exception;
 
 
+    public CompletableFuture<RouteVo> fullPathVisualizationByCarNumber(HashMap mapValue) throws Exception;
+
 }
 }

+ 83 - 4
src/main/java/com/steerinfo/route/service/impl/RouteServiceImpl.java

@@ -94,7 +94,7 @@ public class RouteServiceImpl implements RouteService {
                 String searchPointJson2 = HTTPRequestUtils.sendGet("https://apis.map.qq.com/ws/geocoder/v1/", "address="+URLEncoder.encode(mapValue.get("receiveAddress").toString()==null?"长沙市":mapValue.get("receiveAddress").toString(),"utf-8")+"&key=WDTBZ-A5VKJ-UDLFI-KYJY6-WTP2S-A6B4Y");
                 String searchPointJson2 = HTTPRequestUtils.sendGet("https://apis.map.qq.com/ws/geocoder/v1/", "address="+URLEncoder.encode(mapValue.get("receiveAddress").toString()==null?"长沙市":mapValue.get("receiveAddress").toString(),"utf-8")+"&key=WDTBZ-A5VKJ-UDLFI-KYJY6-WTP2S-A6B4Y");
                 SearchPoint searchPoint2= (SearchPoint) DataConversionTool.jsonToBean(searchPointJson2, SearchPoint.class);
                 SearchPoint searchPoint2= (SearchPoint) DataConversionTool.jsonToBean(searchPointJson2, SearchPoint.class);
                 if (searchPoint2.getStatus()==0&&searchPoint2.getResult()!=null){
                 if (searchPoint2.getStatus()==0&&searchPoint2.getResult()!=null){
-                    System.out.println(searchPoint2);
+
                     if (searchPoint2.getResult().getAddress_components()!=null){
                     if (searchPoint2.getResult().getAddress_components()!=null){
                         materieldesMap.put("addressProvince",searchPoint2.getResult().getAddress_components().getProvince()==null?"湖南省":searchPoint2.getResult().getAddress_components().getProvince());
                         materieldesMap.put("addressProvince",searchPoint2.getResult().getAddress_components().getProvince()==null?"湖南省":searchPoint2.getResult().getAddress_components().getProvince());
                         materieldesMap.put("addressDistrict",searchPoint2.getResult().getAddress_components().getDistrict()==null?"开福区":searchPoint2.getResult().getAddress_components().getDistrict());
                         materieldesMap.put("addressDistrict",searchPoint2.getResult().getAddress_components().getDistrict()==null?"开福区":searchPoint2.getResult().getAddress_components().getDistrict());
@@ -500,10 +500,8 @@ public class RouteServiceImpl implements RouteService {
                         calendar2.add(Calendar.MONTH,2);
                         calendar2.add(Calendar.MONTH,2);
                         long late= calendar2.getTime().getTime();
                         long late= calendar2.getTime().getTime();
                         long save=(lateTime-agoTime)/1000;
                         long save=(lateTime-agoTime)/1000;
-                        System.out.println(redisMap);
-                        System.out.println("置60天后过期");
+
                         json = zhongJiaoXingLu.visualRoute(redisMap);
                         json = zhongJiaoXingLu.visualRoute(redisMap);
-                        System.out.println(json.length()>100?json.substring(0,100):json);
                         if (json!=null){
                         if (json!=null){
                             redisTemplate.opsForValue().set(prefixLine+":"+mapValue.get("orderNumber").toString(), json, save>0?save:3184000, TimeUnit.SECONDS);
                             redisTemplate.opsForValue().set(prefixLine+":"+mapValue.get("orderNumber").toString(), json, save>0?save:3184000, TimeUnit.SECONDS);
                         }
                         }
@@ -765,6 +763,87 @@ 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");
+        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<>();
+        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);
+        redisMap.put("vclN", mapValue.get("capacityNumber").toString());
+        redisMap.put("vco","2");
+        redisMap.put("qryBtm", mapValue.get("startTime").toString());
+        redisMap.put("qryEtm",mapValue.get("endTime").toString());
+        String json = zhongJiaoXingLu.visualRoute2(redisMap);
+
+        JSONObject jsonObject = JSONObject.parseObject(json);
+        if (json!=null&&jsonObject.get("status").toString().equals(1001+"")){
+            //初始开始链路和结束线路、开始点、结束点、当前点的集合
+            List<StartAndEndRoute> startAndEndRouteList=new ArrayList<>();
+            //一条路线,开始链路和结束线路、开始点、结束点、当前点
+            StartAndEndRoute startAndEndRoute=new StartAndEndRoute();
+
+            ViewVisualization to= (ViewVisualization) DataConversionTool.jsonToBean(json,ViewVisualization.class);
+            //初始化vo对象
+            RouteVo vo=new RouteVo();
+            //当前所在的点
+            //当前所在的点
+            if ((!StringUtils.isEmpty(to.getResult().getLat()))&& (!StringUtils.isEmpty(to.getResult().getLon()))){
+                Double[] centerpoint = LngLonUtil.gps84_To_Gcj02((Double.valueOf(to.getResult().getLat()) / 600000), (Double.valueOf(to.getResult().getLon()) / 600000));
+                //当前所在的点
+                Point currentPoint=new Point();
+                currentPoint.setLat(centerpoint[0]+"");
+                currentPoint.setLon(centerpoint[1]+"");
+                startAndEndRoute.setCurrentPoint(currentPoint);
+            }
+            //当前所在地名称
+            startAndEndRoute.setCurrentPointName(to.getResult().getAdr());
+            //初始已行驶轨迹集合
+            if (to.getResult().getRunRoute()!=null){
+                List<RunRoutePoint> routes =new ArrayList();
+                List<Double[]> routesPath =new ArrayList();
+                for(RunRoutePoint item : to.getResult().getRunRoute()){
+                    RunRoutePoint runRoutePoint=item;
+                    //将已行驶轨迹转义数据格式
+                    Double[] points = LngLonUtil.gps84_To_Gcj02((Double.valueOf(item.getLat()) / 600000), (Double.valueOf(item.getLon()) / 600000));
+                    routesPath.add(new Double[]{points[1],points[0]});
+                    //经纬度
+                    runRoutePoint.setLat(points[0]+"");
+                    runRoutePoint.setLon(points[1]+"");
+                    //坐标点
+                    routes.add(runRoutePoint);
+                }
+                //初始化起始点,已经经过路段的第一个点
+                Point startPoint=new Point();
+                startPoint.setLat(routes.get(0).getLat());
+                startPoint.setLon(routes.get(0).getLon());
+                startAndEndRoute.setStartPoint(startPoint);
+                //点集合
+                startAndEndRoute.setRunPath(routesPath);
+                //已经完成路线点集合
+                startAndEndRoute.setRunRoute(routes);
+            }
+            //当前所行驶历程数
+            String mil=to.getResult().getRunDistance()+"km";
+            startAndEndRoute.setMiled(mil);
+            startAndEndRouteList.add(startAndEndRoute);
+            vo.setStartAndEndRoutes(startAndEndRouteList);
+            //
+            //设置返回值对象
+            return CompletableFuture.completedFuture(vo) ;
+        }else {
+            return  CompletableFuture.completedFuture(new RouteVo());
+        }
+
+    }
 
 
 
 
 }
 }

+ 1 - 4
src/main/java/com/steerinfo/route/threeRequest/ZhongJiaoXingLu.java

@@ -100,13 +100,10 @@ public class ZhongJiaoXingLu {
             map.put("vclN", routeMap.get("vclN").toString());
             map.put("vclN", routeMap.get("vclN").toString());
             map.put("vco",routeMap.get("vco").toString());
             map.put("vco",routeMap.get("vco").toString());
             map.put("qryBtm", routeMap.get("qryBtm").toString());
             map.put("qryBtm", routeMap.get("qryBtm").toString());
-            //2021-12-22 12:45:07
-            SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd 23:59:59");
-            map.put("qryEtm", simpleDateFormat.format(new Date()));
+            map.put("qryEtm", routeMap.get("qryEtm").toString());
 
 
             //routeMap.get("qryEtm").toString()
             //routeMap.get("qryEtm").toString()
             map.put("timeNearby", "30");
             map.put("timeNearby", "30");
-            System.out.println(map);
             String url = "https://openapi.sinoiov.cn/save/apis/visualRoute";
             String url = "https://openapi.sinoiov.cn/save/apis/visualRoute";
             DataExchangeService des = new DataExchangeService(5000, 8000);
             DataExchangeService des = new DataExchangeService(5000, 8000);