public void Execute(User currentUser) { var serialNo = SerialNoHelper.Create(); using (var proxy = new ServiceProxy <IAccountDealService>()) { var rollback = this.RollbackShopDealLogService.GetById(RollbackId); if (rollback == null || rollback.State != RollbackShopDealLogState.Processing) { throw new Exception("³åÕýÇëÇóδÕÒµ½"); } var shopDealLog = this.ShopDealLogService.GetById(rollback.ShopDealLogId); var dealLog = this.DealLogService.GetById(shopDealLog.Addin); var account = this.AccountService.GetById(dealLog.AccountId); var request = new PayRequest_(dealLog.AccountName, "", dealLog.SourcePosName, Math.Abs(dealLog.Amount), serialNo, dealLog.SerialNo, account.AccountToken, dealLog.SourceShopName) { IsForce = true }; var rsp = proxy.Proxy.Roolback(request); if (rsp.Code != ResponseCode.Success) { throw new Exception(ModelHelper.GetBoundText(rsp, x => x.Code)); } rollback.State = RollbackShopDealLogState.Done; RollbackShopDealLogService.Update(rollback); } }
public void Ready() { var user = this.SecurityHelper.GetCurrentUser().CurrentUser as ShopUser; var items = this.ShopDealLogService.QueryUnLiquidateDeals(user.ShopId).ToList(0, 500, "SubmitTime").ToList(); var rollbacks = RollbackShopDealLogService.Query(user.ShopId, null).ToList(); Items = items.Where(s => !rollbacks.Any(x => x.ShopDealLogId == s.ShopDealLogId)).ToList(); }
public SimpleAjaxResult Ready() { var user = this.SecurityHelper.GetCurrentUser().CurrentUser as ShopUser; var shopId = user.ShopId; foreach (var id in Ids) { using (var tran = TransactionHelper.BeginTransaction()) { var shopDealLog = ShopDealLogService.GetById(id); if (shopDealLog.State == DealLogStates.Normal_) { return(new SimpleAjaxResult("该交易已冲正")); } if (shopDealLog.ShopId != shopId) { return(new SimpleAjaxResult("只能提交自己商户的申请")); } var rollback = this.RollbackShopDealLogService.GetByShopDealLogId(shopDealLog.ShopDealLogId); if (rollback != null) { return(new SimpleAjaxResult("该交易取消请求已经存在")); } rollback = new RollbackShopDealLog { ShopDealLogId = shopDealLog.ShopDealLogId, ShopId = shopDealLog.ShopId, State = RollbackShopDealLogState.Processing, }; RollbackShopDealLogService.Create(rollback); tran.Commit(); } } return(new SimpleAjaxResult()); }