コード例 #1
0
ファイル: CMIndvClient.java プロジェクト: fordream/zhan-cms
 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
ファイル: CMIndvClient.java プロジェクト: fordream/zhan-cms
 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
ファイル: CMIndvClient.java プロジェクト: fordream/zhan-cms
  public int preEdit(
      SessionContext ctx,
      DatabaseConnection conn,
      FormInstance instance,
      ErrorMessages msgs,
      EventManager manager,
      SqlAssistor assistor) {
    String CLIENTNO = ctx.getParameter("CLIENTNO").trim();
    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();
    String LASTMODIFIED = SystemDate.getSystemDate2();
    UserManager um = (UserManager) ctx.getAttribute(SystemAttributeNames.USER_INFO_NAME);
    String BrhId = SCUser.getBrhId(um.getUserName());
    String OPERATOR = null;
    try {
      OPERATOR = um.getUserName();
    } catch (Exception ex) {
      return -1;
    }
    // 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;
    }
    String str1 =
        "select * from CMINDVCLIENT where ID='"
            + ID
            + "' and clientno<>'"
            + ctx.getParameter("CLIENTNO")
            + "'";
    String str2 =
        "select * from CMINDVCLIENT where ID like '"
            + ID2
            + "%' and clientno<>'"
            + ctx.getParameter("CLIENTNO")
            + "'";
    RecordSet rs1 = conn.executeQuery(str1);
    RecordSet rs2 = conn.executeQuery(str2);
    if (rs1.next() || rs2.next()) {
      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;
    //    }
    assistor.setSqlFieldValue(assistor.getDefaultTbl(), "MNTBRHID", BrhId);
    assistor.setSqlFieldValue(assistor.getDefaultTbl(), "LASTMODIFIED", LASTMODIFIED);
    assistor.setSqlFieldValue(assistor.getDefaultTbl(), "OPERATOR", OPERATOR);
    return 0;
  }
コード例 #4
0
ファイル: CMIndvClient.java プロジェクト: fordream/zhan-cms
  /** 扩展基类的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;
  }