Ejemplo n.º 1
0
 // 当天交易查询的sql条件
 private StringBuffer getConditionSql(
     String queryTable,
     String mid,
     Integer gate,
     Integer tstat,
     Integer type,
     String oid,
     Integer gid,
     String date,
     Integer bdate,
     Integer edate,
     String tseq,
     String bkseq,
     Integer bkCheck,
     Integer mstate,
     String begintrantAmt,
     String endtrantAmt) {
   StringBuffer condition = new StringBuffer();
   // String a="(select * from "+queryTable+" where type!=11) as a ";
   condition.append(" FROM ").append(queryTable + " as a, minfo m ").append(" WHERE  a.mid=m.id ");
   if (!Ryt.empty(mid)) condition.append(" AND a.mid = " + Ryt.addQuotes(mid));
   if (gate != null) condition.append(" AND a.gate = " + gate);
   if (tstat != null) condition.append(" AND a.tstat = " + tstat);
   if (type != null) {
     condition.append(" AND a.type = " + type);
   } else {
     condition.append(" AND a.type not in (11,12,16,17,14) ");
   }
   if (!Ryt.empty(tseq)) condition.append(" AND a.tseq = " + Ryt.addQuotes(tseq));
   if (gid != null) condition.append(" AND a.gid = " + gid);
   if (!Ryt.empty(oid)) condition.append(" AND a.oid like " + Ryt.addQuotes("%" + oid + "%"));
   if (date != null) {
     if (bdate != null) condition.append(" AND " + date + " >= " + bdate);
     if (edate != null) condition.append(" AND " + date + " <= " + edate);
   }
   if (!Ryt.empty(bkseq)) {
     condition.append(" AND (a.bk_seq1 = " + Ryt.addQuotes(bkseq));
     condition.append(" OR a.bk_seq2 = " + Ryt.addQuotes(bkseq));
     condition.append(" ) ");
   }
   if (bkCheck != null) {
     condition.append(" AND a.bk_chk= " + bkCheck);
   }
   if (mstate != null) {
     condition.append(" AND m.mstate= " + mstate);
   }
   if (!Ryt.empty(begintrantAmt)) {
     condition.append(" AND a.amount>= " + Ryt.mul100toInt(begintrantAmt));
   }
   if (!Ryt.empty(endtrantAmt)) {
     condition.append(" AND a.amount<=" + Ryt.mul100toInt(endtrantAmt));
   }
   return condition;
 }
Ejemplo n.º 2
0
  @Override
  public List<String> getSql(String flowNo, String serviceType) {
    List<String> sqlList = new ArrayList<String>();

    String tseq = Ryt.genOidBySysTime();
    int bkResTime = DateUtil.getCurrentUTCSeconds();
    int bkResDate = DateUtil.today();

    StringBuffer sql = new StringBuffer();
    sql.append("insert into hlog(tseq,version,ip,mdate,mid,bid,oid,amount,type,gate,author_type,");
    sql.append("sys_date,init_sys_date,sys_time,fee_amt,tstat,bk_flag,bk_send,bk_recv,bk_date,");
    sql.append("bk_seq1,bk_seq2,trans_period,gid,bk_fee_model,pay_amt,data_source,p9) ");
    sql.append(" values(" + tseq + ",10,0,");
    sql.append(orderDate + ",");
    sql.append(Ryt.addQuotes(merId) + ",");
    sql.append(Ryt.addQuotes(merId) + ",");
    sql.append(Ryt.addQuotes(ordId) + ",");
    sql.append(transAmt + ",");
    sql.append(transMode + ",");
    sql.append(gateId + ",0,");
    sql.append(sysDate + ",");
    sql.append(sysDate + ",");
    sql.append(sysTime + ",");
    sql.append(merFee + ",");
    sql.append(transState + ",1,");
    sql.append(sysTime + ",");
    // sql.append(bkResTime + ",");
    sql.append(sysTime + ",");
    sql.append(sysDate + ",");
    sql.append(Ryt.addQuotes(bkSeq) + ",");
    sql.append(Ryt.addQuotes(bkSeq) + ",0,");
    sql.append(gid + ",");
    sql.append(Ryt.addQuotes(bkFeeMode) + ",");
    sql.append(payAmt + ",4,");
    sql.append(Ryt.addQuotes(flowNo) + ")");

    sqlList.add(sql.toString());

    if (transState == Constant.PayState.SUCCESS) {
      AccSeqs params = new AccSeqs();
      params.setUid(merId);
      params.setAid(merId);
      params.setTrAmt(transAmt);
      params.setTrFee(merFee);
      params.setAmt(transAmt - merFee);
      params.setRecPay((short) Constant.RecPay.INCREASE);
      params.setTbName(Constant.HLOG);
      params.setTbId(tseq);
      params.setRemark(serviceType + "同步");

      // 账户流水记未结算金额
      List<String> list = RecordLiveAccount.recordAccSeqsAndCalLiqBalance(params);
      if (list != null) sqlList.addAll(list);
    }

    return sqlList;
  }