|
@@ -0,0 +1,71 @@
|
|
|
+package com.diagbot.web;
|
|
|
+
|
|
|
+import com.diagbot.annotation.SysLogger;
|
|
|
+import com.diagbot.dto.RespDTO;
|
|
|
+import com.diagbot.facade.RsaFacade;
|
|
|
+import com.diagbot.vo.EncryptVO;
|
|
|
+import com.diagbot.vo.DecodeVO;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @description: RSA加解密
|
|
|
+ * @author: zhoutg
|
|
|
+ * @date: 2019/11/21 10:56
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/rsa")
|
|
|
+@Api(value = "RSA加解密相关API", tags = { "RSA加解密相关API" })
|
|
|
+@SuppressWarnings("unchecked")
|
|
|
+public class RsaController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ RsaFacade rsaFacade;
|
|
|
+
|
|
|
+ @ApiOperation(value = "licence截止日期加密:[by:zhoutg]",
|
|
|
+ notes = "licence截止日期加密,格式如下:2019-12-31 12:00:00, 英文状态")
|
|
|
+ @PostMapping("/encryptLicenceExpire")
|
|
|
+ @SysLogger("encryptLicenceExpire")
|
|
|
+ public RespDTO<String> encryptLicenceExpire(@Valid @RequestBody EncryptVO encryptVO) {
|
|
|
+ encryptVO.setType(1);
|
|
|
+ String res = rsaFacade.encrypt(encryptVO);
|
|
|
+ return RespDTO.onSuc(res);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "licence剩余天数加密:[by:zhoutg]",
|
|
|
+ notes = "licence剩余天数加密,格式如下:365,纯数字")
|
|
|
+ @PostMapping("/encryptLicenceReamin")
|
|
|
+ @SysLogger("encryptLicenceReamin")
|
|
|
+ public RespDTO<String> encryptLicenceReamin(@Valid @RequestBody EncryptVO encryptVO) {
|
|
|
+ encryptVO.setType(2);
|
|
|
+ String res = rsaFacade.encrypt(encryptVO);
|
|
|
+ return RespDTO.onSuc(res);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "普通文本加密:[by:zhoutg]",
|
|
|
+ notes = "普通文本加密,格式如下:365,纯数字")
|
|
|
+ @PostMapping("/encrypt")
|
|
|
+ @SysLogger("encrypt")
|
|
|
+ public RespDTO<String> encrypt(@Valid @RequestBody EncryptVO encryptVO) {
|
|
|
+ String res = rsaFacade.encrypt(encryptVO);
|
|
|
+ return RespDTO.onSuc(res);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "解密:[by:zhoutg]", notes = "解密")
|
|
|
+ @PostMapping("/decode")
|
|
|
+ @SysLogger("decode")
|
|
|
+ public RespDTO<String> decode(@Valid @RequestBody DecodeVO decodeVO) {
|
|
|
+ String res = rsaFacade.decode(decodeVO);
|
|
|
+ return RespDTO.onSuc(res);
|
|
|
+ }
|
|
|
+}
|