|
@@ -14,6 +14,7 @@ import cn.kdan.pdf.tech.core.pojo.vo.*;
|
|
import cn.kdan.pdf.tech.core.service.*;
|
|
import cn.kdan.pdf.tech.core.service.*;
|
|
import cn.kdan.pdf.tech.core.utils.ThreadPoolSingleUtil;
|
|
import cn.kdan.pdf.tech.core.utils.ThreadPoolSingleUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
import constant.CommonConstant;
|
|
import constant.CommonConstant;
|
|
@@ -183,6 +184,7 @@ public class VppDeviceServiceImpl implements VppDeviceService {
|
|
return extVppDeviceMapper.selectByExample(devicesExample);
|
|
return extVppDeviceMapper.selectByExample(devicesExample);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Transactional
|
|
@Override
|
|
@Override
|
|
public ActivationVO activation(VerifyParam verifyParam) {
|
|
public ActivationVO activation(VerifyParam verifyParam) {
|
|
ActivationVO activationVO = new ActivationVO();
|
|
ActivationVO activationVO = new ActivationVO();
|
|
@@ -197,8 +199,7 @@ public class VppDeviceServiceImpl implements VppDeviceService {
|
|
String sign = licenseCodesVO.getSign();
|
|
String sign = licenseCodesVO.getSign();
|
|
VppPrivateDeployment deployment = new VppPrivateDeployment();
|
|
VppPrivateDeployment deployment = new VppPrivateDeployment();
|
|
BeanUtils.copyProperties(licenseCodesVO, deployment);
|
|
BeanUtils.copyProperties(licenseCodesVO, deployment);
|
|
- //将对象转化为json
|
|
|
|
- String deploymentJson = JSON.toJSONString(deployment) + "vpp_private_deployment";
|
|
|
|
|
|
+ String deploymentJson = deployment.toJSON() + "vpp_private_deployment";
|
|
//对上述json进行MD5加密并且和sign对比
|
|
//对上述json进行MD5加密并且和sign对比
|
|
String signOriginal = DigestUtils.md5Hex(deploymentJson);
|
|
String signOriginal = DigestUtils.md5Hex(deploymentJson);
|
|
if (!signOriginal.equals(sign)) {
|
|
if (!signOriginal.equals(sign)) {
|
|
@@ -257,10 +258,10 @@ public class VppDeviceServiceImpl implements VppDeviceService {
|
|
.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);
|
|
-
|
|
|
|
|
|
+ Devices devices = new Devices();
|
|
if (CollectionUtils.isEmpty(statusDevicelist)) {
|
|
if (CollectionUtils.isEmpty(statusDevicelist)) {
|
|
// 新增设备
|
|
// 新增设备
|
|
- Devices devices = new Devices();
|
|
|
|
|
|
+ devices.setId(UUID.randomUUID().toString());
|
|
devices.setAppId(licenseCodesVO.getAppId());
|
|
devices.setAppId(licenseCodesVO.getAppId());
|
|
devices.setEndUpAt(licenseCodesVO.getEndUpAt());
|
|
devices.setEndUpAt(licenseCodesVO.getEndUpAt());
|
|
devices.setMemberId(licenseCodesVO.getMemberId());
|
|
devices.setMemberId(licenseCodesVO.getMemberId());
|
|
@@ -269,9 +270,14 @@ public class VppDeviceServiceImpl implements VppDeviceService {
|
|
devices.setSubscriptionId(licenseCodesVO.getSubscriptionId());
|
|
devices.setSubscriptionId(licenseCodesVO.getSubscriptionId());
|
|
devices.setStatus(DeviceStatusEnum.ACTIVE.code());
|
|
devices.setStatus(DeviceStatusEnum.ACTIVE.code());
|
|
devices.setCdkey(licenseCodesVO.getCdkey());
|
|
devices.setCdkey(licenseCodesVO.getCdkey());
|
|
|
|
+ devices.setUniqueSn(verifyParam.getDevice().getUniqueSn());
|
|
devices.setActivatedDate(new Date());
|
|
devices.setActivatedDate(new Date());
|
|
devices.setIsVpp(Short.valueOf("2"));
|
|
devices.setIsVpp(Short.valueOf("2"));
|
|
|
|
+ devices.setCreatedAt(new Date());
|
|
|
|
+ devices.setUpdatedAt(new Date());
|
|
extVppDeviceMapper.insert(devices);
|
|
extVppDeviceMapper.insert(devices);
|
|
|
|
+ }else {
|
|
|
|
+ devices = statusDevicelist.get(0);
|
|
}
|
|
}
|
|
|
|
|
|
// 更新序列码的使用次数和有效标志
|
|
// 更新序列码的使用次数和有效标志
|
|
@@ -286,8 +292,8 @@ public class VppDeviceServiceImpl implements VppDeviceService {
|
|
licenseCodeService.updateByPrimaryKey(updateCode);
|
|
licenseCodeService.updateByPrimaryKey(updateCode);
|
|
|
|
|
|
// 返回设备信息
|
|
// 返回设备信息
|
|
- DeviceResVO deviceResVO = activationVO.getDevice();
|
|
|
|
- deviceResVO.setStatus(Objects.requireNonNull(DeviceStatusEnum.getEnumByCode(statusDevicelist.get(0).getStatus())).value());
|
|
|
|
|
|
+ DeviceResVO deviceResVO = new DeviceResVO();
|
|
|
|
+ deviceResVO.setStatus((Objects.requireNonNull(DeviceStatusEnum.getEnumByCode(devices.getStatus()))).value());
|
|
Products products = productService.getById(licenseCodesVO.getProductId());
|
|
Products products = productService.getById(licenseCodesVO.getProductId());
|
|
deviceResVO.setProductCode(products.getCode());
|
|
deviceResVO.setProductCode(products.getCode());
|
|
activationVO.setDevice(deviceResVO);
|
|
activationVO.setDevice(deviceResVO);
|
|
@@ -304,6 +310,7 @@ public class VppDeviceServiceImpl implements VppDeviceService {
|
|
extVppDeviceMapper.updateByExampleSelective(devices,devicesExample);
|
|
extVppDeviceMapper.updateByExampleSelective(devices,devicesExample);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Transactional
|
|
@Override
|
|
@Override
|
|
public ActivationVO verify(VerifyParam verifyParam) {
|
|
public ActivationVO verify(VerifyParam verifyParam) {
|
|
// 查询设备是否已激活
|
|
// 查询设备是否已激活
|
|
@@ -317,6 +324,7 @@ public class VppDeviceServiceImpl implements VppDeviceService {
|
|
devices.setAppVersion(verifyParam.getDevice().getAppVersion());
|
|
devices.setAppVersion(verifyParam.getDevice().getAppVersion());
|
|
devices.setId(list.get(0).getId());
|
|
devices.setId(list.get(0).getId());
|
|
extVppDeviceMapper.updateByPrimaryKeySelective(devices);
|
|
extVppDeviceMapper.updateByPrimaryKeySelective(devices);
|
|
|
|
+ devices = list.get(0);
|
|
}else{
|
|
}else{
|
|
// 新增设备
|
|
// 新增设备
|
|
AppsExample example = new AppsExample();
|
|
AppsExample example = new AppsExample();
|
|
@@ -325,6 +333,7 @@ public class VppDeviceServiceImpl implements VppDeviceService {
|
|
if (!CollectionUtils.isEmpty(apps)) {
|
|
if (!CollectionUtils.isEmpty(apps)) {
|
|
devices.setAppId(apps.get(0).getId());
|
|
devices.setAppId(apps.get(0).getId());
|
|
}
|
|
}
|
|
|
|
+ devices.setId(UUID.randomUUID().toString());
|
|
devices.setAppVersion(verifyParam.getDevice().getAppVersion());
|
|
devices.setAppVersion(verifyParam.getDevice().getAppVersion());
|
|
devices.setModel(verifyParam.getDevice().getModel());
|
|
devices.setModel(verifyParam.getDevice().getModel());
|
|
devices.setOs(verifyParam.getDevice().getOs());
|
|
devices.setOs(verifyParam.getDevice().getOs());
|
|
@@ -334,6 +343,8 @@ public class VppDeviceServiceImpl implements VppDeviceService {
|
|
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"));
|
|
|
|
+ devices.setCreatedAt(new Date());
|
|
|
|
+ devices.setUpdatedAt(new Date());
|
|
extVppDeviceMapper.insert(devices);
|
|
extVppDeviceMapper.insert(devices);
|
|
}
|
|
}
|
|
deviceResVO.setStatus(Objects.requireNonNull(DeviceStatusEnum.getEnumByCode(devices.getStatus())).value());
|
|
deviceResVO.setStatus(Objects.requireNonNull(DeviceStatusEnum.getEnumByCode(devices.getStatus())).value());
|