From 2c11c858547883815878b2fc9e229064333096de Mon Sep 17 00:00:00 2001 From: lai_kd Date: Thu, 29 Aug 2019 17:44:29 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=A1=A8=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/cre_bui.sql | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/doc/cre_bui.sql b/doc/cre_bui.sql index c91cc089..954b33df 100644 --- a/doc/cre_bui.sql +++ b/doc/cre_bui.sql @@ -518,15 +518,17 @@ create table T_BUI_OPERLOG ( ID NUMBER(20) not null primary key, - OPER_NO VARCHAR2(50) default ' ' not null, - OPER_NM VARCHAR2(1024) default ' ' not null, - TXN_CD VARCHAR2(1) default '0' not null, - IP_ADDR VARCHAR2(80) default ' ' not null, - REQ_DATA VARCHAR2(80) default ' ' not null, - REQ_ID VARCHAR2(64) default ' ' not null, - NOD_ID VARCHAR2(20) default ' ' not null, - TM_SMP VARCHAR2(14) default ' ' not null, - UPD_OPR VARCHAR2(10) default ' ' not null + OPER_NO VARCHAR2(50) default ' ' , + OPER_NM VARCHAR2(1024) default ' ', + TXN_CD VARCHAR2(1) default '0', + IP_ADDR VARCHAR2(80) default ' ' , + REQ_DATA VARCHAR2(80) default ' ' , + REQ_ID VARCHAR2(64) default ' ' , + NOD_ID VARCHAR2(20) default ' ' , + TM_SMP VARCHAR2(14) default ' ' , + UPD_OPR VARCHAR2(10) default ' ' , + REP_CODE NUMBER(10) default ' ' , + REP_SON VARCHAR2(20) default ' ' , ) ; @@ -557,4 +559,11 @@ comment on column T_BUI_CONFIG.TM_SMP is '时间戳' comment on column T_BUI_CONFIG.UPD_OPR is '操作员' ; -create unique index ui1_T_BUI_CONFIG on T_BUI_CONFIG (PARAM_KEY); \ No newline at end of file +comment on column T_BUI_CONFIG.REP_CODE is '响应码' +; + +comment on column T_BUI_CONFIG.REP_SON is '原因' +; + + +create unique index ui1_T_BUI_CONFIG on T_BUI_CONFIG (PARAM_KEY); From 33b18adcc8d8b580288cd114a19e8195b156aac7 Mon Sep 17 00:00:00 2001 From: lai_kd Date: Thu, 29 Aug 2019 17:46:34 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=8B=A6=E6=88=AA=E5=99=A8=E4=B8=AD?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=97=A5=E5=BF=97=E5=A4=84=E7=90=86=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mbu/web/interceptor/BUIInterceptor.java | 68 ++++++++++++++++--- 1 file changed, 58 insertions(+), 10 deletions(-) diff --git a/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/interceptor/BUIInterceptor.java b/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/interceptor/BUIInterceptor.java index 02a66adb..693cc54b 100644 --- a/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/interceptor/BUIInterceptor.java +++ b/ecp-mbu-web/src/main/java/com/murong/ecp/netpay/mbu/web/interceptor/BUIInterceptor.java @@ -2,8 +2,11 @@ package com.murong.ecp.netpay.mbu.web.interceptor; import com.murong.ecp.bp.common.annotation.ECPInterceptorMapping; import com.murong.ecp.netpay.mbu.web.common.utils.CommonMessageCode; +import com.murong.ecp.netpay.mbu.web.common.utils.OperSession; +import com.murong.ecp.netpay.mbu.web.pub.dal.dao.BuiOperlogMapper; +import com.murong.ecp.netpay.mbu.web.pub.dal.entity.BuiOperlogDO; +import com.murong.ecp.netpay.mbu.web.pub.model.BuiOperDTO; import com.yuangou.ecp.biz.transengine.YGAbstractBizIntercetpor; -import com.yuangou.ecp.biz.transengine.sqlsession.YGSqlSession; import com.yuangou.ecp.biz.transengine.util.GDAUtil; import com.yuangou.ecp.bp.comp.expr.YGExpUtil; import com.yuangou.ecp.bp.comp.pubatc.YGPUBATCUtil; @@ -16,6 +19,9 @@ import com.yuangou.ecp.bp.core.common.yglog4j.YGLogger; import com.yuangou.ecp.bp.database.YGDatabaseUtil; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.exception.ExceptionUtils; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.servlet.http.HttpServletRequest; /** * 公共处理 @@ -23,11 +29,16 @@ import org.apache.commons.lang.exception.ExceptionUtils; @ECPInterceptorMapping({".*"}) public class BUIInterceptor extends YGAbstractBizIntercetpor { + @Autowired + private BuiOperlogMapper buiOperlogMapper; + @Override public void onError(YGBizMessageContext bizCtx, Throwable t) throws YGException { YGBizMessage msg = bizCtx.getCurrentMsg(); - + YGEDB edb = msg.getEDBBody(); + edb.setData("EDBBody", String.valueOf(edb)); + logger.info("EDBBody Begin---->"+edb.getData("EDBBody")); Logger logger = YGLogger.getLogger(msg); if (logger.isInfoEnabled()) { @@ -52,12 +63,15 @@ public class BUIInterceptor extends YGAbstractBizIntercetpor { public boolean onRequest(YGBizMessageContext bizCtx) throws YGException { YGBizMessage msg = bizCtx.getCurrentMsg(); + YGEDB edb = msg.getEDBBody(); + edb.setData("EDBBody", String.valueOf(edb)); + logger.info("EDBBody Begin---->"+edb.getData("EDBBody")); Logger logger = YGLogger.getLogger(msg); + if (logger.isInfoEnabled()) { logger.info("执行前处理:[" + this.getClass().getSimpleName() + ".onRequest]"); } - YGPUBATCUtil.initGDS(bizCtx); if (logger.isInfoEnabled()) { logger.info("初始化GDA成功"); @@ -76,34 +90,68 @@ public class BUIInterceptor extends YGAbstractBizIntercetpor { YGBizMessage msg = bizCtx.getCurrentMsg(); YGEDB edb = msg.getEDBBody(); - Logger logger = YGLogger.getLogger(msg); logger.info("执行后处理:[" + this.getClass().getSimpleName() + ".onResponse]"); - String msg_cd = GDAUtil.getMsg_cd(msg); - if (StringUtils.isBlank(msg_cd)) { if (logger.isInfoEnabled()) { logger.info("消息编码为空"); } - GDAUtil.setMsg_cd(msg, CommonMessageCode.FAIL.getMsgCod()); GDAUtil.setMsg_inf(msg, CommonMessageCode.FAIL.getMsgInf()); } edb.setData("msg_cd", msg_cd); + BuiOperlogDO logDo=new BuiOperlogDO(); + HttpServletRequest request = (HttpServletRequest) msg.getObjectHeadItem("_WEB_REQUEST"); + BuiOperDTO operDTO=null; + try { + if (OperSession.getOperInf(msg)==null){ + logger.info("当前session为空"); + }else{ + operDTO= OperSession.getOperInf(msg); + logger.info("当前session的对象:"+operDTO); + } + }catch (Exception e){ + logger.info("e"+e); + } if (YGExpUtil.is_succ(msg_cd)) { + if (logger.isInfoEnabled()) { logger.info("业务处理成功,提交数据库事务"); - } + logDo.setRepCode(200L); + logDo.setRepSon("业务处理成功"); + logDo.setTxnCd(msg_cd); + logDo.setOperNo(null); + if (operDTO!=null){ + logDo.setOperNm(operDTO.getOperNm()); + logDo.setOperNo(operDTO.getOperNo()); + logDo.setIpAddr(request.getRemoteAddr()); + logDo.setReqData(edb.getData("EDBBody")); + logger.info("EDBBody------>"+edb.getData("EDBBody")); + } + buiOperlogMapper.insert(logDo); + logger.info("msg_cd----->"+msg_cd); + } edb.setData("gda.msg_typ", "N"); YGPUBATCUtil.commitWork(bizCtx); } else { if (logger.isInfoEnabled()) { logger.info("业务处理失败,回滚数据库事务"); - } + + logDo.setRepCode(500L); + logDo.setRepSon("业务处理失败"); + logDo.setTxnCd(msg_cd); + logDo.setOperNo(null); + if (operDTO!=null){ + logDo.setOperNm(operDTO.getOperNm()); + logDo.setOperNo(operDTO.getOperNo()); + logDo.setIpAddr(request.getRemoteAddr()); + logDo.setReqData(edb.getData("EDBBody")); + } + buiOperlogMapper.insert(logDo); edb.setData("gda.msg_typ", "E"); YGPUBATCUtil.rollbackWork(bizCtx); } @@ -111,4 +159,4 @@ public class BUIInterceptor extends YGAbstractBizIntercetpor { logger.info("后处理结束:[" + this.getClass().getSimpleName() + ".onResponse]"); } -} +}} From af08c83da8802231d220d401903919d2fde70de9 Mon Sep 17 00:00:00 2001 From: lai_kd Date: Thu, 29 Aug 2019 17:47:13 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=8B=A6=E6=88=AA=E5=99=A8=E4=B8=AD?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=97=A5=E5=BF=97=E5=A4=84=E7=90=86=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mbu/etc/pub/mapper/BuiOperlogMapper.xml | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 ecp-mbu-web/src/main/resources/app/mbu/etc/pub/mapper/BuiOperlogMapper.xml diff --git a/ecp-mbu-web/src/main/resources/app/mbu/etc/pub/mapper/BuiOperlogMapper.xml b/ecp-mbu-web/src/main/resources/app/mbu/etc/pub/mapper/BuiOperlogMapper.xml new file mode 100644 index 00000000..493ef377 --- /dev/null +++ b/ecp-mbu-web/src/main/resources/app/mbu/etc/pub/mapper/BuiOperlogMapper.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + delete from T_BUI_OPERLOG where id = #{id} + + + + delete from T_BUI_OPERLOG where id in (${ids}) + + + + update T_BUI_OPERLOG + + id=#{id}, + oper_no=#{operNo}, + oper_nm=#{operNm}, + txn_cd=#{txnCd}, + ip_addr=#{ipAddr}, + req_data=#{reqData}, + rep_code=#{repCode}, + rep_son=#{repSon}, + + where id = #{id} + + + + update T_BUI_OPERLOG + + id=#{id}, + oper_no=#{operNo}, + oper_nm=#{operNm}, + txn_cd=#{txnCd}, + ip_addr=#{ipAddr}, + req_data=#{reqData}, + rep_code=#{repCode}, + rep_son=#{repSon}, + + where id = #{id} + + + + insert into T_BUI_OPERLOG(id, oper_no, oper_nm, txn_cd, ip_addr, req_data, rep_code, rep_son) + values(S_PUB_ID.nextval,#{operNo}, #{operNm}, #{txnCd}, #{ipAddr}, #{reqData}, #{repCode}, #{repSon}) + + + + insert into T_BUI_OPERLOG + + id , + oper_no, + oper_nm, + txn_cd, + ip_addr, + req_data, + rep_code, + rep_son, + + + S_PUB_ID.nextval , + #{operNo}, + #{operNm}, + #{txnCd}, + #{ipAddr}, + #{reqData}, + #{repCode}, + #{repSon}, + + + + + id, oper_no, oper_nm, txn_cd, ip_addr, req_data, rep_code, rep_son + + + + + id=#{id}, + oper_no=#{operNo}, + oper_nm=#{operNm}, + txn_cd=#{txnCd}, + ip_addr=#{ipAddr}, + req_data=#{reqData}, + rep_code=#{repCode}, + rep_son=#{repSon}, + + +