예제 #1
0
  public int buttonEvent(
      SessionContext ctx,
      DatabaseConnection conn,
      FormInstance instance,
      String button,
      ErrorMessages msgs,
      EventManager manager) {
    // String CLIENTNO = instance.getStringValue("CLIENTNO");
    String CLIENTNO = strClientNo;
    // String CLIENTNO = ctx.getParameter("CLIENTNO");
    if (CLIENTNO == null || CLIENTNO.length() < 1 || CLIENTNO.equals("自动生成")) {
      System.out.println(CLIENTNO);
      msgs.add("请确定个人客户资料信息已经存在!");
      return -1;
    }
    // setRequestAtrribute
    ctx.setRequestAtrribute("flag", flag);
    ctx.setRequestAtrribute("CLIENTNO", CLIENTNO);

    if (button.equals("CMINDVRELA")) {
      trigger(manager, "100012", null);
    } else if (button.equals("BMRQL")) {
      trigger(manager, "BMRQL1", null);
    } else if (button.equals("BMCREDITLMAINTPAGE")) {
      trigger(manager, "BMCREDITLMAINTPAGE", null);
    } else if (button.equals("PHOTO")) {
      // ctx.setRequestAtrribute("PHOTONO",ctx.getParameter("PHOTONO"));
      ctx.setRequestAtrribute("TABLENAME", "CMINDVCLIENT");
      ctx.setRequestAtrribute("WHERECONDITION", "clientno='" + CLIENTNO + "'");
      ctx.setRequestAtrribute("title", "个人客户图片");
      ctx.setRequestAtrribute("flag", this.flag);
      ctx.setTarget("/photo/photo.jsp");
    } else if (button.equals("CREDIT")) {
      RecordSet rs =
          conn.executeQuery("select id from CMINDVCLIENT where clientno='" + CLIENTNO + "'");
      if (!rs.next()) {
        msgs.add("取得id失败!");
        return -1;
      }
      String id = rs.getString("ID");
      ctx.setRequestAtrribute("ID", id);
      trigger(manager, "GUARANTORCREDITLIST", null);
      return 0;
    }

    /**
     * else if (button.equals("CMINDVASSET")) { trigger(manager, "100013", null); } else if
     * (button.equals("CMINDVDEBT")) { trigger(manager, "100014", null); } else if
     * (button.equals("CMINDVDEBTPAYMENT")) { trigger(manager, "100015", null); }
     */
    return 0;
  }
예제 #2
0
  /** 扩展基类的preDelete方法,对实际业务做删除前的检验 */
  public int preDelete(
      SessionContext ctx,
      DatabaseConnection conn,
      FormInstance instance,
      ErrorMessages msgs,
      EventManager manager,
      SqlAssistor assistor) {

    String cltNo = ctx.getParameter("CLIENTNO");

    String bmStr = "select * from bmtable where clientno='" + cltNo + "'";
    RecordSet bmRs = conn.executeQuery(bmStr);
    if (bmRs.next()) {
      msgs.add("还有业务没有删除");
      return -1;
    }

    RecordSet rs = conn.executeQuery("select id from CMINDVCLIENT where clientno='" + cltNo + "'");

    if (!rs.next()) {
      msgs.add("取得id失败!");
      return -1;
    } else {
      String id = rs.getString("ID");
      String tempStr = "select * from bmguarantor where id='" + id + "'";
      // System.out.println(tempStr);
      RecordSet tempRs = conn.executeQuery(tempStr);
      if (tempRs.next()) {
        msgs.add("还有担保的贷款,不能删除!");
        return -1;
      }
    }

    String sql1[] = new String[4];
    sql1[0] = "delete from CMINDVRELA where clientno='" + cltNo + "'";
    sql1[1] = "delete from CMINDVASSET where clientno='" + cltNo + "'"; //
    sql1[2] = "delete from CMINDVDEBT where clientno='" + cltNo + "'"; //
    sql1[3] = "delete from CMINDVDEBTPAYMENT where clientno='" + cltNo + "'"; //
    String sql2 = "";
    for (int i = 0; i < sql1.length; i++) {
      sql2 += sql1[i] + ";";
    }
    sql2 = sql2.substring(0, sql2.length() - 1);
    // System.out.println(sql2);
    int ret = conn.executeUpdate(sql2);
    return ret;
  }
예제 #3
0
 public int postFindOk(
     SessionContext ctx,
     DatabaseConnection conn,
     FormInstance instance,
     ErrorMessages msgs,
     EventManager manager,
     RecordSet result) {
   // BRHID(用户网点)
   UserManager um = (UserManager) ctx.getAttribute(SystemAttributeNames.USER_INFO_NAME);
   String BRHID = SCUser.getBrhId(um.getUserName());
   if (BRHID == null || BRHID.length() < 1) {
     msgs.add("登录用户信息错误!");
     return -1;
   }
   // APPBRHID(登记网点)
   String APPBRHID = result.getString("APPBRHID").trim();
   if (!(SCBranch.checkSub(APPBRHID, BRHID) || BRHID.equals(APPBRHID))) {
     msgs.add("对不起,该客户的资料不在您的维护网点范围内!");
     return -1;
   }
   return 0;
 }
예제 #4
0
  public int load(
      SessionContext ctx,
      DatabaseConnection conn,
      FormInstance instance,
      ErrorMessages msgs,
      EventManager manager,
      String parameter) {

    int userNo = SessionInfo.getLoginUserNo(ctx);
    String roleStr = "select * from scuserrole where userno=" + userNo + " and roleno=1";
    RecordSet roleRs = conn.executeQuery(roleStr);
    if (roleRs.next()) {
      instance.useCloneFormBean();
      instance.getFormBean().setUseDelete(true);
    }

    // flag
    flag = (String) ctx.getRequestAttribute("flag");
    if (flag == null) {
      flag = "read";
    }
    flag = flag.toLowerCase();
    if (flag.equals("write")) {
      instance.setReadonly(false);
    } else {
      instance.setReadonly(true);
    }
    // CLIENTNO
    String CLIENTNO = ctx.getParameter("CLIENTNO");
    if (CLIENTNO == null) {
      CLIENTNO = (String) ctx.getRequestAttribute("CLIENTNO");
    }
    initClientNo = (String) ctx.getRequestAttribute("INITCLIENTNO");
    guarantorID = (String) ctx.getRequestAttribute("GID");
    String sql = "select * from cmindvclient where ";
    if (CLIENTNO != null && CLIENTNO.length() > 0) {
      strClientNo = CLIENTNO;
      sql += "clientno='" + CLIENTNO + "'";
    } else if (guarantorID != null && guarantorID.trim().length() > 0) {
      sql += "id='" + guarantorID + "'";
    }
    if (sql.endsWith("where ")) {
      return 0;
    }

    RecordSet rs = conn.executeQuery(sql);
    if (rs.next()) {
      // lj del in 20090316
      //      UserManager um = (UserManager) ctx.getAttribute(SystemAttributeNames.USER_INFO_NAME);
      //      String BRHID = SCUser.getBrhId(um.getUserName()); //登录用户所在网点
      //      String APPBRHID = rs.getString("APPBRHID").trim(); //客户资料的登记网点
      //      if ( strClientNo!=null && ! (SCBranch.checkSub(APPBRHID, BRHID) ||
      // APPBRHID.equals(BRHID))) {
      //        flag = "read";
      //        msgs.add("该客户不在本网点维护范围内!");
      //        instance.setReadonly(true);
      //      }
      //      else
      if (guarantorID != null && guarantorID.trim().length() > 0) {
        flag = "read";
        msgs.add("客户信息已经存在,不需要再做转移,请删除原来的保证人信息即可!");
        instance.setReadonly(true);
        strClientNo = rs.getString("clientno");
      }
      // trigger
      instance.setValue("CLIENTNO", strClientNo);
      trigger(manager, instance, EventType.EDIT_VIEW_EVENT_TYPE, Event.BRANCH_CONTINUE_TYPE);
    }
    return 0;
  }