DocumentManagerPlus.java
资源名称:OA.rar [点击查看]
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:39k
源码类别:
OA系统
开发平台:
Java
- package com.gforce.gfoa;
- import com.gforce.currency.database.*;
- import java.util.*;
- import com.gforce.currency.*;
- /**
- * <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
- */
- public class DocumentManagerPlus
- extends RecordManager
- {
- public DocumentManagerPlus()
- {
- }
- protected final static String TableName = "Document"; //定义声明本类操作表名称
- protected final static String IDFieldName = "ID"; //定义声明主键或者可以确定唯一记录的字段名称为“ID”,必须为自增整型
- protected final static String[] NumericFieldsName =
- {
- "DocFlowTempletID", "BuildUserID", "FillUserID", "CurrentFlowTacheID"}; //声明数值型字段名称
- protected final static String[] StringFieldsName =
- {
- "DocumentName"}; //声明字符型字段名称
- protected final static String[] DatetimeFieldsName =
- {
- "BuildTime", "RemindTime"}; //声明日期时间型字段名称
- protected final static String[] BoolFieldsName =
- {
- "IsPigeonholed", "IsReminded"}; //声明布尔型字段名称
- 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[] getBoolFieldsName()
- { //获取布尔型字段名称
- return BoolFieldsName;
- }
- protected String[] getTextFieldsName()
- { //获取大文本型字段名称
- return TextFieldsName;
- }
- /**
- * 获取所有文档记录集
- * @return 所有文档记录集
- */
- public static Vector getAllRecord()
- {
- Vector vt = SQLManager.GetResultSet("Select * from " + TableName);
- return vt;
- }
- /**
- * 获取指定ID地记录
- * @param iDocID 指定地记录ID
- * @return 记录数据集
- */
- public static Vector getByIDRecord(int iDocID)
- {
- Vector vt = SQLManager.GetResultSet("Select * from " + TableName +
- " WHERE ID ='" + iDocID + "'");
- return vt;
- }
- /**
- * 按制定条件查询记录集
- * @param strID ID标识
- * @param strDocumentName 公文名称
- * @param iDocFlowTempletID 公文流转模板ID
- * @param strDocFlowTempletName 公文流转模板名称
- * @param iBuildUserID 生成用户ID
- * @param strBuildUserName 生成用户姓名
- * @param iFillUserID 填表用户ID
- * @param strFillUserName 填表用户ID
- * @param bIsPigeonholed 是否已经归档
- * @param iCurrentFlowTacheID 当前流程环节ID
- * @param strCurrentFlowTacheName 当前流程环节名称
- * @param iTacheStatus 当前流程环节状态ID
- * @param strTacheStatus 当前流程环节状态
- * @param bIsReminded 是否已经提醒
- * @param strRemindTime 提醒时间
- * @param strBuildTimeFrom 建立时间起始
- * @param strBuildTimeTo 建立时间截至
- * @param strOrderBy 排序字段
- * @param bIsDesc 是否降序排序
- * @return 符合条件记录向量集
- */
- public static Vector getRecordBySearch(String strID, String strDocumentName,
- int iDocFlowTempletID,
- String strDocFlowTempletName,
- int iBuildUserID,
- String strBuildUserName,
- int iFillUserID,
- String strFillUserName,
- boolean bIsPigeonholed,
- int iCurrentFlowTacheID,
- String strCurrentFlowTacheName,
- int iTacheStatus,
- String strTacheStatus,
- boolean bIsReminded,
- String strRemindTime,
- String strBuildTimeFrom,
- String strBuildTimeTo,
- String strOrderBy, boolean bIsDesc)
- {
- return getRecordBySearch(strID, strDocumentName, iDocFlowTempletID,
- strDocFlowTempletName, iBuildUserID,
- strBuildUserName, iFillUserID, strFillUserName,
- bIsPigeonholed, iCurrentFlowTacheID,
- strCurrentFlowTacheName, iTacheStatus,
- strTacheStatus, bIsReminded + "", strRemindTime,
- strBuildTimeFrom, strBuildTimeTo, strOrderBy,
- bIsDesc);
- }
- /**
- * 按制定条件查询记录集
- * @param strID ID标识
- * @param strDocumentName 公文名称
- * @param iDocFlowTempletID 公文流转模板ID
- * @param strDocFlowTempletName 公文流转模板名称
- * @param iBuildUserID 生成用户ID
- * @param strBuildUserName 生成用户姓名
- * @param iFillUserID 填表用户ID
- * @param strFillUserName 填表用户ID
- * @param bIsPigeonholed 是否已经归档
- * @param iCurrentFlowTacheID 当前流程环节ID
- * @param strCurrentFlowTacheName 当前流程环节名称
- * @param iTacheStatus 当前流程环节状态ID
- * @param strTacheStatus 当前流程环节状态
- * @param strIsReminded 是否已经提醒
- * @param strRemindTime 提醒时间
- * @param strBuildTimeFrom 建立时间起始
- * @param strBuildTimeTo 建立时间截至
- * @param strOrderBy 排序字段
- * @param bIsDesc 是否降序排序
- * @return 符合条件记录向量集
- */
- public static Vector getRecordBySearch(String strID, String strDocumentName,
- int iDocFlowTempletID,
- String strDocFlowTempletName,
- int iBuildUserID,
- String strBuildUserName,
- int iFillUserID,
- String strFillUserName,
- boolean bIsPigeonholed,
- int iCurrentFlowTacheID,
- String strCurrentFlowTacheName,
- int iTacheStatus,
- String strTacheStatus,
- String strIsReminded,
- String strRemindTime,
- String strBuildTimeFrom,
- String strBuildTimeTo,
- String strOrderBy, boolean bIsDesc)
- {
- return getRecordBySearch(strID, strDocumentName, iDocFlowTempletID,
- strDocFlowTempletName, iBuildUserID,
- strBuildUserName, iFillUserID, strFillUserName,
- bIsPigeonholed, iCurrentFlowTacheID,
- strCurrentFlowTacheName, iTacheStatus,
- strTacheStatus, strIsReminded, strRemindTime,
- strBuildTimeFrom, strBuildTimeTo, 0, strOrderBy,
- bIsDesc);
- }
- /**
- * 按制定条件查询记录集
- * @param strID ID标识
- * @param strDocumentName 公文名称
- * @param iDocFlowTempletID 公文流转模板ID
- * @param strDocFlowTempletName 公文流转模板名称
- * @param iBuildUserID 生成用户ID
- * @param strBuildUserName 生成用户姓名
- * @param iFillUserID 填表用户ID
- * @param strFillUserName 填表用户ID
- * @param bIsPigeonholed 是否已经归档
- * @param iCurrentFlowTacheID 当前流程环节ID
- * @param strCurrentFlowTacheName 当前流程环节名称
- * @param iTacheStatus 当前流程环节状态ID
- * @param strTacheStatus 当前流程环节状态
- * @param strIsReminded 是否已经提醒
- * @param strRemindTime 提醒时间
- * @param strBuildTimeFrom 建立时间起始
- * @param strBuildTimeTo 建立时间截至
- * @param iReadUserID 读取用户ID
- * @param strOrderBy 排序字段
- * @param bIsDesc 是否降序排序
- * @return 符合条件记录向量集
- */
- public static Vector getRecordBySearch(String strID, String strDocumentName,
- int iDocFlowTempletID,
- String strDocFlowTempletName,
- int iBuildUserID,
- String strBuildUserName,
- int iFillUserID,
- String strFillUserName,
- boolean bIsPigeonholed,
- int iCurrentFlowTacheID,
- String strCurrentFlowTacheName,
- int iTacheStatus,
- String strTacheStatus,
- String strIsReminded,
- String strRemindTime,
- String strBuildTimeFrom,
- String strBuildTimeTo, int iReadUserID,
- String strOrderBy, boolean bIsDesc)
- {
- String strSQL = "Select a.[ID], a.[DocumentName], a.[DocFlowTempletID], a.[BuildTime], a.[BuildUserID], a.[FillUserID]," +
- " a.[IsPigeonholed], a.[CurrentFlowTacheID], a.[IsReminded], a.[RemindTime]," +
- " c.[Name], d.[Name], e.[Name], f.[TacheName], f.[TacheStatus] from [" +
- TableName + "] as a" +
- " left outer join [UserInfo] as b on (a.BuildUserId=b.ID) left outer join [PersonnelInfo] as c on (b.PersonnelID=c.ID)" +
- " left outer join [UserInfo] as g on (a.FillUserID=g.ID) left outer join [PersonnelInfo] as d on (g.PersonnelID=d.ID)" +
- " left outer join [DocTempletMoveFlow] as e on (a.DocFlowTempletID=e.ID)" +
- " left outer join [FlowTacheInfo] as f on (a.CurrentFlowTacheID=f.ID) where a.[CurrentFlowTacheID]>-2";
- if (strDocumentName.trim().length() > 0)
- {
- strSQL += " and a.[DocumentName] like '%" + strDocumentName + "%'";
- }
- if (strDocFlowTempletName.trim().length() > 0)
- {
- strSQL += " and e.[Name] like '%" + strDocFlowTempletName + "%'";
- }
- if (strIsReminded.trim().equalsIgnoreCase("true"))
- {
- strSQL += " and a.[IsReminded] = 1";
- }
- else if (strIsReminded.trim().equalsIgnoreCase("false"))
- {
- strSQL += " and (a.[IsReminded] IS null OR a.[IsReminded] = 0)";
- }
- if (strBuildUserName.trim().length() > 0)
- {
- strSQL += " and c.[Name] like '%" + strBuildUserName + "%'";
- }
- if (strFillUserName.trim().length() > 0)
- {
- strSQL += " and d.[Name] like '%" + strFillUserName + "%'";
- }
- if (bIsPigeonholed)
- {
- strSQL += " and a.[IsPigeonholed] = 1";
- }
- else
- {
- strSQL += " and (a.[IsPigeonholed] IS null OR a.[IsPigeonholed] = 0)";
- }
- if (strCurrentFlowTacheName.trim().length() > 0)
- {
- strSQL += " and f.[TacheName] like '%" + strCurrentFlowTacheName + "%'";
- }
- if (strTacheStatus.trim().length() > 0)
- {
- strSQL += " and '%' + f.[TacheStatus] + '%' like '%" + strTacheStatus +
- "%'";
- }
- if (strBuildTimeFrom.trim().length() > 0)
- {
- strSQL += " and a.[BuildTime]>='" + strBuildTimeFrom + " 00:00:00.000'";
- }
- if (strBuildTimeTo.trim().length() > 0)
- {
- strSQL += " and a.[BuildTime]<='" + strBuildTimeTo + " 23:59:59.999'";
- }
- if (iReadUserID > 0)
- {
- strSQL += " and ',' + e.[ReadOnlyUserIDs] + ',' like '%," + iReadUserID +
- ",%'";
- }
- if (iDocFlowTempletID > 0)
- {
- strSQL += " and e.[DocFlowTempletID]=" + iReadUserID + "";
- }
- if (iCurrentFlowTacheID != 0)
- {
- strSQL += " and a.[CurrentFlowTacheID]=" + iCurrentFlowTacheID + "";
- }
- if (strOrderBy.trim().length() > 0)
- {
- if (bIsDesc)
- {
- strSQL += " Order by " + strOrderBy + " desc";
- }
- else
- {
- strSQL += " Order by " + strOrderBy + "";
- }
- }
- Vector vt = SQLManager.GetResultSet(strSQL);
- return vt;
- }
- /**
- * 插入记录
- * @param iDocTempletMoveFlowID 指定工作流ID
- * @param iUserID 用户ID
- * @param strIPAddress 用户IP地址
- * @param strDocTempletTableName 公文模板表名称
- * @return 返回错误代码
- */
- public static int InsertRecord(int iDocTempletMoveFlowID, int iUserID,
- String strIPAddress,
- String strDocTempletTableName)
- {
- return InsertRecord(iDocTempletMoveFlowID, iUserID, iUserID, strIPAddress,
- strDocTempletTableName);
- }
- /**
- * 插入记录
- * @param iDocTempletMoveFlowID 指定工作流ID
- * @param iBuildUserID 创建用户ID
- * @param iFillUserID 填写用户ID
- * @param strIPAddress 用户IP地址
- * @param strDocTempletTableName 公文模板表名称
- * @return 返回错误代码
- */
- public static int InsertRecord(int iDocTempletMoveFlowID, int iBuildUserID,
- int iFillUserID, String strIPAddress,
- String strDocTempletTableName)
- {
- Vector vt = DocTempletMoveFlowManager.getRecordBySearch(
- iDocTempletMoveFlowID + "", strDocTempletTableName);
- if (vt.size() == 1)
- {
- String strWritableUserIDs = ( (Vector) vt.get(0)).get(13).toString();
- String strWritableDepartIDs = ( (Vector) vt.get(0)).get(14).toString();
- String strDepartID = UserManager.getDepartmentIDByUserID(iFillUserID);
- String strDocName = "";
- String strBuildTime = StringNew.GetDateString(new Date(),
- "yyyy-MM-dd HH:mm:ss");
- String strMoveFlowID = ( (Vector) vt.get(0)).get(4).toString();
- if ( ( ("," + strWritableUserIDs + ",").indexOf("," + iFillUserID + ",") >=
- 0)
- ||
- ( ("," + strWritableDepartIDs + ",").indexOf("," + strDepartID + ",") >=
- 0))
- {
- int iDocTempletID = 0;
- try
- {
- iDocTempletID = Integer.parseInt( ( (Vector) vt.get(0)).get(2).
- toString());
- }
- catch (Exception e)
- {
- return -103;
- }
- Vector vtDocName = DocumentTempletManager.getRecordByID(iDocTempletID);
- if (vtDocName.size() == 1)
- {
- strDocName = ( (Vector) vtDocName.get(0)).get(1).toString();
- }
- else
- {
- return -101;
- }
- Vector vtMoveFlow = SQLManager.GetResultSet(
- "select ID from FlowTacheInfo where FlowID = " + strMoveFlowID
- + " and TacheStatus='S'");
- if (vtMoveFlow.size() == 1)
- {
- int iCurrentFlowTacheID = Integer.parseInt( ( (Vector) vtMoveFlow.get(
- 0)).get(0).toString());
- int i = SQLManager.ExcuteSQL("insert " + TableName
- + "(DocumentName, DocFlowTempletID, BuildTime, BuildUserID, FillUserID, CurrentFlowTacheID) values ('"
- + strDocName + "', " +
- iDocTempletMoveFlowID + ", '" +
- strBuildTime + "', "
- + iBuildUserID + ", " + iFillUserID +
- ", " + iCurrentFlowTacheID + ")");
- Vector vtID = SQLManager.GetResultSet("select ID from " + TableName +
- " where DocumentName='" +
- strDocName +
- "' and DocFlowTempletID=" +
- iDocTempletMoveFlowID +
- " and BuildTime='" +
- strBuildTime +
- "' and BuildUserID=" +
- iBuildUserID +
- " and FillUserID=" +
- iFillUserID +
- " and CurrentFlowTacheID=" +
- iCurrentFlowTacheID);
- int iDocID = Integer.parseInt( ( (Vector) vtID.get(0)).get(0).
- toString());
- return iDocID;
- }
- else
- {
- return -104;
- }
- }
- else
- {
- return -102;
- }
- }
- else
- {
- return -101;
- }
- }
- /**
- * 插入多条记录前保存IDs
- * @param strIDs 模板ID
- * @param iUserID 操作用户ID
- * @param strIPAddress 操作用户IP地址
- * @param strDocTempletTableName 公文模板表名称
- * @return 返回错误代码
- */
- public static int SendDocInsert(String strIDs, int iUserID,
- String strIPAddress,
- String strDocTempletTableName)
- {
- Vector vt = SQLManager.GetResultSet(
- "select ID from DocTempletMoveFlow where ID in (" + strIDs + ")");
- int returnValue = 0;
- if (vt.size() > 0)
- {
- for (int i = 0; i < vt.size(); i++)
- {
- int iDocTempletMoveFlowID = Integer.parseInt( ( (Vector) vt.get(i)).get(
- 0).toString());
- returnValue = InsertRecordMult(iDocTempletMoveFlowID, iUserID,
- strIPAddress, strDocTempletTableName);
- }
- }
- else
- {
- returnValue = -101;
- }
- return returnValue;
- }
- /**
- * 插入多条记录
- * @param iDocTempletMoveFlowID 指定工作流ID
- * @param iUserID 用户ID
- * @param strIPAddress 用户IP地址
- * @param strDocTempletTableName 公文模板表名称
- * @return 返回错误代码
- */
- public static int InsertRecordMult(int iDocTempletMoveFlowID, int iUserID,
- String strIPAddress,
- String strDocTempletTableName)
- {
- Vector vt = DocTempletMoveFlowManager.getRecordBySearch(
- iDocTempletMoveFlowID + "", strDocTempletTableName);
- if (vt.size() == 1)
- {
- String strWritableUserIDs = ( (Vector) vt.get(0)).get(13).toString();
- String strWritableDepartIDs = ( (Vector) vt.get(0)).get(14).toString();
- String strDepAllUser = "";
- if (strWritableDepartIDs.trim().length() > 0)
- {
- Vector vtDep = UserManager.getRecordByDepartmentIDs(
- strWritableDepartIDs);
- for (int j = 0; j < vtDep.size(); j++)
- {
- if (j >0)
- {
- strDepAllUser += ",";
- }
- strDepAllUser += ( (Vector) vtDep.get(j)).get(0).toString();
- }
- }
- if(strWritableUserIDs.trim().length()>0 && strDepAllUser.trim().length()>0)
- strDepAllUser = strWritableUserIDs + "," + strDepAllUser;
- else if(strWritableUserIDs.trim().length()>0)
- strDepAllUser = strWritableUserIDs;
- if(strDepAllUser.trim().length()>0)
- {
- Vector vtUserID = UserManager.getRecordByIDs(strDepAllUser);
- for (int i = 0; i < vtUserID.size(); i++)
- {
- InsertRecord(iDocTempletMoveFlowID, iUserID,
- Integer.parseInt( ( (Vector) vtUserID.get(i)).get(0).
- toString()), strIPAddress,
- strDocTempletTableName);
- }
- return 1;
- }
- else
- {
- return -101;
- }
- }
- else
- {
- return -101;
- }
- }
- /**
- * 对公文进行归档
- * @param strIDs 要进行归档的公文记录编号
- * @return 返回错误代码
- */
- public static int Pigeonholed(String strIDs)
- {
- int iReturnValue = 0;
- Vector vt = SQLManager.GetResultSet("Select * from " + TableName +
- " where ID in (" + strIDs + ")");
- if (vt.size() > 0)
- {
- iReturnValue = SQLManager.ExcuteSQL(
- "UPDATE Document SET IsPigeonholed = 1 where ID IN (" + strIDs + ")");
- }
- else
- {
- iReturnValue = -101;
- }
- return iReturnValue;
- }
- /**
- * 对公文进行反归档
- * @param strIDs 要进行归档的公文记录编号
- * @return 返回错误代码
- */
- public static int DisPigeonholed(String strIDs)
- {
- int iReturnValue = 0;
- Vector vt = SQLManager.GetResultSet("Select * from " + TableName +
- " where ID in (" + strIDs + ")");
- if (vt.size() > 0)
- {
- iReturnValue = SQLManager.ExcuteSQL(
- "UPDATE Document SET IsPigeonholed = 0 where ID IN (" + strIDs + ")");
- }
- else
- {
- iReturnValue = -101;
- }
- return iReturnValue;
- }
- /**
- * 删除公文
- * @param strIDs 要进行删除操作的公文记录编号
- * @return 返回错误代代码
- */
- public static int DeleteDocument(String strIDs)
- {
- int iReturnValue = -101;
- Vector vt = SQLManager.GetResultSet("Select ID from " + TableName +
- " where ID in (" + strIDs + ")");
- if (vt.size() > 0)
- {
- for (int i = 0; i < vt.size(); i++)
- {
- int counter = 0;
- Vector vc = SQLManager.GetResultSet(
- "select count(*) as counter from DocFieldsValue where DocumentID = " +
- Integer.parseInt( ( (Vector) vt.get(i)).get(0).toString()));
- if (vc.size() == 1)
- {
- counter = Integer.parseInt( ( (Vector) vc.get(0)).get(0).toString());
- if (counter < 0)
- {
- return -3; //表示要修改的记录不存在
- }
- }
- else
- {
- return -3; //表示要修改的记录不存在
- }
- iReturnValue = SQLManager.ExcuteSQL(
- "Delete from DocFieldsValue where DocumentID = " +
- Integer.parseInt( ( (Vector) vt.get(i)).get(0).toString()));
- vc = SQLManager.GetResultSet(
- "select count(*) as counter from ApproveRecordInfo where DocumentID = " +
- Integer.parseInt( ( (Vector) vt.get(i)).get(0).toString()));
- if (vc.size() == 1)
- {
- counter = Integer.parseInt( ( (Vector) vc.get(0)).get(0).toString());
- if (counter < 0)
- {
- return -3; //表示要修改的记录不存在
- }
- }
- else
- {
- return -3; //表示要修改的记录不存在
- }
- iReturnValue = SQLManager.ExcuteSQL(
- "Delete from ApproveRecordInfo where DocumentID = " +
- Integer.parseInt( ( (Vector) vt.get(i)).get(0).toString()));
- vc = SQLManager.GetResultSet(
- "select count(*) as counter from Document where ID = " +
- Integer.parseInt( ( (Vector) vt.get(i)).get(0).toString()));
- if (vc.size() == 1)
- {
- counter = Integer.parseInt( ( (Vector) vc.get(0)).get(0).toString());
- if (counter < 0)
- {
- return -3; //表示要修改的记录不存在
- }
- }
- else
- {
- return -3; //表示要修改的记录不存在
- }
- iReturnValue = SQLManager.ExcuteSQL("Delete from Document where ID = " +
- Integer.parseInt( ( (Vector) vt.get(
- i)).get(0).toString()));
- }
- }
- else
- {
- return -101;
- }
- return iReturnValue;
- }
- /**
- * 返回待处理公文列表
- * @param strID 公文模板ID
- * @param strDocumentName 公文名称
- * @param strBuildTimeFrom 公文生成时间起始
- * @param strBuildTimeTo 公文生成时间结束
- * @param strBuildUserName 生成用户姓名
- * @param strFillUserName 填表用户姓名
- * @param strTacheName 当前环节名称
- * @param strFillUserID 填表用户ID
- * @param strApproveUserID 当前环节审批用户ID
- * @param strOrderBy 排序字段
- * @param strIsDesc 是否降序排序
- * @return 符合条件记录向量集
- */
- public static Vector getRecordBySearchAll(String strID,
- String strDocumentName,
- String strBuildTimeFrom,
- String strBuildTimeTo,
- String strBuildUserName,
- String strFillUserName,
- String strTacheName,
- String strFillUserID,
- String strApproveUserID,
- String strOrderBy, String strIsDesc)
- {
- String strSQL = "SELECT a.[ID],a.[DocumentName],a.[DocFlowTempletID],a.[BuildTime],a.[BuildUserID],a.[FillUserID],a.[IsPigeonholed],"
- + "a.[CurrentFlowTacheID],a.[IsReminded],a.[RemindTime],c.[Name],e.[Name],f.[TacheName],f.[FromTacheID],f.[TacheStatus],"
- + "f.[ApproveUserIDs],f.[TacheType],f.[FlowID],f.[IsRecordRead],f.[RemindInterval],f.[MaxWaitTime],f.[IsFromDefault],f.[IsFinishedByRead]"
- + " FROM [Document] AS a LEFT OUTER JOIN [UserInfo] AS b ON (a.[BuildUserID] = b.[ID]) LEFT OUTER JOIN [PersonnelInfo] AS c "
- + "ON (b.[PersonnelID] = c.[ID]) LEFT OUTER JOIN [UserInfo] AS d ON (a.[FillUserID] = d.[ID]) LEFT OUTER JOIN [PersonnelInfo] AS e"
- + " ON (d.[PersonnelID] = e.[ID]) LEFT OUTER JOIN [FlowTacheInfo] AS f ON (a.[CurrentFlowTacheID] = f.[ID]) WHERE a.[ID]>0 and NOT(a.[IsPigeonholed] = 1) and a.[CurrentFlowTacheID]>-2";
- if (strID.trim().length() > 0)
- {
- strSQL += " and a.[ID] ='" + strID + "'";
- }
- if (strDocumentName.trim().length() > 0)
- {
- strSQL += " and a.[DocumentName] like '%" + strDocumentName + "%'";
- }
- if (strBuildTimeFrom.trim().length() > 0)
- {
- strSQL += " and a.[BuildTime]>='" + strBuildTimeFrom + " 00:00:00.000'";
- }
- if (strBuildTimeTo.trim().length() > 0)
- {
- strSQL += " and a.[BuildTime]<='" + strBuildTimeTo + " 23:59:59.999'";
- }
- if (strBuildUserName.trim().length() > 0)
- {
- strSQL += " and c.[Name] like '%" + strBuildUserName + "%'";
- }
- if (strFillUserName.trim().length() > 0)
- {
- strSQL += " and e.[Name] like '%" + strFillUserName + "%'";
- }
- if (strTacheName.trim().length() > 0)
- {
- strSQL += " and f.[TacheName] like '%" + strTacheName + "%'";
- }
- if ( (strFillUserID.trim().length() > 0) &&
- (strApproveUserID.trim().length() > 0))
- {
- strSQL += " and ((a.[FillUserID]=" + strFillUserID +
- ") or (not(f.[TacheStatus]='S') and ',' + f.[ApproveUserIDs] + ',' LIKE '%," +
- strApproveUserID + ",%'))";
- }
- if (strOrderBy.trim().length() > 0)
- {
- if (strIsDesc.equalsIgnoreCase("True"))
- {
- strSQL += " Order by " + strOrderBy + " desc";
- }
- else
- {
- strSQL += " Order by " + strOrderBy + "";
- }
- }
- Vector vt = SQLManager.GetResultSet(strSQL);
- return vt;
- }
- /**
- * 重载getRecordBySearchAll方法,按ID返回结果
- * @param strID 公文模板ID
- * @return 符合条件记录向量集
- */
- public static Vector getRecordByIDAll(String strID)
- {
- Vector vt = getRecordBySearchAll(strID, "", "", "", "", "", "", "", "", "",
- "");
- return vt;
- }
- /**
- * 公文环节跳转
- * @param DocumentID 公文ID
- * @param NextTache 跳转环节ID
- * @return 整型值
- */
- public static int MoveFlow(String DocumentID, String NextTache)
- {
- String strSQL = "Update " + TableName +
- " set IsReminded=0,RemindTime=null,CurrentFlowTacheID='" + NextTache +
- "' where ID=" + DocumentID;
- return SQLManager.ExcuteSQL(strSQL);
- }
- /**
- * 返回应该被提醒的公文信息
- * @param strUserID 当前用户ID
- * @param CurrentTime 当前时间
- * @return 符合条件记录向量集
- */
- public static Vector UNReminded(String strUserID, String CurrentTime)
- {
- String strSQL = "SELECT a.[ID],a.[DocumentName],a.[FillUserID],a.[IsPigeonholed],a.[CurrentFlowTacheID],a.[IsReminded],"
- +
- "a.[RemindTime],b.[ApproveUserIDs],b.[RemindInterval],b.[TacheStatus],d.[Name] "
- + "FROM [Document] AS a LEFT OUTER JOIN [FlowTacheInfo] AS b ON (a.[CurrentFlowTacheID] = b.[ID])"
- + " LEFT OUTER JOIN [UserInfo] AS c ON (a.[FillUserID] = c.[ID]) LEFT OUTER JOIN [PersonnelInfo] AS d"
- + " ON (c.[PersonnelID] = d.[ID])"
- + " WHERE a.[ID]>0 and IsPigeonholed <> 1 and a.[CurrentFlowTacheID]>-2 and b.[RemindInterval]>0 and (((a.[FillUserID] = " +
- strUserID + ") and (b.[TacheStatus]='S')) or (not(b.[TacheStatus]='S') and (',' + b.[ApproveUserIDs] + ',') LIKE ('%," +
- strUserID + ",%')))"
- + " and ((a.[IsReminded]<>1) or (DATEDIFF(mi,a.[RemindTime],'" +
- CurrentTime + "')>=b.[RemindInterval]))";
- Vector vt = SQLManager.GetResultSet(strSQL);
- return vt;
- }
- /**
- * 设置公文提醒时间以及提醒标记
- * @param strID 公文ID
- * @param CurrentTime 当前时间
- * @return 整型值
- */
- public static int ResetReminded(String strID, String CurrentTime)
- {
- String strSQL = "UPDATE " + TableName + " SET IsReminded=1,RemindTime='" +
- CurrentTime + "' WHERE ID=" + strID;
- return SQLManager.ExcuteSQL(strSQL);
- }
- /**
- * 返回需要自动跳转的公文ID集合
- * @param CurrentTime 当前时间
- * @return 符合条件结果集
- */
- public static Vector NeedAutoFlow(String CurrentTime)
- {
- String strSQL = "select c.ID from Document as c left outer join FlowTacheInfo as d on (c.CurrentFlowTacheID=d.ID) "
- + "where d.MaxWaitTime<>0 and (d.MaxWaitTime<=(datediff(mi,(Select top 1 a.ApproveTime from ApproveRecordInfo as"
- + " a left outer join Document as b on (a.DocumentID=b.ID) order by a.ApproveTime Desc),'" +
- CurrentTime + "')) or"
- + " ((datediff(mi,(Select top 1 a.ApproveTime from ApproveRecordInfo as a left outer join Document as b on "
- + "(a.DocumentID=b.ID) order by a.ApproveTime Desc),'" + CurrentTime +
- "') is null and d.MaxWaitTime<=(datediff(mi,c.BuildTime,'" +
- CurrentTime +
- "'))))) and c.IsPigeonholed <> 1 and c.[CurrentFlowTacheID]>-2";
- Vector vt = SQLManager.GetResultSet(strSQL);
- return vt;
- }
- /**
- * 公文环节自动跳转
- * @param strTacheID 环节ID
- * @param strDocumentID 公文ID
- * @return 整型值
- */
- public static int ResetCurrentTache(String strTacheID, String strDocumentID)
- {
- String strSQL = "UPDATE " + TableName + " SET CurrentFlowTacheID=" +
- strTacheID + " WHERE ID=" + strDocumentID;
- return SQLManager.ExcuteSQL(strSQL);
- }
- /**
- * 返回当前公文的下一个环节ID
- * @param DocumentID 公文ID
- * @return 符合条件向量集
- */
- public static Vector AutoFlowTache(String DocumentID)
- {
- String strSQL = "select top 1 ID from FlowTacheInfo where FromTacheID = "
- + "(select CurrentFlowTacheID from " + TableName + " where ID = " +
- DocumentID
- + ") and IsFromDefault = 1";
- Vector vt = SQLManager.GetResultSet(strSQL);
- return vt;
- }
- public static Vector VisitDoc(String strUserID, String strOrderBy,
- String strIsDesc)
- {
- return VisitDoc(strUserID, "", "", "", "", "", "", strOrderBy, strIsDesc);
- }
- public static Vector VisitDoc(String strUserID, String strDocumentName,
- String strBuildTimeFrom, String strBuildTimeTo,
- String strBuildUserName, String strFillUserName,
- String strTacheName, String strOrderBy,
- String strIsDesc)
- {
- String strSQL = "select a.[ID],a.[DocumentName],a.[BuildTime],a.[BuildUserID],a.[FillUserID],a.[IsPigeonholed],a.[CurrentFlowTacheID]" +
- ",a.[DocFlowTempletID],c.[Name],e.[Name],f.[TacheName],g.[ReadOnlyUserIDs] from " +
- TableName + " As a LEFT OUTER JOIN" +
- " [UserInfo] AS b ON (a.[BuildUserID] = b.[ID]) LEFT OUTER JOIN [PersonnelInfo] AS c" +
- " ON (b.[PersonnelID] = c.[ID]) LEFT OUTER JOIN [UserInfo] AS d ON (a.[FillUserID] = d.[ID])" +
- " LEFT OUTER JOIN [PersonnelInfo] AS e ON (d.[PersonnelID] = e.[ID]) LEFT OUTER JOIN [FlowTacheInfo] AS" +
- " f ON (a.[CurrentFlowTacheID] = f.[ID]) left outer join [DocTempletMoveFlow] as g on (a.[DocFlowTempletID]=g.[ID])" +
- " where a.[IsPigeonholed]<>1 and a.[CurrentFlowTacheID]>-2 and g.[ReadOnlyUserIDs] like ('%" +
- strUserID + "%')";
- if (strDocumentName.trim().length() > 0)
- {
- strSQL += " and a.[DocumentName] like '%" + strDocumentName + "%'";
- }
- if (strBuildTimeFrom.trim().length() > 0)
- {
- strSQL += " and a.[BuildTime]>='" + strBuildTimeFrom + " 00:00:00.000'";
- }
- if (strBuildTimeTo.trim().length() > 0)
- {
- strSQL += " and a.[BuildTime]<='" + strBuildTimeTo + " 23:59:59.999'";
- }
- if (strBuildUserName.trim().length() > 0)
- {
- strSQL += " and c.[Name] like '%" + strBuildUserName + "%'";
- }
- if (strFillUserName.trim().length() > 0)
- {
- strSQL += " and e.[Name] like '%" + strFillUserName + "%'";
- }
- if (strTacheName.trim().length() > 0)
- {
- strSQL += " and f.[TacheName] like '%" + strTacheName + "%'";
- }
- if (strOrderBy.trim().length() > 0)
- {
- if (strIsDesc.equalsIgnoreCase("True"))
- {
- strSQL += " Order by " + strOrderBy + " desc";
- }
- else
- {
- strSQL += " Order by " + strOrderBy + "";
- }
- }
- Vector vt = SQLManager.GetResultSet(strSQL);
- return vt;
- }
- /**
- * 返回按制定条件查询的已作废记录集
- * @param strID ID标识
- * @param strDocumentName 公文名称
- * @param iDocFlowTempletID 公文流转模板ID
- * @param strDocFlowTempletName 公文流转模板名称
- * @param iBuildUserID 生成用户ID
- * @param strBuildUserName 生成用户姓名
- * @param iFillUserID 填表用户ID
- * @param strFillUserName 填表用户ID
- * @param bIsPigeonholed 是否已经归档
- * @param iCurrentFlowTacheID 当前流程环节ID
- * @param strCurrentFlowTacheName 当前流程环节名称
- * @param iTacheStatus 当前流程环节状态ID
- * @param strTacheStatus 当前流程环节状态
- * @param strIsReminded 是否已经提醒
- * @param strRemindTime 提醒时间
- * @param strBuildTimeFrom 建立时间起始
- * @param strBuildTimeTo 建立时间截至
- * @param strOrderBy 排序字段
- * @param bIsDesc 是否降序排序
- * @return 符合条件记录向量集
- */
- public static Vector getNoUsefulRecordBySearch(String strID,
- String strDocumentName,
- int iDocFlowTempletID,
- String strDocFlowTempletName,
- int iBuildUserID,
- String strBuildUserName,
- int iFillUserID,
- String strFillUserName,
- boolean bIsPigeonholed,
- int iCurrentFlowTacheID,
- String strCurrentFlowTacheName,
- int iTacheStatus,
- String strTacheStatus,
- String strIsReminded,
- String strRemindTime,
- String strBuildTimeFrom,
- String strBuildTimeTo,
- String strOrderBy,
- boolean bIsDesc)
- {
- String strSQL = "Select a.[ID], a.[DocumentName], a.[DocFlowTempletID], a.[BuildTime], a.[BuildUserID], a.[FillUserID]," +
- " a.[IsPigeonholed], a.[CurrentFlowTacheID], a.[IsReminded], a.[RemindTime]," +
- " c.[Name], d.[Name], e.[Name], f.[TacheName], f.[TacheStatus] from [" +
- TableName + "] as a" +
- " left outer join [UserInfo] as b on (a.BuildUserId=b.ID) left outer join [PersonnelInfo] as c on (b.PersonnelID=c.ID)" +
- " left outer join [UserInfo] as g on (a.FillUserID=g.ID) left outer join [PersonnelInfo] as d on (g.PersonnelID=d.ID)" +
- " left outer join [DocTempletMoveFlow] as e on (a.DocFlowTempletID=e.ID)" +
- " left outer join [FlowTacheInfo] as f on (a.CurrentFlowTacheID=f.ID) where a.[CurrentFlowTacheID] < -1";
- if (strDocumentName.trim().length() > 0)
- {
- strSQL += " and a.[DocumentName] like '%" + strDocumentName + "%'";
- }
- if (strDocFlowTempletName.trim().length() > 0)
- {
- strSQL += " and e.[Name] like '%" + strDocFlowTempletName + "%'";
- }
- if (strIsReminded.trim().equalsIgnoreCase("true"))
- {
- strSQL += " and a.[IsReminded] = 1";
- }
- else if (strIsReminded.trim().equalsIgnoreCase("false"))
- {
- strSQL += " and (a.[IsReminded] IS null OR a.[IsReminded] = 0)";
- }
- if (strBuildUserName.trim().length() > 0)
- {
- strSQL += " and c.[Name] like '%" + strBuildUserName + "%'";
- }
- if (strFillUserName.trim().length() > 0)
- {
- strSQL += " and d.[Name] like '%" + strFillUserName + "%'";
- }
- if (strCurrentFlowTacheName.trim().length() > 0)
- {
- strSQL += " and f.[TacheName] like '%" + strCurrentFlowTacheName + "%'";
- }
- if (strTacheStatus.trim().length() > 0)
- {
- strSQL += " and f.[TacheStatus] like '%" + strTacheStatus + "%'";
- }
- if (strBuildTimeFrom.trim().length() > 0)
- {
- strSQL += " and a.[BuildTime]>='" + strBuildTimeFrom + " 00:00:00.000'";
- }
- if (strBuildTimeTo.trim().length() > 0)
- {
- strSQL += " and a.[BuildTime]<='" + strBuildTimeTo + " 23:59:59.999'";
- }
- if (strOrderBy.trim().length() > 0)
- {
- if (bIsDesc)
- {
- strSQL += " Order by " + strOrderBy + " desc";
- }
- else
- {
- strSQL += " Order by " + strOrderBy + "";
- }
- }
- Vector vt = SQLManager.GetResultSet(strSQL);
- return vt;
- }
- }