|
@@ -187,7 +187,7 @@ public class VppDeviceServiceImpl implements VppDeviceService {
|
|
public ActivationVO activation(VerifyParam verifyParam) {
|
|
public ActivationVO activation(VerifyParam verifyParam) {
|
|
ActivationVO activationVO = new ActivationVO();
|
|
ActivationVO activationVO = new ActivationVO();
|
|
// 查询序列码信息
|
|
// 查询序列码信息
|
|
- List<LicenseCodesVO> licenseCodes = licenseCodeService.getWithInfo(verifyParam.getCdkey());
|
|
|
|
|
|
+ List<LicenseCodesVO> licenseCodes = licenseCodeService.getWithInfo(verifyParam.getSubscription().getCdkey());
|
|
if (CollectionUtils.isEmpty(licenseCodes)) {
|
|
if (CollectionUtils.isEmpty(licenseCodes)) {
|
|
throw new BackendRuntimeException(VppDeviceConstant.EXCEPTION_MSG_INVALID_LICENSE_KEY);
|
|
throw new BackendRuntimeException(VppDeviceConstant.EXCEPTION_MSG_INVALID_LICENSE_KEY);
|
|
}
|
|
}
|
|
@@ -213,8 +213,8 @@ public class VppDeviceServiceImpl implements VppDeviceService {
|
|
// 查询设备是否已激活
|
|
// 查询设备是否已激活
|
|
DevicesExample devicesExample = new DevicesExample();
|
|
DevicesExample devicesExample = new DevicesExample();
|
|
devicesExample.createCriteria()
|
|
devicesExample.createCriteria()
|
|
- .andUniqueSnEqualTo(verifyParam.getUniqueSn())
|
|
|
|
- .andCdkeyEqualTo(verifyParam.getCdkey())
|
|
|
|
|
|
+ .andUniqueSnEqualTo(verifyParam.getDevice().getUniqueSn())
|
|
|
|
+ .andCdkeyEqualTo(verifyParam.getSubscription().getCdkey())
|
|
.andStatusIn(new ArrayList<>(activeStatuses));
|
|
.andStatusIn(new ArrayList<>(activeStatuses));
|
|
List<Devices> list = extVppDeviceMapper.selectByExample(devicesExample);
|
|
List<Devices> list = extVppDeviceMapper.selectByExample(devicesExample);
|
|
|
|
|
|
@@ -230,7 +230,7 @@ public class VppDeviceServiceImpl implements VppDeviceService {
|
|
}
|
|
}
|
|
|
|
|
|
// 验证序列码的应用程序代码和激活请求的应用程序代码是否一致
|
|
// 验证序列码的应用程序代码和激活请求的应用程序代码是否一致
|
|
- if (!Objects.equals(licenseCodesVO.getAppCode(), verifyParam.getAppCode())) {
|
|
|
|
|
|
+ if (!Objects.equals(licenseCodesVO.getAppCode(), verifyParam.getSubscription().getAppCode())) {
|
|
throw new BackendRuntimeException(VppDeviceConstant.EXCEPTION_MSG_LICENSE_NOT_MATCH_PRODUCT);
|
|
throw new BackendRuntimeException(VppDeviceConstant.EXCEPTION_MSG_LICENSE_NOT_MATCH_PRODUCT);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -253,7 +253,7 @@ public class VppDeviceServiceImpl implements VppDeviceService {
|
|
// 查询设备状态列表
|
|
// 查询设备状态列表
|
|
DevicesExample devicesExample1 = new DevicesExample();
|
|
DevicesExample devicesExample1 = new DevicesExample();
|
|
devicesExample1.createCriteria()
|
|
devicesExample1.createCriteria()
|
|
- .andUniqueSnEqualTo(verifyParam.getUniqueSn())
|
|
|
|
|
|
+ .andUniqueSnEqualTo(verifyParam.getDevice().getUniqueSn())
|
|
.andAppIdEqualTo(licenseCodesVO.getAppId())
|
|
.andAppIdEqualTo(licenseCodesVO.getAppId())
|
|
.andStatusIn(new ArrayList<>(activeStatuses));
|
|
.andStatusIn(new ArrayList<>(activeStatuses));
|
|
List<Devices> statusDevicelist = extVppDeviceMapper.selectByExample(devicesExample1);
|
|
List<Devices> statusDevicelist = extVppDeviceMapper.selectByExample(devicesExample1);
|
|
@@ -264,7 +264,7 @@ public class VppDeviceServiceImpl implements VppDeviceService {
|
|
devices.setAppId(licenseCodesVO.getAppId());
|
|
devices.setAppId(licenseCodesVO.getAppId());
|
|
devices.setEndUpAt(licenseCodesVO.getEndUpAt());
|
|
devices.setEndUpAt(licenseCodesVO.getEndUpAt());
|
|
devices.setMemberId(licenseCodesVO.getMemberId());
|
|
devices.setMemberId(licenseCodesVO.getMemberId());
|
|
- PlatformEnum platformEnum = PlatformEnum.getEnumByCode(verifyParam.getPlatform());
|
|
|
|
|
|
+ PlatformEnum platformEnum = PlatformEnum.getEnumByCode(verifyParam.getDevice().getPlatform());
|
|
devices.setPlatform(platformEnum.code());
|
|
devices.setPlatform(platformEnum.code());
|
|
devices.setSubscriptionId(licenseCodesVO.getSubscriptionId());
|
|
devices.setSubscriptionId(licenseCodesVO.getSubscriptionId());
|
|
devices.setStatus(DeviceStatusEnum.ACTIVE.code());
|
|
devices.setStatus(DeviceStatusEnum.ACTIVE.code());
|
|
@@ -309,28 +309,28 @@ public class VppDeviceServiceImpl implements VppDeviceService {
|
|
// 查询设备是否已激活
|
|
// 查询设备是否已激活
|
|
DevicesExample devicesExample = new DevicesExample();
|
|
DevicesExample devicesExample = new DevicesExample();
|
|
devicesExample.createCriteria()
|
|
devicesExample.createCriteria()
|
|
- .andUniqueSnEqualTo(verifyParam.getUniqueSn());
|
|
|
|
|
|
+ .andUniqueSnEqualTo(verifyParam.getDevice().getUniqueSn());
|
|
List<Devices> list = extVppDeviceMapper.selectByExample(devicesExample);
|
|
List<Devices> list = extVppDeviceMapper.selectByExample(devicesExample);
|
|
Devices devices = new Devices();
|
|
Devices devices = new Devices();
|
|
DeviceResVO deviceResVO = new DeviceResVO();
|
|
DeviceResVO deviceResVO = new DeviceResVO();
|
|
if(!CollectionUtils.isEmpty(list)){
|
|
if(!CollectionUtils.isEmpty(list)){
|
|
- devices.setAppVersion(verifyParam.getAppVersion());
|
|
|
|
|
|
+ devices.setAppVersion(verifyParam.getDevice().getAppVersion());
|
|
devices.setId(list.get(0).getId());
|
|
devices.setId(list.get(0).getId());
|
|
extVppDeviceMapper.updateByPrimaryKeySelective(devices);
|
|
extVppDeviceMapper.updateByPrimaryKeySelective(devices);
|
|
}else{
|
|
}else{
|
|
// 新增设备
|
|
// 新增设备
|
|
AppsExample example = new AppsExample();
|
|
AppsExample example = new AppsExample();
|
|
- example.createCriteria().andCodeEqualTo(verifyParam.getAppCode());
|
|
|
|
|
|
+ example.createCriteria().andCodeEqualTo(verifyParam.getSubscription().getAppCode());
|
|
List<Apps> apps = appsMapper.selectByExample(example);
|
|
List<Apps> apps = appsMapper.selectByExample(example);
|
|
if (!CollectionUtils.isEmpty(apps)) {
|
|
if (!CollectionUtils.isEmpty(apps)) {
|
|
devices.setAppId(apps.get(0).getId());
|
|
devices.setAppId(apps.get(0).getId());
|
|
}
|
|
}
|
|
- devices.setAppVersion(verifyParam.getAppVersion());
|
|
|
|
- devices.setModel(verifyParam.getModel());
|
|
|
|
- devices.setOs(verifyParam.getOs());
|
|
|
|
- devices.setUniqueSn(verifyParam.getUniqueSn());
|
|
|
|
- devices.setTimeZone(verifyParam.getTimeZone());
|
|
|
|
- PlatformEnum platformEnum = PlatformEnum.getEnumByCode(verifyParam.getPlatform());
|
|
|
|
|
|
+ devices.setAppVersion(verifyParam.getDevice().getAppVersion());
|
|
|
|
+ devices.setModel(verifyParam.getDevice().getModel());
|
|
|
|
+ devices.setOs(verifyParam.getDevice().getOs());
|
|
|
|
+ devices.setUniqueSn(verifyParam.getDevice().getUniqueSn());
|
|
|
|
+ devices.setTimeZone(verifyParam.getDevice().getTimeZone());
|
|
|
|
+ PlatformEnum platformEnum = PlatformEnum.getEnumByCode(verifyParam.getDevice().getPlatform());
|
|
devices.setPlatform(platformEnum.code());
|
|
devices.setPlatform(platformEnum.code());
|
|
devices.setStatus(DeviceStatusEnum.UNACTIVATED.code());
|
|
devices.setStatus(DeviceStatusEnum.UNACTIVATED.code());
|
|
devices.setIsVpp(Short.valueOf("2"));
|
|
devices.setIsVpp(Short.valueOf("2"));
|
|
@@ -338,7 +338,7 @@ public class VppDeviceServiceImpl implements VppDeviceService {
|
|
}
|
|
}
|
|
deviceResVO.setStatus(Objects.requireNonNull(DeviceStatusEnum.getEnumByCode(devices.getStatus())).value());
|
|
deviceResVO.setStatus(Objects.requireNonNull(DeviceStatusEnum.getEnumByCode(devices.getStatus())).value());
|
|
if(list.size()>0&&list.get(0).getStatus().equals(DeviceStatusEnum.ACTIVE.code())){
|
|
if(list.size()>0&&list.get(0).getStatus().equals(DeviceStatusEnum.ACTIVE.code())){
|
|
- List<LicenseCodesVO> licenseCodes = licenseCodeService.getWithInfo(verifyParam.getCdkey());
|
|
|
|
|
|
+ List<LicenseCodesVO> licenseCodes = licenseCodeService.getWithInfo(verifyParam.getSubscription().getCdkey());
|
|
if (CollectionUtils.isEmpty(licenseCodes)) {
|
|
if (CollectionUtils.isEmpty(licenseCodes)) {
|
|
throw new BackendRuntimeException(VppDeviceConstant.EXCEPTION_MSG_INVALID_LICENSE_KEY);
|
|
throw new BackendRuntimeException(VppDeviceConstant.EXCEPTION_MSG_INVALID_LICENSE_KEY);
|
|
}
|
|
}
|