parent
e1648c1203
commit
5c8f3210ad
|
@ -18,6 +18,7 @@ import com.dispose.pojo.dto.protocol.device.ability.DpProtectionStrategyInfo;
|
||||||
import com.dispose.pojo.dto.protocol.device.ability.DpTractionStrategy;
|
import com.dispose.pojo.dto.protocol.device.ability.DpTractionStrategy;
|
||||||
import com.dispose.pojo.entity.ServiceInfo;
|
import com.dispose.pojo.entity.ServiceInfo;
|
||||||
import com.dispose.pojo.po.MulReturnType;
|
import com.dispose.pojo.po.MulReturnType;
|
||||||
|
import com.dispose.security.arithmetic.CryptoHelper;
|
||||||
import com.dptech.dispose.ArrayOfBypassManualTractionStrategyForService;
|
import com.dptech.dispose.ArrayOfBypassManualTractionStrategyForService;
|
||||||
import com.dptech.dispose.ArrayOfProtectionObjectDataForService;
|
import com.dptech.dispose.ArrayOfProtectionObjectDataForService;
|
||||||
import com.dptech.dispose.ArrayOfProtectionTargetWithStrategyForService;
|
import com.dptech.dispose.ArrayOfProtectionTargetWithStrategyForService;
|
||||||
|
@ -25,6 +26,7 @@ import com.dptech.dispose.NtcRequestResultInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -42,6 +44,10 @@ import java.util.stream.Collectors;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Traction strategy name.
|
||||||
|
*/
|
||||||
|
private Long tractionStrategyName = System.currentTimeMillis() / 1000;
|
||||||
/**
|
/**
|
||||||
* The Dispose object cache.
|
* The Dispose object cache.
|
||||||
*/
|
*/
|
||||||
|
@ -638,7 +644,18 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
||||||
* @return the traction strategy name
|
* @return the traction strategy name
|
||||||
*/
|
*/
|
||||||
private String getTractionStrategyName(String disposeIp) {
|
private String getTractionStrategyName(String disposeIp) {
|
||||||
return objectPrefix + "_" + disposeIp;
|
|
||||||
|
String tsName = objectPrefix + "_" + disposeIp;
|
||||||
|
|
||||||
|
if(tsName.length() >= 16) {
|
||||||
|
try {
|
||||||
|
tsName = objectPrefix + "_" + CryptoHelper.md5Encryption(disposeIp).substring(0, 14);
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
tsName = objectPrefix + "_" + tractionStrategyName++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tsName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -73,6 +73,19 @@ public class CryptoHelper {
|
||||||
return messageDigest.digest();
|
return messageDigest.digest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Md 5 encryption string.
|
||||||
|
*
|
||||||
|
* @param plaintext the plaintext
|
||||||
|
* @return the string
|
||||||
|
* @throws NoSuchAlgorithmException the no such algorithm exception
|
||||||
|
*/
|
||||||
|
public static String md5Encryption(String plaintext) throws NoSuchAlgorithmException {
|
||||||
|
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
|
||||||
|
messageDigest.update(plaintext.getBytes(StandardCharsets.UTF_8));
|
||||||
|
return new String(messageDigest.digest());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Aes 128 encryption byte [ ].
|
* Aes 128 encryption byte [ ].
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue