This commit is contained in:
guohb
2024-05-28 14:24:41 +08:00
parent 3cdd6c05bb
commit e6a7537f00
2 changed files with 10 additions and 13 deletions

View File

@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.request.AuditResultRequest;
import com.cool.store.request.LicenseBizContentRequest;
import com.cool.store.request.SysBuildResultRequest;
import com.cool.store.request.XfsgOpenApiRequest;
import com.cool.store.response.LicenseApiResponse;
import com.cool.store.response.ResponseResult;
@@ -33,12 +32,12 @@ public class KdzApiController {
public ResponseResult<Boolean> auditResult(@PathVariable(value = "enterprise-id") String eid,
@RequestBody XfsgOpenApiRequest request) {
log.info("auditResult requestBody :{}", JSONObject.toJSONString(request));
if(!verifyMD5(request,eid)){
log.error("验签失败,request{};eid:{}",JSONObject.toJSONString(request),eid);
if (!verifyMD5(request, eid)) {
log.error("验签失败,request{};eid:{}", JSONObject.toJSONString(request), eid);
return ResponseResult.fail(ErrorCodeEnum.VERIFY_MD5_FALSE);
}
if(eid == null || request.getBizContent() == null){
log.error("参数校验失败,BizContent{}",JSONObject.toJSONString(request.getBizContent()));
if (eid == null || request.getBizContent() == null) {
log.error("参数校验失败,BizContent{}", JSONObject.toJSONString(request.getBizContent()));
return ResponseResult.fail(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
AuditResultRequest auditResultRequest = JSONObject.parseObject(request.getBizContent(), AuditResultRequest.class);
@@ -50,12 +49,12 @@ public class KdzApiController {
public ResponseResult<LicenseApiResponse> license(@PathVariable(value = "enterprise-id") String eid,
@RequestBody XfsgOpenApiRequest request) {
log.info("license requestBody :{}", JSONObject.toJSONString(request));
if(!verifyMD5(request,eid)){
log.error("验签失败,request{};eid:{}",JSONObject.toJSONString(request),eid);
if (!verifyMD5(request, eid)) {
log.error("验签失败,request{};eid:{}", JSONObject.toJSONString(request), eid);
return ResponseResult.fail(ErrorCodeEnum.VERIFY_MD5_FALSE);
}
if(eid == null || request.getBizContent() == null){
log.error("参数校验失败,BizContent{}",JSONObject.toJSONString(request.getBizContent()));
if (eid == null || request.getBizContent() == null) {
log.error("参数校验失败,BizContent{}", JSONObject.toJSONString(request.getBizContent()));
return ResponseResult.fail(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
LicenseBizContentRequest storeNum = JSONObject.parseObject(request.getBizContent(), LicenseBizContentRequest.class);
@@ -63,9 +62,7 @@ public class KdzApiController {
}
public static boolean verifyMD5(XfsgOpenApiRequest request, String eid){
public static boolean verifyMD5(XfsgOpenApiRequest request, String eid) {
//签名
StringBuffer sb = new StringBuffer();
//用户唯一标识id