| | |
| | | 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.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.AdditionalFee; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.OrderAdditionalFee; |
| | | import com.stylefeng.guns.modular.system.model.OfflineTravelPayment; |
| | | import com.stylefeng.guns.modular.system.model.OrderEvaluate; |
| | | 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.util.LiuZhouBank.PayUtil; |
| | | import com.stylefeng.guns.modular.system.util.LiuZhouBank.ResultNotification; |
| | | import com.stylefeng.guns.modular.system.warpper.*; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | |
| | | * 订单控制器(综合) |
| | | */ |
| | | @Api |
| | | //@CrossOrigin |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class OrderController { |
| | |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | @Autowired |
| | | private ICBCPayUtil icbcPayUtil; |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | @Autowired |
| | |
| | | private IOrderCancelService orderCancelService; |
| | | |
| | | @Autowired |
| | | private IOfflineTravelPaymentService offlineTravelPaymentService; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Autowired |
| | | private IPaymentRecordService paymentRecordService; |
| | | |
| | | @Autowired |
| | | private ITaxiCardService taxiCardService; |
| | | |
| | | @Autowired |
| | | private IOrderCallService orderCallService; |
| | | |
| | | @Autowired |
| | | private IOrderAdditionalFeeService orderAdditionalFeeService; |
| | | |
| | | @Autowired |
| | | private IAdditionalFeeService additionalFeeService; |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | |
| | | @PostMapping("/api/order/queryMyOrderList") |
| | | @ApiOperation(value = "获取个人中心订单列表", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单类型(1=专车/快车,2=出租车,3=机场专线,7=景区直通车,8=公务出行)", name = "type", required = true, dataType = "int"), |
| | | @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.....") |
| | |
| | | list = orderCrossCityService.queryMyOrderList(uid, pageNum, size); |
| | | break; |
| | | case 4: |
| | | list = orderLogisticsService.queryMyOrderList(uid, type, pageNum, size); |
| | | list = orderLogisticsService.queryMyOrderList(uid, 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)); |
| | |
| | | } |
| | | Integer page = pageNum; |
| | | pageNum = (pageNum - 1) * size; |
| | | List<TransactionDetails> transactionDetails = transactionDetailsService.selectList(new EntityWrapper<TransactionDetails>() |
| | | .eq("type", 1).eq("userType", 1).eq("userId", uid).orderBy("insertTime desc limit " + pageNum + ", " + size)); |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | List<Map<String, Object>> maps = orderCancelService.queryCancel(uid, 2); |
| | | List<Map<String, Object>> list = orderPrivateCarService.queryMyTravelRecord(uid);//专车 |
| | | List<Map<String, Object>> list1 = orderTaxiService.queryMyTravelRecord(uid);//出租车 |
| | | List<Map<String, Object>> list2 = orderCrossCityService.queryMyTravelRecord(uid);//跨城车 |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryMyTravelRecord(uid);//小件物流 |
| | | List<TransactionDetails> transactionDetails = transactionDetailsService.selectList(new EntityWrapper<TransactionDetails>().eq("state", 1) |
| | | .eq("type", 1).eq("userType", 1).eq("userId", uid)); |
| | | List<Map<String, Object>> list4 = new ArrayList<>(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | for(TransactionDetails t : transactionDetails){ |
| | | for(TransactionDetails transactionDetails1 : transactionDetails){ |
| | | Map<String, Object> 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); |
| | | 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<TravelRecordWarpper> 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(); |
| | |
| | | @ApiOperation(value = "发票页获取订单列表", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单开票状态(1=未开票,2=其他)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车/快车,2=出租车,3=机场专线,7=景区直通车,8=公务出行)", name = "orderType", required = false, 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"), |
| | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Resource |
| | | private SystemPriceMapper systemPriceMapper; |
| | | |
| | | /** |
| | | * 获取服务中的详情数据 |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryOrderInfo") |
| | | @ApiOperation(value = "获取服务中的详情数据", tags = {"用户端-服务中"}, notes = "",response = OrderInfoWarpper.class) |
| | | @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<OrderInfoWarpper> queryOrderInfo(Integer orderId, Integer orderType){ |
| | | try { |
| | | Map<String, Object> map = null; |
| | | List<OrderAdditionalFeeWarpper> list = new ArrayList<>(); |
| | | switch (orderType){ |
| | | case 1://专车 |
| | | map = orderPrivateCarService.queryOrderInfo(orderId); |
| | |
| | | if(map.get("telX") != null){ |
| | | map.put("driverPhone", map.get("telX")); |
| | | } |
| | | List<OrderAdditionalFee> orderAdditionalFees = orderAdditionalFeeService.selectList(new EntityWrapper<OrderAdditionalFee>().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); |
| | | if(orderType==1){ |
| | | |
| | | if(orderInfoWarpper.getPid()!=0){ |
| | | orderId=orderInfoWarpper.getPid(); |
| | | } |
| | | List<Map<String, Object>> 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 = redisUtil.getValue("DRIVER" + String.valueOf(orderInfoWarpper.getDriverId())); |
| | | if(value==null || value.equals("")){ |
| | | if(orderList.isEmpty()){ |
| | | orderList= orderPrivateCarService.queryOrderInfo2(orderId,5,"0","0"); |
| | | }else{ |
| | | List<Map<String, Object>> 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<Map<String, Object>> 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<String, Object> query1 = systemPriceMapper.query(orderPrivateCar.getCompanyId(), 1, orderPrivateCar.getServerCarModelId()); |
| | | //开始根据不同的方式计算金额 |
| | | 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()); |
| | | } |
| | | return ResultUtil.success(orderInfoWarpper); |
| | | return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/queryOrderInfo_") |
| | | @ApiOperation(value = "获取服务中的详情数据", tags = {"分享专用"}, notes = "") |
| | | @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<OrderInfoWarpper> queryOrderInfo_(Integer orderId, Integer orderType){ |
| | | try { |
| | | Map<String, Object> map = null; |
| | | List<OrderAdditionalFeeWarpper> list = new ArrayList<>(); |
| | | switch (orderType){ |
| | | case 1://专车 |
| | | map = orderPrivateCarService.queryOrderInfo(orderId); |
| | |
| | | if(null != map.get("telX")){ |
| | | map.put("driverPhone", map.get("telX")); |
| | | } |
| | | List<OrderAdditionalFee> orderAdditionalFees = orderAdditionalFeeService.selectList(new EntityWrapper<OrderAdditionalFee>().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)); |
| | | |
| | | return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | public ResultUtil<OrderInfoWarpper> queryCancelPage(Integer orderId, Integer orderType){ |
| | | try { |
| | | Map<String, Object> map = null; |
| | | List<OrderAdditionalFeeWarpper> list = new ArrayList<>(); |
| | | switch (orderType) { |
| | | case 1://专车 |
| | | map = orderPrivateCarService.queryOrderInfo(orderId); |
| | |
| | | map.put("cancelPayMoney", r.getData().getAmount()); |
| | | break; |
| | | } |
| | | if(null != map.get("telX")){ |
| | | map.put("driverPhone", map.get("telX")); |
| | | } |
| | | List<OrderAdditionalFee> orderAdditionalFees = orderAdditionalFeeService.selectList(new EntityWrapper<OrderAdditionalFee>().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)); |
| | | return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | |
| | | |
| | | /** |
| | | * 添加取消记录 |
| | | * @param id |
| | | * @param reason |
| | | * @param remark |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/taxi/addCancle1") |
| | | @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 addCancle1(Integer id, Integer orderType, String reason, String remark){ |
| | | try { |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.addCancle(id, reason, remark, null); |
| | | case 2: |
| | | return orderTaxiService.addCancle(id, reason, remark, null); |
| | | case 3: |
| | | return orderCrossCityService.addCancle(id, reason, remark, null); |
| | | case 4: |
| | | return orderLogisticsService.addCancle(id, reason, remark, null); |
| | | case 5: |
| | | return orderLogisticsService.addCancle(id, reason, remark, null); |
| | | case 6: |
| | | return orderCharteredCarService.addCancle(id, reason, remark, null); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 取消操作支付 |
| | | * @param id |
| | | * @param payType |
| | |
| | | |
| | | |
| | | /** |
| | | * 支付页面获取余额和优惠数据 |
| | | * @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<PreferentialDataVo> 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 |
| | |
| | | |
| | | |
| | | |
| | | @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<List<CouponsListVo>> queryCouponList(Integer orderId, Integer orderType, Integer pageNum, Integer size, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<CouponsListVo> 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 |
| | |
| | | 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){ |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | try { |
| | | Map<String, String> 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 transaction_id = map.get("transaction_id"); |
| | | |
| | | String[] split = out_trade_no.split("_"); |
| | | Integer id = Integer.valueOf(split[0]); |
| | | Integer type = Integer.valueOf(split[1]); |
| | | String substring = out_trade_no.substring(17); |
| | | Integer type = Integer.valueOf(substring.substring(0, 1)); |
| | | Integer id = Integer.valueOf(substring.substring(1)); |
| | | switch (type){ |
| | | case 1: |
| | | orderPrivateCarService.payCancelOrderPrivateCar(id, order_id, 1); |
| | | orderPrivateCarService.payCancelOrderPrivateCar(id, transaction_id, 1); |
| | | break; |
| | | case 2: |
| | | orderTaxiService.payCancelOrderTaxi(id, order_id, 1); |
| | | orderTaxiService.payCancelOrderTaxi(id, transaction_id, 1); |
| | | break; |
| | | case 3: |
| | | orderCrossCityService.payCancelOrderCrossCity(id, order_id, 1); |
| | | orderCrossCityService.payCancelOrderCrossCity(id, transaction_id, 1); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | String result = map.get("result"); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print(result); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | Map<String, String> 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]); |
| | | String trade_no = map.get("trade_no"); |
| | | |
| | | String substring = out_trade_no.substring(17); |
| | | Integer type = Integer.valueOf(substring.substring(0, 1)); |
| | | Integer id = Integer.valueOf(substring.substring(1)); |
| | | switch (type){ |
| | | case 1: |
| | | orderPrivateCarService.payCancelOrderPrivateCar(id, order_id, 2); |
| | | orderPrivateCarService.payCancelOrderPrivateCar(id, trade_no, 2); |
| | | break; |
| | | case 2: |
| | | orderTaxiService.payCancelOrderTaxi(id, order_id, 2); |
| | | orderTaxiService.payCancelOrderTaxi(id, trade_no, 2); |
| | | break; |
| | | case 3: |
| | | orderCrossCityService.payCancelOrderCrossCity(id, order_id, 2); |
| | | orderCrossCityService.payCancelOrderCrossCity(id, trade_no, 2); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("success"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | try { |
| | | Map<String, String> 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 transaction_id = map.get("transaction_id"); |
| | | |
| | | String[] split = out_trade_no.split("_"); |
| | | Integer id = Integer.valueOf(split[0]); |
| | | Integer type = Integer.valueOf(split[1]); |
| | | String substring = out_trade_no.substring(17); |
| | | Integer type = Integer.valueOf(substring.substring(0, 1)); |
| | | Integer id = Integer.valueOf(substring.substring(1)); |
| | | switch (type){ |
| | | case 1: |
| | | orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 1); |
| | | orderPrivateCarService.payOrderPrivateCarCallback(id, transaction_id, 1); |
| | | break; |
| | | case 2: |
| | | orderTaxiService.payOrderTaxiCallback(id, order_id, 1); |
| | | orderTaxiService.payOrderTaxiCallback(id, transaction_id, 1); |
| | | break; |
| | | case 3: |
| | | orderCrossCityService.payOrderCrossCityCallback(id, order_id, 1); |
| | | orderCrossCityService.payOrderCrossCityCallback(id, transaction_id, 1); |
| | | break; |
| | | case 4: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1); |
| | | orderLogisticsService.payOrderLogisticsCallback(id, transaction_id, 1); |
| | | break; |
| | | case 5: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1); |
| | | orderLogisticsService.payOrderLogisticsCallback(id, transaction_id, 1); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | String result = map.get("result"); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print(result); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | Map<String, String> 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]); |
| | | String trade_no = map.get("trade_no"); |
| | | |
| | | String substring = out_trade_no.substring(17); |
| | | Integer type = Integer.valueOf(substring.substring(0, 1)); |
| | | Integer id = Integer.valueOf(substring.substring(1)); |
| | | switch (type){ |
| | | case 1: |
| | | orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 2); |
| | | orderPrivateCarService.payOrderPrivateCarCallback(id, trade_no, 2); |
| | | break; |
| | | case 2: |
| | | orderTaxiService.payOrderTaxiCallback(id, order_id, 2); |
| | | orderTaxiService.payOrderTaxiCallback(id, trade_no, 2); |
| | | break; |
| | | case 3: |
| | | orderCrossCityService.payOrderCrossCityCallback(id, order_id, 2); |
| | | orderCrossCityService.payOrderCrossCityCallback(id, trade_no, 2); |
| | | break; |
| | | case 4: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2); |
| | | orderLogisticsService.payOrderLogisticsCallback(id, trade_no, 2); |
| | | break; |
| | | case 5: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2); |
| | | orderLogisticsService.payOrderLogisticsCallback(id, trade_no, 2); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("success"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | if(null != map){ |
| | | String order_id = map.get("transaction_id"); |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String transaction_id = map.get("transaction_id"); |
| | | |
| | | String substring = out_trade_no.substring(17); |
| | | Integer type = Integer.valueOf(substring.substring(0, 1)); |
| | | Integer id = Integer.valueOf(substring.substring(1)); |
| | | |
| | | orderLogisticsService.payOrderLogisticsSpreadCallback(id, transaction_id, 1); |
| | | |
| | | String result = map.get("result"); |
| | | if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id)){ |
| | | PrintWriter out = response.getWriter(); |
| | | out.write(result); |
| | | out.print(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); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | Map<String, String> 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); |
| | | } |
| | | String trade_no = map.get("trade_no"); |
| | | |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | String substring = out_trade_no.substring(17); |
| | | Integer type = Integer.valueOf(substring.substring(0, 1)); |
| | | Integer id = Integer.valueOf(substring.substring(1)); |
| | | orderLogisticsService.payOrderLogisticsSpreadCallback(id, trade_no, 2); |
| | | |
| | | /** |
| | | * 取消订单微信退款成功回调 |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/cancleOrderWXPay") |
| | | public void cancleOrderWXPay(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> 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.print("success"); |
| | | out.flush(); |
| | | out.close(); |
| | | |
| | | String[] split = out_refund_no.split(","); |
| | | Integer id = Integer.valueOf(split[0]); |
| | | Integer type = Integer.valueOf(split[1]); |
| | | 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); |
| | | break; |
| | | case 4: |
| | | break; |
| | | case 5: |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 购买出行卡微信支付回调 |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/wxPayTaxiCardPaymentSpread") |
| | | public void wxPayTaxiCardPaymentSpread(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> 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(); |
| | | taxiCardService.payTaxiCardPaymentSpread(Integer.valueOf(out_trade_no), order_id); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 购买出行卡支付宝支付回调 |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/aliPayTaxiCardPaymentSpread") |
| | | public void aliPayTaxiCardPaymentSpread(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> 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); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/payThankYouFee") |
| | | @ApiOperation(value = "1.0-支付感谢费", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流", "用户端-包车", "用户端-助老模式"}, notes = "") |
| | | @PostMapping("/base/order/queryDriverInfo") |
| | | @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=同城小件物流,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.....") |
| | | @ApiImplicitParam(value = "司机id", name = "driverId", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil payThankYouFee(Integer orderId, Integer orderType, Double money, Integer payType, Integer type, HttpServletRequest request){ |
| | | public ResultUtil<Map<String, Object>> queryDriverInfo(Integer driverId){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | Driver driver = driverService.selectById(driverId); |
| | | String phone = AESUtil.decrypt(driver.getPhone()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("name", driver.getName()); |
| | | map.put("phone", phone.substring(0, 3) + "****" + phone.substring(7)); |
| | | map.put("headImg", driver.getHeadImgUrl()); |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | 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); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/order/driverQrCodePaymentCollection") |
| | | @ApiOperation(value = "扫码司机收款码调起支付", tags = {"线下收款"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "司机id", name = "driverId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付金额", name = "money", required = true, dataType = "double"), |
| | | @ApiImplicitParam(value = "支付方式(1=微信,2=支付宝)", name = "payType", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil<Map<String, String>> driverQrCodePaymentCollection(Integer driverId, Double money, Integer payType){ |
| | | try { |
| | | return orderService.driverQrCodePaymentCollection(driverId, money, payType); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/order/queryDriverQrCodePaymentStatus") |
| | | @ApiOperation(value = "获取线下收款支付状态", tags = {"线下收款"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "支付id", name = "id", required = true, dataType = "string"), |
| | | }) |
| | | public ResultUtil<Integer> queryDriverQrCodePaymentStatus(String id){ |
| | | try { |
| | | OfflineTravelPayment offlineTravelPayment = offlineTravelPaymentService.selectOne(new EntityWrapper<OfflineTravelPayment>().eq("orderId", id)); |
| | | if(null != offlineTravelPayment){ |
| | | return ResultUtil.success(offlineTravelPayment.getStatus()); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | return ResultUtil.success(); |
| | | return ResultUtil.success(0); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/order/evaluateDriver") |
| | | @ApiOperation(value = "支付完成后的评价操作", tags = {"线下收款"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "司机id", name = "driverId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "评分", name = "score", required = true, dataType = "double"), |
| | | @ApiImplicitParam(value = "评价内容", name = "content", required = true, dataType = "string"), |
| | | }) |
| | | public ResultUtil evaluateDriver(Integer driverId, Integer score, String content){ |
| | | try { |
| | | OrderEvaluate orderEvaluate = new OrderEvaluate(); |
| | | orderEvaluate.setDriverId(driverId); |
| | | orderEvaluate.setFraction(score); |
| | | orderEvaluate.setContent(content); |
| | | orderEvaluate.setInsertTime(new Date()); |
| | | orderEvaluateService.insert(orderEvaluate); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 感谢费支付回调 |
| | | * 扫码司机收款码支付回调 |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/wxPayThankYouFee") |
| | | public void wxPayThankYouFee(HttpServletRequest request, HttpServletResponse response){ |
| | | @PostMapping("/base/offlineTravelPaymentCallback") |
| | | public void offlineTravelPaymentCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> 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)){ |
| | | System.err.println("线下收款开始回调-------------------"); |
| | | ResultNotification resultNotification = PayUtil.payResultNotification(request); |
| | | System.err.println("支付回调:" + JSON.toJSONString(resultNotification)); |
| | | if(null != resultNotification){ |
| | | if("000000".equals(resultNotification.getReturnCode())){ |
| | | if("00".equals(resultNotification.getResultCode())){ |
| | | String chnlSeq = resultNotification.getChnlSeq(); |
| | | String txnSeq = resultNotification.getTxnSeq(); |
| | | OfflineTravelPayment offlineTravelPayment = offlineTravelPaymentService.selectOne(new EntityWrapper<OfflineTravelPayment>().eq("orderId", chnlSeq)); |
| | | if(null != offlineTravelPayment && offlineTravelPayment.getStatus() == 1){ |
| | | offlineTravelPayment.setStatus(2); |
| | | offlineTravelPayment.setPayTime(new Date()); |
| | | offlineTravelPayment.setPayNumber(txnSeq); |
| | | offlineTravelPaymentService.updateById(offlineTravelPayment); |
| | | |
| | | PrintWriter out = response.getWriter(); |
| | | out.write(result); |
| | | out.print(resultNotification.getResponseStr()); |
| | | 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); |
| | | } |
| | | }else{ |
| | | System.err.println(resultNotification.getResultMsg()); |
| | | } |
| | | }else{ |
| | | System.err.println(resultNotification.getReturnMessage()); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | |
| | | |
| | | |
| | | /** |
| | | * 感谢费支付宝支付回调 |
| | | * 微信支付退款回调 |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/aliPayThankYouFee") |
| | | public void aliPayThankYouFee(HttpServletRequest request, HttpServletResponse response){ |
| | | @PostMapping("/base/wxRefundCallback") |
| | | public void wxRefundCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | Map<String, String> map = payMoneyUtil.wxRefundCallback(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); |
| | | String out_refund_no = map.get("out_refund_no"); |
| | | String refund_id = map.get("refund_id"); |
| | | String result = map.get("result"); |
| | | String substring = out_refund_no.substring(17); |
| | | Integer type = Integer.valueOf(substring.substring(0, 1)); |
| | | Integer id = Integer.valueOf(substring.substring(1)); |
| | | |
| | | PaymentRecord paymentRecord = paymentRecordService.selectById(id); |
| | | if(paymentRecord.getRefundState() == 2){ |
| | | return; |
| | | } |
| | | if(type == 3){ |
| | | paymentRecord.setRefundCode(refund_id); |
| | | paymentRecord.setRefundState(2); |
| | | paymentRecordService.updateById(paymentRecord); |
| | | OrderCrossCity orderCrossCity = orderCrossCityService.selectById(paymentRecord.getOrderId()); |
| | | transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城订单取消退款", orderCrossCity.getPayMoney(), 1, 1, 1, 3, id); |
| | | } |
| | | if(type == 4 || type == 5){ |
| | | paymentRecord.setRefundCode(refund_id); |
| | | paymentRecord.setRefundState(2); |
| | | paymentRecordService.updateById(paymentRecord); |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(paymentRecord.getOrderId()); |
| | | transactionDetailsService.saveData(orderLogistics.getUserId(), "小件物流取消退款", orderLogistics.getPayMoney(), 1, 1, 1, orderLogistics.getType(), orderLogistics.getId()); |
| | | } |
| | | |
| | | PrintWriter out = response.getWriter(); |
| | | out.print(result); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 管理后台取消订单回退支付金额 |
| | | * @param orderId |
| | | * @param orderType |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/cancelOrderRollbackAmount") |
| | | public String cancelOrderRollbackAmount(Integer orderId, Integer orderType){ |
| | | try { |
| | | switch (orderType){ |
| | | case 3: |
| | | OrderCrossCity orderCrossCity = orderCrossCityService.selectById(orderId); |
| | | if(orderCrossCity.getPayType() == 3){//余额支付 |
| | | UserInfo userInfo = userInfoService.selectById(orderCrossCity.getUserId()); |
| | | userInfo.setBalance(userInfo.getBalance() + orderCrossCity.getPayMoney()); |
| | | userInfoService.updateById(userInfo); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城订单取消退款", orderCrossCity.getPayMoney(), 1, 1, 1, 3, orderId); |
| | | }else{ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | List<PaymentRecord> paymentRecords = paymentRecordService.selectList(new EntityWrapper<PaymentRecord>().eq("category", 1).eq("orderId", orderId) |
| | | .eq("orderType", orderType).eq("state", 2).isNull("refundState")); |
| | | for (PaymentRecord paymentRecord : paymentRecords) { |
| | | String out_trade_no = sdf.format(new Date()) + orderType + paymentRecord.getId(); |
| | | if(paymentRecord.getPayType() == 1){//微信 |
| | | payMoneyUtil.wxRefund(paymentRecord.getCode(), out_trade_no, paymentRecord.getAmount().toString(), paymentRecord.getAmount().toString(), callbackPath + "/base/wxRefundCallback"); |
| | | } |
| | | if(paymentRecord.getPayType() == 2){//支付宝 |
| | | Map<String, String> map = payMoneyUtil.aliRefund(paymentRecord.getCode(), paymentRecord.getAmount().toString()); |
| | | String code = map.get("code"); |
| | | if(!"10000".equals(code)){ |
| | | return JSON.toJSONString(ResultUtil.error(map.get("msg"))); |
| | | } |
| | | paymentRecord.setRefundState(2); |
| | | paymentRecord.setRefundCode(map.get("trade_no")); |
| | | paymentRecordService.updateById(paymentRecord); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城订单取消退款", orderCrossCity.getPayMoney(), 1, 1, 1, 3, orderId); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | if(orderLogistics.getPayType() == 3){//余额支付 |
| | | UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); |
| | | userInfo.setBalance(userInfo.getBalance() + orderLogistics.getPayMoney()); |
| | | userInfoService.updateById(userInfo); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderLogistics.getUserId(), "小件物流取消退款", orderLogistics.getPayMoney(), 1, 1, 1, orderLogistics.getType(), orderLogistics.getId()); |
| | | }else{ |
| | | //调用回退接口 |
| | | List<PaymentRecord> paymentRecords = paymentRecordService.selectList(new EntityWrapper<PaymentRecord>().eq("category", 1).eq("orderId", orderId) |
| | | .eq("orderType", orderType).eq("state", 2).isNull("refundState")); |
| | | for (PaymentRecord paymentRecord : paymentRecords) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String out_trade_no = sdf.format(new Date()) + orderLogistics.getType() + paymentRecord.getId(); |
| | | |
| | | if(paymentRecord.getPayType() == 1){//微信 |
| | | Map<String, String> map = payMoneyUtil.wxRefund(paymentRecord.getCode(), out_trade_no, paymentRecord.getAmount().toString(), paymentRecord.getAmount().toString(), callbackPath + "/base/wxRefundCallback"); |
| | | String return_code = map.get("return_code"); |
| | | if(!"SUCCESS".equals(return_code)){ |
| | | return JSON.toJSONString(ResultUtil.error(map.get("return_msg"))); |
| | | } |
| | | } |
| | | if(paymentRecord.getPayType() == 2){//支付宝 |
| | | Map<String, String> map = payMoneyUtil.aliRefund(paymentRecord.getCode(), paymentRecord.getAmount().toString()); |
| | | String code = map.get("code"); |
| | | if(!"10000".equals(code)){ |
| | | return JSON.toJSONString(ResultUtil.error(map.get("msg"))); |
| | | } |
| | | paymentRecord.setRefundState(2); |
| | | paymentRecord.setRefundCode(map.get("trade_no")); |
| | | paymentRecordService.updateById(paymentRecord); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderLogistics.getUserId(), "小件物流取消退款", orderLogistics.getPayMoney(), 1, 1, 1, orderLogistics.getType(), orderLogistics.getId()); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case 5: |
| | | OrderLogistics orderLogistics1 = orderLogisticsService.selectById(orderId); |
| | | if(orderLogistics1.getPayType() == 3){//余额支付 |
| | | UserInfo userInfo = userInfoService.selectById(orderLogistics1.getUserId()); |
| | | userInfo.setBalance(userInfo.getBalance() + orderLogistics1.getPayMoney()); |
| | | userInfoService.updateById(userInfo); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderLogistics1.getUserId(), "小件物流取消退款", orderLogistics1.getPayMoney(), 1, 1, 1, orderLogistics1.getType(), orderLogistics1.getId()); |
| | | }else{ |
| | | //调用回退接口 |
| | | List<PaymentRecord> paymentRecords = paymentRecordService.selectList(new EntityWrapper<PaymentRecord>().eq("category", 1).eq("orderId", orderId) |
| | | .eq("orderType", orderType).eq("state", 2).isNull("refundState")); |
| | | for (PaymentRecord paymentRecord : paymentRecords) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String out_trade_no = sdf.format(new Date()) + orderLogistics1.getType() + paymentRecord.getId(); |
| | | |
| | | if(paymentRecord.getPayType() == 1){//微信 |
| | | Map<String, String> map = payMoneyUtil.wxRefund(paymentRecord.getCode(), out_trade_no, paymentRecord.getAmount().toString(), paymentRecord.getAmount().toString(), callbackPath + "/base/wxRefundCallback"); |
| | | String return_code = map.get("return_code"); |
| | | if(!"SUCCESS".equals(return_code)){ |
| | | return JSON.toJSONString(ResultUtil.error(map.get("return_msg"))); |
| | | } |
| | | } |
| | | if(paymentRecord.getPayType() == 2){//支付宝 |
| | | Map<String, String> map = payMoneyUtil.aliRefund(paymentRecord.getCode(), paymentRecord.getAmount().toString()); |
| | | String code = map.get("code"); |
| | | if(!"10000".equals(code)){ |
| | | return JSON.toJSONString(ResultUtil.error(map.get("msg"))); |
| | | } |
| | | paymentRecord.setRefundState(2); |
| | | paymentRecord.setRefundCode(map.get("trade_no")); |
| | | paymentRecordService.updateById(paymentRecord); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderLogistics1.getUserId(), "小件物流取消退款", orderLogistics1.getPayMoney(), 1, 1, 1, orderLogistics1.getType(), orderLogistics1.getId()); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return JSON.toJSONString(ResultUtil.runErr()); |
| | | } |
| | | return JSON.toJSONString(ResultUtil.success()); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/orderPrivateCar/directCallCar") |
| | | @ApiOperation(value = "智慧屏一键叫车", tags = {"智慧屏"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "下单手机号", name = "phone", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "下单地点经度", name = "placementLon", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "下单地点纬度", name = "placementLat", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "起点经度", name = "startLon", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "起点纬度", name = "startLat", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "起点地址", name = "startAddress", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "设备号", name = "deviceCode", required = true, dataType = "string"), |
| | | }) |
| | | public ResultUtil<BaseWarpper> directCallCar(String phone, String placementLon, String placementLat, String startLon, String startLat, String startAddress, String deviceCode){ |
| | | try { |
| | | return orderPrivateCarService.directCallCar(phone, placementLon, placementLat, startLon, startLat, startAddress, deviceCode); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/orderPrivateCar/querySmartScreenOrder") |
| | | @ApiOperation(value = "获取智慧屏订单列表", tags = {"智慧屏"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "设备号", name = "deviceCode", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "经纬度(103.2222,30.23554)", name = "lonLat", required = true, dataType = "string"), |
| | | }) |
| | | public ResultUtil<List<SmartScreenOrderVo>> querySmartScreenOrder(String deviceCode, String lonLat){ |
| | | try { |
| | | List<SmartScreenOrderVo> orderVos = orderPrivateCarService.querySmartScreenOrder(deviceCode, lonLat); |
| | | return ResultUtil.success(orderVos); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | } |