/*
package com.dxhy.core.util;

import cn.hutool.core.codec.Base64;
import com.alibaba.fastjson.JSONObject;
import com.dxhy.core.job.bxvo.BxRequestData;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.net.URL;
import java.nio.charset.StandardCharsets;


*/
/**
 * 签名工具类
 *//*

@Slf4j
@SuppressWarnings("all")
public class SignUtil {
    private static final String HAMCSHA1="HmacSHA1";
    
    */
/**
     * 请求参数签名方法
     * @param requestUrl
     * @param requestData
     * @return
     *//*

    public static String sign(String requestUrl, BxRequestData requestData, String appSecKey){
        if(StringUtils.isEmpty(appSecKey)){
            log.warn("appSecKey为空");
            return null;
        }
        //获取URL路径
        try{
            URL url = new URL(requestUrl);
            requestUrl = url.getPath();
        }catch (Exception e){
           log.info("业务处理异常：{}", e);
        }

        JSONObject authorize=new JSONObject();
        authorize.put("appSecId",requestData.getAuthorize().getAppSecId());
        StringBuilder stringBuilder=new StringBuilder("POST")
                .append(requestUrl)
                .append("?authorize=").append(authorize.toJSONString())
                .append("&globalInfo=")
                .append("{\"appId\":\"")
                .append(requestData.getGlobalInfo().getAppId())
                .append("\",\"version\":\"")
                .append(requestData.getGlobalInfo().getVersion())
                .append("\",\"interfaceCode\":\"").append(requestData.getGlobalInfo().getInterfaceCode()).append("\"}")
                .append("&data=").append(Base64.encode(JSONObject.toJSONString(requestData.getData()).getBytes(StandardCharsets.UTF_8)));
        String signData=stringBuilder.toString();
        return doSign(signData,appSecKey);
    }
    private static String doSign(String signData,String key){
        System.out.println(signData);
        log.info("签名参数：{}",signData);
        String sign;
        try {
            SecretKeySpec keySpec=new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8.name()),HAMCSHA1);
            Mac mac=Mac.getInstance("HmacSHA1");
            mac.init(keySpec);
            byte[] signBytes=mac.doFinal(signData.getBytes(StandardCharsets.UTF_8.name()));
            sign = Base64.encode(signBytes);
        } catch (Exception e) {
            log.error("签名失败：{}",e);
            return null;
        }
        log.info("签名：{}",sign);
        return sign;
    }
}
*/
