package com.stylefeng.guns.modular.api; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.stylefeng.guns.core.util.DateUtil; import com.stylefeng.guns.core.util.ToolUtil; import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; import com.stylefeng.guns.modular.crossCity.warpper.OrderCrossCityInfoWrapper; import com.stylefeng.guns.modular.crossCity.warpper.OrderWarpper; import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; import com.stylefeng.guns.modular.system.dao.DriverWorkMapper; import com.stylefeng.guns.modular.system.model.*; import com.stylefeng.guns.modular.system.service.*; import com.stylefeng.guns.modular.system.util.ChinaMobileUtil; import com.stylefeng.guns.modular.system.util.PushUtil; import com.stylefeng.guns.modular.system.util.ResultUtil; import com.stylefeng.guns.modular.system.util.SystemException; import com.stylefeng.guns.modular.system.warpper.*; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 订单相关控制器 */ @RestController @RequestMapping("") public class OrderController { @Autowired private IOrderService orderService; @Autowired private IDriverService driverService; @Autowired private IReassignService reassignService; @Autowired private PushUtil pushUtil; @Autowired private ChinaMobileUtil chinaMobileUtil; @Autowired private IOrderLogisticsService orderLogisticsService; @Resource private DriverWorkMapper driverWorkMapper; @Autowired private ISysTimeoutMoneyService sysTimeoutMoneyService; @Autowired private IOpenCityService openCityService; @Autowired private ICarService carService; /** * 司机端获取首页订单列表 * @param state * @param pageNum * @param size * @param request * @return */ @ResponseBody @PostMapping("/api/order/queryOrderList") @ApiOperation(value = "获取首页订单列表", tags = {"司机端-首页"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "数据类型(1=服务中,2=待服务,3=助老模式接单)", name = "state", required = true, dataType = "int"), @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil> queryOrderList(Integer state, Integer pageNum, Integer size, HttpServletRequest request){ try { Integer uid = driverService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } List> list = orderService.queryOrderList(state, pageNum, size, uid); return ResultUtil.success(OrderListWarpper.getOrderListWarpper(list)); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 司机端获取首页订单列表 * @param state * @param pageNum * @param size * @param request * @return */ @ResponseBody @PostMapping("/api/order/queryOrderList1") @ApiOperation(value = "获取首页订单列表", tags = {"司机端-车载端"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "数据类型(1=服务中,2=待服务)", name = "state", required = true, dataType = "int"), @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(1=其他订单,2=小件物流)", name = "type", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil> queryOrderList1(Integer state, Integer type, Integer pageNum, Integer size, HttpServletRequest request){ try { Integer uid = driverService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } List> list = orderService.queryOrderList1(state, type, pageNum, size, uid); return ResultUtil.success(OrderListWarpper.getOrderListWarpper(list)); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 获取我的订单列表 * @param state * @param pageNum * @param size * @param request * @return */ @ResponseBody @PostMapping("/api/order/queryMyAllOrder") @ApiOperation(value = "获取我的订单列表", tags = {"司机端-首页"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "数据类型(1=全部,2=待支付,3=已取消,4=已完成)", name = "state", required = true, dataType = "int"), @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil> queryMyAllOrder(Integer state, Integer pageNum, Integer size, HttpServletRequest request){ try { Integer uid = driverService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } List listWarppers = orderService.queryMyAllOrder(state, pageNum, size, uid); return ResultUtil.success(listWarppers); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 获取我的订单列表 * @param pageNum * @param size * @param request * @return */ @ResponseBody @PostMapping("/api/order/queryMyAllOrder1") @ApiOperation(value = "获取我的订单列表", tags = {"司机端-车载端"}, notes = "只含出租车") @ApiImplicitParams({ @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil> queryMyAllOrder1(Integer pageNum, Integer size, HttpServletRequest request){ try { Integer uid = driverService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } List listWarppers = orderService.queryMyAllOrder1(pageNum, size, uid); return ResultUtil.success(listWarppers); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 获取抢单界面的订单详情 * @param orderId * @param orderType * @param lon * @param lat * @return */ @ResponseBody @PostMapping("/api/order/queryPushOrder") @ApiOperation(value = "获取抢单界面的订单详情", tags = {"司机端-首页"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,7=助老模式)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(value = "当前定位经度", name = "lon", required = true, dataType = "string"), @ApiImplicitParam(value = "当前定位纬度", name = "lat", required = true, dataType = "string"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil queryPushOrder(Integer orderId, Integer orderType, String lon, String lat){ try { Map map = orderService.queryPushOrder(orderId, orderType, lon, lat); return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map)); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 司机抢单操作 * @param orderId * @param orderType * @param request * @return */ @ResponseBody @PostMapping("/api/order/grabOrder") @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"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil grabOrder(Integer orderId, Integer orderType, HttpServletRequest request){ try { Integer uid = driverService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } DriverWork driverWork = new DriverWork(); driverWork.setDriverId(uid); driverWork.setState(1); DriverWork driverWork1 = driverWorkMapper.selectOne(driverWork); if(null == driverWork1){ return ResultUtil.error("您已下班,无法接单"); } Driver driver = driverService.selectById(uid); //判断车辆是否正在使用中 Car car = carService.selectById(driver.getCarId()); if(car.getUseDriverId() != null && !car.getUseDriverId().equals(uid)){ return ResultUtil.error("当前绑定车辆正在使用中,请更换车辆"); }else if(car.getUseDriverId()==null){ car.setUseDriverId(uid); carService.updateById(car); } return orderService.grabOrder(orderId, orderType, uid); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 获取服务中页面订单详情 * @param orderId * @param orderType * @return */ @ResponseBody @PostMapping("/api/order/queryOrderInfo") @ApiOperation(value = "获取服务中页面订单详情", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,4=小件物流-同城,5=小件物流-跨城)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil queryOrderInfo(Integer orderId, Integer orderType, HttpServletRequest request){ try { Integer uid = driverService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } Map map = orderService.queryOrderInfo(uid, orderId, orderType); if (orderType == 4 || orderType == 5){ OpenCity openCity = openCityService.openCity1(map.get("startLon").toString(), map.get("startLat").toString()); SysTimeoutMoney sysTimeoutMoney = sysTimeoutMoneyService.selectOne(new EntityWrapper().eq("openCityId", openCity.getId())); map.put("timeOutMoney",Double.parseDouble(map.get("timeOutMoney").toString())); map.put("note","配送超过" + sysTimeoutMoney.getTimeOut() + "分钟扣订单的" + sysTimeoutMoney.getDeductMoney() + "%费用"); TimeOutAppeal timeOutAppeal = timeAppealService.selectOne(new EntityWrapper().eq("orderId",orderId)); if (ToolUtil.isNotEmpty(timeOutAppeal)){ if (timeOutAppeal.getState() == 1){ map.put("appealState",1); map.put("returnMoney",0); }else if (timeOutAppeal.getState() == 2){ map.put("appealState",2); map.put("returnMoney",timeOutAppeal.getReturnMoney()==null?0:timeOutAppeal.getReturnMoney()); }else { map.put("appealState",2); map.put("returnMoney",0); } } } return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map)); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } @ResponseBody @PostMapping("/api/order/queryOrderInfo1") @ApiOperation(value = "获取服务中页面订单详情", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,4=小件物流-同城,5=小件物流-跨城)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil queryOrderInfo1(Integer orderId, Integer orderType, HttpServletRequest request){ try { Integer uid = driverService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } Map map = orderService.queryOrderInfo(uid, orderId, 7); if (orderType == 4 || orderType == 5){ OpenCity openCity = openCityService.openCity1(map.get("startLon").toString(), map.get("startLat").toString()); SysTimeoutMoney sysTimeoutMoney = sysTimeoutMoneyService.selectOne(new EntityWrapper().eq("openCityId", openCity.getId())); map.put("timeOutMoney",Double.parseDouble(map.get("timeOutMoney").toString())); map.put("note","配送超过" + sysTimeoutMoney.getTimeOut() + "分钟扣订单的" + sysTimeoutMoney.getDeductMoney() + "%费用"); TimeOutAppeal timeOutAppeal = timeAppealService.selectOne(new EntityWrapper().eq("orderId",orderId)); if (ToolUtil.isNotEmpty(timeOutAppeal)){ if (timeOutAppeal.getState() == 1){ map.put("appealState",1); map.put("returnMoney",0); }else if (timeOutAppeal.getState() == 2){ map.put("appealState",2); map.put("returnMoney",timeOutAppeal.getReturnMoney()==null?0:timeOutAppeal.getReturnMoney()); }else { map.put("appealState",2); map.put("returnMoney",0); } } } OrderWarpper orderWarpper = OrderWarpper.getOrderWarpper(map); List orders = orderWarpper.getOrders(); Integer peopleNumber=0; Double totalMoney=0d; Double serverMoney=0d; for(OrderCrossCityInfoWrapper orderCrossCityInfoWrapper:orders){ Map map1 = orderService.queryMoneyInfo(orderCrossCityInfoWrapper.getOrderId(), 1); MoneyInfo1Warpper moneyInfo1Warpper = MoneyInfo1Warpper.getMoneyInfoWarpper(map1); orderCrossCityInfoWrapper.setMoneyInfo1Warpper(moneyInfo1Warpper); peopleNumber=peopleNumber+orderCrossCityInfoWrapper.getPeopleNumber(); totalMoney=totalMoney+moneyInfo1Warpper.getOrderMoney(); } orderWarpper.setPeopleNumber(peopleNumber); orderWarpper.setTotalMoney(totalMoney); orderWarpper.setOrders(orders); return ResultUtil.success(orderWarpper); //return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map)); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 获取订单的改派金额 * @param orderId * @param orderType * @return */ @ResponseBody @PostMapping("/api/order/queryReassignMoney") @ApiOperation(value = "获取改派支付金额", tags = {"司机端-服务中"}, notes = "返回金额为0不需要调用支付") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id(跨城多个订单使用逗号分隔)", name = "orderId", required = true, dataType = "string"), @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil queryReassignMoney(String orderId, Integer orderType){ try { String[] split = orderId.split(","); Double aDouble = orderService.queryReassignMoney(Integer.valueOf(split[0]), orderType); BaseWarpper baseWarpper = new BaseWarpper(); if(orderType == 3){ aDouble = aDouble * split.length; } baseWarpper.setAmount(aDouble); return ResultUtil.success(baseWarpper); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 司机提交改派申请 * @param reassign * @param request * @return */ @ResponseBody @PostMapping("/api/order/reassign") @ApiOperation(value = "提交改派申请", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,4=小件物流-同城,5=小件物流-跨城)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(value = "改派支付方式(1=微信,2=支付宝,3=余额,4=云闪付)", name = "payType", required = false, dataType = "int"), @ApiImplicitParam(value = "改派原因", name = "reason", required = true, dataType = "string"), @ApiImplicitParam(value = "备注", name = "remark", required = false, dataType = "string"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil reassign(Reassign reassign, HttpServletRequest request){ try { Integer uid = driverService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } return reassignService.saveData(reassign, uid, null); }catch (SystemException s){ return ResultUtil.error(s.getMsg()); } catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 司机走流程操作 * @param orderId * @param orderType * @param state * @param lon * @param lat * @param request * @return */ @ResponseBody @PostMapping("/api/order/process") @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"), @ApiImplicitParam(value = "流程操作状态(3=开始出发预约点,4=到达预约点,5=开始服务,6=服务结束)", name = "state", required = true, dataType = "int"), @ApiImplicitParam(value = "当前经度", name = "lon", required = true, dataType = "double"), @ApiImplicitParam(value = "当前纬度", name = "lat", required = true, dataType = "double"), @ApiImplicitParam(value = "小件物流司机上传的图片,多个分号分隔", name = "driverImg", required = true, dataType = "string"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil process(Integer orderId, Integer orderType, Integer state, Double lon, Double lat, String driverImg, HttpServletRequest request){ try { Integer uid = driverService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } return orderService.process(orderId, orderType, state, uid, lon, lat, driverImg); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 司机抢单操作(车载端) * @param orderId * @param orderType * @param request * @return */ @ResponseBody @PostMapping("/api/order/grabOrder_") @ApiOperation(value = "司机抢单操作", tags = {"司机端-车载端"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(2=出租车,4=小件物流-同城,5=小件物流-跨城)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil grabOrder_(Integer orderId, Integer orderType, HttpServletRequest request){ try { Integer uid = driverService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } return orderService.grabOrder_(orderId, orderType, uid); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 司机确认费用 * @param orderId * @param orderType * @param type * @param travelFee * @param parkingFee * @param crossingFee * @return */ @ResponseBody @PostMapping("/api/order/confirmFees") @ApiOperation(value = "司机确认费用", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(value = "支付方式(1=OK平台收款,2=其他方式收款)", name = "type", required = true, dataType = "int"), @ApiImplicitParam(value = "行程费用(出租车必传)", name = "travelFee", required = false, dataType = "double"), @ApiImplicitParam(value = "停车费", name = "parkingFee", required = false, dataType = "double"), @ApiImplicitParam(value = "过路费", name = "crossingFee", required = false, dataType = "double"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil confirmFees(Integer orderId, Integer orderType, Integer type, Double travelFee, Double parkingFee, Double crossingFee){ try{ return orderService.confirmFees(orderId, orderType, type, travelFee, parkingFee, crossingFee); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } @ResponseBody @PostMapping("/api/order/cancleOrder") @ApiOperation(value = "取消订单", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil cancleOrder(Integer orderId, Integer orderType){ try{ return orderService.cancleOrder(orderId, orderType); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } @ResponseBody @PostMapping("/api/order/updatePeopleNum") @ApiOperation(value = "修改人数", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "人数", name = "peopleNum", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil updatePeopleNum(Integer orderId, Integer peopleNum){ try{ return orderService.updatePeopleNum(orderId, peopleNum); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } @ResponseBody @PostMapping("/api/order/confirmFees1") @ApiOperation(value = "1.0-司机确认费用", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(value = "支付方式(1=OK平台收款,2=其他方式收款)", name = "type", required = true, dataType = "int"), @ApiImplicitParam(value = "行程费用(出租车必传)", name = "travelFee", required = false, dataType = "double"), @ApiImplicitParam(value = "附加费JSON数组[{\"id\":1,\"amount\":20.5}]", name = "additionalFee", required = false, dataType = "double"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil confirmFees1(Integer orderId, Integer orderType, Integer type, Double travelFee, String additionalFee){ try{ return orderService.confirmFees1(orderId, orderType, type, travelFee, additionalFee); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 司机确认费用(车载端) * @param orderId * @param orderType * @param type * @param travelFee * @return */ @ResponseBody @PostMapping("/api/order/confirmFees_") @ApiOperation(value = "司机确认费用(车载端)", tags = {"司机端-车载端"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(2=出租车)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(value = "支付方式(1=OK平台收款)", name = "type", required = true, dataType = "int"), @ApiImplicitParam(value = "行程费用", name = "travelFee", required = false, dataType = "double"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil confirmFees_(Integer orderId, Integer orderType, Integer type, Double travelFee, Double lon, Double lat){ try{ return orderService.confirmFees_(orderId, orderType, type, travelFee, lon, lat); }catch (Exception e){ e.printStackTrace(); System.err.println(lon + "," + lat); return ResultUtil.runErr(); } } /** * 获取待支付页详情 * @param orderId * @param orderType * @return */ @ResponseBody @PostMapping("/api/order/queryToBePaidPage") @ApiOperation(value = "获取待支付页详情", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(1=专车,2=出租车)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil queryToBePaidPage(Integer orderId, Integer orderType){ try { Map map = orderService.queryToBePaidPage(orderId, orderType); if(null != map.get("telX")){ map.put("phone", map.get("telX")); } return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map)); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 后台改派成功后的推送接口 * @param orderId * @param orderType * @return */ @ResponseBody @PostMapping("/base/order/pushOrderState") public String pushOrderState(Integer orderId, Integer orderType){ try { Map map = orderService.queryOrderInfo(null, orderId, orderType); //更新小号绑定关系 orderService.RebindMidAxbBindSend(orderId, orderType); pushUtil.pushOrderReassign(Integer.valueOf(String.valueOf(map.get("driverId"))), 2,Integer.valueOf(String.valueOf(map.get("orderId"))), orderType); pushUtil.pushOrderReassign(Integer.valueOf(String.valueOf(map.get("userId"))), 1,Integer.valueOf(String.valueOf(map.get("orderId"))), orderType); pushUtil.pushOrderState(1, Integer.valueOf(String.valueOf(map.get("userId"))), Integer.valueOf(String.valueOf(map.get("orderId"))), orderType, Integer.valueOf(String.valueOf(map.get("orderState")))); return JSON.toJSONString(ResultUtil.success()); }catch (Exception e){ e.printStackTrace(); return JSON.toJSONString(ResultUtil.runErr()); } } @ResponseBody @PostMapping("/base/order/reassign_") @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"), @ApiImplicitParam(value = "改派支付方式(1=微信,2=支付宝,3=余额)", name = "payType", required = false, dataType = "int"), @ApiImplicitParam(value = "改派原因", name = "reason", required = true, dataType = "string"), @ApiImplicitParam(value = "备注", name = "remark", required = false, dataType = "string"), }) public String reassign_(Reassign reassign, Integer uid){ try { ResultUtil resultUtil = reassignService.saveData(reassign, uid, 3); return JSON.toJSONString(resultUtil); }catch (SystemException s){ return JSON.toJSONString(ResultUtil.error(s.getMsg())); } catch (Exception e){ e.printStackTrace(); return JSON.toJSONString(ResultUtil.runErr()); } } @ResponseBody @PostMapping("/base/order/test") public String test(String phoneA, String phoneB){ try { Map map = chinaMobileUtil.midAxbBindSend(phoneA, phoneB, (System.currentTimeMillis() + 86400000)); System.err.println(JSON.toJSONString(map)); }catch (Exception e){ e.printStackTrace(); return ""; } return null; } @ResponseBody @PostMapping("/base/order/test_") public String test(String bindId){ try { Map map = chinaMobileUtil.midAxbUnBindSend(bindId, null, null); }catch (Exception e){ e.printStackTrace(); return ""; } return null; } /** * 司机确认费用(车载端)不管之前数据状态直接修改到待支付(流程断网情况的处理流程) * @param orderId * @param orderType * @param type * @param travelFee * @param lon * @param lat * @return */ @ResponseBody @PostMapping("/api/order/confirmFees$") @ApiOperation(value = "司机确认费用(车载端)不管之前数据状态直接修改到已完成(流程断网情况的处理流程)", tags = {"司机端-车载端"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(2=出租车)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(value = "支付方式(1=OK平台收款)", name = "type", required = true, dataType = "int"), @ApiImplicitParam(value = "行程费用", name = "travelFee", required = false, dataType = "double"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil confirmFees$(Integer orderId, Integer orderType, Integer type, Double travelFee, Double lon, Double lat){ try{ return orderService.confirmFees$(orderId, orderType, type, travelFee, lon, lat); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } @ResponseBody @PostMapping("/api/order/queryVoiceBroadcast") @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"), @ApiImplicitParam(value = "当前位置经度", name = "lon", required = true, dataType = "string"), @ApiImplicitParam(value = "当前位置纬度", name = "lat", required = true, dataType = "string"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil queryVoiceBroadcast(Integer orderId, Integer orderType, String lon, String lat){ try { String s = orderService.queryVoiceBroadcast(orderId, orderType, lon, lat); return ResultUtil.success(s); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 手动确认订单完成 * @param orderId * @param orderType * @return */ @ResponseBody @PostMapping("/api/order/completeOrder") @ApiOperation(value = "手动确认订单完成", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(1=专车,2=出租车)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil completeOrder(Integer orderId, Integer orderType){ try { return orderService.completeOrder(orderId, orderType); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } @ResponseBody @PostMapping("/api/order/queryMoneyInfo") @ApiOperation(value = "获取订单费用明细", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(1=专车)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil queryMoneyInfo(Integer orderId, Integer orderType){ try { Map map = orderService.queryMoneyInfo(orderId, orderType); return ResultUtil.success(MoneyInfoWarpper.getMoneyInfoWarpper(map)); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } @ResponseBody @PostMapping("/api/order/queryMoneyInfo1") @ApiOperation(value = "1.0-获取订单费用明细", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(1=专车)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil queryMoneyInfo1(Integer orderId, Integer orderType){ try { Map map = orderService.queryMoneyInfo(orderId, orderType); return ResultUtil.success(MoneyInfo1Warpper.getMoneyInfoWarpper(map)); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } @ResponseBody @PostMapping("/api/order/fillInPickUpCode") @ApiOperation(value = "验证小件物流取件码", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "取件码", name = "pickUpCode", required = true, dataType = "string"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil fillInPickUpCode(Integer orderId, String pickUpCode){ try { return orderLogisticsService.fillInPickUpCode(orderId, pickUpCode); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } @ResponseBody @PostMapping("/api/order/turnAppeal") @ApiOperation(value = "跳转到申诉", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @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 turnAppeal(Integer orderId){ try { OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); Map map = new HashMap<>(); map.put("arriveTimeExpect", DateUtil.getTime(orderLogistics.getArriveTimeExpect())); // map.put("deductMoney",orderLogistics.getTimeOutMoney()); // map.put("endServiceTime",orderLogistics.getEndServiceTime()); map.put("travelTime",DateUtil.getTime(orderLogistics.getTravelTime())); map.put("endServiceTime",DateUtil.getTime(orderLogistics.getEndServiceTime())); if (ToolUtil.isNotEmpty(orderLogistics.getArriveTimeExpect()) && ToolUtil.isNotEmpty(orderLogistics.getEndServiceTime())){ map.put("timeOut", DateUtil.CalTime(DateUtil.getTime(orderLogistics.getEndServiceTime()),DateUtil.getTime(orderLogistics.getArriveTimeExpect()))); }else { map.put("timeOut",0); } return ResultUtil.success(AppealWrapper.getAppealWrapper(map)); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } @Autowired private ITimeOutAppealService timeAppealService; @ResponseBody @PostMapping("/api/order/submitAppeal") @ApiOperation(value = "提交申诉", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "申诉内容", name = "content", required = true, dataType = "string"), @ApiImplicitParam(value = "申诉图片(多张用分号;隔开)", name = "imgList", required = true, dataType = "string"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil submitAppeal(HttpServletRequest request, Integer orderId, String content, String imgList){ try { Integer uid = driverService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } TimeOutAppeal timeAppeal = new TimeOutAppeal(); timeAppeal.setOrderId(orderId); timeAppeal.setDriverId(uid); timeAppeal.setCreateTime(new Date()); timeAppeal.setContent(content); timeAppeal.setImgList(imgList); timeAppealService.insert(timeAppeal); return ResultUtil.success(); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } @ResponseBody @PostMapping("/api/order/makeUpTheDifference") @ApiOperation(value = "设置小件物流差价", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "差价金额", name = "difference", required = true, dataType = "double"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil makeUpTheDifference(Integer orderId, Double difference){ try { return orderLogisticsService.makeUpTheDifference(orderId, difference); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } @ResponseBody @PostMapping("/api/order/sendVerificationCode") @ApiOperation(value = "小件物流发送收货码", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @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 sendVerificationCode(Integer orderId){ try { orderLogisticsService.sendVerificationCode(orderId); return ResultUtil.success(); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 管理后台发送收货码 * @param orderId * @return */ @ResponseBody @PostMapping("/base/order/sendVerificationCode1") public ResultUtil sendVerificationCode1(Integer orderId){ try { orderLogisticsService.sendVerificationCode(orderId); return ResultUtil.success(); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } @ResponseBody @PostMapping("/api/order/queryAdditionalFee") @ApiOperation(value = "1.0-获取确认费用页面的附加费", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城出行,4=同城小件,5=跨城小件,7=助老模式)", name = "orderType", required = true, dataType = "int"), @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 queryAdditionalFee(Integer orderType, Integer orderId, HttpServletRequest request){ try { Integer uid = driverService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } List list = orderService.queryAdditionalFee(orderType, orderId, uid); return ResultUtil.success(list); }catch (Exception e){ e.printStackTrace(); return ResultUtil.success(); } } }