📄 aggetlatestweek.java.svn-base
字号:
package com.fzet.cois.dividework.agents;
import java.io.PrintWriter;
import com.fzet.cois.common.scriptLib.Common;
import com.fzet.cois.common.scriptLib.ErrHandle;
import lotus.domino.*;
public class AgGetLatestWeek extends AgentBase {
public void NotesMain() {
Session session = null;
AgentContext ac = null;
Database db = null;
Document doc = null;
PrintWriter pw = null;
ErrHandle err = null; // 错误处理
View vwMonth = null; // 部门月考勤视图
Document docMonth = null;
ViewEntryCollection vec = null;
ViewEntry ve = null;
try {
session = getSession();
ac = session.getAgentContext();
db = ac.getCurrentDatabase();
doc = ac.getDocumentContext();
pw = getAgentOutput();
err = new ErrHandle(session, 0, "", "agGetLatestWeek.xml");
// 获取URL的参数
String sQuery = doc.getItemValueString("Query_String_Decoded");
String sDeptName = Common.parseParameter(sQuery, "DeptName");
vwMonth = db.getView("vwPaibIndx");
if (vwMonth == null) {
Common
.returnXML(pw,
"<root><Return>0</Return><Error>无法打开月考勤视图</Error></root>");
return;
}
vec = vwMonth.getAllEntriesByKey(sDeptName, true);
ve = vec.getFirstEntry();
if (ve != null) { // 如果找到最近月份数据,返回最近的年、月
docMonth = ve.getDocument();
String sStartDay = docMonth.getItemValue("start_day")
.firstElement().toString();
Common.returnXML(pw,
"<root><Return>1</Return><Content><IsExist>1</IsExist><DeptName>"
+ sStartDay + "</DeptName></Content></root>");
return;
} else { // 如果找不到,则返回自己的年、月
Common.returnXML(pw,
"<root><Return>1</Return><Content><IsExist>0</IsExist><DeptName>"
+ "" + "</DeptName></Content></root>");
return;
}
} catch (NotesException e) {
Common.returnXML(pw,
"<root><Return>0</Return><Error>调用代理出错</Error></root>");
err.record(true, e.id, e.text);
e.printStackTrace();
} finally {
try {
if (docMonth != null)
docMonth.recycle();
if (vwMonth != null)
vwMonth.recycle();
if (vec != null)
vec.recycle();
if (ve != null)
ve.recycle();
if (doc != null)
doc.recycle();
if (db != null)
db.recycle();
if (ac != null)
ac.recycle();
if (session != null)
session.recycle();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -