Commit 3290e610 authored by qinxunjia's avatar qinxunjia

日志记录

parent 03019183
...@@ -41,6 +41,7 @@ public class DmHubApi { ...@@ -41,6 +41,7 @@ public class DmHubApi {
*/ */
@PostMapping("/sms/template") @PostMapping("/sms/template")
public String template(@RequestBody DmHubTemplateRequest params, String appId, String timestamp, String signature) { public String template(@RequestBody DmHubTemplateRequest params, String appId, String timestamp, String signature) {
log.info("**********创建模板接口入参*******:{},\r\n appId:{},timestamp:{},signature:{}", JSONObject.toJSONString(params), appId, timestamp, signature); log.info("**********创建模板接口入参*******:{},\r\n appId:{},timestamp:{},signature:{}", JSONObject.toJSONString(params), appId, timestamp, signature);
try { try {
boolean checkResult = this.checkSignature(timestamp, signature); boolean checkResult = this.checkSignature(timestamp, signature);
...@@ -95,6 +96,7 @@ public class DmHubApi { ...@@ -95,6 +96,7 @@ public class DmHubApi {
public DmHubResponse batch(@RequestBody DmHubBatchSendRequest request, String appId, String timestamp, String signature) { public DmHubResponse batch(@RequestBody DmHubBatchSendRequest request, String appId, String timestamp, String signature) {
log.info("**********批量发送入参*******:{},\r\n appId:{},timestamp:{},signature:{}", JSONObject.toJSONString(request), appId, timestamp, signature); log.info("**********批量发送入参*******:{},\r\n appId:{},timestamp:{},signature:{}", JSONObject.toJSONString(request), appId, timestamp, signature);
DmHubResponse response; DmHubResponse response;
long start = System.currentTimeMillis();
try { try {
boolean checkResult = this.checkSignature(timestamp, signature); boolean checkResult = this.checkSignature(timestamp, signature);
if (!checkResult) { if (!checkResult) {
...@@ -105,7 +107,9 @@ public class DmHubApi { ...@@ -105,7 +107,9 @@ public class DmHubApi {
log.error("发送批量短信异常", e); log.error("发送批量短信异常", e);
response = new DmHubResponse(ResponseCode.SYSTEM_ERROR); response = new DmHubResponse(ResponseCode.SYSTEM_ERROR);
} }
long end = System.currentTimeMillis();
log.info("**********批量发送出参*******:{}", JSONObject.toJSONString(response)); log.info("**********批量发送出参*******:{}", JSONObject.toJSONString(response));
log.info("**********批量发送耗时*******:{}ms", end - start);
return response; return response;
} }
...@@ -129,6 +133,7 @@ public class DmHubApi { ...@@ -129,6 +133,7 @@ public class DmHubApi {
@RequestMapping("/sms/send") @RequestMapping("/sms/send")
public DmHubResponse send(@RequestBody DmHubSendRequest request, String appId, String timestamp, String signature) { public DmHubResponse send(@RequestBody DmHubSendRequest request, String appId, String timestamp, String signature) {
log.info("**********单条发送入参*******:{},\r\n appId:{},timestamp:{},signature:{}", JSONObject.toJSONString(request), appId, timestamp, signature); log.info("**********单条发送入参*******:{},\r\n appId:{},timestamp:{},signature:{}", JSONObject.toJSONString(request), appId, timestamp, signature);
long start = System.currentTimeMillis();
DmHubResponse response; DmHubResponse response;
try { try {
boolean checkResult = this.checkSignature(timestamp, signature); boolean checkResult = this.checkSignature(timestamp, signature);
...@@ -140,7 +145,9 @@ public class DmHubApi { ...@@ -140,7 +145,9 @@ public class DmHubApi {
log.error("发送单条短信异常", e); log.error("发送单条短信异常", e);
response = new DmHubResponse(ResponseCode.SYSTEM_ERROR); response = new DmHubResponse(ResponseCode.SYSTEM_ERROR);
} }
long end = System.currentTimeMillis();
log.info("**********单条发送出参*******:{}", JSONObject.toJSONString(response)); log.info("**********单条发送出参*******:{}", JSONObject.toJSONString(response));
log.info("**********单条发送耗时*******:{}ms", end - start);
return response; return response;
} }
......
...@@ -61,6 +61,7 @@ public class BgySmsServiceImpl implements BgySmsService { ...@@ -61,6 +61,7 @@ public class BgySmsServiceImpl implements BgySmsService {
@Override @Override
public CLBizResponse sendSms(String mobile, String content, String areaId, String subModule, String api) throws Exception { public CLBizResponse sendSms(String mobile, String content, String areaId, String subModule, String api) throws Exception {
log.info("进入碧桂园短信发送接口"); log.info("进入碧桂园短信发送接口");
String appId = BgySMSConfig.appId; String appId = BgySMSConfig.appId;
String securityCode = BgySMSConfig.securityCode; String securityCode = BgySMSConfig.securityCode;
String url = BgySMSConfig.url; String url = BgySMSConfig.url;
...@@ -76,8 +77,11 @@ public class BgySmsServiceImpl implements BgySmsService { ...@@ -76,8 +77,11 @@ public class BgySmsServiceImpl implements BgySmsService {
requestParams.put("content", content); requestParams.put("content", content);
requestParams.put("mobile", mobile); requestParams.put("mobile", mobile);
log.info("碧桂园短信接口参数:{}", JSONObject.toJSONString(requestParams)); log.info("碧桂园短信接口参数:{}", JSONObject.toJSONString(requestParams));
long start = System.currentTimeMillis();
String retStr = SendSmsUtil.sendSmsByPost(url, JSONObject.toJSONString(requestParams)); String retStr = SendSmsUtil.sendSmsByPost(url, JSONObject.toJSONString(requestParams));
log.info("碧桂园短信接口返回信息:{}", retStr); log.info("碧桂园短信接口返回信息:{}", retStr);
long end = System.currentTimeMillis();
log.info("**********碧桂园短信接口耗时*******:{}ms", end - start);
if (retStr == null) { if (retStr == null) {
return new CLBizResponse(ResponseCode.UPSTREAM_BLANK); return new CLBizResponse(ResponseCode.UPSTREAM_BLANK);
} }
...@@ -95,6 +99,11 @@ public class BgySmsServiceImpl implements BgySmsService { ...@@ -95,6 +99,11 @@ public class BgySmsServiceImpl implements BgySmsService {
} }
} }
public static void main(String[] args) {
String encrypt = Md5Util.encrypt("1023" + "f80a1c5c-8f90-401a-98a1-221af5db0a9b".toUpperCase());
System.out.println(encrypt);
}
@Override @Override
public CLBizResponse sendBatchSms(List<JSONObject> data, String areaId, String subModule, String api, String templateId) throws Exception { public CLBizResponse sendBatchSms(List<JSONObject> data, String areaId, String subModule, String api, String templateId) throws Exception {
log.info("进入碧桂园短信发送接口"); log.info("进入碧桂园短信发送接口");
...@@ -110,9 +119,12 @@ public class BgySmsServiceImpl implements BgySmsService { ...@@ -110,9 +119,12 @@ public class BgySmsServiceImpl implements BgySmsService {
requestParams.put("templateId", templateId); requestParams.put("templateId", templateId);
requestParams.put("data", data); requestParams.put("data", data);
log.info("碧桂园短信接口参数:{}", JSONObject.toJSONString(requestParams)); log.info("碧桂园短信接口参数:{}", JSONObject.toJSONString(requestParams));
long start = System.currentTimeMillis();
String reqStr = JSONObject.toJSONString(requestParams); String reqStr = JSONObject.toJSONString(requestParams);
String retStr = SendSmsUtil.sendSmsByPost(url, reqStr); String retStr = SendSmsUtil.sendSmsByPost(url, reqStr);
log.info("碧桂园短信接口返回信息:{}", retStr); log.info("碧桂园短信接口返回信息:{}", retStr);
long end = System.currentTimeMillis();
log.info("**********碧桂园短信接口耗时*******:{}ms", end - start);
if (retStr == null) { if (retStr == null) {
return new CLBizResponse(ResponseCode.UPSTREAM_BLANK); return new CLBizResponse(ResponseCode.UPSTREAM_BLANK);
} }
......
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