PageRenderTime 30ms CodeModel.GetById 18ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/webccr/src/com/emis/caesar/senao/event/button/TBtnCreditStage.java

https://bitbucket.org/sanliou/synccr
Java | 102 lines | 75 code | 4 blank | 23 comment | 13 complexity | 49ff6f3c1519250a0074a0116902005d MD5 | raw file
  1package com.emis.caesar.senao.event.button;
  2
  3import com.emis.caesar.senao.event.TButtonEventContext;
  4import com.emis.caesar.senao.unit.TCcrConst;
  5import com.emis.caesar.senao.util.CcrUtil;
  6import com.emis.caesar.senao.util.EDCUtil;
  7import com.emis.caesar.senao.util.GenUtil;
  8import com.emis.caesarui.webccr.webccr;
  9import com.emis.util.emisUtil;
 10import com.vaadin.ui.UI;
 11
 12/**
 13 * Created by Jenny on 2017/1/11.
 14 * 信用卡分期付款
 15 */
 16public class TBtnCreditStage extends TButtonEventContext {
 17  /**
 18   * 來源是否為信用卡分期、信用卡無分期(一次)
 19   * isCreditStage: true(分期);false(無分期)
 20   */
 21  boolean isCreditStage = false;
 22  int iEntryAmt = 0;
 23
 24  public TBtnCreditStage(boolean isCreditStage) {
 25    super();
 26    this.isCreditStage = isCreditStage;
 27    FiNextState = TCcrConst.CPS_PAY;
 28    //增加是否為信用卡分期CREDIT_STAGE  or 一般刷卡 CREDIT_PAY add by daff 20181227 start
 29      if (isCreditStage) {
 30          FoSale.setSTAGE_BANK("CREDIT_STAGE");
 31      }else{
 32          FoSale.setSTAGE_BANK("CREDIT_PAY");
 33      }
 34      //增加是否為信用卡分期CREDIT_STAGE  or 一般刷卡 CREDIT_PAY add by daff 20181227 end
 35  }
 36  /**
 37   * 檢核在哪些交易流程狀態下可執行
 38   */
 39  protected boolean inCcrSate() {
 40    int aRunSate[] = {TCcrConst.CPS_WAIT_PAY, TCcrConst.CPS_PAY,TCcrConst.CPS_LOCK_PAY};
 41    return GenUtil.isIntKeyInArray(aRunSate, FoCcr.getCurrnetState());
 42  }
 43  //轉換狀態是否可合法
 44  protected boolean trsCcrStateIsOK() {
 45      //add by Ares 20200729 線下繳費限定付款方式
 46      // 檢查是否有設定限定付款別
 47      String sLimitPayNo = FoSale.getFsLimitPayNo();
 48      if (!emisUtil.isEmpty(sLimitPayNo)) {
 49          CcrUtil.setMessage("限定付款別 = " + sLimitPayNo);
 50          //CcrUtil.setMessage("目前限定付款別 = " + FsPAY_NO);
 51          if (sLimitPayNo.indexOf("," + TCcrConst.PAY_CREDIT + ",") < 0) {
 52            FsErrMsg ="無法使用此付款方式";
 53            return eventOver(false);
 54          }
 55      }
 56
 57    if (isCreditStage) {
 58      if (FoCcr.getCurrentSale().IsOnlyOrder()) {
 59        FsErrMsg = "純客訂不可信用卡分期";
 60        return eventOver(false);
 61      }
 62    }
 63    // 行動支付不能混合付款
 64    if (FoSale.getSaleItemCount() > 0) {
 65      if (FoSale.isExistedLinePay()) {
 66        FsErrMsg = "行動支付不能和其他付款方式併用";
 67        return eventOver(false);
 68      }
 69    }
 70    //
 71    String _sEntryAmt = FoCcr.UInotify.receivceMainDisplayEntryData();
 72    if (emisUtil.isEmpty(_sEntryAmt)) {
 73      iEntryAmt = (int)FoCcr.getCurrentSale().getUnpaidAmout();
 74    } else {
 75      iEntryAmt = emisUtil.parseInt(_sEntryAmt);
 76    }
 77//    ((webccr) UI.getCurrent()).getlog().info(webccr.class, "信用卡金額:" + iEntryAmt);
 78    CcrUtil.setMessage("信用卡金額:" + iEntryAmt);
 79    if (iEntryAmt > FoCcr.getCurrentSale().getUnpaidAmout()
 80        || iEntryAmt <= 0) {
 81      FsErrMsg = "超過已未付金額";
 82      return eventOver(false);
 83    }
 84    //
 85    loadWindow();
 86    return eventOver(true);
 87  }
 88  private void loadWindow() {
 89    int iTransType = EDCUtil.NORMAIL_SALE;    // 一般銷售
 90    if (isCreditStage) {
 91      iTransType = EDCUtil.CARD_CREDITSTAGE;  // 分期
 92    }
 93    // isCreditStage = true 表示需要開商品分期數視窗,反之則否
 94    EDCUtil edcUtil = new EDCUtil(iTransType, this, isCreditStage);
 95    // 不開窗,傳入金額與分期數
 96      if (!isCreditStage) {
 97      edcUtil.setiCreditStageAmt(iEntryAmt); // 刷卡金額
 98        edcUtil.setsStage(""); // 分期數
 99    }
100    edcUtil.openPartWin();
101  }
102}