Pu Zhibing
3 天以前 33632d86bbf74e922ce406d9032fadc90f6bba5e
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -9,7 +9,6 @@
import com.stylefeng.guns.modular.account.controller.AppOrderController;
import com.stylefeng.guns.modular.crossCity.dao.OrderCrossCityMapper;
import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity;
import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService;
import com.stylefeng.guns.modular.smallLogistics.dao.OrderLogisticsMapper;
import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics;
import com.stylefeng.guns.modular.smallLogistics.model.OrderLogisticsSpread;
@@ -17,7 +16,6 @@
import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsSpreadService;
import com.stylefeng.guns.modular.specialTrain.dao.OrderPrivateCarMapper;
import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar;
import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService;
import com.stylefeng.guns.modular.system.dao.*;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
@@ -28,13 +26,11 @@
import com.stylefeng.guns.modular.taxi.dao.OrderTaxiMapper;
import com.stylefeng.guns.modular.taxi.model.OrderTaxi;
import com.stylefeng.guns.modular.taxi.model.PaymentRecord;
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 com.unionpay.upyzt.exception.UpyztException;
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;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@@ -95,28 +91,28 @@
    @Autowired
    private ICompanyService companyService;
    @Autowired
    private IIncomeService incomeService;
    @Autowired
    private IOrderCancelService orderCancelService;
    @Autowired
    private IOrderLogisticsSpreadService orderLogisticsSpreadService;
    @Autowired
    private RedisUtil redisUtil;
    @Resource
    private RedisTemplate<String, Object> redisTemplate;
    @Resource
    private RegionMapper regionMapper;
    @Autowired
    private GDMapElectricFenceUtil gdMapElectricFenceUtil;
    @Autowired
    private PayMoneyUtil payMoneyUtil;
    @Resource
    private OrderPrivateCarMapper orderPrivateCarMapper;
@@ -566,7 +562,7 @@
                try {
                    Integer id = orderLogistics.getId();
                    orderIds.add(orderLogistics.getId());//添加记录,防止调用接口重复提醒无人接单
                    String vehicle = redisUtil.getValue("VEHICLE");
                    String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE");
                    List<Integer> integers = new ArrayList<>();
                    if(ToolUtil.isNotEmpty(vehicle)){
                        integers = JSON.parseArray(vehicle).toJavaList(Integer.class);
@@ -695,7 +691,6 @@
    }
    @Override
    @Transactional(rollbackFor = UpyztException.class,propagation = Propagation.REQUIRES_NEW)
    public ResultUtil payLogisticsOrder1(Integer payType, Integer orderId, Integer objectId, Integer objectType, Integer type) throws Exception {
        OrderLogistics orderLogistics = this.selectById(orderId);
        if(orderLogistics.getState() != 7){
@@ -779,24 +774,24 @@
            paymentRecordService.saveData(1, orderLogistics.getUserId(), 1, orderId, orderLogistics.getType(), 2, orderMoney, "", 1);//添加预支付数据
        }
        if(payType == 3){//余额支付
            if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){
            if (userInfo.getBalance() == null || userInfo.getBalance() < orderMoney) {
                return ResultUtil.error("余额不足,无法完成支付");
            }
            if(orderMoney>0) {
                resultUtil = appOrderController.moneyPay(orderId, userInfo.getId(), orderMoney);
                if (resultUtil.getCode() == 500) {
                    return ResultUtil.error("电子余额不足,无法完成支付");
                }
            }
//            if(orderMoney>0) {
//                resultUtil = appOrderController.moneyPay(orderId, userInfo.getId(), orderMoney);
//                if (resultUtil.getCode() == 500) {
//                    return ResultUtil.error("电子余额不足,无法完成支付");
//                }
//            }
            userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
            SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId());
            userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分
            //添加交易明细
            transactionDetailsService.saveData(uid, (orderLogistics.getType() == 4 ? "同城" : "跨城") + "小件物流下单", orderMoney, 2, 1, 1, 4, orderId);
            userInfoService.updateById(userInfo);
            orderLogistics.setState(1);//小件物流先支付后司机抢单
            orderLogistics.setPayType(3);
            orderLogistics.setPayMoney(orderMoney);
@@ -868,24 +863,24 @@
            resultUtil = payMoneyUtil.alipay("小件物流补差价", "小件物流补差价", "", orderId + "_" + orderLogistics.getType() + "_" + UUIDUtil.getRandomCode(5), orderMoney.toString(), "/base/aliPayOrderLogisticsSpread");
            paymentRecordService.saveData(1, orderLogistics.getUserId(), 1, orderId, orderLogistics.getType(), 2, orderMoney, "", 1);//添加预支付数据
        }
        if(payType == 3){//余额支付
            if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){
        if(payType == 3) {//余额支付
            if (userInfo.getBalance() == null || userInfo.getBalance() < orderMoney) {
                return ResultUtil.error("余额不足,无法完成支付");
            }
            resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),orderMoney);
            if(resultUtil.getCode()==500){
                return ResultUtil.error("电子余额不足,无法完成支付");
            }
//            resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),orderMoney);
//            if(resultUtil.getCode()==500){
//                return ResultUtil.error("电子余额不足,无法完成支付");
//            }
            userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
            SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId());
            userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分
            //添加交易明细
            transactionDetailsService.saveData(uid, (orderLogistics.getType() == 4 ? "同城" : "跨城") + "小件物流补差价", orderMoney, 2, 1, 1, 4, orderId);
            userInfoService.updateById(userInfo);
            orderLogistics.setState(12);//已支付差价
            this.updateById(orderLogistics);
@@ -1619,24 +1614,24 @@
            resultUtil = payMoneyUtil.alipay("感谢费", "感谢费", "", orderId + "_" + orderLogistics.getType() + "_" + UUIDUtil.getRandomCode(5), money.toString(), "/base/aliPayThankYouFee");
            paymentRecordService.saveData(1, uid, 1, orderId, orderLogistics.getType(), 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(orderLogistics.getCompanyId());
            userInfo.setIntegral(userInfo.getIntegral() + (money.intValue() * query1.getIntegral()));//积分
            //添加交易明细
            transactionDetailsService.saveData(uid, (orderLogistics.getType() == 4 ? "同城小件物流-" : "跨城小件物流-") + "感谢费", money, 2, 1, 1, orderLogistics.getType(), orderId);
            userInfoService.updateById(userInfo);
            orderLogistics.setThankYouFee(money);
            this.updateById(orderLogistics);