Merge remote-tracking branch 'origin/branch_20190822' into branch_20190822

This commit is contained in:
xu_lw
2019-08-29 17:48:01 +08:00
3 changed files with 187 additions and 20 deletions
+19 -10
View File
@@ -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);
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);
@@ -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]");
}
}
}}
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="GBK"?>
<!-- Created by xu_lw on 2019-08-29 13:41:35. -->
<mapper namespace="com.murong.ecp.netpay.mbu.web.pub.dal.dao.BuiOperlogMapper">
<select id="selectByPrimaryKey" resultType="com.murong.ecp.netpay.mbu.web.pub.dal.entity.BuiOperlogDO">
select <include refid="base_column_list"/>
from T_BUI_OPERLOG where id = #{id}
</select>
<!-- 分页查询id后缀必须为Page -->
<select id="selectPage" resultType="com.murong.ecp.netpay.mbu.web.pub.dal.entity.BuiOperlogDO">
select <include refid="base_column_list"/>
from T_BUI_OPERLOG where oper_no like '%%${operNo}%%' or oper_nm like '%%${operNm}%%' or txn_cd like '%%${txnCd}%%' or ip_addr like '%%${ipAddr}%%' or req_data like '%%${reqData}%%' or rep_son like '%%${repSon}%%' order by id
</select>
<!-- 游标后缀必须为Cursor -->
<select id="selectCursor" resultType="com.murong.ecp.netpay.mbu.web.pub.dal.entity.BuiOperlogDO">
select <include refid="base_column_list"/>
from T_BUI_OPERLOG
</select>
<!-- 查询id后缀必须为ResultHandler -->
<select id="selectResultHandler" resultType="com.murong.ecp.netpay.mbu.web.pub.dal.entity.BuiOperlogDO">
select <include refid="base_column_list"/>
from T_BUI_OPERLOG
</select>
<delete id="deleteByPrimaryKey" parameterType="com.murong.ecp.netpay.mbu.web.pub.dal.entity.BuiOperlogDO">
delete from T_BUI_OPERLOG where id = #{id}
</delete>
<delete id="deleteByIds" parameterType="java.lang.String">
delete from T_BUI_OPERLOG where id in (${ids})
</delete>
<update id="updateByPrimaryKey" parameterType="com.murong.ecp.netpay.mbu.web.pub.dal.entity.BuiOperlogDO">
update T_BUI_OPERLOG
<trim prefix="set" suffixOverrides = ",">
<if test="isNotNull(id)">id=#{id},</if>
<if test="isNotNull(operNo)">oper_no=#{operNo},</if>
<if test="isNotNull(operNm)">oper_nm=#{operNm},</if>
<if test="isNotNull(txnCd)">txn_cd=#{txnCd},</if>
<if test="isNotNull(ipAddr)">ip_addr=#{ipAddr},</if>
<if test="isNotNull(reqData)">req_data=#{reqData},</if>
<if test="isNotNull(repCode)">rep_code=#{repCode},</if>
<if test="isNotNull(repSon)">rep_son=#{repSon},</if>
</trim>
where id = #{id}
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.murong.ecp.netpay.mbu.web.pub.dal.entity.BuiOperlogDO">
update T_BUI_OPERLOG
<trim prefix="set" suffixOverrides = ",">
<if test="isNotNull(id)">id=#{id},</if>
<if test="isNotNull(operNo)">oper_no=#{operNo},</if>
<if test="isNotNull(operNm)">oper_nm=#{operNm},</if>
<if test="isNotNull(txnCd)">txn_cd=#{txnCd},</if>
<if test="isNotNull(ipAddr)">ip_addr=#{ipAddr},</if>
<if test="isNotNull(reqData)">req_data=#{reqData},</if>
<if test="isNotNull(repCode)">rep_code=#{repCode},</if>
<if test="isNotNull(repSon)">rep_son=#{repSon},</if>
</trim>
where id = #{id}
</update>
<insert id="insert" parameterType="com.murong.ecp.netpay.mbu.web.pub.dal.entity.BuiOperlogDO">
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>
<insert id="insertSelective" parameterType="com.murong.ecp.netpay.mbu.web.pub.dal.entity.BuiOperlogDO">
insert into T_BUI_OPERLOG
<trim prefix="(" suffix=')' suffixOverrides=",">
id ,
<if test="isNotNull(operNo)">oper_no,</if>
<if test="isNotNull(operNm)">oper_nm,</if>
<if test="isNotNull(txnCd)">txn_cd,</if>
<if test="isNotNull(ipAddr)">ip_addr,</if>
<if test="isNotNull(reqData)">req_data,</if>
<if test="isNotNull(repCode)">rep_code,</if>
<if test="isNotNull(repSon)">rep_son,</if>
</trim>
<trim prefix="values(" suffix=')' suffixOverrides=",">
S_PUB_ID.nextval ,
<if test="isNotNull(operNo)">#{operNo},</if>
<if test="isNotNull(operNm)">#{operNm},</if>
<if test="isNotNull(txnCd)">#{txnCd},</if>
<if test="isNotNull(ipAddr)">#{ipAddr},</if>
<if test="isNotNull(reqData)">#{reqData},</if>
<if test="isNotNull(repCode)">#{repCode},</if>
<if test="isNotNull(repSon)">#{repSon},</if>
</trim>
</insert>
<sql id="base_column_list">
id, oper_no, oper_nm, txn_cd, ip_addr, req_data, rep_code, rep_son
</sql>
<sql id="where_condition">
<trim prefix="where" prefixOverrides="and">
<if test="isNotNull(id)">id=#{id},</if>
<if test="isNotNull(operNo)">oper_no=#{operNo},</if>
<if test="isNotNull(operNm)">oper_nm=#{operNm},</if>
<if test="isNotNull(txnCd)">txn_cd=#{txnCd},</if>
<if test="isNotNull(ipAddr)">ip_addr=#{ipAddr},</if>
<if test="isNotNull(reqData)">req_data=#{reqData},</if>
<if test="isNotNull(repCode)">rep_code=#{repCode},</if>
<if test="isNotNull(repSon)">rep_son=#{repSon},</if>
</trim>
</sql>
</mapper>