test1(String key, String value){
- return AjaxResult.success("操作成功", value);
- }
+ /**
+ * 测试 @Cacheable
+ *
+ * 表示这个方法有了缓存的功能,方法的返回值会被缓存下来
+ * 下一次调用该方法前,会去检查是否缓存中已经有值
+ * 如果有就直接返回,不调用方法
+ * 如果没有,就调用方法,然后把结果缓存起来
+ * 这个注解「一般用在查询方法上」
+ *
+ * 重点说明: 缓存注解严谨与其他筛选数据功能一起使用
+ * 例如: 数据权限注解 会造成 缓存击穿 与 数据不一致问题
+ *
+ * cacheNames 为配置文件内 groupId
+ */
+ @ApiOperation("测试 @Cacheable")
+ @Cacheable(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null")
+ @GetMapping("/test1")
+ public AjaxResult test1(String key, String value) {
+ return AjaxResult.success("操作成功", value);
+ }
- /**
- * 测试 @CachePut
- *
- * 加了@CachePut注解的方法,会把方法的返回值put到缓存里面缓存起来,供其它地方使用
- * 它「通常用在新增方法上」
- *
- * cacheNames 为 配置文件内 groupId
- */
- @ApiOperation("测试 @CachePut")
- @CachePut(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null")
- @GetMapping("/test2")
- public AjaxResult test2(String key, String value){
- return AjaxResult.success("操作成功", value);
- }
+ /**
+ * 测试 @CachePut
+ *
+ * 加了@CachePut注解的方法,会把方法的返回值put到缓存里面缓存起来,供其它地方使用
+ * 它「通常用在新增方法上」
+ *
+ * cacheNames 为 配置文件内 groupId
+ */
+ @ApiOperation("测试 @CachePut")
+ @CachePut(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null")
+ @GetMapping("/test2")
+ public AjaxResult test2(String key, String value) {
+ return AjaxResult.success("操作成功", value);
+ }
- /**
- * 测试 @CacheEvict
- *
- * 使用了CacheEvict注解的方法,会清空指定缓存
- * 「一般用在更新或者删除的方法上」
- *
- * cacheNames 为 配置文件内 groupId
- */
- @ApiOperation("测试 @CacheEvict")
- @CacheEvict(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null")
- @GetMapping("/test3")
- public AjaxResult test3(String key, String value){
- return AjaxResult.success("操作成功", value);
- }
+ /**
+ * 测试 @CacheEvict
+ *
+ * 使用了CacheEvict注解的方法,会清空指定缓存
+ * 「一般用在更新或者删除的方法上」
+ *
+ * cacheNames 为 配置文件内 groupId
+ */
+ @ApiOperation("测试 @CacheEvict")
+ @CacheEvict(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null")
+ @GetMapping("/test3")
+ public AjaxResult test3(String key, String value) {
+ return AjaxResult.success("操作成功", value);
+ }
- /**
- * 测试设置过期时间
- * 手动设置过期时间10秒
- * 11秒后获取 判断是否相等
- */
- @ApiOperation("测试设置过期时间")
- @GetMapping("/test6")
- public AjaxResult test6(String key, String value){
- RedisUtils.setCacheObject(key, value);
- boolean flag = RedisUtils.expire(key, 10, TimeUnit.SECONDS);
- System.out.println("***********" + flag);
- try {
- Thread.sleep(11 * 1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- Object obj = RedisUtils.getCacheObject(key);
- return AjaxResult.success("操作成功", value.equals(obj));
- }
+ /**
+ * 测试设置过期时间
+ * 手动设置过期时间10秒
+ * 11秒后获取 判断是否相等
+ */
+ @ApiOperation("测试设置过期时间")
+ @GetMapping("/test6")
+ public AjaxResult test6(String key, String value) {
+ RedisUtils.setCacheObject(key, value);
+ boolean flag = RedisUtils.expire(key, 10, TimeUnit.SECONDS);
+ System.out.println("***********" + flag);
+ try {
+ Thread.sleep(11 * 1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ Object obj = RedisUtils.getCacheObject(key);
+ return AjaxResult.success("操作成功", value.equals(obj));
+ }
}
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisLockController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisLockController.java
index a72024663..b2d66f5bb 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisLockController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisLockController.java
@@ -28,59 +28,59 @@ import java.time.LocalTime;
@RequestMapping("/demo/redisLock")
public class RedisLockController {
- @Autowired
- private LockTemplate lockTemplate;
+ @Autowired
+ private LockTemplate lockTemplate;
- /**
- * 测试lock4j 注解
- */
- @ApiOperation("测试lock4j 注解")
- @Lock4j(keys = {"#key"})
- @GetMapping("/testLock4j")
- public AjaxResult testLock4j(String key,String value){
- System.out.println("start:"+key+",time:"+ LocalTime.now().toString());
- try {
- Thread.sleep(10000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- System.out.println("end :"+key+",time:"+LocalTime.now().toString());
- return AjaxResult.success("操作成功",value);
- }
+ /**
+ * 测试lock4j 注解
+ */
+ @ApiOperation("测试lock4j 注解")
+ @Lock4j(keys = {"#key"})
+ @GetMapping("/testLock4j")
+ public AjaxResult testLock4j(String key, String value) {
+ System.out.println("start:" + key + ",time:" + LocalTime.now().toString());
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ System.out.println("end :" + key + ",time:" + LocalTime.now().toString());
+ return AjaxResult.success("操作成功", value);
+ }
- /**
- * 测试lock4j 工具
- */
- @ApiOperation("测试lock4j 工具")
- @GetMapping("/testLock4jLockTemaplate")
- public AjaxResult testLock4jLockTemaplate(String key,String value){
- final LockInfo lockInfo = lockTemplate.lock(key, 30000L, 5000L, RedissonLockExecutor.class);
- if (null == lockInfo) {
- throw new RuntimeException("业务处理中,请稍后再试");
- }
- // 获取锁成功,处理业务
- try {
- try {
- Thread.sleep(8000);
- } catch (InterruptedException e) {
- //
- }
- System.out.println("执行简单方法1 , 当前线程:" + Thread.currentThread().getName());
- } finally {
- //释放锁
- lockTemplate.releaseLock(lockInfo);
- }
- //结束
- return AjaxResult.success("操作成功",value);
- }
+ /**
+ * 测试lock4j 工具
+ */
+ @ApiOperation("测试lock4j 工具")
+ @GetMapping("/testLock4jLockTemaplate")
+ public AjaxResult testLock4jLockTemaplate(String key, String value) {
+ final LockInfo lockInfo = lockTemplate.lock(key, 30000L, 5000L, RedissonLockExecutor.class);
+ if (null == lockInfo) {
+ throw new RuntimeException("业务处理中,请稍后再试");
+ }
+ // 获取锁成功,处理业务
+ try {
+ try {
+ Thread.sleep(8000);
+ } catch (InterruptedException e) {
+ //
+ }
+ System.out.println("执行简单方法1 , 当前线程:" + Thread.currentThread().getName());
+ } finally {
+ //释放锁
+ lockTemplate.releaseLock(lockInfo);
+ }
+ //结束
+ return AjaxResult.success("操作成功", value);
+ }
- /**
- * 测试spring-cache注解
- */
- @ApiOperation("测试spring-cache注解")
- @Cacheable(value = "test", key = "#key")
- @GetMapping("/testCache")
- public AjaxResult testCache(String key) {
- return AjaxResult.success("操作成功", key);
- }
+ /**
+ * 测试spring-cache注解
+ */
+ @ApiOperation("测试spring-cache注解")
+ @Cacheable(value = "test", key = "#key")
+ @GetMapping("/testCache")
+ public AjaxResult testCache(String key) {
+ return AjaxResult.success("操作成功", key);
+ }
}
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisPubSubController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisPubSubController.java
index 810b307dc..619a69028 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisPubSubController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisPubSubController.java
@@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.RedisUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -21,22 +22,22 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/demo/redis/pubsub")
public class RedisPubSubController {
- @ApiOperation("发布消息")
- @GetMapping("/pub")
- public AjaxResult pub(String key, String value){
- RedisUtils.publish(key, value, consumer -> {
- System.out.println("发布通道 => " + key + ", 发送值 => " + value);
- });
- return AjaxResult.success("操作成功");
- }
+ @ApiOperation("发布消息")
+ @GetMapping("/pub")
+ public AjaxResult pub(@ApiParam("通道Key") String key, @ApiParam("发送内容") String value) {
+ RedisUtils.publish(key, value, consumer -> {
+ System.out.println("发布通道 => " + key + ", 发送值 => " + value);
+ });
+ return AjaxResult.success("操作成功");
+ }
- @ApiOperation("订阅消息")
- @GetMapping("/sub")
- public AjaxResult sub(String key){
- RedisUtils.subscribe(key, String.class, msg -> {
- System.out.println("订阅通道 => " + key + ", 接收值 => " + msg);
- });
- return AjaxResult.success("操作成功");
- }
+ @ApiOperation("订阅消息")
+ @GetMapping("/sub")
+ public AjaxResult sub(@ApiParam("通道Key") String key) {
+ RedisUtils.subscribe(key, String.class, msg -> {
+ System.out.println("订阅通道 => " + key + ", 接收值 => " + msg);
+ });
+ return AjaxResult.success("操作成功");
+ }
}
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisRateLimiterController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisRateLimiterController.java
index 33d75093b..1eeab6114 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisRateLimiterController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisRateLimiterController.java
@@ -22,37 +22,37 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/demo/rateLimiter")
public class RedisRateLimiterController {
- /**
- * 测试全局限流
- * 全局影响
- */
- @ApiOperation("测试全局限流")
- @RateLimiter(count = 2, time = 10)
- @GetMapping("/test")
- public AjaxResult test(String value){
- return AjaxResult.success("操作成功",value);
- }
+ /**
+ * 测试全局限流
+ * 全局影响
+ */
+ @ApiOperation("测试全局限流")
+ @RateLimiter(count = 2, time = 10)
+ @GetMapping("/test")
+ public AjaxResult test(String value) {
+ return AjaxResult.success("操作成功", value);
+ }
- /**
- * 测试请求IP限流
- * 同一IP请求受影响
- */
- @ApiOperation("测试请求IP限流")
- @RateLimiter(count = 2, time = 10, limitType = LimitType.IP)
- @GetMapping("/testip")
- public AjaxResult testip(String value){
- return AjaxResult.success("操作成功",value);
- }
+ /**
+ * 测试请求IP限流
+ * 同一IP请求受影响
+ */
+ @ApiOperation("测试请求IP限流")
+ @RateLimiter(count = 2, time = 10, limitType = LimitType.IP)
+ @GetMapping("/testip")
+ public AjaxResult testip(String value) {
+ return AjaxResult.success("操作成功", value);
+ }
- /**
- * 测试集群实例限流
- * 启动两个后端服务互不影响
- */
- @ApiOperation("测试集群实例限流")
- @RateLimiter(count = 2, time = 10, limitType = LimitType.CLUSTER)
- @GetMapping("/testcluster")
- public AjaxResult testcluster(String value){
- return AjaxResult.success("操作成功",value);
- }
+ /**
+ * 测试集群实例限流
+ * 启动两个后端服务互不影响
+ */
+ @ApiOperation("测试集群实例限流")
+ @RateLimiter(count = 2, time = 10, limitType = LimitType.CLUSTER)
+ @GetMapping("/testcluster")
+ public AjaxResult testcluster(String value) {
+ return AjaxResult.success("操作成功", value);
+ }
}
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/Swagger3DemoController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/Swagger3DemoController.java
index a8efb64e4..6b73d64a8 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/Swagger3DemoController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/Swagger3DemoController.java
@@ -21,18 +21,18 @@ import org.springframework.web.multipart.MultipartFile;
@RequestMapping("/swagger/demo")
public class Swagger3DemoController {
- /**
- * 上传请求
- * 必须使用 @RequestPart 注解标注为文件
- * dataType 必须为 "java.io.File"
- */
- @ApiOperation(value = "通用上传请求")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "file", value = "文件", dataType = "java.io.File", required = true),
- })
- @PostMapping(value = "/upload")
- public AjaxResult upload(@RequestPart("file") MultipartFile file) {
- return AjaxResult.success("操作成功", file.getOriginalFilename());
- }
+ /**
+ * 上传请求
+ * 必须使用 @RequestPart 注解标注为文件
+ * dataType 必须为 "java.io.File"
+ */
+ @ApiOperation(value = "通用上传请求")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "file", value = "文件", dataType = "java.io.File", required = true),
+ })
+ @PostMapping(value = "/upload")
+ public AjaxResult upload(@RequestPart("file") MultipartFile file) {
+ return AjaxResult.success("操作成功", file.getOriginalFilename());
+ }
}
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java
index ef117a11c..d6e691dbb 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java
@@ -34,48 +34,48 @@ public class TestBatchController extends BaseController {
/**
* 新增批量方法 可完美替代 saveBatch 秒级插入上万数据 (对mysql负荷较大)
*/
- @ApiOperation(value = "新增批量方法")
+ @ApiOperation(value = "新增批量方法")
@PostMapping("/add")
// @DataSource(DataSourceType.SLAVE)
public AjaxResult add() {
- List list = new ArrayList<>();
- for (int i = 0; i < 1000; i++) {
- list.add(new TestDemo().setOrderNum(-1L).setTestKey("批量新增").setValue("测试新增"));
- }
+ List list = new ArrayList<>();
+ for (int i = 0; i < 1000; i++) {
+ list.add(new TestDemo().setOrderNum(-1L).setTestKey("批量新增").setValue("测试新增"));
+ }
return toAjax(iTestDemoService.saveAll(list) ? 1 : 0);
}
- /**
- * 新增或更新 可完美替代 saveOrUpdateBatch 高性能
- */
- @ApiOperation(value = "新增或更新批量方法")
- @PostMapping("/addOrUpdate")
+ /**
+ * 新增或更新 可完美替代 saveOrUpdateBatch 高性能
+ */
+ @ApiOperation(value = "新增或更新批量方法")
+ @PostMapping("/addOrUpdate")
// @DataSource(DataSourceType.SLAVE)
- public AjaxResult addOrUpdate() {
- List list = new ArrayList<>();
- for (int i = 0; i < 1000; i++) {
- list.add(new TestDemo().setOrderNum(-1L).setTestKey("批量新增").setValue("测试新增"));
- }
- iTestDemoService.saveAll(list);
- for (int i = 0; i < list.size(); i++) {
- TestDemo testDemo = list.get(i);
- testDemo.setTestKey("批量新增或修改").setValue("批量新增或修改");
- if (i % 2 == 0) {
- testDemo.setId(null);
- }
- }
- return toAjax(iTestDemoService.saveOrUpdateAll(list) ? 1 : 0);
- }
+ public AjaxResult addOrUpdate() {
+ List list = new ArrayList<>();
+ for (int i = 0; i < 1000; i++) {
+ list.add(new TestDemo().setOrderNum(-1L).setTestKey("批量新增").setValue("测试新增"));
+ }
+ iTestDemoService.saveAll(list);
+ for (int i = 0; i < list.size(); i++) {
+ TestDemo testDemo = list.get(i);
+ testDemo.setTestKey("批量新增或修改").setValue("批量新增或修改");
+ if (i % 2 == 0) {
+ testDemo.setId(null);
+ }
+ }
+ return toAjax(iTestDemoService.saveOrUpdateAll(list) ? 1 : 0);
+ }
/**
* 删除批量方法
*/
- @ApiOperation(value = "删除批量方法")
+ @ApiOperation(value = "删除批量方法")
@DeleteMapping()
// @DataSource(DataSourceType.SLAVE)
public AjaxResult remove() {
return toAjax(iTestDemoService.remove(new LambdaQueryWrapper()
- .eq(TestDemo::getOrderNum, -1L)) ? 1 : 0);
+ .eq(TestDemo::getOrderNum, -1L)) ? 1 : 0);
}
}
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java
index 66339de28..7b7036030 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java
@@ -16,6 +16,7 @@ import com.ruoyi.demo.domain.vo.TestDemoVo;
import com.ruoyi.demo.service.ITestDemoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -54,30 +55,30 @@ public class TestDemoController extends BaseController {
return iTestDemoService.queryPageList(bo);
}
- /**
- * 自定义分页查询
- */
- @ApiOperation("自定义分页查询")
- @PreAuthorize("@ss.hasPermi('demo:demo:list')")
- @GetMapping("/page")
- public TableDataInfo page(@Validated(QueryGroup.class) TestDemoBo bo) {
- return iTestDemoService.customPageList(bo);
- }
+ /**
+ * 自定义分页查询
+ */
+ @ApiOperation("自定义分页查询")
+ @PreAuthorize("@ss.hasPermi('demo:demo:list')")
+ @GetMapping("/page")
+ public TableDataInfo page(@Validated(QueryGroup.class) TestDemoBo bo) {
+ return iTestDemoService.customPageList(bo);
+ }
- /**
+ /**
* 导出测试单表列表
*/
@ApiOperation("导出测试单表列表")
@PreAuthorize("@ss.hasPermi('demo:demo:export')")
@Log(title = "测试单表", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
+ @PostMapping("/export")
public void export(@Validated TestDemoBo bo, HttpServletResponse response) {
List list = iTestDemoService.queryList(bo);
- // 测试雪花id导出
+ // 测试雪花id导出
// for (TestDemoVo vo : list) {
// vo.setId(1234567891234567893L);
// }
- ExcelUtil.exportExcel(list, "测试单表", TestDemoVo.class, response);
+ ExcelUtil.exportExcel(list, "测试单表", TestDemoVo.class, response);
}
/**
@@ -86,8 +87,9 @@ public class TestDemoController extends BaseController {
@ApiOperation("获取测试单表详细信息")
@PreAuthorize("@ss.hasPermi('demo:demo:query')")
@GetMapping("/{id}")
- public AjaxResult getInfo(@NotNull(message = "主键不能为空")
- @PathVariable("id") Long id) {
+ public AjaxResult getInfo(@ApiParam("测试ID")
+ @NotNull(message = "主键不能为空")
+ @PathVariable("id") Long id) {
return AjaxResult.success(iTestDemoService.queryById(id));
}
@@ -123,10 +125,11 @@ public class TestDemoController extends BaseController {
*/
@ApiOperation("删除测试单表")
@PreAuthorize("@ss.hasPermi('demo:demo:remove')")
- @Log(title = "测试单表" , businessType = BusinessType.DELETE)
+ @Log(title = "测试单表", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
- public AjaxResult remove(@NotEmpty(message = "主键不能为空")
- @PathVariable Long[] ids) {
+ public AjaxResult remove(@ApiParam("测试ID串")
+ @NotEmpty(message = "主键不能为空")
+ @PathVariable Long[] ids) {
return toAjax(iTestDemoService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
}
}
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestI18nController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestI18nController.java
index bb0695f78..c2ab0310b 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestI18nController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestI18nController.java
@@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.MessageUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -27,7 +28,7 @@ public class TestI18nController {
*/
@ApiOperation("通过code获取国际化内容")
@GetMapping()
- public AjaxResult get(String code) {
+ public AjaxResult get(@ApiParam("国际化code") String code) {
return AjaxResult.success(MessageUtils.message(code));
}
}
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java
index c34c77c4b..463ea3bf6 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java
@@ -14,6 +14,7 @@ import com.ruoyi.demo.domain.vo.TestTreeVo;
import com.ruoyi.demo.service.ITestTreeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -61,7 +62,7 @@ public class TestTreeController extends BaseController {
@GetMapping("/export")
public void export(@Validated TestTreeBo bo, HttpServletResponse response) {
List list = iTestTreeService.queryList(bo);
- ExcelUtil.exportExcel(list, "测试树表", TestTreeVo.class, response);
+ ExcelUtil.exportExcel(list, "测试树表", TestTreeVo.class, response);
}
/**
@@ -70,8 +71,9 @@ public class TestTreeController extends BaseController {
@ApiOperation("获取测试树表详细信息")
@PreAuthorize("@ss.hasPermi('demo:tree:query')")
@GetMapping("/{id}")
- public AjaxResult getInfo(@NotNull(message = "主键不能为空")
- @PathVariable("id") Long id) {
+ public AjaxResult getInfo(@ApiParam("测试树ID")
+ @NotNull(message = "主键不能为空")
+ @PathVariable("id") Long id) {
return AjaxResult.success(iTestTreeService.queryById(id));
}
@@ -104,10 +106,11 @@ public class TestTreeController extends BaseController {
*/
@ApiOperation("删除测试树表")
@PreAuthorize("@ss.hasPermi('demo:tree:remove')")
- @Log(title = "测试树表" , businessType = BusinessType.DELETE)
+ @Log(title = "测试树表", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
- public AjaxResult remove(@NotEmpty(message = "主键不能为空")
- @PathVariable Long[] ids) {
+ public AjaxResult remove(@ApiParam("测试树ID串")
+ @NotEmpty(message = "主键不能为空")
+ @PathVariable Long[] ids) {
return toAjax(iTestTreeService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
}
}
diff --git a/ruoyi-extend/ruoyi-monitor-admin/pom.xml b/ruoyi-extend/ruoyi-monitor-admin/pom.xml
index 33a78516d..fc321bd58 100644
--- a/ruoyi-extend/ruoyi-monitor-admin/pom.xml
+++ b/ruoyi-extend/ruoyi-monitor-admin/pom.xml
@@ -28,6 +28,12 @@
de.codecentric
spring-boot-admin-starter-server
+
+
+ de.codecentric
+ spring-boot-admin-starter-client
+
+
diff --git a/ruoyi-extend/ruoyi-monitor-admin/src/main/java/com/ruoyi/monitor/admin/config/SecurityConfig.java b/ruoyi-extend/ruoyi-monitor-admin/src/main/java/com/ruoyi/monitor/admin/config/SecurityConfig.java
index ca9072c78..7335e2f25 100644
--- a/ruoyi-extend/ruoyi-monitor-admin/src/main/java/com/ruoyi/monitor/admin/config/SecurityConfig.java
+++ b/ruoyi-extend/ruoyi-monitor-admin/src/main/java/com/ruoyi/monitor/admin/config/SecurityConfig.java
@@ -34,6 +34,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
//授予对所有静态资产和登录页面的公共访问权限。
.antMatchers(adminContextPath + "/assets/**").permitAll()
.antMatchers(adminContextPath + "/login").permitAll()
+ .antMatchers("/actuator").anonymous()
+ .antMatchers("/actuator/**").anonymous()
//必须对每个其他请求进行身份验证
.anyRequest().authenticated().and()
//配置登录和注销
diff --git a/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application-dev.yml b/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application-dev.yml
new file mode 100644
index 000000000..829314b41
--- /dev/null
+++ b/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application-dev.yml
@@ -0,0 +1,14 @@
+--- # 监控配置
+spring:
+ boot:
+ admin:
+ # Spring Boot Admin Client 客户端的相关配置
+ client:
+ # 增加客户端开关
+ enabled: true
+ # 设置 Spring Boot Admin Server 地址
+ url: http://localhost:9090/admin
+ instance:
+ prefer-ip: true # 注册实例时,优先使用 IP
+ username: ruoyi
+ password: 123456
diff --git a/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application-prod.yml b/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application-prod.yml
new file mode 100644
index 000000000..e8cac1369
--- /dev/null
+++ b/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application-prod.yml
@@ -0,0 +1,14 @@
+--- # 监控配置
+spring:
+ boot:
+ admin:
+ # Spring Boot Admin Client 客户端的相关配置
+ client:
+ # 增加客户端开关
+ enabled: true
+ # 设置 Spring Boot Admin Server 地址
+ url: http://172.30.0.90:9090/admin
+ instance:
+ prefer-ip: true # 注册实例时,优先使用 IP
+ username: ruoyi
+ password: 123456
diff --git a/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application.yml b/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application.yml
index 631f3e772..bf0db5620 100644
--- a/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application.yml
+++ b/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application.yml
@@ -1,6 +1,12 @@
server:
port: 9090
+spring:
+ application:
+ name: ruoyi-monitor-admin
+ profiles:
+ active: @profiles.active@
+--- # 监控中心服务端配置
spring:
security:
user:
@@ -9,3 +15,17 @@ spring:
boot:
admin:
context-path: /admin
+
+--- # Actuator 监控端点的配置项
+management:
+ endpoints:
+ web:
+ # Actuator 提供的 API 接口的根目录。默认为 /actuator
+ base-path: /actuator
+ exposure:
+ # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
+ # 生产环境不建议放开所有 根据项目需求放开即可
+ include: @endpoints.include@
+ endpoint:
+ logfile:
+ external-file: ./logs/ruoyi-monitor-admin.log
diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/pom.xml b/ruoyi-extend/ruoyi-xxl-job-admin/pom.xml
index a2b198fc9..26892d424 100644
--- a/ruoyi-extend/ruoyi-xxl-job-admin/pom.xml
+++ b/ruoyi-extend/ruoyi-xxl-job-admin/pom.xml
@@ -71,6 +71,11 @@
${mysql-connector-java.version}
+
+ de.codecentric
+ spring-boot-admin-starter-client
+
+
com.xuxueli
diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-dev.yml b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-dev.yml
index 065b34262..540a3237a 100644
--- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-dev.yml
+++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-dev.yml
@@ -1,3 +1,18 @@
+--- # 监控配置
+spring:
+ boot:
+ admin:
+ # Spring Boot Admin Client 客户端的相关配置
+ client:
+ # 增加客户端开关
+ enabled: true
+ # 设置 Spring Boot Admin Server 地址
+ url: http://localhost:9090/admin
+ instance:
+ prefer-ip: true # 注册实例时,优先使用 IP
+ username: ruoyi
+ password: 123456
+
--- # 数据库配置
spring:
datasource:
diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-prod.yml b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-prod.yml
index 2994909ac..bcec9d82e 100644
--- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-prod.yml
+++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-prod.yml
@@ -1,3 +1,18 @@
+--- # 监控配置
+spring:
+ boot:
+ admin:
+ # Spring Boot Admin Client 客户端的相关配置
+ client:
+ # 增加客户端开关
+ enabled: true
+ # 设置 Spring Boot Admin Server 地址
+ url: http://172.30.0.90:9090/admin
+ instance:
+ prefer-ip: true # 注册实例时,优先使用 IP
+ username: ruoyi
+ password: 123456
+
--- # 数据库配置
spring:
datasource:
diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application.yml b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application.yml
index edafdb01b..202272087 100644
--- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application.yml
+++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application.yml
@@ -4,6 +4,8 @@ server:
servlet:
context-path: /xxl-job-admin
spring:
+ application:
+ name: ruoyi-xxl-job-admin
profiles:
active: @profiles.active@
mvc:
@@ -28,13 +30,22 @@ spring:
suffix: .ftl
templateLoaderPath: classpath:/templates/
---- # 监控配置
+--- # Actuator 监控端点的配置项
management:
health:
mail:
enabled: false
- server:
- base-path: /actuator
+ endpoints:
+ web:
+ # Actuator 提供的 API 接口的根目录。默认为 /actuator
+ base-path: /actuator
+ exposure:
+ # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
+ # 生产环境不建议放开所有 根据项目需求放开即可
+ include: @endpoints.include@
+ endpoint:
+ logfile:
+ external-file: ./logs/ruoyi-xxl-job-admin.log
--- # xxljob系统配置
xxl:
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java
index e4a6cdcdb..9a7f38bb0 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java
@@ -14,6 +14,7 @@ import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
/**
* 数据过滤处理
@@ -135,6 +136,12 @@ public class DataScopeAspect {
if (params instanceof BaseEntity) {
BaseEntity baseEntity = (BaseEntity) params;
baseEntity.getParams().put(DATA_SCOPE, sql);
+ } else if (params instanceof Map) {
+ Map, ?> tempMap = (Map, ?>) params;
+ Map paramMap = new ConcurrentHashMap<>(tempMap.size() + 1);
+ tempMap.forEach((k, v) -> paramMap.put((String) k, v));
+ paramMap.put(DATA_SCOPE, sql);
+ joinPoint.getArgs()[0] = paramMap;
} else {
Map invoke = ReflectUtils.invokeGetter(params, "params");
invoke.put(DATA_SCOPE, sql);
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java
index 459020d87..6f3b099ab 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java
@@ -20,7 +20,6 @@ import java.util.Map;
* @author Lion Li
*/
@Configuration
-@ConditionalOnProperty(value = "xss.enabled", havingValue = "true")
public class FilterConfig {
@Autowired
@@ -28,6 +27,7 @@ public class FilterConfig {
@SuppressWarnings({"rawtypes", "unchecked"})
@Bean
+ @ConditionalOnProperty(value = "xss.enabled", havingValue = "true")
public FilterRegistrationBean xssFilterRegistration() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setDispatcherTypes(DispatcherType.REQUEST);
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java
index 4ed536690..ef77a219a 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java
@@ -14,7 +14,7 @@ import java.util.concurrent.ScheduledExecutorService;
*
* @author Lion Li
*/
-@Slf4j(topic = "sys-user")
+@Slf4j
@Component
public class ShutdownManager {
diff --git a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm
index 2c8caa41b..ae6f81876 100644
--- a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm
+++ b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm
@@ -28,6 +28,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
#elseif($table.tree)
#end
import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiOperation;
/**
@@ -80,7 +81,8 @@ public class ${ClassName}Controller extends BaseController {
@ApiOperation("获取${functionName}详细信息")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')")
@GetMapping("/{${pkColumn.javaField}}")
- public AjaxResult<${ClassName}Vo> getInfo(@NotNull(message = "主键不能为空")
+ public AjaxResult<${ClassName}Vo> getInfo(@ApiParam("主键")
+ @NotNull(message = "主键不能为空")
@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) {
return AjaxResult.success(i${ClassName}Service.queryById(${pkColumn.javaField}));
}
@@ -116,7 +118,8 @@ public class ${ClassName}Controller extends BaseController {
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')")
@Log(title = "${functionName}" , businessType = BusinessType.DELETE)
@DeleteMapping("/{${pkColumn.javaField}s}")
- public AjaxResult remove(@NotEmpty(message = "主键不能为空")
+ public AjaxResult remove(@ApiParam("主键串")
+ @NotEmpty(message = "主键不能为空")
@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) {
return toAjax(i${ClassName}Service.deleteWithValidByIds(Arrays.asList(${pkColumn.javaField}s), true) ? 1 : 0);
}
diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
index 7e28c2e9e..765017054 100644
--- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
+++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
@@ -108,7 +108,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['${moduleName}:${businessName}:export']"
>导出
@@ -324,8 +323,6 @@ export default {
buttonLoading: false,
// 遮罩层
loading: true,
- // 导出遮罩层
- exportLoading: false,
// 选中数组
ids: [],
#if($table.sub)
@@ -573,7 +570,9 @@ export default {
#end
/** 导出按钮操作 */
handleExport() {
- this.#[[$download]]#.excel('/${moduleName}/${businessName}/export', this.queryParams);
+ this.download('${moduleName}/${businessName}/export', {
+ ...this.queryParams
+ }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
}
}
};
diff --git a/ruoyi-oss/src/main/java/com/ruoyi/oss/factory/OssFactory.java b/ruoyi-oss/src/main/java/com/ruoyi/oss/factory/OssFactory.java
index ecb269dd7..b5de00145 100644
--- a/ruoyi-oss/src/main/java/com/ruoyi/oss/factory/OssFactory.java
+++ b/ruoyi-oss/src/main/java/com/ruoyi/oss/factory/OssFactory.java
@@ -24,18 +24,22 @@ import java.util.concurrent.ConcurrentHashMap;
@Slf4j
public class OssFactory {
- static {
- RedisUtils.subscribe(CloudConstant.CACHE_CONFIG_KEY, String.class, msg -> {
- refreshService(msg);
- log.info("订阅刷新OSS配置 => " + msg);
- });
- }
-
/**
* 服务实例缓存
*/
private static final Map SERVICES = new ConcurrentHashMap<>();
+ /**
+ * 初始化工厂
+ */
+ public static void init() {
+ log.info("初始化OSS工厂");
+ RedisUtils.subscribe(CloudConstant.CACHE_CONFIG_KEY, String.class, msg -> {
+ refreshService(msg);
+ log.info("订阅刷新OSS配置 => " + msg);
+ });
+ }
+
/**
* 获取默认实例
*/
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssConfigServiceImpl.java
index df3f6d153..ddbf421ee 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssConfigServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssConfigServiceImpl.java
@@ -16,6 +16,7 @@ import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.RedisUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.oss.constant.CloudConstant;
+import com.ruoyi.oss.factory.OssFactory;
import com.ruoyi.system.domain.SysOssConfig;
import com.ruoyi.system.domain.bo.SysOssConfigBo;
import com.ruoyi.system.domain.vo.SysOssConfigVo;
@@ -49,6 +50,7 @@ public class SysOssConfigServiceImpl extends ServicePlusImpl list = list();
+ // 加载OSS初始化配置
for (SysOssConfig config : list) {
String configKey = config.getConfigKey();
if ("0".equals(config.getStatus())) {
@@ -56,6 +58,8 @@ public class SysOssConfigServiceImpl extends ServicePlusImpl {
- const isLogin = await this.blobValidate(res.data);
- if (isLogin) {
- const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
- this.saveAs(blob, decodeURI(res.headers['download-filename']))
- } else {
- Message.error('无效的会话,或者会话已过期,请重新登录。');
- }
- })
- },
oss(ossId) {
var url = baseURL + '/system/oss/download/' + ossId
axios({
@@ -54,7 +15,7 @@ export default {
responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() }
}).then(async (res) => {
- const isLogin = await this.blobValidate(res.data);
+ const isLogin = await blobValidate(res.data);
if (isLogin) {
const blob = new Blob([res.data], { type: 'application/octet-stream' })
this.saveAs(blob, decodeURI(res.headers['download-filename']))
@@ -71,7 +32,7 @@ export default {
responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() }
}).then(async (res) => {
- const isLogin = await this.blobValidate(res.data);
+ const isLogin = await blobValidate(res.data);
if (isLogin) {
const blob = new Blob([res.data], { type: 'application/zip' })
this.saveAs(blob, name)
@@ -82,15 +43,6 @@ export default {
},
saveAs(text, name, opts) {
saveAs(text, name, opts);
- },
- async blobValidate(data) {
- try {
- const text = await data.text();
- JSON.parse(text);
- return false;
- } catch (error) {
- return true;
- }
- },
+ }
}
diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js
index 96f557b34..b6b14fabc 100644
--- a/ruoyi-ui/src/router/index.js
+++ b/ruoyi-ui/src/router/index.js
@@ -138,19 +138,6 @@ export const constantRoutes = [
}
]
},
- {
- path: '/monitor/job-log',
- component: Layout,
- hidden: true,
- children: [
- {
- path: 'index',
- component: (resolve) => require(['@/views/monitor/job/log'], resolve),
- name: 'JobLog',
- meta: { title: '调度日志', activeMenu: '/monitor/job'}
- }
- ]
- },
{
path: '/tool/gen-edit',
component: Layout,
diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js
index 31944e2a2..d376a76a5 100644
--- a/ruoyi-ui/src/utils/request.js
+++ b/ruoyi-ui/src/utils/request.js
@@ -1,8 +1,12 @@
import axios from 'axios'
-import { Notification, MessageBox, Message } from 'element-ui'
+import { Notification, MessageBox, Message, Loading } from 'element-ui'
import store from '@/store'
import { getToken } from '@/utils/auth'
import errorCode from '@/utils/errorCode'
+import { tansParams, blobValidate } from "@/utils/ruoyi";
+import { saveAs } from 'file-saver'
+
+let downloadLoadingInstance;
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 对应国际化资源文件后缀
@@ -14,6 +18,7 @@ const service = axios.create({
// 超时
timeout: 10000
})
+
// request拦截器
service.interceptors.request.use(config => {
// 是否需要设置 token
@@ -23,24 +28,7 @@ service.interceptors.request.use(config => {
}
// get请求映射params参数
if (config.method === 'get' && config.params) {
- let url = config.url + '?';
- for (const propName of Object.keys(config.params)) {
- const value = config.params[propName];
- var part = encodeURIComponent(propName) + "=";
- if (value !== null && typeof(value) !== "undefined") {
- if (typeof value === 'object') {
- for (const key of Object.keys(value)) {
- if (value[key] !== null && typeof (value[key]) !== 'undefined') {
- let params = propName + '[' + key + ']';
- let subPart = encodeURIComponent(params) + '=';
- url += subPart + encodeURIComponent(value[key]) + '&';
- }
- }
- } else {
- url += part + encodeURIComponent(value) + "&";
- }
- }
- }
+ let url = config.url + '?' + tansParams(config.params);
url = url.slice(0, -1);
config.params = {};
config.url = url;
@@ -57,6 +45,10 @@ service.interceptors.response.use(res => {
const code = res.data.code || 200;
// 获取错误信息
const msg = errorCode[code] || res.data.msg || errorCode['default']
+ // 二进制数据则直接返回
+ if(res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer'){
+ return res.data
+ }
if (code === 401) {
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
confirmButtonText: '重新登录',
@@ -105,4 +97,27 @@ service.interceptors.response.use(res => {
}
)
+// 通用下载方法
+export function download(url, params, filename) {
+ downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
+ return service.post(url, params, {
+ transformRequest: [(params) => { return tansParams(params) }],
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ responseType: 'blob'
+ }).then(async (data) => {
+ const isLogin = await blobValidate(data);
+ if (isLogin) {
+ const blob = new Blob([data])
+ saveAs(blob, filename)
+ } else {
+ Message.error('无效的会话,或者会话已过期,请重新登录。');
+ }
+ downloadLoadingInstance.close();
+ }).catch((r) => {
+ console.error(r)
+ Message.error('下载文件出现错误,请联系管理员!')
+ downloadLoadingInstance.close();
+ })
+}
+
export default service
diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js
index 440bf4cd8..4cc5e24ea 100644
--- a/ruoyi-ui/src/utils/ruoyi.js
+++ b/ruoyi-ui/src/utils/ruoyi.js
@@ -181,3 +181,40 @@ export function handleTree(data, id, parentId, children) {
}
return tree;
}
+
+/**
+* 参数处理
+* @param {*} params 参数
+*/
+export function tansParams(params) {
+ let result = ''
+ for (const propName of Object.keys(params)) {
+ const value = params[propName];
+ var part = encodeURIComponent(propName) + "=";
+ if (value !== null && typeof (value) !== "undefined") {
+ if (typeof value === 'object') {
+ for (const key of Object.keys(value)) {
+ if (value[key] !== null && typeof (value[key]) !== 'undefined') {
+ let params = propName + '[' + key + ']';
+ var subPart = encodeURIComponent(params) + "=";
+ result += subPart + encodeURIComponent(value[key]) + "&";
+ }
+ }
+ } else {
+ result += part + encodeURIComponent(value) + "&";
+ }
+ }
+ }
+ return result
+}
+
+// 验证是否为blob格式
+export async function blobValidate(data) {
+ try {
+ const text = await data.text();
+ JSON.parse(text);
+ return false;
+ } catch (error) {
+ return true;
+ }
+}
diff --git a/ruoyi-ui/src/views/demo/demo/index.vue b/ruoyi-ui/src/views/demo/demo/index.vue
index 678ae218a..9ff0e4755 100644
--- a/ruoyi-ui/src/views/demo/demo/index.vue
+++ b/ruoyi-ui/src/views/demo/demo/index.vue
@@ -77,7 +77,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['demo:demo:export']"
>导出
@@ -181,8 +180,6 @@ export default {
buttonLoading: false,
// 遮罩层
loading: true,
- // 导出遮罩层
- exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
@@ -358,7 +355,9 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.$download.excel('/demo/demo/export', this.queryParams);
+ this.download('demo/demo/export', {
+ ...this.queryParams
+ }, `demo_${new Date().getTime()}.xlsx`)
}
}
};
diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue
deleted file mode 100644
index a97477b0c..000000000
--- a/ruoyi-ui/src/views/monitor/job/index.vue
+++ /dev/null
@@ -1,517 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 搜索
- 重置
-
-
-
-
-
- 新增
-
-
- 修改
-
-
- 删除
-
-
- 导出
-
-
- 日志
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 修改
- 删除
- handleCommand(command, scope.row)" v-hasPermi="['monitor:job:changeStatus', 'monitor:job:query']">
-
- 更多
-
-
- 执行一次
- 任务详细
- 调度日志
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 调用方法
-
-
- Bean调用示例:ryTask.ryParams('ry')
-
Class类调用示例:com.ruoyi.quartz.task.RyTask.ryParams('ry')
-
参数说明:支持字符串,布尔类型,长整型,浮点型,整型
-
-
-
-
-
-
-
-
-
-
-
-
- 生成表达式
-
-
-
-
-
-
-
-
-
- 立即执行
- 执行一次
- 放弃执行
-
-
-
-
-
-
- 允许
- 禁止
-
-
-
-
-
-
- {{dict.label}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ form.jobId }}
- {{ form.jobName }}
-
-
- {{ jobGroupFormat(form) }}
- {{ form.createTime }}
-
-
- {{ form.cronExpression }}
-
-
- {{ parseTime(form.nextValidTime) }}
-
-
- {{ form.invokeTarget }}
-
-
-
- 正常
- 失败
-
-
-
-
- 允许
- 禁止
-
-
-
-
- 默认策略
- 立即执行
- 执行一次
- 放弃执行
-
-
-
-
-
-
-
-
-
-
diff --git a/ruoyi-ui/src/views/monitor/job/log.vue b/ruoyi-ui/src/views/monitor/job/log.vue
deleted file mode 100644
index fca1af40e..000000000
--- a/ruoyi-ui/src/views/monitor/job/log.vue
+++ /dev/null
@@ -1,300 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 搜索
- 重置
-
-
-
-
-
- 删除
-
-
- 清空
-
-
- 导出
-
-
- 关闭
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ parseTime(scope.row.createTime) }}
-
-
-
-
- 详细
-
-
-
-
-
-
-
-
-
-
-
- {{ form.jobLogId }}
- {{ form.jobName }}
-
-
- {{ form.jobGroup }}
- {{ form.createTime }}
-
-
- {{ form.invokeTarget }}
-
-
- {{ form.jobMessage }}
-
-
-
- 正常
- 失败
-
-
-
- {{ form.exceptionInfo }}
-
-
-
-
-
-
-
-
-
diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue
index 5b113016d..0f4ecbba6 100644
--- a/ruoyi-ui/src/views/monitor/logininfor/index.vue
+++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue
@@ -83,7 +83,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['monitor:logininfor:export']"
>导出
@@ -132,8 +131,6 @@ export default {
return {
// 遮罩层
loading: true,
- // 导出遮罩层
- exportLoading: false,
// 选中数组
ids: [],
// 非多个禁用
@@ -216,7 +213,9 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.$download.excel('/monitor/logininfor/export', this.queryParams);
+ this.download('monitor/logininfor/export', {
+ ...this.queryParams
+ }, `logininfor_${new Date().getTime()}.xlsx`)
}
}
};
diff --git a/ruoyi-ui/src/views/monitor/operlog/index.vue b/ruoyi-ui/src/views/monitor/operlog/index.vue
index 35fd2b812..28f705b82 100644
--- a/ruoyi-ui/src/views/monitor/operlog/index.vue
+++ b/ruoyi-ui/src/views/monitor/operlog/index.vue
@@ -99,7 +99,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['monitor:operlog:export']"
>导出
@@ -205,8 +204,6 @@ export default {
return {
// 遮罩层
loading: true,
- // 导出遮罩层
- exportLoading: false,
// 选中数组
ids: [],
// 非多个禁用
@@ -303,7 +300,9 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.$download.excel('/monitor/operlog/export', this.queryParams);
+ this.download('monitor/operlog/export', {
+ ...this.queryParams
+ }, `operlog_${new Date().getTime()}.xlsx`)
}
}
};
diff --git a/ruoyi-ui/src/views/system/config/index.vue b/ruoyi-ui/src/views/system/config/index.vue
index b03791755..9fde370f7 100644
--- a/ruoyi-ui/src/views/system/config/index.vue
+++ b/ruoyi-ui/src/views/system/config/index.vue
@@ -88,7 +88,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:config:export']"
>导出
@@ -194,8 +193,6 @@ export default {
return {
// 遮罩层
loading: true,
- // 导出遮罩层
- exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
@@ -334,7 +331,9 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.$download.excel('/system/config/export', this.queryParams);
+ this.download('system/config/export', {
+ ...this.queryParams
+ }, `config_${new Date().getTime()}.xlsx`)
},
/** 刷新缓存按钮操作 */
handleRefreshCache() {
diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue
index c7a90067e..bb779198b 100644
--- a/ruoyi-ui/src/views/system/dict/data.vue
+++ b/ruoyi-ui/src/views/system/dict/data.vue
@@ -75,7 +75,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:dict:export']"
>导出
@@ -193,8 +192,6 @@ export default {
return {
// 遮罩层
loading: true,
- // 导出遮罩层
- exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
@@ -380,8 +377,10 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.$download.excel('/system/dict/data/export', this.queryParams);
+ this.download('system/dict/data/export', {
+ ...this.queryParams
+ }, `data_${new Date().getTime()}.xlsx`)
}
}
};
-
\ No newline at end of file
+
diff --git a/ruoyi-ui/src/views/system/dict/index.vue b/ruoyi-ui/src/views/system/dict/index.vue
index 6daa8679c..92b78c98b 100644
--- a/ruoyi-ui/src/views/system/dict/index.vue
+++ b/ruoyi-ui/src/views/system/dict/index.vue
@@ -94,7 +94,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:dict:export']"
>导出
@@ -202,8 +201,6 @@ export default {
return {
// 遮罩层
loading: true,
- // 导出遮罩层
- exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
@@ -338,7 +335,9 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.$download.excel('/system/dict/type/export', this.queryParams);
+ this.download('system/dict/type/export', {
+ ...this.queryParams
+ }, `type_${new Date().getTime()}.xlsx`)
},
/** 刷新缓存按钮操作 */
handleRefreshCache() {
@@ -348,4 +347,4 @@ export default {
}
}
};
-
\ No newline at end of file
+
diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue
index 8f823f39b..02698da38 100644
--- a/ruoyi-ui/src/views/system/post/index.vue
+++ b/ruoyi-ui/src/views/system/post/index.vue
@@ -74,7 +74,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:post:export']"
>导出
@@ -169,8 +168,6 @@ export default {
return {
// 遮罩层
loading: true,
- // 导出遮罩层
- exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
@@ -305,7 +302,9 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.$download.excel('/system/post/export', this.queryParams);
+ this.download('system/post/export', {
+ ...this.queryParams
+ }, `post_${new Date().getTime()}.xlsx`)
}
}
};
diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue
index 9ca11c0c0..a2a412072 100644
--- a/ruoyi-ui/src/views/system/role/index.vue
+++ b/ruoyi-ui/src/views/system/role/index.vue
@@ -94,7 +94,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:role:export']"
>导出
@@ -270,8 +269,6 @@ export default {
return {
// 遮罩层
loading: true,
- // 导出遮罩层
- exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
@@ -613,8 +610,10 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.$download.excel('/system/role/export', this.queryParams);
+ this.download('system/role/export', {
+ ...this.queryParams
+ }, `role_${new Date().getTime()}.xlsx`)
}
}
};
-
\ No newline at end of file
+
diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue
index 4faa25020..4d86a14ab 100644
--- a/ruoyi-ui/src/views/system/user/index.vue
+++ b/ruoyi-ui/src/views/system/user/index.vue
@@ -131,7 +131,6 @@
plain
icon="el-icon-download"
size="mini"
- :loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:user:export']"
>导出
@@ -360,8 +359,6 @@ export default {
return {
// 遮罩层
loading: true,
- // 导出遮罩层
- exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
@@ -643,7 +640,9 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- this.$download.excel('/system/user/export', this.queryParams);
+ this.download('system/user/export', {
+ ...this.queryParams
+ }, `user_${new Date().getTime()}.xlsx`)
},
/** 导入按钮操作 */
handleImport() {
@@ -652,7 +651,9 @@ export default {
},
/** 下载模板操作 */
importTemplate() {
- this.$download.excel('/system/user/importTemplate');
+ this.download('system/user/importTemplate', {
+ ...this.queryParams
+ }, `user_template_${new Date().getTime()}.xlsx`)
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
@@ -672,4 +673,4 @@ export default {
}
}
};
-
\ No newline at end of file
+
diff --git a/script/bin/ry.bat b/script/bin/ry.bat
index fd33a7210..ae2494044 100644
--- a/script/bin/ry.bat
+++ b/script/bin/ry.bat
@@ -1,21 +1,21 @@
@echo off
-rem jarƽ��Ŀ¼
+rem jarƽĿ¼
set AppName=ruoyi-admin.jar
-rem JVM����
+rem JVM
set JVM_OPTS="-Dname=%AppName% -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
ECHO.
- ECHO. [1] ����%AppName%
- ECHO. [2] �ر�%AppName%
- ECHO. [3] ����%AppName%
- ECHO. [4] ����״̬ %AppName%
- ECHO. [5] �� ��
+ ECHO. [1] %AppName%
+ ECHO. [2] ر%AppName%
+ ECHO. [3] %AppName%
+ ECHO. [4] ״̬ %AppName%
+ ECHO. [5]
ECHO.
-ECHO.������ѡ����Ŀ�����:
+ECHO.ѡĿ:
set /p ID=
IF "%id%"=="1" GOTO start
IF "%id%"=="2" GOTO stop
@@ -35,11 +35,11 @@ PAUSE
start javaw %JAVA_OPTS% -jar %AppName%
-echo starting����
+echo starting
echo Start %AppName% success...
goto:eof
-rem ����stopͨ��jps�������pid����������
+rem stopͨjpspid
:stop
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
set pid=%%a
@@ -48,7 +48,7 @@ rem ����stopͨ��jps�������pid��������
if not defined pid (echo process %AppName% does not exists) else (
echo prepare to kill %image_name%
echo start kill %pid% ...
- rem ���ݽ���ID��kill����
+ rem ݽIDkill
taskkill /f /pid %pid%
)
goto:eof