From 1c7d3b4538dcd2ae6c0ec1ffc4a548088bb7b00b Mon Sep 17 00:00:00 2001 From: guyue <1721849008@qq.com> Date: 星期六, 26 七月 2025 09:09:01 +0800 Subject: [PATCH] 未支付订单查询接口 --- UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java | 82 ++++++++++++++++++++++++++++------------ 1 files changed, 57 insertions(+), 25 deletions(-) diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java index 364d0d8..9090f85 100644 --- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java +++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java @@ -20,6 +20,7 @@ import com.stylefeng.guns.modular.system.dao.SysIntegralMapper; import com.stylefeng.guns.modular.system.dao.UserActivityDiscount1Mapper; 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.warpper.*; @@ -29,6 +30,7 @@ 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 org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; @@ -204,20 +206,26 @@ public synchronized ResultUtil<BaseWarpper> taxiOrder(OrderTaxi orderTaxi, Integer uid) throws Exception { //定义用户所属公司 UserInfo userInfo1 = userInfoService.selectById(uid); + if (null == userInfo1 || userInfo1.getFlag() == 3) { + return ResultUtil.error("无效的账户"); + } + if (2 == userInfo1.getState()) { + return ResultUtil.error("账号已被冻结,请联系管理员"); + } Company query = companyCityService.query(String.valueOf(orderTaxi.getStartLon()), String.valueOf(orderTaxi.getStartLat())); - if(null == query){ + if (null == query) { return ResultUtil.error("出发点暂未开通"); } - if(null != userInfo1.getCompanyId() && 0 != userInfo1.getCompanyId()){ + if (null != userInfo1.getCompanyId() && 0 != userInfo1.getCompanyId()) { userInfo1.setCompanyId(query.getId()); userInfoService.updateById(userInfo1); } - - if(orderTaxi.getTravelTime().getTime() > (System.currentTimeMillis() + 600000)){ + + if (orderTaxi.getTravelTime().getTime() > (System.currentTimeMillis() + 600000)) { orderTaxi.setOrderType(2); } - - + + /** * 1.出租车、专车、跨城有待支付的订单不能叫车 * 2.小件物流有未完成的订单可以下跨城、专车、出租车 @@ -609,22 +617,22 @@ // resultUtil = ResultUtil.error(map.get("msg"), ""); // } } - if(payType == 3){//余额支付 - if(userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()){ + if(payType == 3) {//余额支付 + if (userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()) { return ResultUtil.error("余额不足,无法完成支付"); } - resultUtil= appOrderController.moneyPay(id,userInfo.getId(),query.getMoney()); - if(resultUtil.getCode()==500){ - return ResultUtil.error("电子余额不足,无法完成支付"); - } - +// resultUtil= appOrderController.moneyPay(id,userInfo.getId(),query.getMoney()); +// if(resultUtil.getCode()==500){ +// return ResultUtil.error("电子余额不足,无法完成支付"); +// } + userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(query.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); //添加交易明细 transactionDetailsService.saveData(uid, "出租车取消订单", query.getMoney(), 2, 1, 1, 2, id); userInfoService.updateById(userInfo); - + //解除小号绑定 - if(orderTaxi.getBindId() != null){ + if (orderTaxi.getBindId() != null) { chinaMobileUtil.midAxbUnBindSend(orderTaxi.getBindId(), orderTaxi.getTelX(), (System.currentTimeMillis() + 600000)); } @@ -1880,7 +1888,7 @@ userRedPacketRecord.setUserId(orderTaxi.getUserId()); userRedPacketRecordService.insert(userRedPacketRecord); } - appOrderController.moneyPay(orderTaxi.getId(),orderTaxi.getUserId(),money); +// appOrderController.moneyPay(orderTaxi.getId(),orderTaxi.getUserId(),money); return ResultUtil.success(baseWarpper); } @@ -2159,23 +2167,23 @@ resultUtil = payMoneyUtil.alipay("感谢费", "感谢费", "", orderId + "_2_" + UUIDUtil.getRandomCode(5), money.toString(), "/base/aliPayThankYouFee"); paymentRecordService.saveData(1, uid, 1, orderId, 2, 2, money, "", 1);//添加预支付数据 } - if(payType == 3){//余额支付 - if(userInfo.getBalance() == null || userInfo.getBalance() < money){ + if(payType == 3) {//余额支付 + if (userInfo.getBalance() == null || userInfo.getBalance() < money) { return ResultUtil.error("余额不足,无法完成支付"); } - resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),money); - if(resultUtil.getCode()==500){ - return ResultUtil.error("电子余额不足,无法完成支付"); - } +// resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),money); +// if(resultUtil.getCode()==500){ +// return ResultUtil.error("电子余额不足,无法完成支付"); +// } userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); - + SysIntegral query1 = sysIntegralMapper.query(orderTaxi.getCompanyId()); userInfo.setIntegral(userInfo.getIntegral() + (money.intValue() * query1.getIntegral()));//积分 - + //添加交易明细 transactionDetailsService.saveData(uid, "出租车-感谢费", money, 2, 1, 1, 2, orderId); userInfoService.updateById(userInfo); - + orderTaxi.setThankYouFee(money); this.updateById(orderTaxi); @@ -2225,4 +2233,28 @@ driverService.updateById(driver); systemNoticeService.addSystemNotice(1, "您已使用" + (payType == 1 ? "微信" : (payType==2?"支付宝":"云闪付")) + "成功完成感谢费支付,谢谢使用!", userInfo.getId(), 1); } + + @Override + public List<UnPayOrderVO> getUnpayTaxiOrders(Integer uid) { + EntityWrapper<OrderTaxi> wrapper = new EntityWrapper<>(); + wrapper.eq("userId", uid); + wrapper.eq("state", 7); + //查出未支付订单 + List<OrderTaxi> orderTaxiList = this.selectList(wrapper); + List<UnPayOrderVO> unPayOrderVOList = new ArrayList<>(); + for (OrderTaxi orderTaxi:orderTaxiList) { + UnPayOrderVO unPayOrderVO = new UnPayOrderVO(); + //添加司机信息 + DriverInfoWarpper driverInfoWarpper = new DriverInfoWarpper(); + Driver driver = driverService.selectById(orderTaxi.getDriverId()); + BeanUtils.copyProperties(driver, driverInfoWarpper); + unPayOrderVO.setDriverInfoWarpper(driverInfoWarpper); + //其余信息 + BeanUtils.copyProperties(orderTaxi, unPayOrderVO); + unPayOrderVOList.add(unPayOrderVO); + + } + + return unPayOrderVOList; + } } -- Gitblit v1.7.1