Commit d6da180a by 魏建枢

设备IDv0版本

parent 3daa838d
package com.cloud.udf.util;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import com.cloud.udf.vo.device.android.AndroidCollectionBody;
import com.cloud.udf.vo.device.android.deviceInfo.AndroidA1;
import com.cloud.udf.vo.device.android.deviceInfo.D3;
import com.cloud.udf.vo.device.ios.IosCollectionBody;
import com.cloud.udf.vo.device.ios.IosDeviceInfo;
/**
* @author wjs
* @version 创建时间:2025-3-25 17:53:21
* 类说明
*/
public class GenDeviceIdV0 {
private final static String SALT = "yylmfy6iehjzmq";
public static String genAndroidDeviceIdHashV1(AndroidCollectionBody androidBodyObj) {
System.out.println("GenDeviceIdV1 genAndroidDeviceIdHashV1 start!");
StringBuilder sbD3 = new StringBuilder();
StringBuilder sbDevicId = new StringBuilder();
AndroidA1 a1 = new AndroidA1();
List<D3> d3List = new ArrayList<>();
if(androidBodyObj != null) {
a1 = androidBodyObj.getA1();
if(a1 != null) {
d3List = a1.getD3();
if(CollectionUtils.isEmpty(d3List)) {
d3List = new ArrayList<>();
}
}else {
a1 = new AndroidA1();
}
}
for (D3 d3 : d3List) {
sbD3.append(d3.toString()).append(":");
}
sbDevicId.append(a1.getB6()).append("/");
sbDevicId.append(a1.getB2()).append("/");
sbDevicId.append(a1.getB15()).append("/");
sbDevicId.append(a1.getB1()).append("/");
sbDevicId.append(a1.getB3()).append("/");
sbDevicId.append(a1.getB14()).append("/");
sbDevicId.append(a1.getB8()).append("/");
// sbDevicId.append(Build.FINGERPRINT).append("/");
sbDevicId.append(a1.getD4().split("&")[0]).append("/");
sbDevicId.append(a1.getC3()).append("/");
System.out.println("GenDeviceIdV1 genAndroidDeviceIdHashV1 end! body:"+null + ":" + sbD3.toString() + ":" + sbDevicId.toString());
return Md5Utils.string2MD5(null + ":" + sbD3.toString() + ":" + sbDevicId.toString());
}
public static String genIosDeviceIdHash(IosCollectionBody iosBodyObj) {
System.out.println("GenDeviceIdV1 genIosDeviceIdHash start!");
StringBuilder sb = new StringBuilder();
IosDeviceInfo a1 = new IosDeviceInfo();
if(null != iosBodyObj) {
a1 = iosBodyObj.getA1();
if(null == a1) {
a1 = new IosDeviceInfo();
}
}
sb.append(a1.getAp1())
.append(a1.getAp5())
;
System.out.println("GenDeviceIdV1 genIosDeviceIdHash end! body:"+sb.toString());
return (HashUtil.genKeyHash(sb.toString())+SALT).toLowerCase();
}
}
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 sign in to comment