public int preInsert( SessionContext ctx, DatabaseConnection conn, FormInstance instance, ErrorMessages msgs, EventManager manager, SqlAssistor assistor) { int seqNo = (int) BMReviewLimitCode.getNextNo(); assistor.setSqlFieldValue(assistor.getDefaultTbl(), "SEQNO", seqNo + ""); return 0; }
/** * Description of the Method * * @param ctx Description of the Parameter * @param conn Description of the Parameter * @param instance Description of the Parameter * @param msgs Description of the Parameter * @param manager Description of the Parameter * @param assistor Description of the Parameter * @return Description of the Return Value */ public int preInsert( SessionContext ctx, DatabaseConnection conn, FormInstance instance, ErrorMessages msgs, EventManager manager, SqlAssistor assistor) { int seqNo = (int) SerialNumber.getNextSN("BMLOANADMCHANGE", "SEQNO"); // System.out.println("Seqno:"+seqNo); instance.setValue("SEQNO", seqNo); assistor.setSqlFieldValue(assistor.getDefaultTbl(), "SEQNO", seqNo + ""); MyDB.getInstance().addDBConn(conn); return InactLoanMan.loanAdmByChange(this.bmno, ctx.getParameter("NEWADM")); }
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; }
/** 扩展基类的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; }