package com.stylefeng.guns.modular.api; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; 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.account.server.ITEnterpriseWithdrawalService; import com.stylefeng.guns.modular.call.server.IOrderCallService; 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.dao.SystemPriceMapper; import com.stylefeng.guns.modular.system.model.*; import com.stylefeng.guns.modular.system.model.vo.UnPayOrderVO; import com.stylefeng.guns.modular.system.service.*; import com.stylefeng.guns.modular.system.util.*; import com.stylefeng.guns.modular.system.util.qianyuntong.model.QYTPaymentCallback; import com.stylefeng.guns.modular.system.warpper.*; import com.stylefeng.guns.modular.taxi.model.OrderTaxi; import com.stylefeng.guns.modular.taxi.model.PaymentRecord; import com.stylefeng.guns.modular.taxi.model.TransactionDetails; import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; 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 lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.PrintWriter; import java.text.SimpleDateFormat; import java.util.*; /** * 订单控制器(综合) */ @Api @Slf4j @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 GDMapGeocodingUtil gdMapGeocodingUtil; @Autowired private IComplaintService complaintService; @Autowired private IOrderEvaluateService orderEvaluateService; @Autowired private IOrderCrossCityService orderCrossCityService; @Autowired private IOrderLogisticsService orderLogisticsService; @Autowired private IOrderCharteredCarService orderCharteredCarService; @Autowired private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; @Autowired private ITransactionDetailsService transactionDetailsService; @Autowired private IOrderCancelService orderCancelService; @Autowired private PayMoneyUtil payMoneyUtil; @Autowired private IPaymentRecordService paymentRecordService; @Autowired private ITaxiCardService taxiCardService; @Autowired private IOrderCallService orderCallService; @Autowired private IOrderAdditionalFeeService orderAdditionalFeeService; @Autowired private IAdditionalFeeService additionalFeeService; @Autowired private ITEnterpriseWithdrawalService enterpriseWithdrawalService; @Autowired private ICompanyService companyService; @Autowired private IUserCouponRecordService userCouponRecordService; @Value("${pushMinistryOfTransport}") private boolean pushMinistryOfTransport; @Resource private SystemPriceMapper systemPriceMapper; @Resource private RedisTemplate redisTemplate; @Resource private ISystemPriceCityService systemPriceCityService; /** * 获取正在进行中的订单 * * @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()); orderStatusWarpper.setRideType(orderPrivateCar.getRideType()); 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()); orderStatusWarpper.setRideType(1); 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()); orderStatusWarpper.setRideType(3); 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=跨城小件物流,6=包车,7=助老模式)", 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, type, pageNum, size); break; case 5: list = orderLogisticsService.queryMyOrderList(uid, type, pageNum, size); break; case 6: list = orderCharteredCarService.queryMyOrderList(uid, pageNum, size); break; case 7: // list = orderCallService.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 transactionDetails = transactionDetailsService.selectList(new EntityWrapper() .eq("type", 1).eq("userType", 1).eq("userId", uid).orderBy("insertTime desc limit " + pageNum + ", " + size)); List> list = new ArrayList<>(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); for(TransactionDetails t : transactionDetails){ Map map = new HashMap<>(); map.put("money", t.getState() == 1 ? t.getMoney() : -1 * t.getMoney()); map.put("time", sdf.format(t.getInsertTime())); map.put("name", t.getRemark()); map.put("insertTime", Double.valueOf(t.getInsertTime().getTime() / 1000).intValue()); list.add(map); } List orderWarpper = TravelRecordWarpper.getTravelRecordWarpper(list); 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 = "",response = OrderInfoWarpper.class) @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, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } Map map = null; List list = new ArrayList<>(); switch (orderType){ case 1://专车 map = orderPrivateCarService.queryOrderInfo(uid, orderId); break; case 2://出租车 map = orderTaxiService.queryOrderInfo(orderId); break; case 3://跨城 map = orderCrossCityService.queryOrderInfo(orderId); break; } if(map.get("companyId") != null){ Company companyId = companyService.selectById(map.get("companyId").toString()); map.put("companyName", companyId.getName()); }else { String string = map.get("driverId").toString(); Driver driver = driverService.selectById(string); Company company = companyService.selectById(driver.getCompanyId()); map.put("companyName", company.getName()); } if(map.get("telX") != null){ map.put("driverPhone", map.get("telX")); } List orderAdditionalFees = orderAdditionalFeeService.selectList(new EntityWrapper().eq("orderType", orderType).eq("orderId", orderId)); orderAdditionalFees.forEach(orderAdditionalFee -> { AdditionalFee additionalFee = additionalFeeService.selectById(orderAdditionalFee.getAdditionalFeeId()); OrderAdditionalFeeWarpper orderAdditionalFeeWarpper = new OrderAdditionalFeeWarpper(); orderAdditionalFeeWarpper.setName(additionalFee.getName()); orderAdditionalFeeWarpper.setAdditionalFee(orderAdditionalFee.getAmount()); list.add(orderAdditionalFeeWarpper); }); OrderInfoWarpper orderInfoWarpper = OrderInfoWarpper.getOrderInfoWarpper(map, list); orderType = orderInfoWarpper.getOrderType(); if(orderType==1){ if(orderInfoWarpper.getPid()!=0){ orderId=orderInfoWarpper.getPid(); } List> orderList= orderPrivateCarService.queryOrderInfo2(orderId,4,null,null); if(!orderList.isEmpty()){ orderInfoWarpper.setMeetOrderList(JSON.parseArray(JSON.toJSONString(orderList), OrderCrossCityInfoWrapper.class)); }else{ orderInfoWarpper.setMeetOrderList(new ArrayList<>()); } orderList= orderPrivateCarService.queryOrderInfo2(orderId,6,null,null); if(orderInfoWarpper.getState()>1 && orderInfoWarpper.getDriverId()!=0){ String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(orderInfoWarpper.getDriverId())); if(value==null || value.equals("")){ if(orderList.isEmpty()){ orderList= orderPrivateCarService.queryOrderInfo2(orderId,5,"0","0"); }else{ List> orderList1 = orderPrivateCarService.queryOrderInfo2(orderId,5,"0","0"); if(!orderList1.isEmpty()){ orderList.addAll(orderList1); } } }else{ if(orderList.isEmpty()){ orderList= orderPrivateCarService.queryOrderInfo2(orderId,5,value.split(",")[0],value.split(",")[1]); }else{ List> orderList1 = orderPrivateCarService.queryOrderInfo2(orderId,5,value.split(",")[0],value.split(",")[1]); if(!orderList1.isEmpty()){ orderList.addAll(orderList1); } } } } if(!orderList.isEmpty()){ orderInfoWarpper.setGiveOrderList(JSON.parseArray(JSON.toJSONString(orderList), OrderCrossCityInfoWrapper.class)); }else{ orderInfoWarpper.setGiveOrderList(new ArrayList<>()); } OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); if(orderPrivateCar.getState()>1) { Map geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getStartLon().toString(), orderPrivateCar.getStartLat().toString()); String provinceCode = geocode.get("provinceCode"); String cityCode = geocode.get("cityCode"); String districtCode = geocode.get("districtCode"); //获取匹配的城市价格配置 SystemPriceCity systemPriceCity = systemPriceCityService.queryOne(provinceCode, cityCode, districtCode); if (null == systemPriceCity) { return ResultUtil.error("请先配置价格规则"); } Map query1 = systemPriceMapper.query(orderPrivateCar.getCompanyId(), 1, orderPrivateCar.getServerCarModelId(), systemPriceCity.getId()); System.out.println("参数:" + orderPrivateCar.getCompanyId() + "|" + orderPrivateCar.getServerCarModelId()); System.out.println("query1:" + query1); //开始根据不同的方式计算金额 if (query1 != null) { JSONObject jsonObject = JSON.parseObject(query1.get("content").toString());//等待费 JSONObject contentPutOne = JSON.parseObject(query1.get("contentPutOne").toString());//一人拼成 JSONObject contentNotOne = JSON.parseObject(query1.get("contentNotOne").toString());//一人未拼成 JSONObject contentPutTwo = JSON.parseObject(query1.get("contentPutTwo").toString());//2人拼成 JSONObject contentNotTwo = JSON.parseObject(query1.get("contentNotTwo").toString());//2人未拼成 JSONObject contentPutThree = JSON.parseObject(query1.get("contentPutThree").toString());//3人拼成 JSONObject contentNotThree = JSON.parseObject(query1.get("contentNotThree").toString());//3人未拼成 JSONObject contentExclusive = JSON.parseObject(query1.get("contentExclusive").toString());//独享 JSONObject contentPrice = JSON.parseObject(query1.get("contentPrice").toString());//一口价 //一口价 orderInfoWarpper.setFareTypeNote1(query1.get("fareTypeNote1").toString()); orderInfoWarpper.setFareTypeNote2(query1.get("fareTypeNote2").toString()); orderInfoWarpper.setFareTypeNote3(query1.get("fareTypeNote3").toString()); orderInfoWarpper.setContentPutOne(contentPutOne); orderInfoWarpper.setContentNotOne(contentNotOne); orderInfoWarpper.setContentPutTwo(contentPutTwo); orderInfoWarpper.setContentNotTwo(contentNotTwo); orderInfoWarpper.setContentPutThree(contentPutThree); orderInfoWarpper.setContentNotThree(contentNotThree); orderInfoWarpper.setContentExclusive(contentExclusive); orderInfoWarpper.setContentPrice(contentPrice); } }else{ orderInfoWarpper.setContentPutOne(new JSONObject()); orderInfoWarpper.setContentNotOne(new JSONObject()); orderInfoWarpper.setContentPutTwo(new JSONObject()); orderInfoWarpper.setContentNotTwo(new JSONObject()); orderInfoWarpper.setContentPutThree(new JSONObject()); orderInfoWarpper.setContentNotThree(new JSONObject()); orderInfoWarpper.setContentExclusive(new JSONObject()); orderInfoWarpper.setContentPrice(new JSONObject()); } }else{ orderInfoWarpper.setContentPutOne(new JSONObject()); orderInfoWarpper.setContentNotOne(new JSONObject()); orderInfoWarpper.setContentPutTwo(new JSONObject()); orderInfoWarpper.setContentNotTwo(new JSONObject()); orderInfoWarpper.setContentPutThree(new JSONObject()); orderInfoWarpper.setContentNotThree(new JSONObject()); orderInfoWarpper.setContentExclusive(new JSONObject()); orderInfoWarpper.setContentPrice(new JSONObject()); } String arriveTime = orderInfoWarpper.getArriveTime(); if(ToolUtil.isNotEmpty(arriveTime)){ orderInfoWarpper.setTime(arriveTime.substring(11,arriveTime.length()-3)); } return ResultUtil.success(orderInfoWarpper); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } @ResponseBody @PostMapping("/api/order/addAppeal") @ApiOperation(value = "发起申诉", tags = {"用户端-服务中"}, notes = "",response = OrderInfoWarpper.class) @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(value = "申诉描述", name = "abnormalIntro", required = true, dataType = "String"), @ApiImplicitParam(value = "申诉图片", name = "abnormalImg", required = true, dataType = "String"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil addAppeal(Integer orderId, Integer orderType,String abnormalIntro, String abnormalImg, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } switch (orderType){ case 1://专车 orderPrivateCarService.addAppeal(uid, orderId,abnormalIntro,abnormalImg); break; case 2://出租车 orderTaxiService.addAppeal(uid,orderId,abnormalIntro,abnormalImg); break; case 3://跨城 orderCrossCityService.addAppeal(uid,orderId,abnormalIntro,abnormalImg); break; } return ResultUtil.success(); }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; List list = new ArrayList<>(); switch (orderType){ case 1://专车 map = orderPrivateCarService.queryOrderInfo(null, 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")); } List orderAdditionalFees = orderAdditionalFeeService.selectList(new EntityWrapper().eq("orderType", orderType).eq("orderId", orderId)); orderAdditionalFees.forEach(orderAdditionalFee -> { AdditionalFee additionalFee = additionalFeeService.selectById(orderAdditionalFee.getAdditionalFeeId()); OrderAdditionalFeeWarpper orderAdditionalFeeWarpper = new OrderAdditionalFeeWarpper(); orderAdditionalFeeWarpper.setName(additionalFee.getName()); orderAdditionalFeeWarpper.setAdditionalFee(orderAdditionalFee.getAmount()); list.add(orderAdditionalFeeWarpper); }); return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map, list)); }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, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } Map map = null; List list = new ArrayList<>(); switch (orderType) { case 1://专车 map = orderPrivateCarService.queryOrderInfo(uid, 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; } if(null != map.get("telX")){ map.put("driverPhone", map.get("telX")); } List orderAdditionalFees = orderAdditionalFeeService.selectList(new EntityWrapper().eq("orderType", orderType).eq("orderId", orderId)); orderAdditionalFees.forEach(orderAdditionalFee -> { AdditionalFee additionalFee = additionalFeeService.selectById(orderAdditionalFee.getAdditionalFeeId()); OrderAdditionalFeeWarpper orderAdditionalFeeWarpper = new OrderAdditionalFeeWarpper(); orderAdditionalFeeWarpper.setName(additionalFee.getName()); orderAdditionalFeeWarpper.setAdditionalFee(orderAdditionalFee.getAmount()); list.add(orderAdditionalFeeWarpper); }); return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map, list)); }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 request * @return */ @ResponseBody @PostMapping("/api/taxi/queryBalance1") @ApiOperation(value = "1.0-支付页面获取余额和优惠数据", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-小件物流"}) @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 queryBalance1(Integer orderId, Integer orderType, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } PreferentialDataVo map = new PreferentialDataVo(); switch (orderType){ case 1: map = orderPrivateCarService.queryBalance1(orderId, uid); break; case 2: map = orderTaxiService.queryBalance1(orderId, uid); break; case 3: map = orderCrossCityService.queryBalance1(orderId, uid); break; case 4: map = orderLogisticsService.queryBalance1(orderId, uid); break; case 5: map = orderLogisticsService.queryBalance1(orderId, uid); break; case 6: map = orderCharteredCarService.queryBalance1(orderId, uid); break; case 7: // map = orde.queryBalance1(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(); } } @ResponseBody @PostMapping("/api/taxi/queryCouponList") @ApiOperation(value = "1.0-获取支付页面的优惠券和打车卡列表", 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", 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> queryCouponList(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.queryCouponList(orderId, uid, pageNum, size); break; case 2: list = orderTaxiService.queryCouponList(orderId, uid, pageNum, size); break; case 3: list = orderCrossCityService.queryCouponList(orderId, uid, pageNum, size); break; case 4: list = orderLogisticsService.queryCouponList(orderId, uid, pageNum, size); break; case 5: list = orderLogisticsService.queryCouponList(orderId, uid, pageNum, size); break; } return ResultUtil.success(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(); } } @ResponseBody @PostMapping("/api/taxi/payTaxiOrder1") @ApiOperation(value = "1.0-订单完成支付订单操作", 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 = "objectId", required = false, dataType = "int"), @ApiImplicitParam(value = "数据类型(1=优惠券,2=打车卡)", name = "objectType", 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 payTaxiOrder1(Integer payType, Integer orderId, Integer orderType, Integer objectId, Integer objectType, Integer type, HttpServletRequest request){ System.out.println(objectType); System.out.println(objectId); try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } switch (orderType){ case 1: return orderPrivateCarService.payPrivateCarOrder1(payType, orderId, objectId, objectType, type); case 2: return orderTaxiService.payTaxiOrder1(payType, orderId, objectId, objectType, type); case 3: return orderCrossCityService.payCrossCityOrder1(payType, orderId, objectId, objectType, type); case 4: return orderLogisticsService.payLogisticsOrder1(payType, orderId, objectId, objectType, type); case 5: return orderLogisticsService.payLogisticsOrder1(payType, orderId, objectId, objectType, 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; } } // cloudPay(map.get("total_fee"),map.get("transaction_id"),1); } }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; } PrintWriter out = response.getWriter(); out.print("success"); out.flush(); out.close(); } // cloudPay(map.get("total_amount"),map.get("trade_no"),0); } }catch (Exception e){ e.printStackTrace(); } } /** * 完成订单微信支付回调 * @param request */ @ResponseBody @PostMapping("/base/wxPayOrderTaxi") public void wxPayOrderTaxi(HttpServletRequest request, HttpServletResponse response){ try { System.out.println("完成订单微信支付回调"); Map map = payMoneyUtil.weixinpayCallback(request); System.out.println("wx支付信息:"+map); if(null != map){ String order_id = map.get("transaction_id"); String out_trade_no = map.get("out_trade_no"); String result = map.get("result"); String total_fee = map.get("total_fee"); String transaction_id = map.get("transaction_id"); 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,0); break; case 3: orderCrossCityService.payOrderCrossCityCallback(id, order_id, 1,null); break; case 4: orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1); break; case 5: orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1); break; } } // cloudPay(map.get("total_fee"),map.get("transaction_id"),1); } }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,0); break; case 3: orderCrossCityService.payOrderCrossCityCallback(id, order_id, 2,null); break; case 4: orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2); break; case 5: orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2); break; } PrintWriter out = response.getWriter(); out.print("success"); out.flush(); out.close(); } // cloudPay(map.get("total_amount"),map.get("trade_no"),0); } }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); } // cloudPay(map.get("total_fee"),map.get("transaction_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); PrintWriter out = response.getWriter(); out.print("success"); out.flush(); out.close(); } // cloudPay(map.get("total_amount"),map.get("trade_no"),0); } }catch (Exception e){ e.printStackTrace(); } } /** * 取消订单微信退款成功回调 * @param request * @param response */ @ResponseBody @PostMapping("/base/cancleOrderWXPay") public void cancleOrderWXPay(HttpServletRequest request, HttpServletResponse response){ try { System.out.println("小件物流取消"); Map map = payMoneyUtil.wxRefundCallback(request); if(null != map){ String order_id = map.get("refund_id"); String out_refund_no = map.get("out_refund_no"); String result = map.get("result"); if(ToolUtil.isNotEmpty(out_refund_no) && ToolUtil.isNotEmpty(order_id)){ PrintWriter out = response.getWriter(); out.write(result); out.flush(); out.close(); String[] split = out_refund_no.split("_"); Integer id = Integer.valueOf(split[0]); Integer type = Integer.valueOf(split[1]); System.out.println("取消回调:"+type); switch (type){ case 1: break; case 2: break; case 3: OrderCrossCity orderCrossCity = orderCrossCityService.selectById(id); PaymentRecord query = paymentRecordService.query(1, orderCrossCity.getUserId(), 1, id, 3, orderCrossCity.getPayType(), 2); //添加交易明细 transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城出行取消退款", query.getAmount(), 1, 1, 1, 3, id); UserCouponRecord userCouponRecord = userCouponRecordService.selectById(orderCrossCity.getCouponId()); userCouponRecord.setState(1); userCouponRecordService.updateById(userCouponRecord); orderCrossCity.setCouponMoney(0.00); orderCrossCityService.updateById(orderCrossCity); break; case 4: OrderLogistics orderLogistics1 = orderLogisticsService.selectById(id); PaymentRecord query1 = paymentRecordService.query(1, orderLogistics1.getUserId(), 1, id, 4, orderLogistics1.getPayType(), 2); //添加交易明细 transactionDetailsService.saveData(orderLogistics1.getUserId(), "同城小件物流取消退款", query1.getAmount(), 1, 1, 1, 4, id); UserCouponRecord userCouponRecord1 = userCouponRecordService.selectById(orderLogistics1.getCouponId()); userCouponRecord1.setState(1); userCouponRecordService.updateById(userCouponRecord1); orderLogistics1.setCouponMoney(0.00); orderLogisticsService.updateById(orderLogistics1); break; case 5: OrderLogistics orderLogistics2 = orderLogisticsService.selectById(id); PaymentRecord query2 = paymentRecordService.query(1, orderLogistics2.getUserId(), 1, id, 5, orderLogistics2.getPayType(), 2); //添加交易明细 transactionDetailsService.saveData(orderLogistics2.getUserId(), "跨城小件物流取消退款", query2.getAmount(), 1, 1, 1, 5, id); UserCouponRecord userCouponRecord2 = userCouponRecordService.selectById(orderLogistics2.getCouponId()); userCouponRecord2.setState(1); userCouponRecordService.updateById(userCouponRecord2); orderLogistics2.setCouponMoney(0.00); orderLogisticsService.updateById(orderLogistics2); break; } } // cloudPay(map.get("total_fee"),map.get("transaction_id"),1); } }catch (Exception e){ e.printStackTrace(); } } /** * 购买出行卡微信支付回调 * @param request * @param response */ @ResponseBody @PostMapping("/base/wxPayTaxiCardPaymentSpread") public void wxPayTaxiCardPaymentSpread(HttpServletRequest request, HttpServletResponse response){ try { System.out.println("购买出行卡微信支付回调"); Map map = payMoneyUtil.weixinpayCallback(request); System.out.println("购买出行卡微信支付回调"+map); if(null != map){ String order_id = map.get("transaction_id"); String out_trade_no = map.get("out_trade_no"); String result = map.get("result"); System.out.println(out_trade_no+"_"+order_id); if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id)){ PrintWriter out = response.getWriter(); out.write(result); out.flush(); out.close(); taxiCardService.payTaxiCardPaymentSpread(Integer.valueOf(out_trade_no), order_id); } // cloudPay(map.get("total_fee"),map.get("transaction_id"),1); } }catch (Exception e){ e.printStackTrace(); } } /** * 购买出行卡支付宝支付回调 * @param request * @param response */ @ResponseBody @PostMapping("/base/aliPayTaxiCardPaymentSpread") public void aliPayTaxiCardPaymentSpread(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)){ taxiCardService.payTaxiCardPaymentSpread(Integer.valueOf(out_trade_no), order_id); PrintWriter out = response.getWriter(); out.print("success"); out.flush(); out.close(); } // cloudPay(map.get("total_amount"),map.get("trade_no"),0); } }catch (Exception e){ e.printStackTrace(); } } @ResponseBody @PostMapping("/api/taxi/payThankYouFee") @ApiOperation(value = "1.0-支付感谢费", 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=同城小件物流,5=跨城小件物流,6=包车,7=助老模式)", name = "orderType", required = true, dataType = "int"), @ApiImplicitParam(value = "支付金额", name = "money", required = true, dataType = "double"), @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 payThankYouFee(Integer orderId, Integer orderType, Double money, Integer payType, Integer type, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } switch (orderType){ case 1: return orderPrivateCarService.payThankYouFee(uid, orderId, money, payType, type); case 2: return orderTaxiService.payThankYouFee(uid, orderId, money, payType, type); case 3: return orderCrossCityService.payThankYouFee(uid, orderId, money, payType, type); case 4: return orderLogisticsService.payThankYouFee(uid, orderId, money, payType, type); case 5: return orderLogisticsService.payThankYouFee(uid, orderId, money, payType, type); case 6: return orderCharteredCarService.payThankYouFee(uid, orderId, money, payType, type); case 7: return orderCallService.payThankYouFee(uid, orderId, money, payType, type); } }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } return ResultUtil.success(); } /** * 感谢费支付回调 * @param request * @param response */ @ResponseBody @PostMapping("/base/wxPayThankYouFee") public void wxPayThankYouFee(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[] s = out_trade_no.split("_"); switch (Integer.valueOf(s[1])){ case 1: orderPrivateCarService.payThankYouFeeCallback(Integer.valueOf(s[0]), order_id, 1); case 2: orderTaxiService.payThankYouFeeCallback(Integer.valueOf(s[0]), order_id, 1); case 3: orderCrossCityService.payThankYouFeeCallback(Integer.valueOf(s[0]), order_id, 1); case 4: orderLogisticsService.payThankYouFeeCallback(Integer.valueOf(s[0]), order_id, 1); case 5: orderLogisticsService.payThankYouFeeCallback(Integer.valueOf(s[0]), order_id, 1); case 6: orderCharteredCarService.payThankYouFeeCallback(Integer.valueOf(s[0]), order_id, 1); case 7: orderCallService.payThankYouFeeCallback(Integer.valueOf(s[0]), order_id, 1); } } // cloudPay(map.get("total_fee"),map.get("transaction_id"),1); } }catch (Exception e){ e.printStackTrace(); } } /** * 感谢费支付宝支付回调 * @param request * @param response */ @ResponseBody @PostMapping("/base/aliPayThankYouFee") public void aliPayThankYouFee(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[] s = out_trade_no.split("_"); switch (Integer.valueOf(s[1])){ case 1: orderPrivateCarService.payThankYouFeeCallback(Integer.valueOf(s[0]), order_id, 2); case 2: orderTaxiService.payThankYouFeeCallback(Integer.valueOf(s[0]), order_id, 2); case 3: orderCrossCityService.payThankYouFeeCallback(Integer.valueOf(s[0]), order_id, 2); case 4: orderLogisticsService.payThankYouFeeCallback(Integer.valueOf(s[0]), order_id, 2); case 5: orderLogisticsService.payThankYouFeeCallback(Integer.valueOf(s[0]), order_id, 2); case 6: orderCharteredCarService.payThankYouFeeCallback(Integer.valueOf(s[0]), order_id, 2); case 7: orderCallService.payThankYouFeeCallback(Integer.valueOf(s[0]), order_id, 2); } PrintWriter out = response.getWriter(); out.print("success"); out.flush(); out.close(); } // cloudPay(map.get("total_amount"),map.get("trade_no"),0); } }catch (Exception e){ e.printStackTrace(); } } /** * 管理后台推单 * * @param orderType * @return */ @ResponseBody @PostMapping("/base/taxi/pushOrder") public ResultUtil pushOrder(Integer orderId, Integer orderType) { try { switch (orderType) { case 1: return orderPrivateCarService.pushOrderPrivateCar(orderId); case 2: return orderTaxiService.pushOrderTaxi(orderId); } return ResultUtil.success(); } catch (Exception e) { e.printStackTrace(); return ResultUtil.runErr(); } } /** * 黔云通支付回调通知 * * @param qytPaymentCallback * @return */ @ResponseBody @PostMapping("/base/order/qytPaymentCallback") public String qytPaymentCallback(@RequestBody QYTPaymentCallback qytPaymentCallback) { log.info("【黔云通支付回调通知】请求参数:" + JSON.toJSONString(qytPaymentCallback)); if (null == qytPaymentCallback) { return "error"; } return "success"; } @ResponseBody @PostMapping("/api/get/unPayOrder") @ApiOperation(value = "获取未支付订单", tags = {"用户端-首页"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=小件物流,null=全部)", name = "orderType", required = false, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil getUnPayOrder( Integer orderType, HttpServletRequest request){ try { // 从Redis中获取当前用户ID Integer uid = userInfoService.getUserIdFormRedis(request); if (null == uid) { return ResultUtil.tokenErr(); } List unpaidOrders = new ArrayList<>(); // 根据订单类型查询对应未支付订单 if (orderType == null || orderType == 1) { // 查询未支付的专车订单 List privateCarOrders = orderPrivateCarService.getUnpayPrivateOrders(uid); unpaidOrders.addAll(privateCarOrders); } if (orderType == null || orderType == 2) { // 查询未支付的出租车订单 List taxiOrders = orderTaxiService.getUnpayTaxiOrders(uid); unpaidOrders.addAll(taxiOrders); } if (orderType == null || orderType == 3) { // 查询未支付的跨城订单 List crossCityOrders = orderCrossCityService.getUnpayCrossCityOrders(uid); unpaidOrders.addAll(crossCityOrders); } if (orderType == null || orderType == 4 || orderType == 5) { // 查询未支付的物流订单(包含类型4和5) List logisticsOrders = orderLogisticsService.getUnpayLogisticsOrders(uid); unpaidOrders.addAll(logisticsOrders); } // 按创建时间倒序排序(最新的订单在前) unpaidOrders.sort(Comparator.comparing(UnPayOrderVO::getInsertTime).reversed()); Map result = new HashMap<>(); result.put("total", unpaidOrders.size()); result.put("orders", unpaidOrders); return ResultUtil.success(result); } catch (Exception e) { e.printStackTrace(); return ResultUtil.runErr(); } } }