|
|
|
@ -5,10 +5,8 @@ import okhttp3.OkHttpClient;
|
|
|
|
|
import okhttp3.Request;
|
|
|
|
|
import okhttp3.Response;
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
import weaver.general.BaseBean;
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
import weaver.general.*;
|
|
|
|
|
import weaver.hrm.User;
|
|
|
|
|
import weaver.general.GCONST;
|
|
|
|
|
import weaver.interfaces.dito.comInfo.PropBean;
|
|
|
|
|
import weaver.login.VerifyLogin;
|
|
|
|
|
import javax.servlet.http.Cookie;
|
|
|
|
@ -132,8 +130,13 @@ public class HttpRequestUtil extends BaseBean{
|
|
|
|
|
*/
|
|
|
|
|
public void userSessionFilter(HttpServletRequest request, HttpServletResponse response, ServletContext application,String staffCode,String uid){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BaseBean bb = new BaseBean();
|
|
|
|
|
initLicenseInfo();
|
|
|
|
|
|
|
|
|
|
String path = PropBean.getUfPropValue("ecologypath");
|
|
|
|
|
boolean isMutiLangua = Util.isEnableMultiLang();
|
|
|
|
|
bb.writeLog("isMutiLangua:"+isMutiLangua);
|
|
|
|
|
//系统使用语言,未使用多语言的用户默认为中文。
|
|
|
|
|
int isLanguId = 8;
|
|
|
|
|
String languId = "8";
|
|
|
|
@ -143,10 +146,13 @@ public class HttpRequestUtil extends BaseBean{
|
|
|
|
|
if (isLanguId == 0) {
|
|
|
|
|
isLanguId = 8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
languId = String.valueOf(isLanguId);
|
|
|
|
|
bb.writeLog("languId:"+languId);
|
|
|
|
|
|
|
|
|
|
Cookie syslanid = new Cookie("Systemlanguid", languId);
|
|
|
|
|
syslanid.setMaxAge(-1);
|
|
|
|
|
syslanid.setPath(path);
|
|
|
|
|
syslanid.setPath("/");
|
|
|
|
|
response.addCookie(syslanid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -180,6 +186,7 @@ public class HttpRequestUtil extends BaseBean{
|
|
|
|
|
newUser.setSex(rs.getString("sex"));
|
|
|
|
|
newUser.setPwd(rs.getString("password"));
|
|
|
|
|
String languageIdWeaver = rs.getString("systemlanguage");
|
|
|
|
|
bb.writeLog("languageIdWeaver:"+languageIdWeaver);
|
|
|
|
|
newUser.setLanguage(Util.getIntValue(languageIdWeaver, 8));
|
|
|
|
|
if (!languId.equalsIgnoreCase(languageIdWeaver) && isMutiLangua) {
|
|
|
|
|
User.setUserLang(rs.getInt("id"), Util.getIntValue(languId, 8));
|
|
|
|
@ -214,7 +221,7 @@ public class HttpRequestUtil extends BaseBean{
|
|
|
|
|
newUser.setLastlogindate(rs.getString("currentdate"));
|
|
|
|
|
newUser.setLogintype("1");
|
|
|
|
|
newUser.setAccount(rs.getString("account"));
|
|
|
|
|
newUser.setLoginip(request.getRemoteAddr());
|
|
|
|
|
newUser.setLoginip(Util.getIpAddr(request));
|
|
|
|
|
String weaverLoginType = Util.null2String(request.getSession(true).getAttribute("weaver_login_type"));
|
|
|
|
|
if("".equals(weaverLoginType)){
|
|
|
|
|
weaverLoginType = "1";
|
|
|
|
@ -244,9 +251,28 @@ public class HttpRequestUtil extends BaseBean{
|
|
|
|
|
List accounts = verifyLogin.getAccountsById(newUser.getUID());
|
|
|
|
|
request.getSession(true).setAttribute("accounts", accounts);
|
|
|
|
|
}
|
|
|
|
|
Util.setCookie(response, "loginidweaver", newUser.getUID()+"", -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map logmessages = (Map) application.getAttribute("logmessages");
|
|
|
|
|
if (logmessages == null) {
|
|
|
|
|
logmessages = new WHashMap();
|
|
|
|
|
logmessages.put(newUser.getUID(), "");
|
|
|
|
|
application.setAttribute("logmessages", logmessages);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String loginuuids = newUser.getUID() + "";
|
|
|
|
|
rs.executeQuery("select id from hrmresource where status in(0,1,2,3) and belongto = ? ", newUser.getUID());
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
if (loginuuids.length() > 0){
|
|
|
|
|
loginuuids = loginuuids + ",";
|
|
|
|
|
}
|
|
|
|
|
loginuuids = loginuuids + rs.getInt("id");
|
|
|
|
|
}
|
|
|
|
|
Cookie ckloginuuids = new Cookie("loginuuids", loginuuids);
|
|
|
|
|
ckloginuuids.setMaxAge(-1);
|
|
|
|
|
ckloginuuids.setPath("/");
|
|
|
|
|
response.addCookie(ckloginuuids);
|
|
|
|
|
|
|
|
|
|
Map userSessions = (Map) application.getAttribute("userSessions");
|
|
|
|
|
String uId = String.valueOf(newUser.getUID());
|
|
|
|
|
if (userSessions == null) {
|
|
|
|
@ -265,4 +291,45 @@ public class HttpRequestUtil extends BaseBean{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void initLicenseInfo(){
|
|
|
|
|
BaseBean bb = new BaseBean();
|
|
|
|
|
try{
|
|
|
|
|
StaticObj staticobj = StaticObj.getInstance();
|
|
|
|
|
String software = (String) staticobj.getObject("software");
|
|
|
|
|
bb.writeLog("software:"+software);
|
|
|
|
|
String portal = "n";
|
|
|
|
|
String multilanguage = "n";
|
|
|
|
|
if (software == null) {
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
rs.executeQuery("select * from license");
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
software = rs.getString("software");
|
|
|
|
|
bb.writeLog("software2:"+software);
|
|
|
|
|
if (software.equals("")) {
|
|
|
|
|
software = "ALL";
|
|
|
|
|
}
|
|
|
|
|
staticobj.putObject("software", software);
|
|
|
|
|
portal = rs.getString("portal");
|
|
|
|
|
bb.writeLog("portal:"+portal);
|
|
|
|
|
if (portal.equals("")) {
|
|
|
|
|
portal = "n";
|
|
|
|
|
}
|
|
|
|
|
staticobj.putObject("portal", portal);
|
|
|
|
|
multilanguage = rs.getString("multilanguage");
|
|
|
|
|
bb.writeLog("multilanguage:"+multilanguage);
|
|
|
|
|
if (multilanguage.equals("")) {
|
|
|
|
|
multilanguage = "n";
|
|
|
|
|
}
|
|
|
|
|
staticobj.putObject("multilanguage", multilanguage);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|