From 850090b0be9b8a5b6cf26606ea8321df8cbf7b92 Mon Sep 17 00:00:00 2001 From: yixian Date: Mon, 28 Oct 2019 17:59:52 +0800 Subject: [PATCH] add logger for RetailAppMessage sender api --- pom.xml | 4 ++-- .../payment/manage/appclient/beans/RetailAppMessage.java | 5 +++-- .../manage/appclient/core/impls/RetailAppServiceImp.java | 1 + .../manage/appclient/extend/GatewayOAuthRegister.java | 5 ++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 9ac542a40..37c725e90 100644 --- a/pom.xml +++ b/pom.xml @@ -5,12 +5,12 @@ au.com.royalpay.payment payment-parent - 1.1.4 + 1.1.5 4.0.0 manage - 1.2.45 + 1.2.46 UTF-8 diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/beans/RetailAppMessage.java b/src/main/java/au/com/royalpay/payment/manage/appclient/beans/RetailAppMessage.java index 5b3651f6f..908149737 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/beans/RetailAppMessage.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/beans/RetailAppMessage.java @@ -6,6 +6,7 @@ import au.com.royalpay.payment.tools.device.message.AppMessage; import au.com.royalpay.payment.tools.env.RequestEnvironment; import au.com.royalpay.payment.tools.permission.enums.PartnerRole; import com.alibaba.fastjson.JSONObject; +import org.apache.commons.lang3.StringUtils; import java.util.Date; @@ -47,7 +48,7 @@ public class RetailAppMessage { } public RetailAppMessage setTitle(String title) { - this.title = title; + this.title = StringUtils.substring(title, 0, 50); return this; } @@ -56,7 +57,7 @@ public class RetailAppMessage { } public RetailAppMessage setBody(String body) { - this.body = body; + this.body = StringUtils.substring(body, 0, 500); return this; } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index ec4f065be..7b5e39e30 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -2455,6 +2455,7 @@ public class RetailAppServiceImp implements RetailAppService { @Override public JSONObject postAppMessage(JSONObject device, RetailAppMessage message) { + logger.debug("post message called by device:{}", device.toJSONString()); String clientType = device.getString("client_type"); if (!GatewayOAuthRegister.CLIENT_TYPE.equals(clientType)) { throw new ForbiddenException("Invalid Client Type:" + clientType); diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/extend/GatewayOAuthRegister.java b/src/main/java/au/com/royalpay/payment/manage/appclient/extend/GatewayOAuthRegister.java index 9bae01d6c..e619521c7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/extend/GatewayOAuthRegister.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/extend/GatewayOAuthRegister.java @@ -7,6 +7,8 @@ import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; @@ -19,6 +21,7 @@ import java.time.Duration; */ @Service public class GatewayOAuthRegister implements DeviceRegister { + private Logger logger = LoggerFactory.getLogger(getClass()); public static final String CLIENT_TYPE = "oauthclient"; private MerchantInfoProvider provider; private AuthHistoryMapper authHistoryMapper; @@ -60,7 +63,7 @@ public class GatewayOAuthRegister implements DeviceRegister { JSONObject client = provider.getClientInfo(clientId); auth.put("client_moniker", client.getString("client_moniker")); auth.put("client", client); - + logger.debug("dev info:{}", auth.toJSONString()); return auth; }