| | |
| | | public ResultUtil getOrderTrack(String orderDetailId){ |
| | | if(ToolUtil.isNotEmpty(orderDetailId)){ |
| | | try { |
| | | TOrderTaxi tOrderTaxi = tOrderTaxiService.selectById(orderDetailId); |
| | | TDriver tDriver = driverService.selectById(tOrderTaxi.getDriverId()); |
| | | SearchHttpAK ta = new SearchHttpAK(); |
| | | Map params = new LinkedHashMap<String, String>(); |
| | | params.put("ak", AK); |
| | | params.put("entity_name", tDriver.getPhone()); |
| | | params.put("service_id", "241187"); |
| | | long start = tOrderTaxi.getStartServiceTime().getTime() / 1000L; |
| | | long end = tOrderTaxi.getEndServiceTime().getTime() / 1000L; |
| | | params.put("start_time", start+""); |
| | | params.put("end_time", end+""); |
| | | String s = ta.requestGetAK(URL, params); |
| | | List<TOrderPositionBaiDu> list = JSONArray.parseArray(s.toString(), TOrderPositionBaiDu.class); |
| | | // List<TOrderPosition> list = tOrderPositionService.selectList(new EntityWrapper<TOrderPosition>().eq("orderType", 2).eq("orderId", orderDetailId).orderBy("insertTime")); |
| | | /*if(list.size() == 0){ |
| | | return ResultUtil.error("该订单没有运行轨迹"); |
| | | }*/ |
| | | //将数据存储到文件中 |
| | | File file = new File(filePath + orderDetailId + "_2.txt"); |
| | | if(!file.exists()){ |
| | | return ResultUtil.success(new ArrayList<>()); |
| | | } |
| | | //读取文件(字符流) |
| | | 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<TOrderPosition> list = JSONArray.parseArray(sb.toString(), TOrderPosition.class); |
| | | resultUtil = ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |