班级表增删改查 全局格式化代码

master
liuyunhu 2024-04-22 21:08:06 +08:00
parent 8f4cc5e9f3
commit 2cb1520b9e
280 changed files with 5754 additions and 5305 deletions

View File

@ -18,23 +18,29 @@
* 权限认证使用Jwt支持多终端认证系统。
* 支持加载动态权限菜单,多方式轻松权限控制。
* 高效率开发,使用代码生成器可以一键生成前后端代码。
* 提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev))版本[RuoYi-Vue3](https://github.com/yangzongzhuan/RuoYi-Vue3),保持同步更新。
* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast)Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
*
提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev)
)版本[RuoYi-Vue3](https://github.com/yangzongzhuan/RuoYi-Vue3),保持同步更新。
* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast)
Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi)
,微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)  
* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)  
* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link)
,腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)
  
## 内置功能
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
3. 岗位管理:配置系统用户所属担任职务。
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
7. 参数管理:对系统动态配置常用参数。
8. 通知公告:系统通知公告信息发布维护。
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
3. 岗位管理:配置系统用户所属担任职务。
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
7. 参数管理:对系统动态配置常用参数。
8. 通知公告:系统通知公告信息发布维护。
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
10. 登录日志:系统登录日志记录查询包含登录异常。
11. 在线用户:当前系统中活跃用户状态监控。
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
@ -47,7 +53,7 @@
## 在线体验
- admin/admin123
- admin/admin123
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
演示地址http://vue.ruoyi.vip
@ -90,7 +96,7 @@
</tr>
</table>
## 若依前后端分离交流群
QQ群 [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/已满-201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [![加入QQ群](https://img.shields.io/badge/已满-101456076-blue.svg)](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [![加入QQ群](https://img.shields.io/badge/已满-101539465-blue.svg)](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [![加入QQ群](https://img.shields.io/badge/已满-264312783-blue.svg)](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [![加入QQ群](https://img.shields.io/badge/已满-167385320-blue.svg)](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) [![加入QQ群](https://img.shields.io/badge/已满-104748341-blue.svg)](https://jq.qq.com/?_wv=1027&k=96Dkdq0k) [![加入QQ群](https://img.shields.io/badge/已满-160110482-blue.svg)](https://jq.qq.com/?_wv=1027&k=0fsNiYZt) [![加入QQ群](https://img.shields.io/badge/已满-170801498-blue.svg)](https://jq.qq.com/?_wv=1027&k=7xw4xUG1) [![加入QQ群](https://img.shields.io/badge/已满-108482800-blue.svg)](https://jq.qq.com/?_wv=1027&k=eCx8eyoJ) [![加入QQ群](https://img.shields.io/badge/已满-101046199-blue.svg)](https://jq.qq.com/?_wv=1027&k=SpyH2875) [![加入QQ群](https://img.shields.io/badge/已满-136919097-blue.svg)](https://jq.qq.com/?_wv=1027&k=tKEt51dz) [![加入QQ群](https://img.shields.io/badge/143961921-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=0vBbSb0ztbBgVtn3kJS-Q4HUNYwip89G&authKey=8irq5PhutrZmWIvsUsklBxhj57l%2F1nOZqjzigkXZVoZE451GG4JHPOqW7AW6cf0T&noverify=0&group_code=143961921) 点击按钮入群。
QQ群 [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/已满-201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [![加入QQ群](https://img.shields.io/badge/已满-101456076-blue.svg)](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [![加入QQ群](https://img.shields.io/badge/已满-101539465-blue.svg)](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [![加入QQ群](https://img.shields.io/badge/已满-264312783-blue.svg)](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [![加入QQ群](https://img.shields.io/badge/已满-167385320-blue.svg)](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) [![加入QQ群](https://img.shields.io/badge/已满-104748341-blue.svg)](https://jq.qq.com/?_wv=1027&k=96Dkdq0k) [![加入QQ群](https://img.shields.io/badge/已满-160110482-blue.svg)](https://jq.qq.com/?_wv=1027&k=0fsNiYZt) [![加入QQ群](https://img.shields.io/badge/已满-170801498-blue.svg)](https://jq.qq.com/?_wv=1027&k=7xw4xUG1) [![加入QQ群](https://img.shields.io/badge/已满-108482800-blue.svg)](https://jq.qq.com/?_wv=1027&k=eCx8eyoJ) [![加入QQ群](https://img.shields.io/badge/已满-101046199-blue.svg)](https://jq.qq.com/?_wv=1027&k=SpyH2875) [![加入QQ群](https://img.shields.io/badge/已满-136919097-blue.svg)](https://jq.qq.com/?_wv=1027&k=tKEt51dz) [![加入QQ群](https://img.shields.io/badge/143961921-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=0vBbSb0ztbBgVtn3kJS-Q4HUNYwip89G&authKey=8irq5PhutrZmWIvsUsklBxhj57l%2F1nOZqjzigkXZVoZE451GG4JHPOqW7AW6cf0T&noverify=0&group_code=143961921)
点击按钮入群。

View File

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<groupId>com.muyu</groupId>
<artifactId>ruoyi</artifactId>
@ -177,13 +177,18 @@
<version>${ruoyi.version}</version>
</dependency>
<!-- 自定义项目-->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>ruoyi-custom</artifactId>
<version>${ruoyi.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<modules>
<module>ruoyi-application</module>
<module>ruoyi-basic</module>
<module>ruoyi-custom</module>
</modules>
<packaging>pom</packaging>

View File

@ -11,8 +11,9 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
* @author ruoyi
*/
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@MapperScan("com.ruoyi.*.mapper")
public class RuoYiApplication {
public static void main (String[] args) {
public static void main(String[] args) {
SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙");
}

View File

@ -10,7 +10,7 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
*/
public class RuoYiServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure (SpringApplicationBuilder application) {
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(RuoYiApplication.class);
}
}

View File

@ -45,7 +45,7 @@ public class CaptchaController {
*
*/
@GetMapping("/captchaImage")
public Result<CaptchaModel> getCode (HttpServletResponse response) throws IOException {
public Result<CaptchaModel> getCode(HttpServletResponse response) throws IOException {
Result<CaptchaModel> ajax = Result.success();
boolean captchaEnabled = configService.selectCaptchaEnabled();
CaptchaModel.CaptchaModelBuilder builder

View File

@ -43,7 +43,7 @@ public class CommonController {
* @param delete
*/
@GetMapping("/download")
public void fileDownload (String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
try {
if (!FileUtils.checkAllowDownload(fileName)) {
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
@ -66,7 +66,7 @@ public class CommonController {
*
*/
@PostMapping("/upload")
public Result<UploadFileModel> uploadFile (MultipartFile file) throws Exception {
public Result<UploadFileModel> uploadFile(MultipartFile file) throws Exception {
try {
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
@ -89,7 +89,7 @@ public class CommonController {
*
*/
@PostMapping("/uploads")
public Result<List<UploadFileModel>> uploadFiles (List<MultipartFile> files) throws Exception {
public Result<List<UploadFileModel>> uploadFiles(List<MultipartFile> files) throws Exception {
try {
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
@ -116,7 +116,7 @@ public class CommonController {
*
*/
@GetMapping("/download/resource")
public void resourceDownload (String resource, HttpServletRequest request, HttpServletResponse response)
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
if (!FileUtils.checkAllowDownload(resource)) {

View File

@ -0,0 +1,106 @@
package com.ruoyi.web.controller.custom;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.custom.domain.SysClass;
import com.ruoyi.custom.domain.req.SysClassEditReq;
import com.ruoyi.custom.domain.req.SysClassQueryReq;
import com.ruoyi.custom.domain.req.SysClassSaveReq;
import com.ruoyi.custom.service.SysClassService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller
*
* @author ruoyi
* @date 2024-04-22
*/
@Api(tags = "班级管理")
@RestController
@RequestMapping("/custom/class")
public class SysClassController extends BaseController {
@Autowired
private SysClassService sysClassService;
/**
*
*/
@ApiOperation("获取班级管理列表")
@PreAuthorize("@ss.hasPermi('custom:class:list')")
@GetMapping("/list")
public Result<TableDataInfo<SysClass>> list(SysClassQueryReq sysClassQueryReq) {
startPage();
List<SysClass> list = sysClassService.list(SysClass.queryBuild(sysClassQueryReq));
return getDataTable(list);
}
/**
*
*/
@ApiOperation("导出班级管理列表")
@PreAuthorize("@ss.hasPermi('custom:class:export')")
@Log(title = "班级管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysClass sysClass) {
List<SysClass> list = sysClassService.list(sysClass);
ExcelUtil<SysClass> util = new ExcelUtil<SysClass>(SysClass.class);
util.exportExcel(response, list, "班级管理数据");
}
/**
*
*/
@ApiOperation("获取班级管理详细信息")
@PreAuthorize("@ss.hasPermi('custom:class:query')")
@GetMapping(value = "/{classId}")
@ApiImplicitParam(name = "classId", value = "classId", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
public Result<SysClass> getInfo(@PathVariable("classId") Long classId) {
return Result.success(sysClassService.getById(classId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('custom:class:add')")
@Log(title = "班级管理", businessType = BusinessType.INSERT)
@PostMapping
@ApiOperation("新增班级管理")
public Result<String> add(@RequestBody SysClassSaveReq sysClassSaveReq) {
return toAjax(sysClassService.save(SysClass.saveBuild(sysClassSaveReq)));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('custom:class:edit')")
@Log(title = "班级管理", businessType = BusinessType.UPDATE)
@PutMapping("/{classId}")
@ApiOperation("修改班级管理")
public Result<String> edit(@PathVariable Long classId, @RequestBody SysClassEditReq sysClassEditReq) {
return toAjax(sysClassService.updateById(SysClass.editBuild(classId, sysClassEditReq)));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('custom:class:remove')")
@Log(title = "班级管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{classIds}")
@ApiOperation("删除班级管理")
@ApiImplicitParam(name = "classId", value = "classId", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
public Result<String> remove(@PathVariable List<Long> classIds) {
return toAjax(sysClassService.removeBatchByIds(classIds));
}
}

View File

@ -36,7 +36,7 @@ public class CacheController {
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping()
public Result<Map<String, Object>> getInfo () throws Exception {
public Result<Map<String, Object>> getInfo() throws Exception {
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
@ -59,20 +59,20 @@ public class CacheController {
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getNames")
public Result<List<SysCache>> cache () {
public Result<List<SysCache>> cache() {
return Result.success(caches);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getKeys/{cacheName}")
public Result<Set<String>> getCacheKeys (@PathVariable String cacheName) {
public Result<Set<String>> getCacheKeys(@PathVariable String cacheName) {
Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
return Result.success(cacheKeys);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getValue/{cacheName}/{cacheKey}")
public Result<SysCache> getCacheValue (@PathVariable String cacheName, @PathVariable String cacheKey) {
public Result<SysCache> getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) {
String cacheValue = redisTemplate.opsForValue().get(cacheKey);
SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
return Result.success(sysCache);
@ -80,7 +80,7 @@ public class CacheController {
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheName/{cacheName}")
public Result<String> clearCacheName (@PathVariable String cacheName) {
public Result<String> clearCacheName(@PathVariable String cacheName) {
Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
if (cacheKeys != null) {
redisTemplate.delete(cacheKeys);
@ -90,14 +90,14 @@ public class CacheController {
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheKey/{cacheKey}")
public Result<String> clearCacheKey (@PathVariable String cacheKey) {
public Result<String> clearCacheKey(@PathVariable String cacheKey) {
redisTemplate.delete(cacheKey);
return Result.success();
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheAll")
public Result<String> clearCacheAll () {
public Result<String> clearCacheAll() {
Collection<String> cacheKeys = redisTemplate.keys("*");
if (cacheKeys != null) {
redisTemplate.delete(cacheKeys);

View File

@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
public class ServerController {
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
@GetMapping()
public Result<Server> getInfo () throws Exception {
public Result<Server> getInfo() throws Exception {
Server server = new Server();
server.copyTo();
return Result.success(server);

View File

@ -32,7 +32,7 @@ public class SysLogininforController extends BaseController {
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
@GetMapping("/list")
public Result<TableDataInfo<SysLogininfor>> list (SysLogininfor logininfor) {
public Result<TableDataInfo<SysLogininfor>> list(SysLogininfor logininfor) {
startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list);
@ -41,7 +41,7 @@ public class SysLogininforController extends BaseController {
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
@PostMapping("/export")
public void export (HttpServletResponse response, SysLogininfor logininfor) {
public void export(HttpServletResponse response, SysLogininfor logininfor) {
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
util.exportExcel(response, list, "登录日志");
@ -50,14 +50,14 @@ public class SysLogininforController extends BaseController {
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{infoIds}")
public Result<String> remove (@PathVariable Long[] infoIds) {
public Result<String> remove(@PathVariable Long[] infoIds) {
return toAjax(logininforService.deleteLogininforByIds(infoIds));
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean")
public Result<String> clean () {
public Result<String> clean() {
logininforService.cleanLogininfor();
return Result.success();
}
@ -65,7 +65,7 @@ public class SysLogininforController extends BaseController {
@PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
@GetMapping("/unlock/{userName}")
public Result<String> unlock (@PathVariable("userName") String userName) {
public Result<String> unlock(@PathVariable("userName") String userName) {
passwordService.clearLoginRecordCache(userName);
return Result.success();
}

View File

@ -28,7 +28,7 @@ public class SysOperlogController extends BaseController {
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
@GetMapping("/list")
public Result<TableDataInfo<SysOperLog>> list (SysOperLog operLog) {
public Result<TableDataInfo<SysOperLog>> list(SysOperLog operLog) {
startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list);
@ -37,7 +37,7 @@ public class SysOperlogController extends BaseController {
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
@PostMapping("/export")
public void export (HttpServletResponse response, SysOperLog operLog) {
public void export(HttpServletResponse response, SysOperLog operLog) {
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
util.exportExcel(response, list, "操作日志");
@ -46,14 +46,14 @@ public class SysOperlogController extends BaseController {
@Log(title = "操作日志", businessType = BusinessType.DELETE)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/{operIds}")
public Result<String> remove (@PathVariable Long[] operIds) {
public Result<String> remove(@PathVariable Long[] operIds) {
return toAjax(operLogService.deleteOperLogByIds(operIds));
}
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/clean")
public Result<String> clean () {
public Result<String> clean() {
operLogService.cleanOperLog();
return Result.success();
}

View File

@ -36,7 +36,7 @@ public class SysUserOnlineController extends BaseController {
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
@GetMapping("/list")
public Result<TableDataInfo<SysUserOnline>> list (String ipaddr, String userName) {
public Result<TableDataInfo<SysUserOnline>> list(String ipaddr, String userName) {
Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys) {
@ -62,7 +62,7 @@ public class SysUserOnlineController extends BaseController {
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/{tokenId}")
public Result<String> forceLogout (@PathVariable String tokenId) {
public Result<String> forceLogout(@PathVariable String tokenId) {
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
return Result.success();
}

View File

@ -32,7 +32,7 @@ public class SysConfigController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:config:list')")
@GetMapping("/list")
public Result<TableDataInfo<SysConfig>> list (SysConfig config) {
public Result<TableDataInfo<SysConfig>> list(SysConfig config) {
startPage();
List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list);
@ -41,7 +41,7 @@ public class SysConfigController extends BaseController {
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:config:export')")
@PostMapping("/export")
public void export (HttpServletResponse response, SysConfig config) {
public void export(HttpServletResponse response, SysConfig config) {
List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
util.exportExcel(response, list, "参数数据");
@ -52,7 +52,7 @@ public class SysConfigController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:config:query')")
@GetMapping(value = "/{configId}")
public Result<SysConfig> getInfo (@PathVariable Long configId) {
public Result<SysConfig> getInfo(@PathVariable Long configId) {
return Result.success(configService.selectConfigById(configId));
}
@ -60,7 +60,7 @@ public class SysConfigController extends BaseController {
*
*/
@GetMapping(value = "/configKey/{configKey}")
public Result<String> getConfigKey (@PathVariable String configKey) {
public Result<String> getConfigKey(@PathVariable String configKey) {
return Result.success(configService.selectConfigByKey(configKey));
}
@ -70,7 +70,7 @@ public class SysConfigController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:config:add')")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping
public Result<String> add (@Validated @RequestBody SysConfig config) {
public Result<String> add(@Validated @RequestBody SysConfig config) {
if (!configService.checkConfigKeyUnique(config)) {
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
@ -84,7 +84,7 @@ public class SysConfigController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:config:edit')")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping
public Result<String> edit (@Validated @RequestBody SysConfig config) {
public Result<String> edit(@Validated @RequestBody SysConfig config) {
if (!configService.checkConfigKeyUnique(config)) {
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
@ -98,7 +98,7 @@ public class SysConfigController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}")
public Result<String> remove (@PathVariable Long[] configIds) {
public Result<String> remove(@PathVariable Long[] configIds) {
configService.deleteConfigByIds(configIds);
return Result.success();
}
@ -109,7 +109,7 @@ public class SysConfigController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public Result<String> refreshCache () {
public Result<String> refreshCache() {
configService.resetConfigCache();
return Result.success();
}

View File

@ -32,7 +32,7 @@ public class SysDeptController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list")
public Result<List<SysDept>> list (SysDept dept) {
public Result<List<SysDept>> list(SysDept dept) {
List<SysDept> depts = deptService.selectDeptList(dept);
return Result.success(depts);
}
@ -42,7 +42,7 @@ public class SysDeptController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list/exclude/{deptId}")
public Result<List<SysDept>> excludeChild (@PathVariable(value = "deptId", required = false) Long deptId) {
public Result<List<SysDept>> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) {
List<SysDept> depts = deptService.selectDeptList(new SysDept());
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
return Result.success(depts);
@ -53,7 +53,7 @@ public class SysDeptController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:dept:query')")
@GetMapping(value = "/{deptId}")
public Result<SysDept> getInfo (@PathVariable Long deptId) {
public Result<SysDept> getInfo(@PathVariable Long deptId) {
deptService.checkDeptDataScope(deptId);
return Result.success(deptService.selectDeptById(deptId));
}
@ -64,7 +64,7 @@ public class SysDeptController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dept:add')")
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@PostMapping
public Result<String> add (@Validated @RequestBody SysDept dept) {
public Result<String> add(@Validated @RequestBody SysDept dept) {
if (!deptService.checkDeptNameUnique(dept)) {
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
@ -78,7 +78,7 @@ public class SysDeptController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping
public Result<String> edit (@Validated @RequestBody SysDept dept) {
public Result<String> edit(@Validated @RequestBody SysDept dept) {
Long deptId = dept.getDeptId();
deptService.checkDeptDataScope(deptId);
if (!deptService.checkDeptNameUnique(dept)) {
@ -98,7 +98,7 @@ public class SysDeptController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{deptId}")
public Result<String> remove (@PathVariable Long deptId) {
public Result<String> remove(@PathVariable Long deptId) {
if (deptService.hasChildByDeptId(deptId)) {
return warn("存在下级部门,不允许删除");
}

View File

@ -35,7 +35,7 @@ public class SysDictDataController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
public Result<TableDataInfo<SysDictData>> list (SysDictData dictData) {
public Result<TableDataInfo<SysDictData>> list(SysDictData dictData) {
startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list);
@ -44,7 +44,7 @@ public class SysDictDataController extends BaseController {
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
@PostMapping("/export")
public void export (HttpServletResponse response, SysDictData dictData) {
public void export(HttpServletResponse response, SysDictData dictData) {
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
util.exportExcel(response, list, "字典数据");
@ -55,7 +55,7 @@ public class SysDictDataController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictCode}")
public Result<SysDictData> getInfo (@PathVariable Long dictCode) {
public Result<SysDictData> getInfo(@PathVariable Long dictCode) {
return Result.success(dictDataService.selectDictDataById(dictCode));
}
@ -63,7 +63,7 @@ public class SysDictDataController extends BaseController {
*
*/
@GetMapping(value = "/type/{dictType}")
public Result<List<SysDictData>> dictType (@PathVariable String dictType) {
public Result<List<SysDictData>> dictType(@PathVariable String dictType) {
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data)) {
data = new ArrayList<SysDictData>();
@ -77,7 +77,7 @@ public class SysDictDataController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping
public Result<String> add (@Validated @RequestBody SysDictData dict) {
public Result<String> add(@Validated @RequestBody SysDictData dict) {
dict.setCreateBy(getUserId());
return toAjax(dictDataService.insertDictData(dict));
}
@ -88,7 +88,7 @@ public class SysDictDataController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping
public Result<String> edit (@Validated @RequestBody SysDictData dict) {
public Result<String> edit(@Validated @RequestBody SysDictData dict) {
dict.setUpdateBy(getUserId());
return toAjax(dictDataService.updateDictData(dict));
}
@ -99,7 +99,7 @@ public class SysDictDataController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}")
public Result<String> remove (@PathVariable Long[] dictCodes) {
public Result<String> remove(@PathVariable Long[] dictCodes) {
dictDataService.deleteDictDataByIds(dictCodes);
return Result.success();
}

View File

@ -29,7 +29,7 @@ public class SysDictTypeController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
public Result<TableDataInfo<SysDictType>> list (SysDictType dictType) {
public Result<TableDataInfo<SysDictType>> list(SysDictType dictType) {
startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
@ -38,7 +38,7 @@ public class SysDictTypeController extends BaseController {
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
@PostMapping("/export")
public void export (HttpServletResponse response, SysDictType dictType) {
public void export(HttpServletResponse response, SysDictType dictType) {
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
util.exportExcel(response, list, "字典类型");
@ -49,7 +49,7 @@ public class SysDictTypeController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictId}")
public Result<SysDictType> getInfo (@PathVariable Long dictId) {
public Result<SysDictType> getInfo(@PathVariable Long dictId) {
return Result.success(dictTypeService.selectDictTypeById(dictId));
}
@ -59,7 +59,7 @@ public class SysDictTypeController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典类型", businessType = BusinessType.INSERT)
@PostMapping
public Result<String> add (@Validated @RequestBody SysDictType dict) {
public Result<String> add(@Validated @RequestBody SysDictType dict) {
if (!dictTypeService.checkDictTypeUnique(dict)) {
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
@ -73,7 +73,7 @@ public class SysDictTypeController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
@PutMapping
public Result<String> edit (@Validated @RequestBody SysDictType dict) {
public Result<String> edit(@Validated @RequestBody SysDictType dict) {
if (!dictTypeService.checkDictTypeUnique(dict)) {
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
@ -87,7 +87,7 @@ public class SysDictTypeController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}")
public Result<String> remove (@PathVariable Long[] dictIds) {
public Result<String> remove(@PathVariable Long[] dictIds) {
dictTypeService.deleteDictTypeByIds(dictIds);
return Result.success();
}
@ -98,7 +98,7 @@ public class SysDictTypeController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public Result<String> refreshCache () {
public Result<String> refreshCache() {
dictTypeService.resetDictCache();
return Result.success();
}
@ -107,7 +107,7 @@ public class SysDictTypeController extends BaseController {
*
*/
@GetMapping("/optionselect")
public Result<List<SysDictType>> optionselect () {
public Result<List<SysDictType>> optionselect() {
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
return Result.success(dictTypes);
}

View File

@ -23,7 +23,7 @@ public class SysIndexController {
* 访
*/
@RequestMapping("/")
public String index () {
public String index() {
return StringUtils.format("欢迎使用{}后台管理框架当前版本v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
}
}

View File

@ -39,11 +39,10 @@ public class SysLoginController {
*
*
* @param loginBody
*
* @return
*/
@PostMapping("/login")
public Result<String> login (@RequestBody LoginBody loginBody) {
public Result<String> login(@RequestBody LoginBody loginBody) {
// 生成令牌
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
loginBody.getUuid());
@ -56,7 +55,7 @@ public class SysLoginController {
* @return
*/
@GetMapping("getInfo")
public Result<UserInfoResp> getInfo () {
public Result<UserInfoResp> getInfo() {
SysUser user = SecurityUtils.getLoginUser().getUser();
// 角色集合
Set<String> roles = permissionService.getRolePermission(user);
@ -77,7 +76,7 @@ public class SysLoginController {
* @return
*/
@GetMapping("getRouters")
public Result<List<RouterVo>> getRouters () {
public Result<List<RouterVo>> getRouters() {
Long userId = SecurityUtils.getUserId();
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
return Result.success(menuService.buildMenus(menus));

View File

@ -33,7 +33,7 @@ public class SysMenuController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:menu:list')")
@GetMapping("/list")
public Result<List<SysMenu>> list (SysMenu menu) {
public Result<List<SysMenu>> list(SysMenu menu) {
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return Result.success(menus);
}
@ -43,7 +43,7 @@ public class SysMenuController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:menu:query')")
@GetMapping(value = "/{menuId}")
public Result<SysMenu> getInfo (@PathVariable Long menuId) {
public Result<SysMenu> getInfo(@PathVariable Long menuId) {
return Result.success(menuService.selectMenuById(menuId));
}
@ -51,7 +51,7 @@ public class SysMenuController extends BaseController {
*
*/
@GetMapping("/treeselect")
public Result<List<TreeSelect>> treeselect (SysMenu menu) {
public Result<List<TreeSelect>> treeselect(SysMenu menu) {
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return Result.success(menuService.buildMenuTreeSelect(menus));
}
@ -60,7 +60,7 @@ public class SysMenuController extends BaseController {
*
*/
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
public Result<RoleMenuTreeResp> roleMenuTreeselect (@PathVariable("roleId") Long roleId) {
public Result<RoleMenuTreeResp> roleMenuTreeselect(@PathVariable("roleId") Long roleId) {
List<SysMenu> menus = menuService.selectMenuList(getUserId());
return Result.success(
RoleMenuTreeResp.builder()
@ -76,7 +76,7 @@ public class SysMenuController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:menu:add')")
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
@PostMapping
public Result<String> add (@Validated @RequestBody SysMenu menu) {
public Result<String> add(@Validated @RequestBody SysMenu menu) {
if (!menuService.checkMenuNameUnique(menu)) {
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
@ -92,7 +92,7 @@ public class SysMenuController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@PutMapping
public Result<String> edit (@Validated @RequestBody SysMenu menu) {
public Result<String> edit(@Validated @RequestBody SysMenu menu) {
if (!menuService.checkMenuNameUnique(menu)) {
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
@ -110,7 +110,7 @@ public class SysMenuController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{menuId}")
public Result<String> remove (@PathVariable("menuId") Long menuId) {
public Result<String> remove(@PathVariable("menuId") Long menuId) {
if (menuService.hasChildByMenuId(menuId)) {
return warn("存在子菜单,不允许删除");
}

View File

@ -30,7 +30,7 @@ public class SysNoticeController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:notice:list')")
@GetMapping("/list")
public Result<TableDataInfo<SysNotice>> list (SysNotice notice) {
public Result<TableDataInfo<SysNotice>> list(SysNotice notice) {
startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list);
@ -41,7 +41,7 @@ public class SysNoticeController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:notice:query')")
@GetMapping(value = "/{noticeId}")
public Result<SysNotice> getInfo (@PathVariable Long noticeId) {
public Result<SysNotice> getInfo(@PathVariable Long noticeId) {
return Result.success(noticeService.selectNoticeById(noticeId));
}
@ -51,7 +51,7 @@ public class SysNoticeController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:notice:add')")
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping
public Result<String> add (@Validated @RequestBody SysNotice notice) {
public Result<String> add(@Validated @RequestBody SysNotice notice) {
notice.setCreateBy(getUserId());
return toAjax(noticeService.insertNotice(notice));
}
@ -62,7 +62,7 @@ public class SysNoticeController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PutMapping
public Result<String> edit (@Validated @RequestBody SysNotice notice) {
public Result<String> edit(@Validated @RequestBody SysNotice notice) {
notice.setUpdateBy(getUserId());
return toAjax(noticeService.updateNotice(notice));
}
@ -73,7 +73,7 @@ public class SysNoticeController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
@Log(title = "通知公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}")
public Result<String> remove (@PathVariable Long[] noticeIds) {
public Result<String> remove(@PathVariable Long[] noticeIds) {
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
}
}

View File

@ -32,7 +32,7 @@ public class SysPostController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:post:list')")
@GetMapping("/list")
public Result<TableDataInfo<SysPost>> list (SysPost post) {
public Result<TableDataInfo<SysPost>> list(SysPost post) {
startPage();
List<SysPost> list = postService.selectPostList(post);
return getDataTable(list);
@ -41,7 +41,7 @@ public class SysPostController extends BaseController {
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:post:export')")
@PostMapping("/export")
public void export (HttpServletResponse response, SysPost post) {
public void export(HttpServletResponse response, SysPost post) {
List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
util.exportExcel(response, list, "岗位数据");
@ -52,7 +52,7 @@ public class SysPostController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:post:query')")
@GetMapping(value = "/{postId}")
public Result<SysPost> getInfo (@PathVariable Long postId) {
public Result<SysPost> getInfo(@PathVariable Long postId) {
return Result.success(postService.selectPostById(postId));
}
@ -62,7 +62,7 @@ public class SysPostController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:post:add')")
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping
public Result<String> add (@Validated @RequestBody SysPost post) {
public Result<String> add(@Validated @RequestBody SysPost post) {
if (!postService.checkPostNameUnique(post)) {
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
} else if (!postService.checkPostCodeUnique(post)) {
@ -78,7 +78,7 @@ public class SysPostController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:post:edit')")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PutMapping
public Result<String> edit (@Validated @RequestBody SysPost post) {
public Result<String> edit(@Validated @RequestBody SysPost post) {
if (!postService.checkPostNameUnique(post)) {
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
} else if (!postService.checkPostCodeUnique(post)) {
@ -94,7 +94,7 @@ public class SysPostController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:post:remove')")
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{postIds}")
public Result<String> remove (@PathVariable Long[] postIds) {
public Result<String> remove(@PathVariable Long[] postIds) {
return toAjax(postService.deletePostByIds(postIds));
}
@ -102,7 +102,7 @@ public class SysPostController extends BaseController {
*
*/
@GetMapping("/optionselect")
public Result<List<SysPost>> optionselect () {
public Result<List<SysPost>> optionselect() {
List<SysPost> posts = postService.selectPostAll();
return Result.success(posts);
}

View File

@ -36,7 +36,7 @@ public class SysProfileController extends BaseController {
*
*/
@GetMapping
public Result<ProfileResp> profile () {
public Result<ProfileResp> profile() {
LoginUser loginUser = getLoginUser();
SysUser user = loginUser.getUser();
return Result.success(
@ -53,7 +53,7 @@ public class SysProfileController extends BaseController {
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping
public Result<String> updateProfile (@RequestBody SysUser user) {
public Result<String> updateProfile(@RequestBody SysUser user) {
LoginUser loginUser = getLoginUser();
SysUser currentUser = loginUser.getUser();
currentUser.setNickName(user.getNickName());
@ -79,7 +79,7 @@ public class SysProfileController extends BaseController {
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd")
public Result<String> updatePwd (String oldPassword, String newPassword) {
public Result<String> updatePwd(String oldPassword, String newPassword) {
LoginUser loginUser = getLoginUser();
String userName = loginUser.getUsername();
String password = loginUser.getPassword();
@ -103,7 +103,7 @@ public class SysProfileController extends BaseController {
*/
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
@PostMapping("/avatar")
public Result<String> avatar (@RequestParam("avatarfile") MultipartFile file) throws Exception {
public Result<String> avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception {
if (!file.isEmpty()) {
LoginUser loginUser = getLoginUser();
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);

View File

@ -25,7 +25,7 @@ public class SysRegisterController extends BaseController {
private SysConfigServic configService;
@PostMapping("/register")
public Result<String> register (@RequestBody RegisterBody user) {
public Result<String> register(@RequestBody RegisterBody user) {
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
return error("当前系统没有开启注册功能!");
}

View File

@ -51,7 +51,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/list")
public Result<TableDataInfo<SysRole>> list (SysRole role) {
public Result<TableDataInfo<SysRole>> list(SysRole role) {
startPage();
List<SysRole> list = roleService.selectRoleList(role);
return getDataTable(list);
@ -60,7 +60,7 @@ public class SysRoleController extends BaseController {
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:role:export')")
@PostMapping("/export")
public void export (HttpServletResponse response, SysRole role) {
public void export(HttpServletResponse response, SysRole role) {
List<SysRole> list = roleService.selectRoleList(role);
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
util.exportExcel(response, list, "角色数据");
@ -71,7 +71,7 @@ public class SysRoleController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping(value = "/{roleId}")
public Result<SysRole> getInfo (@PathVariable Long roleId) {
public Result<SysRole> getInfo(@PathVariable Long roleId) {
roleService.checkRoleDataScope(roleId);
return Result.success(roleService.selectRoleById(roleId));
}
@ -82,7 +82,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:add')")
@Log(title = "角色管理", businessType = BusinessType.INSERT)
@PostMapping
public Result<String> add (@Validated @RequestBody SysRole role) {
public Result<String> add(@Validated @RequestBody SysRole role) {
if (!roleService.checkRoleNameUnique(role)) {
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
} else if (!roleService.checkRoleKeyUnique(role)) {
@ -99,7 +99,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping
public Result<String> edit (@Validated @RequestBody SysRole role) {
public Result<String> edit(@Validated @RequestBody SysRole role) {
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
if (!roleService.checkRoleNameUnique(role)) {
@ -128,7 +128,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/dataScope")
public Result<String> dataScope (@RequestBody SysRole role) {
public Result<String> dataScope(@RequestBody SysRole role) {
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
return toAjax(roleService.authDataScope(role));
@ -140,7 +140,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public Result<String> changeStatus (@RequestBody SysRole role) {
public Result<String> changeStatus(@RequestBody SysRole role) {
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
role.setUpdateBy(getUserId());
@ -153,7 +153,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:remove')")
@Log(title = "角色管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{roleIds}")
public Result<String> remove (@PathVariable Long[] roleIds) {
public Result<String> remove(@PathVariable Long[] roleIds) {
return toAjax(roleService.deleteRoleByIds(roleIds));
}
@ -162,7 +162,7 @@ public class SysRoleController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping("/optionselect")
public Result<List<SysRole>> optionselect () {
public Result<List<SysRole>> optionselect() {
return Result.success(roleService.selectRoleAll());
}
@ -171,7 +171,7 @@ public class SysRoleController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/authUser/allocatedList")
public Result<TableDataInfo<SysUser>> allocatedList (SysUser user) {
public Result<TableDataInfo<SysUser>> allocatedList(SysUser user) {
startPage();
List<SysUser> list = userService.selectAllocatedList(user);
return getDataTable(list);
@ -182,7 +182,7 @@ public class SysRoleController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/authUser/unallocatedList")
public Result<TableDataInfo<SysUser>> unallocatedList (SysUser user) {
public Result<TableDataInfo<SysUser>> unallocatedList(SysUser user) {
startPage();
List<SysUser> list = userService.selectUnallocatedList(user);
return getDataTable(list);
@ -194,7 +194,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancel")
public Result<String> cancelAuthUser (@RequestBody SysUserRole userRole) {
public Result<String> cancelAuthUser(@RequestBody SysUserRole userRole) {
return toAjax(roleService.deleteAuthUser(userRole));
}
@ -204,7 +204,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancelAll")
public Result<String> cancelAuthUserAll (Long roleId, Long[] userIds) {
public Result<String> cancelAuthUserAll(Long roleId, Long[] userIds) {
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
}
@ -214,7 +214,7 @@ public class SysRoleController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/selectAll")
public Result<String> selectAuthUserAll (Long roleId, Long[] userIds) {
public Result<String> selectAuthUserAll(Long roleId, Long[] userIds) {
roleService.checkRoleDataScope(roleId);
return toAjax(roleService.insertAuthUsers(roleId, userIds));
}
@ -224,7 +224,7 @@ public class SysRoleController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping(value = "/deptTree/{roleId}")
public Result<DeptTreeResp> deptTree (@PathVariable("roleId") Long roleId) {
public Result<DeptTreeResp> deptTree(@PathVariable("roleId") Long roleId) {
return Result.success(
DeptTreeResp.builder()
.checkedKeys(deptService.selectDeptListByRoleId(roleId))

View File

@ -55,7 +55,7 @@ public class SysUserController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list")
public Result<TableDataInfo<SysUser>> list (SysUser user) {
public Result<TableDataInfo<SysUser>> list(SysUser user) {
startPage();
List<SysUser> list = userService.selectUserList(user);
return getDataTable(list);
@ -64,7 +64,7 @@ public class SysUserController extends BaseController {
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:user:export')")
@PostMapping("/export")
public void export (HttpServletResponse response, SysUser user) {
public void export(HttpServletResponse response, SysUser user) {
List<SysUser> list = userService.selectUserList(user);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
util.exportExcel(response, list, "用户数据");
@ -73,7 +73,7 @@ public class SysUserController extends BaseController {
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:user:import')")
@PostMapping("/importData")
public Result<String> importData (MultipartFile file, boolean updateSupport) throws Exception {
public Result<String> importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
List<SysUser> userList = util.importExcel(file.getInputStream());
Long userId = getUserId();
@ -82,7 +82,7 @@ public class SysUserController extends BaseController {
}
@PostMapping("/importTemplate")
public void importTemplate (HttpServletResponse response) {
public void importTemplate(HttpServletResponse response) {
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
util.importTemplateExcel(response, "用户数据");
}
@ -92,7 +92,7 @@ public class SysUserController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping(value = {"/", "/{userId}"})
public Result<UserDetailInfoResp> getInfo (@PathVariable(value = "userId", required = false) Long userId) {
public Result<UserDetailInfoResp> getInfo(@PathVariable(value = "userId", required = false) Long userId) {
userService.checkUserDataScope(userId);
List<SysRole> roles = roleService.selectRoleAll();
UserDetailInfoRespBuilder builder = UserDetailInfoResp.builder()
@ -115,7 +115,7 @@ public class SysUserController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:user:add')")
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping
public Result<String> add (@Validated @RequestBody SysUser user) {
public Result<String> add(@Validated @RequestBody SysUser user) {
if (!userService.checkUserNameUnique(user)) {
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
@ -134,7 +134,7 @@ public class SysUserController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping
public Result<String> edit (@Validated @RequestBody SysUser user) {
public Result<String> edit(@Validated @RequestBody SysUser user) {
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
if (!userService.checkUserNameUnique(user)) {
@ -154,7 +154,7 @@ public class SysUserController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:user:remove')")
@Log(title = "用户管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}")
public Result<String> remove (@PathVariable Long[] userIds) {
public Result<String> remove(@PathVariable Long[] userIds) {
if (ArrayUtils.contains(userIds, getUserId())) {
return error("当前用户不能删除");
}
@ -167,7 +167,7 @@ public class SysUserController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/resetPwd")
public Result<String> resetPwd (@RequestBody SysUser user) {
public Result<String> resetPwd(@RequestBody SysUser user) {
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
@ -181,7 +181,7 @@ public class SysUserController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public Result<String> changeStatus (@RequestBody SysUser user) {
public Result<String> changeStatus(@RequestBody SysUser user) {
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
user.setUpdateBy(getUserId());
@ -193,7 +193,7 @@ public class SysUserController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping("/authRole/{userId}")
public Result<AuthRoleResp> authRole (@PathVariable("userId") Long userId) {
public Result<AuthRoleResp> authRole(@PathVariable("userId") Long userId) {
SysUser user = userService.selectUserById(userId);
List<SysRole> roles = roleService.selectRolesByUserId(userId);
return Result.success(
@ -210,7 +210,7 @@ public class SysUserController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.GRANT)
@PutMapping("/authRole")
public Result<String> insertAuthRole (Long userId, Long[] roleIds) {
public Result<String> insertAuthRole(Long userId, Long[] roleIds) {
userService.checkUserDataScope(userId);
userService.insertUserAuth(userId, roleIds);
return Result.success();
@ -221,7 +221,7 @@ public class SysUserController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/deptTree")
public Result<List<TreeSelect>> deptTree (SysDept dept) {
public Result<List<TreeSelect>> deptTree(SysDept dept) {
return Result.success(deptService.selectDeptTreeList(dept));
}
}

View File

@ -29,7 +29,7 @@ public class TestController extends BaseController {
@ApiOperation("获取用户列表")
@GetMapping("/list")
public Result<List<UserEntity>> userList () {
public Result<List<UserEntity>> userList() {
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
return Result.success(userList);
}
@ -37,7 +37,7 @@ public class TestController extends BaseController {
@ApiOperation("获取用户详细")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@GetMapping("/{userId}")
public Result<UserEntity> getUser (@PathVariable Integer userId) {
public Result<UserEntity> getUser(@PathVariable Integer userId) {
if (!users.isEmpty() && users.containsKey(userId)) {
return Result.success(users.get(userId));
} else {
@ -53,7 +53,7 @@ public class TestController extends BaseController {
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
})
@PostMapping("/save")
public Result<String> save (UserEntity user) {
public Result<String> save(UserEntity user) {
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) {
return Result.error("用户ID不能为空");
}
@ -63,7 +63,7 @@ public class TestController extends BaseController {
@ApiOperation("更新用户")
@PutMapping("/update")
public Result<String> update (@RequestBody UserEntity user) {
public Result<String> update(@RequestBody UserEntity user) {
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) {
return Result.error("用户ID不能为空");
}
@ -78,7 +78,7 @@ public class TestController extends BaseController {
@ApiOperation("删除用户信息")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@DeleteMapping("/{userId}")
public Result<String> delete (@PathVariable Integer userId) {
public Result<String> delete(@PathVariable Integer userId) {
if (!users.isEmpty() && users.containsKey(userId)) {
users.remove(userId);
return Result.success();
@ -102,46 +102,46 @@ class UserEntity {
@ApiModelProperty("用户手机")
private String mobile;
public UserEntity () {
public UserEntity() {
}
public UserEntity (Integer userId, String username, String password, String mobile) {
public UserEntity(Integer userId, String username, String password, String mobile) {
this.userId = userId;
this.username = username;
this.password = password;
this.mobile = mobile;
}
public Integer getUserId () {
public Integer getUserId() {
return userId;
}
public void setUserId (Integer userId) {
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getUsername () {
public String getUsername() {
return username;
}
public void setUsername (String username) {
public void setUsername(String username) {
this.username = username;
}
public String getPassword () {
public String getPassword() {
return password;
}
public void setPassword (String password) {
public void setPassword(String password) {
this.password = password;
}
public String getMobile () {
public String getMobile() {
return mobile;
}
public void setMobile (String mobile) {
public void setMobile(String mobile) {
this.mobile = mobile;
}
}

View File

@ -47,7 +47,7 @@ public class SwaggerConfig {
* API
*/
@Bean
public Docket createRestApi () {
public Docket createRestApi() {
return new Docket(DocumentationType.OAS_30)
// 是否启用Swagger
.enable(enabled)
@ -71,7 +71,7 @@ public class SwaggerConfig {
/**
* tokenAuthorization
*/
private List<SecurityScheme> securitySchemes () {
private List<SecurityScheme> securitySchemes() {
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
return apiKeyList;
@ -80,7 +80,7 @@ public class SwaggerConfig {
/**
*
*/
private List<SecurityContext> securityContexts () {
private List<SecurityContext> securityContexts() {
List<SecurityContext> securityContexts = new ArrayList<>();
securityContexts.add(
SecurityContext.builder()
@ -93,7 +93,7 @@ public class SwaggerConfig {
/**
*
*/
private List<SecurityReference> defaultAuth () {
private List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
@ -105,7 +105,7 @@ public class SwaggerConfig {
/**
*
*/
private ApiInfo apiInfo () {
private ApiInfo apiInfo() {
// 用ApiInfoBuilder进行定制
return new ApiInfoBuilder()
// 设置标题

View File

@ -16,6 +16,7 @@
<module>ruoyi-framework</module>
<module>ruoyi-system</module>
<module>ruoyi-common</module>
<module>ruoyi-custom</module>
</modules>
<properties>

View File

@ -14,15 +14,15 @@ public @interface DataScope {
/**
*
*/
public String deptAlias () default "";
public String deptAlias() default "";
/**
*
*/
public String userAlias () default "";
public String userAlias() default "";
/**
* @ss
*/
public String permission () default "";
public String permission() default "";
}

View File

@ -19,5 +19,5 @@ public @interface DataSource {
/**
*
*/
public DataSourceType value () default DataSourceType.MASTER;
public DataSourceType value() default DataSourceType.MASTER;
}

View File

@ -21,137 +21,137 @@ public @interface Excel {
/**
* excel
*/
public int sort () default Integer.MAX_VALUE;
public int sort() default Integer.MAX_VALUE;
/**
* Excel.
*/
public String name () default "";
public String name() default "";
/**
* , : yyyy-MM-dd
*/
public String dateFormat () default "";
public String dateFormat() default "";
/**
* type (: sys_user_sex)
*/
public String dictType () default "";
public String dictType() default "";
/**
* (: 0=,1=,2=)
*/
public String readConverterExp () default "";
public String readConverterExp() default "";
/**
*
*/
public String separator () default ",";
public String separator() default ",";
/**
* BigDecimal :-1(BigDecimal)
*/
public int scale () default -1;
public int scale() default -1;
/**
* BigDecimal :BigDecimal.ROUND_HALF_EVEN
*/
public int roundingMode () default BigDecimal.ROUND_HALF_EVEN;
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
/**
* excel
*/
public double height () default 14;
public double height() default 14;
/**
* excel
*/
public double width () default 16;
public double width() default 16;
/**
* ,% 90 90%
*/
public String suffix () default "";
public String suffix() default "";
/**
* ,
*/
public String defaultValue () default "";
public String defaultValue() default "";
/**
*
*/
public String prompt () default "";
public String prompt() default "";
/**
* .
*/
public String[] combo () default {};
public String[] combo() default {};
/**
* ,:list)
*/
public boolean needMerge () default false;
public boolean needMerge() default false;
/**
* ,:,.
*/
public boolean isExport () default true;
public boolean isExport() default true;
/**
* ,,
*/
public String targetAttr () default "";
public String targetAttr() default "";
/**
* ,
*/
public boolean isStatistics () default false;
public boolean isStatistics() default false;
/**
* 0 1 2
*/
public ColumnType cellType () default ColumnType.STRING;
public ColumnType cellType() default ColumnType.STRING;
/**
*
*/
public IndexedColors headerBackgroundColor () default IndexedColors.GREY_50_PERCENT;
public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
/**
*
*/
public IndexedColors headerColor () default IndexedColors.WHITE;
public IndexedColors headerColor() default IndexedColors.WHITE;
/**
*
*/
public IndexedColors backgroundColor () default IndexedColors.WHITE;
public IndexedColors backgroundColor() default IndexedColors.WHITE;
/**
*
*/
public IndexedColors color () default IndexedColors.BLACK;
public IndexedColors color() default IndexedColors.BLACK;
/**
*
*/
public HorizontalAlignment align () default HorizontalAlignment.CENTER;
public HorizontalAlignment align() default HorizontalAlignment.CENTER;
/**
*
*/
public Class<?> handler () default ExcelHandlerAdapter.class;
public Class<?> handler() default ExcelHandlerAdapter.class;
/**
*
*/
public String[] args () default {};
public String[] args() default {};
/**
* 012
*/
Type type () default Type.ALL;
Type type() default Type.ALL;
public enum Type {
/**
@ -168,11 +168,11 @@ public @interface Excel {
IMPORT(2);
private final int value;
Type (int value) {
Type(int value) {
this.value = value;
}
public int value () {
public int value() {
return this.value;
}
}
@ -199,17 +199,19 @@ public @interface Excel {
/**
*
*
* @param value
*/
ColumnType (int value) {
ColumnType(int value) {
this.value = value;
}
/**
*
*
* @return
*/
public int value () {
public int value() {
return this.value;
}
}

View File

@ -13,5 +13,5 @@ import java.lang.annotation.Target;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Excels {
public Excel[] value ();
public Excel[] value();
}

View File

@ -17,30 +17,30 @@ public @interface Log {
/**
*
*/
public String title () default "";
public String title() default "";
/**
*
*/
public BusinessType businessType () default BusinessType.OTHER;
public BusinessType businessType() default BusinessType.OTHER;
/**
*
*/
public OperatorType operatorType () default OperatorType.MANAGE;
public OperatorType operatorType() default OperatorType.MANAGE;
/**
*
*/
public boolean isSaveRequestData () default true;
public boolean isSaveRequestData() default true;
/**
*
*/
public boolean isSaveResponseData () default true;
public boolean isSaveResponseData() default true;
/**
*
*/
public String[] excludeParamNames () default {};
public String[] excludeParamNames() default {};
}

View File

@ -17,20 +17,20 @@ public @interface RateLimiter {
/**
* key
*/
public String key () default CacheConstants.RATE_LIMIT_KEY;
public String key() default CacheConstants.RATE_LIMIT_KEY;
/**
* ,
*/
public int time () default 60;
public int time() default 60;
/**
*
*/
public int count () default 100;
public int count() default 100;
/**
*
*/
public LimitType limitType () default LimitType.DEFAULT;
public LimitType limitType() default LimitType.DEFAULT;
}

View File

@ -15,10 +15,10 @@ public @interface RepeatSubmit {
/**
* (ms)
*/
public int interval () default 5000;
public int interval() default 5000;
/**
*
*/
public String message () default "不允许重复提交,请稍候再试";
public String message() default "不允许重复提交,请稍候再试";
}

View File

@ -40,87 +40,87 @@ public class RuoYiConfig {
*/
private boolean demoEnabled;
public static String getProfile () {
public static String getProfile() {
return profile;
}
public void setProfile (String profile) {
public void setProfile(String profile) {
RuoYiConfig.profile = profile;
}
public static boolean isAddressEnabled () {
public static boolean isAddressEnabled() {
return addressEnabled;
}
public void setAddressEnabled (boolean addressEnabled) {
public void setAddressEnabled(boolean addressEnabled) {
RuoYiConfig.addressEnabled = addressEnabled;
}
public static String getCaptchaType () {
public static String getCaptchaType() {
return captchaType;
}
public void setCaptchaType (String captchaType) {
public void setCaptchaType(String captchaType) {
RuoYiConfig.captchaType = captchaType;
}
/**
*
*/
public static String getImportPath () {
public static String getImportPath() {
return getProfile() + "/import";
}
/**
*
*/
public static String getAvatarPath () {
public static String getAvatarPath() {
return getProfile() + "/avatar";
}
/**
*
*/
public static String getDownloadPath () {
public static String getDownloadPath() {
return getProfile() + "/download/";
}
/**
*
*/
public static String getUploadPath () {
public static String getUploadPath() {
return getProfile() + "/upload";
}
public String getName () {
public String getName() {
return name;
}
public void setName (String name) {
public void setName(String name) {
this.name = name;
}
public String getVersion () {
public String getVersion() {
return version;
}
public void setVersion (String version) {
public void setVersion(String version) {
this.version = version;
}
public String getCopyrightYear () {
public String getCopyrightYear() {
return copyrightYear;
}
public void setCopyrightYear (String copyrightYear) {
public void setCopyrightYear(String copyrightYear) {
this.copyrightYear = copyrightYear;
}
public boolean isDemoEnabled () {
public boolean isDemoEnabled() {
return demoEnabled;
}
public void setDemoEnabled (boolean demoEnabled) {
public void setDemoEnabled(boolean demoEnabled) {
this.demoEnabled = demoEnabled;
}
}

View File

@ -45,11 +45,11 @@ public class ScheduleConstants {
private String value;
private Status (String value) {
private Status(String value) {
this.value = value;
}
public String getValue () {
public String getValue() {
return value;
}
}

View File

@ -12,7 +12,6 @@ import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.sql.SqlUtil;
import org.apache.poi.ss.formula.functions.T;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder;
@ -34,11 +33,11 @@ public class BaseController {
* Date
*/
@InitBinder
public void initBinder (WebDataBinder binder) {
public void initBinder(WebDataBinder binder) {
// Date 类型转换
binder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
@Override
public void setAsText (String text) {
public void setAsText(String text) {
setValue(DateUtils.parseDate(text));
}
});
@ -47,14 +46,14 @@ public class BaseController {
/**
*
*/
protected void startPage () {
protected void startPage() {
PageUtils.startPage();
}
/**
*
*/
protected void startOrderBy () {
protected void startOrderBy() {
PageDomain pageDomain = TableSupport.buildPageRequest();
if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) {
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
@ -65,7 +64,7 @@ public class BaseController {
/**
* 线
*/
protected void clearPage () {
protected void clearPage() {
PageUtils.clearPage();
}
@ -73,7 +72,7 @@ public class BaseController {
*
*/
@SuppressWarnings({"rawtypes", "unchecked"})
protected <T> Result<TableDataInfo<T>> getDataTable (List<T> list) {
protected <T> Result<TableDataInfo<T>> getDataTable(List<T> list) {
return Result.success(
TableDataInfo.<T>builder()
.total(new PageInfo(list).getTotal())
@ -85,14 +84,14 @@ public class BaseController {
/**
*
*/
public Result<String> success () {
public Result<String> success() {
return Result.success();
}
/**
*
*/
public Result<String> error () {
public Result<String> error() {
return Result.error();
}
@ -100,14 +99,14 @@ public class BaseController {
/**
*
*/
public Result<String> error (String message) {
public Result<String> error(String message) {
return Result.error(message);
}
/**
*
*/
public Result<String> warn (String message) {
public Result<String> warn(String message) {
return Result.warn(message);
}
@ -115,10 +114,9 @@ public class BaseController {
*
*
* @param rows
*
* @return
*/
protected Result<String> toAjax (int rows) {
protected Result<String> toAjax(int rows) {
return rows > 0 ? Result.success() : Result.error();
}
@ -126,45 +124,44 @@ public class BaseController {
*
*
* @param result
*
* @return
*/
protected Result<String> toAjax (boolean result) {
protected Result<String> toAjax(boolean result) {
return result ? success() : error();
}
/**
*
*/
public String redirect (String url) {
public String redirect(String url) {
return StringUtils.format("redirect:{}", url);
}
/**
*
*/
public LoginUser getLoginUser () {
public LoginUser getLoginUser() {
return SecurityUtils.getLoginUser();
}
/**
* id
*/
public Long getUserId () {
public Long getUserId() {
return getLoginUser().getUserId();
}
/**
* id
*/
public Long getDeptId () {
public Long getDeptId() {
return getLoginUser().getDeptId();
}
/**
*
*/
public String getUsername () {
public String getUsername() {
return getLoginUser().getUsername();
}
}

View File

@ -40,31 +40,31 @@ public class BaseEntity implements Serializable {
/**
*
*/
@TableField(value = "create_by" , fill = FieldFill.INSERT)
@ApiModelProperty(hidden=true)
@TableField(value = "create_by", fill = FieldFill.INSERT)
@ApiModelProperty(hidden = true)
private Long createBy;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(value = "create_time" , fill = FieldFill.INSERT)
@ApiModelProperty(hidden=true)
@TableField(value = "create_time", fill = FieldFill.INSERT)
@ApiModelProperty(hidden = true)
private Date createTime;
/**
*
*/
@TableField(value = "update_by" , fill = FieldFill.UPDATE)
@ApiModelProperty(hidden=true)
@TableField(value = "update_by", fill = FieldFill.UPDATE)
@ApiModelProperty(hidden = true)
private Long updateBy;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(value = "update_time" , fill = FieldFill.UPDATE)
@ApiModelProperty(hidden=true)
@TableField(value = "update_time", fill = FieldFill.UPDATE)
@ApiModelProperty(hidden = true)
private Date updateTime;
/**
@ -72,26 +72,27 @@ public class BaseEntity implements Serializable {
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@TableField(exist = false)
@ApiModelProperty(hidden=true)
@ApiModelProperty(hidden = true)
private Map<String, Object> params;
public Map<String, Object> getParams () {
public Map<String, Object> getParams() {
if (params == null) {
params = new HashMap<>();
}
return params;
}
public void setParams (Map<String, Object> params) {
public void setParams(Map<String, Object> params) {
this.params = params;
}
/**
*
*
* @param key
* @return
*/
public Object getBeginParam(String key){
public Object getBeginParam(String key) {
return getParams().get(
StringUtils.format(ReqDomain.BEGIN_REF, key)
);
@ -99,10 +100,11 @@ public class BaseEntity implements Serializable {
/**
*
*
* @param key
* @return
*/
public Object getEndParam(String key){
public Object getEndParam(String key) {
return getParams().get(
StringUtils.format(ReqDomain.END_REF, key)
);
@ -110,10 +112,11 @@ public class BaseEntity implements Serializable {
/**
*
*
* @param key
* @return
*/
public Object[] getBetween(String key){
public Object[] getBetween(String key) {
return new Object[]{getBeginParam(key), getEndParam(key)};
}
}

View File

@ -32,59 +32,59 @@ public class Result<T> implements Serializable {
private T data;
public static <T> Result<T> success () {
public static <T> Result<T> success() {
return restResult(null, SUCCESS, "操作成功");
}
public static <T> Result<T> success (T data) {
public static <T> Result<T> success(T data) {
return restResult(data, SUCCESS, "操作成功");
}
public static <T> Result<T> success (T data, String msg) {
public static <T> Result<T> success(T data, String msg) {
return restResult(data, SUCCESS, msg);
}
public static <T> Result<T> error () {
public static <T> Result<T> error() {
return restResult(null, FAIL, "操作失败");
}
public static <T> Result<T> error (String msg) {
public static <T> Result<T> error(String msg) {
return restResult(null, FAIL, msg);
}
public static <T> Result<T> error (T data) {
public static <T> Result<T> error(T data) {
return restResult(data, FAIL, "操作失败");
}
public static <T> Result<T> error (T data, String msg) {
public static <T> Result<T> error(T data, String msg) {
return restResult(data, FAIL, msg);
}
public static <T> Result<T> error (int code, String msg) {
public static <T> Result<T> error(int code, String msg) {
return restResult(null, code, msg);
}
public static <T> Result<T> warn () {
public static <T> Result<T> warn() {
return restResult(null, WARN, "操作失败");
}
public static <T> Result<T> warn (String msg) {
public static <T> Result<T> warn(String msg) {
return restResult(null, WARN, msg);
}
public static <T> Result<T> warn (T data) {
public static <T> Result<T> warn(T data) {
return restResult(data, WARN, "操作失败");
}
public static <T> Result<T> warn (T data, String msg) {
public static <T> Result<T> warn(T data, String msg) {
return restResult(data, WARN, msg);
}
public static <T> Result<T> warn (int code, String msg) {
public static <T> Result<T> warn(int code, String msg) {
return restResult(null, code, msg);
}
private static <T> Result<T> restResult (T data, int code, String msg) {
private static <T> Result<T> restResult(T data, int code, String msg) {
Result<T> apiResult = new Result<>();
apiResult.setCode(code);
apiResult.setData(data);
@ -92,11 +92,11 @@ public class Result<T> implements Serializable {
return apiResult;
}
public static <T> Boolean isError (Result<T> ret) {
public static <T> Boolean isError(Result<T> ret) {
return !isSuccess(ret);
}
public static <T> Boolean isSuccess (Result<T> ret) {
public static <T> Boolean isSuccess(Result<T> ret) {
return Result.SUCCESS == ret.getCode();
}
}

View File

@ -36,43 +36,43 @@ public class TreeEntity extends BaseEntity {
*/
private List<?> children = new ArrayList<>();
public String getParentName () {
public String getParentName() {
return parentName;
}
public void setParentName (String parentName) {
public void setParentName(String parentName) {
this.parentName = parentName;
}
public Long getParentId () {
public Long getParentId() {
return parentId;
}
public void setParentId (Long parentId) {
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Integer getOrderNum () {
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum (Integer orderNum) {
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
public String getAncestors () {
public String getAncestors() {
return ancestors;
}
public void setAncestors (String ancestors) {
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
public List<?> getChildren () {
public List<?> getChildren() {
return children;
}
public void setChildren (List<?> children) {
public void setChildren(List<?> children) {
this.children = children;
}
}

View File

@ -32,43 +32,43 @@ public class TreeSelect implements Serializable {
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children;
public TreeSelect () {
public TreeSelect() {
}
public TreeSelect (SysDept dept) {
public TreeSelect(SysDept dept) {
this.id = dept.getDeptId();
this.label = dept.getDeptName();
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public TreeSelect (SysMenu menu) {
public TreeSelect(SysMenu menu) {
this.id = menu.getMenuId();
this.label = menu.getMenuName();
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public Long getId () {
public Long getId() {
return id;
}
public void setId (Long id) {
public void setId(Long id) {
this.id = id;
}
public String getLabel () {
public String getLabel() {
return label;
}
public void setLabel (String label) {
public void setLabel(String label) {
this.label = label;
}
public List<TreeSelect> getChildren () {
public List<TreeSelect> getChildren() {
return children;
}
public void setChildren (List<TreeSelect> children) {
public void setChildren(List<TreeSelect> children) {
this.children = children;
}
}

View File

@ -79,110 +79,110 @@ public class SysDept extends BaseEntity {
*/
private List<SysDept> children = new ArrayList<SysDept>();
public Long getDeptId () {
public Long getDeptId() {
return deptId;
}
public void setDeptId (Long deptId) {
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public Long getParentId () {
public Long getParentId() {
return parentId;
}
public void setParentId (Long parentId) {
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getAncestors () {
public String getAncestors() {
return ancestors;
}
public void setAncestors (String ancestors) {
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
@NotBlank(message = "部门名称不能为空")
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
public String getDeptName () {
public String getDeptName() {
return deptName;
}
public void setDeptName (String deptName) {
public void setDeptName(String deptName) {
this.deptName = deptName;
}
@NotNull(message = "显示顺序不能为空")
public Integer getOrderNum () {
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum (Integer orderNum) {
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
public String getLeader () {
public String getLeader() {
return leader;
}
public void setLeader (String leader) {
public void setLeader(String leader) {
this.leader = leader;
}
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
public String getPhone () {
public String getPhone() {
return phone;
}
public void setPhone (String phone) {
public void setPhone(String phone) {
this.phone = phone;
}
@Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail () {
public String getEmail() {
return email;
}
public void setEmail (String email) {
public void setEmail(String email) {
this.email = email;
}
public String getStatus () {
public String getStatus() {
return status;
}
public void setStatus (String status) {
public void setStatus(String status) {
this.status = status;
}
public String getDelFlag () {
public String getDelFlag() {
return delFlag;
}
public void setDelFlag (String delFlag) {
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getParentName () {
public String getParentName() {
return parentName;
}
public void setParentName (String parentName) {
public void setParentName(String parentName) {
this.parentName = parentName;
}
public List<SysDept> getChildren () {
public List<SysDept> getChildren() {
return children;
}
public void setChildren (List<SysDept> children) {
public void setChildren(List<SysDept> children) {
this.children = children;
}
@Override
public String toString () {
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("deptId", getDeptId())
.append("parentId", getParentId())

View File

@ -2,7 +2,6 @@ package com.ruoyi.common.core.domain.entity;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
@ -87,29 +86,29 @@ public class SysDictData extends BaseEntity {
@NotBlank(message = "字典标签不能为空")
@Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符")
public String getDictLabel () {
public String getDictLabel() {
return dictLabel;
}
@NotBlank(message = "字典键值不能为空")
@Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符")
public String getDictValue () {
public String getDictValue() {
return dictValue;
}
@NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符")
public String getDictType () {
public String getDictType() {
return dictType;
}
@Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符")
public String getCssClass () {
public String getCssClass() {
return cssClass;
}
@Override
public String toString () {
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("dictCode", getDictCode())
.append("dictSort", getDictSort())

View File

@ -60,19 +60,19 @@ public class SysDictType extends BaseEntity {
@NotBlank(message = "字典名称不能为空")
@Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
public String getDictName () {
public String getDictName() {
return dictName;
}
@NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
@Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)")
public String getDictType () {
public String getDictType() {
return dictType;
}
@Override
public String toString () {
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("dictId", getDictId())
.append("dictName", getDictName())

View File

@ -116,38 +116,38 @@ public class SysMenu extends BaseEntity {
@NotBlank(message = "菜单名称不能为空")
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
public String getMenuName () {
public String getMenuName() {
return menuName;
}
@NotNull(message = "显示顺序不能为空")
public Integer getOrderNum () {
public Integer getOrderNum() {
return orderNum;
}
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
public String getPath () {
public String getPath() {
return path;
}
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
public String getComponent () {
public String getComponent() {
return component;
}
@NotBlank(message = "菜单类型不能为空")
public String getMenuType () {
public String getMenuType() {
return menuType;
}
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
public String getPerms () {
public String getPerms() {
return perms;
}
@Override
public String toString () {
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("menuId", getMenuId())
.append("menuName", getMenuName())

View File

@ -6,7 +6,6 @@ import com.ruoyi.common.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -105,48 +104,49 @@ public class SysRole extends BaseEntity {
private String remark;
public SysRole () {
public SysRole() {
}
public SysRole (Long roleId) {
public SysRole(Long roleId) {
this.roleId = roleId;
}
public static boolean isAdmin (Long roleId) {
public static boolean isAdmin(Long roleId) {
return roleId != null && 1L == roleId;
}
public boolean isAdmin () {
public boolean isAdmin() {
return isAdmin(this.roleId);
}
@NotBlank(message = "角色名称不能为空")
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
public String getRoleName () {
public String getRoleName() {
return roleName;
}
@NotBlank(message = "权限字符不能为空")
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
public String getRoleKey () {
public String getRoleKey() {
return roleKey;
}
@NotNull(message = "显示顺序不能为空")
public Integer getRoleSort () {
public Integer getRoleSort() {
return roleSort;
}
public boolean isMenuCheckStrictly () {
public boolean isMenuCheckStrictly() {
return menuCheckStrictly;
}
public boolean isDeptCheckStrictly () {
public boolean isDeptCheckStrictly() {
return deptCheckStrictly;
}
@Override
public String toString () {
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId())
.append("roleName", getRoleName())

View File

@ -9,7 +9,6 @@ import com.ruoyi.common.xss.Xss;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -141,47 +140,48 @@ public class SysUser extends BaseEntity {
*/
private String remark;
public SysUser () {
public SysUser() {
}
public SysUser (Long userId) {
public SysUser(Long userId) {
this.userId = userId;
}
public static boolean isAdmin (Long userId) {
public static boolean isAdmin(Long userId) {
return userId != null && 1L == userId;
}
public boolean isAdmin () {
public boolean isAdmin() {
return isAdmin(this.userId);
}
@Xss(message = "用户昵称不能包含脚本字符")
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
public String getNickName () {
public String getNickName() {
return nickName;
}
@Xss(message = "用户账号不能包含脚本字符")
@NotBlank(message = "用户账号不能为空")
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
public String getUserName () {
public String getUserName() {
return userName;
}
@Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail () {
public String getEmail() {
return email;
}
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
public String getPhonenumber () {
public String getPhonenumber() {
return phonenumber;
}
@Override
public String toString () {
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("deptId", getDeptId())

View File

@ -26,35 +26,35 @@ public class LoginBody {
*/
private String uuid;
public String getUsername () {
public String getUsername() {
return username;
}
public void setUsername (String username) {
public void setUsername(String username) {
this.username = username;
}
public String getPassword () {
public String getPassword() {
return password;
}
public void setPassword (String password) {
public void setPassword(String password) {
this.password = password;
}
public String getCode () {
public String getCode() {
return code;
}
public void setCode (String code) {
public void setCode(String code) {
this.code = code;
}
public String getUuid () {
public String getUuid() {
return uuid;
}
public void setUuid (String uuid) {
public void setUuid(String uuid) {
this.uuid = uuid;
}
}

View File

@ -71,53 +71,53 @@ public class LoginUser implements UserDetails {
*/
private SysUser user;
public LoginUser () {
public LoginUser() {
}
public LoginUser (SysUser user, Set<String> permissions) {
public LoginUser(SysUser user, Set<String> permissions) {
this.user = user;
this.permissions = permissions;
}
public LoginUser (Long userId, Long deptId, SysUser user, Set<String> permissions) {
public LoginUser(Long userId, Long deptId, SysUser user, Set<String> permissions) {
this.userId = userId;
this.deptId = deptId;
this.user = user;
this.permissions = permissions;
}
public Long getUserId () {
public Long getUserId() {
return userId;
}
public void setUserId (Long userId) {
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getDeptId () {
public Long getDeptId() {
return deptId;
}
public void setDeptId (Long deptId) {
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public String getToken () {
public String getToken() {
return token;
}
public void setToken (String token) {
public void setToken(String token) {
this.token = token;
}
@JSONField(serialize = false)
@Override
public String getPassword () {
public String getPassword() {
return user.getPassword();
}
@Override
public String getUsername () {
public String getUsername() {
return user.getUserName();
}
@ -126,7 +126,7 @@ public class LoginUser implements UserDetails {
*/
@JSONField(serialize = false)
@Override
public boolean isAccountNonExpired () {
public boolean isAccountNonExpired() {
return true;
}
@ -137,7 +137,7 @@ public class LoginUser implements UserDetails {
*/
@JSONField(serialize = false)
@Override
public boolean isAccountNonLocked () {
public boolean isAccountNonLocked() {
return true;
}
@ -148,7 +148,7 @@ public class LoginUser implements UserDetails {
*/
@JSONField(serialize = false)
@Override
public boolean isCredentialsNonExpired () {
public boolean isCredentialsNonExpired() {
return true;
}
@ -159,76 +159,76 @@ public class LoginUser implements UserDetails {
*/
@JSONField(serialize = false)
@Override
public boolean isEnabled () {
public boolean isEnabled() {
return true;
}
public Long getLoginTime () {
public Long getLoginTime() {
return loginTime;
}
public void setLoginTime (Long loginTime) {
public void setLoginTime(Long loginTime) {
this.loginTime = loginTime;
}
public String getIpaddr () {
public String getIpaddr() {
return ipaddr;
}
public void setIpaddr (String ipaddr) {
public void setIpaddr(String ipaddr) {
this.ipaddr = ipaddr;
}
public String getLoginLocation () {
public String getLoginLocation() {
return loginLocation;
}
public void setLoginLocation (String loginLocation) {
public void setLoginLocation(String loginLocation) {
this.loginLocation = loginLocation;
}
public String getBrowser () {
public String getBrowser() {
return browser;
}
public void setBrowser (String browser) {
public void setBrowser(String browser) {
this.browser = browser;
}
public String getOs () {
public String getOs() {
return os;
}
public void setOs (String os) {
public void setOs(String os) {
this.os = os;
}
public Long getExpireTime () {
public Long getExpireTime() {
return expireTime;
}
public void setExpireTime (Long expireTime) {
public void setExpireTime(Long expireTime) {
this.expireTime = expireTime;
}
public Set<String> getPermissions () {
public Set<String> getPermissions() {
return permissions;
}
public void setPermissions (Set<String> permissions) {
public void setPermissions(Set<String> permissions) {
this.permissions = permissions;
}
public SysUser getUser () {
public SysUser getUser() {
return user;
}
public void setUser (SysUser user) {
public void setUser(SysUser user) {
this.user = user;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities () {
public Collection<? extends GrantedAuthority> getAuthorities() {
return null;
}
}

View File

@ -33,42 +33,42 @@ public class PageDomain {
*/
private Boolean reasonable = true;
public String getOrderBy () {
public String getOrderBy() {
if (StringUtils.isEmpty(orderByColumn)) {
return "";
}
return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
}
public Integer getPageNum () {
public Integer getPageNum() {
return pageNum;
}
public void setPageNum (Integer pageNum) {
public void setPageNum(Integer pageNum) {
this.pageNum = pageNum;
}
public Integer getPageSize () {
public Integer getPageSize() {
return pageSize;
}
public void setPageSize (Integer pageSize) {
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public String getOrderByColumn () {
public String getOrderByColumn() {
return orderByColumn;
}
public void setOrderByColumn (String orderByColumn) {
public void setOrderByColumn(String orderByColumn) {
this.orderByColumn = orderByColumn;
}
public String getIsAsc () {
public String getIsAsc() {
return isAsc;
}
public void setIsAsc (String isAsc) {
public void setIsAsc(String isAsc) {
if (StringUtils.isNotEmpty(isAsc)) {
// 兼容前端排序类型
if ("ascending".equals(isAsc)) {
@ -80,14 +80,14 @@ public class PageDomain {
}
}
public Boolean getReasonable () {
public Boolean getReasonable() {
if (StringUtils.isNull(reasonable)) {
return Boolean.TRUE;
}
return reasonable;
}
public void setReasonable (Boolean reasonable) {
public void setReasonable(Boolean reasonable) {
this.reasonable = reasonable;
}
}

View File

@ -37,7 +37,7 @@ public class TableSupport {
/**
*
*/
public static PageDomain getPageDomain () {
public static PageDomain getPageDomain() {
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1));
pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
@ -47,7 +47,7 @@ public class TableSupport {
return pageDomain;
}
public static PageDomain buildPageRequest () {
public static PageDomain buildPageRequest() {
return getPageDomain();
}
}

View File

@ -7,7 +7,10 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
@ -27,7 +30,7 @@ public class RedisCache {
* @param key
* @param value
*/
public <T> void setCacheObject (final String key, final T value) {
public <T> void setCacheObject(final String key, final T value) {
redisTemplate.opsForValue().set(key, value);
}
@ -39,7 +42,7 @@ public class RedisCache {
* @param timeout
* @param timeUnit
*/
public <T> void setCacheObject (final String key, final T value, final Integer timeout, final TimeUnit timeUnit) {
public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) {
redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
}
@ -48,10 +51,9 @@ public class RedisCache {
*
* @param key Redis
* @param timeout
*
* @return true=false=
*/
public boolean expire (final String key, final long timeout) {
public boolean expire(final String key, final long timeout) {
return expire(key, timeout, TimeUnit.SECONDS);
}
@ -61,10 +63,9 @@ public class RedisCache {
* @param key Redis
* @param timeout
* @param unit
*
* @return true=false=
*/
public boolean expire (final String key, final long timeout, final TimeUnit unit) {
public boolean expire(final String key, final long timeout, final TimeUnit unit) {
return Boolean.TRUE.equals(redisTemplate.expire(key, timeout, unit));
}
@ -72,10 +73,9 @@ public class RedisCache {
*
*
* @param key Redis
*
* @return
*/
public long getExpire (final String key) {
public long getExpire(final String key) {
return redisTemplate.getExpire(key);
}
@ -83,10 +83,9 @@ public class RedisCache {
* key
*
* @param key
*
* @return true false
*/
public Boolean hasKey (String key) {
public Boolean hasKey(String key) {
return redisTemplate.hasKey(key);
}
@ -94,10 +93,9 @@ public class RedisCache {
*
*
* @param key
*
* @return
*/
public <T> T getCacheObject (final String key) {
public <T> T getCacheObject(final String key) {
ValueOperations<String, T> operation = redisTemplate.opsForValue();
return operation.get(key);
}
@ -107,7 +105,7 @@ public class RedisCache {
*
* @param key
*/
public boolean deleteObject (final String key) {
public boolean deleteObject(final String key) {
return redisTemplate.delete(key);
}
@ -115,10 +113,9 @@ public class RedisCache {
*
*
* @param collection
*
* @return
*/
public boolean deleteObject (final Collection collection) {
public boolean deleteObject(final Collection collection) {
return redisTemplate.delete(collection) > 0;
}
@ -127,10 +124,9 @@ public class RedisCache {
*
* @param key
* @param dataList List
*
* @return
*/
public <T> long setCacheList (final String key, final List<T> dataList) {
public <T> long setCacheList(final String key, final List<T> dataList) {
Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
return count == null ? 0 : count;
}
@ -139,10 +135,9 @@ public class RedisCache {
* list
*
* @param key
*
* @return
*/
public <T> List<T> getCacheList (final String key) {
public <T> List<T> getCacheList(final String key) {
return redisTemplate.opsForList().range(key, 0, -1);
}
@ -151,10 +146,9 @@ public class RedisCache {
*
* @param key
* @param dataSet
*
* @return
*/
public <T> BoundSetOperations<String, T> setCacheSet (final String key, final Set<T> dataSet) {
public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) {
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
for (T t : dataSet) {
setOperation.add(t);
@ -166,10 +160,9 @@ public class RedisCache {
* set
*
* @param key
*
* @return
*/
public <T> Set<T> getCacheSet (final String key) {
public <T> Set<T> getCacheSet(final String key) {
return redisTemplate.opsForSet().members(key);
}
@ -179,7 +172,7 @@ public class RedisCache {
* @param key
* @param dataMap
*/
public <T> void setCacheMap (final String key, final Map<String, T> dataMap) {
public <T> void setCacheMap(final String key, final Map<String, T> dataMap) {
if (dataMap != null) {
redisTemplate.opsForHash().putAll(key, dataMap);
}
@ -189,10 +182,9 @@ public class RedisCache {
* Map
*
* @param key
*
* @return
*/
public <T> Map<String, T> getCacheMap (final String key) {
public <T> Map<String, T> getCacheMap(final String key) {
return redisTemplate.opsForHash().entries(key);
}
@ -203,7 +195,7 @@ public class RedisCache {
* @param hKey Hash
* @param value
*/
public <T> void setCacheMapValue (final String key, final String hKey, final T value) {
public <T> void setCacheMapValue(final String key, final String hKey, final T value) {
redisTemplate.opsForHash().put(key, hKey, value);
}
@ -212,10 +204,9 @@ public class RedisCache {
*
* @param key Redis
* @param hKey Hash
*
* @return Hash
*/
public <T> T getCacheMapValue (final String key, final String hKey) {
public <T> T getCacheMapValue(final String key, final String hKey) {
HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
return opsForHash.get(key, hKey);
}
@ -225,10 +216,9 @@ public class RedisCache {
*
* @param key Redis
* @param hKeys Hash
*
* @return Hash
*/
public <T> List<T> getMultiCacheMapValue (final String key, final Collection<Object> hKeys) {
public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) {
return redisTemplate.opsForHash().multiGet(key, hKeys);
}
@ -237,10 +227,9 @@ public class RedisCache {
*
* @param key Redis
* @param hKey Hash
*
* @return
*/
public boolean deleteCacheMapValue (final String key, final String hKey) {
public boolean deleteCacheMapValue(final String key, final String hKey) {
return redisTemplate.opsForHash().delete(key, hKey) > 0;
}
@ -248,10 +237,9 @@ public class RedisCache {
*
*
* @param pattern
*
* @return
*/
public Collection<String> keys (final String pattern) {
public Collection<String> keys(final String pattern) {
return redisTemplate.keys(pattern);
}
}

View File

@ -41,10 +41,9 @@ public class CharsetKit {
* Charset
*
* @param charset
*
* @return Charset
*/
public static Charset charset (String charset) {
public static Charset charset(String charset) {
return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset);
}
@ -54,10 +53,9 @@ public class CharsetKit {
* @param source
* @param srcCharset ISO-8859-1
* @param destCharset UTF-8
*
* @return
*/
public static String convert (String source, String srcCharset, String destCharset) {
public static String convert(String source, String srcCharset, String destCharset) {
return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset));
}
@ -67,10 +65,9 @@ public class CharsetKit {
* @param source
* @param srcCharset ISO-8859-1
* @param destCharset UTF-8
*
* @return
*/
public static String convert (String source, Charset srcCharset, Charset destCharset) {
public static String convert(String source, Charset srcCharset, Charset destCharset) {
if (null == srcCharset) {
srcCharset = StandardCharsets.ISO_8859_1;
}
@ -88,7 +85,7 @@ public class CharsetKit {
/**
* @return
*/
public static String systemCharset () {
public static String systemCharset() {
return Charset.defaultCharset().name();
}
}

View File

@ -23,10 +23,9 @@ public class Convert {
*
* @param value
* @param defaultValue
*
* @return
*/
public static String toStr (Object value, String defaultValue) {
public static String toStr(Object value, String defaultValue) {
if (null == value) {
return defaultValue;
}
@ -42,10 +41,9 @@ public class Convert {
*
*
* @param value
*
* @return
*/
public static String toStr (Object value) {
public static String toStr(Object value) {
return toStr(value, null);
}
@ -56,10 +54,9 @@ public class Convert {
*
* @param value
* @param defaultValue
*
* @return
*/
public static Character toChar (Object value, Character defaultValue) {
public static Character toChar(Object value, Character defaultValue) {
if (null == value) {
return defaultValue;
}
@ -77,10 +74,9 @@ public class Convert {
*
*
* @param value
*
* @return
*/
public static Character toChar (Object value) {
public static Character toChar(Object value) {
return toChar(value, null);
}
@ -91,10 +87,9 @@ public class Convert {
*
* @param value
* @param defaultValue
*
* @return
*/
public static Byte toByte (Object value, Byte defaultValue) {
public static Byte toByte(Object value, Byte defaultValue) {
if (value == null) {
return defaultValue;
}
@ -121,10 +116,9 @@ public class Convert {
*
*
* @param value
*
* @return
*/
public static Byte toByte (Object value) {
public static Byte toByte(Object value) {
return toByte(value, null);
}
@ -135,10 +129,9 @@ public class Convert {
*
* @param value
* @param defaultValue
*
* @return
*/
public static Short toShort (Object value, Short defaultValue) {
public static Short toShort(Object value, Short defaultValue) {
if (value == null) {
return defaultValue;
}
@ -165,10 +158,9 @@ public class Convert {
*
*
* @param value
*
* @return
*/
public static Short toShort (Object value) {
public static Short toShort(Object value) {
return toShort(value, null);
}
@ -179,10 +171,9 @@ public class Convert {
*
* @param value
* @param defaultValue
*
* @return
*/
public static Number toNumber (Object value, Number defaultValue) {
public static Number toNumber(Object value, Number defaultValue) {
if (value == null) {
return defaultValue;
}
@ -206,10 +197,9 @@ public class Convert {
*
*
* @param value
*
* @return
*/
public static Number toNumber (Object value) {
public static Number toNumber(Object value) {
return toNumber(value, null);
}
@ -220,10 +210,9 @@ public class Convert {
*
* @param value
* @param defaultValue
*
* @return
*/
public static Integer toInt (Object value, Integer defaultValue) {
public static Integer toInt(Object value, Integer defaultValue) {
if (value == null) {
return defaultValue;
}
@ -250,10 +239,9 @@ public class Convert {
*
*
* @param value
*
* @return
*/
public static Integer toInt (Object value) {
public static Integer toInt(Object value) {
return toInt(value, null);
}
@ -261,10 +249,9 @@ public class Convert {
* Integer<br>
*
* @param str
*
* @return
*/
public static Integer[] toIntArray (String str) {
public static Integer[] toIntArray(String str) {
return toIntArray(",", str);
}
@ -272,10 +259,9 @@ public class Convert {
* Long<br>
*
* @param str
*
* @return
*/
public static Long[] toLongArray (String str) {
public static Long[] toLongArray(String str) {
return toLongArray(",", str);
}
@ -284,16 +270,15 @@ public class Convert {
*
* @param split
* @param split
*
* @return
*/
public static Integer[] toIntArray (String split, String str) {
public static Integer[] toIntArray(String split, String str) {
if (StringUtils.isEmpty(str)) {
return new Integer[]{};
}
String[] arr = str.split(split);
final Integer[] ints = new Integer[arr.length];
for (int i = 0 ; i < arr.length ; i++) {
for (int i = 0; i < arr.length; i++) {
final Integer v = toInt(arr[i], 0);
ints[i] = v;
}
@ -305,16 +290,15 @@ public class Convert {
*
* @param split
* @param str
*
* @return
*/
public static Long[] toLongArray (String split, String str) {
public static Long[] toLongArray(String split, String str) {
if (StringUtils.isEmpty(str)) {
return new Long[]{};
}
String[] arr = str.split(split);
final Long[] longs = new Long[arr.length];
for (int i = 0 ; i < arr.length ; i++) {
for (int i = 0; i < arr.length; i++) {
final Long v = toLong(arr[i], null);
longs[i] = v;
}
@ -325,10 +309,9 @@ public class Convert {
* String<br>
*
* @param str
*
* @return
*/
public static String[] toStrArray (String str) {
public static String[] toStrArray(String str) {
return toStrArray(",", str);
}
@ -337,10 +320,9 @@ public class Convert {
*
* @param split
* @param split
*
* @return
*/
public static String[] toStrArray (String split, String str) {
public static String[] toStrArray(String split, String str) {
return str.split(split);
}
@ -351,10 +333,9 @@ public class Convert {
*
* @param value
* @param defaultValue
*
* @return
*/
public static Long toLong (Object value, Long defaultValue) {
public static Long toLong(Object value, Long defaultValue) {
if (value == null) {
return defaultValue;
}
@ -382,10 +363,9 @@ public class Convert {
*
*
* @param value
*
* @return
*/
public static Long toLong (Object value) {
public static Long toLong(Object value) {
return toLong(value, null);
}
@ -396,10 +376,9 @@ public class Convert {
*
* @param value
* @param defaultValue
*
* @return
*/
public static Double toDouble (Object value, Double defaultValue) {
public static Double toDouble(Object value, Double defaultValue) {
if (value == null) {
return defaultValue;
}
@ -427,10 +406,9 @@ public class Convert {
*
*
* @param value
*
* @return
*/
public static Double toDouble (Object value) {
public static Double toDouble(Object value) {
return toDouble(value, null);
}
@ -441,10 +419,9 @@ public class Convert {
*
* @param value
* @param defaultValue
*
* @return
*/
public static Float toFloat (Object value, Float defaultValue) {
public static Float toFloat(Object value, Float defaultValue) {
if (value == null) {
return defaultValue;
}
@ -471,10 +448,9 @@ public class Convert {
*
*
* @param value
*
* @return
*/
public static Float toFloat (Object value) {
public static Float toFloat(Object value) {
return toFloat(value, null);
}
@ -485,10 +461,9 @@ public class Convert {
*
* @param value
* @param defaultValue
*
* @return
*/
public static Boolean toBool (Object value, Boolean defaultValue) {
public static Boolean toBool(Object value, Boolean defaultValue) {
if (value == null) {
return defaultValue;
}
@ -521,10 +496,9 @@ public class Convert {
*
*
* @param value
*
* @return
*/
public static Boolean toBool (Object value) {
public static Boolean toBool(Object value) {
return toBool(value, null);
}
@ -535,10 +509,9 @@ public class Convert {
* @param clazz EnumClass
* @param value
* @param defaultValue
*
* @return Enum
*/
public static <E extends Enum<E>> E toEnum (Class<E> clazz, Object value, E defaultValue) {
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue) {
if (value == null) {
return defaultValue;
}
@ -564,10 +537,9 @@ public class Convert {
*
* @param clazz EnumClass
* @param value
*
* @return Enum
*/
public static <E extends Enum<E>> E toEnum (Class<E> clazz, Object value) {
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value) {
return toEnum(clazz, value, null);
}
@ -578,10 +550,9 @@ public class Convert {
*
* @param value
* @param defaultValue
*
* @return
*/
public static BigInteger toBigInteger (Object value, BigInteger defaultValue) {
public static BigInteger toBigInteger(Object value, BigInteger defaultValue) {
if (value == null) {
return defaultValue;
}
@ -608,10 +579,9 @@ public class Convert {
*
*
* @param value
*
* @return
*/
public static BigInteger toBigInteger (Object value) {
public static BigInteger toBigInteger(Object value) {
return toBigInteger(value, null);
}
@ -622,10 +592,9 @@ public class Convert {
*
* @param value
* @param defaultValue
*
* @return
*/
public static BigDecimal toBigDecimal (Object value, BigDecimal defaultValue) {
public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) {
if (value == null) {
return defaultValue;
}
@ -658,10 +627,9 @@ public class Convert {
*
*
* @param value
*
* @return
*/
public static BigDecimal toBigDecimal (Object value) {
public static BigDecimal toBigDecimal(Object value) {
return toBigDecimal(value, null);
}
@ -670,10 +638,9 @@ public class Convert {
* 1ByteByteBuffer 2Arrays.toString
*
* @param obj
*
* @return
*/
public static String utf8Str (Object obj) {
public static String utf8Str(Object obj) {
return str(obj, CharsetKit.CHARSET_UTF_8);
}
@ -683,10 +650,9 @@ public class Convert {
*
* @param obj
* @param charsetName
*
* @return
*/
public static String str (Object obj, String charsetName) {
public static String str(Object obj, String charsetName) {
return str(obj, Charset.forName(charsetName));
}
@ -696,10 +662,9 @@ public class Convert {
*
* @param obj
* @param charset
*
* @return
*/
public static String str (Object obj, Charset charset) {
public static String str(Object obj, Charset charset) {
if (null == obj) {
return null;
}
@ -722,10 +687,9 @@ public class Convert {
*
* @param bytes byte
* @param charset
*
* @return
*/
public static String str (byte[] bytes, String charset) {
public static String str(byte[] bytes, String charset) {
return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset));
}
@ -734,10 +698,9 @@ public class Convert {
*
* @param data
* @param charset
*
* @return
*/
public static String str (byte[] data, Charset charset) {
public static String str(byte[] data, Charset charset) {
if (data == null) {
return null;
}
@ -753,10 +716,9 @@ public class Convert {
*
* @param data
* @param charset 使
*
* @return
*/
public static String str (ByteBuffer data, String charset) {
public static String str(ByteBuffer data, String charset) {
if (data == null) {
return null;
}
@ -769,10 +731,9 @@ public class Convert {
*
* @param data
* @param charset 使
*
* @return
*/
public static String str (ByteBuffer data, Charset charset) {
public static String str(ByteBuffer data, Charset charset) {
if (null == charset) {
charset = Charset.defaultCharset();
}
@ -785,10 +746,9 @@ public class Convert {
*
*
* @param input String.
*
* @return .
*/
public static String toSBC (String input) {
public static String toSBC(String input) {
return toSBC(input, null);
}
@ -797,12 +757,11 @@ public class Convert {
*
* @param input String
* @param notConvertSet
*
* @return .
*/
public static String toSBC (String input, Set<Character> notConvertSet) {
public static String toSBC(String input, Set<Character> notConvertSet) {
char[] c = input.toCharArray();
for (int i = 0 ; i < c.length ; i++) {
for (int i = 0; i < c.length; i++) {
if (null != notConvertSet && notConvertSet.contains(c[i])) {
// 跳过不替换的字符
continue;
@ -822,10 +781,9 @@ public class Convert {
*
*
* @param input String.
*
* @return
*/
public static String toDBC (String input) {
public static String toDBC(String input) {
return toDBC(input, null);
}
@ -834,12 +792,11 @@ public class Convert {
*
* @param text
* @param notConvertSet
*
* @return
*/
public static String toDBC (String text, Set<Character> notConvertSet) {
public static String toDBC(String text, Set<Character> notConvertSet) {
char[] c = text.toCharArray();
for (int i = 0 ; i < c.length ; i++) {
for (int i = 0; i < c.length; i++) {
if (null != notConvertSet && notConvertSet.contains(c[i])) {
// 跳过不替换的字符
continue;
@ -860,10 +817,9 @@ public class Convert {
*
*
* @param n
*
* @return
*/
public static String digitUppercase (double n) {
public static String digitUppercase(double n) {
String[] fraction = {"角", "分"};
String[] digit = {"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"};
String[][] unit = {{"元", "万", "亿"}, {"", "拾", "佰", "仟"}};
@ -872,7 +828,7 @@ public class Convert {
n = Math.abs(n);
String s = "";
for (int i = 0 ; i < fraction.length ; i++) {
for (int i = 0; i < fraction.length; i++) {
s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", "");
}
if (s.length() < 1) {
@ -880,9 +836,9 @@ public class Convert {
}
int integerPart = (int) Math.floor(n);
for (int i = 0 ; i < unit[0].length && integerPart > 0 ; i++) {
for (int i = 0; i < unit[0].length && integerPart > 0; i++) {
String p = "";
for (int j = 0 ; j < unit[1].length && n > 0 ; j++) {
for (int j = 0; j < unit[1].length && n > 0; j++) {
p = digit[integerPart % 10] + unit[1][j] + p;
integerPart = integerPart / 10;
}

View File

@ -24,10 +24,9 @@ public class StrFormatter {
*
* @param strPattern
* @param argArray
*
* @return
*/
public static String format (final String strPattern, final Object... argArray) {
public static String format(final String strPattern, final Object... argArray) {
if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) {
return strPattern;
}
@ -38,7 +37,7 @@ public class StrFormatter {
int handledPosition = 0;
int delimIndex;// 占位符所在位置
for (int argIndex = 0 ; argIndex < argArray.length ; argIndex++) {
for (int argIndex = 0; argIndex < argArray.length; argIndex++) {
delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition);
if (delimIndex == -1) {
if (handledPosition == 0) {

View File

@ -22,11 +22,11 @@ public enum HttpMethod {
}
@Nullable
public static HttpMethod resolve (@Nullable String method) {
public static HttpMethod resolve(@Nullable String method) {
return (method != null ? mappings.get(method) : null);
}
public boolean matches (String method) {
public boolean matches(String method) {
return (this == resolve(method));
}
}

View File

@ -11,16 +11,16 @@ public enum UserStatus {
private final String code;
private final String info;
UserStatus (String code, String info) {
UserStatus(String code, String info) {
this.code = code;
this.info = info;
}
public String getCode () {
public String getCode() {
return code;
}
public String getInfo () {
public String getInfo() {
return info;
}
}

View File

@ -8,6 +8,6 @@ package com.ruoyi.common.exception;
public class DemoModeException extends RuntimeException {
private static final long serialVersionUID = 1L;
public DemoModeException () {
public DemoModeException() {
}
}

View File

@ -23,28 +23,28 @@ public class GlobalException extends RuntimeException {
/**
*
*/
public GlobalException () {
public GlobalException() {
}
public GlobalException (String message) {
public GlobalException(String message) {
this.message = message;
}
public String getDetailMessage () {
public String getDetailMessage() {
return detailMessage;
}
public GlobalException setDetailMessage (String detailMessage) {
public GlobalException setDetailMessage(String detailMessage) {
this.detailMessage = detailMessage;
return this;
}
@Override
public String getMessage () {
public String getMessage() {
return message;
}
public GlobalException setMessage (String message) {
public GlobalException setMessage(String message) {
this.message = message;
return this;
}

View File

@ -28,38 +28,38 @@ public final class ServiceException extends RuntimeException {
/**
*
*/
public ServiceException () {
public ServiceException() {
}
public ServiceException (String message) {
public ServiceException(String message) {
this.message = message;
}
public ServiceException (String message, Integer code) {
public ServiceException(String message, Integer code) {
this.message = message;
this.code = code;
}
public String getDetailMessage () {
public String getDetailMessage() {
return detailMessage;
}
public ServiceException setDetailMessage (String detailMessage) {
public ServiceException setDetailMessage(String detailMessage) {
this.detailMessage = detailMessage;
return this;
}
@Override
public String getMessage () {
public String getMessage() {
return message;
}
public ServiceException setMessage (String message) {
public ServiceException setMessage(String message) {
this.message = message;
return this;
}
public Integer getCode () {
public Integer getCode() {
return code;
}
}

View File

@ -8,15 +8,15 @@ package com.ruoyi.common.exception;
public class UtilException extends RuntimeException {
private static final long serialVersionUID = 8247610319171014183L;
public UtilException (Throwable e) {
public UtilException(Throwable e) {
super(e.getMessage(), e);
}
public UtilException (String message) {
public UtilException(String message) {
super(message);
}
public UtilException (String message, Throwable throwable) {
public UtilException(String message, Throwable throwable) {
super(message, throwable);
}
}

View File

@ -31,31 +31,31 @@ public class BaseException extends RuntimeException {
*/
private String defaultMessage;
public BaseException (String module, String code, Object[] args, String defaultMessage) {
public BaseException(String module, String code, Object[] args, String defaultMessage) {
this.module = module;
this.code = code;
this.args = args;
this.defaultMessage = defaultMessage;
}
public BaseException (String module, String code, Object[] args) {
public BaseException(String module, String code, Object[] args) {
this(module, code, args, null);
}
public BaseException (String module, String defaultMessage) {
public BaseException(String module, String defaultMessage) {
this(module, null, null, defaultMessage);
}
public BaseException (String code, Object[] args) {
public BaseException(String code, Object[] args) {
this(null, code, args, null);
}
public BaseException (String defaultMessage) {
public BaseException(String defaultMessage) {
this(null, null, null, defaultMessage);
}
@Override
public String getMessage () {
public String getMessage() {
String message = null;
if (!StringUtils.isEmpty(code)) {
message = MessageUtils.message(code, args);
@ -66,19 +66,19 @@ public class BaseException extends RuntimeException {
return message;
}
public String getModule () {
public String getModule() {
return module;
}
public String getCode () {
public String getCode() {
return code;
}
public Object[] getArgs () {
public Object[] getArgs() {
return args;
}
public String getDefaultMessage () {
public String getDefaultMessage() {
return defaultMessage;
}
}

View File

@ -10,7 +10,7 @@ import com.ruoyi.common.exception.base.BaseException;
public class FileException extends BaseException {
private static final long serialVersionUID = 1L;
public FileException (String code, Object[] args) {
public FileException(String code, Object[] args) {
super("file", code, args, null);
}

View File

@ -8,7 +8,7 @@ package com.ruoyi.common.exception.file;
public class FileNameLengthLimitExceededException extends FileException {
private static final long serialVersionUID = 1L;
public FileNameLengthLimitExceededException (int defaultFileNameLength) {
public FileNameLengthLimitExceededException(int defaultFileNameLength) {
super("upload.filename.exceed.length", new Object[]{defaultFileNameLength});
}
}

View File

@ -8,7 +8,7 @@ package com.ruoyi.common.exception.file;
public class FileSizeLimitExceededException extends FileException {
private static final long serialVersionUID = 1L;
public FileSizeLimitExceededException (long defaultMaxSize) {
public FileSizeLimitExceededException(long defaultMaxSize) {
super("upload.exceed.maxSize", new Object[]{defaultMaxSize});
}
}

View File

@ -14,21 +14,21 @@ public class FileUploadException extends Exception {
private final Throwable cause;
public FileUploadException () {
public FileUploadException() {
this(null, null);
}
public FileUploadException (final String msg) {
public FileUploadException(final String msg) {
this(msg, null);
}
public FileUploadException (String msg, Throwable cause) {
public FileUploadException(String msg, Throwable cause) {
super(msg);
this.cause = cause;
}
@Override
public void printStackTrace (PrintStream stream) {
public void printStackTrace(PrintStream stream) {
super.printStackTrace(stream);
if (cause != null) {
stream.println("Caused by:");
@ -37,7 +37,7 @@ public class FileUploadException extends Exception {
}
@Override
public void printStackTrace (PrintWriter writer) {
public void printStackTrace(PrintWriter writer) {
super.printStackTrace(writer);
if (cause != null) {
writer.println("Caused by:");
@ -46,7 +46,7 @@ public class FileUploadException extends Exception {
}
@Override
public Throwable getCause () {
public Throwable getCause() {
return cause;
}
}

View File

@ -14,29 +14,29 @@ public class InvalidExtensionException extends FileUploadException {
private String extension;
private String filename;
public InvalidExtensionException (String[] allowedExtension, String extension, String filename) {
public InvalidExtensionException(String[] allowedExtension, String extension, String filename) {
super("文件[" + filename + "]后缀[" + extension + "]不正确,请上传" + Arrays.toString(allowedExtension) + "格式");
this.allowedExtension = allowedExtension;
this.extension = extension;
this.filename = filename;
}
public String[] getAllowedExtension () {
public String[] getAllowedExtension() {
return allowedExtension;
}
public String getExtension () {
public String getExtension() {
return extension;
}
public String getFilename () {
public String getFilename() {
return filename;
}
public static class InvalidImageExtensionException extends InvalidExtensionException {
private static final long serialVersionUID = 1L;
public InvalidImageExtensionException (String[] allowedExtension, String extension, String filename) {
public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename) {
super(allowedExtension, extension, filename);
}
}
@ -44,7 +44,7 @@ public class InvalidExtensionException extends FileUploadException {
public static class InvalidFlashExtensionException extends InvalidExtensionException {
private static final long serialVersionUID = 1L;
public InvalidFlashExtensionException (String[] allowedExtension, String extension, String filename) {
public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename) {
super(allowedExtension, extension, filename);
}
}
@ -52,7 +52,7 @@ public class InvalidExtensionException extends FileUploadException {
public static class InvalidMediaExtensionException extends InvalidExtensionException {
private static final long serialVersionUID = 1L;
public InvalidMediaExtensionException (String[] allowedExtension, String extension, String filename) {
public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) {
super(allowedExtension, extension, filename);
}
}
@ -60,7 +60,7 @@ public class InvalidExtensionException extends FileUploadException {
public static class InvalidVideoExtensionException extends InvalidExtensionException {
private static final long serialVersionUID = 1L;
public InvalidVideoExtensionException (String[] allowedExtension, String extension, String filename) {
public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename) {
super(allowedExtension, extension, filename);
}
}

View File

@ -10,16 +10,16 @@ public class TaskException extends Exception {
private Code code;
public TaskException (String msg, Code code) {
public TaskException(String msg, Code code) {
this(msg, code, null);
}
public TaskException (String msg, Code code, Exception nestedEx) {
public TaskException(String msg, Code code, Exception nestedEx) {
super(msg, nestedEx);
this.code = code;
}
public Code getCode () {
public Code getCode() {
return code;
}

View File

@ -8,7 +8,7 @@ package com.ruoyi.common.exception.user;
public class BlackListException extends UserException {
private static final long serialVersionUID = 1L;
public BlackListException () {
public BlackListException() {
super("login.blocked", null);
}
}

View File

@ -8,7 +8,7 @@ package com.ruoyi.common.exception.user;
public class CaptchaException extends UserException {
private static final long serialVersionUID = 1L;
public CaptchaException () {
public CaptchaException() {
super("user.jcaptcha.error", null);
}
}

View File

@ -8,7 +8,7 @@ package com.ruoyi.common.exception.user;
public class CaptchaExpireException extends UserException {
private static final long serialVersionUID = 1L;
public CaptchaExpireException () {
public CaptchaExpireException() {
super("user.jcaptcha.expire", null);
}
}

View File

@ -10,7 +10,7 @@ import com.ruoyi.common.exception.base.BaseException;
public class UserException extends BaseException {
private static final long serialVersionUID = 1L;
public UserException (String code, Object[] args) {
public UserException(String code, Object[] args) {
super("user", code, args, null);
}
}

View File

@ -8,7 +8,7 @@ package com.ruoyi.common.exception.user;
public class UserNotExistsException extends UserException {
private static final long serialVersionUID = 1L;
public UserNotExistsException () {
public UserNotExistsException() {
super("user.not.exists", null);
}
}

View File

@ -8,7 +8,7 @@ package com.ruoyi.common.exception.user;
public class UserPasswordNotMatchException extends UserException {
private static final long serialVersionUID = 1L;
public UserPasswordNotMatchException () {
public UserPasswordNotMatchException() {
super("user.password.not.match", null);
}
}

View File

@ -8,7 +8,7 @@ package com.ruoyi.common.exception.user;
public class UserPasswordRetryLimitExceedException extends UserException {
private static final long serialVersionUID = 1L;
public UserPasswordRetryLimitExceedException (int retryLimitCount, int lockTime) {
public UserPasswordRetryLimitExceedException(int retryLimitCount, int lockTime) {
super("user.password.retry.limit.exceed", new Object[]{retryLimitCount, lockTime});
}
}

View File

@ -8,11 +8,11 @@ import com.alibaba.fastjson2.filter.SimplePropertyPreFilter;
* @author ruoyi
*/
public class PropertyPreExcludeFilter extends SimplePropertyPreFilter {
public PropertyPreExcludeFilter () {
public PropertyPreExcludeFilter() {
}
public PropertyPreExcludeFilter addExcludes (String... filters) {
for (int i = 0 ; i < filters.length ; i++) {
public PropertyPreExcludeFilter addExcludes(String... filters) {
for (int i = 0; i < filters.length; i++) {
this.getExcludes().add(filters[i]);
}
return this;

View File

@ -14,12 +14,12 @@ import java.io.IOException;
*/
public class RepeatableFilter implements Filter {
@Override
public void init (FilterConfig filterConfig) throws ServletException {
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter (ServletRequest request, ServletResponse response, FilterChain chain)
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
ServletRequest requestWrapper = null;
if (request instanceof HttpServletRequest
@ -34,7 +34,7 @@ public class RepeatableFilter implements Filter {
}
@Override
public void destroy () {
public void destroy() {
}
}

View File

@ -21,7 +21,7 @@ import java.io.InputStreamReader;
public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper {
private final byte[] body;
public RepeatedlyRequestWrapper (HttpServletRequest request, ServletResponse response) throws IOException {
public RepeatedlyRequestWrapper(HttpServletRequest request, ServletResponse response) throws IOException {
super(request);
request.setCharacterEncoding(Constants.UTF8);
response.setCharacterEncoding(Constants.UTF8);
@ -30,36 +30,36 @@ public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper {
}
@Override
public BufferedReader getReader () throws IOException {
public BufferedReader getReader() throws IOException {
return new BufferedReader(new InputStreamReader(getInputStream()));
}
@Override
public ServletInputStream getInputStream () throws IOException {
public ServletInputStream getInputStream() throws IOException {
final ByteArrayInputStream bais = new ByteArrayInputStream(body);
return new ServletInputStream() {
@Override
public int read () throws IOException {
public int read() throws IOException {
return bais.read();
}
@Override
public int available () throws IOException {
public int available() throws IOException {
return body.length;
}
@Override
public boolean isFinished () {
public boolean isFinished() {
return false;
}
@Override
public boolean isReady () {
public boolean isReady() {
return false;
}
@Override
public void setReadListener (ReadListener readListener) {
public void setReadListener(ReadListener readListener) {
}
};

View File

@ -22,18 +22,18 @@ public class XssFilter implements Filter {
public List<String> excludes = new ArrayList<>();
@Override
public void init (FilterConfig filterConfig) throws ServletException {
public void init(FilterConfig filterConfig) throws ServletException {
String tempExcludes = filterConfig.getInitParameter("excludes");
if (StringUtils.isNotEmpty(tempExcludes)) {
String[] url = tempExcludes.split(",");
for (int i = 0 ; url != null && i < url.length ; i++) {
for (int i = 0; url != null && i < url.length; i++) {
excludes.add(url[i]);
}
}
}
@Override
public void doFilter (ServletRequest request, ServletResponse response, FilterChain chain)
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse resp = (HttpServletResponse) response;
@ -45,7 +45,7 @@ public class XssFilter implements Filter {
chain.doFilter(xssRequest, response);
}
private boolean handleExcludeURL (HttpServletRequest request, HttpServletResponse response) {
private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response) {
String url = request.getServletPath();
String method = request.getMethod();
// GET DELETE 不过滤
@ -56,7 +56,7 @@ public class XssFilter implements Filter {
}
@Override
public void destroy () {
public void destroy() {
}
}

View File

@ -22,17 +22,17 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
/**
* @param request
*/
public XssHttpServletRequestWrapper (HttpServletRequest request) {
public XssHttpServletRequestWrapper(HttpServletRequest request) {
super(request);
}
@Override
public String[] getParameterValues (String name) {
public String[] getParameterValues(String name) {
String[] values = super.getParameterValues(name);
if (values != null) {
int length = values.length;
String[] escapesValues = new String[length];
for (int i = 0 ; i < length ; i++) {
for (int i = 0; i < length; i++) {
// 防xss攻击和过滤前后空格
escapesValues[i] = EscapeUtil.clean(values[i]).trim();
}
@ -42,7 +42,7 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
}
@Override
public ServletInputStream getInputStream () throws IOException {
public ServletInputStream getInputStream() throws IOException {
// 非json类型直接返回
if (!isJsonRequest()) {
return super.getInputStream();
@ -60,26 +60,26 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
final ByteArrayInputStream bis = new ByteArrayInputStream(jsonBytes);
return new ServletInputStream() {
@Override
public boolean isFinished () {
public boolean isFinished() {
return true;
}
@Override
public boolean isReady () {
public boolean isReady() {
return true;
}
@Override
public int available () throws IOException {
public int available() throws IOException {
return jsonBytes.length;
}
@Override
public void setReadListener (ReadListener readListener) {
public void setReadListener(ReadListener readListener) {
}
@Override
public int read () throws IOException {
public int read() throws IOException {
return bis.read();
}
};
@ -90,7 +90,7 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
*
* @param request
*/
public boolean isJsonRequest () {
public boolean isJsonRequest() {
String header = super.getHeader(HttpHeaders.CONTENT_TYPE);
return StringUtils.startsWithIgnoreCase(header, MediaType.APPLICATION_JSON_VALUE);
}

View File

@ -18,7 +18,7 @@ public class Arith {
/**
*
*/
private Arith () {
private Arith() {
}
/**
@ -26,10 +26,9 @@ public class Arith {
*
* @param v1
* @param v2
*
* @return
*/
public static double add (double v1, double v2) {
public static double add(double v1, double v2) {
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));
return b1.add(b2).doubleValue();
@ -40,10 +39,9 @@ public class Arith {
*
* @param v1
* @param v2
*
* @return
*/
public static double sub (double v1, double v2) {
public static double sub(double v1, double v2) {
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));
return b1.subtract(b2).doubleValue();
@ -54,10 +52,9 @@ public class Arith {
*
* @param v1
* @param v2
*
* @return
*/
public static double mul (double v1, double v2) {
public static double mul(double v1, double v2) {
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));
return b1.multiply(b2).doubleValue();
@ -69,10 +66,9 @@ public class Arith {
*
* @param v1
* @param v2
*
* @return
*/
public static double div (double v1, double v2) {
public static double div(double v1, double v2) {
return div(v1, v2, DEF_DIV_SCALE);
}
@ -83,10 +79,9 @@ public class Arith {
* @param v1
* @param v2
* @param scale
*
* @return
*/
public static double div (double v1, double v2, int scale) {
public static double div(double v1, double v2, int scale) {
if (scale < 0) {
throw new IllegalArgumentException(
"The scale must be a positive integer or zero");
@ -104,10 +99,9 @@ public class Arith {
*
* @param v
* @param scale
*
* @return
*/
public static double round (double v, int scale) {
public static double round(double v, int scale) {
if (scale < 0) {
throw new IllegalArgumentException(
"The scale must be a positive integer or zero");

View File

@ -34,7 +34,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
*
* @return Date()
*/
public static Date getNowDate () {
public static Date getNowDate() {
return new Date();
}
@ -43,31 +43,31 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
*
* @return String
*/
public static String getDate () {
public static String getDate() {
return dateTimeNow(YYYY_MM_DD);
}
public static final String getTime () {
public static final String getTime() {
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
}
public static final String dateTimeNow () {
public static final String dateTimeNow() {
return dateTimeNow(YYYYMMDDHHMMSS);
}
public static final String dateTimeNow (final String format) {
public static final String dateTimeNow(final String format) {
return parseDateToStr(format, new Date());
}
public static final String dateTime (final Date date) {
public static final String dateTime(final Date date) {
return parseDateToStr(YYYY_MM_DD, date);
}
public static final String parseDateToStr (final String format, final Date date) {
public static final String parseDateToStr(final String format, final Date date) {
return new SimpleDateFormat(format).format(date);
}
public static final Date dateTime (final String format, final String ts) {
public static final Date dateTime(final String format, final String ts) {
try {
return new SimpleDateFormat(format).parse(ts);
} catch (ParseException e) {
@ -78,7 +78,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
/**
* // 2018/08/08
*/
public static final String datePath () {
public static final String datePath() {
Date now = new Date();
return DateFormatUtils.format(now, "yyyy/MM/dd");
}
@ -86,7 +86,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
/**
* // 20180808
*/
public static final String dateTime () {
public static final String dateTime() {
Date now = new Date();
return DateFormatUtils.format(now, "yyyyMMdd");
}
@ -94,7 +94,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
/**
*
*/
public static Date parseDate (Object str) {
public static Date parseDate(Object str) {
if (str == null) {
return null;
}
@ -108,7 +108,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
/**
*
*/
public static Date getServerStartDate () {
public static Date getServerStartDate() {
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
return new Date(time);
}
@ -116,7 +116,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
/**
*
*/
public static int differentDaysByMillisecond (Date date1, Date date2) {
public static int differentDaysByMillisecond(Date date1, Date date2) {
return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)));
}
@ -125,10 +125,9 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
*
* @param endDate
* @param startTime
*
* @return //
*/
public static String timeDistance (Date endDate, Date startTime) {
public static String timeDistance(Date endDate, Date startTime) {
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
@ -149,7 +148,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
/**
* LocalDateTime ==> Date
*/
public static Date toDate (LocalDateTime temporalAccessor) {
public static Date toDate(LocalDateTime temporalAccessor) {
ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault());
return Date.from(zdt.toInstant());
}
@ -157,7 +156,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
/**
* LocalDate ==> Date
*/
public static Date toDate (LocalDate temporalAccessor) {
public static Date toDate(LocalDate temporalAccessor) {
LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0));
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
return Date.from(zdt.toInstant());

View File

@ -26,7 +26,7 @@ public class DictUtils {
* @param key
* @param dictDatas
*/
public static void setDictCache (String key, List<SysDictData> dictDatas) {
public static void setDictCache(String key, List<SysDictData> dictDatas) {
SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas);
}
@ -34,10 +34,9 @@ public class DictUtils {
*
*
* @param key
*
* @return dictDatas
*/
public static List<SysDictData> getDictCache (String key) {
public static List<SysDictData> getDictCache(String key) {
JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
if (StringUtils.isNotNull(arrayCache)) {
return arrayCache.toList(SysDictData.class);
@ -50,10 +49,9 @@ public class DictUtils {
*
* @param dictType
* @param dictValue
*
* @return
*/
public static String getDictLabel (String dictType, String dictValue) {
public static String getDictLabel(String dictType, String dictValue) {
return getDictLabel(dictType, dictValue, SEPARATOR);
}
@ -62,10 +60,9 @@ public class DictUtils {
*
* @param dictType
* @param dictLabel
*
* @return
*/
public static String getDictValue (String dictType, String dictLabel) {
public static String getDictValue(String dictType, String dictLabel) {
return getDictValue(dictType, dictLabel, SEPARATOR);
}
@ -75,10 +72,9 @@ public class DictUtils {
* @param dictType
* @param dictValue
* @param separator
*
* @return
*/
public static String getDictLabel (String dictType, String dictValue, String separator) {
public static String getDictLabel(String dictType, String dictValue, String separator) {
StringBuilder propertyString = new StringBuilder();
List<SysDictData> datas = getDictCache(dictType);
@ -109,10 +105,9 @@ public class DictUtils {
* @param dictType
* @param dictLabel
* @param separator
*
* @return
*/
public static String getDictValue (String dictType, String dictLabel, String separator) {
public static String getDictValue(String dictType, String dictLabel, String separator) {
StringBuilder propertyString = new StringBuilder();
List<SysDictData> datas = getDictCache(dictType);
@ -140,14 +135,14 @@ public class DictUtils {
*
* @param key
*/
public static void removeDictCache (String key) {
public static void removeDictCache(String key) {
SpringUtils.getBean(RedisCache.class).deleteObject(getCacheKey(key));
}
/**
*
*/
public static void clearDictCache () {
public static void clearDictCache() {
Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.SYS_DICT_KEY + "*");
SpringUtils.getBean(RedisCache.class).deleteObject(keys);
}
@ -156,10 +151,9 @@ public class DictUtils {
* cache key
*
* @param configKey
*
* @return key
*/
public static String getCacheKey (String configKey) {
public static String getCacheKey(String configKey) {
return CacheConstants.SYS_DICT_KEY + configKey;
}
}

View File

@ -14,13 +14,13 @@ public class ExceptionUtil {
/**
* exception
*/
public static String getExceptionMessage (Throwable e) {
public static String getExceptionMessage(Throwable e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
return sw.toString();
}
public static String getRootErrorMessage (Exception e) {
public static String getRootErrorMessage(Exception e) {
Throwable root = ExceptionUtils.getRootCause(e);
root = (root == null ? e : root);
if (root == null) {

View File

@ -6,7 +6,7 @@ package com.ruoyi.common.utils;
* @author ruoyi
*/
public class LogUtils {
public static String getBlock (Object msg) {
public static String getBlock(Object msg) {
if (msg == null) {
msg = "";
}

View File

@ -15,10 +15,9 @@ public class MessageUtils {
*
* @param code
* @param args
*
* @return
*/
public static String message (String code, Object... args) {
public static String message(String code, Object... args) {
MessageSource messageSource = SpringUtils.getBean(MessageSource.class);
return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
}

View File

@ -17,49 +17,56 @@ public class ObjUtils {
* Array:
* Collection:
* Map:
*
* @param o
* @return nulltruefalse
*/
public static boolean notNull(Object o){
public static boolean notNull(Object o) {
return ObjectUtils.isNotEmpty(o);
}
/**
* long0
*
* @param val
* @return 0
*/
public static boolean notNull(Long val){
return ObjectUtils.isNotEmpty(val) && val != 0;
public static boolean notNull(Long val) {
return ObjectUtils.isNotEmpty(val) && val != 0;
}
/**
* Integer0
*
* @param val
* @return 0
*/
public static boolean notNull(Integer val){
return ObjectUtils.isNotEmpty(val) && val != 0;
public static boolean notNull(Integer val) {
return ObjectUtils.isNotEmpty(val) && val != 0;
}
/**
* BigDecimal0
*
* @param val
* @return 0
*/
public static boolean notNull(BigDecimal val){
return ObjectUtils.isNotEmpty(val) && val.doubleValue() == 0.00;
public static boolean notNull(BigDecimal val) {
return ObjectUtils.isNotEmpty(val) && val.doubleValue() == 0.00;
}
/**
* BigDecimal0
*
* @param val
* @return 0
*/
public static boolean notChildNull(Object[] val){
public static boolean notChildNull(Object[] val) {
for (Object o : val) {
if (!notNull(o)){
if (!notNull(o)) {
return false;
}
}
return true;
return true;
}
}

View File

@ -14,7 +14,7 @@ public class PageUtils extends PageHelper {
/**
*
*/
public static void startPage () {
public static void startPage() {
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
@ -26,7 +26,7 @@ public class PageUtils extends PageHelper {
/**
* 线
*/
public static void clearPage () {
public static void clearPage() {
PageHelper.clearPage();
}
}

View File

@ -16,7 +16,7 @@ public class SecurityUtils {
/**
* ID
**/
public static Long getUserId () {
public static Long getUserId() {
try {
return getLoginUser().getUserId();
} catch (Exception e) {
@ -27,7 +27,7 @@ public class SecurityUtils {
/**
* ID
**/
public static Long getDeptId () {
public static Long getDeptId() {
try {
return getLoginUser().getDeptId();
} catch (Exception e) {
@ -38,7 +38,7 @@ public class SecurityUtils {
/**
*
**/
public static String getUsername () {
public static String getUsername() {
try {
return getLoginUser().getUsername();
} catch (Exception e) {
@ -49,7 +49,7 @@ public class SecurityUtils {
/**
*
**/
public static LoginUser getLoginUser () {
public static LoginUser getLoginUser() {
try {
return (LoginUser) getAuthentication().getPrincipal();
} catch (Exception e) {
@ -60,7 +60,7 @@ public class SecurityUtils {
/**
* Authentication
*/
public static Authentication getAuthentication () {
public static Authentication getAuthentication() {
return SecurityContextHolder.getContext().getAuthentication();
}
@ -68,10 +68,9 @@ public class SecurityUtils {
* BCryptPasswordEncoder
*
* @param password
*
* @return
*/
public static String encryptPassword (String password) {
public static String encryptPassword(String password) {
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
return passwordEncoder.encode(password);
}
@ -81,10 +80,9 @@ public class SecurityUtils {
*
* @param rawPassword
* @param encodedPassword
*
* @return
*/
public static boolean matchesPassword (String rawPassword, String encodedPassword) {
public static boolean matchesPassword(String rawPassword, String encodedPassword) {
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
return passwordEncoder.matches(rawPassword, encodedPassword);
}
@ -93,10 +91,9 @@ public class SecurityUtils {
*
*
* @param userId ID
*
* @return
*/
public static boolean isAdmin (Long userId) {
public static boolean isAdmin(Long userId) {
return userId != null && 1L == userId;
}
}

View File

@ -27,42 +27,42 @@ public class ServletUtils {
/**
* String
*/
public static String getParameter (String name) {
public static String getParameter(String name) {
return getRequest().getParameter(name);
}
/**
* String
*/
public static String getParameter (String name, String defaultValue) {
public static String getParameter(String name, String defaultValue) {
return Convert.toStr(getRequest().getParameter(name), defaultValue);
}
/**
* Integer
*/
public static Integer getParameterToInt (String name) {
public static Integer getParameterToInt(String name) {
return Convert.toInt(getRequest().getParameter(name));
}
/**
* Integer
*/
public static Integer getParameterToInt (String name, Integer defaultValue) {
public static Integer getParameterToInt(String name, Integer defaultValue) {
return Convert.toInt(getRequest().getParameter(name), defaultValue);
}
/**
* Boolean
*/
public static Boolean getParameterToBool (String name) {
public static Boolean getParameterToBool(String name) {
return Convert.toBool(getRequest().getParameter(name));
}
/**
* Boolean
*/
public static Boolean getParameterToBool (String name, Boolean defaultValue) {
public static Boolean getParameterToBool(String name, Boolean defaultValue) {
return Convert.toBool(getRequest().getParameter(name), defaultValue);
}
@ -70,10 +70,9 @@ public class ServletUtils {
*
*
* @param request {@link ServletRequest}
*
* @return Map
*/
public static Map<String, String[]> getParams (ServletRequest request) {
public static Map<String, String[]> getParams(ServletRequest request) {
final Map<String, String[]> map = request.getParameterMap();
return Collections.unmodifiableMap(map);
}
@ -82,10 +81,9 @@ public class ServletUtils {
*
*
* @param request {@link ServletRequest}
*
* @return Map
*/
public static Map<String, String> getParamMap (ServletRequest request) {
public static Map<String, String> getParamMap(ServletRequest request) {
Map<String, String> params = new HashMap<>();
for (Map.Entry<String, String[]> entry : getParams(request).entrySet()) {
params.put(entry.getKey(), StringUtils.join(entry.getValue(), ","));
@ -96,25 +94,25 @@ public class ServletUtils {
/**
* request
*/
public static HttpServletRequest getRequest () {
public static HttpServletRequest getRequest() {
return getRequestAttributes().getRequest();
}
/**
* response
*/
public static HttpServletResponse getResponse () {
public static HttpServletResponse getResponse() {
return getRequestAttributes().getResponse();
}
/**
* session
*/
public static HttpSession getSession () {
public static HttpSession getSession() {
return getRequest().getSession();
}
public static ServletRequestAttributes getRequestAttributes () {
public static ServletRequestAttributes getRequestAttributes() {
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
return (ServletRequestAttributes) attributes;
}
@ -125,7 +123,7 @@ public class ServletUtils {
* @param response
* @param string
*/
public static void renderString (HttpServletResponse response, String string) {
public static void renderString(HttpServletResponse response, String string) {
try {
response.setStatus(200);
response.setContentType("application/json");
@ -141,7 +139,7 @@ public class ServletUtils {
*
* @param request
*/
public static boolean isAjaxRequest (HttpServletRequest request) {
public static boolean isAjaxRequest(HttpServletRequest request) {
String accept = request.getHeader("accept");
if (accept != null && accept.contains("application/json")) {
return true;
@ -165,10 +163,9 @@ public class ServletUtils {
*
*
* @param str
*
* @return
*/
public static String urlEncode (String str) {
public static String urlEncode(String str) {
try {
return URLEncoder.encode(str, Constants.UTF8);
} catch (UnsupportedEncodingException e) {
@ -180,10 +177,9 @@ public class ServletUtils {
*
*
* @param str
*
* @return
*/
public static String urlDecode (String str) {
public static String urlDecode(String str) {
try {
return URLDecoder.decode(str, Constants.UTF8);
} catch (UnsupportedEncodingException e) {

View File

@ -26,10 +26,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*
*
* @param value defaultValue value
*
* @return value
*/
public static <T> T nvl (T value, T defaultValue) {
public static <T> T nvl(T value, T defaultValue) {
return value != null ? value : defaultValue;
}
@ -37,10 +36,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* * Collection ListSetQueue
*
* @param coll Collection
*
* @return true false
*/
public static boolean isEmpty (Collection<?> coll) {
public static boolean isEmpty(Collection<?> coll) {
return isNull(coll) || coll.isEmpty();
}
@ -48,10 +46,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* * CollectionListSetQueue
*
* @param coll Collection
*
* @return true false
*/
public static boolean isNotEmpty (Collection<?> coll) {
public static boolean isNotEmpty(Collection<?> coll) {
return !isEmpty(coll);
}
@ -61,7 +58,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* @param objects
* * @return true false
*/
public static boolean isEmpty (Object[] objects) {
public static boolean isEmpty(Object[] objects) {
return isNull(objects) || (objects.length == 0);
}
@ -69,10 +66,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* *
*
* @param objects
*
* @return true false
*/
public static boolean isNotEmpty (Object[] objects) {
public static boolean isNotEmpty(Object[] objects) {
return !isEmpty(objects);
}
@ -80,10 +76,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* * Map
*
* @param map Map
*
* @return true false
*/
public static boolean isEmpty (Map<?, ?> map) {
public static boolean isEmpty(Map<?, ?> map) {
return isNull(map) || map.isEmpty();
}
@ -91,10 +86,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* * Map
*
* @param map Map
*
* @return true false
*/
public static boolean isNotEmpty (Map<?, ?> map) {
public static boolean isNotEmpty(Map<?, ?> map) {
return !isEmpty(map);
}
@ -102,10 +96,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* *
*
* @param str String
*
* @return true false
*/
public static boolean isEmpty (String str) {
public static boolean isEmpty(String str) {
return isNull(str) || NULLSTR.equals(str.trim());
}
@ -113,10 +106,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* *
*
* @param str String
*
* @return true false
*/
public static boolean isNotEmpty (String str) {
public static boolean isNotEmpty(String str) {
return !isEmpty(str);
}
@ -124,10 +116,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* *
*
* @param object Object
*
* @return true false
*/
public static boolean isNull (Object object) {
public static boolean isNull(Object object) {
return object == null;
}
@ -135,10 +126,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* *
*
* @param object Object
*
* @return true false
*/
public static boolean isNotNull (Object object) {
public static boolean isNotNull(Object object) {
return !isNull(object);
}
@ -146,17 +136,16 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* * Java
*
* @param object
*
* @return true false
*/
public static boolean isArray (Object object) {
public static boolean isArray(Object object) {
return isNotNull(object) && object.getClass().isArray();
}
/**
*
*/
public static String trim (String str) {
public static String trim(String str) {
return (str == null ? "" : str.trim());
}
@ -165,10 +154,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*
* @param str
* @param start
*
* @return
*/
public static String substring (final String str, int start) {
public static String substring(final String str, int start) {
if (str == null) {
return NULLSTR;
}
@ -193,10 +181,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* @param str
* @param start
* @param end
*
* @return
*/
public static String substring (final String str, int start, int end) {
public static String substring(final String str, int start, int end) {
if (str == null) {
return NULLSTR;
}
@ -237,10 +224,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*
* @param template {}
* @param params
*
* @return
*/
public static String format (String template, Object... params) {
public static String format(String template, Object... params) {
if (isEmpty(params) || isEmpty(template)) {
return template;
}
@ -251,10 +237,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* http(s)://开头
*
* @param link
*
* @return
*/
public static boolean ishttp (String link) {
public static boolean ishttp(String link) {
return StringUtils.startsWithAny(link, Constants.HTTP, Constants.HTTPS);
}
@ -263,10 +248,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*
* @param str
* @param sep
*
* @return set
*/
public static final Set<String> str2Set (String str, String sep) {
public static final Set<String> str2Set(String str, String sep) {
return new HashSet<String>(str2List(str, sep, true, false));
}
@ -277,10 +261,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* @param sep
* @param filterBlank
* @param trim
*
* @return list
*/
public static final List<String> str2List (String str, String sep, boolean filterBlank, boolean trim) {
public static final List<String> str2List(String str, String sep, boolean filterBlank, boolean trim) {
List<String> list = new ArrayList<String>();
if (StringUtils.isEmpty(str)) {
return list;
@ -309,10 +292,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*
* @param collection
* @param array
*
* @return boolean
*/
public static boolean containsAny (Collection<String> collection, String... array) {
public static boolean containsAny(Collection<String> collection, String... array) {
if (isEmpty(collection) || isEmpty(array)) {
return false;
} else {
@ -330,10 +312,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*
* @param cs
* @param searchCharSequences
*
* @return
*/
public static boolean containsAnyIgnoreCase (CharSequence cs, CharSequence... searchCharSequences) {
public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) {
if (isEmpty(cs) || isEmpty(searchCharSequences)) {
return false;
}
@ -348,7 +329,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* 线
*/
public static String toUnderScoreCase (String str) {
public static String toUnderScoreCase(String str) {
if (str == null) {
return null;
}
@ -359,7 +340,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
boolean curreCharIsUpperCase = true;
// 下一字符是否大写
boolean nexteCharIsUpperCase = true;
for (int i = 0 ; i < str.length() ; i++) {
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (i > 0) {
preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1));
@ -389,10 +370,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*
* @param str
* @param strs
*
* @return true
*/
public static boolean inStringIgnoreCase (String str, String... strs) {
public static boolean inStringIgnoreCase(String str, String... strs) {
if (str != null && strs != null) {
for (String s : strs) {
if (str.equalsIgnoreCase(trim(s))) {
@ -407,10 +387,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* 线线 HELLO_WORLD->HelloWorld
*
* @param name 线
*
* @return
*/
public static String convertToCamelCase (String name) {
public static String convertToCamelCase(String name) {
StringBuilder result = new StringBuilder();
// 快速检查
if (name == null || name.isEmpty()) {
@ -438,7 +417,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*
* user_name->userName
*/
public static String toCamelCase (String s) {
public static String toCamelCase(String s) {
if (s == null) {
return null;
}
@ -448,7 +427,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
s = s.toLowerCase();
StringBuilder sb = new StringBuilder(s.length());
boolean upperCase = false;
for (int i = 0 ; i < s.length() ; i++) {
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == SEPARATOR) {
@ -468,10 +447,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*
* @param str
* @param strs
*
* @return
*/
public static boolean matches (String str, List<String> strs) {
public static boolean matches(String str, List<String> strs) {
if (isEmpty(str) || isEmpty(strs)) {
return false;
}
@ -491,16 +469,15 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*
* @param pattern
* @param url url
*
* @return
*/
public static boolean isMatch (String pattern, String url) {
public static boolean isMatch(String pattern, String url) {
AntPathMatcher matcher = new AntPathMatcher();
return matcher.match(pattern, url);
}
@SuppressWarnings("unchecked")
public static <T> T cast (Object obj) {
public static <T> T cast(Object obj) {
return (T) obj;
}
@ -509,10 +486,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*
* @param num
* @param size
*
* @return
*/
public static final String padl (final Number num, final int size) {
public static final String padl(final Number num, final int size) {
return padl(num.toString(), size, '0');
}
@ -522,15 +498,14 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* @param s
* @param size
* @param c
*
* @return
*/
public static final String padl (final String s, final int size, final char c) {
public static final String padl(final String s, final int size, final char c) {
final StringBuilder sb = new StringBuilder(size);
if (s != null) {
final int len = s.length();
if (s.length() <= size) {
for (int i = size - len ; i > 0 ; i--) {
for (int i = size - len; i > 0; i--) {
sb.append(c);
}
sb.append(s);
@ -538,7 +513,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
return s.substring(len - size, len);
}
} else {
for (int i = size ; i > 0 ; i--) {
for (int i = size; i > 0; i--) {
sb.append(c);
}
}

View File

@ -16,7 +16,7 @@ public class Threads {
/**
* sleep,
*/
public static void sleep (long milliseconds) {
public static void sleep(long milliseconds) {
try {
Thread.sleep(milliseconds);
} catch (InterruptedException e) {
@ -31,7 +31,7 @@ public class Threads {
* 退.
* shutdown线.
*/
public static void shutdownAndAwaitTermination (ExecutorService pool) {
public static void shutdownAndAwaitTermination(ExecutorService pool) {
if (pool != null && !pool.isShutdown()) {
pool.shutdown();
try {
@ -51,7 +51,7 @@ public class Threads {
/**
* 线
*/
public static void printException (Runnable r, Throwable t) {
public static void printException(Runnable r, Throwable t) {
if (t == null && r instanceof Future<?>) {
try {
Future<?> future = (Future<?>) r;

View File

@ -33,7 +33,7 @@ public class BeanUtils extends org.springframework.beans.BeanUtils {
* @param dest
* @param src
*/
public static void copyBeanProp (Object dest, Object src) {
public static void copyBeanProp(Object dest, Object src) {
try {
copyProperties(src, dest);
} catch (Exception e) {
@ -45,10 +45,9 @@ public class BeanUtils extends org.springframework.beans.BeanUtils {
* setter
*
* @param obj
*
* @return setter
*/
public static List<Method> getSetterMethods (Object obj) {
public static List<Method> getSetterMethods(Object obj) {
// setter方法列表
List<Method> setterMethods = new ArrayList<Method>();
@ -71,11 +70,10 @@ public class BeanUtils extends org.springframework.beans.BeanUtils {
* getter
*
* @param obj
*
* @return getter
*/
public static List<Method> getGetterMethods (Object obj) {
public static List<Method> getGetterMethods(Object obj) {
// getter方法列表
List<Method> getterMethods = new ArrayList<Method>();
// 获取所有方法
@ -97,11 +95,10 @@ public class BeanUtils extends org.springframework.beans.BeanUtils {
*
* @param m1 1
* @param m2 2
*
* @return truefalse
*/
public static boolean isMethodPropEquals (String m1, String m2) {
public static boolean isMethodPropEquals(String m1, String m2) {
return m1.substring(BEAN_METHOD_PROP_INDEX).equals(m2.substring(BEAN_METHOD_PROP_INDEX));
}
}

View File

@ -11,7 +11,7 @@ import java.util.Set;
* @author ruoyi
*/
public class BeanValidators {
public static void validateWithException (Validator validator, Object object, Class<?>... groups)
public static void validateWithException(Validator validator, Object object, Class<?>... groups)
throws ConstraintViolationException {
Set<ConstraintViolation<Object>> constraintViolations = validator.validate(object, groups);
if (!constraintViolations.isEmpty()) {

View File

@ -16,10 +16,9 @@ public class FileTypeUtils {
* : ruoyi.txt, : txt
*
* @param file
*
* @return ".")
*/
public static String getFileType (File file) {
public static String getFileType(File file) {
if (null == file) {
return StringUtils.EMPTY;
}
@ -32,10 +31,9 @@ public class FileTypeUtils {
* : ruoyi.txt, : txt
*
* @param fileName
*
* @return ".")
*/
public static String getFileType (String fileName) {
public static String getFileType(String fileName) {
int separatorIndex = fileName.lastIndexOf(".");
if (separatorIndex < 0) {
return "";
@ -47,10 +45,9 @@ public class FileTypeUtils {
*
*
* @param photoByte
*
* @return ".")
*/
public static String getFileExtendName (byte[] photoByte) {
public static String getFileExtendName(byte[] photoByte) {
String strFileExtendName = "JPG";
if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56)
&& ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97)) {

View File

@ -37,11 +37,11 @@ public class FileUploadUtils {
*/
private static String defaultBaseDir = RuoYiConfig.getProfile();
public static String getDefaultBaseDir () {
public static String getDefaultBaseDir() {
return defaultBaseDir;
}
public static void setDefaultBaseDir (String defaultBaseDir) {
public static void setDefaultBaseDir(String defaultBaseDir) {
FileUploadUtils.defaultBaseDir = defaultBaseDir;
}
@ -49,12 +49,10 @@ public class FileUploadUtils {
*
*
* @param file
*
* @return
*
* @throws Exception
*/
public static final String upload (MultipartFile file) throws IOException {
public static final String upload(MultipartFile file) throws IOException {
try {
return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
} catch (Exception e) {
@ -67,12 +65,10 @@ public class FileUploadUtils {
*
* @param baseDir
* @param file
*
* @return
*
* @throws IOException
*/
public static final String upload (String baseDir, MultipartFile file) throws IOException {
public static final String upload(String baseDir, MultipartFile file) throws IOException {
try {
return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
} catch (Exception e) {
@ -86,15 +82,13 @@ public class FileUploadUtils {
* @param baseDir
* @param file
* @param allowedExtension
*
* @return
*
* @throws FileSizeLimitExceededException
* @throws FileNameLengthLimitExceededException
* @throws IOException
* @throws InvalidExtensionException
*/
public static final String upload (String baseDir, MultipartFile file, String[] allowedExtension)
public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension)
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
InvalidExtensionException {
int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length();
@ -114,12 +108,12 @@ public class FileUploadUtils {
/**
*
*/
public static final String extractFilename (MultipartFile file) {
public static final String extractFilename(MultipartFile file) {
return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file));
}
public static final File getAbsoluteFile (String uploadDir, String fileName) throws IOException {
public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException {
File desc = new File(uploadDir + File.separator + fileName);
if (!desc.exists()) {
@ -130,7 +124,7 @@ public class FileUploadUtils {
return desc;
}
public static final String getPathFileName (String uploadDir, String fileName) throws IOException {
public static final String getPathFileName(String uploadDir, String fileName) throws IOException {
int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
return Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
@ -140,13 +134,11 @@ public class FileUploadUtils {
*
*
* @param file
*
* @return
*
* @throws FileSizeLimitExceededException
* @throws InvalidExtensionException
*/
public static final void assertAllowed (MultipartFile file, String[] allowedExtension)
public static final void assertAllowed(MultipartFile file, String[] allowedExtension)
throws FileSizeLimitExceededException, InvalidExtensionException {
long size = file.getSize();
if (size > DEFAULT_MAX_SIZE) {
@ -179,10 +171,9 @@ public class FileUploadUtils {
*
* @param extension
* @param allowedExtension
*
* @return
*/
public static final boolean isAllowedExtension (String extension, String[] allowedExtension) {
public static final boolean isAllowedExtension(String extension, String[] allowedExtension) {
for (String str : allowedExtension) {
if (str.equalsIgnoreCase(extension)) {
return true;
@ -195,10 +186,9 @@ public class FileUploadUtils {
*
*
* @param file
*
* @return
*/
public static final String getExtension (MultipartFile file) {
public static final String getExtension(MultipartFile file) {
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
if (StringUtils.isEmpty(extension)) {
extension = MimeTypeUtils.getExtension(Objects.requireNonNull(file.getContentType()));

View File

@ -27,10 +27,9 @@ public class FileUtils {
*
* @param filePath
* @param os
*
* @return
*/
public static void writeBytes (String filePath, OutputStream os) throws IOException {
public static void writeBytes(String filePath, OutputStream os) throws IOException {
FileInputStream fis = null;
try {
File file = new File(filePath);
@ -55,12 +54,10 @@ public class FileUtils {
*
*
* @param data
*
* @return
*
* @throws IOException IO
*/
public static String writeImportBytes (byte[] data) throws IOException {
public static String writeImportBytes(byte[] data) throws IOException {
return writeBytes(data, RuoYiConfig.getImportPath());
}
@ -69,12 +66,10 @@ public class FileUtils {
*
* @param data
* @param uploadDir
*
* @return
*
* @throws IOException IO
*/
public static String writeBytes (byte[] data, String uploadDir) throws IOException {
public static String writeBytes(byte[] data, String uploadDir) throws IOException {
FileOutputStream fos = null;
String pathName = "";
try {
@ -93,10 +88,9 @@ public class FileUtils {
*
*
* @param filePath
*
* @return
*/
public static boolean deleteFile (String filePath) {
public static boolean deleteFile(String filePath) {
boolean flag = false;
File file = new File(filePath);
// 路径为文件且不为空则进行删除
@ -110,10 +104,9 @@ public class FileUtils {
*
*
* @param filename
*
* @return true false
*/
public static boolean isValidFilename (String filename) {
public static boolean isValidFilename(String filename) {
return filename.matches(FILENAME_PATTERN);
}
@ -121,10 +114,9 @@ public class FileUtils {
*
*
* @param resource
*
* @return true false
*/
public static boolean checkAllowDownload (String resource) {
public static boolean checkAllowDownload(String resource) {
// 禁止目录上跳级别
if (StringUtils.contains(resource, "..")) {
return false;
@ -144,10 +136,9 @@ public class FileUtils {
*
* @param request
* @param fileName
*
* @return
*/
public static String setFileDownloadHeader (HttpServletRequest request, String fileName) throws UnsupportedEncodingException {
public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException {
final String agent = request.getHeader("USER-AGENT");
String filename = fileName;
if (agent.contains("MSIE")) {
@ -173,7 +164,7 @@ public class FileUtils {
* @param response
* @param realFileName
*/
public static void setAttachmentResponseHeader (HttpServletResponse response, String realFileName) throws UnsupportedEncodingException {
public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException {
String percentEncodedFileName = percentEncode(realFileName);
StringBuilder contentDispositionValue = new StringBuilder();
@ -193,10 +184,9 @@ public class FileUtils {
*
*
* @param s
*
* @return
*/
public static String percentEncode (String s) throws UnsupportedEncodingException {
public static String percentEncode(String s) throws UnsupportedEncodingException {
String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString());
return encode.replaceAll("\\+", "%20");
}
@ -205,10 +195,9 @@ public class FileUtils {
*
*
* @param photoByte
*
* @return
*/
public static String getFileExtendName (byte[] photoByte) {
public static String getFileExtendName(byte[] photoByte) {
String strFileExtendName = "jpg";
if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56)
&& ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97)) {
@ -227,10 +216,9 @@ public class FileUtils {
* /profile/upload/2022/04/16/ruoyi.png -- ruoyi.png
*
* @param fileName
*
* @return
*/
public static String getName (String fileName) {
public static String getName(String fileName) {
if (fileName == null) {
return null;
}
@ -244,10 +232,9 @@ public class FileUtils {
* /profile/upload/2022/04/16/ruoyi.png -- ruoyi
*
* @param fileName
*
* @return
*/
public static String getNameNotSuffix (String fileName) {
public static String getNameNotSuffix(String fileName) {
if (fileName == null) {
return null;
}

View File

@ -22,7 +22,7 @@ import java.util.Arrays;
public class ImageUtils {
private static final Logger log = LoggerFactory.getLogger(ImageUtils.class);
public static byte[] getImage (String imagePath) {
public static byte[] getImage(String imagePath) {
InputStream is = getFile(imagePath);
try {
return IOUtils.toByteArray(is);
@ -34,7 +34,7 @@ public class ImageUtils {
}
}
public static InputStream getFile (String imagePath) {
public static InputStream getFile(String imagePath) {
try {
byte[] result = readFile(imagePath);
result = Arrays.copyOf(result, result.length);
@ -49,10 +49,9 @@ public class ImageUtils {
*
*
* @param url
*
* @return
*/
public static byte[] readFile (String url) {
public static byte[] readFile(String url) {
InputStream in = null;
try {
if (url.startsWith("http")) {

View File

@ -37,7 +37,7 @@ public class MimeTypeUtils {
// pdf
"pdf"};
public static String getExtension (String prefix) {
public static String getExtension(String prefix) {
switch (prefix) {
case IMAGE_PNG:
return "png";

Some files were not shown because too many files have changed in this diff Show More