excelLayoutSave.jsp
3.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<%@page import="com.engine.fnaMulDimensions.util.constants.FnaAccTypeConstant"%>
<%@page import="weaver.conn.RecordSet"%>
<%@page import="com.engine.fnaMulDimensions.util.AccountInfoComInfo"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ page import="weaver.file.FileUpload,java.io.File"%>
<%@ page import="weaver.workflow.workflow.WfRightManager"%>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="excelLayoutManager" class="weaver.fna.exceldesign.ExcelLayoutManager" scope="page"/>
<%
FileUpload fu = new FileUpload(request, false, false, "filesystem/htmllayoutimages");
//int wfid = Util.getIntValue(fu.getParameter("wfid"), 0);
//WfRightManager wfrm = new WfRightManager();
//boolean haspermission = wfrm.hasPermission3(wfid, 0, user, WfRightManager.OPERATION_CREATEDIR);
if (!HrmUserVarify.checkUserRight("FnaMultiBudgetTempldate:Edit",user)) {
response.sendRedirect("/notice/noright.jsp") ;
return ;
}
String accountId = Util.null2String(fu.getParameter("accountId"));
String approvalId = Util.null2String(fu.getParameter("approvalId"));
String templateId = Util.null2String(fu.getParameter("templateId"));
AccountInfoComInfo accountInfoComInfo = new AccountInfoComInfo();
String numberCode = accountInfoComInfo.getNumberCode(accountId);
//生效模板不能保存
StringBuffer buffer = new StringBuffer();
buffer.append(" select approvaTypelstatus,nodeStatus from FnaBudgetApprovalType_").append(numberCode).append(" fat ");
buffer.append(" join FnaBudgetApproval_").append(numberCode).append(" fa ");
buffer.append(" on fat.id = fa.approvalTypeId ");
buffer.append(" where fa.id = ? ");
rs.executeQuery(buffer.toString(), approvalId);
if(rs.next()){
int approvaTypelstatus = Util.getIntValue(rs.getString("approvaTypelstatus"));
int nodeStatus = Util.getIntValue(rs.getString("nodeStatus"));
if(approvaTypelstatus == 1 || nodeStatus == 1){
String url = "excelMain.jsp?templateId="+templateId+"&accountId="+accountId+"&approvalId="+approvalId+"&approvaTypelstatus="+approvaTypelstatus;
url += "&nodeStatus="+nodeStatus;
response.sendRedirect(url);
return;
}
}
//两人同时新建,防止一个节点产生2个模板
String tableName = "";
rs.executeQuery(" select * from FnaAccountDtl where accountId = ? and tableType = ? ", accountId, FnaAccTypeConstant.BUDGET_TEMPLATE);
if(rs.next()){
tableName = Util.null2String(rs.getString("tableName"));
}
if(!"".equals(tableName)){
rs.executeQuery(" select id from Fnabudgettemplate_"+numberCode+" where approvalid = ? ", approvalId);
if(rs.next()){
String id = Util.null2String(rs.getString("id"));
if(!templateId.equals(id)){
String url = "excelMain.jsp?templateId="+templateId+"&accountId="+accountId+"&approvalId="+approvalId;
url += "&hasCreate=1";
response.sendRedirect(url);
return;
}
}
}
//多人编辑,防止节点已被删除
rs.executeQuery(" select id from FnaBudgetApproval_"+numberCode+" where id = ? ", approvalId);
if(!rs.next()){
String url = "excelMain.jsp?templateId="+templateId+"&accountId="+accountId+"&approvalId="+approvalId;
url += "&nodeDelete=1";
response.sendRedirect(url);
return;
}
//保存Excel模板
excelLayoutManager.setFu(fu);
excelLayoutManager.setUser(user);
String operation = fu.getParameter("operation");
String isCheck = fu.getParameter("isCheck");
String number = fu.getParameter("number");
if("saveExcel".equalsIgnoreCase(operation)){
templateId = excelLayoutManager.doSaveExcelInfo();
String url = "excelMain.jsp?templateId="+templateId+"&accountId="+accountId+"&approvalId="+approvalId+"&isCheck="+isCheck+"&number="+number;
response.sendRedirect(url);
}
%>