package com.action;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.ServletActionContext;
import com.entity.Account;
import com.entity.ApproveInfo;
import com.entity.Document;
import com.entity.WorkFlow;
import com.service.ApproveInfoService;
import com.service.DocService;
import com.service.WorkFlowService;
public class DocAction {
@Resource(name = "docServiceImpl")
private DocService ds;
@Resource(name = "workFlowServiceImpl")
private WorkFlowService ws;
@Resource(name="approveInfoServiceImpl")
private ApproveInfoService as;
private Integer wfId;
private String contentFileName;
private File content;
private String docTitle;
private String docDesc;
private Integer docId;
//审批信息
private String comment;
private Integer prize;
// 显示选择公文
public String showAddDoc() {
HttpServletRequest request = ServletActionContext.getRequest();
List<WorkFlow> wfs = ws.findAll();
request.setAttribute("wfs", wfs);
return "showAddDoc";
}
// 显示公文对应的表单
public String showAddDocForm() {
HttpServletRequest request = ServletActionContext.getRequest();
WorkFlow workFlow = ws.findById(wfId);
request.setAttribute("workFlow", workFlow);
return "showAddDocForm";
}
//添加公文(填写表单)
public String addDoc() {
HttpServletRequest request = ServletActionContext.getRequest();
Account account = (Account)request.getSession().getAttribute("account");
Document doc = new Document();
doc.setCreateTime(new Date());
doc.setCreator(account);
doc.setDocDesc(docDesc);
doc.setDocTitle(docTitle);
WorkFlow wf = ws.findById(wfId);
doc.setStatus(Document.STATUS_NEW);
doc.setFlag(1);
doc.setLoadName(contentFileName);
doc.setContent(getByteFromFile(content));
Map<String, Object> params = new HashMap<String, Object>();
params.put("emp", account.getUname());
params.put("prize", prize);
System.out.println(prize);
ds.addDocForProcess(doc, wf, params);
return "addDoc";
}
//显示我的公文
public String showMyDoc() {
HttpServletRequest request = ServletActionContext.getRequest();
//得到登陆用户的对象
Account account = (Account)request.getSession().getAttribute("account");
//根据UID获取集合
Integer uid = account.getUid();
List<Document> docs = ds.findAllByKey("from Document doc where doc.creator.uid=?", new Object[]{uid});
request.setAttribute("docs", docs);
return "showMyDoc";
}
//下载
public String execute() throws Exception {
HttpServletResponse response = ServletActionContext.getResponse();
Document doc = ds.findById(docId);
response.reset();
String loadName = doc.getLoadName();
String name = new String(loadName.getBytes("utf-8"),"iso-8859-1");
response.setContentType("application/x-download;charset=utf-8");
response.setHeader("content-Disposition", "attachment;filename="+name);
response.getOutputStream().write(doc.getContent());
response.getOutputStream().flush();
response.getOutputStream().close();
return null;
}
//提交流程
public String appDoc() {
HttpServletRequest request = ServletActionContext.getRequest();
Account account = (Account)request.getSession().getAttribute("account");
String uname = account.getUname();
Document doc = ds.findById(docId);
ds.applyDoc(uname, doc);
return "appDoc";
}
//显示待审公文
public String showApproveingDoc() {
HttpServletRequest request = ServletActionContext.getRequest();
Account account = (Account)request.getSession().getAttribute("account");
String uname = account.getUname();
List<Document> docs = ds.findApprovingDoc(uname);
request.setAttribute("docs",docs);
return "showApproveingDoc";
}
//显示审批意见
public String showApprove() {
HttpServletRequest request = ServletActionContext.getRequest();
request.setAttribute("docId",docId);
return "showApprove";
}
//提交审批信息
public String approve() {
HttpServletRequest request = ServletActionContext.getRequest();
ApproveInfo approveInfo = new ApproveInfo();
approveInfo.setComment(comment);
approveInfo.setApproveTime(new Date());
Account account = (Account)request.getSession().getAttribute("account");
String uname = account.getUname();
approveInfo.setApprover(account);
Document doc = ds.findById(docId);
ds.endDoc(approveInfo, uname, doc);
return "approve";
}
//显示已审公文的页面
public String showApprovedDoc() {
HttpServletRequest request = ServletActionContext.getRequest();
Account account = (Account)request.getSession().getAttribute("account");
Integer uid = account.getUid();
List<ApproveInfo> approves = as.findAllByKey("from ApproveInfo ao where ao.approver.uid=?", new Object[]{uid});
request.setAttribute("approves", approves);
return "showApprovedDoc";
}
//显示审批历史
public String showApprovedHistory() {
HttpServletRequest request = ServletActionContext.getRequest();
//根据docId获取审批历史
List<ApproveInfo> approveHistory = as.findAllByKey("from ApproveInfo ao where ao.document.did=?", new Object[]{docId});
request.setAttribute("approveHistory", approveHistory);
return "showApprovedHistory";
}
public Integer getWfId() {
return wfId;
}
public void setWfId(Integer wfId) {
this.wfId = wfId;
}
public String getContentFileName() {
return contentFileName;
}
public void setContentFileName(String contentFileName) {
this.contentFileName = contentFileName;
}
public File getContent() {
return content;
}
public void setContent(File content) {
this.content = content;
}
public String getDocTitle() {
return docTitle;
}
public void setDocTitle(String docTitle) {
this.docTitle = docTitle;
}
public String getDocDesc() {
return docDesc;
}
public void setDocDesc(String docDesc) {
this.docDesc = docDesc;
}
public Integer getDocId() {
return docId;
}
public void setDocId(Integer docId) {
this.docId = docId;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public Integer getPrize() {
return prize;
}
public void setPrize(Integer prize) {
this.prize = prize;
}
// 文件转换为字节数组
private byte[] getByteFromFile(File file) {
byte[] be = null;
try {
if (file == null) {
return null;
}
FileInputStream in = new FileInputStream(file);
ByteArrayOutputStream out = new ByteArrayOutputStream(4000);
byte[] b = new byte[4000];
int n;
while ((n = in.read(b)) != -1) {
out.write(b, 0, n);
}
in.close();
out.close();
be = out.toByteArray();
} catch (Exception e) {
e.printStackTrace();
}
return be;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
JBPM5.4 SSH 完整项目整合案例
共343个文件
jar:84个
jpg:46个
java:43个
5星 · 超过95%的资源 需积分: 10 542 下载量 142 浏览量
2013-07-05
15:23:52
上传
评论 13
收藏 29.86MB RAR 举报
温馨提示
完整项目案例 包含完整架包 和数据库表结构 以及完整数据 在eclipse和myeclipse都可以完美运行 下载后遇到问题 可以给我留言解决
资源推荐
资源详情
资源评论
收起资源包目录
JBPM5.4 SSH 完整项目整合案例 (343个子文件)
Bitmap_202.bmp 5KB
Bitmap_203.bmp 1KB
midformbar.bmp 296B
Bitmap_201.bmp 290B
special02.bpmn 13KB
special02.bpmn 13KB
special01.bpmn 8KB
special01.bpmn 8KB
JbpmAPIUtil.class 9KB
DocAction.class 8KB
IdaoImpl.class 6KB
FlowFormAction.class 6KB
DocServiceImpl.class 6KB
WorkFlowAction.class 5KB
AbstractBaseDao.class 4KB
Document.class 3KB
TestJBPM5.class 3KB
AccountAction.class 3KB
UserServiceImpl.class 2KB
FormField.class 2KB
DynaFormFunction.class 2KB
JbpmAction.class 2KB
Idao.class 2KB
WorkFlow.class 2KB
ApproveInfo.class 2KB
FlowForm.class 2KB
BaseDao.class 1KB
AccountServiceImpl.class 1KB
FreeMarkerUtil.class 1KB
DocProperty.class 1KB
Pager.class 1KB
FieldInput.class 996B
Account.class 981B
FieldType.class 981B
GetEntityClassUtil.class 776B
FieldItem.class 740B
DocService.class 723B
ApproveInfoServiceImpl.class 570B
FieldInputServiceImpl.class 564B
FormFieldServiceImpl.class 558B
FieldTypeServiceImpl.class 558B
FlowFormServiceImpl.class 552B
WorkFlowServiceImpl.class 552B
UserService.class 514B
AccountService.class 322B
ApproveInfoService.class 257B
FieldInputService.class 254B
FormFieldService.class 251B
FieldTypeService.class 251B
FlowFormService.class 248B
WorkFlowService.class 248B
.classpath 607B
org.eclipse.wst.common.component 482B
org.eclipse.wst.jsdt.ui.superType.container 49B
mainstyle.css 2KB
page.css 914B
reset.css 689B
Thumbs.db 9KB
Thumbs.db 8KB
Thumbs.db 8KB
Thumbs.db 5KB
Thumbs.db 5KB
leave.ftl 190B
leave.ftl 190B
text.ftl 68B
text.ftl 68B
drools-core-5.4.0.Final.jar 2.71MB
trove4j-3.0.2.jar 2.41MB
hibernate-core-3.3.2.GA.jar 2.2MB
ecj-3.5.1.jar 1.6MB
hornetq-core-2.2.10.Final.jar 1.39MB
h2-1.3.161.jar 1.2MB
drools-compiler-5.4.0.Final.jar 1.08MB
netty-3.2.0.Final.jar 930KB
freemarker-2.3.19.jar 909KB
spring-core-3.2.0.M2.jar 813KB
spring-context-3.2.0.M2.jar 813KB
struts2-core-2.3.4.1.jar 765KB
mvel2-2.1.0.drools16.jar 724KB
mysql-connector-java-5.1.7-bin.jar 693KB
javassist-3.14.0-GA.jar 633KB
mina-core-2.0.1.jar 626KB
xwork-core-2.3.4.1.jar 614KB
javassist-3.11.0.GA.jar 600KB
spring-webmvc-3.2.0.M2.jar 596KB
spring-beans-3.2.0.M2.jar 586KB
spring-web-3.2.0.M2.jar 582KB
commons-collections-3.2.1.jar 562KB
jbpm-flow-5.3.0.Final.jar 554KB
xstream-1.4.1.jar 484KB
log4j-1.2.16.jar 470KB
protobuf-java-2.4.1.jar 440KB
antlr-2.7.7.jar 435KB
spring-jdbc-3.2.0.M2.jar 389KB
mail-1.4.jar 380KB
spring-orm-3.2.0.M2.jar 375KB
spring-aop-3.2.0.M2.jar 325KB
commons-lang3-3.1.jar 308KB
dom4j-1.6.1.jar 307KB
btm-2.1.2.jar 282KB
共 343 条
- 1
- 2
- 3
- 4
一缕寒芒
- 粉丝: 9
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 老飞飞搭建基础通用数据库V19数据库.rar
- jquery.js
- 机械设计多工位ACF贴胶带&预压设备sw18可编辑非常好的设计图纸100%好用.zip
- 基于Pytorch复现Point-Transformer,用于ShapeNet数据集点云分割
- 【医学影像分析】2D超声图像的分割检测(Ultrasound Nerve Segmentation - Kaggle数据集)
- 嘎嘎香的五款神仙谷歌插件
- .arch书源导入教程.mp4
- 贪心算法介绍及代码示例讲解
- CR13SP35MSI64 Crystal 水晶报表运行组件最后版本64位
- 图像分类数据集:玉米叶是否感染分类数据集(2分类,包含训练集、验证集)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页