Commit bef298c7 by ping.wu

日志修改

parent c45aeed3
package cn.freemud.annotations; //package cn.freemud.annotations;
//
import java.lang.annotation.Retention; //import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; //import java.lang.annotation.RetentionPolicy;
//
/** ///**
* @author wanghanghang // * @author wanghanghang
*/ // */
//
@Retention(RetentionPolicy.RUNTIME) //@Retention(RetentionPolicy.RUNTIME)
public @interface LogIgnore { //public @interface LogIgnore {
/** // /**
* 是否打印日志,true打印,false不打印,注意设置成false状态码和状态码信息都不会打印 // * 是否打印日志,true打印,false不打印,注意设置成false状态码和状态码信息都不会打印
* // *
* @return // * @return
*/ // */
boolean printLog() default true; // boolean printLog() default true;
//
/** // /**
* printLog 设置成true的时候,可以排除哪些状态码的响应不用打印响应报文,只会打印状态码 // * printLog 设置成true的时候,可以排除哪些状态码的响应不用打印响应报文,只会打印状态码
* 默认成功100 // * 默认成功100
* @return // * @return
*/ // */
String[] excludeSuccessCodes() default "100"; // String[] excludeSuccessCodes() default "100";
//
/** // /**
* statusCodeFieldName 默认返回状态码字段为code // * statusCodeFieldName 默认返回状态码字段为code
* // *
* @return // * @return
*/ // */
String codeFieldName() default "code"; // String codeFieldName() default "code";
//
/** // /**
* statusCodeFieldName 默认返回状态码字段为message // * statusCodeFieldName 默认返回状态码字段为message
* // *
* @return // * @return
*/ // */
String messageFieldName() default "message"; // String messageFieldName() default "message";
//
/** // /**
* logMessage 日志打印 // * logMessage 日志打印
* @return // * @return
*/ // */
String logMessage() default ""; // String logMessage() default "";
} //}
package cn.freemud.aop; package cn.freemud.aop;
import cn.freemud.annotations.LogIgnore;
import cn.freemud.annotations.LogIgnoreFeign; import cn.freemud.annotations.LogIgnoreFeign;
import cn.freemud.entities.vo.ThirdPartLogVo; import cn.freemud.entities.vo.ThirdPartLogVo;
import cn.freemud.utils.AppLogUtil; import cn.freemud.utils.AppLogUtil;
......
...@@ -507,16 +507,16 @@ public class CheckMCCafeOrder { ...@@ -507,16 +507,16 @@ public class CheckMCCafeOrder {
McdNetBatchQueryResponse mcdNetBatchQueryResponse = couponClientService.batchQuery(mcCafeCouponRequest); McdNetBatchQueryResponse mcdNetBatchQueryResponse = couponClientService.batchQuery(mcCafeCouponRequest);
if (mcdNetBatchQueryResponse == null || !ResponseCodeConstant.RESPONSE_SUCCESS.equals(mcdNetBatchQueryResponse.getStatusCode()) if (mcdNetBatchQueryResponse == null || !ResponseCodeConstant.RESPONSE_SUCCESS.equals(mcdNetBatchQueryResponse.getStatusCode())
|| CollectionUtils.isEmpty(mcdNetBatchQueryResponse.getCouponlist())) { || CollectionUtils.isEmpty(mcdNetBatchQueryResponse.getCouponlist())) {
AppLogUtil.errorLog("部分优惠券当前不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse); AppLogUtil.infoLog("部分优惠券当前不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse);
throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, "部分优惠券当前不可用"); throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, "部分优惠券当前不可用");
} else if(!ResponseCodeConstant.RESPONSE_SUCCESS.equals(mcdNetBatchQueryResponse.getCouponlist().get(0).getStatusCode())) { } else if(!ResponseCodeConstant.RESPONSE_SUCCESS.equals(mcdNetBatchQueryResponse.getCouponlist().get(0).getStatusCode())) {
mcdNetBatchQueryResponse.getCouponlist().forEach(o -> { mcdNetBatchQueryResponse.getCouponlist().forEach(o -> {
if(!ResponseCodeConstant.RESPONSE_SUCCESS.equals(o.getStatusCode())) { if(!ResponseCodeConstant.RESPONSE_SUCCESS.equals(o.getStatusCode())) {
if(o.getCodeInfo() != null) { if(o.getCodeInfo() != null) {
AppLogUtil.errorLog(o.getCodeInfo().getAct_name()+"当前不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse); AppLogUtil.infoLog(o.getCodeInfo().getAct_name()+"当前不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse);
throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, o.getCodeInfo().getAct_name()+"当前不可用"); throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, o.getCodeInfo().getAct_name()+"当前不可用");
} else { } else {
AppLogUtil.errorLog("部分优惠券暂时不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse); AppLogUtil.infoLog("部分优惠券暂时不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse);
throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, "部分优惠券暂时不可用"); throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, "部分优惠券暂时不可用");
} }
} }
...@@ -604,16 +604,16 @@ public class CheckMCCafeOrder { ...@@ -604,16 +604,16 @@ public class CheckMCCafeOrder {
McdNetBatchQueryResponse mcdNetBatchQueryResponse = couponClientService.batchQuery(mcCafeCouponRequest); McdNetBatchQueryResponse mcdNetBatchQueryResponse = couponClientService.batchQuery(mcCafeCouponRequest);
if (mcdNetBatchQueryResponse == null || !ResponseCodeConstant.RESPONSE_SUCCESS.equals(mcdNetBatchQueryResponse.getStatusCode()) if (mcdNetBatchQueryResponse == null || !ResponseCodeConstant.RESPONSE_SUCCESS.equals(mcdNetBatchQueryResponse.getStatusCode())
|| CollectionUtils.isEmpty(mcdNetBatchQueryResponse.getCouponlist())) { || CollectionUtils.isEmpty(mcdNetBatchQueryResponse.getCouponlist())) {
AppLogUtil.errorLog("部分优惠券当前不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse); AppLogUtil.infoLog("部分优惠券当前不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse);
throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, "部分优惠券当前不可用"); throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, "部分优惠券当前不可用");
} else { } else {
mcdNetBatchQueryResponse.getCouponlist().forEach(o -> { mcdNetBatchQueryResponse.getCouponlist().forEach(o -> {
if(!ResponseCodeConstant.RESPONSE_SUCCESS.equals(o.getStatusCode())) { if(!ResponseCodeConstant.RESPONSE_SUCCESS.equals(o.getStatusCode())) {
if(o.getCodeInfo() != null) { if(o.getCodeInfo() != null) {
AppLogUtil.errorLog(o.getCodeInfo().getAct_name()+"当前不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse); AppLogUtil.infoLog(o.getCodeInfo().getAct_name()+"当前不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse);
throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, o.getCodeInfo().getAct_name()+"当前不可用"); throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, o.getCodeInfo().getAct_name()+"当前不可用");
} else { } else {
AppLogUtil.errorLog("部分优惠券暂时不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse); AppLogUtil.infoLog("部分优惠券暂时不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse);
throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, "部分优惠券暂时不可用"); throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, "部分优惠券暂时不可用");
} }
} }
......
...@@ -564,7 +564,7 @@ public class MallOrderServiceImpl implements MallOrderService { ...@@ -564,7 +564,7 @@ public class MallOrderServiceImpl implements MallOrderService {
try { try {
com.freemud.application.sdk.api.ordercenter.response.BaseResponse baseResponse = orderSdkService.acceptOrder(acceptOrderReq, LogThreadLocal.getTrackingNo()); com.freemud.application.sdk.api.ordercenter.response.BaseResponse baseResponse = orderSdkService.acceptOrder(acceptOrderReq, LogThreadLocal.getTrackingNo());
if(baseResponse == null || !ResponseCodeConstant.RESPONSE_SUCCESS_STR.equals(baseResponse.getCode())) { if(baseResponse == null || !ResponseCodeConstant.RESPONSE_SUCCESS_STR.equals(baseResponse.getCode())) {
AppLogUtil.errorLog("paySuccessCallback_acceptOrder_faild", gson.toJson(confirmOrderDto), gson.toJson(payAccessResponse)); AppLogUtil.infoLog("paySuccessCallback_acceptOrder_faild", gson.toJson(confirmOrderDto), gson.toJson(payAccessResponse));
} }
}catch (Exception e){ }catch (Exception e){
AppLogUtil.errorLog("paySuccessCallback_acceptOrder_error",orderId,e); AppLogUtil.errorLog("paySuccessCallback_acceptOrder_error",orderId,e);
......
...@@ -69,12 +69,13 @@ public class AppLogUtil implements BeanFactoryAware { ...@@ -69,12 +69,13 @@ public class AppLogUtil implements BeanFactoryAware {
public void info(String message, Object... params) { public void info(String message, Object... params) {
logUtil.info(message,params); logUtil.info(message,params);
} }
public void error(String message, Exception e, String... params) { public void error(String message, Exception e, String... params) {
logUtil.error(message, e, params); logUtil.errorDev("",message, e, params);
}
public void error(String message, Object... params) {
ErrorLog.errorDev(message, params);
} }
// public void error(String message, Object... params) {
// ErrorLog.errorDev(message, params);
// }
public void errorSe(String message, Exception e, String... params) { public void errorSe(String message, Exception e, String... params) {
......
...@@ -221,16 +221,16 @@ public class CouponActivityServiceTest { ...@@ -221,16 +221,16 @@ public class CouponActivityServiceTest {
System.out.println(JSON.toJSONString(mcdNetBatchQueryResponse)); System.out.println(JSON.toJSONString(mcdNetBatchQueryResponse));
if (mcdNetBatchQueryResponse == null || !ResponseCodeConstant.RESPONSE_SUCCESS.equals(mcdNetBatchQueryResponse.getStatusCode()) if (mcdNetBatchQueryResponse == null || !ResponseCodeConstant.RESPONSE_SUCCESS.equals(mcdNetBatchQueryResponse.getStatusCode())
|| CollectionUtils.isEmpty(mcdNetBatchQueryResponse.getCouponlist())) { || CollectionUtils.isEmpty(mcdNetBatchQueryResponse.getCouponlist())) {
AppLogUtil.errorLog("部分优惠券当前不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse); AppLogUtil.infoLog("部分优惠券当前不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse);
throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, "部分优惠券当前不可用"); throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, "部分优惠券当前不可用");
} else { } else {
mcdNetBatchQueryResponse.getCouponlist().forEach(o -> { mcdNetBatchQueryResponse.getCouponlist().forEach(o -> {
if(!ResponseCodeConstant.RESPONSE_SUCCESS.equals(o.getStatusCode())) { if(!ResponseCodeConstant.RESPONSE_SUCCESS.equals(o.getStatusCode())) {
if(o.getCodeInfo() != null) { if(o.getCodeInfo() != null) {
AppLogUtil.errorLog(o.getCodeInfo().getAct_name()+"当前不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse); AppLogUtil.infoLog(o.getCodeInfo().getAct_name()+"当前不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse);
throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, o.getCodeInfo().getAct_name()+"当前不可用"); throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, o.getCodeInfo().getAct_name()+"当前不可用");
} else { } else {
AppLogUtil.errorLog("部分优惠券暂时不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse); AppLogUtil.infoLog("部分优惠券暂时不可用", mcCafeCouponRequest, mcdNetBatchQueryResponse);
throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, "部分优惠券暂时不可用"); throw new ServiceException(ResponseResult.COUPON_SHOP_NOTSUPPORT, "部分优惠券暂时不可用");
} }
} }
......
...@@ -62,6 +62,10 @@ public class LogUtil { ...@@ -62,6 +62,10 @@ public class LogUtil {
ErrorLog.errorDev(message, e, params); ErrorLog.errorDev(message, e, params);
} }
public void errorDev(String statusCode, String message,Exception e, Object... params) {
ErrorLog.errorDev(statusCode,message, e, params);
}
public void errorSe(String message, Exception e, Object... params) { public void errorSe(String message, Exception e, Object... params) {
ErrorLog.errorSe(message, e, params); ErrorLog.errorSe(message, e, params);
} }
......
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