Browse Source

fix:回调处理

liangbo.huang 9 hours ago
parent
commit
37f690ca8b

+ 12 - 2
src/main/java/com/sunxung/factoring/service/smbApi/spi/impl/SMBSpiServiceImpl.java

@@ -6,7 +6,10 @@ 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.CreditNotifyPayloadDto;
 import com.sunxung.factoring.service.smbApi.dto.SMBNotifyRespDto;
+import com.sunxung.factoring.service.smbApi.dto.WithdrawNotifyPayloadDto;
 import com.sunxung.factoring.service.smbApi.spi.SMBSpiRegister;
 import com.sunxung.factoring.service.smbApi.spi.SMBSpiService;
 import org.slf4j.Logger;
@@ -47,7 +50,7 @@ public class SMBSpiServiceImpl implements SMBSpiService {
         String respCode = SUCCESS_CODE;
         String respMsg = "成功";
         JSONObject jsonObject = null;
-        logger.info("收到来自苏商银行的通知消息,通知类型:{}, 通知内容:{}", channelSerialNo, transCode, reqParameterMap);
+        logger.info("收到来自苏商银行的通知消息,channelSerialNo:{}, 通知类型:{}, 通知内容:{}", channelSerialNo, transCode, reqParameterMap);
         SMBRequestLogPO smbRequestLogPO = new SMBRequestLogPO();
         smbRequestLogPO.setSmbSerialNo(channelSerialNo);
         smbRequestLogPO.setTransCode(transCode);
@@ -73,7 +76,14 @@ public class SMBSpiServiceImpl implements SMBSpiService {
             Function<Object, SMBNotifyRespDto> handler = smbSpiRegister.findHandler(transCode);
             if (handler != null) {
                 payloadMap = new HashMap<>();
-                SMBNotifyRespDto smbNotifyRespDto = handler.apply(jsonObject);
+                SMBNotifyRespDto smbNotifyRespDto = null;
+                if (TransCodeEnum.CREDIT_NOTIFY.getCode().equals(transCode)) {
+                    smbNotifyRespDto = handler.apply(jsonObject.toJavaObject(CreditNotifyPayloadDto.class));
+                } else if (TransCodeEnum.WITHDRAW_NOTIFY.getCode().equals(transCode)) {
+                    smbNotifyRespDto = handler.apply(jsonObject.toJavaObject(WithdrawNotifyPayloadDto.class));
+                } else {
+                    smbNotifyRespDto = handler.apply(jsonObject);
+                }
                 if (!smbNotifyRespDto.getRespResult()) {
                     respCode = "00100046";
                     respMsg = smbNotifyRespDto.getRespMsg();