package com.stylefeng.guns.modular.api; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.stylefeng.guns.core.util.ToolUtil; import com.stylefeng.guns.modular.CharteredCar.server.IOrderCharteredCarService; import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; import com.stylefeng.guns.modular.system.model.Driver; import com.stylefeng.guns.modular.system.model.UserInfo; import com.stylefeng.guns.modular.system.service.*; import com.stylefeng.guns.modular.system.util.*; import com.stylefeng.guns.modular.system.warpper.*; import com.stylefeng.guns.modular.taxi.model.OrderTaxi; import com.stylefeng.guns.modular.taxi.model.TransactionDetails; import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; import io.swagger.annotations.Api; 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.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.PrintWriter; import java.text.SimpleDateFormat; import java.util.*; /** * 订单控制器(综合) */ @Api //@CrossOrigin @RestController @RequestMapping("") public class OrderController { @Autowired private IOrderTaxiService orderTaxiService; @Autowired private IUserInfoService userInfoService; @Autowired private IOrderPositionService orderPositionService; @Autowired private PushUtil pushUtil; @Autowired private IOrderService orderService; @Autowired private IDriverService driverService; @Autowired private WeChatUtil weChatUtil; @Autowired private IOrderPrivateCarService orderPrivateCarService; @Autowired private IComplaintService complaintService; @Autowired private IOrderEvaluateService orderEvaluateService; @Autowired private IOrderCrossCityService orderCrossCityService; // @Autowired // private ICBCPayUtil icbcPayUtil; @Autowired private IOrderLogisticsService orderLogisticsService; @Autowired private IOrderCharteredCarService orderCharteredCarService; @Autowired private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; @Autowired private ITransactionDetailsService transactionDetailsService; @Autowired private IOrderCancelService orderCancelService; @Autowired private PayMoneyUtil payMoneyUtil; @Value("${pushMinistryOfTransport}") private boolean pushMinistryOfTransport; /** * 获取正在进行中的订单 * @param request * @return */ @ResponseBody @PostMapping("/api/order/queryServingOrder") @ApiOperation(value = "获取正在进行中的订单", tags = {"用户端-首页"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil> queryServingOrder(HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } List data = new ArrayList<>(); List orderPrivateCars = orderPrivateCarService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12); for(OrderPrivateCar orderPrivateCar : orderPrivateCars){ if(orderPrivateCar.getState() == 11){ orderPrivateCar.setState(orderPrivateCar.getOldState()); } OrderStatusWarpper orderStatusWarpper = new OrderStatusWarpper(); orderStatusWarpper.setOrderId(orderPrivateCar.getId()); orderStatusWarpper.setOrderType(1); orderStatusWarpper.setState(orderPrivateCar.getState()); data.add(orderStatusWarpper); } List list = orderTaxiService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12); for(OrderTaxi orderTaxi : list){ if(orderTaxi.getState() == 11){ orderTaxi.setState(orderTaxi.getOldState()); } OrderStatusWarpper orderStatusWarpper = new OrderStatusWarpper(); orderStatusWarpper.setOrderId(orderTaxi.getId()); orderStatusWarpper.setOrderType(2); orderStatusWarpper.setState(orderTaxi.getState()); data.add(orderStatusWarpper); } List orderCrossCities = orderCrossCityService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12); for(OrderCrossCity orderCrossCity : orderCrossCities){ if(orderCrossCity.getState() == 11){ orderCrossCity.setState(orderCrossCity.getOldState()); } OrderStatusWarpper orderStatusWarpper = new OrderStatusWarpper(); orderStatusWarpper.setOrderId(orderCrossCity.getId()); orderStatusWarpper.setOrderType(3); orderStatusWarpper.setState(orderCrossCity.getState()); data.add(orderStatusWarpper); } return ResultUtil.success(data); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 获取个人中心订单列表 * @param type * @param pageNum * @param size * @param request * @return */ @ResponseBody @PostMapping("/api/order/queryMyOrderList") @ApiOperation(value = "获取个人中心订单列表", tags = {"用户端-个人中心"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城出行,4=小件物流,5=包车)", name = "type", 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> queryMyOrderList(Integer type, Integer pageNum, Integer size, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } List> list = null; switch (type){ case 1: list = orderPrivateCarService.queryMyOrderList(uid, pageNum, size); break; case 2: list = orderTaxiService.queryMyOrderList(uid, pageNum, size); break; case 3: list = orderCrossCityService.queryMyOrderList(uid, pageNum, size); break; case 4: list = orderLogisticsService.queryMyOrderList(uid, pageNum, size); break; case 5: list = orderCharteredCarService.queryMyOrderList(uid, pageNum, size); break; } return ResultUtil.success(OrderWarpper.getOrderWarpper(list)); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 获取消费记录 * @param pageNum * @param size * @param request * @return */ @ResponseBody @PostMapping("/api/order/queryMyTravelRecord") @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> queryMyTravelRecord(Integer pageNum, Integer size, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } Integer page = pageNum; pageNum = (pageNum - 1) * size; List> maps = orderCancelService.queryCancel(uid, 2); List> list = orderPrivateCarService.queryMyTravelRecord(uid);//专车 List> list1 = orderTaxiService.queryMyTravelRecord(uid);//出租车 List> list2 = orderCrossCityService.queryMyTravelRecord(uid);//跨城车 List> list3 = orderLogisticsService.queryMyTravelRecord(uid);//小件物流 List transactionDetails = transactionDetailsService.selectList(new EntityWrapper().eq("state", 1) .eq("type", 1).eq("userType", 1).eq("userId", uid)); List> list4 = new ArrayList<>(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); for(TransactionDetails transactionDetails1 : transactionDetails){ Map map = new HashMap<>(); map.put("money", transactionDetails1.getMoney()); map.put("time", sdf.format(transactionDetails1.getInsertTime())); map.put("name", transactionDetails1.getOrderType() == 3 ? "直通车订单取消退款" : transactionDetails1.getOrderType() == 4 ? "小件物流订单取消退款" : ""); map.put("insertTime", Double.valueOf(transactionDetails1.getInsertTime().getTime() / 1000).intValue()); list4.add(map); } list.addAll(maps); list.addAll(list1); list.addAll(list2); list.addAll(list3); list.addAll(list4); List orderWarpper = TravelRecordWarpper.getTravelRecordWarpper(list); //分页 if(orderWarpper.size() >= page * size){ orderWarpper = orderWarpper.subList(pageNum, pageNum + size); }else if(pageNum < orderWarpper.size() && orderWarpper.size() < page * size){ orderWarpper = orderWarpper.subList(pageNum, orderWarpper.size()); }else{ orderWarpper = new ArrayList<>(); } return ResultUtil.success(orderWarpper); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 发票页获取订单列表 * @param type * @param orderType * @param startTime * @param endTime * @param startMoney * @param endMoney * @param pageNum * @param size * @param request * @return */ @ResponseBody @PostMapping("/api/order/queryInvoiceOrder") @ApiOperation(value = "发票页获取订单列表", tags = {"用户端-个人中心"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单开票状态(1=未开票,2=其他)", name = "type", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城出行,4=同城小件物流,5=跨城小件物流)", name = "orderType", required = false, dataType = "int"), @ApiImplicitParam(value = "开始日期", name = "startTime", required = false, dataType = "string"), @ApiImplicitParam(value = "结束日期", name = "endTime", required = false, dataType = "string"), @ApiImplicitParam(value = "开始金额", name = "startMoney", required = false, dataType = "double"), @ApiImplicitParam(value = "结束金额", name = "endMoney", required = false, dataType = "double"), @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> queryInvoiceOrder(Integer type, Integer orderType, Date startTime, Date endTime, Double startMoney, Double endMoney, Integer pageNum, Integer size, HttpServletRequest request){ Integer page = pageNum; pageNum = (pageNum - 1) * size; try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } List> list = new ArrayList<>(); if(null != orderType){ switch (orderType){ case 1://专车 list = orderPrivateCarService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); break; case 2://出租车 list = orderTaxiService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); break; case 3://跨城 list = orderCrossCityService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); break; case 4://同城小件物流 list = orderLogisticsService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType); break; case 5://跨城小件物流 list = orderLogisticsService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType); break; } }else{ //专车 List> maps = orderPrivateCarService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); list.addAll(maps); //出租车 List> list1 = orderTaxiService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); list.addAll(list1); //跨城 List> list2 = orderCrossCityService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); list.addAll(list2); //同城小件物流 List> list3 = orderLogisticsService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType); list.addAll(list3); //跨城小件物流 List> list4 = orderLogisticsService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType); list.addAll(list4); } //分页 if(list.size() >= page * size){ list = list.subList(pageNum, pageNum + size); }else if(pageNum < list.size() && list.size() < page * size){ list = list.subList(pageNum, list.size()); }else{ list = new ArrayList<>(); } return ResultUtil.success(OrderWarpper.getOrderWarpper(list)); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 继续等待推单操作 * @param id * @return */ @ResponseBody @PostMapping("/api/taxi/pushOrderTaxi") @ApiOperation(value = "继续等待推单操作", tags = {"用户端-出租车", "用户端-专车"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "id", 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 pushOrderTaxi(Integer id, Integer orderType){ try { switch (orderType){ case 1: return orderPrivateCarService.pushOrderPrivateCar(id); case 2: return orderTaxiService.pushOrderTaxi(id); } return ResultUtil.success(); }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=出租车,3=城际)", 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){ try { Map map = null; switch (orderType){ case 1://专车 map = orderPrivateCarService.queryOrderInfo(orderId); break; case 2://出租车 map = orderTaxiService.queryOrderInfo(orderId); break; case 3://跨城 map = orderCrossCityService.queryOrderInfo(orderId); break; } if(map.get("telX") != null){ map.put("driverPhone", 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/queryOrderInfo_") @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"), }) public ResultUtil queryOrderInfo_(Integer orderId, Integer orderType){ try { Map map = null; switch (orderType){ case 1://专车 map = orderPrivateCarService.queryOrderInfo(orderId); break; case 2://出租车 map = orderTaxiService.queryOrderInfo(orderId); break; case 3://跨城 map = orderCrossCityService.queryOrderInfo(orderId); break; } if(null != map.get("telX")){ map.put("driverPhone", map.get("telX")); } return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map)); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 获取订单取消支付页面详情 * @param orderId * @param orderType * @return */ @ResponseBody @PostMapping("/api/order/queryCancelPage") @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 queryCancelPage(Integer orderId, Integer orderType){ try { Map map = null; switch (orderType) { case 1://专车 map = orderPrivateCarService.queryOrderInfo(orderId); ResultUtil res = orderPrivateCarService.queryCancleAmount(orderId); map.put("cancelPayMoney", res.getData().getAmount()); break; case 2://出租车 map = orderTaxiService.queryOrderInfo(orderId); ResultUtil re = orderTaxiService.queryCancleAmount(orderId); map.put("cancelPayMoney", re.getData().getAmount()); break; case 3://跨城 map = orderCrossCityService.queryOrderInfo(orderId); ResultUtil r = orderCrossCityService.queryCancleAmount(orderId); map.put("cancelPayMoney", r.getData().getAmount()); break; } return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map)); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 获取订单轨迹坐标 * @param orderId * @param orderType * @return */ @ResponseBody @PostMapping("/api/order/queryTrack") @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 queryTrack(Integer orderId, Integer orderType){ try { List> list = orderPositionService.queryTrack(orderId, orderType); return ResultUtil.success(list); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 获取订单轨迹坐标 * @param orderId * @param orderType * @return */ @ResponseBody @PostMapping("/base/order/queryTrack_") @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"), }) public ResultUtil queryTrack_(Integer orderId, Integer orderType){ try { List> list = orderPositionService.queryTrack(orderId, orderType); return ResultUtil.success(list); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 发送订单状态 * @param id * @param orderType * @return */ @ResponseBody @PostMapping("/base/order/sendOrderState") public ResultUtil cancelOrder(Integer id, Integer orderType){ try { Integer driverId = null; Integer userId = null; Integer state = 0; switch (orderType){ case 1: OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(id); driverId = orderPrivateCar.getDriverId(); userId = orderPrivateCar.getUserId(); state = orderPrivateCar.getState(); if(null != driverId){ pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); } break; case 2: OrderTaxi orderTaxi = orderTaxiService.selectById(id); driverId = orderTaxi.getDriverId(); userId = orderTaxi.getUserId(); state = orderTaxi.getState(); if(null != driverId){ pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); } break; case 3: OrderCrossCity orderCrossCity = orderCrossCityService.selectById(id); driverId = orderCrossCity.getDriverId(); userId = orderCrossCity.getUserId(); state = orderCrossCity.getState(); if(orderCrossCity.getPayMoney() == null && state == 10){//支付的情况才推送取消 break; }else{ pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); } break; case 4: OrderLogistics orderLogistics = orderLogisticsService.selectById(id); driverId = orderLogistics.getDriverId(); userId = orderLogistics.getUserId(); state = orderLogistics.getState(); if(orderLogistics.getPayMoney() == null && state == 10){//支付的情况才推送取消 break; }else{ pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); } break; case 5: OrderLogistics orderLogistics1 = orderLogisticsService.selectById(id); driverId = orderLogistics1.getDriverId(); userId = orderLogistics1.getUserId(); state = orderLogistics1.getState(); if(orderLogistics1.getPayMoney() == null && state == 10){//支付的情况才推送取消 break; }else{ pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); } break; } pushUtil.pushOrderState(1, userId, id, orderType, state, 0); return ResultUtil.success(); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * APP调用微信小程序支付 * @param orderId * @param orderType * @param type * @param content * @return */ @ResponseBody @PostMapping("/base/order/weChatPay") @ApiOperation(value = "APP调用微信小程序支付", 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 = "业务类型(1=订单完成支付,2=订单取消支付,3=司机端改派支付,4=余额充值,5=小件物流差价支付)", name = "type", required = true, dataType = "int"), @ApiImplicitParam(value = "端口类型(1=用户端,2=司机端)", name = "userType", required = true, dataType = "int"), @ApiImplicitParam(value = "用户id", name = "uid", required = true, dataType = "int"), @ApiImplicitParam(value = "附加参数{\"key\":\"value\"}", name = "content", required = true, dataType = "string") }) public ResultUtil weChatPay(Integer orderId, Integer orderType, Integer type, Integer userType, Integer uid, String content){ try { return orderService.weChatPay(orderId, orderType, type, userType, uid, content); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } @ResponseBody @PostMapping("/base/order/queryUserOpenId") @ApiOperation(value = "获取用户的微信openid", tags = {"用户端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "端口类型(1=用户端,2=司机端)", name = "userType", required = true, dataType = "int"), @ApiImplicitParam(value = "用户id", name = "uid", required = true, dataType = "int") }) public ResultUtil queryUserOpenId(Integer uid, Integer userType){ if(userType == 2){ Driver driver = driverService.selectById(uid); return ResultUtil.success(driver.getAppletsOpenId()); } if(userType == 1){ UserInfo userInfo = userInfoService.selectById(uid); return ResultUtil.success(userInfo.getAppletsOpenId()); } return ResultUtil.success(); } @ResponseBody @PostMapping("/base/order/getWeChatOpenId") @ApiOperation(value = "用户授权获取小程序openid", tags = {"用户端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "端口类型(1=用户端,2=司机端)", name = "userType", required = true, dataType = "int"), @ApiImplicitParam(value = "用户id", name = "uid", required = true, dataType = "int"), @ApiImplicitParam(value = "小程序授权临时凭证", name = "jscode", required = true, dataType = "string"), }) public ResultUtil getWeChatOpenId(Integer uid, Integer userType, String jscode){ Map map = weChatUtil.code2Session(jscode); if(userType == 2){ Driver driver = driverService.selectById(uid); driver.setAppletsOpenId(map.get("openid")); driverService.updateById(driver); } if(userType == 1){ UserInfo userInfo = userInfoService.selectById(uid); userInfo.setAppletsOpenId(map.get("openid")); userInfoService.updateById(userInfo); } return ResultUtil.success(); } /** * 获取预计行驶时间 * @param slon * @param slat * @param elon * @param elat * @return */ @ResponseBody @PostMapping("/base/taxi/queryExpectedTime") @ApiOperation(value = "选择地点和终点后获取预计行驶时长", tags = {"用户端-出租车", "用户端-专车"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "起点经度", name = "slon", required = true, dataType = "double"), @ApiImplicitParam(value = "起点纬度", name = "slat", required = true, dataType = "double"), @ApiImplicitParam(value = "终点经度", name = "elon", required = true, dataType = "double"), @ApiImplicitParam(value = "终点纬度", name = "elat", required = true, dataType = "double") }) public ResultUtil queryExpectedTime(Double slon, Double slat, Double elon, Double elat){ try { return orderService.queryExpectedTime(slon, slat, elon, elat); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 获取取消订单需要支付的费用金额 * @param id * @return */ @ResponseBody @PostMapping("/api/taxi/queryCancleAmount") @ApiOperation(value = "获取取消订单需要支付的费用金额", tags = {"用户端-出租车", "用户端-专车"}, notes = "返回金额为0则不需要支付") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "id", 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 queryCancleAmount(Integer id, Integer orderType){ try { switch (orderType){ case 1: return orderPrivateCarService.queryCancleAmount(id); case 2: return orderTaxiService.queryCancleAmount(id); case 3: return orderCrossCityService.queryCancleAmount(id); } return ResultUtil.success(); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 添加取消记录 * @param id * @param reason * @param remark * @param request * @return */ @ResponseBody @PostMapping("/api/taxi/addCancle") @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"), @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 addCancle(Integer id, Integer orderType, String reason, String remark, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } switch (orderType){ case 1: return orderPrivateCarService.addCancle(id, reason, remark, uid); case 2: return orderTaxiService.addCancle(id, reason, remark, uid); case 3: return orderCrossCityService.addCancle(id, reason, remark, uid); case 4: return orderLogisticsService.addCancle(id, reason, remark, uid); case 5: return orderLogisticsService.addCancle(id, reason, remark, uid); case 6: return orderCharteredCarService.addCancle(id, reason, remark, uid); } return ResultUtil.success(); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 取消操作支付 * @param id * @param payType * @return */ @ResponseBody @PostMapping("/api/taxi/cancleOrderTaxi") @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"), @ApiImplicitParam(value = "支付方式(1=微信,2=支付宝,3=余额)", name = "payType", required = true, dataType = "int"), @ApiImplicitParam(value = "取消单id(取消操作返回)", name = "cancleId", required = false, dataType = "int"), @ApiImplicitParam(value = "支付端(1=用户APP端,2=司机APP端,3=用户小程序端)", name = "type", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil cancleOrderTaxi(Integer id, Integer orderType, Integer payType, Integer cancleId, Integer type, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } switch (orderType){ case 1: return orderPrivateCarService.cancleOrderPrivateCar(id, payType, cancleId, type); case 2: return orderTaxiService.cancleOrderTaxi(id, payType, cancleId, type); case 3: return orderCrossCityService.cancleOrderCrossCity(id, payType, cancleId, type); } return ResultUtil.success(); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 投诉操作 * @param driverId * @param reason * @param description * @param request * @return */ @ResponseBody @PostMapping("/api/taxi/complaintService") @ApiOperation(value = "添加投诉操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "司机id", name = "driverId", required = true, dataType = "int"), @ApiImplicitParam(value = "投诉原因", name = "reason", required = true, dataType = "String"), @ApiImplicitParam(value = "投诉描述", name = "description", required = true, dataType = "String"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil complaintService(Integer driverId, String reason, String description, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } complaintService.saveData(driverId, reason, description, uid); return ResultUtil.success(); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 支付页面获取可用优惠券数量和余额 * @param orderId * @param request * @return */ @ResponseBody @PostMapping("/api/taxi/queryBalance") @ApiOperation(value = "支付页面获取可用优惠券数量和余额", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "balance=余额,coupon=优惠券") @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 queryBalance(Integer orderId, Integer orderType, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } Map map = new HashMap<>(); switch (orderType){ case 1: map = orderPrivateCarService.queryBalance(orderId, uid); break; case 2: map = orderTaxiService.queryBalance(orderId, uid); break; case 3: map = orderCrossCityService.queryBalance(orderId, uid); break; case 4: map = orderLogisticsService.queryBalance(orderId, uid); break; case 5: map = orderLogisticsService.queryBalance(orderId, uid); break; } return ResultUtil.success(map); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 获取支付页面的优惠券列表 * @param orderId * @param pageNum * @param size * @param request * @return */ @ResponseBody @PostMapping("/api/taxi/queryCoupon") @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", 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 queryCoupon(Integer orderId, Integer orderType, Integer pageNum, Integer size, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } List> list = new ArrayList<>(); switch (orderType){ case 1: list = orderPrivateCarService.queryCoupon(orderId, uid, pageNum, size); break; case 2: list = orderTaxiService.queryCoupon(orderId, uid, pageNum, size); break; case 3: list = orderCrossCityService.queryCoupon(orderId, uid, pageNum, size); break; } return ResultUtil.success(CouponWarpper.getCouponWarppers(list)); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 订单完成支付订单操作 * @param payType * @param orderId * @param request * @return */ @ResponseBody @PostMapping("/api/taxi/payTaxiOrder") @ApiOperation(value = "订单完成支付订单操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "支付方式(1=微信,2=支付宝,3=余额)", name = "payType", required = true, dataType = "int"), @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=小件物流)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(value = "优惠券id", name = "couponId", required = false, dataType = "int"), @ApiImplicitParam(value = "支付端(1=用户APP端,2=司机APP端,3=用户小程序端)", name = "type", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil payTaxiOrder(Integer payType, Integer orderId, Integer orderType, Integer couponId, Integer type, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } switch (orderType){ case 1: return orderPrivateCarService.payPrivateCarOrder(payType, orderId, couponId, type); case 2: return orderTaxiService.payTaxiOrder(payType, orderId, couponId, type); case 3: return orderCrossCityService.payCrossCityOrder(payType, orderId, couponId, type); case 4: return orderLogisticsService.payLogisticsOrder(payType, orderId, type); case 5: return orderLogisticsService.payLogisticsOrder(payType, orderId, type); } return ResultUtil.success(); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 订单完成后添加评价操作 * @param orderId * @param fraction * @param content * @return */ @ResponseBody @PostMapping("/api/taxi/orderEvaluate") @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 = "评分", name = "fraction", required = true, dataType = "int"), @ApiImplicitParam(value = "评价内容", name = "content", required = false, dataType = "String"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil orderEvaluate(Integer orderId, Integer orderType, Integer fraction, String content){ try { ResultUtil resultUtil = orderEvaluateService.saveData(orderId, orderType, fraction, content); if(resultUtil.getCode() == 200){ switch (orderType){ case 1: OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); orderPrivateCar.setState(9); orderPrivateCarService.updateById(orderPrivateCar); new Thread(new Runnable() { @Override public void run() { if(pushMinistryOfTransport){//上传数据 pushMinistryOfTransportUtil.ratedPassenger(Integer.valueOf(resultUtil.getData().toString())); pushMinistryOfTransportUtil.ratedDriver(orderPrivateCar.getDriverId()); } } }).start(); break; case 2: OrderTaxi orderTaxi = orderTaxiService.selectById(orderId); orderTaxi.setState(9); orderTaxiService.updateById(orderTaxi); break; case 3: OrderCrossCity orderCrossCity = orderCrossCityService.selectById(orderId); orderCrossCity.setState(9); orderCrossCityService.updateById(orderCrossCity); break; } } return resultUtil.getCode() == 200 ? ResultUtil.success() : resultUtil; }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 评论成功后获取红包金额 * @param orderId * @return */ @ResponseBody @PostMapping("/api/taxi/queryRedMoney") @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 queryRedMoney(Integer orderId, Integer orderType){ try { switch (orderType){ case 1: return orderPrivateCarService.queryRedMoney(orderId); case 2: return orderTaxiService.queryRedMoney(orderId); case 3: return orderCrossCityService.queryRedMoney(orderId); } return ResultUtil.success(); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 分享成功后添加红包操作 * @param orderId * @return */ @ResponseBody @PostMapping("/api/taxi/shareRedEnvelope") @ApiOperation(value = "分享成功后添加红包操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil shareRedEnvelope(Integer orderId, Integer orderType){ try { switch (orderType){ case 1: return orderPrivateCarService.shareRedEnvelope(orderId); case 2: return orderTaxiService.shareRedEnvelope(orderId); case 3: return orderCrossCityService.shareRedEnvelope(orderId); } return ResultUtil.success(); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } /** * 取消订单微信回调 * @param request */ @ResponseBody @PostMapping("/base/wxCancelOrderTaxi") public void wxCancelOrderTaxi(HttpServletRequest request, HttpServletResponse response){ try { Map map = payMoneyUtil.weixinpayCallback(request); if(null != map){ String order_id = map.get("transaction_id"); String out_trade_no = map.get("out_trade_no"); String result = map.get("result"); if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id)){ PrintWriter out = response.getWriter(); out.write(result); out.flush(); out.close(); String[] split = out_trade_no.split("_"); Integer id = Integer.valueOf(split[0]); Integer type = Integer.valueOf(split[1]); switch (type){ case 1: orderPrivateCarService.payCancelOrderPrivateCar(id, order_id, 1); break; case 2: orderTaxiService.payCancelOrderTaxi(id, order_id, 1); break; case 3: orderCrossCityService.payCancelOrderCrossCity(id, order_id, 1); break; } } } // Map map = icbcPayUtil.payCallback(request); // if(null != map){ // String out_trade_no = map.get("out_trade_no"); // String order_id = map.get("order_id"); // String s = icbcPayUtil.queryTransaction("", order_id); // if(s.equals("0")){ // icbcPayUtil.answer(response);//回调应答 // } // if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id) && s.equals("0")){ // String[] split = out_trade_no.split(","); // Integer id = Integer.valueOf(split[0]); // Integer type = Integer.valueOf(split[1]); // switch (type){ // case 1: // orderPrivateCarService.payCancelOrderPrivateCar(id, order_id, 1); // break; // case 2: // orderTaxiService.payCancelOrderTaxi(id, order_id, 1); // break; // case 3: // orderCrossCityService.payCancelOrderCrossCity(id, order_id, 1); // break; // } // } // // } }catch (Exception e){ e.printStackTrace(); } } /** * 取消订单支付宝回调 * @param request */ @ResponseBody @PostMapping("/base/aliCancelOrderTaxi") public void aliCancelOrderTaxi(HttpServletRequest request, HttpServletResponse response){ try { Map map = payMoneyUtil.alipayCallback(request); if(null != map){ String out_trade_no = map.get("out_trade_no"); String order_id = map.get("trade_no"); if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id)){ String[] split = out_trade_no.split("_"); Integer id = Integer.valueOf(split[0]); Integer type = Integer.valueOf(split[1]); switch (type){ case 1: orderPrivateCarService.payCancelOrderPrivateCar(id, order_id, 2); break; case 2: orderTaxiService.payCancelOrderTaxi(id, order_id, 2); break; case 3: orderCrossCityService.payCancelOrderCrossCity(id, order_id, 2); break; } } } // Map map = icbcPayUtil.payCallback(request); // if(null != map){ // String out_trade_no = map.get("out_trade_no"); // String order_id = map.get("order_id"); // String s = icbcPayUtil.queryTransaction("", order_id); // if(s.equals("0")){ // icbcPayUtil.answer(response);//回调应答 // } // if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id) && s.equals("0")){ // String[] split = out_trade_no.split(","); // Integer id = Integer.valueOf(split[0]); // Integer type = Integer.valueOf(split[1]); // switch (type){ // case 1: // orderPrivateCarService.payCancelOrderPrivateCar(id, order_id, 2); // break; // case 2: // orderTaxiService.payCancelOrderTaxi(id, order_id, 2); // break; // case 3: // orderCrossCityService.payCancelOrderCrossCity(id, order_id, 2); // break; // } // } // // } }catch (Exception e){ e.printStackTrace(); } } /** * 完成订单微信支付回调 * @param request */ @ResponseBody @PostMapping("/base/wxPayOrderTaxi") public void wxPayOrderTaxi(HttpServletRequest request, HttpServletResponse response){ try { Map map = payMoneyUtil.weixinpayCallback(request); if(null != map){ String order_id = map.get("transaction_id"); String out_trade_no = map.get("out_trade_no"); String result = map.get("result"); if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id)){ PrintWriter out = response.getWriter(); out.write(result); out.flush(); out.close(); String[] split = out_trade_no.split("_"); Integer id = Integer.valueOf(split[0]); Integer type = Integer.valueOf(split[1]); switch (type){ case 1: orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 1); 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, 1); break; case 5: orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1); break; } } } // Map map = icbcPayUtil.payCallback(request); // if(null != map){ // String out_trade_no = map.get("out_trade_no"); // String order_id = map.get("order_id"); // String s = icbcPayUtil.queryTransaction("", order_id); // if(s.equals("0")){ // icbcPayUtil.answer(response);//回调应答 // } // if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id) && s.equals("0")){ // String[] split = out_trade_no.split(","); // Integer id = Integer.valueOf(split[0]); // Integer type = Integer.valueOf(split[1]); // switch (type){ // case 1: // orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 1); // 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, 1); // break; // case 5: // orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1); // break; // } // } // } }catch (Exception e){ e.printStackTrace(); } } /** * 完成订单支付宝支付回调 * @param request */ @ResponseBody @PostMapping("/base/aliPayOrderTaxi") public void aliPayOrderTaxi(HttpServletRequest request, HttpServletResponse response){ try { Map map = payMoneyUtil.alipayCallback(request); if(null != map){ String out_trade_no = map.get("out_trade_no"); String order_id = map.get("trade_no"); if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id)){ String[] split = out_trade_no.split("_"); Integer id = Integer.valueOf(split[0]); Integer type = Integer.valueOf(split[1]); switch (type){ case 1: orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 2); break; case 2: orderTaxiService.payOrderTaxiCallback(id, order_id, 2); break; case 3: orderCrossCityService.payOrderCrossCityCallback(id, order_id, 2); break; case 4: orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2); break; case 5: orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2); break; } } } // Map map = icbcPayUtil.payCallback(request); // if(null != map){ // String out_trade_no = map.get("out_trade_no"); // String order_id = map.get("order_id"); // String s = icbcPayUtil.queryTransaction("", order_id); // if(s.equals("0")){ // icbcPayUtil.answer(response);//回调应答 // } // if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id) && s.equals("0")){ // String[] split = out_trade_no.split(","); // Integer id = Integer.valueOf(split[0]); // Integer type = Integer.valueOf(split[1]); // switch (type){ // case 1: // orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 2); // break; // case 2: // orderTaxiService.payOrderTaxiCallback(id, order_id, 2); // break; // case 3: // orderCrossCityService.payOrderCrossCityCallback(id, order_id, 2); // break; // case 4: // orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2); // break; // case 5: // orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2); // break; // } // } // // } }catch (Exception e){ e.printStackTrace(); } } /** * 小件物流差价微信支付回调 * @param request */ @ResponseBody @PostMapping("/base/wxPayOrderLogisticsSpread") public void wxPayOrderLogisticsSpread(HttpServletRequest request, HttpServletResponse response){ try { Map map = payMoneyUtil.weixinpayCallback(request); if(null != map){ String order_id = map.get("transaction_id"); String out_trade_no = map.get("out_trade_no"); String result = map.get("result"); if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id)){ PrintWriter out = response.getWriter(); out.write(result); out.flush(); out.close(); String[] split = out_trade_no.split("_"); Integer id = Integer.valueOf(split[0]); Integer type = Integer.valueOf(split[1]); orderLogisticsService.payOrderLogisticsSpreadCallback(id, order_id, 1); } } // Map map = icbcPayUtil.payCallback(request); // if(null != map){ // String out_trade_no = map.get("out_trade_no"); // String order_id = map.get("order_id"); // String s = icbcPayUtil.queryTransaction("", order_id); // if(s.equals("0")){ // icbcPayUtil.answer(response);//回调应答 // } // if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id) && s.equals("0")){ // String[] split = out_trade_no.split(","); // Integer id = Integer.valueOf(split[0]); // Integer type = Integer.valueOf(split[1]); // orderLogisticsService.payOrderLogisticsSpreadCallback(id, order_id, 1); // } // } }catch (Exception e){ e.printStackTrace(); } } /** * 小件物流差价支付宝支付回调 * @param request */ @ResponseBody @PostMapping("/base/aliPayOrderLogisticsSpread") public void aliPayOrderLogisticsSpread(HttpServletRequest request, HttpServletResponse response){ try { Map map = payMoneyUtil.alipayCallback(request); if(null != map){ String out_trade_no = map.get("out_trade_no"); String order_id = map.get("trade_no"); if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id)){ String[] split = out_trade_no.split("_"); Integer id = Integer.valueOf(split[0]); Integer type = Integer.valueOf(split[1]); orderLogisticsService.payOrderLogisticsSpreadCallback(id, order_id, 2); } } // Map map = icbcPayUtil.payCallback(request); // if(null != map){ // String out_trade_no = map.get("out_trade_no"); // String order_id = map.get("order_id"); // String s = icbcPayUtil.queryTransaction("", order_id); // if(s.equals("0")){ // icbcPayUtil.answer(response);//回调应答 // } // if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id) && s.equals("0")){ // String[] split = out_trade_no.split(","); // Integer id = Integer.valueOf(split[0]); // Integer type = Integer.valueOf(split[1]); // orderLogisticsService.payOrderLogisticsSpreadCallback(id, order_id, 2); // } // // } }catch (Exception e){ e.printStackTrace(); } } }