Commit 0ed5f058 authored by hongguangwu's avatar hongguangwu

MVP1.7.16-法大大

parent 63c5f79b
package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.fasc.open.api.exception.ApiException;
import com.fasc.open.api.utils.crypt.FddCryptUtil;
import com.yifu.cloud.plus.v1.yifu.archives.service.FascService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
/**
* @auther huyc
......@@ -77,4 +79,40 @@ public class FascController {
return fascService.urgeTask(id);
}
// 法大大回调
@ResponseBody
@PostMapping(value = "/api/fascCallback")
public String fddEventCallback(@RequestHeader HttpHeaders headers,
@RequestParam("bizContent") String bizContent) throws Exception {
//appSecret,由开发者登陆到法大大官网,在应用管理管理中点击应用详情里面获取
String appSecret = "xxxx";
//获取请求头参数
String appId = headers.getFirst("X-FASC-App-Id");
String signType = headers.getFirst("X-FASC-Sign-Type");
String sign = headers.getFirst("X-FASC-Sign");
String timestamp = headers.getFirst("X-FASC-Timestamp");
//事件名称,开发者可以根据不同事件名称去解析bizContent的值,实现不同的逻辑
String event = headers.getFirst("X-FASC-Event");
String nonce = headers.getFirst("X-FASC-Nonce");
//验签
Map<String, String> paramMap = new HashMap<>();
paramMap.put("X-FASC-App-Id", appId);
paramMap.put("X-FASC-Sign-Type", "HMAC-SHA256");
paramMap.put("X-FASC-Timestamp", timestamp);
paramMap.put("X-FASC-Nonce", nonce);
paramMap.put("X-FASC-Event", event);
paramMap.put("bizContent", bizContent);
//参数排序,ascii码排序
String sortParam = FddCryptUtil.sortParameters(paramMap);
//生成签名后可以进行校验
String signature = FddCryptUtil.sign(sortParam, timestamp, appSecret);
if(!signature.equals(sign)) {
//log.error("日志记录,签名失败");
//为了不重复接收该请求,建议这里返回success,返回success后这条消息法大大将中断重试回调机制
return "{\"code\":\"200\";\"msg\":\"success\"}";
}
return "{\"code\":\"200\";\"msg\":\"success\"}";
}
}
......@@ -60,6 +60,7 @@ security:
- /tgzempinfo/saveTGzEmpInfo
- /gz/core/saveOfferInfo
- /gz/core/getGzBank
- /fasc/api/fascCallback
# 文件上传相关 支持阿里云、华为云、腾讯、minio
......
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