代码改造
This commit is contained in:
+51
-47
@@ -8,6 +8,7 @@ import com.murong.ecp.netpay.mbu.web.service.OperService;
|
||||
import com.yuangou.ecp.biz.transengine.Utils;
|
||||
import com.yuangou.ecp.biz.transengine.YGAbstractBizIntercetpor;
|
||||
import com.yuangou.ecp.biz.transengine.util.GDAUtil;
|
||||
import com.yuangou.ecp.bp.comp.expr.YGExpUtil;
|
||||
import com.yuangou.ecp.bp.comp.pubatc.YGPUBATCUtil;
|
||||
import com.yuangou.ecp.bp.core.common.exception.YGException;
|
||||
import com.yuangou.ecp.bp.core.common.message.YGBizMessage;
|
||||
@@ -15,6 +16,7 @@ import com.yuangou.ecp.bp.core.common.message.YGBizMessageContext;
|
||||
import com.yuangou.ecp.bp.core.common.message.YGEDB;
|
||||
import com.yuangou.ecp.bp.core.common.yglog4j.Logger;
|
||||
import com.yuangou.ecp.bp.core.common.yglog4j.YGLogger;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -39,6 +41,7 @@ public class MrMBUInterceptor extends YGAbstractBizIntercetpor {
|
||||
@Override
|
||||
public boolean onRequest(YGBizMessageContext bizCtx) throws YGException {
|
||||
Hashtable mappub = new Hashtable();
|
||||
YGBizMessage msg = bizCtx.getCurrentMsg();
|
||||
Logger logger = YGLogger.getLogger(bizCtx.getCurrentMsg());
|
||||
YGEDB root = bizCtx.getCurrentMsg().getEDBBody();
|
||||
logger.info("执行公共前处理===");
|
||||
@@ -50,7 +53,7 @@ public class MrMBUInterceptor extends YGAbstractBizIntercetpor {
|
||||
logger.info("{}", root.toString());
|
||||
logger.info("前处理结束:[" + this.getClass().getSimpleName() + ".onRequest]");
|
||||
}
|
||||
String req = Utils.getData(bizCtx, "$req_url");
|
||||
String req = root.getData("req_url");
|
||||
|
||||
try {
|
||||
req = new String(req.getBytes("ISO-8859-1"), "UTF-8");
|
||||
@@ -62,7 +65,12 @@ public class MrMBUInterceptor extends YGAbstractBizIntercetpor {
|
||||
edb.setData("req_url", req);
|
||||
logger.info(req);
|
||||
mappub.clear();
|
||||
if (Utils.eval(bizCtx, "is_noequal_string($txn_cd,login,forgetPassword,resetPassword,getCheckFlag,getSmsCode,addShopInfo)")) {
|
||||
String txnCd = root.getData("txn_cd");
|
||||
|
||||
// 不判断是否登录的交易
|
||||
String[] noNeedLoginTxnCds = {"login", "forgetPassword", "resetPassword", "getCheckFlag", "getSmsCode", "addShopInfo"};
|
||||
|
||||
if (ArrayUtils.contains(noNeedLoginTxnCds, txnCd)) {
|
||||
mappub.put("cur_oper_no", "oper_no");
|
||||
mappub.put("cur_oper_city", "oper_city");
|
||||
mappub.put("cur_oper_prov", "oper_prov");
|
||||
@@ -74,53 +82,55 @@ public class MrMBUInterceptor extends YGAbstractBizIntercetpor {
|
||||
mappub.put("img_path", "img_path");
|
||||
mappub.put("cur_oper_nm", "oper_nm");
|
||||
YGPUBATCUtil.getSession(bizCtx, "oper_inf", mappub);
|
||||
if (Utils.eval(bizCtx, "is_equal_string($txn_cd,menuservice)")) {
|
||||
Utils.setData(bizCtx, "session_tmout", "$cur_oper_no");
|
||||
if (Utils.eval(bizCtx, "is_null($cur_oper_no)")) {
|
||||
logger.info("is_null($cur_oper_no) begin");
|
||||
Utils.setData(bizCtx, "session_tmout", "1");
|
||||
Utils.setData(bizCtx, "rsp_pag", "/showmessage.jsp");
|
||||
YGBizMessage msg = bizCtx.getCurrentMsg();
|
||||
|
||||
String curOperNo = root.getData("cur_oper_no");
|
||||
|
||||
if ("menuservice".equals(root.getData("txn_cd"))) {
|
||||
root.setData("session_tmout", curOperNo);
|
||||
if (StringUtils.isEmpty(curOperNo) ) {
|
||||
root.setData("session_tmout", "1");
|
||||
root.setData("rsp_pag", "/showmessage.jsp");
|
||||
GDAUtil.setMsg_inf(msg, PUBMsgCd.SYSTEM_ERROR.getCode(), PUBMsgCd.SYSTEM_ERROR.getDesc());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("is_noequal_string($txn_cd,login) begin");
|
||||
if (Utils.eval(bizCtx, "is_noequal_string($txn_cd,0040260,0040280,4716015,4800123,4810004)")) {
|
||||
logger.info("is_noequal_string($txn_cd,0040260,0040280,4716015) begin");
|
||||
if (Utils.eval(bizCtx, "is_null($cur_oper_no)")) {
|
||||
//
|
||||
String[] txnCds = {"0040260", "0040280", "4716015", "4800123", "4810004"};
|
||||
if (ArrayUtils.contains(txnCds, txnCd) ) {
|
||||
if (StringUtils.isEmpty(curOperNo) ) {
|
||||
logger.info("is_null($cur_oper_no) begin");
|
||||
Utils.setData(bizCtx, "session_tmout", "1");
|
||||
Utils.setData(bizCtx, "rsp_pag", "/showmessage.jsp");
|
||||
YGBizMessage msg = bizCtx.getCurrentMsg();
|
||||
root.setData( "session_tmout", "1");
|
||||
root.setData( "rsp_pag", "/showmessage.jsp");
|
||||
GDAUtil.setMsg_inf(msg, PUBMsgCd.SYSTEM_ERROR.getCode(), PUBMsgCd.SYSTEM_ERROR.getDesc());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Utils.setData(bizCtx, "upd_oper", "$cur_oper_no");
|
||||
Utils.setData(bizCtx, "curuid", "$cur_oper_no");
|
||||
Utils.setData(bizCtx, "cur_opr_id", "$cur_oper_no");
|
||||
Utils.setData(bizCtx, "sys_dt", "get_date()");
|
||||
if (Utils.eval(bizCtx, "is_equal_string($cur_oper_prov_lvl,1)")) {
|
||||
root.setData("upd_oper", root.getData("cur_oper_no"));
|
||||
root.setData("curuid", root.getData("cur_oper_no"));
|
||||
root.setData("cur_opr_id", root.getData("cur_oper_no"));
|
||||
root.setData("sys_dt", YGExpUtil.get_date());
|
||||
|
||||
if( "1".equals(root.getData("cur_oper_prov_lvl"))) {
|
||||
logger.info("操作员级别:直属省部门,查询省范围");
|
||||
if (Utils.eval(bizCtx, "or(is_null($cur_oper_prov),is_equal_string($cur_oper_prov,000)")) {
|
||||
logger.info("is_equal_string($cur_oper_prov_lvl,1) begin");
|
||||
Utils.setData(bizCtx, "scop_sql", "strcat(dept.prov_cd=\',$cur_oper_prov,\')");
|
||||
if( StringUtils.isEmpty(root.getData("cur_oper_prov")) || "000".equals(root.getData("cur_oper_prov"))) {
|
||||
root.setData("scop_sql", "dept.city_cd='" + root.getData("cur_oper_city") + "'");
|
||||
} else {
|
||||
logger.info("操作员级别:直属市部门,查询市范围");
|
||||
Utils.setData(bizCtx, "scop_sql", "strcat(dept.city_cd=\',$cur_oper_city,\')");
|
||||
root.setData("scop_sql", "dept.city_cd='" + root.getData("cur_oper_city") + "'");
|
||||
}
|
||||
} else {
|
||||
logger.info("操作员级别:总中心,查询全国范围");
|
||||
Utils.setData(bizCtx, "scop_sql", "1=1");
|
||||
root.setData("scop_sql", "1=1");
|
||||
}
|
||||
|
||||
Utils.setData(bizCtx, "gda.bus_cnl", "BUI");
|
||||
Utils.setData(bizCtx, "gda.sys_cnl", "BUI");
|
||||
Utils.setData(bizCtx, "param_name", "");
|
||||
Utils.setData(bizCtx, "ip_addr", "@MSG.SIP");
|
||||
root.setData("gda.bus_cnl", "BUI");
|
||||
root.setData("gda.sys_cnl", "BUI");
|
||||
root.setData("param_name", "BUI");
|
||||
root.setData("ip_addr", msg.getHeadItem("SIP"));
|
||||
|
||||
|
||||
logger.info("前处理结束==");
|
||||
return true;
|
||||
}
|
||||
@@ -131,22 +141,18 @@ public class MrMBUInterceptor extends YGAbstractBizIntercetpor {
|
||||
Logger logger = YGLogger.getLogger(bizCtx.getCurrentMsg());
|
||||
logger.info("MrMBUInterceptor.onResponse");
|
||||
YGPUBATCUtil.logETF(bizCtx);
|
||||
if (Utils.eval(bizCtx, "~RetCod=-1")) {
|
||||
logger.info("~RetCod=-1 条件成立,执行:");
|
||||
|
||||
YGEDB root = bizCtx.getCurrentMsg().getEDBBody();
|
||||
|
||||
String msgCd = root.getData("gda.msg_cd");
|
||||
if (StringUtils.isEmpty(msgCd)) {
|
||||
YGBizMessage msg = bizCtx.getCurrentMsg();
|
||||
GDAUtil.setMsg_inf(msg, PUBMsgCd.SYSTEM_ERROR.getCode(), PUBMsgCd.SYSTEM_ERROR.getDesc());
|
||||
}
|
||||
|
||||
if (Utils.eval(bizCtx, "is_null($gda.msg_cd)")) {
|
||||
logger.info("is_null($gda.msg_cd) 条件成立,执行:");
|
||||
YGBizMessage msg = bizCtx.getCurrentMsg();
|
||||
GDAUtil.setMsg_inf(msg, PUBMsgCd.SYSTEM_ERROR.getCode(), PUBMsgCd.SYSTEM_ERROR.getDesc());
|
||||
}
|
||||
|
||||
Utils.setData(bizCtx, "msg_cd", "$gda.msg_cd");
|
||||
if (Utils.eval(bizCtx, "is_succ($gda.msg_cd)")) {
|
||||
logger.info("is_succ($gda.msg_cd) 条件成立,执行:");
|
||||
Utils.setData(bizCtx, "gda.msg_typ", "N");
|
||||
root.setData( "msg_cd", msgCd);
|
||||
if (YGExpUtil.is_succ(msgCd)) {
|
||||
root.setData("gda.msg_typ", "N");
|
||||
} else {
|
||||
logger.info("is_succ($gda.msg_cd) 条件不成立,执行:");
|
||||
}
|
||||
@@ -155,8 +161,7 @@ public class MrMBUInterceptor extends YGAbstractBizIntercetpor {
|
||||
operService.recordOperLog(bizCtx);
|
||||
}
|
||||
|
||||
Utils.setData(bizCtx, "gda.msg_typ", "$gda.msg_typ");
|
||||
if (Utils.eval(bizCtx, "is_equal_string($gda.msg_typ,N)")) {
|
||||
if ("N".equals(root.getData("gda.msg_typ"))) {
|
||||
logger.info("交易成功,执行commitWorkIgnore");
|
||||
bizCtx.getDataBaseUtil().commit();
|
||||
YGPUBATCUtil.commitWork(bizCtx);
|
||||
@@ -165,10 +170,9 @@ public class MrMBUInterceptor extends YGAbstractBizIntercetpor {
|
||||
YGPUBATCUtil.rollbackWork(bizCtx);
|
||||
}
|
||||
|
||||
YGPUBATCUtil.logETF(bizCtx);
|
||||
logger.info("--------->mbu特色公共后处理执行结束");
|
||||
if (Utils.eval(bizCtx, "is_equal_string($txn_cd,login)")) {
|
||||
logger.info("is_equal_string($txn_cd,login) begin");
|
||||
if ("login".equals(root.getData("txn_cd"))) {
|
||||
logger.info("登录交易特殊处理");
|
||||
YGEDB edb = bizCtx.getCurrentMsg().getEDBBody();
|
||||
edb.removeChildNode("oper_no");
|
||||
edb.removeChildNode("oper_pwd");
|
||||
|
||||
Reference in New Issue
Block a user