From a50197bd1a429d903718e40b54685bb2a241bd4a Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期二, 14 一月 2025 19:37:20 +0800 Subject: [PATCH] 修改 --- UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java | 103 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 92 insertions(+), 11 deletions(-) diff --git a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java index d55346c..7041973 100644 --- a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java +++ b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java @@ -240,6 +240,8 @@ orderTaxi.setInsertTime(new Date()); orderTaxi.setIsReassign(1); UserInfo userInfo = userInfoService.selectById(uid); + orderTaxi.setPassengersPhone(userInfo.getPhone()); + orderTaxi.setPassengers(userInfo.getNickName()); if (!StringUtils.hasLength(orderTaxi.getPassengers()) || StringUtils.hasLength(orderTaxi.getPassengersPhone()) ){ // 如果没有填写乘车人电话或者姓名 那么用用户的 @@ -557,8 +559,26 @@ } userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(query.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); + Integer placeOrderWay = null; + switch (orderTaxi.getOrderSource()){ + case 2: + placeOrderWay = 4; + break; + case 3: + placeOrderWay = 4; + break; + case 6: + placeOrderWay = 1; + break; + case 7: + placeOrderWay = 2; + break; + case 5: + placeOrderWay = 3; + break; + } //添加交易明细 - transactionDetailsService.saveData(uid, "取消订单", query.getMoney(), 2, 1, 1, 2, id); + transactionDetailsService.saveDataTaxi(uid, "取消订单", query.getMoney(), 2, 1, 1, 2, id,placeOrderWay); userInfoService.updateById(userInfo); //解除小号绑定 @@ -731,12 +751,15 @@ appletsOpenId = userInfo.getAppletsOpenId(); } Map<String, String> map = icbcPayUtil.placeAnOrder(orderId + ",2", 9, 5, uid.toString(), "完成订单", orderMoney, callbackPath + "/base/wxPayOrderTaxi", "", type, appletsOpenId); - if(map.get("code").equals("200")){ - paymentRecordService.saveData(1, orderTaxi.getUserId(), 1, orderId, 2, 1, orderMoney, map.get("order_id"), 1);//添加预支付数据 - resultUtil = ResultUtil.success(map.get("data")); - }else{ - resultUtil = ResultUtil.error(map.get("msg"), ""); - } + String app = type == 1 ? "APP" : "JSAPI"; + resultUtil = payMoneyUtil.weixinpay("完成订单", "", orderId + "_2_" + UUIDUtil.getRandomCode(5), orderMoney.toString(), "/base/wxPayOrderTaxi", app, userInfo.getAppletsOpenId()); + paymentRecordService.saveData(1, orderTaxi.getUserId(), 1, orderId, 2, 1, orderMoney, "", 1);//添加预支付数据 +// if(map.get("code").equals("200")){ +// paymentRecordService.saveData(1, orderTaxi.getUserId(), 1, orderId, 2, 1, orderMoney, map.get("order_id"), 1);//添加预支付数据 +// resultUtil = ResultUtil.success(map.get("data")); +// }else{ +// resultUtil = ResultUtil.error(map.get("msg"), ""); +// } } if(payType == 2){//支付宝支付 Map<String, String> map = icbcPayUtil.placeAnOrder(orderId + ",2", 10, 5, uid.toString(), "完成订单", orderMoney, callbackPath + "/base/aliPayOrderTaxi", "", type, null); @@ -756,9 +779,26 @@ SysIntegral query1 = sysIntegralMapper.query(orderTaxi.getCompanyId()); userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分 - + Integer placeOrderWay = null; + switch (orderTaxi.getOrderSource()){ + case 2: + placeOrderWay = 4; + break; + case 3: + placeOrderWay = 4; + break; + case 6: + placeOrderWay = 1; + break; + case 7: + placeOrderWay = 2; + break; + case 5: + placeOrderWay = 3; + break; + } //添加交易明细 - transactionDetailsService.saveData(uid, "完成订单", orderMoney, 2, 1, 1, 2, orderId); + transactionDetailsService.saveDataTaxi(uid, "完成订单", orderMoney, 2, 1, 1, 2, orderId,placeOrderWay); userInfoService.updateById(userInfo); orderTaxi.setState(8); @@ -1168,8 +1208,26 @@ OrderTaxi orderTaxi = this.selectById(id); PaymentRecord query = paymentRecordService.query(1, orderTaxi.getUserId(), 1, Integer.valueOf(id), 2, type, 1); if(null != query){ + Integer placeOrderWay = null; + switch (orderTaxi.getOrderSource()){ + case 2: + placeOrderWay = 4; + break; + case 3: + placeOrderWay = 4; + break; + case 6: + placeOrderWay = 1; + break; + case 7: + placeOrderWay = 2; + break; + case 5: + placeOrderWay = 3; + break; + } //添加交易明细 - transactionDetailsService.saveData(orderTaxi.getUserId(), "完成订单", query.getAmount(), 2, 1, 1, 2, query.getOrderId()); + transactionDetailsService.saveDataTaxi(orderTaxi.getUserId(), "完成订单", query.getAmount(), 2, 1, 1, 2, query.getOrderId(),placeOrderWay); orderTaxi.setState(8); orderTaxi.setPayType(type); orderTaxi.setPayMoney(query.getAmount()); @@ -1262,8 +1320,26 @@ OrderTaxi orderTaxi = this.selectById(id); PaymentRecord query = paymentRecordService.query(1, orderTaxi.getUserId(), 1, Integer.valueOf(id), 2, type, 1); if(null != query){ + Integer placeOrderWay = null; + switch (orderTaxi.getOrderSource()){ + case 2: + placeOrderWay = 4; + break; + case 3: + placeOrderWay = 4; + break; + case 6: + placeOrderWay = 1; + break; + case 7: + placeOrderWay = 2; + break; + case 5: + placeOrderWay = 3; + break; + } //添加交易明细 - transactionDetailsService.saveData(orderTaxi.getUserId(), "取消订单", query.getAmount(), 2, 1, 1, 2, query.getOrderId()); + transactionDetailsService.saveDataTaxi(orderTaxi.getUserId(), "取消订单", query.getAmount(), 2, 1, 1, 2, query.getOrderId(),placeOrderWay); orderTaxi.setState(10); //解除小号绑定 if(orderTaxi.getBindId() != null){ @@ -1324,13 +1400,17 @@ List<PushOrder> querys = pushOrderService.querys(null, 2, query.getId());//获取需要推送的次数 for(int i = 1; i <= querys.size(); i++){ PushOrder pushOrder = pushOrderService.querys(i, 2, query.getId()).get(0); + System.out.println("进入订单推送"); //获取空闲司机 List<Driver> list = driverService.queryIdleDriver(2, orderTaxi.getStartLon(), orderTaxi.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 + System.out.println("获取空闲司机============="+list); if(list.size() > 0){ + System.out.println("进入司机推送"); double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数 int lastIndex = Double.valueOf(list.size() * driverProportion).intValue();//计算占比转成整数(下标截取) list = list.subList(0, lastIndex);//获取空闲司机中占比数据 for(Driver driver : list){//开始进行推送 + System.out.println("开始进行推送======="+driver); //查询是否在限制推单范围内 boolean bo = false; for(Integer integer : integers){ @@ -1343,6 +1423,7 @@ continue; } pushUtil.pushOrderState(2, driver.getId(), orderTaxi.getId(), 2, orderTaxi.getState(), pushOrder.getPushTime()); + System.out.println("推送订单后"); } } Thread.sleep(pushOrder.getPushTime() * 1000);//设置等待时间 -- Gitblit v1.7.1