| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.global.api.model.Result; |
| | | import com.alipay.global.api.model.ResultStatusType; |
| | | import com.alipay.global.api.request.ams.notify.AlipayPayResultNotify; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.google.api.client.http.UrlEncodedParser; |
| | | import com.stylefeng.guns.core.util.MD5Util; |
| | |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.DistancematrixVo; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.*; |
| | | import com.stylefeng.guns.modular.system.warpper.*; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.net.URLDecoder; |
| | | import java.net.URLEncoder; |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryMyTravelRecord") |
| | | @ApiOperation(value = "获取消费记录【2.0】", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "获取消费记录", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码(首页1)", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryOrderInfo") |
| | | @ApiOperation(value = "获取服务中的详情数据【2.0】", tags = {"用户端-服务中"}, notes = "") |
| | | @ApiOperation(value = "获取服务中的详情数据", tags = {"用户端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=同城小件,5=跨城小件)", name = "orderType", required = true, dataType = "int"), |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/queryOrderInfo_") |
| | | @ApiOperation(value = "获取服务中的详情数据【1.0】", tags = {"分享专用"}, notes = "") |
| | | @ApiOperation(value = "获取服务中的详情数据", tags = {"分享专用"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=同城小件,5=跨城小件)", name = "orderType", required = true, dataType = "int"), |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/addCancle") |
| | | @ApiOperation(value = "添加取消记录【2.0】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiOperation(value = "添加取消记录", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"), |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/complaintService") |
| | | @ApiOperation(value = "添加投诉操作【2.0】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiOperation(value = "添加投诉操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车)", name = "orderType", required = true, dataType = "int"), |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/payTaxiOrder") |
| | | @ApiOperation(value = "订单完成支付订单操作【2.0】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiOperation(value = "订单完成支付订单操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "支付方式(1=手机支付,2=银行卡支付,3=余额,4=线下支付)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "银行卡id", name = "bankCardId", required = false, dataType = "int"), |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/orderEvaluate") |
| | | @ApiOperation(value = "订单完成后添加评价操作【2.0】", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiOperation(value = "订单完成后添加评价操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=小件物流)", name = "orderType", required = true, dataType = "int"), |
| | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/wxCancelOrderTaxiAntom") |
| | | public void wxCancelOrderTaxiAntom(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | ResultUtil<AlipayPayResultNotify> resultUtil = AntomPaymentUtil.receivePaymentNotify(request); |
| | | Integer code = resultUtil.getCode(); |
| | | if(200 == code){ |
| | | AlipayPayResultNotify alipayPayResultNotify = resultUtil.getData(); |
| | | Result result = alipayPayResultNotify.getResult(); |
| | | ResultStatusType resultStatus = result.getResultStatus(); |
| | | if(resultStatus.equals(ResultStatusType.S)){ |
| | | String out_trade_no = alipayPayResultNotify.getPaymentRequestId(); |
| | | String order_id = alipayPayResultNotify.getPaymentId(); |
| | | Integer type = Integer.valueOf(out_trade_no.substring(17, 18)); |
| | | Integer language = Integer.valueOf(out_trade_no.substring(18, 19)); |
| | | Integer id = Integer.valueOf(out_trade_no.substring(19)); |
| | | switch (type){ |
| | | case 1: |
| | | orderPrivateCarService.payCancelOrderPrivateCar(id, order_id, language); |
| | | break; |
| | | // case 2: |
| | | // orderTaxiService.payCancelOrderTaxi(id, order_id, 1); |
| | | // break; |
| | | // case 3: |
| | | // orderCrossCityService.payCancelOrderCrossCity(id, order_id, 1); |
| | | // break; |
| | | case 4: |
| | | orderLogisticsService.payCancelOrderPrivateCar(id, order_id, language); |
| | | break; |
| | | } |
| | | PrintWriter out = response.getWriter(); |
| | | out.write("{\n" + |
| | | " \"result\": {\n" + |
| | | " \"resultCode\": \"SUCCESS\",\n" + |
| | | " \"resultMessage\": \"success\",\n" + |
| | | " \"resultStatus\": \"S\"\n" + |
| | | " }\n" + |
| | | "}"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 取消订单支付宝回调 |
| | | * @param request |
| | |
| | | |
| | | |
| | | /** |
| | | * 支付宝国际支付通知回调 |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/wxPayOrderTaxiAntom") |
| | | public void wxPayOrderTaxiAntom(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | ResultUtil<AlipayPayResultNotify> resultUtil = AntomPaymentUtil.receivePaymentNotify(request); |
| | | Integer code = resultUtil.getCode(); |
| | | if(200 == code){ |
| | | AlipayPayResultNotify alipayPayResultNotify = resultUtil.getData(); |
| | | Result result = alipayPayResultNotify.getResult(); |
| | | ResultStatusType resultStatus = result.getResultStatus(); |
| | | if(resultStatus.equals(ResultStatusType.S)){ |
| | | String out_trade_no = alipayPayResultNotify.getPaymentRequestId(); |
| | | String order_id = alipayPayResultNotify.getPaymentId(); |
| | | if(ToolUtil.isNotEmpty(out_trade_no)){ |
| | | Integer orderType = Integer.valueOf(out_trade_no.substring(17, 18)); |
| | | Integer language = Integer.valueOf(out_trade_no.substring(18, 19)); |
| | | Integer id = Integer.valueOf(out_trade_no.substring(19)); |
| | | switch (orderType){ |
| | | case 1: |
| | | orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, language); |
| | | break; |
| | | // case 2: |
| | | // orderTaxiService.payOrderTaxiCallback(id, order_id, 1); |
| | | // break; |
| | | // case 3: |
| | | // orderCrossCityService.payOrderCrossCityCallback(id, order_id, 1); |
| | | // break; |
| | | case 4: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, language); |
| | | break; |
| | | // case 5: |
| | | // orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1, language); |
| | | // break; |
| | | } |
| | | PrintWriter out = response.getWriter(); |
| | | out.write("{\n" + |
| | | " \"result\": {\n" + |
| | | " \"resultCode\": \"SUCCESS\",\n" + |
| | | " \"resultMessage\": \"success\",\n" + |
| | | " \"resultStatus\": \"S\"\n" + |
| | | " }\n" + |
| | | "}"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 完成订单支付宝支付回调 |
| | | * @param request |
| | | */ |
| | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/wxPayOrderLogisticsSpreadAntom") |
| | | public void wxPayOrderLogisticsSpreadAntom(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | ResultUtil<AlipayPayResultNotify> resultUtil = AntomPaymentUtil.receivePaymentNotify(request); |
| | | Integer code = resultUtil.getCode(); |
| | | if(200 == code){ |
| | | AlipayPayResultNotify alipayPayResultNotify = resultUtil.getData(); |
| | | Result result = alipayPayResultNotify.getResult(); |
| | | ResultStatusType resultStatus = result.getResultStatus(); |
| | | if(resultStatus.equals(ResultStatusType.S)){ |
| | | String out_trade_no = alipayPayResultNotify.getPaymentRequestId(); |
| | | String order_id = alipayPayResultNotify.getPaymentId(); |
| | | Integer orderType = Integer.valueOf(out_trade_no.substring(17, 18)); |
| | | Integer language = Integer.valueOf(out_trade_no.substring(18, 19)); |
| | | Integer id = Integer.valueOf(out_trade_no.substring(19)); |
| | | orderLogisticsService.payOrderLogisticsSpreadCallback(id, order_id, language); |
| | | |
| | | PrintWriter out = response.getWriter(); |
| | | out.write("{\n" + |
| | | " \"result\": {\n" + |
| | | " \"resultCode\": \"SUCCESS\",\n" + |
| | | " \"resultMessage\": \"success\",\n" + |
| | | " \"resultStatus\": \"S\"\n" + |
| | | " }\n" + |
| | | "}"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 小件物流差价支付宝支付回调 |
| | | * @param request |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/IGO/tinggPayoutCallback") |
| | | public PayoutCallbackResponse tinggPayoutCallback(@RequestBody PayoutCallbackRequest request){ |
| | | System.err.println("转账回调>>>>" + JSON.toJSONString(request)); |
| | | PayoutCallbackResponse payoutCallbackResponse = new PayoutCallbackResponse(); |
| | | AuthStatus authStatus = new AuthStatus(); |
| | | authStatus.setAuthStatusCode(131); |
| | | authStatus.setAuthStatusDescription("Authentication was successful"); |
| | | payoutCallbackResponse.setAuthStatus(authStatus); |
| | | Results results = new Results(); |
| | | PayoutPacket packet = request.getPayload().getPacket(); |
| | | String beepTransactionID = packet.getBeepTransactionID(); |
| | | String payerTransactionID = packet.getPayerTransactionID(); |
| | | results.setBeepTransactionID(beepTransactionID); |
| | | results.setPayerTransactionID(payerTransactionID); |
| | | results.setStatusCode("188"); |
| | | results.setStatusDescription("Response was received"); |
| | | payoutCallbackResponse.setResults(results); |
| | | return payoutCallbackResponse; |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/updateEndAddress") |
| | | @ApiOperation(value = "修改目的地【2.0】", tags = {"用户端-专车", "用户端-小件物流"}, notes = "") |
| | | @ApiOperation(value = "修改目的地", tags = {"用户端-专车", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型", name = "orderType", required = true, dataType = "int"), |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/redEnvelopeDeductionAmount") |
| | | @ApiOperation(value = "获取支付页红包抵扣金额【2.0】", tags = {"用户端-专车", "用户端-小件物流"}, notes = "") |
| | | @ApiOperation(value = "获取支付页红包抵扣金额", tags = {"用户端-专车", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型", name = "orderType", required = true, dataType = "int"), |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/getNewTripId") |
| | | @ApiOperation(value = "获取google预定tripid【2.0】", tags = {"用户端-首页"}, notes = "") |
| | | @ApiOperation(value = "获取google预定tripid", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/getOrderDrivingData") |
| | | @ApiOperation(value = "服务中手动刷新下方行程数据【1.0】", tags = {"用户端-专车", "用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "语言", name = "language", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<Map<String, String>> getOrderDrivingData(Integer orderId, Integer orderType){ |
| | | try { |
| | | Integer driverId = null; |
| | | String startLonLat = null; |
| | | String endLonLat = null; |
| | | Integer state = 0; |
| | | Integer oldState = 0; |
| | | Long startServiceTime = null; |
| | | Double servedMileage = null; |
| | | String tripId = ""; |
| | | switch (orderType){ |
| | | case 1: |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | tripId = redisUtil.getValue("trip" + orderPrivateCar.getUserId()); |
| | | if(orderPrivateCar != null){ |
| | | driverId = orderPrivateCar.getDriverId(); |
| | | startLonLat = orderPrivateCar.getStartLon() + "," + orderPrivateCar.getStartLat(); |
| | | state = orderPrivateCar.getState(); |
| | | oldState = orderPrivateCar.getOldState(); |
| | | startServiceTime = null != orderPrivateCar.getStartServiceTime() ? orderPrivateCar.getStartServiceTime().getTime() : null; |
| | | servedMileage = orderPrivateCar.getMileage(); |
| | | endLonLat = orderPrivateCar.getEndLon() + "," + orderPrivateCar.getEndLat(); |
| | | } |
| | | break; |
| | | case 2: |
| | | OrderTaxi orderTaxi = orderTaxiService.selectById(orderId); |
| | | tripId = redisUtil.getValue("trip" + orderTaxi.getUserId()); |
| | | if(orderTaxi != null){ |
| | | driverId = orderTaxi.getDriverId(); |
| | | startLonLat = orderTaxi.getStartLon() + "," + orderTaxi.getStartLat(); |
| | | state = orderTaxi.getState(); |
| | | oldState = orderTaxi.getOldState(); |
| | | startServiceTime = null != orderTaxi.getStartServiceTime() ? orderTaxi.getStartServiceTime().getTime() : null; |
| | | servedMileage = orderTaxi.getMileage(); |
| | | endLonLat = orderTaxi.getEndLon() + "," + orderTaxi.getEndLat(); |
| | | } |
| | | break; |
| | | case 3: |
| | | OrderCrossCity orderCrossCity = orderCrossCityService.selectById(orderId); |
| | | tripId = redisUtil.getValue("trip" + orderCrossCity.getUserId()); |
| | | if(orderCrossCity == null){ |
| | | driverId = orderCrossCity.getDriverId(); |
| | | startLonLat = orderCrossCity.getStartLon() + "," + orderCrossCity.getStartLat(); |
| | | state = orderCrossCity.getState(); |
| | | startServiceTime = null != orderCrossCity.getStartServiceTime() ? orderCrossCity.getStartServiceTime().getTime() : null; |
| | | servedMileage = orderCrossCity.getMileage(); |
| | | endLonLat = orderCrossCity.getEndLon() + "," + orderCrossCity.getEndLat(); |
| | | } |
| | | break; |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | tripId = redisUtil.getValue("trip" + orderLogistics.getUserId()); |
| | | if(orderLogistics == null){ |
| | | driverId = orderLogistics.getDriverId(); |
| | | startLonLat = orderLogistics.getStartLon() + "," + orderLogistics.getStartLat(); |
| | | state = orderLogistics.getState(); |
| | | startServiceTime = null != orderLogistics.getStartServiceTime() ? orderLogistics.getStartServiceTime().getTime() : null; |
| | | servedMileage = orderLogistics.getMileage(); |
| | | endLonLat = orderLogistics.getEndLon() + "," + orderLogistics.getEndLat(); |
| | | } |
| | | break; |
| | | case 5: |
| | | OrderLogistics orderLogistics1 = orderLogisticsService.selectById(orderId); |
| | | tripId = redisUtil.getValue("trip" + orderLogistics1.getUserId()); |
| | | if(orderLogistics1 == null){ |
| | | driverId = orderLogistics1.getDriverId(); |
| | | startLonLat = orderLogistics1.getStartLon() + "," + orderLogistics1.getStartLat(); |
| | | state = orderLogistics1.getState(); |
| | | startServiceTime = null != orderLogistics1.getStartServiceTime() ? orderLogistics1.getStartServiceTime().getTime() : null; |
| | | servedMileage = orderLogistics1.getMileage(); |
| | | endLonLat = orderLogistics1.getEndLon() + "," + orderLogistics1.getEndLat(); |
| | | } |
| | | break; |
| | | } |
| | | //计算预计距离和剩余时间 |
| | | String value = redisUtil.getValue("DRIVER" + driverId); |
| | | if(null == value || "".equals(value)){ |
| | | System.err.println("司机没有上传位置信息"); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("orderId", String.valueOf(orderId)); |
| | | map.put("orderType", String.valueOf(orderType)); |
| | | map.put("lon", (null != value ? value.split(",")[0] : "")); |
| | | map.put("lat", (null != value ? value.split(",")[1] : "")); |
| | | if(state == 7 || state == 8 || state == 9 || state == 10 || state == 12){ |
| | | return ResultUtil.success(); |
| | | } |
| | | if((state == 2 || state == 3 || state == 4) || (oldState != null && (oldState == 2 || oldState == 3 || oldState == 4))){//前往预约地 |
| | | String d = "0"; |
| | | String t = "0"; |
| | | if(ToolUtil.isNotEmpty(value) && ToolUtil.isNotEmpty(startLonLat)){ |
| | | String[] split = value.split(","); |
| | | String[] split1 = startLonLat.split(","); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(split[1]), Double.valueOf(split[0]), Double.valueOf(split1[1]), Double.valueOf(split1[0]), tripId); |
| | | if(null == distancematrix){ |
| | | System.err.println("地图获取距离出错"); |
| | | }else{ |
| | | d = distancematrix.getDistance().toString();//距离m |
| | | t = distancematrix.getDuration().toString();//时间s |
| | | } |
| | | } |
| | | d = new BigDecimal(d).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(t).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | map.put("reservationMileage", d);//当前位置距离预约点的剩余里程 |
| | | map.put("reservationTime", t);//当前位置距离预约点的剩余分钟 |
| | | map.put("servedMileage", "0");//距离起点已经服务的里程 |
| | | map.put("servedTime", "0");//距离起点已经服务的时间 |
| | | map.put("laveMileage", "0");//距离终点剩余未服务的里程数 |
| | | map.put("laveTime", "0");//距离终端剩余未服务的预计时间 |
| | | } |
| | | if((state == 5 || state == 6) || (oldState != null && (oldState == 5 || oldState == 6))){//服务中 |
| | | map.put("reservationMileage", "0");//当前位置距离预约点的剩余里程 |
| | | map.put("reservationTime", "0");//当前位置距离预约点的剩余分钟 |
| | | map.put("servedMileage", String.valueOf((null == servedMileage ? 0 : servedMileage) / 1000));//距离起点已经服务的里程 |
| | | Integer servedTime = Long.valueOf((new Date().getTime() - startServiceTime) / 60000).intValue(); |
| | | map.put("servedTime", servedTime + "");//距离起点已经服务的时间 |
| | | |
| | | String d = "0"; |
| | | String t = "0"; |
| | | if(ToolUtil.isNotEmpty(value) && ToolUtil.isNotEmpty(endLonLat)){ |
| | | String[] split = value.split(","); |
| | | String[] split1 = endLonLat.split(","); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(split[1]), Double.valueOf(split[0]), Double.valueOf(split1[1]), Double.valueOf(split1[0]), tripId); |
| | | if(null == distancematrix){ |
| | | System.err.println("地图获取距离出错"); |
| | | }else{ |
| | | d = distancematrix.getDistance().toString();//距离m |
| | | t = distancematrix.getDuration().toString();//时间s |
| | | } |
| | | } |
| | | |
| | | d = new BigDecimal(d).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(t).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | map.put("laveMileage", d);//距离终点剩余未服务的里程数 |
| | | map.put("laveTime", t);//距离终端剩余未服务的预计时间 |
| | | } |
| | | File file = new File(filePath + orderId + "_" + orderType + ".txt"); |
| | | if(file.exists()){ |
| | | //读取文件(字符流) |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8")); |
| | | //循环取出数据 |
| | | String str = null; |
| | | StringBuffer sb = new StringBuffer(); |
| | | while ((str = in.readLine()) != null) { |
| | | sb.append(str); |
| | | } |
| | | List<OrderPosition> list = JSONArray.parseArray(sb.toString(), OrderPosition.class); |
| | | map.put("orderPositionList",JSONObject.toJSONString(list)); |
| | | } |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | } |