|
@@ -32,7 +32,6 @@ import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
import java.util.Optional;
|
|
import java.util.Optional;
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -62,6 +61,9 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
|
|
@Resource
|
|
@Resource
|
|
private TConsumptionLogService consumptionLogService;
|
|
private TConsumptionLogService consumptionLogService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private MassageUtil massageUtil;
|
|
|
|
+
|
|
|
|
|
|
// @Resource
|
|
// @Resource
|
|
// private TInfoService infoService;
|
|
// private TInfoService infoService;
|
|
@@ -82,7 +84,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
|
|
}
|
|
}
|
|
//计算车费
|
|
//计算车费
|
|
if (order.getDistance() != null) {
|
|
if (order.getDistance() != null) {
|
|
- BigDecimal bigDecimal = MassageUtil.calculateTaxiFare(order.getDistance());
|
|
|
|
|
|
+ BigDecimal bigDecimal = massageUtil.calculateTaxiFare(order.getDistance());
|
|
order.setFare(bigDecimal.setScale(MassageConstants.INTEGER_TWO, RoundingMode.HALF_UP));
|
|
order.setFare(bigDecimal.setScale(MassageConstants.INTEGER_TWO, RoundingMode.HALF_UP));
|
|
}
|
|
}
|
|
//订单价格
|
|
//订单价格
|
|
@@ -117,10 +119,6 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public Boolean payOrder(TOrder order) {
|
|
public Boolean payOrder(TOrder order) {
|
|
-// if(order.getPayType().equals(PayTypeEnum.WEI_PAY.getCode())){
|
|
|
|
-// //调用微信支付
|
|
|
|
-// weiPay(order);
|
|
|
|
-// }
|
|
|
|
// 根据orderid查询订单信息
|
|
// 根据orderid查询订单信息
|
|
TOrder orderNew = getById(order.getcId());
|
|
TOrder orderNew = getById(order.getcId());
|
|
if (!orderNew.getnStatus().equals(OrderStatusEnum.WAIT_PAY.getCode())) {
|
|
if (!orderNew.getnStatus().equals(OrderStatusEnum.WAIT_PAY.getCode())) {
|
|
@@ -138,20 +136,20 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
|
|
if (null == user) {
|
|
if (null == user) {
|
|
throw new ServiceException("用户不存在");
|
|
throw new ServiceException("用户不存在");
|
|
}
|
|
}
|
|
- if (user.getdBalance().compareTo(orderNew.getdTotalMoney()) < MassageConstants.INTEGER_ZERO) {
|
|
|
|
|
|
+ if (user.getdBalance().compareTo(orderNew.getTotalPrice()) < MassageConstants.INTEGER_ZERO) {
|
|
return false;
|
|
return false;
|
|
} else {
|
|
} else {
|
|
// 更新用户金额 及下单此时
|
|
// 更新用户金额 及下单此时
|
|
TWxUser paramUser = new TWxUser();
|
|
TWxUser paramUser = new TWxUser();
|
|
paramUser.setcOpenid(user.getcOpenid());
|
|
paramUser.setcOpenid(user.getcOpenid());
|
|
- paramUser.setdBalance(user.getdBalance().subtract(orderNew.getdTotalMoney()));
|
|
|
|
- paramUser.setdMoney(user.getdMoney().add(orderNew.getdTotalMoney()));
|
|
|
|
|
|
+ paramUser.setdBalance(user.getdBalance().subtract(orderNew.getTotalPrice()));
|
|
|
|
+ paramUser.setdMoney(user.getdMoney().add(orderNew.getTotalPrice()));
|
|
paramUser.setnNum(user.getnNum() + MassageConstants.INTEGER_ZERO);
|
|
paramUser.setnNum(user.getnNum() + MassageConstants.INTEGER_ZERO);
|
|
paramUser.setId(user.getId());
|
|
paramUser.setId(user.getId());
|
|
wxUserService.updateById(paramUser);
|
|
wxUserService.updateById(paramUser);
|
|
//增加消费记录
|
|
//增加消费记录
|
|
TConsumptionLog tConsumptionLog = new TConsumptionLog();
|
|
TConsumptionLog tConsumptionLog = new TConsumptionLog();
|
|
- tConsumptionLog.setAmount(orderNew.getdTotalMoney().negate());
|
|
|
|
|
|
+ tConsumptionLog.setAmount(orderNew.getTotalPrice().negate());
|
|
tConsumptionLog.setBillNo(orderNew.getOrderNo());
|
|
tConsumptionLog.setBillNo(orderNew.getOrderNo());
|
|
tConsumptionLog.setOpenId(orderNew.getcOpenId());
|
|
tConsumptionLog.setOpenId(orderNew.getcOpenId());
|
|
tConsumptionLog.setBillType(BillTypeEnum.BALANCE_PAYMENT.getCode());
|
|
tConsumptionLog.setBillType(BillTypeEnum.BALANCE_PAYMENT.getCode());
|
|
@@ -181,11 +179,6 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private void weiPay(TOrder order) {
|
|
|
|
- // 根据orderid查询订单信息
|
|
|
|
- TOrder orderNew = getById(order.getcId());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 拒绝订单
|
|
* 拒绝订单
|
|
*
|
|
*
|