impexpDataSet.jsp
7.89 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!DOCTYPE html>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.conn.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@page import="weaver.formmode.exttools.impexp.common.StringUtils"%>
<%@page import="weaver.formmode.exttools.impexp.common.FileUtils"%>
<%@page import="weaver.formmode.exttools.impexp.common.XmlUtils"%>
<%@page import="org.dom4j.Element"%>
<%@page import="weaver.formmode.exttools.impexp.entity.FormDataXmlBean"%>
<%@page import="java.util.List"%>
<%@page import="weaver.file.FileManage"%>
<%@page import="weaver.formmode.exttools.impexp.log.LogRecordService"%>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="CommonConstant" class="weaver.formmode.service.CommonConstant" scope="page"/>
<HTML><HEAD>
<LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
<SCRIPT language="javascript" src="../../js/weaver_wev8.js"></script>
<link rel="stylesheet" href="/css/ecology8/request/requestTopMenu_wev8.css" type="text/css" />
</head>
<%
if(!HrmUserVarify.checkUserRight("WorkflowCustomManage:All", user))
{
response.sendRedirect("/notice/noright.jsp");
return;
}
String imagefilename = "/images/hdMaintenance_wev8.gif";
String titlename = SystemEnv.getHtmlLabelName(23799,user.getLanguage());
String needfav ="1";
String needhelp ="";
String concatS = CommonConstant.DB_CONCAT_SYMBOL;
String isnullFun=CommonConstant.DB_ISNULL_FUN;
String shortName = Util.null2String(request.getParameter("shortName"));
//解析表数据导出配置信息xml
String xmlfilepath="";
String isadd = StringUtils.null2String(request.getParameter("isadd"));
String filename = "data.zip";
FileManage fm = new FileManage();
int fileid = 0 ;
String uploadfilepath="",isaesencrypt="",aescode="";
if(rs.next()){
uploadfilepath = rs.getString("filerealpath");
isaesencrypt = rs.getString("isaesencrypt");
aescode = rs.getString("aescode");
}
String exceptionMsg ="";
if(!uploadfilepath.equals("")){
try{
xmlfilepath = GCONST.getRootPath()+"formmode"+File.separatorChar+"import"+File.separatorChar+filename ;
File oldfile = new File(xmlfilepath);
if(oldfile.exists()){
oldfile.delete();
}
if("1".equals(isaesencrypt)){
uploadfilepath = FileUtils.aesDesEncrypt(uploadfilepath,aescode);
}
fm.copy(uploadfilepath,xmlfilepath);
}catch(Exception e){
}
}
boolean add = "1".equals(isadd)?true:false;
xmlfilepath = GCONST.getRootPath()+"formmode"+File.separatorChar+"import"+File.separatorChar+filename ;
String zipfolderpath = FileUtils.unZip(xmlfilepath,StringUtils.getUnquieID());
XmlUtils xmlUtils = new XmlUtils();
String formDataXmlpath = zipfolderpath + File.separator + "dataSetForm.xml";
Element dataRoot = xmlUtils.parseXml(formDataXmlpath);
FormDataXmlBean formDataXmlBean=new FormDataXmlBean();
formDataXmlBean.fromSetDocument(dataRoot);
//导入数据判断
Map<String, String> requestidMap = formDataXmlBean.getRequestidMap();
Map<String, Integer> tablesum =new HashMap();
LogRecordService logRecordService=new LogRecordService();
String spit="";
String formmodeid="";
for(String key : requestidMap.keySet()){
Map<String, String> map = logRecordService.getRecordMapByRequestid(key);
String newTablename=map.get("tablename");
if(newTablename!=""){
rs.executeSql("select formmodeid,count(1) sum FROM "+newTablename+" WHERE "+isnullFun+"(formmodeid,0)!=1 GROUP BY formmodeid");
while(rs.next()){
int sum=StringUtils.getIntValue(rs.getString("sum"),0);
if(sum>0){
if(formmodeid!=""){
spit=",";
}
formmodeid+=spit+StringUtils.null2String(rs.getString("formmodeid"));
}
}
}
}
%>
<BODY>
<%@ include file="/systeminfo/TopTitle_wev8.jsp" %>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
<TABLE class=Shadow>
<tr>
<td valign="top">
<form name="frmSearch" method="post" action="CustomQuerySet.jsp">
<table id="topTitle" cellpadding="0" cellspacing="0">
</table>
<%
String sqlWhere="";
sqlWhere="a.id=b.formid and b.id in ( "+formmodeid+" ) ";
String operateString= "";
String tabletype="checkbox";
String tableString=""+
"<table needPage=\"false\" instanceid=\"chooseSubWorkflow\" pagesize=\""+PageIdConst.getPageSize(PageIdConst.WF_WORKFLOW_FIELDTRIGGER,user.getUID())+"\" tabletype=\""+tabletype+"\">"+
" <checkboxpopedom id=\"checkbox\" showmethod=\"weaver.general.KnowledgeTransMethod.getMailCheckbox\" />"+
"<sql backfields=\"a.id as id,b.modename modename,a.tablename,b.id as formid\" sqlwhere=\""+Util.toHtmlForSplitPage(sqlWhere)+"\" sqlform=\"workflow_bill a,modeinfo b \" sqlorderby=\"b.id\" sqlprimarykey=\"b.id\" sqlsortway=\"asc\" sqldistinct=\"true\" />"+
operateString+
"<head>"+
"<col width=\"30%\" text=\""+SystemEnv.getHtmlLabelNames("21805,22009",user.getLanguage())+"\" column=\"modeName\"/>"+
"<col width=\"30%\" column=\"tablename\" text=\""+SystemEnv.getHtmlLabelNames("21805,261",user.getLanguage())+"\" />"+
"<col width=\"30%\" transmethod=\"weaver.formmode.exttools.impexp.exp.service.extttoolsTransMethod.getModeDataCount\" otherpara=\"column:tablename+column:formid\" column=\"count\" text=\"数据量\"/>"+
"</head>"+
"</table>";
%>
<TABLE width="100%" cellspacing=0>
<tr style="height:20px">
<td>
<span style="font-size:13px;padding:13px;"><%=SystemEnv.getHtmlLabelName(384028,user.getLanguage())%></span>
</td>
</tr>
<tr>
<td>
<span style="font-size:7px;color:red;padding-left:13px;"><%=SystemEnv.getHtmlLabelName(384030,user.getLanguage())%></span>
</td>
</tr>
<tr>
<td valign="top">
<wea:SplitPageTag tableString='<%=tableString%>' mode="run" />
</td>
</tr>
</TABLE>
</td>
</tr>
</TABLE>
<div id="zDialog_div_bottom" class="zDialog_div_bottom">
<wea:layout needImportDefaultJsAndCss="false">
<wea:group context="" attributes="{groupDisplay:none}">
<wea:item type="toolbar">
<input type="button" value="<%=SystemEnv.getHtmlLabelName(128844,user.getLanguage())%>" id="cancelBtn" class="zd_btn_cancle" onclick="impData()">
</wea:item>
</wea:group>
</wea:layout>
</div>
<script type="text/javascript">
function doSubmit(){
enableAllmenu();
document.frmSearch.submit();
}
function donewQueryType(){
enableAllmenu();
location.href="/workflow/workflow/CustomQueryTypeAdd.jsp";
}
</script>
</BODY>
<script type="text/javascript">
var diag_vote;
jQuery(document).ready(function () {
$("#topTitle").topMenuTitle({searchFn:onBtnSearchClick});
$(".topMenuTitle td:eq(0)").html($("#tabDiv").html());
$("#tabDiv").remove();
});
function closeDialog(){
diag_vote.close();
}
function onBtnSearchClick(){
var typename=$("input[name='flowTitle']",parent.document).val();
try{
typename = encodeURI(typename);
}catch(e){
if(window.console)console.log(e)
}
$("input[name='shortName']").val(typename);
window.location="CustomQuerySet.jsp?shortName="+typename;
}
function onReset() {
jQuery('input[name="flowTitle"]', parent.document).val('');
jQuery('input[name="shortName"]').val('');
}
function impData(id){
if(!id){
id = _xtable_CheckedCheckboxId();
}
if(!id){
window.top.Dialog.alert("<%=SystemEnv.getHtmlLabelName(32568,user.getLanguage())%>");
return;
}
if(id.match(/,$/)){
id = id.substring(0,id.length-1);
}
var dialog = window.top.getDialog(window);
dialog.close(id);
}
</script>
</HTML>