Helius
2020-12-23 c554c7ad5405bafa149dbb6429e8245f78b33ffc
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
@@ -205,6 +205,7 @@
        sysOrder.setCardPay(cardMoney);
        sysOrder.setCashPay(xjMoney);
        sysOrder.setStatu(Dictionary.ORDER_STATU_DFK);
        sysOrder.setStaffId(user.getSuId());
        sysOrder.setCompanyId(user.getCompanyId());
        sysOrder.setPayTime(new Date());
@@ -629,6 +630,10 @@
            moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y);
            moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_WX);
        }
        ShoppingGoods shoppingGoods = shoppingGoodsService.findById(moneyCardUse.getGoodsId());
        Date invalidTime = shoppingGoodsService.calInvalidTime(shoppingGoods, 2, moneyCardUse.getFailTime());
        moneyCardUse.setFailTime(invalidTime);
        // 更新充值卡信息
        moneyCardUseDao.update(moneyCardUse);
    }
@@ -736,14 +741,17 @@
                    moneyCardUse.setLastCount(moneyCar.getCarUseCount());
                }
                moneyCardUse.setVipId(sourceOrder.getVipId());
                if (moneyCar.getValidity() == null || moneyCar.getValidity() == 0) {
                    // 设置失效时间
                    Calendar cal = Calendar.getInstance();
                    cal.set(2200, 1, 1);
                    moneyCardUse.setFailTime(cal.getTime());
                } else {
                    moneyCardUse.setFailTime(DateUtil.nextNDate(new Date(), 30 * moneyCar.getValidity()));
                }
//                if (moneyCar.getValidity() == null || moneyCar.getValidity() == 0) {
//                    // 设置失效时间
//                    Calendar cal = Calendar.getInstance();
//                    cal.set(2200, 1, 1);
//                    moneyCardUse.setFailTime(cal.getTime());
//                } else {
//                    moneyCardUse.setFailTime(DateUtil.nextNDate(new Date(), 30 * moneyCar.getValidity()));
//                }
                Date invalidTime = shoppingGoodsService.calInvalidTime(sysOrderItem.getShoppingGoods(), 1, null);
                moneyCardUse.setFailTime(invalidTime);
                moneyCardUseDao.insert(moneyCardUse);
            }
        }