Browse Source

合并冲突

txf 3 years ago
parent
commit
854fd1a70f
33 changed files with 2152 additions and 3 deletions
  1. 23 0
      pom.xml
  2. 35 0
      src/main/java/com/steerinfo/dil/config/AsyncConfiguration.java
  3. 46 0
      src/main/java/com/steerinfo/dil/config/RedisConfiguration.java
  4. 45 0
      src/main/java/com/steerinfo/dil/controller/TestController.java
  5. 9 2
      src/main/java/com/steerinfo/dil/controller/TmstruckLeaveFactoryResultController.java
  6. 3 0
      src/main/java/com/steerinfo/dil/feign/OmsFeign.java
  7. 3 0
      src/main/java/com/steerinfo/dil/mapper/TmstruckLeaveFactoryResultMapper.java
  8. 2 0
      src/main/java/com/steerinfo/dil/service/ITmstruckLeaveFactoryResultService.java
  9. 4 0
      src/main/java/com/steerinfo/dil/service/impl/TmstruckLeaveFactoryResultServiceImpl.java
  10. 2 0
      src/main/java/com/steerinfo/dil/service/impl/TmstruckReturnResultServiceImpl.java
  11. 56 0
      src/main/java/com/steerinfo/route/config/KeyExpiredListener.java
  12. 63 0
      src/main/java/com/steerinfo/route/controller/ZhongJiaoXingLuContoller.java
  13. 14 0
      src/main/java/com/steerinfo/route/service/RouteService.java
  14. 286 0
      src/main/java/com/steerinfo/route/service/impl/RouteServiceImpl.java
  15. 268 0
      src/main/java/com/steerinfo/route/threeRequest/ZhongJiaoXingLu.java
  16. 220 0
      src/main/java/com/steerinfo/route/util/DataConversionTool.java
  17. 136 0
      src/main/java/com/steerinfo/route/util/HTTPRequestUtils.java
  18. 157 0
      src/main/java/com/steerinfo/route/util/LngLonUtil.java
  19. 153 0
      src/main/java/com/steerinfo/route/vo/FullPathVisualizationTo/Result.java
  20. 70 0
      src/main/java/com/steerinfo/route/vo/FullPathVisualizationTo/RunRoute.java
  21. 30 0
      src/main/java/com/steerinfo/route/vo/FullPathVisualizationTo/ViewVisualization.java
  22. 40 0
      src/main/java/com/steerinfo/route/vo/Map/Point.java
  23. 26 0
      src/main/java/com/steerinfo/route/vo/Map/RouteVo.java
  24. 112 0
      src/main/java/com/steerinfo/route/vo/Map/StartAndEndRoute.java
  25. 18 0
      src/main/java/com/steerinfo/route/vo/ResultWarn.java
  26. 22 0
      src/main/java/com/steerinfo/route/vo/resultJson/Ad_info.java
  27. 54 0
      src/main/java/com/steerinfo/route/vo/resultJson/Address_components.java
  28. 32 0
      src/main/java/com/steerinfo/route/vo/resultJson/Location.java
  29. 80 0
      src/main/java/com/steerinfo/route/vo/resultJson/Result.java
  30. 38 0
      src/main/java/com/steerinfo/route/vo/resultJson/SearchPoint.java
  31. 10 0
      src/main/resources/application-dev.yml
  32. 32 1
      src/main/resources/bootstrap.yml
  33. 63 0
      src/main/resources/com/steerinfo/dil/mapper/TmstruckLeaveFactoryResultMapper.xml

+ 23 - 0
pom.xml

@@ -48,6 +48,29 @@
     </distributionManagement>
 
     <dependencies>
+        <!--minio-->
+        <dependency>
+            <groupId>io.minio</groupId>
+            <artifactId>minio</artifactId>
+            <version>8.2.1</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.squareup.okhttp3</groupId>
+                    <artifactId>okhttp</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!--Redis-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <!--中交新路的包这个问杨-->
+        <dependency>
+            <groupId>com.ZhongJiaoXingLu</groupId>
+            <artifactId>openapi-sdk</artifactId>
+            <version>6.0</version>
+        </dependency>
         <!--websocket-->
         <dependency>
             <groupId>org.springframework.boot</groupId>

+ 35 - 0
src/main/java/com/steerinfo/dil/config/AsyncConfiguration.java

@@ -0,0 +1,35 @@
+package com.steerinfo.dil.config;
+
+import io.swagger.annotations.Api;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.ThreadPoolExecutor;
+
+@Configuration
+@EnableAsync
+@Api("多线程配置")
+public class AsyncConfiguration {
+    @Bean("doSomethingExecutor")
+    public Executor doSomeThingExecutor(){
+        ThreadPoolTaskExecutor executor=new ThreadPoolTaskExecutor();
+        //创建时候线程数量
+        executor.setCorePoolSize(10);
+        //最大时候的线程数量
+        executor.setMaxPoolSize(20);
+        //缓冲队列:用来缓冲执行任务的队列
+        executor.setQueueCapacity(500);
+        //允许线程空闲时间
+        executor.setKeepAliveSeconds(60);
+        //线程池前缀
+        executor.setThreadNamePrefix("do-something-");
+        //缓冲队列满了之后的拒绝策略
+        // 缓冲队列满了之后的拒绝策略:由调用线程处理(一般是主线程)
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy());
+        executor.initialize();
+        return executor;
+    }
+}

+ 46 - 0
src/main/java/com/steerinfo/dil/config/RedisConfiguration.java

@@ -0,0 +1,46 @@
+package com.steerinfo.dil.config;
+
+
+import com.steerinfo.route.config.KeyExpiredListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.listener.RedisMessageListenerContainer;
+import org.springframework.data.redis.serializer.RedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+/**
+ * @program: SpringCloud * @description: redis配置类 * @author: zhang yi * @create: 2020-03-24 14:17
+ */
+@Configuration
+public class RedisConfiguration {
+    @Autowired
+    private RedisConnectionFactory redisConnectionFactory;
+
+    @Autowired
+    private RedisTemplate redisTemplate;
+
+    @Bean
+    public RedisTemplate<String, Object> stringSerializerRedisTemplate() {
+        RedisSerializer<String> stringSerializer = new StringRedisSerializer();
+        redisTemplate.setKeySerializer(stringSerializer);
+        redisTemplate.setValueSerializer(stringSerializer);
+        redisTemplate.setHashKeySerializer(stringSerializer);
+        redisTemplate.setHashValueSerializer(stringSerializer);
+        return redisTemplate;
+    }
+
+    @Bean
+    public RedisMessageListenerContainer redisMessageListenerContainer() {
+        RedisMessageListenerContainer redisMessageListenerContainer = new RedisMessageListenerContainer();
+        redisMessageListenerContainer.setConnectionFactory(redisConnectionFactory);
+        return redisMessageListenerContainer;
+    }
+
+    @Bean
+    public KeyExpiredListener keyExpiredListener() {
+        return new KeyExpiredListener(this.redisMessageListenerContainer());
+    }
+}

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

@@ -0,0 +1,45 @@
+package com.steerinfo.dil.controller;
+
+import com.steerinfo.dil.service.ITmstruckLeaveFactoryResultService;
+import com.steerinfo.dil.util.BaseRESTfulController;
+import com.steerinfo.route.service.impl.RouteServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@RestController
+public class TestController extends BaseRESTfulController {
+
+    @Autowired
+    private RouteServiceImpl routeService;
+    @Autowired
+    private ITmstruckLeaveFactoryResultService tmstruckLeaveFactoryResultService;
+    @PostMapping("/savePath")
+    public String savePath() throws Exception {
+
+        Map<String, Object> parem=tmstruckLeaveFactoryResultService.getTruckFactoryResult("WYSDD2021091000000002");
+        parem.put("turnOf","0");
+        //运输订单号:orderNumber、车牌号:capacityNumber、出厂时间:resultOutGateTime、预警开关:turnOf、发货地址:shipperName、收货地址:receiveAddress
+        //初始化请求参数
+//        HashMap<String,Object> mapValue=new HashMap<>();
+//        mapValue.put("orderNumber","WYSDD2021091000000001");
+//        mapValue.put("capacityNumber","豫SB6238");
+//        mapValue.put("resultOutGateTime","2021-11-17 14:20:19");
+//        mapValue.put("turnOf","0");
+//        mapValue.put("shipperName","四川达州钢铁集团有限");
+//        mapValue.put("receiveAddress","长沙市");
+        return routeService.saveRoute(parem).toString();
+    }
+    @PostMapping("/fullPath")
+    public Object fullPath(String orderNumber) throws Exception {
+        //运输订单号:orderNumber、车牌号:capacityNumber、出厂时间:resultOutGateTime、预警开关:turnOf、发货地址:shipperName、收货地址:receiveAddress
+        //初始化请求参数
+        HashMap<String,Object> mapValue=new HashMap<>();
+        mapValue.put("orderNumber",orderNumber);
+        return routeService.fullPathVisualization(mapValue);
+    }
+}

+ 9 - 2
src/main/java/com/steerinfo/dil/controller/TmstruckLeaveFactoryResultController.java

@@ -8,6 +8,7 @@ import com.steerinfo.dil.util.ColumnDataUtil;
 import com.steerinfo.dil.util.PageListAdd;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageHelper;
+import com.steerinfo.route.service.impl.RouteServiceImpl;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
@@ -40,7 +41,8 @@ public class TmstruckLeaveFactoryResultController extends BaseRESTfulController
 
     @Autowired
     ITmstruckLeaveFactoryResultService tmstruckLeaveFactoryResultService;
-
+    @Autowired
+    private RouteServiceImpl routeService;
     @Autowired
     ESFeign esFeign;
 
@@ -111,15 +113,20 @@ public class TmstruckLeaveFactoryResultController extends BaseRESTfulController
             @ApiImplicitParam(name = "orderNumber", value = "", required = false, dataType = "String"),
     })
     @PostMapping("/addLeaveFactoryResult")
-    public RESTfulResult addLeaveFactoryResult(@RequestBody(required=false) Map<String,Object> mapValue){
+    public RESTfulResult addLeaveFactoryResult(@RequestBody(required=false) Map<String,Object> mapValue) throws Exception {
         String nu=mapValue.get("orderNumber").toString();
         //执行查询语句找出运输类型进行判断,是否为出厂 4 已完成计皮
         Integer i = tmstruckLeaveFactoryResultService.selectTransportRoute(nu);
+       //中交新路接口
+        Map<String, Object> parem=tmstruckLeaveFactoryResultService.getTruckFactoryResult("WYSDD2021091000000002");
+        parem.put("turnOf","0");
+        routeService.saveRoute(parem);
 //        if (i == 4) {
             int leaveFactory=tmstruckLeaveFactoryResultService.leaveFactoryByPDA(mapValue);
             return  success(leaveFactory);
 //        }else
 //            return  failed();
+
     }
 
 }

+ 3 - 0
src/main/java/com/steerinfo/dil/feign/OmsFeign.java

@@ -19,6 +19,9 @@ public interface OmsFeign {
     @PostMapping("api/v1/oms/utilscontroller/insertSelectiveOrder")
     RESTfulResult insertSelectiveOrder(@RequestBody(required = false) Map<String, Object> omstruckOrder);
 
+    @PostMapping("api/v1/oms/utilscontroller/updateOmsTruckOrder")
+    RESTfulResult updateOmsTruckOrder(@RequestBody(required = false) Map<String,Object> omstruckOrder1);
+
     //远程调用新增运输订单子表
     @PostMapping("api/v1/oms/utilscontroller/insertSelectiveOrderMaterial")
     RESTfulResult insertSelectiveOrderMaterial(@RequestBody(required = false) Map<String, Object> omstruckOrderMaterial);

+ 3 - 0
src/main/java/com/steerinfo/dil/mapper/TmstruckLeaveFactoryResultMapper.java

@@ -32,4 +32,7 @@ public interface TmstruckLeaveFactoryResultMapper extends IBaseMapper<TmstruckLe
 
     //通过总实绩Id
     BigDecimal getResultIdByTotalId(Integer resultTotalId);
+
+    Map<String, Object> getTruckFactoryResult(String nu);
+
 }

+ 2 - 0
src/main/java/com/steerinfo/dil/service/ITmstruckLeaveFactoryResultService.java

@@ -33,4 +33,6 @@ public interface ITmstruckLeaveFactoryResultService {
 
     //新增进厂实绩 派单时新增
     int addLeaveFactory(Map<String,Object> mapValue);
+
+    Map<String, Object> getTruckFactoryResult(String nu);
 }

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

@@ -79,6 +79,10 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
         return tmstruckLeaveFactoryResultMapper.insertSelective(tmstruckLeaveFactoryResult);
     }
 
+    @Override
+    public Map<String, Object> getTruckFactoryResult(String nu) {
+        return tmstruckLeaveFactoryResultMapper.getTruckFactoryResult(nu);
+    }
 
 
     /**

+ 2 - 0
src/main/java/com/steerinfo/dil/service/impl/TmstruckReturnResultServiceImpl.java

@@ -77,6 +77,8 @@ public class TmstruckReturnResultServiceImpl implements ITmstruckReturnResultSer
         map.putAll(tmstruckReturnResultMapper.getResultTotalIdByOrderNumber((String) map.get("orderNumber")));
         tmstruckReturnResult.setResultTotalId(DataChange.dataToBigDecimal(map.get("resultTotalId")));
         BigDecimal orderId = DataChange.dataToBigDecimal(map.get("orderId"));
+        //调用更新退货实绩接口
+        omsFeign.updateOmsTruckOrder(map);
         //设置首次新增时的常规字段
         addRegularField(tmstruckReturnResult);
         //新增退货实绩

+ 56 - 0
src/main/java/com/steerinfo/route/config/KeyExpiredListener.java

@@ -0,0 +1,56 @@
+package com.steerinfo.route.config;
+
+import com.alibaba.fastjson.JSON;
+import com.steerinfo.route.threeRequest.ZhongJiaoXingLu;
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.redis.connection.Message;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
+import org.springframework.data.redis.listener.RedisMessageListenerContainer;
+
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.concurrent.TimeUnit;
+
+@Api("redis过期的监听")
+public class KeyExpiredListener extends KeyExpirationEventMessageListener
+{
+    @Value("${redis.prefix.order}")
+    private String prefixOrder;
+    @Value("${redis.prefix.line}")
+    private String prefixLine;
+    @Value("${redis.prefix.suffix}")
+    private String suffix;
+    @Autowired
+    private RedisTemplate redisTemplate;
+    @Autowired
+    private ZhongJiaoXingLu zhongJiaoXingLu;
+    public KeyExpiredListener(RedisMessageListenerContainer listenerContainer)
+    {
+        super(listenerContainer);
+    }
+    @Override
+    public void onMessage(Message message, byte[] pattern)
+    {
+        //当订单快超过三天,这边就要对路径进行保存了
+        if (message.toString().startsWith(prefixOrder)){
+            String redisJson = (String) redisTemplate.opsForValue().get(message.toString()+suffix);
+            redisTemplate.delete(message.toString()+suffix);
+            HashMap mapValue = JSON.parseObject(redisJson, HashMap.class);
+            String json = zhongJiaoXingLu.visualRoute(mapValue);
+            //设置60天后过期
+            Calendar calendar= Calendar.getInstance();
+            long agoTime= calendar.getTime().getTime();
+            calendar.add(Calendar.MONTH,2);
+            long lateTime= calendar.getTime().getTime();
+            long saveTime=(lateTime-agoTime)/1000;
+            String orderId=message.toString().replace(prefixOrder+":","");
+            if (json!=null){
+                redisTemplate.opsForValue().set(prefixLine+":"+orderId, json, saveTime, TimeUnit.SECONDS);
+            }
+
+        }
+    }
+}

+ 63 - 0
src/main/java/com/steerinfo/route/controller/ZhongJiaoXingLuContoller.java

@@ -0,0 +1,63 @@
+package com.steerinfo.route.controller;
+
+//import com.steerinfo.route.feign.TMSFeign;
+import com.steerinfo.route.threeRequest.ZhongJiaoXingLu;
+import com.steerinfo.route.util.DataConversionTool;
+import com.steerinfo.route.vo.ResultWarn;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+@RestController
+@RequestMapping("apis")
+public class ZhongJiaoXingLuContoller {
+
+//    偏离预警回调示例:https://xxxx.xxxx.xxx/apis/abnormalLineWarn
+//    停车预警回调示例:https:// xxxx.xxxx.xxx/apis/parkWarn
+//    离线预警回调示例:https:// xxxx.xxxx.xxx/apis/offLineWarn
+    @Autowired
+    private ZhongJiaoXingLu zhongJiaoXingLu;
+
+    //TMSFeign tmsFeign;
+   // @PostMapping("/recordInfo")
+//    public String startTransit(String data) throws Exception {
+//
+//        HashMap<String,Object> mapValue= (HashMap<String, Object>) JSON.parse(data);
+//        //System.out.println(mapValue);
+//        omsFeign.addOmstruckOrder(mapValue);
+//        return "success";
+//    }
+    @PostMapping("/abnormalLineWarn")
+    public String abnormalLineWarn(@RequestParam(value = "data") String data) throws Exception {
+        System.out.println("abnormalLineWarn");
+        ResultWarn resultWarn= (ResultWarn) DataConversionTool.jsonToBean(data, ResultWarn.class);
+        Map<String, Object> map=  DataConversionTool.objectToMap(resultWarn);
+        //tmsFeign.addTransportationAlarm(map);
+        System.out.println("success");
+        return "success";
+    }
+    @PostMapping("/parkWarn")
+    public String parkWarn(@RequestParam(value = "data") String data) throws Exception {
+        System.out.println("parkWarn");
+        ResultWarn resultWarn= (ResultWarn) DataConversionTool.jsonToBean(data, ResultWarn.class);
+        Map<String, Object> map=  DataConversionTool.objectToMap(resultWarn);
+       // tmsFeign.addTransportationAlarm(map);
+        System.out.println("success");
+        return "success";
+    }
+    @PostMapping("/offLineWarn")
+    public String offLineWarn(@RequestParam(value = "data") String data) throws Exception {
+        System.out.println("offLineWarn");
+        ResultWarn resultWarn= (ResultWarn) DataConversionTool.jsonToBean(data, ResultWarn.class);
+        Map<String, Object> map=  DataConversionTool.objectToMap(resultWarn);
+        //tmsFeign.addTransportationAlarm(map);
+        System.out.println("success");
+        return "success";
+    }
+
+
+}

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

@@ -0,0 +1,14 @@
+package com.steerinfo.route.service;
+
+import com.steerinfo.route.vo.Map.RouteVo;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+
+public interface RouteService {
+    CompletableFuture<String> saveRoute(Map mapValue) throws Exception;
+
+    CompletableFuture<RouteVo> fullPathVisualization(HashMap mapValue) throws Exception;
+
+}

+ 286 - 0
src/main/java/com/steerinfo/route/service/impl/RouteServiceImpl.java

@@ -0,0 +1,286 @@
+package com.steerinfo.route.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+
+import com.steerinfo.framework.controller.RESTfulResult;
+import com.steerinfo.route.service.RouteService;
+import com.steerinfo.route.threeRequest.ZhongJiaoXingLu;
+import com.steerinfo.route.util.DataConversionTool;
+import com.steerinfo.route.util.HTTPRequestUtils;
+import com.steerinfo.route.util.LngLonUtil;
+import com.steerinfo.route.vo.FullPathVisualizationTo.ViewVisualization;
+import com.steerinfo.route.vo.Map.Point;
+import com.steerinfo.route.vo.Map.RouteVo;
+import com.steerinfo.route.vo.Map.StartAndEndRoute;
+import com.steerinfo.route.vo.resultJson.SearchPoint;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+@Service(value = "xmsService")
+public class RouteServiceImpl implements RouteService {
+    @Autowired
+    private RedisTemplate redisTemplate;
+    @Autowired
+    private ZhongJiaoXingLu zhongJiaoXingLu;
+    @Value("${str.tengxun.key}")
+    private String key;
+    @Value("${redis.prefix.order}")
+    private String prefixOrder;
+    @Value("${redis.prefix.line}")
+    private String prefixLine;
+    @Value("${redis.prefix.suffix}")
+    private String suffix;
+
+    /**
+     * 必须参数 运输订单号:orderNumber、车牌号:capacityNumber、出厂时间:resultOutGateTime、预警开关:turnOf、发货地址:shipperName、收货地址:receiveAddress
+     * @param mapValue
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public CompletableFuture<String> saveRoute(Map mapValue) throws Exception {
+
+            //获得起点的经纬度和code
+           SimpleDateFormat dateFormat =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+           Date gateTime = dateFormat.parse(mapValue.get("resultOutGateTime").toString());
+           String searchPointJson = HTTPRequestUtils.sendGet("https://apis.map.qq.com/ws/geocoder/v1/", "address="+ URLEncoder.encode(mapValue.get("shipperName").toString()==null?"四川省达州钢铁集团有限责任公司":mapValue.get("shipperName").toString(),"utf-8")+"&key="+key);
+           SearchPoint searchPoint= (SearchPoint) DataConversionTool.jsonToBean(searchPointJson, SearchPoint.class);
+
+           //创建收货地址    addressProvince 省份、addressDistrict 市区、addressTown 县镇 、addressDeliveryAddress 收货地址、 addressLongitude 收货地址经度、addressLatitude 收货地址纬度
+           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="+key);
+           SearchPoint searchPoint2= (SearchPoint) DataConversionTool.jsonToBean(searchPointJson2, SearchPoint.class);
+
+           //入网验证
+           String netValidationResult = zhongJiaoXingLu.netValidation(mapValue.get("capacityNumber").toString());
+           Map netValidationMap = (Map) JSONObject.parse(netValidationResult);
+           if (Integer.parseInt(netValidationMap.get("status").toString())==1001&&netValidationMap.get("result").toString().equals("yes")){
+
+               //运单生成之后保存
+               HashMap<String, String> redisMap=new HashMap<>();
+               redisMap.put("startLonlat", searchPoint.getResult().getLocation().getLng().toString().substring(0,9)+","+searchPoint.getResult().getLocation().getLat().toString().substring(0,8));
+               redisMap.put("endLonlat", searchPoint2.getResult().getLocation().getLng().toString().substring(0,9)+","+searchPoint2.getResult().getLocation().getLat().toString().substring(0,8));
+               redisMap.put("vclN", mapValue.get("capacityNumber").toString());
+               redisMap.put("vco","2");
+               SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:ss:mm");
+               String qryBtm=mapValue.get("resultOutGateTime").toString();
+
+               //获得两天、23小时、45分钟之后的时间
+               Date parse = simpleDateFormat.parse(qryBtm);
+               //时间添加
+               Calendar calendar = Calendar.getInstance();
+               calendar.setTime(parse);
+               calendar.add(Calendar.DAY_OF_MONTH, 2);
+               calendar.add(Calendar.HOUR_OF_DAY, 23);
+               calendar.add(Calendar.SECOND, 45);
+               //计算时间差
+               long agetime = parse.getTime();
+               long lateTime = calendar.getTimeInMillis();
+               //两天、23小时、45分钟之后的时间差毫秒
+               long reductionTime1=lateTime-agetime;
+               long currentTime = new Date().getTime();
+               //减去已经过的时间(毫秒)
+               long reductionTime2=currentTime-agetime;
+
+               //redis 存储的时间(秒)
+               long saveTime=(reductionTime1-reductionTime2)/1000;
+               redisMap.put("qryBtm", simpleDateFormat.format(simpleDateFormat.parse(qryBtm)));
+               String qryEtm= simpleDateFormat.format(calendar.getTime());
+               redisMap.put("qryEtm",qryEtm );
+               String orderUrl=prefixOrder+":"+mapValue.get("orderNumber").toString();
+               String redisJson= JSON.toJSONString(redisMap);
+               //保存请求中交的参数
+               redisTemplate.opsForValue().set(orderUrl, redisJson, saveTime, TimeUnit.SECONDS);
+               redisTemplate.opsForValue().set(orderUrl+suffix, redisJson);
+               //预警开关判断0开启1关闭
+               if(mapValue.get("turnOf").toString().equals("0")){
+
+                   redisMap.put("startCode",searchPoint.getResult().getAd_info().getAdcode());
+                   redisMap.put("destCode",searchPoint2.getResult().getAd_info().getAdcode());
+                   redisMap.put("qryBtm",parse.toString());
+                   redisMap.put("qryEtm",calendar.getTime().toString());
+                   String subAbnormalLineWarnV2Json = zhongJiaoXingLu.subAbnormalLineWarnV2(redisMap);
+
+                   JSONObject jsonObject = JSONObject.parseObject(subAbnormalLineWarnV2Json);
+
+
+                   if (jsonObject!=null&&jsonObject.get("status").toString().equals(1001+"")) {
+                       HashMap<String, Object> tripMap = new HashMap();
+                       tripMap.put("orderNumber", mapValue.get("orderNumber").toString());
+                       tripMap.put("rid", jsonObject.get("result").toString());
+                       //omsFeign.insertOrderTripId(tripMap);
+                   }
+           }
+           return  CompletableFuture.completedFuture("successful");
+       }
+        return CompletableFuture.completedFuture("fail");
+    }
+
+    /**
+     * 必须参数 orderNumber 运输订单号
+     * 获得运输全路径
+     * @param mapValue
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public CompletableFuture<RouteVo> fullPathVisualization(HashMap mapValue) throws Exception {
+
+        //获得saveRoute()保存在redis请求中交的查询
+        String redisJson = (String) redisTemplate.opsForValue().get(prefixOrder + ":" + mapValue.get("orderNumber"));
+
+        HashMap routeMap = JSON.parseObject(redisJson, HashMap.class);
+        String json="";
+        //判断请求参数是否为空
+        if (routeMap!=null)
+        {
+            //获得路径
+            json =zhongJiaoXingLu.visualRoute(routeMap);
+        //可能中交请求参数已经过期、已经成了路线、可以直接获取路径
+        }else{
+
+            json  = (String) redisTemplate.opsForValue().get(prefixLine + ":" + mapValue.get("orderNumber"));
+            //当redis获取不到参数的备选方案从数据库获取
+            if (json==null){
+                HashMap<String, Object> hashMap=new HashMap();
+                hashMap.put("orderNumber",mapValue.get("orderNumber"));
+                //从数据库获取参数
+                RESTfulResult startAndEndCapacityNumber =null; //tmsFeign.getStartAndEndCapacityNumber(hashMap);
+                HashMap<String, Object> resultMap= (HashMap<String, Object>) startAndEndCapacityNumber.getData();
+                //入网验证
+                String netValidationResult = zhongJiaoXingLu.netValidation(resultMap.get("capacityNumber").toString());
+                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(resultMap.get("shipperName").toString(),"utf-8")+"&key="+key);
+                    SearchPoint searchPoint= (SearchPoint) DataConversionTool.jsonToBean(searchPointJson, SearchPoint.class);
+                    String searchPointJson2 = HTTPRequestUtils.sendGet("https://apis.map.qq.com/ws/geocoder/v1/", "address="+ URLEncoder.encode(resultMap.get("addressDeliveryAddress").toString(),"utf-8")+"&key="+key);
+                    SearchPoint searchPoint2= (SearchPoint) DataConversionTool.jsonToBean(searchPointJson2, SearchPoint.class);
+                    //运单生成之后保存
+                    HashMap<String, String> redisMap=new HashMap<>();
+                    redisMap.put("startLonlat", searchPoint.getResult().getLocation().getLng().toString().substring(0,9)+","+searchPoint.getResult().getLocation().getLat().toString().substring(0,8));
+                    redisMap.put("endLonlat", searchPoint2.getResult().getLocation().getLng().toString().substring(0,9)+","+searchPoint2.getResult().getLocation().getLat().toString().substring(0,8));
+                    redisMap.put("vclN", resultMap.get("capacityNumber").toString());
+                    redisMap.put("vco","2");
+                    SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:ss:mm");
+                    String qryBtm=resultMap.get("resultOutGateTime").toString();
+
+                    //获得两天、23小时、45分钟之后的时间
+                    Date parse = simpleDateFormat.parse(qryBtm);
+                    //时间添加
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(parse);
+                    calendar.add(Calendar.DAY_OF_MONTH, 2);
+                    calendar.add(Calendar.HOUR_OF_DAY, 23);
+                    calendar.add(Calendar.SECOND, 45);
+                    //计算时间差
+                    long agetime = parse.getTime();
+                    long lateTime = calendar.getTimeInMillis();
+                    //两天、23小时、45分钟之后的时间差毫秒
+                    long reductionTime1=lateTime-agetime;
+                    long currentTime = new Date().getTime();
+                    //减去已经过的时间(毫秒)
+                    long reductionTime2=currentTime-agetime;
+
+                    //redis 存储的时间(秒)
+                    long saveTime=(reductionTime1-reductionTime2)/1000;
+                    redisMap.put("qryBtm", simpleDateFormat.format(simpleDateFormat.parse(qryBtm)));
+                    String qryEtm= simpleDateFormat.format(calendar.getTime());
+                    redisMap.put("qryEtm",qryEtm );
+                    if (saveTime>1800){
+                        String orderUrl=prefixOrder+":"+mapValue.get("orderNumber").toString();
+
+                        String redisStr= JSON.toJSONString(redisMap);
+                        redisTemplate.opsForValue().set(orderUrl, redisStr, saveTime, TimeUnit.SECONDS);
+
+                    }else {
+
+                        //设置60天后过期
+                        Calendar calendar2= Calendar.getInstance();
+                        long agoTime= calendar2.getTime().getTime();
+                        calendar2.add(Calendar.MONTH,2);
+                        long late= calendar2.getTime().getTime();
+                        long save=(lateTime-agoTime)/1000;
+
+                        json = zhongJiaoXingLu.visualRoute(redisMap);
+                        redisTemplate.opsForValue().set(prefixLine+":"+mapValue.get("orderNumber").toString(), json, save, TimeUnit.SECONDS);
+                    }
+
+                }
+            }
+        }
+        //获得路线之后封装成路线对象
+        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<Point> routes = to.getResult().getRunRoute().stream().map(item->{
+                    Point er=new Point();
+                    double[] points = LngLonUtil.gps84_To_Gcj02((Double.valueOf(item.getLat()) / 600000), (Double.valueOf(item.getLon()) / 600000));
+                    er.setLat(points[0]+"");
+                    er.setLon(points[1]+"");
+                    return  er;
+                }).collect(Collectors.toList());
+                //初始化起始点,已经经过路段的第一个点
+                startAndEndRoute.setStartPoint(routes.get(0));
+                //已经完成路线点集合
+                startAndEndRoute.setRunRoute(routes);
+            }
+            //预估轨迹
+            if (to.getResult().getEstimateRoute()!=null){
+                List<Point> estimateRoute= to.getResult().getEstimateRoute().stream().map(item->{
+                    Point er=new Point();
+                    double[] points = LngLonUtil.gps84_To_Gcj02((Double.valueOf(item.getLat()) / 600000), (Double.valueOf(item.getLon()) / 600000));
+                    er.setLat(points[0]+"");
+                    er.setLon(points[1]+"");
+                    return  er;
+                }).collect(Collectors.toList());
+                //结束点
+                startAndEndRoute.setEndPoint(estimateRoute.get(estimateRoute.size()-1));
+                //预估轨迹赋值
+                startAndEndRoute.setEstimateRoute(estimateRoute);
+            }
+            //当前所行驶历程数
+            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());
+        }
+
+    }
+
+}

+ 268 - 0
src/main/java/com/steerinfo/route/threeRequest/ZhongJiaoXingLu.java

@@ -0,0 +1,268 @@
+package com.steerinfo.route.threeRequest;
+
+import com.alibaba.fastjson.JSONObject;
+import com.openapi.sdk.service.DataExchangeService;
+import com.steerinfo.route.util.DataConversionTool;
+import com.steerinfo.route.util.LngLonUtil;
+import com.steerinfo.route.vo.FullPathVisualizationTo.ViewVisualization;
+import com.steerinfo.route.vo.Map.Point;
+import com.steerinfo.route.vo.Map.RouteVo;
+import com.steerinfo.route.vo.Map.StartAndEndRoute;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+
+@Component
+public class ZhongJiaoXingLu {
+
+
+    @Value("${str.ZhongJiaoXingLu.parkMins}")
+    private String parkMins;
+    @Value("${str.ZhongJiaoXingLu.abnMins}")
+    private String abnMins;
+    @Value("${str.ZhongJiaoXingLu.outMins}")
+    private String outMins;
+    @Value("${str.ZhongJiaoXingLu.type}")
+    private String type;
+    private String token="238684c3-1817-4e5e-8695-a8c85f8fd231";
+    @Value("${str.ZhongJiaoXingLu.cid}")
+    private String cid;
+    @Value("${str.ZhongJiaoXingLu.srt}")
+    private String srt;
+    @Value("${str.ZhongJiaoXingLu.user}")
+    private String user;
+    @Value("${str.ZhongJiaoXingLu.pwd}")
+    private String pwd;
+    //"238684c3-1817-4e5e-8695-a8c85f8fd231"
+    //"2667ca1f-e003-4822-b4c1-f25561c27f31"
+    //"3dbdc182-b235-4c33-be30-88c0fe8999c5"
+    public String visualRoute(HashMap routeMap) {
+        try {
+            //登陆之后返回的token:d21661ca-e0fe-4934-866a-7d78a0756bd4
+            Map<String, String> map = new HashMap<String, String>(3);
+            map.put("token", token);
+            map.put("cid", cid);
+            map.put("srt", srt);
+            map.put("startLonlat", routeMap.get("startLonlat").toString());
+            map.put("endLonlat", routeMap.get("endLonlat").toString());
+            map.put("vclN", routeMap.get("vclN").toString());
+            map.put("vco",routeMap.get("vco").toString());
+            map.put("qryBtm", routeMap.get("qryBtm").toString());
+            map.put("qryEtm", routeMap.get("qryEtm").toString());
+            map.put("timeNearby", "30");
+            String url = "https://openapi.sinoiov.cn/save/apis/visualRoute";
+            DataExchangeService des = new DataExchangeService(5000, 8000);
+
+            // 通过 https 方式调用,此方法内部会使用私钥生成签名参数 sign,私钥不会发送
+            String res = des.postHttps(url, map);
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            if (jsonObject.get("status").toString().equals(1016+"")){
+                login();
+                return visualRoute( routeMap);
+            }
+            return res;
+        } catch (Exception e) {
+            System.out.println("e:" + e.getMessage());
+        }
+        return null;
+    }
+    //String startLonlat,String endLonlat,String vclN,String vco,String qryBtm,String qryEtm
+    public String subAbnormalLineWarnV2(HashMap routeMap ) {
+        try {
+            //登陆之后返回的token:d21661ca-e0fe-4934-866a-7d78a0756bd4
+            Map<String, String> map = new HashMap<String, String>(3);
+            map.put("token", token);
+            map.put("cid", cid);
+            map.put("srt", srt);
+            map.put("vclN", routeMap.get("vclN").toString());
+            map.put("vco","2");
+            map.put("startCode", routeMap.get("startCode").toString());
+            map.put("destCode", routeMap.get("destCode").toString());
+            map.put("startCoor", routeMap.get("startLonlat").toString());
+            map.put("destCoor", routeMap.get("endLonlat").toString());
+            //把字符串转换成CST日期类型
+            map.put("stime", cstToGMT(routeMap.get("qryBtm").toString()).toString());
+            map.put("etime", cstToGMT(routeMap.get("qryEtm").toString()).toString());
+            map.put("parkMins", parkMins);
+            map.put("outMins", outMins);
+            map.put("abnMins", abnMins);
+            map.put("type", type);
+            String url = "https://openapi.sinoiov.cn/save/apis/subAbnormalLineWarnV2";
+            DataExchangeService des = new DataExchangeService(5000, 8000);
+
+            // 通过 https 方式调用,此方法内部会使用私钥生成签名参数 sign,私钥不会发送
+            System.out.println("map");
+            System.out.println(map);
+            String res = des.postHttps(url, map);
+            System.out.println("res");
+            System.out.println(res);
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            if (jsonObject.get("status").toString().equals(1016+"")){
+                login();
+                return subAbnormalLineWarnV2(routeMap);
+            }
+
+            return res;
+        } catch (Exception e) {
+            System.out.println("e:" + e.getMessage());
+        }
+        return null;
+    }
+
+    public String cstToGMT(String data) throws InterruptedException, ParseException {
+
+        SimpleDateFormat sdf1 = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
+        SimpleDateFormat sdf = new SimpleDateFormat("EEE d MMM yyyy HH:mm:ss 'GMT'", Locale.US);
+        sdf.setTimeZone(TimeZone.getTimeZone("GMT+8")); // 设置时区为GMT  +8为北京时间东八区
+        String str = String.valueOf(sdf1.parse(data).getTime()-60000);
+        return str;
+    }
+    public String netValidation(String vclN) {
+        try {
+            //登陆之后返回的token:d21661ca-e0fe-4934-866a-7d78a0756bd4
+            Map<String, String> map = new HashMap<String, String>(4);
+            map.put("token", token);
+            map.put("cid", cid);
+            map.put("srt", srt);
+            map.put("vclN", vclN);
+            String url = "https://openapi.sinoiov.cn/save/apis/checkTruckExist";
+            DataExchangeService des = new DataExchangeService(5000, 8000);
+
+            // 通过 https 方式调用,此方法内部会使用私钥生成签名参数 sign,私钥不会发送
+            String res = des.postHttps(url, map);
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            if (jsonObject.get("status").toString().equals(1016+"")){
+                login();
+                return netValidation(vclN);
+            }
+            return res;
+        } catch (Exception e) {
+            System.out.println("e:" + e.getMessage());
+        }
+        return null;
+    }
+    public  void login() {
+        try {
+            Map<String, String> map = new HashMap<String, String>(4);
+            map.put("user", user);
+            map.put("pwd", pwd);
+            map.put("cid", cid);
+            map.put("srt", srt);
+            String url = "https://openapi.sinoiov.cn/save/apis/login/";
+            DataExchangeService des = new DataExchangeService(5000, 8000);
+            // 通过 https 方式调用,此方法内部会使用私钥生成签名参数 sign,私钥不会发送
+            String res = des.postHttps(url, map);
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            this.token=jsonObject.get("result").toString();
+            //System.out.println("返回:"+ res);
+        } catch (Exception e) {
+            System.out.println("e:" + e.getMessage());
+        }
+    }
+    public CompletableFuture<RouteVo> fullPathVisualization(String json) throws Exception {
+        //初始开始链路和结束线路、开始点、结束点、当前点的集合
+        List<StartAndEndRoute> startAndEndRouteList=new ArrayList<>();
+        //一条路线,开始链路和结束线路、开始点、结束点、当前点
+        StartAndEndRoute startAndEndRoute=new StartAndEndRoute();
+        // String startLonlat,String endLonlat,String vclN,String vco,String qryBtm,String qryEtm
+//        map.put("vclN", "陕YH0009");
+//        map.put("vco","2");
+//        map.put("qryBtm", "2021-10-06 22:10:10");
+//        map.put("qryEtm", "2021-10-07 22:10:10");
+        //String json =ZhongJiaoXingLu.visualRoute("","","陕YH0009","2","2021-10-06 22:10:10","2021-10-07 22:10:10");
+        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<Point> routes = to.getResult().getRunRoute().stream().map(item->{
+                Point er=new Point();
+                double[] points = LngLonUtil.gps84_To_Gcj02((Double.valueOf(item.getLat()) / 600000), (Double.valueOf(item.getLon()) / 600000));
+                er.setLat(points[0]+"");
+                er.setLon(points[1]+"");
+                return  er;
+            }).collect(Collectors.toList());
+            //初始化起始点,已经经过路段的第一个点
+            startAndEndRoute.setStartPoint(routes.get(0));
+            //已经完成路线点集合
+            startAndEndRoute.setRunRoute(routes);
+        }
+        //预估轨迹
+        if (to.getResult().getEstimateRoute()!=null){
+            List<Point> estimateRoute= to.getResult().getEstimateRoute().stream().map(item->{
+                Point er=new Point();
+                double[] points = LngLonUtil.gps84_To_Gcj02((Double.valueOf(item.getLat()) / 600000), (Double.valueOf(item.getLon()) / 600000));
+                er.setLat(points[0]+"");
+                er.setLon(points[1]+"");
+                return  er;
+            }).collect(Collectors.toList());
+            //结束点
+            startAndEndRoute.setEndPoint(estimateRoute.get(estimateRoute.size()-1));
+            //预估轨迹赋值
+            startAndEndRoute.setEstimateRoute(estimateRoute);
+        }
+        //当前所行驶历程数
+        String mil=to.getResult().getRunRoute().get(to.getResult().getRunRoute().size()-1).getMil();
+        startAndEndRoute.setMiled(mil);
+        startAndEndRouteList.add(startAndEndRoute);
+        vo.setStartAndEndRoutes(startAndEndRouteList);
+        //
+        //设置返回值对象
+        return CompletableFuture.completedFuture(vo) ;
+    }
+
+
+
+
+
+    public String getCid() {
+        return cid;
+    }
+
+    public  void setCid(String cid) {
+        this.cid = cid;
+    }
+
+    public String getSrt() {
+        return srt;
+    }
+
+    public  void setSrt(String srt) {
+        this.srt = srt;
+    }
+
+    public String getUser() {
+        return user;
+    }
+
+    public  void setUser(String user) {
+        this.user = user;
+    }
+
+    public String getPwd() {
+        return pwd;
+    }
+
+    public  void setPwd(String pwd) {
+        this.pwd = pwd;
+    }
+
+
+}

+ 220 - 0
src/main/java/com/steerinfo/route/util/DataConversionTool.java

@@ -0,0 +1,220 @@
+package com.steerinfo.route.util;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+//@Auther Tiroble
+//@meil 2439003195@qq.com
+public class DataConversionTool {
+
+
+    /**
+     *
+     * @param json
+     * @param type
+     * @return
+     * @throws Exception
+     */
+    public static Object jsonToBean(Object json, Object type) throws Exception {
+        try{
+            JSONObject jsonObject=null;
+            //首先需要判断是否是json字符串如果是解析为jsonObject如果是JsonObject就直接赋值给jsonObject
+            if (json instanceof String){
+                //将json转为JSONOject
+                jsonObject= JSONObject.parseObject(json.toString());
+            }else {
+                jsonObject= (JSONObject) json;
+            }
+            //获得Class对象
+            //Class clazz=type.getClass().getDeclaringClass();
+            Class clazz= (Class) type;
+            //通过空参构造器创建实例
+            Constructor constructor = clazz.getDeclaredConstructor();
+            constructor.setAccessible(true);
+            Object classObject =  constructor.newInstance();
+            //获得对象的所有属性名
+            Field[] fields = clazz.getDeclaredFields();
+            //遍历属性集合
+            for (int i=0;i<fields.length;i++){
+                Field field=fields[i];
+                //开启权限
+                field.setAccessible(true);
+                //判断是否保护属性值
+                if(jsonObject.containsKey(field.getName())){
+                    Object objectValue =jsonObject.get(field.getName());
+                    //判断jsonObject的item是否是String或者Integer,是简单类型直接赋值
+                    if ((objectValue instanceof Long)||(objectValue instanceof String)||(objectValue instanceof Integer)||(objectValue instanceof Boolean)||(objectValue instanceof BigDecimal)){
+                        //进行数据判断
+                        if (field.getType()== BigDecimal.class){
+                            field.set(classObject,new BigDecimal(objectValue.toString()));
+                        } else if (field.getType()== Short.class){
+                            field.set(classObject, Short.parseShort(objectValue.toString()));
+                        }else if (field.getType()== Date.class){
+                            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                            Date time = formatter.parse(objectValue.toString());
+                            field.set(classObject,time);
+                        }
+                        else {
+                            field.set(classObject,objectValue);
+                        }
+                    }
+                    //集合类型类型
+                    else if(objectValue instanceof JSONArray){
+                        Iterator<Object> iterator = ((JSONArray) objectValue).iterator();
+                        //这里使用的是arryList接收
+                        List list=new ArrayList<>();
+                        // 如果是List类型,得到其Generic的类型
+                        Type genericType = field.getGenericType();
+                        //如果是空的
+                        if(genericType == null) {
+                            genericType= Object.class;
+                        }
+                        // 如果是泛型参数的类型
+                        else if(genericType instanceof ParameterizedType){
+                            ParameterizedType pt = (ParameterizedType) genericType;
+                            //得到泛型里的class类型对象
+                            Class<?> genericClazz = (Class<?>)pt.getActualTypeArguments()[0];
+                            genericType=genericClazz;
+                        }
+                        while (iterator.hasNext()){
+                            Object nextObject = iterator.next();
+                            Object fieldValue =  jsonToBean(nextObject, genericType);
+                            list.add(fieldValue);
+                        }
+                        field.set(classObject,list);
+                    }
+                    //如果不是再判断是否是JSONOArray,复杂数据类型
+                    else{
+                        //如果是JSONObject需要判断是否是引用类型,如果是引用类型就还需要将值转为对应类型
+                        Object fieldValue =  jsonToBean(objectValue, field.getType());
+                        field.set(classObject,fieldValue);
+                    }
+
+                }
+
+
+            }
+
+            return classObject;
+        }catch (Exception ex){
+            throw ex;
+        }
+    }
+
+    /**
+     * 将Object对象里面的属性和值转化成Map对象
+     *
+     * @param obj
+     * @return
+     * @throws IllegalAccessException
+     */
+    public static Map<String, Object> objectToMap(Object obj) throws IllegalAccessException {
+        Map<String, Object> map = new HashMap<String, Object>();
+        Class<?> clazz = obj.getClass();
+        for (Field field : clazz.getDeclaredFields()) {
+            field.setAccessible(true);
+            String fieldName = field.getName();
+            Object value = field.get(obj);
+            map.put(fieldName, value);
+        }
+        return map;
+    }
+    /**
+     *
+     * @param map
+     * @param type
+     * @return
+     * @throws Exception
+     */
+    public static Object mapToBean(Map map, Object type) throws Exception {
+
+        try{
+            //获得Class对象
+            //Class clazz=type.getClass().getDeclaringClass();
+            Class clazz= (Class) type;
+            //通过空参构造器创建实例
+            Constructor constructor = clazz.getDeclaredConstructor();
+            constructor.setAccessible(true);
+            Object classObject =  constructor.newInstance();
+            //获得对象的所有属性名
+            Field[] fields = clazz.getDeclaredFields();
+            //遍历属性集合
+            for (int i=0;i<fields.length;i++){
+                Field field=fields[i];
+                //开启权限
+                field.setAccessible(true);
+                //判断是否保护属性值
+                if(map.containsKey(field.getName())){
+                    Object objectValue =map.get(field.getName());
+                    //判断jsonObject的item是否是String或者Integer,是简单类型直接赋值
+                    if ((objectValue instanceof String)||(objectValue instanceof Integer)||(objectValue instanceof Boolean)){
+                        //进行数据判断
+                        if (field.getType()== BigDecimal.class){
+                            field.set(classObject,new BigDecimal(objectValue.toString()));
+                        } else if (field.getType()== Short.class){
+                            if(objectValue.toString()=="0.00"){
+                                field.set(classObject,0);
+                            }
+                            field.set(classObject, Short.parseShort(objectValue.toString()));
+                        }else if (field.getType()== Date.class){
+                            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                            Date time = formatter.parse(objectValue.toString());
+                            field.set(classObject,time);
+                        }
+                        else {
+                            field.set(classObject,objectValue);
+                        }
+
+                    }
+                    //集合类型类型
+                    else if(objectValue instanceof List){
+                        Iterator<Object> iterator = ((List)objectValue).iterator();
+                        //这里使用的是arryList接收
+                        List list=new ArrayList<>();
+                        // 如果是List类型,得到其Generic的类型
+                        Type genericType = field.getGenericType();
+                        //如果是空的
+                        if(genericType == null) {
+                            genericType= Object.class;
+                        }
+                        // 如果是泛型参数的类型
+                        else if(genericType instanceof ParameterizedType){
+                            ParameterizedType pt = (ParameterizedType) genericType;
+                            //得到泛型里的class类型对象
+                            Class<?> genericClazz = (Class<?>)pt.getActualTypeArguments()[0];
+                            genericType=genericClazz;
+                        }
+                        while (iterator.hasNext()){
+                            Object nextObject = iterator.next();
+                            Object fieldValue =  jsonToBean(nextObject, genericType);
+                            list.add(fieldValue);
+                        }
+                        field.set(classObject,list);
+                    }
+                    //如果不是再判断是否是JSONOArray,复杂数据类型
+                    else{
+                        //如果是JSONObject需要判断是否是引用类型,如果是引用类型就还需要将值转为对应类型
+                        Object fieldValue =  jsonToBean(objectValue, field.getType());
+                        field.set(classObject,fieldValue);
+                    }
+
+                }
+
+
+            }
+
+            return classObject;
+        }catch (Exception ex){
+            throw ex;
+        }
+
+    }
+}

+ 136 - 0
src/main/java/com/steerinfo/route/util/HTTPRequestUtils.java

@@ -0,0 +1,136 @@
+package com.steerinfo.route.util;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.List;
+import java.util.Map;
+
+public class HTTPRequestUtils {
+    /**
+     * 向指定URL发送GET方法的请求
+     * @param url:发送请求的URL
+     * @param param:请求参数,请求参数应该是 name1=value1&name2=value2&name3=value3 的形式。
+     * @return String[result]:所代表远程资源的响应结果
+     */
+    public static String sendGet(String url, String param) {
+        String result = "";
+        BufferedReader in = null;
+        try {
+            String urlNameString = url + "?" + param;
+            URL realUrl = new URL(urlNameString);
+
+            // 打开和URL之间的连接
+            URLConnection connection = realUrl.openConnection();
+
+            // 设置通用的请求属性
+            connection.setRequestProperty("accept", "*/*");
+            connection.setRequestProperty("connection", "Keep-Alive");
+            connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+
+            // 建立实际的连接
+            connection.connect();
+
+            // 获取所有响应头字段
+            Map<String, List<String>> map = connection.getHeaderFields();
+
+            // 遍历所有的响应头字段
+//            for (String key : map.keySet()) {
+//                System.out.println(key + "--->" + map.get(key));
+//            }
+
+            // 定义 BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(new InputStreamReader(
+                    connection.getInputStream(),"utf-8"));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+            System.out.println("result");
+            System.out.println(result);
+        } catch (Exception e) {
+            System.out.println("发送GET请求出现异常!" + e);
+            e.printStackTrace();
+        }
+
+        // 使用finally块来关闭输入流
+        finally {
+            try {
+                if (in != null) {
+                    in.close();
+                }
+            } catch (Exception e2) {
+                e2.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+    /**
+     * 向指定 URL 发送POST方法的请求
+     *
+     * @param url:发送请求的 URL
+     * @param param:请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
+     * @return String[result]:所代表远程资源的响应结果
+     */
+    public static String sendPost(String url, String param) {
+        PrintWriter out = null;
+        BufferedReader in = null;
+        String result = "";
+        try {
+            URL realUrl = new URL(url);
+
+            // 打开和URL之间的连接
+            URLConnection conn = realUrl.openConnection();
+
+            // 设置通用的请求属性
+            conn.setRequestProperty("accept", "*/*");
+            conn.setRequestProperty("connection", "Keep-Alive");
+            conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+
+            // 发送POST请求必须设置如下两行
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+
+            // 获取URLConnection对象对应的输出流
+            out = new PrintWriter(conn.getOutputStream());
+
+            // 发送请求参数
+            out.print(param);
+
+            // flush输出流的缓冲
+            out.flush();
+
+            // 定义BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(
+                    new InputStreamReader(conn.getInputStream()));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送 POST 请求出现异常!"+e);
+            e.printStackTrace();
+        }
+
+        //使用finally块来关闭输出流、输入流
+        finally{
+            try{
+                if(out!=null){
+                    out.close();
+                }
+                if(in!=null){
+                    in.close();
+                }
+            }
+            catch(IOException ex){
+                ex.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+}

+ 157 - 0
src/main/java/com/steerinfo/route/util/LngLonUtil.java

@@ -0,0 +1,157 @@
+package com.steerinfo.route.util;
+
+/**
+ * GPS84、高德、百度、腾讯编码互转
+ */
+public class LngLonUtil {
+
+    public static double pi = 3.1415926535897932384626;
+    public static double x_pi = 3.14159265358979324 * 3000.0 / 180.0;
+    public static double a = 6378245.0;
+    public static double ee = 0.00669342162296594323;
+
+    public static double transformLat(double x, double y) {
+        double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
+        ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
+        ret += (20.0 * Math.sin(y * pi) + 40.0 * Math.sin(y / 3.0 * pi)) * 2.0 / 3.0;
+        ret += (160.0 * Math.sin(y / 12.0 * pi) + 320 * Math.sin(y * pi / 30.0)) * 2.0 / 3.0;
+        return ret;
+    }
+
+    public static double transformLon(double x, double y) {
+        double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
+        ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
+        ret += (20.0 * Math.sin(x * pi) + 40.0 * Math.sin(x / 3.0 * pi)) * 2.0 / 3.0;
+        ret += (150.0 * Math.sin(x / 12.0 * pi) + 300.0 * Math.sin(x / 30.0 * pi)) * 2.0 / 3.0;
+        return ret;
+    }
+    public static double[] transform(double lat, double lon) {
+        if (outOfChina(lat, lon)) {
+            return new double[]{lat,lon};
+        }
+        double dLat = transformLat(lon - 105.0, lat - 35.0);
+        double dLon = transformLon(lon - 105.0, lat - 35.0);
+        double radLat = lat / 180.0 * pi;
+        double magic = Math.sin(radLat);
+        magic = 1 - ee * magic * magic;
+        double sqrtMagic = Math.sqrt(magic);
+        dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
+        dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
+        double mgLat = lat + dLat;
+        double mgLon = lon + dLon;
+        return new double[]{mgLat,mgLon};
+    }
+    /**
+     * 判断是否在中国
+     * @param lat
+     * @param lon
+     * @return
+     */
+    public static boolean outOfChina(double lat, double lon) {
+        if (lon < 72.004 || lon > 137.8347)
+            return true;
+        if (lat < 0.8293 || lat > 55.8271)
+            return true;
+        return false;
+    }
+    /**
+     * 84 ==》 高德/腾讯
+     * @param lat
+     * @param lon
+     * @return
+     */
+    public static double[] gps84_To_Gcj02(double lat, double lon) {
+        if (outOfChina(lat, lon)) {
+            return new double[]{lat,lon};
+        }
+        double dLat = transformLat(lon - 105.0, lat - 35.0);
+        double dLon = transformLon(lon - 105.0, lat - 35.0);
+        double radLat = lat / 180.0 * pi;
+        double magic = Math.sin(radLat);
+        magic = 1 - ee * magic * magic;
+        double sqrtMagic = Math.sqrt(magic);
+        dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
+        dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
+        double mgLat = lat + dLat;
+        double mgLon = lon + dLon;
+        return new double[]{mgLat, mgLon};
+    }
+
+
+    /**
+     * 高德/腾讯 ==》 84
+     * @param lon * @param lat * @return
+     * */
+    public static double[] gcj02_To_Gps84(double lat, double lon) {
+        double[] gps = transform(lat, lon);
+        double lontitude = lon * 2 - gps[1];
+        double latitude = lat * 2 - gps[0];
+        return new double[]{latitude, lontitude};
+    }
+    /**
+     * 高德/腾讯 == 》 百度
+     * @param lat
+     * @param lon
+     */
+    public static double[] gcj02_To_Bd09(double lat, double lon) {
+        double x = lon, y = lat;
+        double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
+        double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
+        double tempLon = z * Math.cos(theta) + 0.0065;
+        double tempLat = z * Math.sin(theta) + 0.006;
+        double[] gps = {tempLat,tempLon};
+        return gps;
+    }
+
+    /**
+     * 百度 == 》 高德/腾讯
+     * @param lat
+     * @param lon
+     */
+    public static double[] bd09_To_Gcj02(double lat, double lon) {
+        double x = lon - 0.0065, y = lat - 0.006;
+        double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
+        double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
+        double tempLon = z * Math.cos(theta);
+        double tempLat = z * Math.sin(theta);
+        double[] gps = {tempLat,tempLon};
+        return gps;
+    }
+
+    /**
+     * 84 == 》 百度
+     * @param lat
+     * @param lon
+     * @return
+     */
+    public static double[] gps84_To_bd09(double lat,double lon){
+        double[] gcj02 = gps84_To_Gcj02(lat,lon);
+        double[] bd09 = gcj02_To_Bd09(gcj02[0],gcj02[1]);
+        return bd09;
+    }
+
+    /**
+     * 百度 == 》 84
+     * @param lat
+     * @param lon
+     * @return
+     */
+    public static double[] bd09_To_gps84(double lat,double lon){
+        double[] gcj02 = bd09_To_Gcj02(lat, lon);
+        double[] gps84 = gcj02_To_Gps84(gcj02[0], gcj02[1]);
+        //保留小数点后六位
+        gps84[0] = retain6(gps84[0]);
+        gps84[1] = retain6(gps84[1]);
+        return gps84;
+    }
+
+    /*
+     * 保留小数点后六位
+     * @param num
+     * @return
+     */
+    private static double retain6(double num){
+        String result = String.format("%.6f", num);
+        return Double.valueOf(result);
+    }
+}

+ 153 - 0
src/main/java/com/steerinfo/route/vo/FullPathVisualizationTo/Result.java

@@ -0,0 +1,153 @@
+/**
+  * Copyright 2021 bejson.com 
+  */
+package com.steerinfo.route.vo.FullPathVisualizationTo;
+import com.steerinfo.route.vo.Map.Point;
+
+import java.util.List;
+
+/**
+ * Auto-generated: 2021-10-16 11:56:24
+ *
+ * @author bejson.com (i@bejson.com)
+ * @website http://www.bejson.com/java2pojo/
+ */
+public class Result {
+
+    private String adr;
+    private String city;
+    private String country;
+    private String drc;
+    private String estimateArriveTime;
+    private List<Point> estimateRoute;
+    private String lat;
+    private String lon;
+    private String mil;
+    private boolean offlineState;
+    private String offlineTime;
+    private String province;
+    private String remainDistance;
+    private String runDistance;
+    private List<RunRoute> runRoute;
+    private String spd;
+    private String utc;
+    public void setAdr(String adr) {
+         this.adr = adr;
+     }
+     public String getAdr() {
+         return adr;
+     }
+
+    public void setCity(String city) {
+         this.city = city;
+     }
+     public String getCity() {
+         return city;
+     }
+
+    public void setCountry(String country) {
+         this.country = country;
+     }
+     public String getCountry() {
+         return country;
+     }
+
+    public void setDrc(String drc) {
+         this.drc = drc;
+     }
+     public String getDrc() {
+         return drc;
+     }
+
+    public void setEstimateArriveTime(String estimateArriveTime) {
+         this.estimateArriveTime = estimateArriveTime;
+     }
+     public String getEstimateArriveTime() {
+         return estimateArriveTime;
+     }
+
+    public void setEstimateRoute(List<Point> estimateRoute) {
+         this.estimateRoute = estimateRoute;
+     }
+     public List<Point> getEstimateRoute() {
+         return estimateRoute;
+     }
+
+    public void setLat(String lat) {
+         this.lat = lat;
+     }
+     public String getLat() {
+         return lat;
+     }
+
+    public void setLon(String lon) {
+         this.lon = lon;
+     }
+     public String getLon() {
+         return lon;
+     }
+
+    public void setMil(String mil) {
+         this.mil = mil;
+     }
+     public String getMil() {
+         return mil;
+     }
+
+    public void setOfflineState(boolean offlineState) {
+         this.offlineState = offlineState;
+     }
+     public boolean getOfflineState() {
+         return offlineState;
+     }
+
+    public void setOfflineTime(String offlineTime) {
+         this.offlineTime = offlineTime;
+     }
+     public String getOfflineTime() {
+         return offlineTime;
+     }
+
+    public void setProvince(String province) {
+         this.province = province;
+     }
+     public String getProvince() {
+         return province;
+     }
+
+    public void setRemainDistance(String remainDistance) {
+         this.remainDistance = remainDistance;
+     }
+     public String getRemainDistance() {
+         return remainDistance;
+     }
+
+    public void setRunDistance(String runDistance) {
+         this.runDistance = runDistance;
+     }
+     public String getRunDistance() {
+         return runDistance;
+     }
+
+    public void setRunRoute(List<RunRoute> runRoute) {
+         this.runRoute = runRoute;
+     }
+     public List<RunRoute> getRunRoute() {
+         return runRoute;
+     }
+
+    public void setSpd(String spd) {
+         this.spd = spd;
+     }
+     public String getSpd() {
+         return spd;
+     }
+
+    public void setUtc(String utc) {
+         this.utc = utc;
+     }
+     public String getUtc() {
+         return utc;
+     }
+
+}

+ 70 - 0
src/main/java/com/steerinfo/route/vo/FullPathVisualizationTo/RunRoute.java

@@ -0,0 +1,70 @@
+/**
+  * Copyright 2021 bejson.com 
+  */
+package com.steerinfo.route.vo.FullPathVisualizationTo;
+
+/**
+ * Auto-generated: 2021-10-16 11:56:24
+ *
+ * @author bejson.com (i@bejson.com)
+ * @website http://www.bejson.com/java2pojo/
+ */
+public class RunRoute {
+
+    private String agl;
+    private String gtm;
+    private String hgt;
+    private String lat;
+    private String lon;
+    private String mil;
+    private String spd;
+    public void setAgl(String agl) {
+         this.agl = agl;
+     }
+     public String getAgl() {
+         return agl;
+     }
+
+    public void setGtm(String gtm) {
+         this.gtm = gtm;
+     }
+     public String getGtm() {
+         return gtm;
+     }
+
+    public void setHgt(String hgt) {
+         this.hgt = hgt;
+     }
+     public String getHgt() {
+         return hgt;
+     }
+
+    public void setLat(String lat) {
+         this.lat = lat;
+     }
+     public String getLat() {
+         return lat;
+     }
+
+    public void setLon(String lon) {
+         this.lon = lon;
+     }
+     public String getLon() {
+         return lon;
+     }
+
+    public void setMil(String mil) {
+         this.mil = mil;
+     }
+     public String getMil() {
+         return mil;
+     }
+
+    public void setSpd(String spd) {
+         this.spd = spd;
+     }
+     public String getSpd() {
+         return spd;
+     }
+
+}

+ 30 - 0
src/main/java/com/steerinfo/route/vo/FullPathVisualizationTo/ViewVisualization.java

@@ -0,0 +1,30 @@
+/**
+  * Copyright 2021 bejson.com 
+  */
+package com.steerinfo.route.vo.FullPathVisualizationTo;
+
+/**
+ * Auto-generated: 2021-10-16 11:56:24
+ *
+ * @author bejson.com (i@bejson.com)
+ * @website http://www.bejson.com/java2pojo/
+ */
+public class ViewVisualization {
+
+    private Result result;
+    private int status;
+    public void setResult(Result result) {
+         this.result = result;
+     }
+     public Result getResult() {
+         return result;
+     }
+
+    public void setStatus(int status) {
+         this.status = status;
+     }
+     public int getStatus() {
+         return status;
+     }
+
+}

+ 40 - 0
src/main/java/com/steerinfo/route/vo/Map/Point.java

@@ -0,0 +1,40 @@
+/**
+  * Copyright 2021 bejson.com 
+  */
+package com.steerinfo.route.vo.Map;
+
+/**
+ * Auto-generated: 2021-09-28 10:36:43
+ *
+ * @author bejson.com (i@bejson.com)
+ * @website http://www.bejson.com/java2pojo/
+ */
+public class Point {
+
+    private String lat;
+    private String lon;
+
+    public String getLat() {
+        return lat;
+    }
+
+    public void setLat(String lat) {
+        this.lat = lat;
+    }
+
+    public String getLon() {
+        return lon;
+    }
+
+    public void setLon(String lon) {
+        this.lon = lon;
+    }
+
+    @Override
+    public String toString() {
+        return "Point{" +
+                "lat='" + lat + '\'' +
+                ", lon='" + lon + '\'' +
+                '}';
+    }
+}

+ 26 - 0
src/main/java/com/steerinfo/route/vo/Map/RouteVo.java

@@ -0,0 +1,26 @@
+package com.steerinfo.route.vo.Map;
+
+import java.util.List;
+
+public class RouteVo {
+
+
+
+
+    private List<StartAndEndRoute> startAndEndRoutes;
+
+    public List<StartAndEndRoute> getStartAndEndRoutes() {
+        return startAndEndRoutes;
+    }
+
+    public void setStartAndEndRoutes(List<StartAndEndRoute> startAndEndRoutes) {
+        this.startAndEndRoutes = startAndEndRoutes;
+    }
+
+    @Override
+    public String toString() {
+        return "RouteVo{" +
+                "startAndEndRoutes=" + startAndEndRoutes +
+                '}';
+    }
+}

+ 112 - 0
src/main/java/com/steerinfo/route/vo/Map/StartAndEndRoute.java

@@ -0,0 +1,112 @@
+package com.steerinfo.route.vo.Map;
+
+import java.util.List;
+
+public class StartAndEndRoute {
+    //开始点名称
+    private String startPointName;
+    //开始点
+    private Point startPoint;
+    //结束点名称
+    private String endPointName;
+    //结束点
+    private Point endPoint;
+    //当前点名称
+    private String currentPointName;
+    //当前点
+    private Point currentPoint;
+    //行驶里程数
+    private String miled;
+
+    //已经行驶点的集合,绘制已行驶路径使用的
+    private List<Point> runRoute;
+    //预计行驶点的集合,绘制预计行驶径使用的
+    private List<Point> estimateRoute;
+
+    public String getStartPointName() {
+        return startPointName;
+    }
+
+    public void setStartPointName(String startPointName) {
+        this.startPointName = startPointName;
+    }
+
+    public Point getStartPoint() {
+        return startPoint;
+    }
+
+    public void setStartPoint(Point startPoint) {
+        this.startPoint = startPoint;
+    }
+
+    public String getEndPointName() {
+        return endPointName;
+    }
+
+    public void setEndPointName(String endPointName) {
+        this.endPointName = endPointName;
+    }
+
+    public Point getEndPoint() {
+        return endPoint;
+    }
+
+    public void setEndPoint(Point endPoint) {
+        this.endPoint = endPoint;
+    }
+
+    public String getCurrentPointName() {
+        return currentPointName;
+    }
+
+    public void setCurrentPointName(String currentPointName) {
+        this.currentPointName = currentPointName;
+    }
+
+    public Point getCurrentPoint() {
+        return currentPoint;
+    }
+
+    public void setCurrentPoint(Point currentPoint) {
+        this.currentPoint = currentPoint;
+    }
+
+    public String getMiled() {
+        return miled;
+    }
+
+    public void setMiled(String miled) {
+        this.miled = miled;
+    }
+
+    public List<Point> getEstimateRoute() {
+        return estimateRoute;
+    }
+
+    public void setEstimateRoute(List<Point> estimateRoute) {
+        this.estimateRoute = estimateRoute;
+    }
+
+    public List<Point> getRunRoute() {
+        return runRoute;
+    }
+
+    public void setRunRoute(List<Point> runRoute) {
+        this.runRoute = runRoute;
+    }
+
+    @Override
+    public String toString() {
+        return "StartAndEndRoute{" +
+                "startPointName='" + startPointName + '\'' +
+                ", startPoint=" + startPoint +
+                ", endPointName='" + endPointName + '\'' +
+                ", endPoint=" + endPoint +
+                ", currentPointName='" + currentPointName + '\'' +
+                ", currentPoint=" + currentPoint +
+                ", miled='" + miled + '\'' +
+                ", runRoute=" + runRoute +
+                ", estimateRoute=" + estimateRoute +
+                '}';
+    }
+}

+ 18 - 0
src/main/java/com/steerinfo/route/vo/ResultWarn.java

@@ -0,0 +1,18 @@
+package com.steerinfo.route.vo;
+
+import lombok.Data;
+
+@Data
+public class ResultWarn {
+    private String adr;
+    private String dLoc;
+    private String label;
+    private String rid;
+    private String sLoc;
+    private long time;
+    private String type;
+    private String userName;
+    private String vno;
+    private int warnTime;
+
+}

+ 22 - 0
src/main/java/com/steerinfo/route/vo/resultJson/Ad_info.java

@@ -0,0 +1,22 @@
+/**
+  * Copyright 2021 bejson.com 
+  */
+package com.steerinfo.route.vo.resultJson;
+
+/**
+ * Auto-generated: 2021-10-10 19:26:2
+ *
+ * @author bejson.com (i@bejson.com)
+ * @website http://www.bejson.com/java2pojo/
+ */
+public class Ad_info {
+
+    private String adcode;
+    public void setAdcode(String adcode) {
+         this.adcode = adcode;
+     }
+     public String getAdcode() {
+         return adcode;
+     }
+
+}

+ 54 - 0
src/main/java/com/steerinfo/route/vo/resultJson/Address_components.java

@@ -0,0 +1,54 @@
+/**
+  * Copyright 2021 bejson.com 
+  */
+package com.steerinfo.route.vo.resultJson;
+
+/**
+ * Auto-generated: 2021-10-10 19:26:2
+ *
+ * @author bejson.com (i@bejson.com)
+ * @website http://www.bejson.com/java2pojo/
+ */
+public class Address_components {
+
+    private String province;
+    private String city;
+    private String district;
+    private String street;
+    private String street_number;
+    public void setProvince(String province) {
+         this.province = province;
+     }
+     public String getProvince() {
+         return province;
+     }
+
+    public void setCity(String city) {
+         this.city = city;
+     }
+     public String getCity() {
+         return city;
+     }
+
+    public void setDistrict(String district) {
+         this.district = district;
+     }
+     public String getDistrict() {
+         return district;
+     }
+
+    public void setStreet(String street) {
+         this.street = street;
+     }
+     public String getStreet() {
+         return street;
+     }
+
+    public void setStreet_number(String street_number) {
+         this.street_number = street_number;
+     }
+     public String getStreet_number() {
+         return street_number;
+     }
+
+}

+ 32 - 0
src/main/java/com/steerinfo/route/vo/resultJson/Location.java

@@ -0,0 +1,32 @@
+/**
+  * Copyright 2021 bejson.com 
+  */
+package com.steerinfo.route.vo.resultJson;
+
+import java.math.BigDecimal;
+
+/**
+ * Auto-generated: 2021-10-10 19:26:2
+ *
+ * @author bejson.com (i@bejson.com)
+ * @website http://www.bejson.com/java2pojo/
+ */
+public class Location {
+
+    private BigDecimal lng;
+    private BigDecimal lat;
+    public void setLng(BigDecimal lng) {
+         this.lng = lng;
+     }
+     public BigDecimal getLng() {
+         return lng;
+     }
+
+    public void setLat(BigDecimal lat) {
+         this.lat = lat;
+     }
+     public BigDecimal getLat() {
+         return lat;
+     }
+
+}

+ 80 - 0
src/main/java/com/steerinfo/route/vo/resultJson/Result.java

@@ -0,0 +1,80 @@
+/**
+  * Copyright 2021 bejson.com 
+  */
+package com.steerinfo.route.vo.resultJson;
+
+import java.math.BigDecimal;
+
+/**
+ * Auto-generated: 2021-10-10 19:26:2
+ *
+ * @author bejson.com (i@bejson.com)
+ * @website http://www.bejson.com/java2pojo/
+ */
+public class Result {
+
+    private String title;
+    private Location location;
+    private Ad_info ad_info;
+    private Address_components address_components;
+    private BigDecimal similarity;
+    private int deviation;
+    private int reliability;
+    private int level;
+    public void setTitle(String title) {
+         this.title = title;
+     }
+     public String getTitle() {
+         return title;
+     }
+
+    public void setLocation(Location location) {
+         this.location = location;
+     }
+     public Location getLocation() {
+         return location;
+     }
+
+    public void setAd_info(Ad_info ad_info) {
+         this.ad_info = ad_info;
+     }
+     public Ad_info getAd_info() {
+         return ad_info;
+     }
+
+    public void setAddress_components(Address_components address_components) {
+         this.address_components = address_components;
+     }
+     public Address_components getAddress_components() {
+         return address_components;
+     }
+
+    public void setSimilarity(BigDecimal similarity) {
+         this.similarity = similarity;
+     }
+     public BigDecimal getSimilarity() {
+         return similarity;
+     }
+
+    public void setDeviation(int deviation) {
+         this.deviation = deviation;
+     }
+     public int getDeviation() {
+         return deviation;
+     }
+
+    public void setReliability(int reliability) {
+         this.reliability = reliability;
+     }
+     public int getReliability() {
+         return reliability;
+     }
+
+    public void setLevel(int level) {
+         this.level = level;
+     }
+     public int getLevel() {
+         return level;
+     }
+
+}

+ 38 - 0
src/main/java/com/steerinfo/route/vo/resultJson/SearchPoint.java

@@ -0,0 +1,38 @@
+/**
+  * Copyright 2021 bejson.com 
+  */
+package com.steerinfo.route.vo.resultJson;
+
+/**
+ * Auto-generated: 2021-10-10 19:26:2
+ *
+ * @author bejson.com (i@bejson.com)
+ * @website http://www.bejson.com/java2pojo/
+ */
+public class SearchPoint {
+
+    private int status;
+    private String message;
+    private Result result;
+    public void setStatus(int status) {
+         this.status = status;
+     }
+     public int getStatus() {
+         return status;
+     }
+
+    public void setMessage(String message) {
+         this.message = message;
+     }
+     public String getMessage() {
+         return message;
+     }
+
+    public void setResult(Result result) {
+         this.result = result;
+     }
+     public Result getResult() {
+         return result;
+     }
+
+}

+ 10 - 0
src/main/resources/application-dev.yml

@@ -6,4 +6,14 @@ spring:
     driver-class-name: oracle.jdbc.OracleDriver
   application:
     name: dil-tms-truck-dev
+  #Redis相关配置
+  redis:
+    host: 172.16.33.161
+    port: 6379
+    password: 123456
+  cache:
+    type: redis
+    redis:
+      time-to-live: 300000
+      cache-null-values: true
 

+ 32 - 1
src/main/resources/bootstrap.yml

@@ -62,7 +62,34 @@ redis:
     time: 864000000
   database: 0
 
+#自定义配置Redis相关配置
+  prefix:
+    order: order
+    line: line
+    suffix: end
 
+str:
+  tengxun:
+    key: WDTBZ-A5VKJ-UDLFI-KYJY6-WTP2S-A6B4Y
+  ZhongJiaoXingLu:
+    cid: 2667ca1f-e003-4822-b4c1-f25561c27f31
+    srt: 3dbdc182-b235-4c33-be30-88c0fe8999c5
+    user: 695b3735-9d65-4106-98f9-5f2181b40fb5
+    pwd: fQBac3J090gK4L52a73qM821LF790H
+    #停车
+    parkMins: 60
+    #离线时长
+    outMins : 10
+    #路线偏移时长
+    abnMins: 60
+      #处理类型type=1 异常线路预警
+      #type=2 异常线路预警
+      #+停车
+    #type=3 异常线路预警
+    #+离线
+    #type=4 异常线路预警
+    #+停车+离线
+    type: 4
 
 mybatis:
   type-aliases-package: com.steerinfo.dil.model
@@ -73,4 +100,8 @@ mybatis:
     call-setters-on-nulls: true
 
 server:
-  port: 8088
+  port: 8088
+
+
+
+

+ 63 - 0
src/main/resources/com/steerinfo/dil/mapper/TmstruckLeaveFactoryResultMapper.xml

@@ -748,4 +748,67 @@
         from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
         where TLFR.RESULT_TOTAL_ID = #{resultTotalId}
     </select>
+    <select id="getTruckFactoryResult" resultType="java.util.Map">
+                
+                SELECT   * from(
+                
+                 SELECT
+                    -- 出厂时间
+                    to_char(TLFR.RESULT_OUT_GATE_TIME,'yyyy-mm-dd hh24:mi:ss')  "resultOutGateTime",
+                    --出厂抓拍图片
+                    TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture",
+                    --出厂方式
+                    TLFR.RESULT_OUT_MODE "resultOutMode",
+                    --门岗名称
+                    RG.GATEPOST_NAME "gatepostName",
+                    -- 运输订单号
+                    OO.ORDER_NUMBER "orderNumber",
+                    -- 车牌号
+                    RC.CAPACITY_NUMBER "capacityNumber",
+                    -- 运输订单id
+                    OO.ORDER_ID "orderId",
+                    -- 订单类型
+                    OO.ORDER_TYPE "orderType",
+                    -- 销售订单号
+                    ASO.SALE_NUMBER  "saleNum",
+                    -- 收货地址
+                    RRA.ADDRESS_DELIVERY_ADDRESS "receiveAddress",
+                    -- 收货单位
+                    RS.SUPPLIER_NAME  "supplierName" ,
+                    -- 发货单位
+                    RS2.SHIPPER_NAME "shipperName"
+                   
+                    
+                    
+                    
+                FROM
+                    -- 出厂实绩
+                    TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
+                    --  总实绩
+                    LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+                    -- 运输订单
+                    LEFT JOIN OMSTRUCK_ORDER OO ON TTR.ORDER_ID = OO.ORDER_ID
+                     -- 销售订单信息
+                    LEFT JOIN  AMS_SALE_ORDER ASO ON OO.ORDER_PLAN_ID = ASO.SALE_ORDER_ID
+                    -- 托运人
+                    LEFT JOIN RMS_SUPPLIER RS ON ASO.SHIPPER_ID = RS.SUPPLIER_ID
+                    --  门岗
+                    LEFT JOIN RMS_GATEPOST RG ON TLFR.GATEPOST_ID = RG.GATEPOST_ID
+                    -- 运力信息
+                    LEFT JOIN RMS_CAPACITY RC ON OO.CAPACITY_ID = RC.CAPACITY_ID
+                     -- 销售订单中间表
+                    LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM ON    ASOM.SALE_ORDER_MATERIAL_ID =OO.ORDER_PLAN_ID
+                    -- 收货地址
+                    LEFT JOIN RMS_RECEIVE_ADDRESS RRA ON    ASOM.SALE_SHIPPING_ADDRESS_ID =RRA.ADDRESS_ID
+                    -- 收货单位
+                    LEFT JOIN RMS_SHIPPER RS2 ON ASO.SHIPPER_ID = RS2.SHIPPER_ID
+                    
+                WHERE
+                    -- 判断出厂实绩的出厂时间不为空
+                    TLFR.RESULT_OUT_GATE_TIME IS NOT NULL
+                    --   并且订单类型等于1(销售订单),2(焦炭发运计划),3(水渣发运计划)
+                    AND OO.ORDER_TYPE =1 AND OO.ORDER_NUMBER=#{orderNumber}
+                    
+                    )
+    </select>
 </mapper>