Ver código fonte

私有化部署:更新接口

tangxiangan 10 meses atrás
pai
commit
bcbd160835

+ 1 - 1
pdf-tech-core/src/main/java/cn/kdan/pdf/tech/core/controller/VppDeviceController.java

@@ -108,7 +108,7 @@ public class VppDeviceController {
         return new ResultMap<>(CommonConstant.SUCCESS, VppDeviceConstant.SUCCESS_MSG_Canceled,Boolean.TRUE);
     }
 
-    @PostMapping("/activation")
+    @PostMapping("/activate")
     public ResultMap<ActivationVO> activation(@RequestBody VerifyParam verifyParam) {
         return new ResultMap<>(CommonConstant.SUCCESS, VppDeviceConstant.SUCCESS_ACTIVATION_SUCCESS,vppDeviceService.activation(verifyParam));
     }

+ 20 - 0
pdf-tech-core/src/main/java/cn/kdan/pdf/tech/core/params/DeviceParam.java

@@ -0,0 +1,20 @@
+package cn.kdan.pdf.tech.core.params;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class DeviceParam {
+    private String uniqueSn;
+    private String appVersion;
+    private String platform;
+    private String language;
+    private String timeZone;
+    private String os;
+    private String model;
+}

+ 15 - 0
pdf-tech-core/src/main/java/cn/kdan/pdf/tech/core/params/SubscriptionParam.java

@@ -0,0 +1,15 @@
+package cn.kdan.pdf.tech.core.params;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class SubscriptionParam {
+    private String appCode;
+    private String cdkey;
+}

+ 2 - 9
pdf-tech-core/src/main/java/cn/kdan/pdf/tech/core/params/VerifyParam.java

@@ -10,13 +10,6 @@ import lombok.NoArgsConstructor;
 @AllArgsConstructor
 @NoArgsConstructor
 public class VerifyParam {
-    private String appCode;
-    private String cdkey;
-    private String uniqueSn;
-    private String appVersion;
-    private String platform;
-    private String language;
-    private String timeZone;
-    private String os;
-    private String model;
+    private SubscriptionParam subscription;
+    private DeviceParam device;
 }

+ 16 - 16
pdf-tech-core/src/main/java/cn/kdan/pdf/tech/core/service/impl/VppDeviceServiceImpl.java

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