📄 offlogbean.java
字号:
}
public boolean ownView(HttpServletRequest req, HttpServletResponse resp)
{
HttpSession httpsession = req.getSession();
Integer Flag=null;
Flag=(Integer)httpsession.getAttribute("flag");
int flag=Flag.intValue();
boolean islogin=isLogin(req,resp);
if(!islogin)
return islogin;
Vector viewContent=new Vector();
String ownid=req.getParameter("ownid");
String managerReply=req.getParameter("managerReply");
String sql="select * from own where ownid="+ownid;
DbADO dbAdo=new DbADO();
dbAdo.connect();
ResultSet rs=dbAdo.select(sql);
try{
while(rs.next())
{
viewContent.addElement(rs.getString("ownid"));
viewContent.addElement(rs.getString("sumcontent"));
viewContent.addElement(rs.getString("plancontent"));
viewContent.addElement(rs.getString("title"));
viewContent.addElement(rs.getString("partname"));
viewContent.addElement(rs.getString("author"));
viewContent.addElement(rs.getString("dateandtime"));
viewContent.addElement(rs.getString("reply1"));
viewContent.addElement(rs.getString("reply2"));
}
}
catch(Exception e){
e.printStackTrace();
}
finally{
dbAdo.close();
}
if(viewContent!=null)
req.setAttribute("viewContent",viewContent);
return islogin;
}
public boolean ownEdit(HttpServletRequest req, HttpServletResponse resp)
{
HttpSession httpsession = req.getSession();
String username=(String)httpsession.getAttribute("username");
boolean islogin=isLogin(req,resp);
if(!islogin)
return islogin;
String ownid=req.getParameter("ownid");
Vector viewContent=new Vector();
String sql="select * from own where ownid="+ownid;
DbADO dbAdo=new DbADO();
dbAdo.connect();
ResultSet rs=dbAdo.select(sql);
try
{
while(rs.next())
{
viewContent.addElement(rs.getString("ownid"));
viewContent.addElement(rs.getString("sumcontent"));
viewContent.addElement(rs.getString("plancontent"));
System.out.println("sumcontent="+rs.getString("sumcontent")+"__plancontent="+rs.getString("plancontent"));
viewContent.addElement(rs.getString("title"));
viewContent.addElement(rs.getString("partname"));
viewContent.addElement(rs.getString("author"));
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
dbAdo.close();
}
if(viewContent!=null)
req.setAttribute("viewContent",viewContent);
return islogin;
}
public boolean ownUpdate(HttpServletRequest req, HttpServletResponse resp,String title,String sumcontent,String plancontent)
{
HttpSession httpsession = req.getSession();
String username=(String)httpsession.getAttribute("username");
boolean islogin=isLogin(req,resp);
if(!islogin)
return islogin;
String ownid=req.getParameter("ownid");
String sql="update own set title='"+title+"',sumcontent='"+sumcontent+"',plancontent='"+plancontent+"'";
sql=sql+",dateandtime=current Timestamp where ownid="+ownid;
System.out.println("update sql is: "+sql);
DbADO dbAdo=new DbADO();
dbAdo.connect();
dbAdo.update_insert(sql);
dbAdo.close();
String result="编辑个人总结成功!";
req.setAttribute("result",result);
return islogin;
}
public boolean ownDel(HttpServletRequest req, HttpServletResponse resp)
{
HttpSession httpsession = req.getSession();
String username=(String)httpsession.getAttribute("username");
boolean islogin=isLogin(req,resp);
if(!islogin)
return islogin;
String ownid=req.getParameter("ownid");
String sql="delete from own where ownid="+ownid;
System.out.println("update sql is: "+sql);
DbADO dbAdo=new DbADO();
dbAdo.connect();
dbAdo.update_insert(sql);
dbAdo.close();
String result="删除个人总结成功!";
req.setAttribute("result",result);
return islogin;
}
public boolean ownState(HttpServletRequest req, HttpServletResponse resp)
{
HttpSession httpsession = req.getSession();
String username=(String)httpsession.getAttribute("username");
boolean islogin=isLogin(req,resp);
if(!islogin)
return islogin;
String ownid=req.getParameter("ownid");
String sql="update own set state='yes' where ownid="+ownid;
DbADO dbAdo=new DbADO();
dbAdo.connect();
dbAdo.update_insert(sql);
dbAdo.close();
String result="您已成功提交总结!";
req.setAttribute("result",result);
return islogin;
}
public boolean ownReply1(HttpServletRequest req, HttpServletResponse resp,String reply1)
{
HttpSession httpsession = req.getSession();
String username=(String)httpsession.getAttribute("username");
Integer Flag=null;
Flag=(Integer)httpsession.getAttribute("flag");
int flag=Flag.intValue();
boolean isadmin=isAdmin(req,resp);
if(!isadmin)
return isadmin;
String ownid=req.getParameter("ownid");
String sql="update own set reply1='"+reply1+"',dateandtime=current Timestamp where ownid="+ownid;
System.out.println("update sql is: "+sql);
DbADO dbAdo=new DbADO();
dbAdo.connect();
dbAdo.update_insert(sql);
dbAdo.close();
String result="总经理批注成功!";
req.setAttribute("result",result);
return isadmin;
}
public boolean ownReply2(HttpServletRequest req, HttpServletResponse resp,String reply2)
{
HttpSession httpsession = req.getSession();
String username=(String)httpsession.getAttribute("username");
Integer Flag=null;
Flag=(Integer)httpsession.getAttribute("flag");
int flag=Flag.intValue();
boolean ismanager=true;
if(username==null||flag!=3)
{
ismanager=false;
return ismanager;
}
String ownid=req.getParameter("ownid");
String sql="update own set reply2='"+reply2+"', dateandtime=current Timestamp where ownid="+ownid;
System.out.println("update sql is: "+sql);
DbADO dbAdo=new DbADO();
dbAdo.connect();
dbAdo.update_insert(sql);
dbAdo.close();
String result="部门经理批注成功!";
req.setAttribute("result",result);
return ismanager;
}
public boolean workSave(HttpServletRequest req, HttpServletResponse resp,String jobcontent)
{
HttpSession httpsession = req.getSession();
String username=(String)httpsession.getAttribute("username");
boolean islogin=isLogin(req,resp);
if(!islogin)
return islogin;
String d=req.getParameter("day").trim();
String m=req.getParameter("month").trim();
String y=req.getParameter("year").trim();
String sql="insert into job (jobcontent,d,m,y,dateandtime,writer) values ";
sql=sql+"('"+jobcontent+"',"+d+","+m+","+y+",current Timestamp,'"+username+"')";
System.out.println("insert sql is: "+sql);
DbADO dbAdo=new DbADO();
dbAdo.connect();
dbAdo.update_insert(sql);
dbAdo.close();
String result="添加个人工作安排成功!";
req.setAttribute("result",result);
return islogin;
}
public boolean workTotal(HttpServletRequest req, HttpServletResponse resp)
{
HttpSession httpsession = req.getSession();
String username=(String)httpsession.getAttribute("username");
boolean islogin=isLogin(req,resp);
if(!islogin)
return islogin;
String sql1="select * from job where writer='"+username+"'";
String sql2="select count(jobid) from job where writer='"+username+"'";
System.out.println("sql is: "+sql1);
Vector workList=new Vector();
String page=req.getParameter("page");
if(page==null)
page="1";
int pageRow=8;
int totalRow=0;
int thisPage=new Integer(page).intValue();
int maxPage=0;
int startRow=1;
int endRow=pageRow;
DbADO dbAdo=new DbADO();
dbAdo.connect();
totalRow=dbAdo.total(sql2);
if(totalRow % pageRow==0)
{
maxPage=totalRow/pageRow;
}
else
{
maxPage=totalRow/pageRow+1;
}
System.out.println("workTotal() maxPage: "+maxPage);
if(thisPage<1)
thisPage=1;
if(thisPage>maxPage)
thisPage=maxPage;
req.setAttribute("thisPage",new Integer(thisPage));
thisPage=maxPage-thisPage+1;
if(thisPage>1&&thisPage<maxPage)
{
startRow=(thisPage-1)*pageRow+1;
endRow=thisPage*pageRow;
}
else if(thisPage>=maxPage)
{
startRow=(maxPage-1)*pageRow+1;
endRow=totalRow;
}
System.out.println("workTotal() startRow: "+startRow);
System.out.println("workTotal() endRow"+endRow);
System.out.println("workTotal() thisPage "+thisPage);
System.out.println("workTotal() totalRow: "+totalRow);
ResultSet rs=dbAdo.select(sql1);
try{
if(startRow>=1)
{
rs.absolute(startRow);
int i=startRow;
while(i<=endRow)
{
workList.addElement(rs.getString("jobid"));
workList.addElement(rs.getString("jobcontent"));
workList.addElement(rs.getString("d"));
workList.addElement(rs.getString("m"));
workList.addElement(rs.getString("y"));
i++;
rs.next();
}
}
}
catch(Exception e){
e.printStackTrace();
}
finally{
dbAdo.close();
}
if(workList!=null)
req.setAttribute("workList",workList);
req.setAttribute("maxPage",new Integer(maxPage));
return islogin;
}
public boolean workEdit(HttpServletRequest req, HttpServletResponse resp)
{
HttpSession httpsession = req.getSession();
String username=(String)httpsession.getAttribute("username");
boolean islogin=isLogin(req,resp);
if(!islogin)
return islogin;
String jobid=req.getParameter("jobid");
Vector viewContent=new Vector();
String sql="select * from job where jobid="+jobid;
DbADO dbAdo=new DbADO();
dbAdo.connect();
ResultSet rs=dbAdo.select(sql);
try
{
while(rs.next())
{
viewContent.addElement(rs.getString("jobid"));
viewContent.addElement(rs.getString("jobcontent"));
viewContent.addElement(rs.getString("d"));
viewContent.addElement(rs.getString("m"));
viewContent.addElement(rs.getString("y"));
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
dbAdo.close();
}
if(viewContent!=null)
req.setAttribute("viewContent",viewContent);
return islogin;
}
public boolean workUpdate(HttpServletRequest req, HttpServletResponse resp,String jobcontent)
{
HttpSession httpsession = req.getSession();
String username=(String)httpsession.getAttribute("username");
boolean islogin=isLogin(req,resp);
if(!islogin)
return islogin;
String jobid=req.getParameter("jobid");
String d=req.getParameter("day").trim();
String m=req.getParameter("month").trim();
String y=req.getParameter("year").trim();
String sql="update job set jobcontent='"+jobcontent+"',d="+d+",m="+m+",y="+y+" where jobid="+jobid;
System.out.println("update sql is: "+sql);
DbADO dbAdo=new DbADO();
dbAdo.connect();
dbAdo.update_insert(sql);
dbAdo.close();
String result="编辑工作日志成功!";
req.setAttribute("result",result);
return islogin;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -