zhibing.pu
2024-08-27 8f39e870ca9519d8a8190c038d15a030149de98e
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/controller/OrderLogisticsController.java
@@ -119,9 +119,10 @@
            @ApiImplicitParam(value = "终点经纬度(103.23265,30.2312)", name = "endLonLat", required = true, paramType = "query", dataType = "string"),
            @ApiImplicitParam(value = "终点详细地址", name = "endAddress", required = true, paramType = "query", dataType = "string")
    })
    public ResultUtil queryPayMoney(Integer number, Integer type, String startLonLat, String endLonLat, String endAddress, Integer language){
    public ResultUtil queryPayMoney(Integer number, Integer type, String startLonLat, String endLonLat, String endAddress, Integer language, HttpServletRequest request){
        try {
            return orderLogisticsService.queryPayMoney(number, type, startLonLat, endLonLat, endAddress, language);
            Integer uid = userInfoService.getUserIdFormRedis(request);
            return orderLogisticsService.queryPayMoney(uid, number, type, startLonLat, endLonLat, endAddress, language);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
@@ -317,8 +318,12 @@
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<OrderTimeInfo> queryTimeInfo(Integer orderId, Integer language){
    public ResultUtil<OrderTimeInfo> queryTimeInfo(Integer orderId, Integer language, HttpServletRequest request){
        try {
            Integer uid = userInfoService.getUserIdFormRedis(request);
            if(null == uid) {
                return ResultUtil.tokenErr();
            }
            OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId);
            OrderTimeInfo orderTimeInfo = new OrderTimeInfo();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -340,21 +345,22 @@
                usedTime = language == 1 ? h + "小时" + m + "分钟" : language == 2 ? h + "-hour" + m + "-minute(s)" : h + "-hour" + m + "-minute";
            }
            orderTimeInfo.setUsedTime(usedTime);
            String tripId = redisUtil.getValue("trip" + uid);
            if(null != orderLogistics.getEndServiceTime()){
                orderTimeInfo.setEndServiceTime(DateUtil.conversionFormat(language, sdf.format(orderLogistics.getEndServiceTime())));
            }else{
                DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), orderLogistics.getEndLat(), orderLogistics.getEndLon());
                DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), orderLogistics.getEndLat(), orderLogistics.getEndLon(), tripId);
                Long duration = distancematrix.getDuration();
                orderTimeInfo.setEndServiceTime(DateUtil.conversionFormat(language, sdf.format(new Date(System.currentTimeMillis() + duration * 1000))));
            }
            DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), orderLogistics.getEndLat(), orderLogistics.getEndLon());
            DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), orderLogistics.getEndLat(), orderLogistics.getEndLon(), tripId);
            Long distance = distancematrix.getDistance();
            orderTimeInfo.setAllMileage(Double.valueOf(distance / 1000));
            orderTimeInfo.setMileage(orderLogistics.getMileage() / 1000);
            String value = redisUtil.getValue("DRIVER" + orderLogistics.getDriverId());
            if(ToolUtil.isNotEmpty(value)){
                String[] split = value.split(",");
                distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(split[1]), Double.valueOf(split[0]), orderLogistics.getEndLat(), orderLogistics.getEndLon());
                distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(split[1]), Double.valueOf(split[0]), orderLogistics.getEndLat(), orderLogistics.getEndLon(), tripId);
                //分钟
                Long duration = distancematrix.getDuration() / 60;
                h = Double.valueOf(duration / 60).intValue();