Pu Zhibing
昨天 1da73e129402bb3923e92f3d561ac49acc87fee5
DriverZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushMinistryOfTransportUtil.java
@@ -103,14 +103,18 @@
     * 订单发起接口
     * @param orderId
     */
    public void orderCreate(Integer orderId) throws Exception {
    public void orderCreate(Integer orderId)  {
        OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
        Map<String, Object> query = systemPriceMapper.query(orderPrivateCar.getCompanyId(), 1, orderPrivateCar.getServerCarModelId());
        JSONObject jsonObject = new JSONObject();
        if (orderPrivateCar.getBoardingLon()!=null && orderPrivateCar.getBoardingLat()!=null){
            Map<String, String> geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getBoardingLon() + "", orderPrivateCar.getBoardingLat() + "");
            Map<String, String> geocode = null;
            try {
                geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getBoardingLon() + "", orderPrivateCar.getBoardingLat() + "");
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            if (geocode!=null){
                System.err.println("数据上传--经纬度转行政区划代码");
                jsonObject.put("Address", geocode.get("provinceCode"));//发起第行政区划代码
            }else{
                jsonObject.put("Address", 530602);//发起第行政区划代码
@@ -153,16 +157,20 @@
     * 订单成功接口
     * @param orderId
     */
    public void orderMatch(Integer orderId) throws Exception {
    public void orderMatch(Integer orderId)  {
        OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
        Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
        Car car = carService.selectById(orderPrivateCar.getCarId());
        String value = redisUtil.getValue("DRIVER" + orderPrivateCar.getDriverId());
        JSONObject jsonObject = new JSONObject();
        if (orderPrivateCar.getBoardingLon()!=null && orderPrivateCar.getBoardingLat()!=null){
            Map<String, String> geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getBoardingLon() + "", orderPrivateCar.getBoardingLat() + "");
            Map<String, String> geocode = null;
            try {
                geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getBoardingLon() + "", orderPrivateCar.getBoardingLat() + "");
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            if (geocode!=null){
                System.err.println("数据上传--经纬度转行政区划代码");
                jsonObject.put("Address", geocode.get("provinceCode"));//发起第行政区划代码
            }else{
                jsonObject.put("Address", 530602);//发起第行政区划代码
@@ -375,7 +383,7 @@
     * 经营支付接口
     * @param orderId
     */
    public void operatePay(Integer orderId) throws Exception {
    public void operatePay(Integer orderId)  {
        OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
        Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
        Map<String, Object> query = systemPriceMapper.query(orderPrivateCar.getCompanyId(), 1, orderPrivateCar.getServerCarModelId());
@@ -385,9 +393,13 @@
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("OrderId", orderPrivateCar.getOrderNum());//订单号
        if (orderPrivateCar.getBoardingLon()!=null && orderPrivateCar.getBoardingLat()!=null){
            Map<String, String> geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getBoardingLon() + "", orderPrivateCar.getBoardingLat() + "");
            Map<String, String> geocode = null;
            try {
                geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getBoardingLon() + "", orderPrivateCar.getBoardingLat() + "");
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            if (geocode!=null){
                System.err.println("数据上传--经纬度转行政区划代码");
                jsonObject.put("OnArea", geocode.get("provinceCode"));//发起第行政区划代码
            }else{
                jsonObject.put("OnArea", 530602);//发起第行政区划代码
@@ -481,7 +493,7 @@
     * 驾驶员定位信息
     * @param orderId
     */
    public void positionDriver(Integer orderId) throws Exception {
    public void positionDriver(Integer orderId) {
        OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
        Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
        Car car = carService.selectById(orderPrivateCar.getCarId());
@@ -497,8 +509,8 @@
        Double Elevation = orderPositions != null && orderPositions.size() > 0 ? Double.valueOf(orderPositions.get(orderPositions.size() - 1).getAltitude()) : 0D;
        Double Speed = 0D;
        if(orderPositions != null && orderPositions.size() > 1){
            Map<String, String> distance = gdMapElectricFenceUtil.getDistance(orderPositions.get(orderPositions.size() - 1).getLon() + "," + orderPositions.get(orderPositions.size() - 1).getLat(),
                    orderPositions.get(orderPositions.size() - 0).getLon() + "," + orderPositions.get(orderPositions.size() - 0).getLat(), 0);
            Map<String, String> distance = gdMapElectricFenceUtil.getDistance(orderPositions.get(orderPositions.size() - 2).getLon() + "," + orderPositions.get(orderPositions.size() - 2).getLat(),
                    orderPositions.get(orderPositions.size() - 1).getLon() + "," + orderPositions.get(orderPositions.size() - 1).getLat(), 0);
            Speed = distance != null ? Double.valueOf(distance.get("distance")) / 1000 : 0D;
        }
        Integer state = 4;
@@ -524,9 +536,13 @@
        }
        jsonObject.put("LicenseId", driver.getIdCard());//机动车驾驶证号
        if (orderPrivateCar.getBoardingLon()!=null && orderPrivateCar.getBoardingLat()!=null){
            Map<String, String> geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getBoardingLon() + "", orderPrivateCar.getBoardingLat() + "");
            Map<String, String> geocode = null;
            try {
                geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getBoardingLon() + "", orderPrivateCar.getBoardingLat() + "");
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            if (geocode!=null){
                System.err.println("数据上传--经纬度转行政区划代码");
                jsonObject.put("DriverRegionCode", geocode.get("provinceCode"));//发起第行政区划代码
            }else{
                jsonObject.put("DriverRegionCode", 530602);//发起第行政区划代码
@@ -559,7 +575,6 @@
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.err.println("-----------------------------驾驶员定位信息------------------------:" + result);
    }
@@ -567,7 +582,7 @@
     * 车辆定位信息
     * @param orderId
     */
    public void positionVehicle(Integer orderId) throws Exception {
    public void positionVehicle(Integer orderId) {
        OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
        Car car = carService.selectById(orderPrivateCar.getCarId());
        List<OrderPosition> orderPositions = null;
@@ -582,8 +597,8 @@
        Double Elevation = orderPositions != null && orderPositions.size() > 0 ? Double.valueOf(orderPositions.get(orderPositions.size() - 1).getAltitude()) : 0D;
        Double Speed = 0D;
        if(orderPositions != null && orderPositions.size() > 1){
            Map<String, String> distance = gdMapElectricFenceUtil.getDistance(orderPositions.get(orderPositions.size() - 1).getLon() + "," + orderPositions.get(orderPositions.size() - 1).getLat(),
                    orderPositions.get(orderPositions.size() - 0).getLon() + "," + orderPositions.get(orderPositions.size() - 0).getLat(), 0);
            Map<String, String> distance = gdMapElectricFenceUtil.getDistance(orderPositions.get(orderPositions.size() - 2).getLon() + "," + orderPositions.get(orderPositions.size() - 2).getLat(),
                    orderPositions.get(orderPositions.size() - 1).getLon() + "," + orderPositions.get(orderPositions.size() - 1).getLat(), 0);
            Speed = distance != null ? Double.valueOf(distance.get("distance")) / 1000 : 0D;
        }
        Integer state = 4;
@@ -603,9 +618,13 @@
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("VehicleNo", car.getCarLicensePlate());//车辆号牌
        if (orderPrivateCar.getBoardingLon()!=null && orderPrivateCar.getBoardingLat()!=null){
            Map<String, String> geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getBoardingLon() + "", orderPrivateCar.getBoardingLat() + "");
            Map<String, String> geocode = null;
            try {
                geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getBoardingLon() + "", orderPrivateCar.getBoardingLat() + "");
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            if (geocode!=null){
                System.err.println("数据上传--经纬度转行政区划代码");
                jsonObject.put("VehicleRegionCode", geocode.get("provinceCode"));//发起第行政区划代码
            }else{
                jsonObject.put("VehicleRegionCode", 530602);//发起第行政区划代码
@@ -640,7 +659,6 @@
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.err.println("----------------------------车辆定位信息---------------------------:" + result);
    }