public void insert(Connection con, JUser user) throws Exception { PreparedStatement pstmt = null; ResultSet rs = null; String sql = null; sql = "update t_card set valid=1 where member_id=?"; pstmt = con.prepareStatement(sql); pstmt.setString(1, this.member_id); pstmt.executeUpdate(); pstmt.close(); this.card_id = com.gemway.util.ID.getIDObject("default").create(); sql = "insert into t_card " + " (card_id, regdate, card_no, member_id, card_class, op_type, moneyPaid, " + " paidOfPro, con_no, class_name, markup, created, createrName,valid)" + " values(?,?,?,?,?,?,?, ?,?,?,?,?,?,0)"; pstmt = con.prepareStatement(sql); int colIndex = 1; pstmt.setString(colIndex++, this.card_id); pstmt.setDate(colIndex++, this.regdate); pstmt.setString(colIndex++, this.card_no); pstmt.setString(colIndex++, this.member_id); pstmt.setString(colIndex++, this.card_class); pstmt.setInt(colIndex++, this.op_type); pstmt.setString(colIndex++, this.moneypaid); pstmt.setString(colIndex++, this.paidofpro); pstmt.setString(colIndex++, this.con_no); pstmt.setString(colIndex++, this.class_name); pstmt.setString(colIndex++, this.markup); pstmt.setTimestamp(colIndex++, new java.sql.Timestamp(System.currentTimeMillis())); pstmt.setString(colIndex++, user.getUserName()); pstmt.executeUpdate(); pstmt.close(); }
public void saveModify(Connection con, JUser juser, String modify_content) throws Exception { java.sql.Timestamp now = new java.sql.Timestamp(System.currentTimeMillis()); java.sql.PreparedStatement pstmt = null; String sql = null; String modify_memo = JUtil.convertNull(this.getModify_memo()); String szMemo = ""; if (modify_memo.getBytes().length > 950) { // 丢弃前100个字符 modify_memo = "..." + modify_memo.substring(100); } if (modify_memo.length() > 0) szMemo = "\n------------------------------------------\n"; szMemo = "\n" + JUtil.formatDate(now, "YYYY-MM-DD HH:mm") + juser.getUserName(); szMemo += " 修改本团组,以下为本次修改的内容及原因 \r\n"; szMemo += " 修改内容:\r\n" + modify_content; sql = " update t_ym_book " + " set modify_memo = ? " + " where group_status >= 4 and group_id = ? "; pstmt = con.prepareStatement(sql); pstmt.setString(1, modify_memo + szMemo); pstmt.setString(2, this.getGroup_id()); pstmt.executeUpdate(); pstmt.close(); }
public void save(Connection con, JUser juser) throws Exception { PreparedStatement pstmt = null; java.sql.Timestamp now = new java.sql.Timestamp(System.currentTimeMillis()); String sql = null; int idx = 1; if (JUtil.convertNull(this.getGroup_id()).equals("")) { sql = " insert into t_ym_book(group_id, group_name, inquire_date, group_no, contact," + " contact_phone, contact_handset, contact_fax, countries, countries_name, group_type, " + " memo, company_id, zxgw_id, zxgw_name, take_out, creater, createrName, created) " + " values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) "; pstmt = con.prepareStatement(sql); this.setGroup_id(JUtil.createUNID()); pstmt.setString(idx++, this.getGroup_id()); pstmt.setString(idx++, this.getGroup_name()); pstmt.setDate(idx++, this.getInquire_date()); pstmt.setString(idx++, this.getGroup_no()); pstmt.setString(idx++, this.getContact()); pstmt.setString(idx++, this.getContact_phone()); pstmt.setString(idx++, this.getContact_handset()); pstmt.setString(idx++, this.getContact_fax()); pstmt.setString(idx++, this.getCountries()); pstmt.setString(idx++, this.getCountries_name()); pstmt.setInt(idx++, this.getGroup_type()); pstmt.setString(idx++, this.getMemo()); pstmt.setString(idx++, this.getCompany_id()); pstmt.setString(idx++, this.getZxgw_id()); pstmt.setString(idx++, this.getZxgw_name()); pstmt.setString(idx++, this.getTake_out()); pstmt.setString(idx++, juser.getUserId()); pstmt.setString(idx++, juser.getUserName()); pstmt.setTimestamp(idx++, now); pstmt.executeUpdate(); pstmt.close(); } else { sql = " update t_ym_book set group_name = ?, inquire_date = ?, memo = ?, " + " group_no = ?, contact = ?, contact_phone = ?, contact_handset = ?, contact_fax = ?," + " countries = ?, countries_name = ?, zxgw_id = ?, zxgw_name = ?, take_out = ? " + " where group_id = ? "; pstmt = con.prepareStatement(sql); pstmt.setString(idx++, this.getGroup_name()); pstmt.setDate(idx++, this.getInquire_date()); pstmt.setString(idx++, this.getMemo()); pstmt.setString(idx++, this.getGroup_no()); pstmt.setString(idx++, this.getContact()); pstmt.setString(idx++, this.getContact_phone()); pstmt.setString(idx++, this.getContact_handset()); pstmt.setString(idx++, this.getContact_fax()); pstmt.setString(idx++, this.getCountries()); pstmt.setString(idx++, this.getCountries_name()); pstmt.setString(idx++, this.getZxgw_id()); pstmt.setString(idx++, this.getZxgw_name()); pstmt.setString(idx++, this.getTake_out()); pstmt.setString(idx++, this.getGroup_id()); pstmt.executeUpdate(); pstmt.close(); } }
/** * 获得对外合同申请的默认审批人 * * @param request * @param response * @return * @throws Exception */ private String calDefaultExterContractApprover( HttpServletRequest request, HttpServletResponse response) throws Exception { String xml = null; String company_id = JUtil.convertNull(request.getParameter("company_id")); String con_type = JUtil.convertNull(request.getParameter("con_type")); String con_money_str = JUtil.convertNull(request.getParameter("con_money")); String apply_user_id = JUtil.convertNull(request.getParameter("apply_user_id")); Double con_money = null; if (con_money_str.length() > 0) { try { con_money = Double.parseDouble(con_money_str); } catch (Exception e) { } } xml = "<?xml version='1.0' encoding='gbk'?>\n"; org.jdom.Element eleRoot = new org.jdom.Element("root"); org.jdom.Element eleRows = new org.jdom.Element("users"); eleRoot.addContent(eleRows); org.jdom.Element eleRow = null; try { Map<String, JUser> mapUser = null; if (company_id.length() > 0 && con_type.length() > 0) { boolean need_con_money = false; List<ExterContractType> lsType = ExterContractType.getContractTypeByCompany(company_id); for (ExterContractType type : lsType) { if (type.getCon_type_id().equals(con_type)) { if (type.getNeed_con_money() == 1) { need_con_money = true; } break; } } if (!need_con_money || con_money != null) { mapUser = ExterContractApply.getDefaultApprover( company_id, con_type, con_money == null ? 0 : con_money, apply_user_id); } } if (mapUser != null) { for (String userId : mapUser.keySet()) { JUser user = mapUser.get(userId); if (user == null) continue; eleRow = new org.jdom.Element("user"); eleRow.setAttribute("user_id", user.getUserId()); eleRow.setAttribute("user_name", user.getUserName()); eleRows.addContent(eleRow); } } org.jdom.output.XMLOutputter xmlout = new org.jdom.output.XMLOutputter(); xml += xmlout.outputString(eleRoot); JLog.getLogger().debug("xml=\n" + xml); return xml.trim(); } catch (Exception e) { JLog.getLogger().error("", e); } return ""; }
/** * 保存修改 * * @param con * @throws Exception */ public static void saveWithOutApproval( Connection con, JUser juser, String approval_type, String approval_type_name, String con_id) throws Exception { PreparedStatement pstmt = null; ResultSet rs = null; String sql = null; int idx = 1; int approvalCount = 0; sql = " select count(*) count from t_ym_process_approval where con_id = ? and approval_type = ? "; pstmt = con.prepareStatement(sql); pstmt.setString(idx++, con_id); pstmt.setString(idx++, approval_type); rs = pstmt.executeQuery(); if (rs.next()) { approvalCount = rs.getInt("count"); } rs.close(); pstmt.close(); if (approvalCount > 0) return; idx = 1; sql = " insert into t_ym_process_approval(approval_id, con_id, approver, status, " + " approval_type, approval_type_name, creater, createrName, created) " + " values(?, ?, ?, 4, ?, ?, ?, ?, ?) "; pstmt = con.prepareStatement(sql); pstmt.setString(idx++, JUtil.createUNID()); pstmt.setString(idx++, con_id); pstmt.setString(idx++, "-1"); pstmt.setString(idx++, approval_type); pstmt.setString(idx++, approval_type_name); pstmt.setString(idx++, juser.getUserId()); pstmt.setString(idx++, juser.getUserName()); pstmt.setTimestamp(idx++, new java.sql.Timestamp(System.currentTimeMillis())); pstmt.executeUpdate(); pstmt.close(); }
/** * 获得国内合作渠道申请的默认审批人 * * @param request * @param response * @return * @throws Exception */ private String calDefaultGnOrgApprover(HttpServletRequest request, HttpServletResponse response) throws Exception { String xml = null; String company_id = JUtil.convertNull(request.getParameter("company_id")); String dep_id = JUtil.convertNull(request.getParameter("dep_id")); String contract_template = JUtil.convertNull(request.getParameter("contract_template")); String hasDomain_name = JUtil.convertNull(request.getParameter("hasDomain_name")); xml = "<?xml version='1.0' encoding='gbk'?>\n"; org.jdom.Element eleRoot = new org.jdom.Element("root"); org.jdom.Element eleRows = new org.jdom.Element("users"); eleRoot.addContent(eleRows); org.jdom.Element eleRow = null; Connection con = null; try { con = com.gemway.igo.JDatabase.getJDatabase().getConnection(); Map<String, JUser> mapUser = GnOrgApply.getDefaultApprover(con, company_id, dep_id, contract_template, hasDomain_name); if (mapUser != null) { for (String userId : mapUser.keySet()) { JUser user = mapUser.get(userId); if (user == null) continue; eleRow = new org.jdom.Element("user"); eleRow.setAttribute("user_id", user.getUserId()); eleRow.setAttribute("user_name", user.getUserName()); eleRows.addContent(eleRow); } } org.jdom.output.XMLOutputter xmlout = new org.jdom.output.XMLOutputter(); xml += xmlout.outputString(eleRoot); // JLog.getLogger().debug("xml=\n" + xml); return xml.trim(); } catch (Exception e) { JLog.getLogger().error("", e); } finally { if (con != null) con.close(); } return ""; }
/** * 保存修改 * * @param con * @throws Exception */ public void save(Connection con, JUser juser) throws Exception { PreparedStatement pstmt = null; String sql = null; int idx = 1; int updateCount = 0; if (JUtil.convertNull(this.getApproval_id()).length() > 0) { sql = " update t_ym_process_approval set approver = ?, status = 2 where approval_id = ? and status in(1, 3) "; pstmt = con.prepareStatement(sql); pstmt.setString(idx++, this.getApprover()); pstmt.setString(idx++, this.getApproval_id()); updateCount = pstmt.executeUpdate(); pstmt.close(); if (updateCount != 1) throw new Exception( "更新的记录不只一条approval_id=" + this.getApproval_id() + " con_id=" + this.getCon_id()); } else { sql = " insert into t_ym_process_approval(approval_id, con_id, approver, status, " + " approval_type, approval_type_name, creater, createrName, created) " + " values(?, ?, ?,2, ?, ?, ?, ?, ?) "; pstmt = con.prepareStatement(sql); this.setApproval_id(JUtil.createUNID()); pstmt.setString(idx++, this.getApproval_id()); pstmt.setString(idx++, this.getCon_id()); pstmt.setString(idx++, this.getApprover()); pstmt.setString(idx++, this.getApproval_type()); pstmt.setString(idx++, this.getApproval_type_name()); pstmt.setString(idx++, juser.getUserId()); pstmt.setString(idx++, juser.getUserName()); pstmt.setTimestamp(idx++, new java.sql.Timestamp(System.currentTimeMillis())); pstmt.executeUpdate(); pstmt.close(); } }
public String getModifierName() { if (modifier == null || modifier.length() == 0) return ""; return JUser.getUserName(modifier); }
public String getCreaterName() { if (creater == null || creater.length() == 0) return ""; return JUser.getUserName(creater); }
/** * 根据地区代码或学校关键字得到学校 * * @param request * @param response * @return * @throws Exception */ private String checkRepeatGnOrg(HttpServletRequest request, HttpServletResponse response) throws Exception { String xml = "<?xml version='1.0' encoding='gbk'?>\n"; org.jdom.Element eleRoot = new org.jdom.Element("root"); CNHttpServletRequest _req = new CNHttpServletRequest(request); String company_id_kwd = JUtil.convertNull(_req.getParameter("company_id_kwd")); // String dep_id_kwd = JUtil.convertNull(_req.getParameter("dep_id_kwd")); String org_id_kwd = JUtil.convertNull(_req.getParameter("org_id_kwd")); String org_name_kwd = JUtil.convertNull( java.net.URLDecoder.decode(request.getParameter("org_name_kwd"), "utf-8")); // String org_name_kwd = JUtil.convertNull(_req.getParameter("org_name_kwd")); if (org_name_kwd.length() == 0) throw new Exception("机构名称为空!"); if (org_id_kwd.length() == 0) org_id_kwd = "-"; com.gemway.igo.page.Page pageObj = new com.gemway.igo.page.PageOracle(); java.util.List<com.gemway.igo.page.PageHashMap<String, Object>> lsDate = null; pageObj.setRequest(_req); org.jdom.Element eleRows = null; pageObj.setSelectPartSql( "company_id, a.org_id, org_no, org_name, shinyway_contracter, org_type"); pageObj.setFromPartSql("t_gn_org_company a, t_gn_org b"); pageObj.addWherePartSql(" a.org_id = b.org_id "); pageObj.addWherePartSql(" a.org_id != '" + org_id_kwd + "'"); pageObj.getPageInfo().setSize(21); pageObj.addWherePartSql(" org_name = ? "); pageObj.addWhereParam(org_name_kwd); pageObj.setOrderByPartSql(" created desc "); try { lsDate = pageObj.getPageData(); } catch (Exception e) { e.printStackTrace(); } for (int i = 0; i < lsDate.size(); i++) { com.gemway.igo.page.PageHashMap<String, Object> data = lsDate.get(i); eleRows = new org.jdom.Element("org"); if (data.getString("company_id").equals(company_id_kwd)) { // eleRows = new org.jdom.Element("org"); } else { // eleRows = new org.jdom.Element("other_company_org"); } eleRows.setAttribute("company_id", data.getString("company_id")); eleRows.setAttribute( "company_name", JUnit.getUnit(data.getString("company_id")).getUnit_name()); eleRows.setAttribute("org_id", data.getString("org_id")); eleRows.setAttribute("org_no", data.getString("org_no")); eleRows.setAttribute("org_name", data.getString("org_name")); eleRows.setAttribute("org_type", GnOrgBean.getOrgTypeNameById(data.getString("org_type"))); eleRows.setAttribute( "shinyway_contracter", data.getString("shinyway_contracter") == null ? "" : JUser.getUserName(data.getString("shinyway_contracter"))); eleRoot.addContent(eleRows); } org.jdom.output.XMLOutputter xmlout = new org.jdom.output.XMLOutputter(); xml += xmlout.outputString(eleRoot); JLog.getLogger().debug("xml=\n" + xml); return xml.trim(); }