puzhibing
2024-01-30 80b3ea5587ff7ec20541d9ca7c6c28739e4d615b
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/util/SignUtil.java
@@ -73,47 +73,15 @@
    private static String byteArrayToString(byte[] byteArray){
        StringBuilder strBuilder = new StringBuilder();
        for (int i = 0; i < byteArray.length; i++) {
            if (Integer.toHexString(0xFF & byteArray[i]).length() == 1)
            if (Integer.toHexString(0xFF & byteArray[i]).length() == 1) {
                strBuilder.append("0").append(Integer.toHexString(0xFF & byteArray[i]));
            else
            } else {
                strBuilder.append(Integer.toHexString(0xFF & byteArray[i]));
            }
        }
        return strBuilder.toString();
    }
//    public static void main(String[] args) {
        //Get
        /*Long time = new Date().getTime();
        Map<String, Object> map = new HashMap<>();
        map.put("client_id","f168c651bf86f2c1");
        map.put("timestamp",time);
        map.put("longitude","120.10");
        map.put("latitude","30.19");
        String url = "https://sandbox-cop.caocaokeji.cn/v2/common/queryCity";
        String response = PlatformUtil.doGet(url,"client_id=f168c651bf86f2c1&timestamp="+time+"&sign="+SignUtil.sign(map)+"&longitude=120.10&latitude=30.19",null,100000);
        com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(response);
        System.out.println(jsonObject.toJSONString());*/
        //Post
       /* Map<String,Object> map = new HashMap<>();
        map.put("client_id","f168c651bf86f2c1");
        map.put("timestamp",new Date().getTime());
        map.put("order_id",1);
        map.put("score","3");
        map.put("content","测试数据");
        map.put("sign",SignUtil.sign(map));
        String jsonMsg =JSONObject.toJSONString(map);
        String url = "/v2/common/evaluateOrder";
        TokenUtil.RequestEntity req = new TokenUtil.RequestEntity();
        req.setReqMethod(TokenUtil.REQ_METHOD_POST);
        req.setUri(url);
        req.setContent(jsonMsg);
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        req.setReqTime(dateFormat.format(new Date()));
        String response = PlatformUtil.doPostJson1("https://sandbox-cop.caocaokeji.cn"+url,req.getContent(),null);
        System.out.println(JSONObject.parseObject(response));*/
//        System.out.println(new Date().getTime());
//
//    }
}