/** * 通过终止审批 * * @param con * @param user * @throws Exception */ public void passStop(Connection con, JUser user) throws Exception { PreparedStatement pstmt = null; String sql = null; GroupBook book = GroupBook.getGroupBook(con, this.getGroup_id()); sql = " update t_ym_book set group_status = -1, group_stop_status = 4 " + " where group_id = ? and group_stop_status = 2 and group_status >= 4 "; pstmt = con.prepareStatement(sql); pstmt.setString(1, this.group_id); pstmt.executeUpdate(); pstmt.close(); String subject = book.getGroup_name() + "的" + GroupBasic.getGroupTypeName(this.getGroup_type()) + "终止审批已通过"; int msgWay = JMessageEnum.SYSTEM_MESSAGE; JMessageAdapter.sendMessage( msgWay, new String[] {book.getZxgw_id()}, subject, subject, "-1", "/ym/group/groupBookControl.jsp?cmd=update&group_id=" + this.getGroup_id(), 1); }
/** * 通过审批 * * @param con * @param user * @throws Exception */ public void pass(Connection con, JUser user) throws Exception { PreparedStatement pstmt = null; String sql = null; GroupBook book = GroupBook.getGroupBook(con, this.getGroup_id()); String subject = null; if (JUtil.convertNull(book.getGroup_no()).length() == 0) { sql = " update t_ym_book set group_no = ? " + " where group_id = ? and group_status < 4 "; pstmt = con.prepareStatement(sql); pstmt.setString(1, createGroupNO()); pstmt.setString(2, this.group_id); pstmt.executeUpdate(); pstmt.close(); } subject = book.getGroup_name() + "的" + GroupBasic.getGroupTypeName(this.getGroup_type()) + "审批已已通过"; sql = " update t_ym_book set group_status = 4, pass_date = ? " + " where group_id = ? and group_status < 4 "; pstmt = con.prepareStatement(sql); pstmt.setTimestamp(1, new java.sql.Timestamp(System.currentTimeMillis())); pstmt.setString(2, this.group_id); pstmt.executeUpdate(); pstmt.close(); int msgWay = JMessageEnum.SYSTEM_MESSAGE; JMessageAdapter.sendMessage( msgWay, new String[] {book.getZxgw_id()}, subject, subject, "-1", "/ym/group/groupBookControl.jsp?cmd=update&group_id=" + this.getGroup_id(), 1); }
/** * 审批 * * @param user * @param jobId * @param agree * @param suggest */ public void approve(JUser user, String jobId, boolean agree, String suggest) throws Exception { GroupBook book = null; Connection con = null; PreparedStatement pstmt = null; String sql = null; Job job = null; java.util.Map<String, Object> context = new java.util.HashMap<String, Object>(); StringBuffer contextXML = new StringBuffer(); context.put("user_id", user.getUserId()); // 当前操作人 context.put("approveFlag", (agree ? "1" : "0")); // 审批标记 context.put("suggest", suggest); // 审批意见 try { con = JDatabase.getJDatabase().getConnection(); con.setAutoCommit(false); book = GroupBook.getGroupBook(con, this.getGroup_id()); job = Job.getJobById(con, jobId); contextXML.append("<ContextData>"); if (agree) { contextXML.append("<onlyManager>N</onlyManager>"); contextXML.append("<Participants>"); contextXML.append("<Participant type=\"user\"></Participant>"); contextXML.append("</Participants>"); } contextXML.append("</ContextData>"); context.put("contextXML", contextXML.toString()); job.setContext(context); job.start(con); if (!agree) { int msgWay = JMessageEnum.SYSTEM_MESSAGE; String subject = null; sql = "update t_ym_book set group_status = 3 where group_id = ? "; subject = book.getGroup_name() + "的" + GroupBasic.getGroupTypeName(this.getGroup_type()) + "审批未通过,原因:" + suggest; pstmt = con.prepareStatement(sql); pstmt.setString(1, this.getGroup_id()); pstmt.executeUpdate(); pstmt.close(); JMessageAdapter.sendMessage( msgWay, new String[] {book.getZxgw_id()}, subject, subject, "-1", "/ym/group/groupBookControl.jsp?cmd=update&group_id=" + this.getGroup_id(), 1); } else if (job.getActivityId().equals("manager")) { this.pass(con, user); } con.commit(); } catch (Exception e) { throw e; } finally { if (con != null) con.rollback(); if (con != null) con.close(); } }
public static GroupBook getGroupBook(Connection con, String group_id) throws Exception { GroupBook book = null; PreparedStatement pstmt = null; ResultSet rs = null; String sql = null; sql = " select group_id, group_no, group_type, contact, contact_phone, contact_handset, contact_fax, " + " countries, countries_name, group_name, inquire_date, memo, company_id, modify_memo," + " zxgw_id, zxgw_name, take_out, group_status, group_stop_status,creater, createrName,created " + " from t_ym_book where group_id = ? "; pstmt = con.prepareStatement(sql); pstmt.setString(1, group_id); rs = pstmt.executeQuery(); if (rs.next()) { book = new GroupBook(); book.setGroup_id(group_id); book.setGroup_name(rs.getString("group_name")); book.setInquire_date(rs.getDate("inquire_date")); book.setGroup_type(rs.getInt("group_type")); book.setGroup_no(rs.getString("group_no")); book.setMemo(rs.getString("memo")); book.setContact(rs.getString("contact")); book.setContact_handset(rs.getString("contact_handset")); book.setContact_phone(rs.getString("contact_phone")); book.setContact_fax(rs.getString("contact_fax")); book.setCountries(rs.getString("countries")); book.setCountries_name(rs.getString("countries_name")); book.setModify_memo(rs.getString("modify_memo")); book.setCompany_id(rs.getString("company_id")); book.setZxgw_id(rs.getString("zxgw_id")); book.setZxgw_name(rs.getString("zxgw_name")); book.setTake_out(rs.getString("take_out")); book.setGroup_status(rs.getInt("group_status")); book.setGroup_stop_status(rs.getInt("group_stop_status")); book.setCreater(rs.getString("creater")); book.setCreaterName(rs.getString("createrName")); book.setCreated(rs.getTimestamp("created")); } rs.close(); pstmt.close(); return book; }