/** * 通过终止审批 * * @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(); } }