Pu Zhibing
3 天以前 33632d86bbf74e922ce406d9032fadc90f6bba5e
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TaxiCardServiceImpl.java
@@ -24,7 +24,10 @@
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
@@ -362,24 +365,24 @@
            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){