impexpDataSet.jsp 7.89 KB
<!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>