From 8f39e870ca9519d8a8190c038d15a030149de98e Mon Sep 17 00:00:00 2001 From: zhibing.pu <393733352@qq.com> Date: 星期二, 27 八月 2024 09:13:33 +0800 Subject: [PATCH] 修改2.0 bug --- UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/controller/OrderLogisticsController.java | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/controller/OrderLogisticsController.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/controller/OrderLogisticsController.java index e791822..4785244 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/controller/OrderLogisticsController.java +++ b/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(); -- Gitblit v1.7.1