| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | |
| | | paymentRecordService.saveData(4, taxiCardPayment.getUserId(), 1, taxiCardPayment.getId(), null, 2, taxiCard.getSellingPrice(), "", 1);//添加预支付数据 |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() == null || userInfo.getBalance() < taxiCard.getSellingPrice()){ |
| | | return ResultUtil.error("余额不足,无法完成支付", ""); |
| | | } |
| | | resultUtil= appOrderController.moneyPay(taxiCardPayment.getId(),userInfo.getId(),taxiCard.getSellingPrice()); |
| | | if(resultUtil.getCode()==500){ |
| | | return ResultUtil.error("电子余额不足,无法完成支付"); |
| | | } |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(taxiCard.getSellingPrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "购买出行卡", taxiCard.getSellingPrice(), 2, 1, 1, 6, taxiCardPayment.getId()); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | taxiCardPayment.setPayStatus(2);//已支付 |
| | | taxiCardPayment.setPayTime(new Date()); |
| | | taxiCardPaymentService.updateById(taxiCardPayment); |
| | | |
| | | |
| | | //已购买没过期的增加有效期 |
| | | if (userInfo.getBalance() == null || userInfo.getBalance() < taxiCard.getSellingPrice()) { |
| | | return ResultUtil.error("余额不足,无法完成支付", ""); |
| | | } |
| | | // resultUtil= appOrderController.moneyPay(taxiCardPayment.getId(),userInfo.getId(),taxiCard.getSellingPrice()); |
| | | // if(resultUtil.getCode()==500){ |
| | | // return ResultUtil.error("电子余额不足,无法完成支付"); |
| | | // } |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(taxiCard.getSellingPrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "购买出行卡", taxiCard.getSellingPrice(), 2, 1, 1, 6, taxiCardPayment.getId()); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | taxiCardPayment.setPayStatus(2);//已支付 |
| | | taxiCardPayment.setPayTime(new Date()); |
| | | taxiCardPaymentService.updateById(taxiCardPayment); |
| | | |
| | | |
| | | //已购买没过期的增加有效期 |
| | | UserTaxiCard userTaxiCard = userTaxiCardService.selectOne(new EntityWrapper<UserTaxiCard>().eq("userId", uid).eq("taxiCardId", taxiCardPayment.getTaxiCardId()) |
| | | .eq("companyId", taxiCardPayment.getCompanyId()).where("now() between startTime and endTime")); |
| | | if(null != userTaxiCard){ |