📄 calendarinfo.java
字号:
package com.saas.biz.xcalendarMgr;
import java.util.ArrayList;
import java.util.HashMap;
import com.saas.biz.commen.commMethodMgr;
import com.saas.biz.dao.xcalendarDAO.XcalendarDAO;
import com.saas.biz.dao.xcalendarDAO.XcalendarExt;
import com.saas.sys.buffer.Buffers;
import com.saas.sys.dbm.Dbtable;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.Logger;
public class CalendarInfo{
Logger log;
Buffers inBuffer;
Buffers outBuffer;
Dbtable tradeQuery;
commMethodMgr commen;
ArrayList queryResult = new ArrayList();
public CalendarInfo() {
log = new Logger(this);
tradeQuery = new Dbtable();
commen = new commMethodMgr();
outBuffer = new Buffers();
}
public void setOutBuffer(Buffers outBuffer) {
this.outBuffer = outBuffer;
}
public Buffers getOutBuffer() {
return this.outBuffer;
}
public void setTradeQuery(Dbtable tradeQuery) {
this.tradeQuery = tradeQuery;
}
public Dbtable getTradeQuery() {
return this.tradeQuery;
}
public ArrayList getQueryResult() {
return this.queryResult;
}
public void setQueryResult(ArrayList queryResult) {
this.queryResult = queryResult;
}
// 增加日程
public void addItinerary(Buffers inbuffer) {
this.outBuffer = inbuffer;
this.inBuffer = inbuffer;
log.LOG_INFO("进入addItinerary方法...");
int iResult = -1;
String begtime = inbuffer.getString("BEGTIME");
String endtime = inbuffer.getString("ENDTIME");
String content = inbuffer.getString("CONTENT");
String title = inbuffer.getString("TITLE");
String user = inbuffer.getString("SESSION_USER_NAME");
String part = inbuffer.getString("DEPART_CODE");
String recorduser = inbuffer.getString("RECORDUSER");
try {
XcalendarDAO inineraryDao = new XcalendarDAO();
inineraryDao.setBegtime(begtime);
inineraryDao.setEndtime(endtime);
inineraryDao.setContent(content);
inineraryDao.setTitle(title);
inineraryDao.setUser(user);
inineraryDao.setPart(part);
inineraryDao.setRecorduser(recorduser);
iResult = addItinerary(inineraryDao);
}
catch (Exception e) {
iResult = -1;
}
if (iResult != 0) {
this.outBuffer.setInt("RESULT_CODE", -1);
this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
}
else {
this.outBuffer.setInt("RESULT_CODE", 0);
this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
}
log.LOG_INFO("退出addItinerary方法...");
}
public int addItinerary(XcalendarDAO inineraryDao) throws SaasApplicationException {
XcalendarExt calendarExt = new XcalendarExt();
calendarExt.setParam(":VTITLE", inineraryDao.getTitle());
calendarExt.setParam(":VCONTENT", inineraryDao.getContent());
calendarExt.setParam(":VBEGTIME", inineraryDao.getBegtime());
calendarExt.setParam(":VENDTIME", inineraryDao.getEndtime());
calendarExt.setParam(":VCHECKED", "0");
calendarExt.setParam(":VUSER", inineraryDao.getUser());
calendarExt.setParam(":VRECORDUSER", inineraryDao.getRecorduser());
calendarExt.setParam(":VPART", inineraryDao.getPart());
tradeQuery.executeBy(calendarExt.insBy("INS_BY_ALL"));
return 0;
}
public void updateItinerary(Buffers inbuffer) {
this.outBuffer = inbuffer;
this.inBuffer = inbuffer;
log.LOG_INFO("进入updateItinerary方法...");
int iResult = -1;
String begtime = inbuffer.getString("BEGTIME");
String endtime = inbuffer.getString("ENDTIME");
String content = inbuffer.getString("CONTENT");
String title = inbuffer.getString("TITLE");
String user = inbuffer.getString("SESSION_USER_NAME");
String part = inbuffer.getString("DEPART_CODE");
String id = inbuffer.getString("ID");
String checked = inbuffer.getString("CHECKED");
String recorduser = inbuffer.getString("RECORDUSER");
try {
XcalendarDAO inineraryDao = new XcalendarDAO();
inineraryDao.setBegtime(begtime);
inineraryDao.setEndtime(endtime);
inineraryDao.setContent(content);
inineraryDao.setTitle(title);
inineraryDao.setUser(user);
inineraryDao.setPart(part);
inineraryDao.setChecked(Integer.parseInt(checked));
inineraryDao.setId(Integer.parseInt(id));
inineraryDao.setRecorduser(recorduser);
iResult = updateItinerary(inineraryDao);
}
catch (Exception e) {
iResult = -1;
}
if (iResult != 0) {
this.outBuffer.setInt("RESULT_CODE", -1);
this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
}
else {
this.outBuffer.setInt("RESULT_CODE", 0);
this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
}
log.LOG_INFO("退出updateItinerary方法...");
}
public int updateItinerary(XcalendarDAO inineraryDao) throws SaasApplicationException {
XcalendarExt calendarExt = new XcalendarExt();
calendarExt.setParam(":VTITLE", inineraryDao.getTitle());
calendarExt.setParam(":VCONTENT", inineraryDao.getContent());
calendarExt.setParam(":VBEGTIME", inineraryDao.getBegtime());
calendarExt.setParam(":VENDTIME", inineraryDao.getEndtime());
calendarExt.setParam(":VCHECKED", inineraryDao.getChecked());
calendarExt.setParam(":VUSER", inineraryDao.getUser());
calendarExt.setParam(":VRECORDUSER", inineraryDao.getRecorduser());
calendarExt.setParam(":VPART", inineraryDao.getPart());
calendarExt.setParam(":VID", inineraryDao.getId());
tradeQuery.executeBy(calendarExt.insBy("UPDATE_BY_ID"));
return 0;
}
// 个人日程查询
public ArrayList getItineraryByDate(String begtime, String endtime, String user) {
XcalendarExt calendarExt = new XcalendarExt();
ArrayList list = new ArrayList();
calendarExt.setParam(":VBEGTIME", begtime);
calendarExt.setParam(":VENDTIME", endtime);
calendarExt.setParam(":VUSER", user);
list = calendarExt.selByList("SEL_BY_DATE");
return list;
}
// 共享日程查询
public ArrayList getItineraryByShare(String begtime, String endtime, String user) {
XcalendarExt calendarExt = new XcalendarExt();
ArrayList list = new ArrayList();
calendarExt.setParam(":VBEGTIME", begtime);
calendarExt.setParam(":VENDTIME", endtime);
calendarExt.setParam(":VUSER", user);
list = calendarExt.selByList("SEL_BY_SHARE");
return list;
}
public String getItineraryShareByDIV(String begtime, String endtime, String user, String link) throws SaasApplicationException {
String result = "<tr><td colspan=4>" + "" + "在" + begtime + "至" + endtime + "你没有任何共享日程...</td></tr>";
ArrayList list = new ArrayList();
String info="查看详细";
list = getItineraryByShare(begtime, endtime, user);
if (list != null && list.size() > 0) {
result = "";
for (int i = 0; i < list.size(); i++) {
HashMap map = (HashMap) list.get(i);
String id = map.get("id").toString();
String title = map.get("title").toString();
String state = map.get("checked").toString();
String pubtime = map.get("pubtime").toString();
if (pubtime.length() > 10) {
pubtime = pubtime.substring(0, 10);
}
result = result + crateHTML(title, state, pubtime, link + id,info);
}
}
result = "<table width=100% border=0 cellspacing=1 cellpadding=0>" + result + "</table>";
log.LOG_INFO(result);
return result;
}
public String getItineraryByDIV(String begtime, String endtime, String user, String link) throws SaasApplicationException {
String result = "<tr><td colspan=4>" + "" + "在" + begtime + "至" + endtime + "你没有任何日程安排...</td></tr>";
ArrayList list = new ArrayList();
String info="更新日程";
list = getItineraryByDate(begtime, endtime, user);
if (list != null && list.size() > 0) {
result = "";
for (int i = 0; i < list.size(); i++) {
HashMap map = (HashMap) list.get(i);
String id = map.get("id").toString();
String title = map.get("title").toString();
String state = map.get("checked").toString();
String pubtime = map.get("pubtime").toString();
if (pubtime.length() > 10) {
pubtime = pubtime.substring(0, 10);
}
result = result + crateHTML(title, state, pubtime, link+id ,info);
}
}
result = "<table width=100% border=0 cellspacing=1 cellpadding=0>" + result + "</table>";
return result;
}
public static String crateHTML(String title, String state, String pubtime, String link,String info) throws SaasApplicationException {
if (state == "0" || state.equals("0")) {
state = "有效";
}
else {
state = "无效";
}
String HTML = "<tr>" + "<td width=40%>" + "<input type="+"\"checkbox\""+ "name="+"del_query"+ "value="+"<%=id%>"+" "+"<div" + "style=text-align:left; margin-left:10px; font-weight:100;>" + title + "</div>" + "</td>" + "<td width=15%>" + "<div" + "style=text-align:center; margin-left:10px; font-weight:100;>" + state + "</div>" + "</td>" + "<td width=20%>" + "<div" + "style=text-align:center; margin-left:10px; font-weight:100;>" + pubtime + "</div>" + "</td>" + "<td width=20%>" + "<div" + "style=text-align:center; margin-left:10px; font-weight:100;>"
+ "<a href=" + link + ">"+info+"</a>" + "</div>" + "</td>" + "</tr>";
return HTML;
}
// 查找单个日程
public ArrayList getTaskById(String id) throws SaasApplicationException {
ArrayList list = new ArrayList();
XcalendarExt calendarExt = new XcalendarExt();
calendarExt.setParam(":VID", id);
list=calendarExt.selByList("SEL_BY_ID");
return list;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -