Example #1
0
  private int doConfirm(
      SessionContext ctx,
      DatabaseConnection conn,
      FormInstance instance,
      ErrorMessages msgs,
      boolean isPass) {

    try {

      MyDB.getInstance().addDBConn(conn);

      XfactpaydetlDao paydetldao = XfactpaydetlDaoFactory.create(conn.getConnection());
      Xfactpaydetl xfactpaydetl = paydetldao.findByPrimaryKey(journalno);

      if (xfactpaydetl == null) {
        return -1;
      }

      UserManager um = (UserManager) ctx.getAttribute(SystemAttributeNames.USER_INFO_NAME);
      xfactpaydetl.setCheckerid(um.getUserName());
      xfactpaydetl.setCheckdate(new java.util.Date()); // TODO DB TIME

      XfactpaydetlPk paydetlpk = new XfactpaydetlPk();
      paydetlpk.setJournalno(journalno);

      XfcontractDao contractdao = XfcontractDaoFactory.create(conn.getConnection());
      XfcontractPk contractpk = new XfcontractPk(xfactpaydetl.getContractno());
      Xfcontract xfcontract = contractdao.findByPrimaryKey(xfactpaydetl.getContractno());
      if (xfcontract == null) {
        msgs.add("此笔放款记录对应的合同信息未找到,请查询。");
        return -1;
      }

      // TODO:增加XFCONTRACT表字段:贷款发放经办复核人员时间信息
      // xfcontract.(um.getUserName());
      // xfcontract.setCheckdate(new java.util.Date());

      if (isPass) {
        xfactpaydetl.setPaystatus("3"); // 设置状态为“审核通过”  TODO:CONSTANT
      } else {
        xfactpaydetl.setPaystatus("2"); // 设置状态为“驳回”  TODO:CONSTANT
      }
      paydetldao.update(paydetlpk, xfactpaydetl);

      /*
      合同状态处理
       */

      if (isPass) {
        xfcontract.setCstatus(XFContractStatus.FANGKUAN_TONGGUO); // 设置状态为“放款通过”
      } else {
        xfcontract.setCstatus(XFContractStatus.FANGKUAN_BOHUI); // 设置状态为“放款驳回”
      }
      contractdao.update(contractpk, xfcontract);

      return 0;
    } catch (Exception e) {
      msgs.add("系统发生异常:" + e.getMessage());
      Debug.debug(e);
      return -1;
    } finally {
      MyDB.getInstance().releaseDBConn();
    }
  }
Example #2
0
  public int postInsertOk(
      SessionContext ctx,
      DatabaseConnection conn,
      FormInstance instance,
      ErrorMessages msgs,
      EventManager manager) {
    if (this.isG) {
      return conn.executeUpdate(
          "delete from cmguarantor where id='" + ctx.getParameter("ID") + "'");
    }

    if (this.initClientNo == null) {
      return 0;
    }

    MyDB.getInstance().addDBConn(conn);
    int ret = 0;
    try {
      UserManager um = (UserManager) ctx.getAttribute(SystemAttributeNames.USER_INFO_NAME);
      String OPERATOR = null;
      OPERATOR = um.getUserName();

      String clientno = null;

      if (this.initClientNo != null) {
        if (currClientNo == null) {
          msgs.add("客户号码未发现,请重做交易!");
          return -1;
        } else {
          ret = ClientMigration.clientMrig(initClientNo, currClientNo, OPERATOR);
          if (ret >= 0) {
            /** I comment following line temporarily to speed up perfomance JGO on 20040905 */
            // ret = CMClientMan.updateClientCatAndType(currClientNo, OPERATOR);
            ret = 0;
          }
          if (ret < 0) {
            String msg = PropertyManager.getProperty("" + ret);
            if (msg == null) {
              msg = "" + ret;
            }
            ctx.setRequestAtrribute("title", "客户信息移行");
            ctx.setRequestAtrribute("msg", "处理失败:" + msg);
            ctx.setRequestAtrribute("flag", "0");
            ctx.setTarget("/showinfo.jsp");
          } else {
            ctx.setRequestAtrribute("title", "客户信息移行");
            ctx.setRequestAtrribute("msg", "处理成功完成!");
            ctx.setRequestAtrribute("flag", "1");
            ctx.setTarget("/showinfo.jsp");
          }
        }
      }
    } catch (Exception e) {
      if (Debug.isDebugMode) {
        e.printStackTrace();
      }
      ret = -1;
    } finally {
      MyDB.getInstance().releaseDBConn();
      return ret;
    }
  }