@Override protected void check(LocalTransaction localTransaction) { String cardNo = localTransaction.getCardNo(); String aid = localTransaction.getAid(); Application app = applicationManager.getByAid(aid); CardInfo card = cardInfoManager.getByCardNo(cardNo); validateCard(card); // 校验应用的状态 if (app == null) { throw new PlatformException(PlatformErrorCode.APPLICATION_AID_NOT_EXIST); } // 校验卡上应用状态 CardApplication cardApplication = cardApplicationManager.getByCardNoAid(cardNo, aid); if (cardApplication == null) { throw new PlatformException(PlatformErrorCode.INVALID_CARD_APP_STATUS); } if (cardApplication.getApplicationVersion().getApplication().needSubscribe() && CardApplication.STATUS_AVAILABLE.intValue() == cardApplication.getStatus().intValue()) { // 如果应用需要退订,但卡上应用状态为“可用”,抛出异常 throw new PlatformException(PlatformErrorCode.TRANS_DELETE_APP_UNSUBSCRIBE); } // 校验完成,设置卡上应用的版本号 localTransaction.setAppVersion(cardApplication.getApplicationVersion().getVersionNo()); }