|
@@ -3,8 +3,9 @@ package com.sunxung.factoring.service.smbApi.spi.impl;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.snb.fsos.util.SnbSignUtil;
|
|
|
import com.snb.fsos.util.SnbUtil;
|
|
|
+import com.sunxung.factoring.entity.smbApi.SMBRequestLogPO;
|
|
|
+import com.sunxung.factoring.service.smbApi.api.SMBRequestLogService;
|
|
|
import com.sunxung.factoring.service.smbApi.configuration.SMBConfiguration;
|
|
|
-import com.sunxung.factoring.service.smbApi.constants.TransCodeEnum;
|
|
|
import com.sunxung.factoring.service.smbApi.dto.SMBNotifyRespDto;
|
|
|
import com.sunxung.factoring.service.smbApi.spi.SMBSpiRegister;
|
|
|
import com.sunxung.factoring.service.smbApi.spi.SMBSpiService;
|
|
@@ -26,6 +27,8 @@ public class SMBSpiServiceImpl implements SMBSpiService {
|
|
|
private SMBConfiguration smbConfiguration;
|
|
|
@Resource
|
|
|
private SMBSpiRegister smbSpiRegister;
|
|
|
+ @Resource
|
|
|
+ private SMBRequestLogService smbRequestLogService;
|
|
|
|
|
|
@Override
|
|
|
public Map handSMBNotifyCallback(Map<String, String[]> reqParameterMap) {
|
|
@@ -44,6 +47,11 @@ public class SMBSpiServiceImpl implements SMBSpiService {
|
|
|
String respCode = SUCCESS_CODE;
|
|
|
String respMsg = "成功";
|
|
|
JSONObject jsonObject = null;
|
|
|
+ logger.info("收到来自苏商银行的通知消息,通知类型:{}, 通知内容:{}", channelSerialNo, transCode, reqParameterMap);
|
|
|
+ SMBRequestLogPO smbRequestLogPO = new SMBRequestLogPO();
|
|
|
+ smbRequestLogPO.setSmbSerialNo(channelSerialNo);
|
|
|
+ smbRequestLogPO.setTransCode(transCode);
|
|
|
+ smbRequestLogPO.setChannelSerialNo(serialNo);
|
|
|
try {
|
|
|
Map map = SnbUtil.parseNotifyOrRespMsg(parameterMap);
|
|
|
if ((boolean) map.get("verifyRes")) {
|
|
@@ -52,10 +60,13 @@ public class SMBSpiServiceImpl implements SMBSpiService {
|
|
|
} else {
|
|
|
respCode = "00100004";
|
|
|
respMsg = "签名验证错误";
|
|
|
+ smbRequestLogPO.setRemark("签名验证错误");
|
|
|
}
|
|
|
+ smbRequestLogPO.setRequestPayload(JSONObject.toJSONString(map));
|
|
|
} catch (Exception e) {
|
|
|
respCode = "00100042";
|
|
|
respMsg = "payload解密失败";
|
|
|
+ smbRequestLogPO.setRemark("payload解密失败或者参数解析错误");
|
|
|
}
|
|
|
Map payloadMap = null;
|
|
|
if (SUCCESS_CODE.equals(respCode)) {
|
|
@@ -66,12 +77,16 @@ public class SMBSpiServiceImpl implements SMBSpiService {
|
|
|
if (!smbNotifyRespDto.getRespResult()) {
|
|
|
respCode = "00100046";
|
|
|
respMsg = smbNotifyRespDto.getRespMsg();
|
|
|
+ smbRequestLogPO.setRemark("业务处理返回失败:" + smbNotifyRespDto.getRespMsg());
|
|
|
}
|
|
|
} else {
|
|
|
payloadMap = jsonObject;
|
|
|
}
|
|
|
}
|
|
|
- return SnbUtil.getResponseNotifyContent(respCode, respMsg, serialNo, channelSerialNo, payloadMap);
|
|
|
+ Map respMap = SnbUtil.getResponseNotifyContent(respCode, respMsg, serialNo, channelSerialNo, payloadMap);
|
|
|
+ smbRequestLogPO.setResponsePayload(JSONObject.toJSONString(respMap));
|
|
|
+ smbRequestLogService.add(smbRequestLogPO);
|
|
|
+ return respMap;
|
|
|
}
|
|
|
|
|
|
private String getOneValue(Map<String, String[]> parameters, String name) {
|