-- author:scott --- date:20180907---- for: 解决连接远程数据库很慢的问题 ----

org/jeecgframework/web/cgform/controller/autolist/CgAutoListController.java
org/jeecgframework/easypoi/service/EasypoiDictService.java
org/jeecgframework/core/aop/EhcacheAspect.java
org/jeecgframework/web/system/controller/core/IconController.java
com/jeecg/demo/controller/JeecgListDemoController.java
org/jeecgframework/web/system/controller/core/LoginController.java
org/jeecgframework/web/system/controller/core/MutiLangController.java
org/jeecgframework/web/system/service/MutiLangServiceI.java
org/jeecgframework/web/system/service/impl/MutiLangServiceImpl.java
org/jeecgframework/tag/core/easyui/MutiLangTag.java
org/jeecgframework/web/cgform/engine/tag/MutiLangTag.java
org/jeecgframework/web/superquery/controller/SuperQueryMainController.java
org/jeecgframework/web/system/controller/core/SystemController.java
org/jeecgframework/tag/core/easyui/TabTag.java
org/jeecgframework/web/system/service/impl/UserServiceImpl.java
-- author:scott --- date:20180907---- for: 解决连接远程数据库很慢的问题 ----
pull/6/head
zhangdaihao 5 years ago
parent 719bdb09e1
commit 582d7948de

@ -1,26 +1,15 @@
package com.jeecg.demo.controller;
import com.alibaba.fastjson.JSONArray;
import com.jeecg.demo.dao.JeecgMinidaoDao;
import com.jeecg.demo.entity.JeecgDemoEntity;
import com.jeecg.demo.entity.JeecgDemoPage;
import com.jeecg.demo.entity.JeecgLogReport;
import com.jeecg.demo.service.JeecgDemoServiceI;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONObject;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.StringReader;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import org.apache.batik.transcoder.Transcoder;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
@ -39,14 +28,7 @@ import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.common.model.json.Highchart;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.DBTypeUtil;
import org.jeecgframework.core.util.DateUtils;
import org.jeecgframework.core.util.ExceptionUtil;
import org.jeecgframework.core.util.JeecgDataAutorUtils;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.core.util.*;
import org.jeecgframework.jwt.util.GsonUtil;
import org.jeecgframework.jwt.util.ResponseMessage;
import org.jeecgframework.jwt.util.Result;
@ -57,12 +39,10 @@ import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.tag.vo.datatable.SortDirection;
import org.jeecgframework.web.system.controller.core.LoginController;
import org.jeecgframework.web.system.enums.InterfaceEnum;
import org.jeecgframework.web.system.pojo.base.InterfaceRuleDto;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.pojo.base.TSLog;
import org.jeecgframework.web.system.service.MutiLangServiceI;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.web.system.util.InterfaceUtil;
import org.slf4j.Logger;
@ -71,23 +51,22 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.util.UriComponentsBuilder;
import com.alibaba.fastjson.JSONArray;
import com.jeecg.demo.dao.JeecgMinidaoDao;
import com.jeecg.demo.entity.JeecgDemoEntity;
import com.jeecg.demo.entity.JeecgDemoPage;
import com.jeecg.demo.entity.JeecgLogReport;
import com.jeecg.demo.service.JeecgDemoServiceI;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.StringReader;
import java.text.ParseException;
import java.util.*;
/**
* @Title: Controller
@ -116,9 +95,6 @@ public class JeecgListDemoController extends BaseController {
@Autowired
private JeecgMinidaoDao jeecgMinidaoDao;
@Autowired
private MutiLangServiceI mutiLangService;
/**
* minidao
* @param request
@ -521,7 +497,7 @@ public class JeecgListDemoController extends BaseController {
Long count = systemService.getCountForJdbc("SELECT COUNT(1) FROM T_S_Log WHERE 1=1");
List lt = new ArrayList();
hc = new Highchart();
hc.setName(mutiLangService.getLang(BROSWER_COUNT_ANALYSIS));
hc.setName(MutiLangUtil.getLang(BROSWER_COUNT_ANALYSIS));
hc.setType(reportType);
Map<String, Object> map;
if (userBroswerList.size() > 0) {

@ -20,7 +20,7 @@ import org.springframework.stereotype.Component;
/**
*
* @author
* @TODO -
* @TODO MutiLangTag -
* Ehcache
*/
//@Component

@ -1,16 +1,16 @@
package org.jeecgframework.easypoi.service;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.jeecgframework.core.util.MutiLangUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.web.system.dao.JeecgDictDao;
import org.jeecgframework.web.system.pojo.base.DictEntity;
import org.jeecgframework.web.system.service.MutiLangServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
*
* @authorscott
@ -23,9 +23,7 @@ public class EasypoiDictService implements EasypoiDictServiceI {
@Autowired
private JeecgDictDao jeecgDictDao;
@Autowired
private MutiLangServiceI mutiLangService;
/**
* easypoi
* @param
@ -48,7 +46,7 @@ public class EasypoiDictService implements EasypoiDictServiceI {
}
}
for(DictEntity t:dictList){
dictReplace.add(mutiLangService.getLang(t.getTypename())+"_"+t.getTypecode());
dictReplace.add(MutiLangUtil.getLang(t.getTypename())+"_"+t.getTypecode());
}
if(dictReplace!=null && dictReplace.size()!=0){
return dictReplace.toArray(new String[dictReplace.size()]);

@ -1,14 +1,12 @@
package org.jeecgframework.tag.core.easyui;
import java.io.IOException;
import org.jeecgframework.core.util.MutiLangUtil;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import org.jeecgframework.core.util.ApplicationContextUtil;
import org.jeecgframework.web.system.service.MutiLangServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.jeecgframework.core.util.StringUtil;
import java.io.IOException;
/**
@ -46,11 +44,7 @@ public class MutiLangTag extends TagSupport {
}
public String end() {
MutiLangServiceI mutiLangService = ApplicationContextUtil.getContext().getBean(MutiLangServiceI.class);
String lang_context = mutiLangService.getLang(langKey, langArg);
return lang_context;
return MutiLangUtil.getLang(langKey, langArg);
}
public void setLangKey(String langKey) {

@ -1,13 +1,11 @@
package org.jeecgframework.tag.core.easyui;
import org.jeecgframework.core.util.MutiLangUtil;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagSupport;
import org.jeecgframework.core.util.ApplicationContextUtil;
import org.jeecgframework.web.system.service.MutiLangServiceI;
import org.springframework.beans.factory.annotation.Autowired;
/**
*
*
@ -45,10 +43,7 @@ public class TabTag extends TagSupport {
this.id = id;
}
public void setTitle(String title) {
MutiLangServiceI mutiLangService = ApplicationContextUtil.getContext().getBean(MutiLangServiceI.class);
String lang_context = mutiLangService.getLang(title, langArg);
String lang_context = MutiLangUtil.getLang(title, langArg);
this.title = lang_context;
}

@ -1,18 +1,5 @@
package org.jeecgframework.web.cgform.controller.autolist;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.lang.StringUtils;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.model.json.AjaxJson;
@ -20,15 +7,7 @@ import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.enums.SysThemesEnum;
import org.jeecgframework.core.online.util.FreemarkerHelper;
import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.IpUtil;
import org.jeecgframework.core.util.JeecgDataAutorUtils;
import org.jeecgframework.core.util.MutiLangUtil;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.SqlInjectionUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.SysThemesUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.core.util.*;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.cgform.common.CgAutoListConstant;
import org.jeecgframework.web.cgform.entity.config.CgFormFieldEntity;
@ -42,11 +21,9 @@ import org.jeecgframework.web.cgform.service.template.CgformTemplateServiceI;
import org.jeecgframework.web.cgform.util.PublicUtil;
import org.jeecgframework.web.cgform.util.QueryParamUtil;
import org.jeecgframework.web.cgform.util.TemplateUtil;
import org.jeecgframework.web.system.controller.core.LoginController;
import org.jeecgframework.web.system.pojo.base.DictEntity;
import org.jeecgframework.web.system.pojo.base.TSOperation;
import org.jeecgframework.web.system.pojo.base.TSType;
import org.jeecgframework.web.system.service.MutiLangServiceI;
import org.jeecgframework.web.system.service.SystemService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -55,6 +32,13 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;
/**
*
* @Title:CgAutoListController
@ -78,8 +62,6 @@ public class CgAutoListController extends BaseController{
private CgFormFieldServiceI cgFormFieldService;
@Autowired
private CgformTemplateServiceI cgformTemplateService;
@Autowired
private MutiLangServiceI mutiLangService;
/**
*
* @param id ID
@ -720,7 +702,7 @@ public class CgAutoListController extends BaseController{
DictEntity d = new DictEntity();
d.setTypecode(tsType.getTypecode());
d.setTypename(mutiLangService.getLang(tsType.getTypename()));
d.setTypename(MutiLangUtil.getLang(tsType.getTypename()));
li.add(d);
}

@ -1,22 +1,15 @@
package org.jeecgframework.web.cgform.engine.tag;
import java.io.IOException;
import java.io.Writer;
import java.util.Map;
import org.jeecgframework.core.util.ApplicationContextUtil;
import org.jeecgframework.web.system.service.MutiLangServiceI;
import freemarker.core.Environment;
import freemarker.template.*;
import org.jeecgframework.core.util.MutiLangUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import freemarker.core.Environment;
import freemarker.template.TemplateDirectiveBody;
import freemarker.template.TemplateDirectiveModel;
import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
import freemarker.template.TemplateScalarModel;
import java.io.IOException;
import java.io.Writer;
import java.util.Map;
/**
*
@ -41,9 +34,7 @@ public class MutiLangTag implements TemplateDirectiveModel {
String langArg = getAttribute(params, "langArg");
MutiLangServiceI mutiLangService = ApplicationContextUtil.getContext().getBean(MutiLangServiceI.class);
String lang_context = mutiLangService.getLang(langKey, langArg);
String lang_context = MutiLangUtil.getLang(langKey, langArg);
Writer out = env.getOut();

@ -1,20 +1,7 @@
package org.jeecgframework.web.superquery.controller;
import io.swagger.annotations.ApiParam;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import com.alibaba.fastjson.JSONArray;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.criterion.Restrictions;
import org.jeecgframework.core.beanvalidator.BeanValidators;
@ -24,12 +11,7 @@ import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.ApplicationContextUtil;
import org.jeecgframework.core.util.ExceptionUtil;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.core.util.*;
import org.jeecgframework.jwt.util.ResponseMessage;
import org.jeecgframework.jwt.util.Result;
import org.jeecgframework.poi.excel.ExcelImportUtil;
@ -44,7 +26,6 @@ import org.jeecgframework.web.superquery.entity.SuperQueryTableEntity;
import org.jeecgframework.web.superquery.page.SuperQueryMainPage;
import org.jeecgframework.web.superquery.service.SuperQueryMainServiceI;
import org.jeecgframework.web.superquery.util.SuperQueryUtil;
import org.jeecgframework.web.system.service.MutiLangServiceI;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.web.system.service.UserService;
import org.slf4j.Logger;
@ -54,19 +35,19 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.util.UriComponentsBuilder;
import com.alibaba.fastjson.JSONArray;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import java.io.IOException;
import java.util.*;
import java.util.Map.Entry;
/**
* @Title: Controller
@ -868,12 +849,11 @@ public class SuperQueryMainController extends BaseController {
List<Map<String, Object>> selectType = systemService.findForJdbc(sql,typegroup);
//step.2 根据查询的结果判断是否是国际化语言,是的话转换
List<Map<String, Object>> listMap = new ArrayList<Map<String,Object>>();
MutiLangServiceI mutiLangService = ApplicationContextUtil.getContext().getBean(MutiLangServiceI.class);
if(selectType.size()>0) {
for (Map<String, Object> map : selectType) {
Map<String, Object> mutiMap = new HashMap<String, Object>();
mutiMap.put("typecode", map.get("typecode"));
mutiMap.put("typename", mutiLangService.getLang(map.get("typename").toString()));
mutiMap.put("typename", MutiLangUtil.getLang(map.get("typename").toString()));
listMap.add(mutiMap);
}
json.setObj(listMap);

@ -17,7 +17,6 @@ import org.jeecgframework.core.util.MutiLangUtil;
import org.jeecgframework.web.system.pojo.base.TSFunction;
import org.jeecgframework.web.system.pojo.base.TSIcon;
import org.jeecgframework.web.system.pojo.base.TSOperation;
import org.jeecgframework.web.system.service.MutiLangServiceI;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.web.system.util.IconImageUtil;

@ -1,45 +1,19 @@
package org.jeecgframework.web.system.controller.core;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.annotation.Resource;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.kisso.SSOHelper;
import com.baomidou.kisso.SSOToken;
import com.baomidou.kisso.common.util.HttpUtil;
import net.sf.json.JSONArray;
import org.apache.commons.lang.StringUtils;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.enums.SysThemesEnum;
import org.jeecgframework.core.online.util.FreemarkerHelper;
import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.IpUtil;
import org.jeecgframework.core.util.JSONHelper;
import org.jeecgframework.core.util.ListtoMenu;
import org.jeecgframework.core.util.LogUtil;
import org.jeecgframework.core.util.MutiLangUtil;
import org.jeecgframework.core.util.PasswordUtil;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.SysThemesUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.core.util.*;
import org.jeecgframework.web.system.manager.ClientManager;
import org.jeecgframework.web.system.pojo.base.Client;
import org.jeecgframework.web.system.pojo.base.TSFunction;
import org.jeecgframework.web.system.pojo.base.TSPasswordResetkey;
import org.jeecgframework.web.system.pojo.base.TSRole;
import org.jeecgframework.web.system.pojo.base.TSRoleUser;
import org.jeecgframework.web.system.pojo.base.TSUser;
import org.jeecgframework.web.system.service.MutiLangServiceI;
import org.jeecgframework.web.system.pojo.base.*;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.web.system.service.UserService;
import org.jeecgframework.web.system.sms.util.MailUtil;
@ -54,10 +28,13 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.kisso.SSOHelper;
import com.baomidou.kisso.SSOToken;
import com.baomidou.kisso.common.util.HttpUtil;
import javax.annotation.Resource;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.*;
@ -75,9 +52,6 @@ public class LoginController extends BaseController{
@Resource
private ClientManager clientManager;
@Autowired
private MutiLangServiceI mutiLangService;
@Autowired
public void setSystemService(SystemService systemService) {
this.systemService = systemService;
@ -115,16 +89,16 @@ public class LoginController extends BaseController{
//验证码
String randCode = req.getParameter("randCode");
if (StringUtils.isEmpty(randCode)) {
j.setMsg(mutiLangService.getLang("common.enter.verifycode"));
j.setMsg(MutiLangUtil.getLang("common.enter.verifycode"));
j.setSuccess(false);
} else if (!randCode.equalsIgnoreCase(String.valueOf(session.getAttribute("randCode")))) {
j.setMsg(mutiLangService.getLang("common.verifycode.error"));
j.setMsg(MutiLangUtil.getLang("common.verifycode.error"));
log.info("Username:{} ,验证码: {} 错误!", user.getUserName(), randCode);
j.setSuccess(false);
//IP黑名单 check
} else if (userService.isInBlackList(IpUtil.getIpAddr(req))){
log.info("Username:{} ,IP: {} 进入黑名单!", user.getUserName(), IpUtil.getIpAddr(req));
j.setMsg(mutiLangService.getLang("common.blacklist.error"));
j.setMsg(MutiLangUtil.getLang("common.blacklist.error"));
j.setSuccess(false);
}
else {
@ -135,7 +109,7 @@ public class LoginController extends BaseController{
if(u == null || !u.getPassword().equals(PasswordUtil.encrypt(u.getUserName(),user.getPassword(), PasswordUtil.getStaticSalt()))){
j.setMsg(mutiLangService.getLang("common.username.or.password.error"));
j.setMsg(MutiLangUtil.getLang("common.username.or.password.error"));
j.setSuccess(false);
return j;
}
@ -143,13 +117,13 @@ public class LoginController extends BaseController{
if (u != null && u.getStatus() != 0) {
if(u.getDeleteFlag()==1){
j.setMsg(mutiLangService.getLang("common.username.or.password.error"));
j.setMsg(MutiLangUtil.getLang("common.username.or.password.error"));
j.setSuccess(false);
return j;
}
if("2".equals(u.getUserType())){
j.setMsg(mutiLangService.getLang("common.user.interfaceUser"));
j.setMsg(MutiLangUtil.getLang("common.user.interfaceUser"));
j.setSuccess(false);
return j;
}
@ -176,7 +150,7 @@ public class LoginController extends BaseController{
}
} else {
//用户锁定提醒
j.setMsg(mutiLangService.getLang("common.lock.user"));
j.setMsg(MutiLangUtil.getLang("common.lock.user"));
j.setSuccess(false);
}
}

@ -1,8 +1,5 @@
package org.jeecgframework.web.system.controller.core;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
@ -23,13 +20,16 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @Title: Controller
* @Description:
* @author Rocky
* @date 2014-06-28 00:09:31
* @version V1.0
*
*
*/
//@Scope("prototype")
@Controller
@ -118,7 +118,7 @@ public class MutiLangController extends BaseController {
if(MutiLangUtil.existLangKey( mutiLang.getLangKey(),mutiLang.getLangCode()))
{
message = mutiLangService.getLang("common.langkey.exist");
message = MutiLangUtil.getLang("common.langkey.exist");
}
if(StringUtil.isEmpty(message))
@ -163,9 +163,9 @@ public class MutiLangController extends BaseController {
try {
mutiLangService.refleshMutiLangCach();
cacheService.clean();
message = mutiLangService.getLang("common.refresh.success");
message = MutiLangUtil.getLang("common.refresh.success");
} catch (Exception e) {
message = mutiLangService.getLang("common.refresh.fail");
message = MutiLangUtil.getLang("common.refresh.fail");
}
j.setMsg(message);
return j;

@ -1,29 +1,7 @@
package org.jeecgframework.web.system.controller.core;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.SocketException;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;
@ -31,29 +9,14 @@ import org.apache.log4j.Logger;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.dao.jdbc.JdbcDao;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.ComboTree;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.common.model.json.TreeGrid;
import org.jeecgframework.core.common.model.json.ValidForm;
import org.jeecgframework.core.common.model.json.*;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.enums.StoreUploadFilePathEnum;
import org.jeecgframework.core.extend.hqlsearch.parse.ObjectParseUtil;
import org.jeecgframework.core.extend.hqlsearch.parse.PageValueConvertRuleEnum;
import org.jeecgframework.core.extend.hqlsearch.parse.vo.HqlRuleEnum;
import org.jeecgframework.core.extend.swftools.SwfToolsUtil;
import org.jeecgframework.core.util.FileUtils;
import org.jeecgframework.core.util.JSONHelper;
import org.jeecgframework.core.util.ListUtils;
import org.jeecgframework.core.util.MutiLangSqlCriteriaUtil;
import org.jeecgframework.core.util.MutiLangUtil;
import org.jeecgframework.core.util.PropertiesUtil;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.SetListSort;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.UrlCheckUtil;
import org.jeecgframework.core.util.YouBianCodeUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.core.util.*;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.tag.vo.datatable.SortDirection;
import org.jeecgframework.tag.vo.easyui.ComboTreeModel;
@ -61,17 +24,7 @@ import org.jeecgframework.tag.vo.easyui.TreeGridModel;
import org.jeecgframework.web.cgform.exception.BusinessException;
import org.jeecgframework.web.system.manager.ClientManager;
import org.jeecgframework.web.system.manager.ClientSort;
import org.jeecgframework.web.system.pojo.base.Client;
import org.jeecgframework.web.system.pojo.base.DataLogDiff;
import org.jeecgframework.web.system.pojo.base.DictEntity;
import org.jeecgframework.web.system.pojo.base.TSDatalogEntity;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.pojo.base.TSFunction;
import org.jeecgframework.web.system.pojo.base.TSRole;
import org.jeecgframework.web.system.pojo.base.TSRoleFunction;
import org.jeecgframework.web.system.pojo.base.TSType;
import org.jeecgframework.web.system.pojo.base.TSTypegroup;
import org.jeecgframework.web.system.service.MutiLangServiceI;
import org.jeecgframework.web.system.pojo.base.*;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.web.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
@ -87,8 +40,15 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.SocketException;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
*
@ -101,7 +61,6 @@ public class SystemController extends BaseController {
private static final Logger logger = Logger.getLogger(SystemController.class);
private UserService userService;
private SystemService systemService;
private MutiLangServiceI mutiLangService;
@Resource
private ClientManager clientManager;
@ -111,10 +70,6 @@ public class SystemController extends BaseController {
this.systemService = systemService;
}
@Autowired
public void setMutiLangService(MutiLangServiceI mutiLangService) {
this.mutiLangService = mutiLangService;
}
public UserService getUserService() {
return userService;
@ -401,7 +356,7 @@ public class SystemController extends BaseController {
// private void assembleConditionForMutilLang(CriteriaQuery cq, String typegroupname, List<String> typegroupnameKeyList) {
// Map<String,String> typegroupnameMap = new HashMap<String, String>();
// for (String nameKey : typegroupnameKeyList) {
// String name = mutiLangService.getLang(nameKey);
// String name = MutiLangUtil.getLang(nameKey);
// typegroupnameMap.put(nameKey, name);
// }
// List<String> tepegroupnameParamList = new ArrayList<String>();
@ -445,11 +400,11 @@ public class SystemController extends BaseController {
AjaxJson j = new AjaxJson();
if (id.startsWith("G")) {//分组
TSTypegroup typegroup = systemService.getEntity(TSTypegroup.class, id.substring(1));
message = "数据字典分组: " + mutiLangService.getLang(typegroup.getTypegroupname()) + "被删除 成功";
message = "数据字典分组: " + MutiLangUtil.getLang(typegroup.getTypegroupname()) + "被删除 成功";
systemService.delete(typegroup);
} else {
TSType type = systemService.getEntity(TSType.class, id.substring(1));
message = "数据字典类型: " + mutiLangService.getLang(type.getTypename()) + "被删除 成功";
message = "数据字典类型: " + MutiLangUtil.getLang(type.getTypename()) + "被删除 成功";
systemService.delete(type);
}
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
@ -471,14 +426,14 @@ public class SystemController extends BaseController {
AjaxJson j = new AjaxJson();
typegroup = systemService.getEntity(TSTypegroup.class, typegroup.getId());
message = "类型分组: " + mutiLangService.getLang(typegroup.getTypegroupname()) + " 被删除 成功";
message = "类型分组: " + MutiLangUtil.getLang(typegroup.getTypegroupname()) + " 被删除 成功";
if (ListUtils.isNullOrEmpty(typegroup.getTSTypes())) {
systemService.delete(typegroup);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
//刷新缓存
systemService.refleshTypeGroupCach();
} else {
message = "类型分组: " + mutiLangService.getLang(typegroup.getTypegroupname()) + " 下有类型信息,不能删除!";
message = "类型分组: " + MutiLangUtil.getLang(typegroup.getTypegroupname()) + " 下有类型信息,不能删除!";
}
j.setMsg(message);
@ -496,7 +451,7 @@ public class SystemController extends BaseController {
String message = null;
AjaxJson j = new AjaxJson();
type = systemService.getEntity(TSType.class, type.getId());
message = "类型: " + mutiLangService.getLang(type.getTypename()) + "被删除 成功";
message = "类型: " + MutiLangUtil.getLang(type.getTypename()) + "被删除 成功";
systemService.delete(type);
//刷新缓存
systemService.refleshTypesCach(type);
@ -539,9 +494,9 @@ public class SystemController extends BaseController {
AjaxJson j = new AjaxJson();
try{
systemService.refreshTypeGroupAndTypes();
message = mutiLangService.getLang("common.refresh.success");
message = MutiLangUtil.getLang("common.refresh.success");
} catch (Exception e) {
message = mutiLangService.getLang("common.refresh.fail");
message = MutiLangUtil.getLang("common.refresh.fail");
}
j.setMsg(message);
return j;
@ -560,11 +515,11 @@ public class SystemController extends BaseController {
String message = null;
AjaxJson j = new AjaxJson();
if (StringUtil.isNotEmpty(typegroup.getId())) {
message = "类型分组: " + mutiLangService.getLang(typegroup.getTypegroupname()) + "被更新成功";
message = "类型分组: " + MutiLangUtil.getLang(typegroup.getTypegroupname()) + "被更新成功";
userService.saveOrUpdate(typegroup);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} else {
message = "类型分组: " + mutiLangService.getLang(typegroup.getTypegroupname()) + "被添加成功";
message = "类型分组: " + MutiLangUtil.getLang(typegroup.getTypegroupname()) + "被添加成功";
userService.save(typegroup);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}
@ -613,11 +568,11 @@ public class SystemController extends BaseController {
String message = null;
AjaxJson j = new AjaxJson();
if (StringUtil.isNotEmpty(type.getId())) {
message = "类型: " + mutiLangService.getLang(type.getTypename()) + "被更新成功";
message = "类型: " + MutiLangUtil.getLang(type.getTypename()) + "被更新成功";
userService.saveOrUpdate(type);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} else {
message = "类型: " + mutiLangService.getLang(type.getTypename()) + "被添加成功";
message = "类型: " + MutiLangUtil.getLang(type.getTypename()) + "被添加成功";
userService.save(type);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}
@ -657,7 +612,7 @@ public class SystemController extends BaseController {
req.setAttribute("typegroup", typegroup);
req.setAttribute("typegroupname", mutiLangService.getLang(typegroupname));
req.setAttribute("typegroupname", MutiLangUtil.getLang(typegroupname));
if (StringUtil.isNotEmpty(type.getId())) {
type = systemService.getEntity(TSType.class, type.getId());
req.setAttribute("type", type);

@ -6,10 +6,7 @@ public interface MutiLangServiceI{
public void initAllMutiLang();
public String getLang(String lang_key);
public String getLang(String lang_key, String args);
public void refleshMutiLangCach();
/**

@ -7,6 +7,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.jeecgframework.core.common.dao.ICommonDao;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.jeecgframework.core.util.BrowserUtils;
import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.ResourceUtil;
@ -22,17 +23,13 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service("mutiLangService")
public class MutiLangServiceImpl implements MutiLangServiceI {
public class MutiLangServiceImpl extends CommonServiceImpl implements MutiLangServiceI {
private static final Logger logger = LoggerFactory.getLogger(MutiLangServiceImpl.class);
@Autowired
public ICommonDao commonDao;
@Autowired
private CacheServiceI cacheService;
/**初始化语言信息TOMCAT启动时直接加入到内存中**/
@Transactional(readOnly = true)
public void initAllMutiLang() {
Map<String, String> ls = new HashMap<String, String>();
List<MutiLangEntity> mutiLang = this.commonDao.loadAll(MutiLangEntity.class);
@ -75,50 +72,6 @@ public class MutiLangServiceImpl implements MutiLangServiceI {
}
/**取 o_muti_lang.lang_key 的值返回当前语言的值**/
public String getLang(String langKey)
{
//如果为空返回空串防止返回null
if(langKey==null){
return "";
}
HttpServletRequest request = ContextHolderUtils.getRequest();
String language = oConvertUtils.getString(request.getSession().getAttribute("lang"));
if(oConvertUtils.isEmpty(language)){
language = BrowserUtils.getBrowserLanguage(request);
}
String langContext = ResourceUtil.getMutiLan(langKey + "_" + language);
if(StringUtil.isEmpty(langContext))
{
langContext = ResourceUtil.getMutiLan("common.notfind.langkey" + "_" + language);
if("null".equals(langContext)||langContext==null ||langKey.startsWith("?")){
langContext = "";
}
langContext = langContext + langKey;
}
return langContext;
}
public String getLang(String lanKey, String langArg) {
String langContext = "";
if(StringUtil.isEmpty(langArg))
{
langContext = getLang(lanKey);
} else
{
String[] argArray = langArg.split(",");
langContext = getLang(lanKey);
for(int i=0; i< argArray.length; i++)
{
String langKeyArg = argArray[i].trim();
String langKeyContext = getLang(langKeyArg);
langContext = StringUtil.replace(langContext, "{" + i + "}", langKeyContext);
}
}
return langContext;
}
/** 刷新多语言cach **/
public void refleshMutiLangCach() {

@ -20,14 +20,7 @@ import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.BrowserUtils;
import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.DateUtils;
import org.jeecgframework.core.util.IpUtil;
import org.jeecgframework.core.util.NumberComparator;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.core.util.*;
import org.jeecgframework.web.system.manager.ClientManager;
import org.jeecgframework.web.system.pojo.base.Client;
import org.jeecgframework.web.system.pojo.base.TSDepart;
@ -37,7 +30,6 @@ import org.jeecgframework.web.system.pojo.base.TSRole;
import org.jeecgframework.web.system.pojo.base.TSRoleUser;
import org.jeecgframework.web.system.pojo.base.TSUser;
import org.jeecgframework.web.system.pojo.base.TSUserOrg;
import org.jeecgframework.web.system.service.MutiLangServiceI;
import org.jeecgframework.web.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -51,8 +43,6 @@ import org.springframework.transaction.annotation.Transactional;
@Service("userService")
public class UserServiceImpl extends CommonServiceImpl implements UserService {
private Logger log = Logger.getLogger(UserServiceImpl.class);
@Autowired
private MutiLangServiceI mutiLangService;
@Resource
private ClientManager clientManager;
@ -290,7 +280,7 @@ public class UserServiceImpl extends CommonServiceImpl implements UserService {
HttpSession session = ContextHolderUtils.getSession();
user.setDepartid(orgId);
session.setAttribute(ResourceUtil.LOCAL_CLINET_USER, user);
message = mutiLangService.getLang("common.user") + ": " + user.getUserName() + "["+ currentDepart.getDepartname() + "]" + mutiLangService.getLang("common.login.success");
message = MutiLangUtil.getLang("common.user") + ": " + user.getUserName() + "["+ currentDepart.getDepartname() + "]" + MutiLangUtil.getLang("common.login.success");
//IE列表操作按钮的样式
String browserType = "";
@ -345,7 +335,7 @@ public class UserServiceImpl extends CommonServiceImpl implements UserService {
for (TSFunction function : primaryMenu) {
if (function.getFunctionLevel() == 0) {
String lang_key = function.getFunctionName();
String lang_context = mutiLangService.getLang(lang_key);
String lang_context = MutiLangUtil.getLang(lang_key);
lang_context = lang_context.trim();
if ("业务申请".equals(lang_context)) {
@ -420,7 +410,7 @@ public class UserServiceImpl extends CommonServiceImpl implements UserService {
if (function.getFunctionLevel() == 1) {
String lang_key = function.getFunctionName();
String lang_context = mutiLangService.getLang(lang_key);
String lang_context = MutiLangUtil.getLang(lang_key);
if ("申请".equals(lang_key)) {
lang_context = "申请";
String s = "";

Loading…
Cancel
Save