📄 documentmanagerplus.java
字号:
/**
* 插入记录
* @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,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -