wjc
2023-06-28 989b4cf5a84e898e9682f8d9723a8ba1ff20c23b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.hdl.sdk.link.core.utils.mqtt;
 
/**
 * 住宅密钥获取工具类
 *
 * @author yangtao
 * @date 2021.2.26
 */
public class HouseIdSecretUtil {
 
    public static String getSecret(String homeId) {
        String temp = new StringBuffer().append(homeId).reverse().toString();
        if (temp.length() > 16) {
            return temp.substring(0, 16);
        }
        //长度不够16位用0补齐
        for (int i = temp.length(); i < 16; i++) {
            temp += "0";
        }
        return temp;
    }
 
    public static String getSecret(Long homeId) {
       return getSecret(homeId.toString());
    }
 
    public static void main(String[] args) {
        System.out.println(getSecret("1363358800782790658"));
    }
}