fix:设备激活

This commit is contained in:
xydkj 2026-05-21 11:48:05 +08:00
parent 2154320065
commit 929b36d1e3

View File

@ -111,10 +111,22 @@ public class MasterKeyActivateServiceImpl implements MasterKeyActivateService {
MasterKeyActivateEntity masterKeyActivateEntity = masterKeyActivateRepository.find().orElseThrow(() -> new BizException(ErrorCode.VALIDATE_FAILED.getCode(), "激活记录不存在"));
Boolean everInitialized = masterKeyActivateEntity.getEverInitialized();
Boolean activationStatus = masterKeyActivateEntity.getActivationStatus();
if (everInitialized) {
throw new BizException(ErrorCode.BIZ_ERROR.getCode(), "从未进行初始化密钥, 无需激活");
throw new BizException(ErrorCode.BIZ_ERROR.getCode(), "从未进行初始化密钥, 无需激活");
}
DeviceInfoResponse deviceInfoResponse = deviceService.info();
if (deviceInfoResponse.getMasterKeyStatus()){
throw new BizException(ErrorCode.BIZ_ERROR.getCode(), "设备存在主密钥, 无需激活");
}
if (activationStatus) {
throw new BizException(ErrorCode.BIZ_ERROR.getCode(), "设备已激活, 无需激活");
}
if (masterKeyActivateRequest.getUserId() == null){
throw new IllegalArgumentException("使用者ID不能为空");
}