package com.pb.web.action;
import java.io.*;
import java.util.*;
import com.opensymphony.xwork2.ActionSupport;
import com.pb.entity.Email;
import com.pb.entity.Employee;
import com.pb.entity.Page;
import com.pb.service.EmailService;
import com.pb.service.EmployeeService;
/*
* 邮件相关操作的Action
*/
public class EmailAction extends ActionSupport {
Page page;
int currentPage;
Integer emailId;
String recipients;
String title;
String content;
String sender;
String isRead;
Date sendTime;
Date getTime;
String isScrap;
Integer employeeId;// 这是登录用户的Id号,它用来查找当前用户的邮件
String employeeName;// 它是我们的当前用户,用来赋值给发件人的值
Employee employee;
Email email;
EmailService emailService;
List employees = null;
EmployeeService employeeService;
List emails = null;
Set allemail = null;
// 上传文件相关量
private static final long serialVersionUID = 1L;
private File upload;
private String uploadFileName;
private String uploadContentType;
private String savePath;
private static final int BUFFER_SIZE = 16 * 1024;
private String tip;
/*
* 返回收件人列表
*/
public String queryRecipients() throws Exception {
employees = this.employeeService.showall();
employee = this.employeeService.findbyid(employeeId);
return "editEmail";
}
/*
* 上传文件至指定位置tomcat目录下的项目下的upload文件夹下。
*/
private static void copy(File src, File dst) {
InputStream in = null;
OutputStream out = null;
try {
// System.out.println("开始上传"+src.getName());
in = new BufferedInputStream(new FileInputStream(src), BUFFER_SIZE);
out = new BufferedOutputStream(new FileOutputStream(dst),
BUFFER_SIZE);
byte[] buffer = new byte[BUFFER_SIZE];
int len = 0;
int j = 0;
while ((len = in.read(buffer)) > 0) {
// System.out.println(j);
j++;
out.write(buffer, 0, len);
}
} catch (Exception e) {
System.out.println("异常" + e.toString());
e.printStackTrace();
} finally {
// System.out.println("处理");
if (null != in) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (null != out) {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
/*
* 上传附件,其实此上传附件的功能可以实现同时上传十份文件。在此项目中我们只上传一份附件
*/
public String execute() throws Exception {
if (this.upload != null) {
String dstPath = ConfigFile.getRealPath("path");
dstPath += this.uploadFileName;
// System.out.println("文件名:"+this.uploadFileName);
// System.out.println("保存位置:"+dstPath);
// System.out.println("文件类型:"+this.getUploadContentType());
EmailAction.copy(this.upload, new File(dstPath));
}
return SUCCESS;
}
/*
* 添加邮件,将附件的文件名设置为邮件的filename字段值,以备下载邮件用。
*/
public String addEmail() throws Exception {
sender= new String(sender.getBytes("ISO-8859-1"),"UTF-8");
Email email = new Email();
email.setRecipients(recipients);
email.setTitle(title);
email.setContent(content);
email.setIsRead("未读");
email.setSender(sender);
email.setSendTime(new Date());
email.setIsScrap("N");
email.setFilename(this.uploadFileName);
this.emailService.save(email);
return "toEmptyEmail";
}
/*
* 收邮件模块
*/
public String showEmails() throws Exception {
employee = this.employeeService.findbyid(employeeId);
Email email=new Email();
email.setRecipients(employee.getUsername());
email.setIsScrap("N");
page = this.emailService.findbyPage(currentPage,email);
return "showEmails";
}
/*
* 单击邮件标题显示邮件,返回时将邮件保存为"已读"状态
*/
public String findbyIdEmail() throws Exception {
email = this.emailService.findbyid(emailId);
return "toeditEmail";
}
/*
* 更新邮件,点击邮件标题查阅邮件以后将邮件设置为已读状态
*/
public String UpdateEmail() throws Exception {
email = this.emailService.findbyid(emailId);
email.setGetTime(new Date());
email.setIsRead("已读");
this.emailService.update(email);
email = this.emailService.findbyid(emailId);
return "toshowEmails";
}
/*
* 删除邮件,其实质不是真正删除,只是将其放入垃圾邮件列表。在此用标置位Scrap是'Y'还是'N'来实现
* 也可以用集合来实现这样的功能,有时间想办法去实现集合操作
*/
public String deleteEmail() throws Exception {
// System.out.println("我来到这了");
email = this.emailService.findbyid(emailId);
email.setIsScrap("Y".toUpperCase());
this.emailService.update(email);
employee = this.employeeService.findbyid(employeeId);
this.employeeName = employee.getEmployeeName();
Email email=new Email();
email.setRecipients(employee.getEmployeeName());
email.setIsScrap("N");
page = this.emailService.findbyPage(currentPage,email);
return "showEmails";
}
/*
* 下面方法是显示当前用户的垃圾邮件列表
*/
public String showScrapEmail() throws Exception {
// System.out.println("我走到这里了");
employee = this.employeeService.findbyid(employeeId);
Email email=new Email();
email.setRecipients(employee.getUsername());
email.setIsScrap("Y");
// email.setRecipients(employee.getEmployeeName());
page = this.emailService.findbyPage(currentPage,email);
// System.out.println("我终于成功了");
return "showScrapEmail";
}
// employee = this.employeeService.findbyid(employeeId);
// Email email=new Email();
// email.setRecipients(employee.getUsername());
// email.setIsScrap("N");
// page = this.emailService.findbyPage(currentPage,email);
// return "showEmails";
/*
* 还原垃圾邮件,其实质是将其Scrap值设置为'N'
*/
public String resetEmail() throws Exception {
email = this.emailService.findbyid(emailId);
email.setIsScrap("N");
this.emailService.update(email);
employee = this.employeeService.findbyid(employeeId);
this.employeeName = employee.getEmployeeName();
Email email=new Email();
email.setRecipients(employee.getEmployeeName());
email.setIsScrap("Y");
page = this.emailService.findbyPage(currentPage,email);
return "showScrapEmail";
}
/*
* 删除垃圾邮件,彻底删除所选邮件
*/
public String deleteScrapEmail() throws Exception {
email = this.emailService.findbyid(emailId);
this.emailService.delete(email);
employee = this.employeeService.findbyid(employeeId);
this.employeeName = employee.getEmployeeName();
Email email=new Email();
email.setRecipients(employee.getEmployeeName());
email.setIsScrap("Y");
page = this.emailService.findbyPage(currentPage, email);
return "showScrapEmail";
}
/*
* 下面这是所有的getter和setter方法
*/
public Integer getEmailId() {
return emailId;
}
public void setEmailId(Integer emailId) {
this.emailId = emailId;
}
public String getRecipients() {
return recipients;
}
public void setRecipients(String recipients) {
this.recipients = recipients;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getSender() {
return sender;
}
public void setSender(String sender) {
this.sender = sender;
}
public String getIsRead() {
return isRead;
}
public void setIsRead(String isRead) {
this.isRead = isRead;
}
public Date getSendTime() {
return sendTime;
}
没有合适的资源?快使用搜索试试~ 我知道了~
学士后三单元项目 北大青鸟办公管理系统
共187个文件
jar:65个
java:27个
class:27个
4星 · 超过85%的资源 需积分: 9 79 下载量 18 浏览量
2012-06-02
16:21:42
上传
评论 1
收藏 30.77MB RAR 举报
温馨提示
北大青鸟办公自动化管理系统主要用于日常的办公进行管理,如收发邮件,管理账户和考勤管理等,公司职员,经理室该系统的目标用户。 1.使用SSH框架实现该系统 2.使用oracle数据库 3.必须按照B/S结构完成系统
资源推荐
资源详情
资源评论
收起资源包目录
学士后三单元项目 北大青鸟办公管理系统 (187个子文件)
EmailAction.class 11KB
TimeSheetAction.class 7KB
EmployeeAction.class 6KB
EmployeeDaoImpl.class 4KB
GenericDaoImpl.class 4KB
TimeSheetDaoImpl.class 3KB
EmailDaoImpl.class 3KB
LoginAction.class 3KB
Email.class 3KB
Employee.class 3KB
DownLoadAction.class 2KB
TimeSheet.class 2KB
ConfigFile.class 2KB
EmployeeServiceImpl.class 2KB
TimeSheetServiceImpl.class 2KB
EmailServiceImpl.class 2KB
Page.class 1KB
GenericServiceImpl.class 943B
EmployeeService.class 483B
TimeSheetService.class 348B
Constant.class 329B
EmailService.class 328B
GenericService.class 326B
GenericDao.class 314B
EmployeeDao.class 283B
TimeSheetDao.class 145B
EmailDao.class 137B
.classpath 3KB
org.eclipse.wst.jsdt.ui.superType.container 49B
style.css 3KB
login_01.gif 33KB
login_02.gif 7KB
logo.gif 7KB
right_bg.gif 4KB
loading_wh.gif 3KB
login_sub.gif 3KB
copyright.gif 3KB
left_bg.gif 3KB
right.gif 2KB
bg.gif 1KB
submit.gif 1KB
ico.gif 1009B
Top_bg.gif 851B
sub.gif 660B
save.gif 649B
edit.gif 639B
delete.gif 636B
search.gif 617B
Config.ini 33B
spring.jar 2.81MB
spring.jar 2.71MB
hibernate3.jar 2.31MB
hibernate3.jar 2.31MB
xwork-2.1.2.jar 2.18MB
xwork-2.1.2.jar 2.18MB
aspectjweaver.jar 1.8MB
aspectjweaver.jar 1.47MB
ojdbc14.jar 1.47MB
ojdbc14.jar 1.47MB
freemarker-2.3.13.jar 850KB
freemarker-2.3.13.jar 850KB
struts2-core-2.1.6.jar 719KB
struts2-core-2.1.6.jar 719KB
javassist-3.9.0.GA.jar 583KB
javassist-3.9.0.GA.jar 583KB
commons-collections-3.1.jar 546KB
commons-collections-3.1.jar 546KB
mysql-connector-java-5.0.8-bin.jar 528KB
mysql-connector-java-5.0.8-bin.jar 528KB
mysql-connector-java-5.0.8-bin.jar 528KB
dwr.jar 491KB
antlr-2.7.6.jar 433KB
antlr-2.7.6.jar 433KB
log4j-1.2.15.jar 383KB
log4j-1.2.15.jar 383KB
cglib-nodep-2.1_3.jar 317KB
cglib-nodep-2.1_3.jar 317KB
dom4j-1.6.1.jar 307KB
dom4j-1.6.1.jar 307KB
dom4j-1.6.1.jar 307KB
bsh-2.0b4.jar 275KB
junit-4.7.jar 227KB
jaxen-1.1-beta-7.jar 222KB
jaxen-1.1-beta-7.jar 222KB
bsf-2.3.jar 171KB
ognl-2.6.11.jar 164KB
ognl-2.6.11.jar 164KB
commons-dbcp.jar 119KB
aspectjrt.jar 112KB
aspectjrt.jar 112KB
oscache-2.1.jar 112KB
oscache-2.1.jar 112KB
commons-io-1.3.2.jar 86KB
commons-io-1.3.2.jar 86KB
commons-validator-1.1.4.jar 82KB
jakarta-oro-2.0.8.jar 64KB
commons-pool.jar 61KB
commons-pool.jar 61KB
commons-logging.jar 59KB
commons-logging.jar 59KB
共 187 条
- 1
- 2
xiaoxiaoxinyuan8
- 粉丝: 1
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页