Browse Source

提供测试解码

tanzhongran 3 years ago
parent
commit
52cc1292ad

+ 23 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/controller/special/QrPackageTestController.java

@@ -5,13 +5,17 @@ import com.abi.platform.Base.BaseResponse;
 import com.abi.qms.platform.annotation.PassToken;
 import com.abi.qms.platform.dao.entity.QrPackage;
 import com.abi.qms.platform.dao.mapper.QrPackageMapper;
+import com.abi.qms.platform.dto.req.DecodeForTestReq;
 import com.abi.qms.platform.dto.req.GetQrPackageForTestReq;
+import com.abi.qms.platform.dto.res.DecodeForTestRes;
 import com.abi.qms.platform.dto.res.GetQrPackageForTestRes;
+import com.abi.qms.platform.infrastructure.util.AesEncodeUtil;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -38,6 +42,9 @@ public class QrPackageTestController {
     @Autowired
     private RedisClient redisClient;
 
+    @Value("${spring.profiles.active}")
+    private String active;
+
     @ApiOperation("测试获取码包信息")
     @GetMapping("getQrPackageForTest")
     @PassToken
@@ -62,6 +69,22 @@ public class QrPackageTestController {
         return BaseResponse.create(res);
     }
 
+    @Value("${qms.encode.key}")
+    private String encodeKey;
+
+    @ApiOperation("解密")
+    @GetMapping("decodeForTest")
+    @PassToken
+    public BaseResponse<DecodeForTestRes> decodeForTest(@Validated DecodeForTestReq req) throws Exception{
+        //解密
+        String decodeContent = AesEncodeUtil.aesDecode(req.getContent(), encodeKey);
+
+        //包装出参
+        DecodeForTestRes result = new DecodeForTestRes();
+        result.setDecodeContent(decodeContent);
+
+        return BaseResponse.create(result);
+    }
 
 
 }

+ 17 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/DecodeForTestReq.java

@@ -0,0 +1,17 @@
+package com.abi.qms.platform.dto.req;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import java.io.Serializable;
+
+/**
+ * @author:Andy.Tan
+ * @Description: 解密入参
+ */
+@Data
+@Schema
+public class DecodeForTestReq implements Serializable {
+
+    private String content;
+
+}

+ 21 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/res/DecodeForTestRes.java

@@ -0,0 +1,21 @@
+package com.abi.qms.platform.dto.res;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+/**
+ * @author:Andy.Tan
+ * @Description: 解密出参
+ */
+@Data
+@Schema
+public class DecodeForTestRes implements Serializable {
+
+    private String decodeContent;
+
+}