示例#1
0
 public int preReference(
     SessionContext ctx,
     DatabaseConnection conn,
     FormInstance instance,
     ErrorMessages msgs,
     EventManager manager,
     String reffldnm,
     SqlWhereUtil sqlWhereUtil) {
   UserManager um = (UserManager) ctx.getAttribute(SystemAttributeNames.USER_INFO_NAME);
   //    if (reffldnm.equals("APPBRHID") || reffldnm.equals("CLIENTMGR") ||
   // reffldnm.equals("UNIONNO")) {
   if (reffldnm.equals("APPBRHID") || reffldnm.equals("CLIENTMGR")) {
     // BRHID(用户网点)
     String BRHID = SCUser.getBrhId(um.getUserName());
     if (BRHID == null || BRHID.length() < 1) {
       msgs.add("用户网点不存在!");
       return -1;
     }
     // SUBBRHIDs(用户网点下的所有实网点,包括自己)
     String SUBBRHIDs = SCBranch.getSubBranchAll(BRHID);
     if (SUBBRHIDs == null || SUBBRHIDs.length() < 1) {
       msgs.add("下属网点不存在!");
       return -1;
     } else {
       SUBBRHIDs = "'" + SUBBRHIDs.replaceAll(",", "','") + "'";
     }
     // sqlWhereUtil
     if (reffldnm.equals("APPBRHID")) {
       sqlWhereUtil.addWhereField(
           "SCBRANCH",
           "BRHID",
           SUBBRHIDs,
           SqlWhereUtil.DataType_Sql,
           sqlWhereUtil.OperatorType_In);
     }
     if (reffldnm.equals("CLIENTMGR")) {
       sqlWhereUtil.addWhereField(
           "SCUSER",
           "BRHID",
           SUBBRHIDs,
           SqlWhereUtil.DataType_Sql,
           sqlWhereUtil.OperatorType_In,
           sqlWhereUtil.RelationOperator_And);
       sqlWhereUtil.addWhereField(
           "SCUSER",
           "USERTYPE",
           "3",
           //                                   SqlWhereUtil.DataType_Number,
           SqlWhereUtil.DataType_Character,
           sqlWhereUtil.OperatorType_Not_Equals);
     }
     //      if (reffldnm.equals("UNIONNO")) {
     //        sqlWhereUtil.addWhereField("CMFAMILYUNION", "BRHID", SUBBRHIDs,
     //                                   SqlWhereUtil.DataType_Sql,
     //                                   sqlWhereUtil.OperatorType_In);
     //      }
   }
   return 0;
 }
示例#2
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;
 }
示例#3
0
  /** 扩展基类的preInsert方法,对实际业务做insert前的处理 */
  public int preInsert(
      SessionContext ctx,
      DatabaseConnection conn,
      FormInstance instance,
      ErrorMessages msgs,
      EventManager manager,
      SqlAssistor assistor) {
    String CLIENTNO = zt.cms.pub.code.ClientNo.getNextSN() + "";
    currClientNo = CLIENTNO;
    String ID = ctx.getParameter("ID").trim();
    String CLIENTMGR = ctx.getParameter("CLIENTMGR").trim();
    //    String UNIONNO = ctx.getParameter("UNIONNO").trim();
    //    String RGNCODE = ctx.getParameter("RGNCODE").trim();
    String MNTBRHID = ctx.getParameter("MNTBRHID").trim();
    String APPBRHID = ctx.getParameter("APPBRHID").trim();

    // ID唯一检测
    String ID2 = "";
    if (ID.length() == 18) {
      ID2 = ID.substring(0, 6) + ID.substring(8, 17);
    } else if (ID.length() == 15) {
      ID2 = ID.substring(0, 6) + "19" + ID.substring(6, 15);
    } else {
      msgs.add("个人证件号码长度不正确,请仔细检查您输入的号码!");
      return -1;
    }
    String tmp = "";
    if (ID.length() == 18) {
      tmp = ID2;
      ID2 = ID;
      ID = tmp;
    }
    if (DBUtil.getCellValue(conn, "CMINDVCLIENT", "CLIENTNO", "ID='" + ID + "'") != null
        || DBUtil.getCellValue(conn, "CMINDVCLIENT", "CLIENTNO", "ID LIKE '" + ID2 + "%'")
            != null) {
      msgs.add("个人证件号码已经存在,请仔细检查您输入的号码!");
      return -1;
    }
    // CLIENTMGR存在检测
    if (DBUtil.getCellValue(
            conn, "SCUSER", "LOGINNAME", "LOGINNAME='" + CLIENTMGR + "' and USERTYPE<>'3'")
        == null) {
      msgs.add("客户经理不存在,请仔细检查后再提交!");
      return -1;
    }
    // UNIONNO存在检测
    //    if (DBUtil.getCellValue(conn, "CMFAMILYUNION", "UNIONNO", "UNIONNO=" + UNIONNO) == null) {
    //      msgs.add("联户联保小组代码不存在,请仔细检查后再提交!");
    //      return -1;
    //   }
    // UNIONNO在开户网点内
    // RGNCODE存在检测
    //    if (RGNCODE.length() > 0 &&
    //        DBUtil.getCellValue(conn, "CMREGION", "RGNCODE", "RGNCODE='" + RGNCODE + "'") == null)
    // {
    //      msgs.add("行政机构代码不存在,请仔细检查后再提交!");
    //      return -1;
    //    }
    // 网点检测
    //    if (! (SCBranch.checkSub(APPBRHID, MNTBRHID) || MNTBRHID.equals(APPBRHID))) {
    //      msgs.add("业务网点不在维护网点范围内!");
    //      return -1;
    //    }
    if (SCBranch.getBrhtype(APPBRHID).equals("9")) {
      msgs.add("业务网点不能是虚网点!");
      return -1;
    }
    assistor.setSqlFieldValue(assistor.getDefaultTbl(), "CLIENTNO", CLIENTNO);
    return 0;
  }
示例#4
0
  /** 扩展基类的beforeInsert方法,点击“添加”按钮后响应的事件 */
  public int beforeInsert(
      SessionContext ctx,
      DatabaseConnection conn,
      FormInstance instance,
      ErrorMessages msgs,
      EventManager manager) {

    String GID = (String) ctx.getRequestAttribute("GID");
    String GIDTYPE = (String) ctx.getRequestAttribute("GIDTYPE");
    String GNAME = (String) ctx.getRequestAttribute("GNAME");
    String GCREDITCLASS = (String) ctx.getRequestAttribute("GCREDITCLASS");
    if (GID != null) {
      instance.setReadonly(false);
      instance.setValue("NAME", GNAME);
      instance.setValue("IDTYPE", GIDTYPE);
      instance.setValue("ID", GID);
      instance.setValue("CREDITCLASS", GCREDITCLASS);
      instance.setFieldReadonly("NAME", true);
      instance.setFieldReadonly("IDTYPE", true);
      instance.setFieldReadonly("ID", true);
      instance.setFieldReadonly("CREDITCLASS", true);
      this.isG = true;
    }

    UserManager um = (UserManager) ctx.getAttribute(SystemAttributeNames.USER_INFO_NAME);
    String BrhId = SCUser.getBrhId(um.getUserName());
    String APPDATE = SystemDate.getSystemDate5("");
    String OPERATOR = null;
    try {
      OPERATOR = um.getUserName();
    } catch (Exception ex) {
      return -1;
    }
    if (BrhId != null) {
      instance.setValue("MNTBRHID", BrhId);
      if (!SCBranch.getBrhtype(BrhId).trim().equals("9")) {
        instance.setValue("APPBRHID", BrhId);
      }
      instance.setValue("OPERATOR", OPERATOR);
      instance.setValue("APPDATE", APPDATE);
      instance.setValue("INVESTDATE", APPDATE);
      instance.setValue("LASTMODIFIED", APPDATE);
    }

    if (this.initClientNo != null) {
      MyDB.getInstance().addDBConn(conn);
      InitClientData initdata = InitClientMan.getInitClient(initClientNo);
      MyDB.getInstance().releaseDBConn();

      if (initdata == null) {
        msgs.add("移行客户信息不存在,请检查数据!");
        return -1;
      } else {
        if (initdata.appBrhID != null) {
          instance.setValue("APPBRHID", initdata.appBrhID);
        }
        if (initdata.appDate != null) {
          instance.setValue("APPDATE", util.calToString(initdata.appDate, null));
        }
        if (initdata.clientType != null) {
          instance.setValue("CLIENTTYPE", initdata.clientType.intValue());
        }
        if (initdata.ecomDeptType != null) {
          instance.setValue("ECOMDEPTTYPE", initdata.ecomDeptType.intValue());
        }
        if (initdata.ecomType != null) {
          instance.setValue("ECOMTYPE", initdata.ecomType.intValue());
        }
        if (initdata.etpScopType != null) {
          instance.setValue("ETPSCOPTYPE", initdata.etpScopType.intValue());
        }
        if (initdata.gender != null) {
          instance.setValue("GENDER", initdata.gender.intValue());
        }
        if (initdata.ID != null) {
          instance.setValue("ID", initdata.ID);
        }
        if (initdata.IDType != null) {
          // instance.setValue("IDTYPE", initdata.IDType.intValue());
        }
        if (initdata.name != null) {
          instance.setValue("NAME", initdata.name);
        }
        if (initdata.sectorCat1 != null) {
          instance.setValue("SECTORCAT1", initdata.sectorCat1.intValue());
        }
      }
    }
    return 0;
  }