| | |
| | | package com.stylefeng.guns.modular.system.controller.specialTrain; |
| | | |
| | | import cn.hutool.system.UserInfo; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.google.gson.Gson; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | |
| | | |
| | | @Resource |
| | | private ITUserService userService; |
| | | |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private ITCarService carService; |
| | | private ResultUtil resultUtil; |
| | | @Autowired |
| | | private ITCompanyService companyService; |
| | | @Autowired |
| | | private ITDriverService driverService; |
| | | @Autowired |
| | | private IIncomeService incomeService; |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | @Autowired |
| | | private ITSystemNoticeService systemNoticeService; |
| | | @Resource |
| | | private TSystemPriceMapper systemPriceMapper; |
| | | |
| | | /** |
| | | * 跳转到专车订单首页 |
| | |
| | | model.addAttribute("item",item); |
| | | return PREFIX + "tOrderPrivateCar_orderDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改专车订单 |
| | | */ |
| | |
| | | model.addAttribute("item",item); |
| | | return PREFIX + "toChangeMoney.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到出租车订单轨迹页面 |
| | | */ |
| | |
| | | page.setRecords(tOrderPrivateCarService.getPrivateCarOrderList(page,beginTime,endTime,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),orderNum,orderSource,userName,userPhone,passengers,passengersPhone,serverCarModelId,driver,state,smsNumber)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | private ResultUtil resultUtil; |
| | | |
| | | /** |
| | | * 获取订单轨迹 |
| | |
| | | return resultUtil; |
| | | } |
| | | |
| | | @Autowired |
| | | private ITCompanyService companyService; |
| | | |
| | | @Autowired |
| | | private ITDriverService driverService; |
| | | |
| | | @Autowired |
| | | private IIncomeService incomeService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 支付专车订单 |
| | | */ |
| | |
| | | orderPrivateCar.setAbnormalMoney(orderPrivateCar.getOrderMoney()); |
| | | orderPrivateCar.setOrderMoney(money); |
| | | orderPrivateCar.setPayMoney(money); |
| | | orderPrivateCar.setPayType(5); |
| | | orderPrivateCar.setState(7); |
| | | orderPrivateCar.setIsDispute(1); |
| | | orderPrivateCar.updateById(); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/frozenOrder") |
| | | @ResponseBody |
| | |
| | | |
| | | tOrderPrivateCarService.updateById(orderPrivateCar); |
| | | |
| | | //修改行程数据 |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("COMPLETE", null, null, orderPrivateCar.getTripId(), null, null, null, null, orderPrivateCar.getId(), 1); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip("COMPLETE", null, null, orderPrivateCar.getTripId(), null, null, null, null, orderPrivateCar.getId(), 1); |
| | | if(updateTrip){ |
| | | orderPrivateCar.setIsover(1); |
| | | tOrderPrivateCarService.updateById(orderPrivateCar); |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | }else{ |
| | | orderPrivateCar.setIsover(1); |
| | | tOrderPrivateCarService.updateById(orderPrivateCar); |
| | | } |
| | | //上报行程 |
| | | boolean reportBillableEvent = fleetEngineUtil.reportBillableEvent(orderPrivateCar.getTripId()); |
| | | if(!reportBillableEvent){ |
| | | for (int i = 0; i < 5; i++) { |
| | | reportBillableEvent = fleetEngineUtil.reportBillableEvent(orderPrivateCar.getTripId()); |
| | | if(reportBillableEvent){ |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | TUser userInfo = userService.selectById(orderPrivateCar.getUserId()); |
| | | Integer language1 = userInfo.getLanguage(); |
| | |
| | | } |
| | | }).start(); |
| | | |
| | | TOrderPrivateCar finalOrderPrivateCar = orderPrivateCar; |
| | | new Thread(()->{ |
| | | try { |
| | | //上报google |
| | | fleetEngineUtil.reportBillableEvent(finalOrderPrivateCar.getTripId()); |
| | | log.warn("上报时间:{},tripid:{},created_at:{},completed_at:{}", System.currentTimeMillis(), finalOrderPrivateCar.getTripId(), |
| | | finalOrderPrivateCar.getInsertTime().getTime(), finalOrderPrivateCar.getEndServiceTime().getTime()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | }).start(); |
| | | |
| | | pushUtil.frozenOrder(orderPrivateCar.getDriverId(), 2); |
| | | } |
| | | |
| | |
| | | tOrderPrivateCarService.updateById(orderPrivateCar); |
| | | return SUCCESS_TIP; |
| | | } |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | @Autowired |
| | | private ITSystemNoticeService systemNoticeService; |
| | | @Resource |
| | | private TSystemPriceMapper systemPriceMapper; |
| | | |
| | | public TOrderPrivateCar setMoney(TOrderPrivateCar orderPrivateCar, Double parkingFee, Double crossingFee) throws Exception { |
| | | System.err.println("计算金额:"+orderPrivateCar); |
| | | Map<String, Object> query1 = systemPriceMapper.query(orderPrivateCar.getCompanyId(), 1, orderPrivateCar.getServerCarModelId()); |
| | |
| | | orderPrivateCar.setIsplatPay(2); |
| | | orderPrivateCar.setPayManner(1); |
| | | orderPrivateCar.setState(8); |
| | | orderPrivateCar.setPayType(5); |
| | | orderPrivateCar.setPayMoney(orderPrivateCar.getOrderMoney()); |
| | | tOrderPrivateCarService.updateAllColumnById(orderPrivateCar); |
| | | return SUCCESS_TIP; |
| | |
| | | @ResponseBody |
| | | public Object cancel(@RequestParam Integer tOrderPrivateCarId) { |
| | | TOrderPrivateCar tOrderPrivateCar = tOrderPrivateCarService.selectById(tOrderPrivateCarId); |
| | | |
| | | if(Arrays.asList(6, 7, 8, 9, 10).contains(tOrderPrivateCar.getState())){ |
| | | return ERROR; |
| | | } |
| | | //修改之前司机状态 -- 空闲 |
| | | if(null != tOrderPrivateCar.getDriverId()){ |
| | | TDriver driver = tDriverService.selectById(tOrderPrivateCar.getDriverId()); |
| | |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(tOrderPrivateCarId); |
| | | orderCancel.setOrderType(1); |
| | | orderCancel.setReason("The platform cancelled the order"); |
| | | orderCancel.setRemark("The platform cancelled the order"); |
| | | orderCancel.setReason(language == 1 ? "平台取消订单" : language == 2 ? "The platform cancelled the order" : "La plateforme a annulé la commande"); |
| | | orderCancel.setRemark(language == 1 ? "平台取消订单" : language == 2 ? "The platform cancelled the order" : "La plateforme a annulé la commande"); |
| | | orderCancel.setUserType(2); |
| | | orderCancel.setState(2); |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancelMapper.insert(orderCancel); |
| | | |
| | | //修改行程信息 |
| | | try { |
| | | fleetEngineUtil.updateTrip("CANCELED", null, null, tOrderPrivateCar.getTripId(), null, null, null, null); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | TCar car = carService.selectById(tOrderPrivateCar.getCarId()); |
| | | //修改行程信息 |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tOrderPrivateCar.getTripId(), null, null, null, null, tOrderPrivateCar.getId(), 1); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tOrderPrivateCar.getTripId(), null, null, null, null, tOrderPrivateCar.getId(), 1); |
| | | if(updateTrip){ |
| | | tOrderPrivateCar.setIsover(1); |
| | | tOrderPrivateCarService.updateById(tOrderPrivateCar); |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | }else{ |
| | | tOrderPrivateCar.setIsover(1); |
| | | tOrderPrivateCarService.updateById(tOrderPrivateCar); |
| | | } |
| | | |
| | | |
| | |
| | | Map<String,String> map = new HashMap<>(); |
| | | map.put("id", tOrderPrivateCar.getId().toString()); |
| | | map.put("orderType", "1"); |
| | | map.put("from", "admin"); |
| | | String result = HttpRequestUtil.postRequest(PushURL.cancel_order_url, map); |
| | | System.out.println("专车取消:【orderId="+tOrderPrivateCar.getId().toString()+"】,调用接口:"+result); |
| | | return SUCCESS_TIP; |