为高考学子加油,JEECG 3.7.6 高考性能加强版本发布

jeecg_3.7.6
zhangdaiscott@163.com 6 years ago
parent 4335a0aeb9
commit ebd8c4fa72

@ -8,7 +8,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
@ -18,11 +17,9 @@ import org.codehaus.jackson.map.ObjectMapper;
import org.jeecgframework.core.common.hibernate.qbc.PageList;
import org.jeecgframework.core.common.model.json.ComboBox;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.ReflectHelper;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.tag.core.util.GzipUtilities;
import org.jeecgframework.tag.vo.datatable.DataTableReturn;
import org.jeecgframework.tag.vo.easyui.Autocomplete;
import org.jeecgframework.web.system.pojo.base.TSRole;
@ -83,7 +80,7 @@ public class TagUtil {
}
value = reflectHelper.getMethodValue(fieldName)==null?"":reflectHelper.getMethodValue(fieldName);
if (value !=""&&value != null && (FiledName.indexOf("_") != -1||FiledName.indexOf(".") != -1)) {
// update-start--Author:zhangguoming Date:20140827 for功能增强添加处理对象中List<Object>属性字段的解析
if(value instanceof List) {
Object tempValue = "";
for (Object listValue : (List)value) {
@ -93,10 +90,10 @@ public class TagUtil {
} else {
value = fieldNametoValues(childFieldName, value);
}
// update-end--Author:zhangguoming Date:20140827 for功能增强添加处理对象中List<Object>属性字段的解析
}
if(value != "" && value != null) {
// update-begin--Author:jb_longjb 龙金波 Date:20150313 for处理json中可能包含的特殊字符防止页面加载出错
value = converunicode(value.toString());
}
return value;
@ -106,7 +103,7 @@ public class TagUtil {
for (int i=0; i<jsonValue.length(); i++) {
char c = jsonValue.charAt(i);
switch (c){
// update-begin--Author:zhoujf Date:20150615 for菜单图片不显示的问题
// case '\"':
// sb.append("\\\"");
// break;
@ -119,7 +116,7 @@ public class TagUtil {
// case '/':
// sb.append("\\/");
// break;
// update-end--Author:zhoujf Date:20150615 for菜单图片不显示的问题
case '\b':
sb.append("\\b");
break;
@ -141,7 +138,7 @@ public class TagUtil {
}
return sb.toString();
}
// update-end--Author:jb_longjb 龙金波 Date:20150313 for处理json中可能包含的特殊字符防止页面加载出错
/**
*
@ -170,7 +167,7 @@ public class TagUtil {
private static String listtojson(String[] fields, int total, List<?> list, String[] footers, String dataStyle, int pageSize) throws Exception {
//Object[] values = new Object[fields.length];
StringBuffer jsonTemp = new StringBuffer();
//update--begin--author:zhangjiaqiang date:20170413 for:支持jqgrid列表 json格式
if("jqgrid".equals(dataStyle)){
int totalPage = total % pageSize > 0 ? total / pageSize + 1 : total / pageSize;
if(totalPage == 0) totalPage = 1;
@ -179,20 +176,23 @@ public class TagUtil {
jsonTemp.append("{\"total\":" + total );
}
jsonTemp.append(",\"rows\":[");
//update--end--author:zhangjiaqiang date:20170413 for:支持jqgrid列表 json格式
int i;
String fieldName;
//update--begin--author:scott date:20170918 for:list为null问题处理-------
if(list==null){
list = new ArrayList();
}
//update--end--author:scott date:20170918 for:list为null问题处理-------
for (int j = 0; j < list.size(); ++j) {
//update-begin--Author:zhoujf Date:20170323 forTASK #1774 【bug】树列表下一级没了图标是文件夹的问题应该是节点(优化)
//update-begin--Author:zhoujf Date:20170315 forTASK #1774 【bug】树列表下一级没了图标是文件夹的问题应该是节点
//jsonTemp.append("{");
jsonTemp.append("{\"state\":\"closed\",");
//update-end--Author:zhoujf Date:20170315 forTASK #1774 【bug】树列表下一级没了图标是文件夹的问题应该是节点
//update-end--Author:zhoujf Date:20170323 forTASK #1774 【bug】树列表下一级没了图标是文件夹的问题应该是节点(优化)
Object fieldValue = null;
for (i = 0; i < fields.length; ++i) {
fieldName = fields[i].toString();
@ -201,9 +201,9 @@ public class TagUtil {
else {
fieldValue = fieldNametoValues(fieldName, list.get(j));
}
//update-begin--Author:zhoujf Date:20170315 for对象为null时返回空串而不是“null”
jsonTemp.append("\"" + fieldName + "\"" + ":\"" + getStringValue(fieldValue).replace("\"", "\\\"") + "\"");
//update-end--Author:zhoujf Date:20170315 for对象为null时返回空串而不是“null”
if (i != fields.length - 1) {
jsonTemp.append(",");
}
@ -240,7 +240,7 @@ public class TagUtil {
jsonTemp.append("}");
return jsonTemp.toString();
}
//update--begin--author:gj_shaojc-- date:20180604--forTASK #2763 【确认问题】合计金额展示问题,国际通用格式 如61,100.00 确认是否存在问题
/**
* LISTEASYUIJSONFootersjson
* @param fields
@ -307,12 +307,13 @@ public class TagUtil {
jsonTemp.append("}");
return jsonTemp.toString();
}
//update--end--author:gj_shaojc-- date:20180604--forTASK #2763 【确认问题】合计金额展示问题,国际通用格式 如61,100.00 确认是否存在问题
//update-begin--Author:zhoujf Date:20170315 for对象为null时返回空串而不是“null”
//为空时返回空串
private static String getStringValue(Object obj){
return (obj == null) ? "" : obj.toString();
}
//update-end--Author:zhoujf Date:20170315 for对象为null时返回空串而不是“null”
/**
*
@ -414,19 +415,19 @@ public class TagUtil {
private static JSONObject getJson(DataGrid dg) {
JSONObject jObject = null;
try {
//update--begin--author:zhangjiaqiang date:20170413 for:支持jqgrid列表 json格式
if(!StringUtil.isEmpty(dg.getFooter())){
//update--begin--author:gj_shaojc-- date:20180604--forTASK #2763 【确认问题】合计金额展示问题,国际通用格式 如61,100.00 确认是否存在问题
if(dg.getFooter().startsWith("[")){
jObject = JSONObject.parseObject(listtojsonByFootersJson(dg.getField().split(","), dg.getTotal(), dg.getResults(),dg.getFooter(),dg.getDataStyle(),dg.getRows()));
}else{
jObject = JSONObject.parseObject(listtojson(dg.getField().split(","), dg.getTotal(), dg.getResults(),dg.getFooter().split(","),dg.getDataStyle(),dg.getRows()));
}
//update--end--author:gj_shaojc-- date:20180604--forTASK #2763 【确认问题】合计金额展示问题,国际通用格式 如61,100.00 确认是否存在问题
}else{
jObject = JSONObject.parseObject(listtojson(dg.getField().split(","), dg.getTotal(), dg.getResults(),null,dg.getDataStyle(),dg.getRows()));
}
//update--end--author:zhangjiaqiang date:20170413 for:支持jqgrid列表 json格式
} catch (Exception e) {
e.printStackTrace();
}
@ -560,31 +561,21 @@ public class TagUtil {
PrintWriter pw = null;
try {
HttpServletRequest request = ContextHolderUtils.getRequest();
if (GzipUtilities.isGzipSupported(request) && !GzipUtilities.isGzipDisabled(request)) {
log.debug("-------datagrid----json-----开启Gzip压缩-------------");
pw = GzipUtilities.getGzipWriter(response);
response.setHeader("Content-Encoding", "gzip");
} else {
pw = response.getWriter();
}
pw=response.getWriter();
pw.write(object.toString());
pw.flush();
pw.close();
} catch (IOException e) {
e.printStackTrace();
}finally{
try {
//update-begin--Author:scott Date:20160530 for清空降低缓存占用
pw.close();
object.clear();
object = null;
dg.clear();
dg = null;
System.gc();
//update-end--Author:scott Date:20160530 for清空降低缓存占用
} catch (Exception e) {
e.printStackTrace();
}
@ -604,30 +595,22 @@ public class TagUtil {
JSONArray rows = object.getJSONArray("rows");
PrintWriter pw = null;
try {
HttpServletRequest request = ContextHolderUtils.getRequest();
if (GzipUtilities.isGzipSupported(request) && !GzipUtilities.isGzipDisabled(request)) {
log.info("-------datagrid----json-----开启Gzip压缩-------------");
pw = GzipUtilities.getGzipWriter(response);
response.setHeader("Content-Encoding", "gzip");
} else {
pw = response.getWriter();
}
pw = response.getWriter();
pw.write(rows.toString());
pw.flush();
pw.close();
} catch (IOException e) {
e.printStackTrace();
}finally{
try {
//update-begin--Author:scott Date:20160530 for清空降低缓存占用
pw.close();
object.clear();
//update-end--Author:scott Date:20160530 for清空降低缓存占用
//update-begin--Author:scott Date:20170830 forTASK #1756 【性能优化】分页查询存在写法问题,性能 CriteriaQuery cq 清空---
dg.clear();
dg = null;
System.gc();
//update-end--Author:scott Date:20170830 forTASK #1756 【性能优化】分页查询存在写法问题,性能 CriteriaQuery cq 清空---
} catch (Exception e) {
e.printStackTrace();
}
@ -652,31 +635,21 @@ public class TagUtil {
}
PrintWriter pw = null;
try {
HttpServletRequest request = ContextHolderUtils.getRequest();
if (GzipUtilities.isGzipSupported(request) && !GzipUtilities.isGzipDisabled(request)) {
log.debug("-------datagrid----json-----开启Gzip压缩-------------");
pw = GzipUtilities.getGzipWriter(response);
response.setHeader("Content-Encoding", "gzip");
} else {
pw = response.getWriter();
}
pw = response.getWriter();
pw.write(object.toString());
pw.flush();
pw.close();
} catch (IOException e) {
e.printStackTrace();
}finally{
try {
//update-begin--Author:scott Date:20160530 for清空降低缓存占用
pw.close();
object.clear();
dg.clear();
dg = null;
System.gc();
extMap = null;
//update-begin--Author:scott Date:20160530 for清空降低缓存占用
} catch (Exception e2) {
// TODO: handle exception
}
@ -814,7 +787,8 @@ public class TagUtil {
param += "'\"+index+\"'";// 传出行索引号参数
return param;
}
//update-begin--Author:luobaoli Date:20150711 for新增方法将存储过程返回的数据解析为json格式
public static String getJson(List fields,List datas){
if(datas!=null && datas.size()>0){
StringBuffer sb = new StringBuffer();
@ -834,7 +808,7 @@ public class TagUtil {
return "{\"total\":\"0\",\"rows\":[]}";
}
}
//update-begin--Author:luobaoli Date:20150711 for新增方法将存储过程返回的数据解析为json格式
public static String getJsonByMap(List fields,List<Map<String,Object>> datas){
if(datas!=null && datas.size()>0){

Loading…
Cancel
Save