ApproveRecordManager.java
资源名称:OA.rar [点击查看]
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:6k
源码类别:
OA系统
开发平台:
Java
- package com.gforce.gfoa;
- import com.gforce.currency.database.*;
- import com.gforce.currency.*;
- import java.util.*;
- /**
- *
- * <p>Title: 吉力科技办公自动化系统</p>
- * <p>Description: 吉力科技办公自动化系统</p>
- * <p>Copyright: 版权所有 2003 (c) 西安吉力科技发展有限公司 Copyright (c) 2003 GForce Sceince & Technology</p>
- * <p>Company: 西安吉力科技发展有限公司 (GForce Sceince & Technology)</p>
- * @author 王江涛
- * @version 1.0
- * 申请记录管理类
- * Date 2003/09/03
- */
- public class ApproveRecordManager
- extends RecordManager {
- public ApproveRecordManager() {
- }
- protected final static String TableName = "ApproveRecord"; //定义声明本类操作表名称
- protected final static String IDFieldName = "ID"; //定义声明主键或者可以确定唯一记录的字段名称为“ID”,必须为自增整型
- protected final static String[] NumericFieldsName = {"RecordID","ApproveUserID","IsAgreed","ApproveLevel"}; //声明数值型字段名称
- protected final static String[] StringFieldsName = {"ApproveUserID","Content"}; //声明字符型字段名称
- protected final static String[] DatetimeFieldsName = {"ApproveTime"}; //声明日期时间型字段名称
- protected final static String[] TextFieldsName = {}; //声明大字符串型字段名称
- /**
- * 根据字段名称获取插入数据时表单元素名称
- * @param strFieldName 字段名称
- * @return 表单素名称
- */
- protected String InsertParament(String strFieldName) {
- return "" + strFieldName + ""; //可以根据需要加前缀、后缀
- }
- /**
- * 根据字段名称获取修改数据时表单元素名称
- * @param strFieldName 字段名称
- * @return 表单素名称
- */
- protected String UpdateParament(String strFieldName) {
- return "" + strFieldName + ""; //可以根据需要加前缀、后缀
- }
- /**
- * 获取本类操作表名称
- * @return 表名称
- */
- public String getTableName() { //获取本类操作表名称
- return TableName;
- }
- protected String getIDFieldName() { //获取主键或者可以确定唯一记录的字段名称
- return IDFieldName;
- }
- protected String[] getNumericFieldsName() { //获取数值型字段名称
- return NumericFieldsName;
- }
- protected String[] getStringFieldsName() { //获取字符型字段名称
- return StringFieldsName;
- }
- protected String[] getDatetimeFieldsName() { //获取日期时间型字段名称
- return DatetimeFieldsName;
- }
- protected String[] getTextFieldsName() { //获取大字符串型字段名称
- return TextFieldsName;
- }
- /**
- * 获取所有的记录并按“RecordID”排序
- * @return 所有记录的数据集
- */
- public static Vector getAllRecord()
- {
- Vector vt = SQLManager.GetResultSet("SELECT * FROM " + TableName +
- " ORDER BY RecordID");
- return vt;
- }
- /**
- * 根据用户获取审计记录
- * @param iUserID 指定的用户ID
- * @return 待审批数据集
- */
- public static Vector getRecordByUserID(int iUserID)
- {
- Vector vt = SQLManager.GetResultSet("SELECT * FROM " + TableName +
- " Where (ApproveUserID = "+ iUserID +")And(ApproveTime is Null) ORDER BY ID");
- return vt;
- }
- /**
- * 获取指定申请记录的审批记录
- * @param iRecordID 指定记录
- * @param strApproveType 批准类型
- * @return 审批记录数据集
- */
- public static Vector getRecordByRecordID(int iRecordID,String strApproveType)
- {
- Vector vt = SQLManager.GetResultSet("SELECT * FROM " + TableName +
- " Where (RecordID = "+ iRecordID +") and ApproveType='" + strApproveType+ "' ORDER BY ID");
- return vt;
- }
- /**
- * 获取指定的申请记录是否已经有人审批
- * @param iRecordID 指定的申请记录ID
- * @return 是否已经审批。false:没有人审批;true:已有人审批。
- */
- public static boolean getISConfirmByRecordID(String strApproveType, int iRecordID)
- {
- boolean ISConfirm = false;
- Vector vt = SQLManager.GetResultSet("SELECT * FROM " + TableName +
- " Where (RecordID = " + iRecordID + ") And(ApproveType = '" + strApproveType + "') And (Not(ApproveTime is Null)) ORDER BY ID");
- if (vt.size() > 0) ISConfirm = true;
- return ISConfirm;
- }
- /**
- * 增加审批记录
- * @param strApproveType 审批类型
- * @param iRecordID 记录ID
- * @param iUserID 审批用户ID
- * @param iApproveLevel 审批级别
- * @return 错误代码
- */
- public static int insertApproveRecord(String strApproveType,int iRecordID,int iUserID,int iApproveLevel)
- {
- return SQLManager.ExcuteSQL("insert into " + TableName + " (ApproveType,RecordID,ApproveUserID,ApproveLevel) values('" + strApproveType + "'," + iRecordID + "," + iUserID + "," + iApproveLevel + ")");
- }
- /**
- * 审批申请
- * @param iRecordID 要审批的记录ID
- * @param iUserID 审批用户
- * @param iIsAgreed 是否同意
- * @param strContent 审批意见
- * @return 错误代码
- */
- public static int ExamineAndApprove(String strApproveType, int iRecordID,int iUserID, int iIsAgreed, String strContent)
- {
- java.util.Date t_Date = new java.util.Date();
- String strConfirmDateTime = StringNew.GetDateString(t_Date, "yyyy-MM-dd HH:mm:ss");
- return SQLManager.ExcuteSQL("UPDATE " + TableName + " SET IsAgreed = " + iIsAgreed + ", Content = '" + strContent
- + "', ApproveTime = '" + strConfirmDateTime +
- "' WHERE (RecordID = " + iRecordID + ")AND(ApproveUserID = " + iUserID + ")AND(ApproveType = '" + strApproveType +"')");
- }
- /**
- * 删除指定父级记录ID和审批类型的审批记录
- * @param iRecordID 父级记录ID
- * @param strApproveType 审批类型
- */
- public static void delApproveRecord(int iRecordID,String strApproveType)
- {
- SQLManager.ExcuteSQL("Delete from " + TableName + " where RecordID=" + iRecordID + " and ApproveType='" + strApproveType + "'");
- }
- }