11
This commit is contained in:
1 parent
115dc64b85
commit
9ae5f917ce
2 files changed
+19
-6
No files matched your search
+7
-1
@@ -295,6 +295,12 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
log.error("|{}|disposeRecognitionCallback 意外的错误,流程不存在dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(flowDetail.getSkuCallbackTime())) {
|
||||
log.error("|{}|disposeRecognitionCallback 该流程已经提交识别dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
HardDoorFlowEntity updateObj = HardDoorFlowEntity.builder().id(flowDetail.getId()).skuCallbackVo(JSONUtil.toJsonStr(dto)).skuCallbackTime(LocalDateTime.now()).build();
|
||||
baseMapper.updateById(updateObj);
|
||||
// 查询订单
|
||||
HardOrderEntity orderDetail = hardOrderService.getById(flowDetail.getOrderId());
|
||||
if (ObjectUtil.isEmpty(orderDetail)) {
|
||||
@@ -306,7 +312,7 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
if (ObjectUtil.isNotEmpty(resultSkuList)) {
|
||||
Long orderId = hardOrderService.payHardDoorOrder(orderDetail, resultSkuList);
|
||||
if (ObjectUtil.isNotEmpty(orderId)) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-5
@@ -10,9 +10,12 @@ import com.bsd.pjcloud.thirdparty.entity.door.ThirdDoorLogEntity;
|
||||
import com.bsd.pjcloud.thirdparty.service.ThirdDoorLogService;
|
||||
import com.bsd.pjcloud.thirdparty.service.ThirdKsApiService;
|
||||
import com.bsd.pjcloud.thirdparty.utils.ks.api.KsApi;
|
||||
import com.bsd.pjcloud.thirdparty.utils.ks.tool.KsRetailSignUtils;
|
||||
import com.bsd.pjcloud.thirdparty.vo.ks.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.client.methods.HttpDelete;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@@ -305,7 +308,7 @@ public class ThirdKsApiServiceImpl implements ThirdKsApiService {
|
||||
@Override
|
||||
public void callbackSKu(String json, Map<String, String> headers) {
|
||||
KsSkuSubmitCallbackDto dto = JSONUtil.toBean(json, KsSkuSubmitCallbackDto.class);
|
||||
boolean isSign = apiParseSign(json, headers);
|
||||
boolean isSign = apiParseSign(json, ksDiscernConfig.getCallbackSkuUrl(), headers);
|
||||
if (!isSign) {
|
||||
log.error("|{}| callbackSKu 签名错误", TAG);
|
||||
return;
|
||||
@@ -331,9 +334,8 @@ public class ThirdKsApiServiceImpl implements ThirdKsApiService {
|
||||
*/
|
||||
@Override
|
||||
public void callbackRecognition(String json, Map<String, String> headers) {
|
||||
String jsonStr = JSONUtil.toJsonStr(headers);
|
||||
KsRecognitionCallbackDto dto = JSONUtil.toBean(json, KsRecognitionCallbackDto.class);
|
||||
boolean isSign = apiParseSign(json, headers);
|
||||
boolean isSign = apiParseSign(json, ksDiscernConfig.getCallbackRecognitionUrl(), headers);
|
||||
if (!isSign) {
|
||||
log.error("|{}| callbackRecognition 签名错误", TAG);
|
||||
return;
|
||||
@@ -357,7 +359,12 @@ public class ThirdKsApiServiceImpl implements ThirdKsApiService {
|
||||
/**
|
||||
* 接口解签
|
||||
*/
|
||||
private boolean apiParseSign(String json, Map<String, String> headers) {
|
||||
return true;
|
||||
private boolean apiParseSign(String json, String uri, Map<String, String> headers) {
|
||||
String authorization = headers.get("Authorization");
|
||||
String referer = headers.get("Referer");
|
||||
String contentType = headers.get("Content-Type");
|
||||
String timestamp = headers.get("REQUEST-START-TIME");
|
||||
String signAuth = KsRetailSignUtils.getSignAuth(referer, uri, contentType, HttpPost.METHOD_NAME, Long.valueOf(timestamp), ksDiscernConfig.getAccessKey(), ksDiscernConfig.getSecretKey(), json, "");
|
||||
return ObjectUtil.equals(signAuth, authorization);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user