Commit 089a82bc by s_guodong

优化

parent 9a48b71f
...@@ -4,7 +4,7 @@ import java.util.*; ...@@ -4,7 +4,7 @@ import java.util.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.brilliance.mda.runtime.mda.*; import com.brilliance.mda.runtime.mda.*;
import com.brilliance.mda.runtime.mda.impl.*; import com.brilliance.mda.runtime.mda.impl.*;
import com.brilliance.mda.runtime.annotation.*; import com.brilliance.mda.support.mybatis.*;
import com.brilliance.mda.runtime.mda.driver.*; import com.brilliance.mda.runtime.mda.driver.*;
import static com.brilliance.mda.runtime.mda.Constants.*; import static com.brilliance.mda.runtime.mda.Constants.*;
import com.brilliance.mda.runtime.mda.util.*; import com.brilliance.mda.runtime.mda.util.*;
...@@ -1709,6 +1709,8 @@ public class Platform ...@@ -1709,6 +1709,8 @@ public class Platform
if(db!=null) if(db!=null)
{ {
ctx.storeData("LastDB."+Platform.getModuleRoot(),db); ctx.storeData("LastDB."+Platform.getModuleRoot(),db);
DynamicDataSourceContextHolder.setDataSourceType(db);
} }
} }
...@@ -1928,7 +1930,8 @@ public class Platform ...@@ -1928,7 +1930,8 @@ public class Platform
if(db!=null) if(db!=null)
{ {
ctx.storeData("DefaultDB."+Platform.getModuleRoot(),db); ctx.storeData("DefaultDB."+Platform.getModuleRoot(),db);
log.debug("{}","DefaultDB change to "+db); DynamicDataSourceContextHolder.setDataSourceType(db);
log.debug("{}","DefaultDB change to "+db);
} }
} }
......
...@@ -11,7 +11,6 @@ import com.brilliance.mda.runtime.mda.impl.AbstractModule; ...@@ -11,7 +11,6 @@ import com.brilliance.mda.runtime.mda.impl.AbstractModule;
import com.brilliance.mda.runtime.mda.impl.Argument; import com.brilliance.mda.runtime.mda.impl.Argument;
import com.brilliance.mda.runtime.mda.impl.StreamImpl; import com.brilliance.mda.runtime.mda.impl.StreamImpl;
import com.brilliance.mda.runtime.mda.util.MdaUtils; import com.brilliance.mda.runtime.mda.util.MdaUtils;
import com.brilliance.mda.support.mybatis.DynamicDataSourceContextHolder;
import com.ceb.gjjs.mda.bo.Chn; import com.ceb.gjjs.mda.bo.Chn;
import com.ceb.gjjs.mda.bo.Wanrec; import com.ceb.gjjs.mda.bo.Wanrec;
import com.ceb.gjjs.mda.global.Platform; import com.ceb.gjjs.mda.global.Platform;
...@@ -832,13 +831,11 @@ public class Rcvp extends AbstractModule{ ...@@ -832,13 +831,11 @@ public class Rcvp extends AbstractModule{
//20190827新增电子信用证查询语句 //20190827新增电子信用证查询语句
else if("exl".equals(this.getMsgtyp())) else if("exl".equals(this.getMsgtyp()))
{ {
DynamicDataSourceContextHolder.setDataSourceType("datasource2");
// sql = " WHERE m1.inr=m2.inr AND m1.dir='>' AND m1.pntinr IS NULL AND m2.subtyp<>'990' and m2.subtyp<>'900'"; // sql = " WHERE m1.inr=m2.inr AND m1.dir='>' AND m1.pntinr IS NULL AND m2.subtyp<>'990' and m2.subtyp<>'900'";
sql = " WHERE m1.inr=m2.inr AND m1.dir='>' AND m1.pntinr IS NULL AND m2.subtyp<>'990'"; sql = " WHERE m1.inr=m2.inr AND m1.dir='>' AND m1.pntinr IS NULL AND m2.subtyp<>'990'";
} }
else else
{ {
DynamicDataSourceContextHolder.setDataSourceType("datasource1");
//sql = " WHERE m1.inr=m2.inr AND m1.dir='>' AND m1.pntinr IS NULL AND m2.subtyp<>'601' AND m2.subtyp<>'900' "; //sql = " WHERE m1.inr=m2.inr AND m1.dir='>' AND m1.pntinr IS NULL AND m2.subtyp<>'601' AND m2.subtyp<>'900' ";
sql = " WHERE m1.inr=m2.inr AND m1.dir='>' AND m1.pntinr IS NULL AND m2.subtyp<>'NCK' AND m2.subtyp<>'ACK' AND m2.subtyp<>'010' AND m2.subtyp<>'020' "; sql = " WHERE m1.inr=m2.inr AND m1.dir='>' AND m1.pntinr IS NULL AND m2.subtyp<>'NCK' AND m2.subtyp<>'ACK' AND m2.subtyp<>'010' AND m2.subtyp<>'020' ";
} }
...@@ -1794,7 +1791,6 @@ public class Rcvp extends AbstractModule{ ...@@ -1794,7 +1791,6 @@ public class Rcvp extends AbstractModule{
MdaUtils.clear(this.getSmpmod().getMps()); MdaUtils.clear(this.getSmpmod().getMps());
MdaUtils.clear(this.getSmpmod().getMpi()); MdaUtils.clear(this.getSmpmod().getMpi());
MdaUtils.clear(this.getSmpmod().getSmh()); MdaUtils.clear(this.getSmpmod().getSmh());
/* int errorcode = Platform.errorCode(); /* int errorcode = Platform.errorCode();
if(errorcode != NO_ERROR) if(errorcode != NO_ERROR)
{ {
......
...@@ -3,14 +3,11 @@ package com.ceb.gjjs.mda.web; ...@@ -3,14 +3,11 @@ package com.ceb.gjjs.mda.web;
import com.brilliance.mda.runtime.mda.IAuthInfo; import com.brilliance.mda.runtime.mda.IAuthInfo;
import com.brilliance.mda.runtime.mda.IContext; import com.brilliance.mda.runtime.mda.IContext;
import com.brilliance.mda.runtime.mda.driver.MdaEnv; import com.brilliance.mda.runtime.mda.driver.MdaEnv;
import com.brilliance.mda.runtime.mda.util.Datas;
import com.brilliance.mda.runtime.mda.util.Systems; import com.brilliance.mda.runtime.mda.util.Systems;
import com.brilliance.mda.runtime.request.BaseVO; import com.brilliance.mda.runtime.request.BaseVO;
import com.brilliance.mda.support.cache.ICache; import com.brilliance.mda.support.cache.ICache;
import com.brilliance.mda.support.mybatis.DynamicDataSourceContextHolder;
import com.brilliance.mda.support.td.TDAuthInfo; import com.brilliance.mda.support.td.TDAuthInfo;
import com.ceb.gjjs.mda.bo.Etg;
import com.ceb.gjjs.mda.bo.Ety;
import com.ceb.gjjs.mda.bo.Usr;
import com.ceb.gjjs.mda.dao.EtgMapper; import com.ceb.gjjs.mda.dao.EtgMapper;
import com.ceb.gjjs.mda.dao.EtyMapper; import com.ceb.gjjs.mda.dao.EtyMapper;
import com.ceb.gjjs.mda.dao.UsrMapper; import com.ceb.gjjs.mda.dao.UsrMapper;
...@@ -24,9 +21,6 @@ import javax.servlet.http.HttpServletRequest; ...@@ -24,9 +21,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.brilliance.mda.runtime.mda.Constants.tdContextLASTUSERACTIONTIME; import static com.brilliance.mda.runtime.mda.Constants.tdContextLASTUSERACTIONTIME;
...@@ -50,25 +44,25 @@ public class AuthInterceptor implements HandlerInterceptor { ...@@ -50,25 +44,25 @@ public class AuthInterceptor implements HandlerInterceptor {
private ICache<String, IAuthInfo> authInfoICache; private ICache<String, IAuthInfo> authInfoICache;
//简单生成Token Key //简单生成Token Key
private String getTokenKey(HttpServletRequest request){ private String getTokenKey(HttpServletRequest request) {
String logName = request.getHeader("token"); String logName = request.getHeader("token");
if(logName == null || "undefined".equals(logName)) if (logName == null || "undefined".equals(logName))
logName = "sun123"; logName = "sun123";
//现在仅仅以userId这个来实现 //现在仅仅以userId这个来实现
return logName; return logName;
} }
private IAuthInfo getOrCreateAuthInfo(String tokenKey,String userId){ private IAuthInfo getOrCreateAuthInfo(String tokenKey, String userId) {
IAuthInfo authInfo = authInfoICache.get(tokenKey); IAuthInfo authInfo = authInfoICache.get(tokenKey);
if (authInfo == null) { if (authInfo == null) {
synchronized (authInfoICache) { synchronized (authInfoICache) {
authInfo = authInfoICache.get(tokenKey); authInfo = authInfoICache.get(tokenKey);
if(authInfo == null){ if (authInfo == null) {
TDAuthInfo tdAuthInfo = new TDAuthInfo(userId); TDAuthInfo tdAuthInfo = new TDAuthInfo(userId);
authInfo = tdAuthInfo; authInfo = tdAuthInfo;
authInfoICache.store(tokenKey,authInfo); authInfoICache.store(tokenKey, authInfo);
//构造authInfo,本该在登录里面做 //构造authInfo,本该在登录里面做
// initAuthInfo(userId,authInfo); // initAuthInfo(userId,authInfo);
} }
} }
} }
...@@ -76,7 +70,7 @@ public class AuthInterceptor implements HandlerInterceptor { ...@@ -76,7 +70,7 @@ public class AuthInterceptor implements HandlerInterceptor {
return authInfo; return authInfo;
} }
private void initAuthInfo(String logName,IAuthInfo authInfo){ private void initAuthInfo(String logName, IAuthInfo authInfo) {
// Map<String,Object> argsMap = new HashMap<>(); // Map<String,Object> argsMap = new HashMap<>();
// argsMap.put("sql","select * from usr where extkey='"+logName+"'"); // argsMap.put("sql","select * from usr where extkey='"+logName+"'");
// List<Usr> usrList = usrMapper.dyncRead(argsMap); // List<Usr> usrList = usrMapper.dyncRead(argsMap);
...@@ -104,14 +98,14 @@ public class AuthInterceptor implements HandlerInterceptor { ...@@ -104,14 +98,14 @@ public class AuthInterceptor implements HandlerInterceptor {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String logName = request.getHeader("userId"); String logName = request.getHeader("userId");
if(logName == null || "undefined".equals(logName)) if (logName == null || "undefined".equals(logName))
logName = "sun123"; logName = "sun123";
String token = getTokenKey(request); String token = getTokenKey(request);
//目前采用自动登录模式认证 //目前采用自动登录模式认证
getOrCreateAuthInfo(token,logName); getOrCreateAuthInfo(token, logName);
//设置一些系统参数 //设置一些系统参数
String actionTime = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()); String actionTime = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
Systems.setContext(tdContextLASTUSERACTIONTIME,actionTime); Systems.setContext(tdContextLASTUSERACTIONTIME, actionTime);
return true; return true;
} }
...@@ -139,5 +133,8 @@ public class AuthInterceptor implements HandlerInterceptor { ...@@ -139,5 +133,8 @@ public class AuthInterceptor implements HandlerInterceptor {
MdaEnv.removeAttrs(); MdaEnv.removeAttrs();
MdaEnv.clearContext(); MdaEnv.clearContext();
MdaEnv.removeGridData(); MdaEnv.removeGridData();
// 资源释放
DynamicDataSourceContextHolder.clearDataSourceType();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment