Commit 4a9d88d8 by WeiCong

增加bd提前退出交易机制

parent 60001fbe
...@@ -5,7 +5,7 @@ public class ExitTransactionException extends RuntimeException { ...@@ -5,7 +5,7 @@ public class ExitTransactionException extends RuntimeException {
private String errorCode; private String errorCode;
public ExitTransactionException(String message, String errorCode) { public ExitTransactionException(String errorCode,String message) {
super(message); super(message);
this.errorCode = errorCode; this.errorCode = errorCode;
} }
......
...@@ -9,6 +9,7 @@ import org.sss.common.impl.AbstractNullPresentation; ...@@ -9,6 +9,7 @@ import org.sss.common.impl.AbstractNullPresentation;
import org.sss.common.impl.ProxyDatafield; import org.sss.common.impl.ProxyDatafield;
import org.sss.common.model.*; import org.sss.common.model.*;
import org.sss.exception.ContainerException; import org.sss.exception.ContainerException;
import org.sss.presentation.noui.api.exception.ExitTransactionException;
import org.sss.presentation.noui.api.request.NoUiRequest; import org.sss.presentation.noui.api.request.NoUiRequest;
import org.sss.presentation.noui.api.response.ErrorCodes; import org.sss.presentation.noui.api.response.ErrorCodes;
import org.sss.presentation.noui.common.Constants; import org.sss.presentation.noui.common.Constants;
...@@ -44,20 +45,28 @@ public class NoUiPresentation extends AbstractNullPresentation { ...@@ -44,20 +45,28 @@ public class NoUiPresentation extends AbstractNullPresentation {
// ArrayList<IAttribute<?>>(); // ArrayList<IAttribute<?>>();
// public final List<IAttribute<?>> codeValuesList = new // public final List<IAttribute<?>> codeValuesList = new
// ArrayList<IAttribute<?>>(); // ArrayList<IAttribute<?>>();
public IPanel popupPanel = null;
public String transactionName = null;
public boolean clearFlag = false;
public boolean newTabFlag = false;
public Boolean logoutFlag = null;
private Map<String, Object> codetable = new HashMap<>(); private Map<String, Object> codetable = new HashMap<>();
private NoUiRequest noUiRequest; private NoUiRequest noUiRequest;
private Map<String, Object> error = new HashMap<>(); private Map<String, Object> error = new HashMap<>();
private Map<String, Object> modifyMap = new HashMap<>(); private Map<String, Object> modifyMap = new HashMap<>();
// public final List<IAttribute<?>> enableList = new // public final List<IAttribute<?>> enableList = new
// ArrayList<IAttribute<?>>(); // ArrayList<IAttribute<?>>();
// public final List<IAttribute<?>> requiredList = new // public final List<IAttribute<?>> requiredList = new
// ArrayList<IAttribute<?>>(); // ArrayList<IAttribute<?>>();
private String message = null; // 弹出的message private String message = null; // 弹出的message
private String message_code = ErrorCodes.SUCCESS; private String message_code = ErrorCodes.SUCCESS;
public IPanel popupPanel = null; private boolean isChain = false;
public NoUiPresentation(NoUiContext context, NoUiRequest noUiRequest) {
this.ctx = context;
this.noUiRequest = noUiRequest;
}
@Override @Override
public void close(IPanel panel) throws ContainerException { public void close(IPanel panel) throws ContainerException {
// TODO Auto-generated method stub // TODO Auto-generated method stub
...@@ -72,7 +81,7 @@ public class NoUiPresentation extends AbstractNullPresentation { ...@@ -72,7 +81,7 @@ public class NoUiPresentation extends AbstractNullPresentation {
@Override @Override
public Object readFromSession(String name) { public Object readFromSession(String name) {
return ((NoUiContext)this.ctx).getRedisLoginInfo().getContextMap().get(name); return ((NoUiContext) this.ctx).getRedisLoginInfo().getContextMap().get(name);
} }
@Override @Override
...@@ -87,15 +96,9 @@ public class NoUiPresentation extends AbstractNullPresentation { ...@@ -87,15 +96,9 @@ public class NoUiPresentation extends AbstractNullPresentation {
@Override @Override
public void writeToSession(String name, Object value) { public void writeToSession(String name, Object value) {
((NoUiContext)this.ctx).getRedisLoginInfo().getContextMap().put(name, value); ((NoUiContext) this.ctx).getRedisLoginInfo().getContextMap().put(name, value);
} }
public String transactionName = null;
public boolean clearFlag = false;
public boolean newTabFlag = false;
private boolean isChain = false;
public Boolean logoutFlag = null;
public String getMessageCode() { public String getMessageCode() {
return this.message_code; return this.message_code;
} }
...@@ -108,11 +111,6 @@ public class NoUiPresentation extends AbstractNullPresentation { ...@@ -108,11 +111,6 @@ public class NoUiPresentation extends AbstractNullPresentation {
return isChain; return isChain;
} }
public NoUiPresentation(NoUiContext context, NoUiRequest noUiRequest) {
this.ctx = context;
this.noUiRequest = noUiRequest;
}
public synchronized void dispose() { public synchronized void dispose() {
if (disposed) { if (disposed) {
return; return;
...@@ -202,7 +200,7 @@ public class NoUiPresentation extends AbstractNullPresentation { ...@@ -202,7 +200,7 @@ public class NoUiPresentation extends AbstractNullPresentation {
error.put(((IBaseObject) paramIAttribute).getUrl(), str); error.put(((IBaseObject) paramIAttribute).getUrl(), str);
} }
if ((log.isDebugEnabled()) && ((paramIAttribute instanceof IDatafield))) { if ((log.isDebugEnabled()) && ((paramIAttribute instanceof IDatafield))) {
log.info(String.format("error field url %s.", new Object[] { ((IDatafield<?>) paramIAttribute).getUrl() })); log.info(String.format("error field url %s.", new Object[]{((IDatafield<?>) paramIAttribute).getUrl()}));
} }
} }
...@@ -211,12 +209,14 @@ public class NoUiPresentation extends AbstractNullPresentation { ...@@ -211,12 +209,14 @@ public class NoUiPresentation extends AbstractNullPresentation {
// mapPut(hintMap, paramIAttribute, "HINT", paramString, paramVarArgs); // mapPut(hintMap, paramIAttribute, "HINT", paramString, paramVarArgs);
} }
public boolean message(MessageType paramMessageType, String paramString, Object paramObject) throws ContainerException { public boolean message(MessageType paramMessageType, String paramString, Object paramObject) {
if(paramObject instanceof ExitTransactionException){
throw ExitTransactionException.class.cast(paramObject);
}
if(paramMessageType.equals(MessageType.ERROR) && (paramObject instanceof Throwable)) if (paramMessageType.equals(MessageType.ERROR) && (paramObject instanceof Throwable)) {
{
//记录异常日志 //记录异常日志
TxInfo.recordException((Throwable)paramObject); TxInfo.recordException((Throwable) paramObject);
} }
...@@ -232,8 +232,8 @@ public class NoUiPresentation extends AbstractNullPresentation { ...@@ -232,8 +232,8 @@ public class NoUiPresentation extends AbstractNullPresentation {
PrintStream localPrintStream = new PrintStream(new FileOutputStream(new File(localFile, str2))); PrintStream localPrintStream = new PrintStream(new FileOutputStream(new File(localFile, str2)));
((Throwable) paramObject).printStackTrace(localPrintStream); ((Throwable) paramObject).printStackTrace(localPrintStream);
localPrintStream.close(); localPrintStream.close();
str1 = String.format(getI18nValue("eibs", "error.message"), new Object[] { ((Throwable) paramObject).getMessage(), str2 }); str1 = String.format(getI18nValue("eibs", "error.message"), new Object[]{((Throwable) paramObject).getMessage(), str2});
log.error("事件触发异常:"+((Throwable) paramObject).getMessage(),(Throwable)paramObject); log.error("事件触发异常:" + ((Throwable) paramObject).getMessage(), (Throwable) paramObject);
} else if (paramObject != null) { } else if (paramObject != null) {
str1 = paramObject.toString(); str1 = paramObject.toString();
} }
...@@ -533,14 +533,14 @@ public class NoUiPresentation extends AbstractNullPresentation { ...@@ -533,14 +533,14 @@ public class NoUiPresentation extends AbstractNullPresentation {
return codetable; return codetable;
} }
public Map<String, Object> getError() {
return error;
}
public void setCodetable(Map<String, Object> codetable) { public void setCodetable(Map<String, Object> codetable) {
this.codetable = codetable; this.codetable = codetable;
} }
public Map<String, Object> getError() {
return error;
}
public void setError(Map<String, Object> error) { public void setError(Map<String, Object> error) {
this.error = error; this.error = error;
} }
......
...@@ -188,14 +188,15 @@ public abstract class AbstractCommonController { ...@@ -188,14 +188,15 @@ public abstract class AbstractCommonController {
ret = ResultUtil.result(NoUiPresentationUtil.retCode(context), NoUiPresentationUtil.retMsg(context), afterReturnData,paginationData, ret = ResultUtil.result(NoUiPresentationUtil.retCode(context), NoUiPresentationUtil.retMsg(context), afterReturnData,paginationData,
NoUiPresentationUtil.handleErrorReturnData(context, alias), NoUiPresentationUtil.handleCodeTableReturnData(context, alias), noUiVersion.getVersion()); NoUiPresentationUtil.handleErrorReturnData(context, alias), NoUiPresentationUtil.handleCodeTableReturnData(context, alias), noUiVersion.getVersion());
} }
catch (ExitTransactionException exitTrans)
{
ret = ResultUtil.result(exitTrans.getErrorCode(), exitTrans.getMessage(), "service error", noUiVersion.getVersion());
}
catch (Throwable e) { catch (Throwable e) {
if(e.getCause() instanceof ExitTransactionException){
ExitTransactionException exitTrans=ExitTransactionException.class.cast(e.getCause());
ret = ResultUtil.result(exitTrans.getErrorCode(), exitTrans.getMessage(), exitTrans.getMessage(), noUiVersion.getVersion());
}else{
log.error("OnClick command error", e); log.error("OnClick command error", e);
ret = ResultUtil.result(ErrorCodes.ERROR, "hander error", "service error", noUiVersion.getVersion()); ret = ResultUtil.result(ErrorCodes.ERROR, "hander error", "service error", noUiVersion.getVersion());
TxInfo.recordException(e); TxInfo.recordException(e);
}
} finally { } finally {
if (context != null) { if (context != null) {
//context.getSupport().disconnect(); //context.getSupport().disconnect();
......
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