diff --git a/fastbee-admin/pom.xml b/fastbee-admin/pom.xml
index c1b4449e..dc937c52 100644
--- a/fastbee-admin/pom.xml
+++ b/fastbee-admin/pom.xml
@@ -120,17 +120,17 @@
caffeine
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
com.fastbee
diff --git a/fastbee-admin/src/main/java/com/fastbee/FastBeeApplication.java b/fastbee-admin/src/main/java/com/fastbee/FastBeeApplication.java
index cc65908a..8f589952 100644
--- a/fastbee-admin/src/main/java/com/fastbee/FastBeeApplication.java
+++ b/fastbee-admin/src/main/java/com/fastbee/FastBeeApplication.java
@@ -11,10 +11,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
*/
@SpringBootApplication
@ForestScan(basePackages = "com.fastbee")
-public class FastBeeApplication
-{
- public static void main(String[] args)
- {
+public class FastBeeApplication {
+ public static void main(String[] args) {
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(FastBeeApplication.class, args);
}
diff --git a/fastbee-admin/src/main/java/com/fastbee/FastBeeServletInitializer.java b/fastbee-admin/src/main/java/com/fastbee/FastBeeServletInitializer.java
index 76586e58..ff844a75 100644
--- a/fastbee-admin/src/main/java/com/fastbee/FastBeeServletInitializer.java
+++ b/fastbee-admin/src/main/java/com/fastbee/FastBeeServletInitializer.java
@@ -5,14 +5,12 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
/**
* web容器中进行部署
- *
+ *
* @author ruoyi
*/
-public class FastBeeServletInitializer extends SpringBootServletInitializer
-{
+public class FastBeeServletInitializer extends SpringBootServletInitializer {
@Override
- protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
- {
+ protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(FastBeeApplication.class);
}
}
diff --git a/fastbee-admin/src/main/java/com/fastbee/web/controller/common/CaptchaController.java b/fastbee-admin/src/main/java/com/fastbee/web/controller/common/CaptchaController.java
index 78c00b69..ed8a3cc9 100644
--- a/fastbee-admin/src/main/java/com/fastbee/web/controller/common/CaptchaController.java
+++ b/fastbee-admin/src/main/java/com/fastbee/web/controller/common/CaptchaController.java
@@ -1,19 +1,5 @@
package com.fastbee.web.controller.common;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-import javax.annotation.Resource;
-import javax.imageio.ImageIO;
-import javax.servlet.http.HttpServletResponse;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.FastByteArrayOutputStream;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.google.code.kaptcha.Producer;
import com.fastbee.common.config.RuoYiConfig;
import com.fastbee.common.constant.CacheConstants;
import com.fastbee.common.constant.Constants;
@@ -22,6 +8,20 @@ import com.fastbee.common.core.redis.RedisCache;
import com.fastbee.common.utils.sign.Base64;
import com.fastbee.common.utils.uuid.IdUtils;
import com.fastbee.system.service.ISysConfigService;
+import com.google.code.kaptcha.Producer;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.FastByteArrayOutputStream;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletResponse;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
/**
* 验证码操作处理
@@ -30,8 +30,7 @@ import com.fastbee.system.service.ISysConfigService;
*/
@Api(tags = "验证码操作")
@RestController
-public class CaptchaController
-{
+public class CaptchaController {
@Resource(name = "captchaProducer")
private Producer captchaProducer;
@@ -43,18 +42,17 @@ public class CaptchaController
@Autowired
private ISysConfigService configService;
+
/**
* 生成验证码
*/
@ApiOperation("获取验证码")
@GetMapping("/captchaImage")
- public AjaxResult getCode(HttpServletResponse response,Boolean showCode) throws IOException
- {
+ public AjaxResult getCode(HttpServletResponse response, Boolean showCode) throws IOException {
AjaxResult ajax = AjaxResult.success();
boolean captchaEnabled = configService.selectCaptchaEnabled();
ajax.put("captchaEnabled", captchaEnabled);
- if (!captchaEnabled)
- {
+ if (!captchaEnabled) {
return ajax;
}
@@ -67,15 +65,12 @@ public class CaptchaController
// 生成验证码
String captchaType = RuoYiConfig.getCaptchaType();
- if ("math".equals(captchaType))
- {
+ if ("math".equals(captchaType)) {
String capText = captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@"));
code = capText.substring(capText.lastIndexOf("@") + 1);
image = captchaProducerMath.createImage(capStr);
- }
- else if ("char".equals(captchaType))
- {
+ } else if ("char".equals(captchaType)) {
capStr = code = captchaProducer.createText();
image = captchaProducer.createImage(capStr);
}
@@ -83,12 +78,9 @@ public class CaptchaController
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
// 转换流信息写出
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
- try
- {
+ try {
ImageIO.write(image, "jpg", os);
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
return AjaxResult.error(e.getMessage());
}
if (Boolean.TRUE.equals(showCode)) {
diff --git a/fastbee-admin/src/main/java/com/fastbee/web/controller/common/CommonController.java b/fastbee-admin/src/main/java/com/fastbee/web/controller/common/CommonController.java
index a66d3b5e..e2210c8f 100644
--- a/fastbee-admin/src/main/java/com/fastbee/web/controller/common/CommonController.java
+++ b/fastbee-admin/src/main/java/com/fastbee/web/controller/common/CommonController.java
@@ -1,14 +1,14 @@
package com.fastbee.web.controller.common;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
+import com.fastbee.common.config.RuoYiConfig;
+import com.fastbee.common.constant.Constants;
+import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.common.utils.MessageUtils;
+import com.fastbee.common.utils.StringUtils;
+import com.fastbee.common.utils.file.FileUploadUtils;
+import com.fastbee.common.utils.file.FileUtils;
import com.fastbee.common.utils.file.QRCodeUtils;
+import com.fastbee.framework.config.ServerConfig;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import io.swagger.annotations.Api;
@@ -22,13 +22,13 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
-import com.fastbee.common.config.RuoYiConfig;
-import com.fastbee.common.constant.Constants;
-import com.fastbee.common.core.domain.AjaxResult;
-import com.fastbee.common.utils.StringUtils;
-import com.fastbee.common.utils.file.FileUploadUtils;
-import com.fastbee.common.utils.file.FileUtils;
-import com.fastbee.framework.config.ServerConfig;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
/**
* 通用请求处理
@@ -38,8 +38,7 @@ import com.fastbee.framework.config.ServerConfig;
@Api(tags = "通用请求处理")
@RestController
@RequestMapping("/common")
-public class CommonController
-{
+public class CommonController {
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@Autowired
@@ -51,16 +50,13 @@ public class CommonController
* 通用下载请求
*
* @param fileName 文件名称
- * @param delete 是否删除
+ * @param delete 是否删除
*/
@ApiOperation("文件下载")
@GetMapping("/download")
- public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
- {
- try
- {
- if (!FileUtils.checkAllowDownload(fileName))
- {
+ public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
+ try {
+ if (!FileUtils.checkAllowDownload(fileName)) {
throw new Exception(StringUtils.format(MessageUtils.message("download.filename.not.valid"), fileName));
}
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
@@ -69,13 +65,10 @@ public class CommonController
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, realFileName);
FileUtils.writeBytes(filePath, response.getOutputStream());
- if (delete)
- {
+ if (delete) {
FileUtils.deleteFile(filePath);
}
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
log.error("下载文件失败", e);
}
}
@@ -85,10 +78,8 @@ public class CommonController
*/
@ApiOperation("单个文件上传")
@PostMapping("/upload")
- public AjaxResult uploadFile(MultipartFile file) throws Exception
- {
- try
- {
+ public AjaxResult uploadFile(MultipartFile file) throws Exception {
+ try {
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称
@@ -100,9 +91,7 @@ public class CommonController
ajax.put("newFileName", FileUtils.getName(fileName));
ajax.put("originalFilename", file.getOriginalFilename());
return ajax;
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
@@ -112,18 +101,15 @@ public class CommonController
*/
@ApiOperation("多个文件上传")
@PostMapping("/uploads")
- public AjaxResult uploadFiles(List files) throws Exception
- {
- try
- {
+ public AjaxResult uploadFiles(List files) throws Exception {
+ try {
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
List urls = new ArrayList();
List fileNames = new ArrayList();
List newFileNames = new ArrayList();
List originalFilenames = new ArrayList();
- for (MultipartFile file : files)
- {
+ for (MultipartFile file : files) {
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
@@ -138,9 +124,7 @@ public class CommonController
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
return ajax;
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
@@ -151,12 +135,9 @@ public class CommonController
@GetMapping("/download/resource")
@ApiOperation("本地资源通用下载")
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
- throws Exception
- {
- try
- {
- if (!FileUtils.checkAllowDownload(resource))
- {
+ throws Exception {
+ try {
+ if (!FileUtils.checkAllowDownload(resource)) {
throw new Exception(StringUtils.format(MessageUtils.message("download.resource.not.valid"), resource));
}
// 本地资源路径
@@ -168,18 +149,16 @@ public class CommonController
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream());
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
log.error("下载文件失败", e);
}
}
/**
- * 生成二维码
+ * 生成二维码
+ *
* @param url url
-
- * */
+ */
@GetMapping(value = "/createQrCode")
@ApiOperation("根据url生成二维码")
public void getCode(String url, HttpServletResponse response) throws IOException {
@@ -194,6 +173,6 @@ public class CommonController
//获取一个二维码图片
BitMatrix bitMatrix = QRCodeUtils.createCode(url);
//以流的形式输出到前端
- MatrixToImageWriter.writeToStream(bitMatrix , "jpg" , stream);
+ MatrixToImageWriter.writeToStream(bitMatrix, "jpg", stream);
}
}
diff --git a/fastbee-admin/src/main/java/com/fastbee/web/controller/monitor/CacheController.java b/fastbee-admin/src/main/java/com/fastbee/web/controller/monitor/CacheController.java
index 2962d53c..7856ca18 100644
--- a/fastbee-admin/src/main/java/com/fastbee/web/controller/monitor/CacheController.java
+++ b/fastbee-admin/src/main/java/com/fastbee/web/controller/monitor/CacheController.java
@@ -1,28 +1,18 @@
package com.fastbee.web.controller.monitor;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
+import com.fastbee.common.constant.CacheConstants;
+import com.fastbee.common.core.domain.AjaxResult;
+import com.fastbee.common.utils.StringUtils;
+import com.fastbee.system.domain.SysCache;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.fastbee.common.constant.CacheConstants;
-import com.fastbee.common.core.domain.AjaxResult;
-import com.fastbee.common.utils.StringUtils;
-import com.fastbee.system.domain.SysCache;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
/**
* 缓存监控
@@ -32,12 +22,12 @@ import com.fastbee.system.domain.SysCache;
@Api(tags = "缓存监控")
@RestController
@RequestMapping("/monitor/cache")
-public class CacheController
-{
+public class CacheController {
@Autowired
private RedisTemplate redisTemplate;
private final static List caches = new ArrayList();
+
{
caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
@@ -51,8 +41,7 @@ public class CacheController
@ApiOperation("获取缓存信息")
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping()
- public AjaxResult getInfo() throws Exception
- {
+ public AjaxResult getInfo() throws Exception {
Properties info = (Properties) redisTemplate.execute((RedisCallback