HistoryDevByCx/二开源码/美之高/mzg/fna/FnaLoadingAjax.jsp

40 lines
1.9 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@page import="weaver.file.ExcelFile"%>
<%@ page import="weaver.general.Util" %>
<%@page import="weaver.hrm.HrmUserVarify"%>
<%@page import="weaver.hrm.User"%>
<%@page import="org.json.JSONObject"%>
<%@page import="weaver.fna.interfaces.thread.FnaThreadResult"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
boolean isDone = true;
String infoStr = "";
String resultJson = "";
User user = HrmUserVarify.getUser(request, response);
if(user == null){
isDone = true;
}else{
//唯一标识
String guid = Util.null2String(request.getParameter("guid")).trim();
//是否操作完成标识
isDone = "true".equalsIgnoreCase((String)FnaThreadResult.getInfoObjectByInfoKey(guid, "FnaLoadingAjax_"+guid+"_isDone"));
//进度信息字符串
infoStr = Util.null2String((String)FnaThreadResult.getInfoObjectByInfoKey(guid, "FnaLoadingAjax_"+guid+"_infoStr")).trim();
//操作完成后返回数据json字符串
resultJson = Util.null2String((String)FnaThreadResult.getInfoObjectByInfoKey(guid, "FnaLoadingAjax_"+guid+"_resultJson")).trim();
if(isDone){
//针对导入excel对象特殊处理如果存在_excelFile对象则获取对象后放入seesion中。
ExcelFile excelFile = (ExcelFile)FnaThreadResult.getInfoObjectByInfoKey(guid, "FnaLoadingAjax_"+guid+"_excelFile");
if(excelFile!=null){
session.setAttribute("FnaLoadingAjax_"+guid+"_excelFile", excelFile);
}
//如果操作完成则在所有事项完成后按guid移除线程信息
FnaThreadResult.removeInfoByGuid(guid);
}
}
//保证操作完成后返回数据json字符串不为空
//实际返回json对象可能各不相同但是必然都包含以下两个参数所以默认初始化这两个参数避免前端解析出错
if("".equals(resultJson)){
resultJson = "{\"flag\":false,\"msg\":\"\"}";
}
%><%="{\"flag\":"+isDone+",\"infoStr\":"+JSONObject.quote(infoStr)+",\"resultJson\":"+resultJson+"}" %>