瞎搞呗
This commit is contained in:
parent
031ad2b93e
commit
0c68fc1760
|
|
@ -9,11 +9,9 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||||
public class RuoYiApplication
|
public class RuoYiApplication {
|
||||||
{
|
public static void main(String[] args) {
|
||||||
public static void main(String[] args)
|
|
||||||
{
|
|
||||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||||
SpringApplication.run(RuoYiApplication.class, args);
|
SpringApplication.run(RuoYiApplication.class, args);
|
||||||
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
|
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,9 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class RuoYiServletInitializer extends SpringBootServletInitializer
|
public class RuoYiServletInitializer extends SpringBootServletInitializer {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
{
|
|
||||||
return application.sources(RuoYiApplication.class);
|
return application.sources(RuoYiApplication.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,12 @@
|
||||||
package com.ruoyi.web.controller.common;
|
package com.ruoyi.web.controller.common;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import com.ruoyi.common.config.ServerConfig;
|
||||||
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||||
|
import com.ruoyi.common.utils.file.FileUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -11,13 +16,9 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.ruoyi.common.config.RuoYiConfig;
|
|
||||||
import com.ruoyi.common.config.ServerConfig;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
|
||||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
|
||||||
import com.ruoyi.common.utils.file.FileUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用请求处理
|
* 通用请求处理
|
||||||
|
|
@ -25,8 +26,7 @@ import com.ruoyi.common.utils.file.FileUtils;
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class CommonController
|
public class CommonController {
|
||||||
{
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -39,12 +39,9 @@ public class CommonController
|
||||||
* @param delete 是否删除
|
* @param delete 是否删除
|
||||||
*/
|
*/
|
||||||
@GetMapping("common/download")
|
@GetMapping("common/download")
|
||||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
|
||||||
{
|
try {
|
||||||
try
|
if (!FileUtils.checkAllowDownload(fileName)) {
|
||||||
{
|
|
||||||
if (!FileUtils.checkAllowDownload(fileName))
|
|
||||||
{
|
|
||||||
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||||
}
|
}
|
||||||
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||||
|
|
@ -53,13 +50,11 @@ public class CommonController
|
||||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
||||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||||
if (delete)
|
if (delete) {
|
||||||
{
|
|
||||||
FileUtils.deleteFile(filePath);
|
FileUtils.deleteFile(filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
log.error("下载文件失败", e);
|
log.error("下载文件失败", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -69,10 +64,8 @@ public class CommonController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/common/upload")
|
@PostMapping("/common/upload")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
public AjaxResult uploadFile(MultipartFile file) throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
// 上传文件路径
|
// 上传文件路径
|
||||||
String filePath = RuoYiConfig.getUploadPath();
|
String filePath = RuoYiConfig.getUploadPath();
|
||||||
// 上传并返回新文件名称
|
// 上传并返回新文件名称
|
||||||
|
|
@ -83,8 +76,7 @@ public class CommonController
|
||||||
ajax.put("url", url);
|
ajax.put("url", url);
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
return AjaxResult.error(e.getMessage());
|
return AjaxResult.error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -94,12 +86,9 @@ public class CommonController
|
||||||
*/
|
*/
|
||||||
@GetMapping("/common/download/resource")
|
@GetMapping("/common/download/resource")
|
||||||
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||||
throws Exception
|
throws Exception {
|
||||||
{
|
try {
|
||||||
try
|
if (!FileUtils.checkAllowDownload(resource)) {
|
||||||
{
|
|
||||||
if (!FileUtils.checkAllowDownload(resource))
|
|
||||||
{
|
|
||||||
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
||||||
}
|
}
|
||||||
// 本地资源路径
|
// 本地资源路径
|
||||||
|
|
@ -112,8 +101,7 @@ public class CommonController
|
||||||
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||||
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
log.error("下载文件失败", e);
|
log.error("下载文件失败", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,16 +11,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/demo/modal")
|
@RequestMapping("/demo/modal")
|
||||||
public class DemoDialogController
|
public class DemoDialogController {
|
||||||
{
|
|
||||||
private String prefix = "demo/modal";
|
private String prefix = "demo/modal";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模态窗口
|
* 模态窗口
|
||||||
*/
|
*/
|
||||||
@GetMapping("/dialog")
|
@GetMapping("/dialog")
|
||||||
public String dialog()
|
public String dialog() {
|
||||||
{
|
|
||||||
return prefix + "/dialog";
|
return prefix + "/dialog";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -28,8 +26,7 @@ public class DemoDialogController
|
||||||
* 弹层组件
|
* 弹层组件
|
||||||
*/
|
*/
|
||||||
@GetMapping("/layer")
|
@GetMapping("/layer")
|
||||||
public String layer()
|
public String layer() {
|
||||||
{
|
|
||||||
return prefix + "/layer";
|
return prefix + "/layer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,8 +34,7 @@ public class DemoDialogController
|
||||||
* 表单
|
* 表单
|
||||||
*/
|
*/
|
||||||
@GetMapping("/form")
|
@GetMapping("/form")
|
||||||
public String form()
|
public String form() {
|
||||||
{
|
|
||||||
return prefix + "/form";
|
return prefix + "/form";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,8 +42,7 @@ public class DemoDialogController
|
||||||
* 表格
|
* 表格
|
||||||
*/
|
*/
|
||||||
@GetMapping("/table")
|
@GetMapping("/table")
|
||||||
public String table()
|
public String table() {
|
||||||
{
|
|
||||||
return prefix + "/table";
|
return prefix + "/table";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,8 +50,7 @@ public class DemoDialogController
|
||||||
* 表格check
|
* 表格check
|
||||||
*/
|
*/
|
||||||
@GetMapping("/check")
|
@GetMapping("/check")
|
||||||
public String check()
|
public String check() {
|
||||||
{
|
|
||||||
return prefix + "/table/check";
|
return prefix + "/table/check";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,8 +58,7 @@ public class DemoDialogController
|
||||||
* 表格radio
|
* 表格radio
|
||||||
*/
|
*/
|
||||||
@GetMapping("/radio")
|
@GetMapping("/radio")
|
||||||
public String radio()
|
public String radio() {
|
||||||
{
|
|
||||||
return prefix + "/table/radio";
|
return prefix + "/table/radio";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -73,8 +66,7 @@ public class DemoDialogController
|
||||||
* 表格回传父窗体
|
* 表格回传父窗体
|
||||||
*/
|
*/
|
||||||
@GetMapping("/parent")
|
@GetMapping("/parent")
|
||||||
public String parent()
|
public String parent() {
|
||||||
{
|
|
||||||
return prefix + "/table/parent";
|
return prefix + "/table/parent";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -11,16 +11,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/demo/icon")
|
@RequestMapping("/demo/icon")
|
||||||
public class DemoIconController
|
public class DemoIconController {
|
||||||
{
|
|
||||||
private String prefix = "demo/icon";
|
private String prefix = "demo/icon";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FontAwesome图标
|
* FontAwesome图标
|
||||||
*/
|
*/
|
||||||
@GetMapping("/fontawesome")
|
@GetMapping("/fontawesome")
|
||||||
public String fontAwesome()
|
public String fontAwesome() {
|
||||||
{
|
|
||||||
return prefix + "/fontawesome";
|
return prefix + "/fontawesome";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -28,8 +26,7 @@ public class DemoIconController
|
||||||
* Glyphicons图标
|
* Glyphicons图标
|
||||||
*/
|
*/
|
||||||
@GetMapping("/glyphicons")
|
@GetMapping("/glyphicons")
|
||||||
public String glyphicons()
|
public String glyphicons() {
|
||||||
{
|
|
||||||
return prefix + "/glyphicons";
|
return prefix + "/glyphicons";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,5 @@
|
||||||
package com.ruoyi.web.controller.demo.controller;
|
package com.ruoyi.web.controller.demo.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.PageDomain;
|
import com.ruoyi.common.core.page.PageDomain;
|
||||||
|
|
@ -23,6 +11,15 @@ import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.web.controller.demo.domain.CustomerModel;
|
import com.ruoyi.web.controller.demo.domain.CustomerModel;
|
||||||
import com.ruoyi.web.controller.demo.domain.UserOperateModel;
|
import com.ruoyi.web.controller.demo.domain.UserOperateModel;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作控制
|
* 操作控制
|
||||||
|
|
@ -31,11 +28,11 @@ import com.ruoyi.web.controller.demo.domain.UserOperateModel;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/demo/operate")
|
@RequestMapping("/demo/operate")
|
||||||
public class DemoOperateController extends BaseController
|
public class DemoOperateController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "demo/operate";
|
private String prefix = "demo/operate";
|
||||||
|
|
||||||
private final static Map<Integer, UserOperateModel> users = new LinkedHashMap<Integer, UserOperateModel>();
|
private final static Map<Integer, UserOperateModel> users = new LinkedHashMap<Integer, UserOperateModel>();
|
||||||
|
|
||||||
{
|
{
|
||||||
users.put(1, new UserOperateModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
|
users.put(1, new UserOperateModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
|
||||||
users.put(2, new UserOperateModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1"));
|
users.put(2, new UserOperateModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1"));
|
||||||
|
|
@ -69,8 +66,7 @@ public class DemoOperateController extends BaseController
|
||||||
* 表格
|
* 表格
|
||||||
*/
|
*/
|
||||||
@GetMapping("/table")
|
@GetMapping("/table")
|
||||||
public String table()
|
public String table() {
|
||||||
{
|
|
||||||
return prefix + "/table";
|
return prefix + "/table";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,8 +74,7 @@ public class DemoOperateController extends BaseController
|
||||||
* 其他
|
* 其他
|
||||||
*/
|
*/
|
||||||
@GetMapping("/other")
|
@GetMapping("/other")
|
||||||
public String other()
|
public String other() {
|
||||||
{
|
|
||||||
return prefix + "/other";
|
return prefix + "/other";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,44 +83,35 @@ public class DemoOperateController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(UserOperateModel userModel)
|
public TableDataInfo list(UserOperateModel userModel) {
|
||||||
{
|
|
||||||
TableDataInfo rspData = new TableDataInfo();
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
List<UserOperateModel> userList = new ArrayList<UserOperateModel>(users.values());
|
List<UserOperateModel> userList = new ArrayList<UserOperateModel>(users.values());
|
||||||
// 查询条件过滤
|
// 查询条件过滤
|
||||||
if (StringUtils.isNotEmpty(userModel.getSearchValue()))
|
if (StringUtils.isNotEmpty(userModel.getSearchValue())) {
|
||||||
{
|
|
||||||
userList.clear();
|
userList.clear();
|
||||||
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
|
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet()) {
|
||||||
{
|
if (entry.getValue().getUserName().equals(userModel.getSearchValue())) {
|
||||||
if (entry.getValue().getUserName().equals(userModel.getSearchValue()))
|
|
||||||
{
|
|
||||||
userList.add(entry.getValue());
|
userList.add(entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (StringUtils.isNotEmpty(userModel.getUserName()))
|
else if (StringUtils.isNotEmpty(userModel.getUserName())) {
|
||||||
{
|
|
||||||
userList.clear();
|
userList.clear();
|
||||||
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
|
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet()) {
|
||||||
{
|
if (entry.getValue().getUserName().equals(userModel.getUserName())) {
|
||||||
if (entry.getValue().getUserName().equals(userModel.getUserName()))
|
|
||||||
{
|
|
||||||
userList.add(entry.getValue());
|
userList.add(entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
|
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize()) {
|
||||||
{
|
|
||||||
rspData.setRows(userList);
|
rspData.setRows(userList);
|
||||||
rspData.setTotal(userList.size());
|
rspData.setTotal(userList.size());
|
||||||
return rspData;
|
return rspData;
|
||||||
}
|
}
|
||||||
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
||||||
Integer pageSize = pageDomain.getPageNum() * 10;
|
Integer pageSize = pageDomain.getPageNum() * 10;
|
||||||
if (pageSize > userList.size())
|
if (pageSize > userList.size()) {
|
||||||
{
|
|
||||||
pageSize = userList.size();
|
pageSize = userList.size();
|
||||||
}
|
}
|
||||||
rspData.setRows(userList.subList(pageNum, pageSize));
|
rspData.setRows(userList.subList(pageNum, pageSize));
|
||||||
|
|
@ -137,8 +123,7 @@ public class DemoOperateController extends BaseController
|
||||||
* 新增用户
|
* 新增用户
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add(ModelMap mmap)
|
public String add(ModelMap mmap) {
|
||||||
{
|
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -147,8 +132,7 @@ public class DemoOperateController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(UserOperateModel user)
|
public AjaxResult addSave(UserOperateModel user) {
|
||||||
{
|
|
||||||
Integer userId = users.size() + 1;
|
Integer userId = users.size() + 1;
|
||||||
user.setUserId(userId);
|
user.setUserId(userId);
|
||||||
return AjaxResult.success(users.put(userId, user));
|
return AjaxResult.success(users.put(userId, user));
|
||||||
|
|
@ -159,8 +143,7 @@ public class DemoOperateController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/customer/add")
|
@PostMapping("/customer/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(CustomerModel customerModel)
|
public AjaxResult addSave(CustomerModel customerModel) {
|
||||||
{
|
|
||||||
System.out.println(customerModel.toString());
|
System.out.println(customerModel.toString());
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
@ -169,8 +152,7 @@ public class DemoOperateController extends BaseController
|
||||||
* 修改用户
|
* 修改用户
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{userId}")
|
@GetMapping("/edit/{userId}")
|
||||||
public String edit(@PathVariable("userId") Integer userId, ModelMap mmap)
|
public String edit(@PathVariable("userId") Integer userId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("user", users.get(userId));
|
mmap.put("user", users.get(userId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
@ -180,8 +162,7 @@ public class DemoOperateController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(UserOperateModel user)
|
public AjaxResult editSave(UserOperateModel user) {
|
||||||
{
|
|
||||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -190,8 +171,7 @@ public class DemoOperateController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(UserOperateModel user)
|
public AjaxResult export(UserOperateModel user) {
|
||||||
{
|
|
||||||
List<UserOperateModel> list = new ArrayList<UserOperateModel>(users.values());
|
List<UserOperateModel> list = new ArrayList<UserOperateModel>(users.values());
|
||||||
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
||||||
return util.exportExcel(list, "用户数据");
|
return util.exportExcel(list, "用户数据");
|
||||||
|
|
@ -202,8 +182,7 @@ public class DemoOperateController extends BaseController
|
||||||
*/
|
*/
|
||||||
@GetMapping("/importTemplate")
|
@GetMapping("/importTemplate")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult importTemplate()
|
public AjaxResult importTemplate() {
|
||||||
{
|
|
||||||
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
||||||
return util.importTemplateExcel("用户数据");
|
return util.importTemplateExcel("用户数据");
|
||||||
}
|
}
|
||||||
|
|
@ -213,8 +192,7 @@ public class DemoOperateController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/importData")
|
@PostMapping("/importData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
|
||||||
{
|
|
||||||
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
||||||
List<UserOperateModel> userList = util.importExcel(file.getInputStream());
|
List<UserOperateModel> userList = util.importExcel(file.getInputStream());
|
||||||
String message = importUser(userList, updateSupport);
|
String message = importUser(userList, updateSupport);
|
||||||
|
|
@ -226,11 +204,9 @@ public class DemoOperateController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids) {
|
||||||
{
|
|
||||||
Integer[] userIds = Convert.toIntArray(ids);
|
Integer[] userIds = Convert.toIntArray(ids);
|
||||||
for (Integer userId : userIds)
|
for (Integer userId : userIds) {
|
||||||
{
|
|
||||||
users.remove(userId);
|
users.remove(userId);
|
||||||
}
|
}
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
|
|
@ -240,16 +216,14 @@ public class DemoOperateController extends BaseController
|
||||||
* 查看详细
|
* 查看详细
|
||||||
*/
|
*/
|
||||||
@GetMapping("/detail/{userId}")
|
@GetMapping("/detail/{userId}")
|
||||||
public String detail(@PathVariable("userId") Integer userId, ModelMap mmap)
|
public String detail(@PathVariable("userId") Integer userId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("user", users.get(userId));
|
mmap.put("user", users.get(userId));
|
||||||
return prefix + "/detail";
|
return prefix + "/detail";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/clean")
|
@PostMapping("/clean")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult clean()
|
public AjaxResult clean() {
|
||||||
{
|
|
||||||
users.clear();
|
users.clear();
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
@ -261,64 +235,52 @@ public class DemoOperateController extends BaseController
|
||||||
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String importUser(List<UserOperateModel> userList, Boolean isUpdateSupport)
|
public String importUser(List<UserOperateModel> userList, Boolean isUpdateSupport) {
|
||||||
{
|
if (StringUtils.isNull(userList) || userList.size() == 0) {
|
||||||
if (StringUtils.isNull(userList) || userList.size() == 0)
|
|
||||||
{
|
|
||||||
throw new BusinessException("导入用户数据不能为空!");
|
throw new BusinessException("导入用户数据不能为空!");
|
||||||
}
|
}
|
||||||
int successNum = 0;
|
int successNum = 0;
|
||||||
int failureNum = 0;
|
int failureNum = 0;
|
||||||
StringBuilder successMsg = new StringBuilder();
|
StringBuilder successMsg = new StringBuilder();
|
||||||
StringBuilder failureMsg = new StringBuilder();
|
StringBuilder failureMsg = new StringBuilder();
|
||||||
for (UserOperateModel user : userList)
|
for (UserOperateModel user : userList) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
// 验证是否存在这个用户
|
// 验证是否存在这个用户
|
||||||
boolean userFlag = false;
|
boolean userFlag = false;
|
||||||
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
|
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet()) {
|
||||||
{
|
if (entry.getValue().getUserName().equals(user.getUserName())) {
|
||||||
if (entry.getValue().getUserName().equals(user.getUserName()))
|
|
||||||
{
|
|
||||||
userFlag = true;
|
userFlag = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!userFlag)
|
if (!userFlag) {
|
||||||
{
|
|
||||||
Integer userId = users.size() + 1;
|
Integer userId = users.size() + 1;
|
||||||
user.setUserId(userId);
|
user.setUserId(userId);
|
||||||
users.put(userId, user);
|
users.put(userId, user);
|
||||||
successNum++;
|
successNum++;
|
||||||
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 导入成功");
|
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 导入成功");
|
||||||
}
|
}
|
||||||
else if (isUpdateSupport)
|
else if (isUpdateSupport) {
|
||||||
{
|
|
||||||
users.put(user.getUserId(), user);
|
users.put(user.getUserId(), user);
|
||||||
successNum++;
|
successNum++;
|
||||||
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 更新成功");
|
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 更新成功");
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
failureNum++;
|
failureNum++;
|
||||||
failureMsg.append("<br/>" + failureNum + "、用户 " + user.getUserName() + " 已存在");
|
failureMsg.append("<br/>" + failureNum + "、用户 " + user.getUserName() + " 已存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
failureNum++;
|
failureNum++;
|
||||||
String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
|
String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
|
||||||
failureMsg.append(msg + e.getMessage());
|
failureMsg.append(msg + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (failureNum > 0)
|
if (failureNum > 0) {
|
||||||
{
|
|
||||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||||
throw new BusinessException(failureMsg.toString());
|
throw new BusinessException(failureMsg.toString());
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||||
}
|
}
|
||||||
return successMsg.toString();
|
return successMsg.toString();
|
||||||
|
|
|
||||||
|
|
@ -11,16 +11,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/demo/report")
|
@RequestMapping("/demo/report")
|
||||||
public class DemoReportController
|
public class DemoReportController {
|
||||||
{
|
|
||||||
private String prefix = "demo/report";
|
private String prefix = "demo/report";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 百度ECharts
|
* 百度ECharts
|
||||||
*/
|
*/
|
||||||
@GetMapping("/echarts")
|
@GetMapping("/echarts")
|
||||||
public String echarts()
|
public String echarts() {
|
||||||
{
|
|
||||||
return prefix + "/echarts";
|
return prefix + "/echarts";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -28,8 +26,7 @@ public class DemoReportController
|
||||||
* 图表插件
|
* 图表插件
|
||||||
*/
|
*/
|
||||||
@GetMapping("/peity")
|
@GetMapping("/peity")
|
||||||
public String peity()
|
public String peity() {
|
||||||
{
|
|
||||||
return prefix + "/peity";
|
return prefix + "/peity";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,8 +34,7 @@ public class DemoReportController
|
||||||
* 线状图插件
|
* 线状图插件
|
||||||
*/
|
*/
|
||||||
@GetMapping("/sparkline")
|
@GetMapping("/sparkline")
|
||||||
public String sparkline()
|
public String sparkline() {
|
||||||
{
|
|
||||||
return prefix + "/sparkline";
|
return prefix + "/sparkline";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,8 +42,7 @@ public class DemoReportController
|
||||||
* 图表组合
|
* 图表组合
|
||||||
*/
|
*/
|
||||||
@GetMapping("/metrics")
|
@GetMapping("/metrics")
|
||||||
public String metrics()
|
public String metrics() {
|
||||||
{
|
|
||||||
return prefix + "/metrics";
|
return prefix + "/metrics";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,5 @@
|
||||||
package com.ruoyi.web.controller.demo.controller;
|
package com.ruoyi.web.controller.demo.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
|
@ -19,6 +8,14 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.core.page.TableSupport;
|
import com.ruoyi.common.core.page.TableSupport;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格相关
|
* 表格相关
|
||||||
|
|
@ -27,11 +24,11 @@ import com.ruoyi.common.utils.StringUtils;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/demo/table")
|
@RequestMapping("/demo/table")
|
||||||
public class DemoTableController extends BaseController
|
public class DemoTableController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "demo/table";
|
private String prefix = "demo/table";
|
||||||
|
|
||||||
private final static List<UserTableModel> users = new ArrayList<UserTableModel>();
|
private final static List<UserTableModel> users = new ArrayList<UserTableModel>();
|
||||||
|
|
||||||
{
|
{
|
||||||
users.add(new UserTableModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
|
users.add(new UserTableModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
|
||||||
users.add(new UserTableModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1"));
|
users.add(new UserTableModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1"));
|
||||||
|
|
@ -62,6 +59,7 @@ public class DemoTableController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static List<UserTableColumn> columns = new ArrayList<UserTableColumn>();
|
private final static List<UserTableColumn> columns = new ArrayList<UserTableColumn>();
|
||||||
|
|
||||||
{
|
{
|
||||||
columns.add(new UserTableColumn("用户ID", "userId"));
|
columns.add(new UserTableColumn("用户ID", "userId"));
|
||||||
columns.add(new UserTableColumn("用户编号", "userCode"));
|
columns.add(new UserTableColumn("用户编号", "userCode"));
|
||||||
|
|
@ -75,8 +73,7 @@ public class DemoTableController extends BaseController
|
||||||
* 搜索相关
|
* 搜索相关
|
||||||
*/
|
*/
|
||||||
@GetMapping("/search")
|
@GetMapping("/search")
|
||||||
public String search()
|
public String search() {
|
||||||
{
|
|
||||||
return prefix + "/search";
|
return prefix + "/search";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -84,8 +81,7 @@ public class DemoTableController extends BaseController
|
||||||
* 数据汇总
|
* 数据汇总
|
||||||
*/
|
*/
|
||||||
@GetMapping("/footer")
|
@GetMapping("/footer")
|
||||||
public String footer()
|
public String footer() {
|
||||||
{
|
|
||||||
return prefix + "/footer";
|
return prefix + "/footer";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -93,8 +89,7 @@ public class DemoTableController extends BaseController
|
||||||
* 组合表头
|
* 组合表头
|
||||||
*/
|
*/
|
||||||
@GetMapping("/groupHeader")
|
@GetMapping("/groupHeader")
|
||||||
public String groupHeader()
|
public String groupHeader() {
|
||||||
{
|
|
||||||
return prefix + "/groupHeader";
|
return prefix + "/groupHeader";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,8 +97,7 @@ public class DemoTableController extends BaseController
|
||||||
* 表格导出
|
* 表格导出
|
||||||
*/
|
*/
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
public String export()
|
public String export() {
|
||||||
{
|
|
||||||
return prefix + "/export";
|
return prefix + "/export";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,8 +105,7 @@ public class DemoTableController extends BaseController
|
||||||
* 翻页记住选择
|
* 翻页记住选择
|
||||||
*/
|
*/
|
||||||
@GetMapping("/remember")
|
@GetMapping("/remember")
|
||||||
public String remember()
|
public String remember() {
|
||||||
{
|
|
||||||
return prefix + "/remember";
|
return prefix + "/remember";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,8 +113,7 @@ public class DemoTableController extends BaseController
|
||||||
* 跳转至指定页
|
* 跳转至指定页
|
||||||
*/
|
*/
|
||||||
@GetMapping("/pageGo")
|
@GetMapping("/pageGo")
|
||||||
public String pageGo()
|
public String pageGo() {
|
||||||
{
|
|
||||||
return prefix + "/pageGo";
|
return prefix + "/pageGo";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -129,8 +121,7 @@ public class DemoTableController extends BaseController
|
||||||
* 自定义查询参数
|
* 自定义查询参数
|
||||||
*/
|
*/
|
||||||
@GetMapping("/params")
|
@GetMapping("/params")
|
||||||
public String params()
|
public String params() {
|
||||||
{
|
|
||||||
return prefix + "/params";
|
return prefix + "/params";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -138,8 +129,7 @@ public class DemoTableController extends BaseController
|
||||||
* 多表格
|
* 多表格
|
||||||
*/
|
*/
|
||||||
@GetMapping("/multi")
|
@GetMapping("/multi")
|
||||||
public String multi()
|
public String multi() {
|
||||||
{
|
|
||||||
return prefix + "/multi";
|
return prefix + "/multi";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -147,8 +137,7 @@ public class DemoTableController extends BaseController
|
||||||
* 点击按钮加载表格
|
* 点击按钮加载表格
|
||||||
*/
|
*/
|
||||||
@GetMapping("/button")
|
@GetMapping("/button")
|
||||||
public String button()
|
public String button() {
|
||||||
{
|
|
||||||
return prefix + "/button";
|
return prefix + "/button";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,8 +145,7 @@ public class DemoTableController extends BaseController
|
||||||
* 直接加载表格数据
|
* 直接加载表格数据
|
||||||
*/
|
*/
|
||||||
@GetMapping("/data")
|
@GetMapping("/data")
|
||||||
public String data(ModelMap mmap)
|
public String data(ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("users", users);
|
mmap.put("users", users);
|
||||||
return prefix + "/data";
|
return prefix + "/data";
|
||||||
}
|
}
|
||||||
|
|
@ -166,8 +154,7 @@ public class DemoTableController extends BaseController
|
||||||
* 表格冻结列
|
* 表格冻结列
|
||||||
*/
|
*/
|
||||||
@GetMapping("/fixedColumns")
|
@GetMapping("/fixedColumns")
|
||||||
public String fixedColumns()
|
public String fixedColumns() {
|
||||||
{
|
|
||||||
return prefix + "/fixedColumns";
|
return prefix + "/fixedColumns";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -175,8 +162,7 @@ public class DemoTableController extends BaseController
|
||||||
* 自定义触发事件
|
* 自定义触发事件
|
||||||
*/
|
*/
|
||||||
@GetMapping("/event")
|
@GetMapping("/event")
|
||||||
public String event()
|
public String event() {
|
||||||
{
|
|
||||||
return prefix + "/event";
|
return prefix + "/event";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -184,8 +170,7 @@ public class DemoTableController extends BaseController
|
||||||
* 表格细节视图
|
* 表格细节视图
|
||||||
*/
|
*/
|
||||||
@GetMapping("/detail")
|
@GetMapping("/detail")
|
||||||
public String detail()
|
public String detail() {
|
||||||
{
|
|
||||||
return prefix + "/detail";
|
return prefix + "/detail";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,8 +178,7 @@ public class DemoTableController extends BaseController
|
||||||
* 表格父子视图
|
* 表格父子视图
|
||||||
*/
|
*/
|
||||||
@GetMapping("/child")
|
@GetMapping("/child")
|
||||||
public String child()
|
public String child() {
|
||||||
{
|
|
||||||
return prefix + "/child";
|
return prefix + "/child";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,8 +186,7 @@ public class DemoTableController extends BaseController
|
||||||
* 表格图片预览
|
* 表格图片预览
|
||||||
*/
|
*/
|
||||||
@GetMapping("/image")
|
@GetMapping("/image")
|
||||||
public String image()
|
public String image() {
|
||||||
{
|
|
||||||
return prefix + "/image";
|
return prefix + "/image";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -211,8 +194,7 @@ public class DemoTableController extends BaseController
|
||||||
* 动态增删改查
|
* 动态增删改查
|
||||||
*/
|
*/
|
||||||
@GetMapping("/curd")
|
@GetMapping("/curd")
|
||||||
public String curd()
|
public String curd() {
|
||||||
{
|
|
||||||
return prefix + "/curd";
|
return prefix + "/curd";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -220,8 +202,7 @@ public class DemoTableController extends BaseController
|
||||||
* 表格拖拽操作
|
* 表格拖拽操作
|
||||||
*/
|
*/
|
||||||
@GetMapping("/reorder")
|
@GetMapping("/reorder")
|
||||||
public String reorder()
|
public String reorder() {
|
||||||
{
|
|
||||||
return prefix + "/reorder";
|
return prefix + "/reorder";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -229,8 +210,7 @@ public class DemoTableController extends BaseController
|
||||||
* 表格列宽拖动
|
* 表格列宽拖动
|
||||||
*/
|
*/
|
||||||
@GetMapping("/resizable")
|
@GetMapping("/resizable")
|
||||||
public String resizable()
|
public String resizable() {
|
||||||
{
|
|
||||||
return prefix + "/resizable";
|
return prefix + "/resizable";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -238,8 +218,7 @@ public class DemoTableController extends BaseController
|
||||||
* 表格行内编辑操作
|
* 表格行内编辑操作
|
||||||
*/
|
*/
|
||||||
@GetMapping("/editable")
|
@GetMapping("/editable")
|
||||||
public String editable()
|
public String editable() {
|
||||||
{
|
|
||||||
return prefix + "/editable";
|
return prefix + "/editable";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -247,8 +226,7 @@ public class DemoTableController extends BaseController
|
||||||
* 主子表提交
|
* 主子表提交
|
||||||
*/
|
*/
|
||||||
@GetMapping("/subdata")
|
@GetMapping("/subdata")
|
||||||
public String subdata()
|
public String subdata() {
|
||||||
{
|
|
||||||
return prefix + "/subdata";
|
return prefix + "/subdata";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -256,8 +234,7 @@ public class DemoTableController extends BaseController
|
||||||
* 表格自动刷新
|
* 表格自动刷新
|
||||||
*/
|
*/
|
||||||
@GetMapping("/refresh")
|
@GetMapping("/refresh")
|
||||||
public String refresh()
|
public String refresh() {
|
||||||
{
|
|
||||||
return prefix + "/refresh";
|
return prefix + "/refresh";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -265,8 +242,7 @@ public class DemoTableController extends BaseController
|
||||||
* 表格打印配置
|
* 表格打印配置
|
||||||
*/
|
*/
|
||||||
@GetMapping("/print")
|
@GetMapping("/print")
|
||||||
public String print()
|
public String print() {
|
||||||
{
|
|
||||||
return prefix + "/print";
|
return prefix + "/print";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -274,8 +250,7 @@ public class DemoTableController extends BaseController
|
||||||
* 表格标题格式化
|
* 表格标题格式化
|
||||||
*/
|
*/
|
||||||
@GetMapping("/headerStyle")
|
@GetMapping("/headerStyle")
|
||||||
public String headerStyle()
|
public String headerStyle() {
|
||||||
{
|
|
||||||
return prefix + "/headerStyle";
|
return prefix + "/headerStyle";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -283,8 +258,7 @@ public class DemoTableController extends BaseController
|
||||||
* 表格动态列
|
* 表格动态列
|
||||||
*/
|
*/
|
||||||
@GetMapping("/dynamicColumns")
|
@GetMapping("/dynamicColumns")
|
||||||
public String dynamicColumns()
|
public String dynamicColumns() {
|
||||||
{
|
|
||||||
return prefix + "/dynamicColumns";
|
return prefix + "/dynamicColumns";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -292,8 +266,7 @@ public class DemoTableController extends BaseController
|
||||||
* 表格其他操作
|
* 表格其他操作
|
||||||
*/
|
*/
|
||||||
@GetMapping("/other")
|
@GetMapping("/other")
|
||||||
public String other()
|
public String other() {
|
||||||
{
|
|
||||||
return prefix + "/other";
|
return prefix + "/other";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -302,12 +275,10 @@ public class DemoTableController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/ajaxColumns")
|
@PostMapping("/ajaxColumns")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult ajaxColumns(UserTableColumn userColumn)
|
public AjaxResult ajaxColumns(UserTableColumn userColumn) {
|
||||||
{
|
|
||||||
List<UserTableColumn> columnList = new ArrayList<UserTableColumn>(Arrays.asList(new UserTableColumn[columns.size()]));
|
List<UserTableColumn> columnList = new ArrayList<UserTableColumn>(Arrays.asList(new UserTableColumn[columns.size()]));
|
||||||
Collections.copy(columnList, columns);
|
Collections.copy(columnList, columns);
|
||||||
if (userColumn != null && "userBalance".equals(userColumn.getField()))
|
if (userColumn != null && "userBalance".equals(userColumn.getField())) {
|
||||||
{
|
|
||||||
columnList.add(new UserTableColumn("用户余额", "userBalance"));
|
columnList.add(new UserTableColumn("用户余额", "userBalance"));
|
||||||
}
|
}
|
||||||
return AjaxResult.success(columnList);
|
return AjaxResult.success(columnList);
|
||||||
|
|
@ -318,34 +289,28 @@ public class DemoTableController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(UserTableModel userModel)
|
public TableDataInfo list(UserTableModel userModel) {
|
||||||
{
|
|
||||||
TableDataInfo rspData = new TableDataInfo();
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
List<UserTableModel> userList = new ArrayList<UserTableModel>(Arrays.asList(new UserTableModel[users.size()]));
|
List<UserTableModel> userList = new ArrayList<UserTableModel>(Arrays.asList(new UserTableModel[users.size()]));
|
||||||
Collections.copy(userList, users);
|
Collections.copy(userList, users);
|
||||||
// 查询条件过滤
|
// 查询条件过滤
|
||||||
if (StringUtils.isNotEmpty(userModel.getUserName()))
|
if (StringUtils.isNotEmpty(userModel.getUserName())) {
|
||||||
{
|
|
||||||
userList.clear();
|
userList.clear();
|
||||||
for (UserTableModel user : users)
|
for (UserTableModel user : users) {
|
||||||
{
|
if (user.getUserName().equals(userModel.getUserName())) {
|
||||||
if (user.getUserName().equals(userModel.getUserName()))
|
|
||||||
{
|
|
||||||
userList.add(user);
|
userList.add(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
|
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize()) {
|
||||||
{
|
|
||||||
rspData.setRows(userList);
|
rspData.setRows(userList);
|
||||||
rspData.setTotal(userList.size());
|
rspData.setTotal(userList.size());
|
||||||
return rspData;
|
return rspData;
|
||||||
}
|
}
|
||||||
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
||||||
Integer pageSize = pageDomain.getPageNum() * 10;
|
Integer pageSize = pageDomain.getPageNum() * 10;
|
||||||
if (pageSize > userList.size())
|
if (pageSize > userList.size()) {
|
||||||
{
|
|
||||||
pageSize = userList.size();
|
pageSize = userList.size();
|
||||||
}
|
}
|
||||||
rspData.setRows(userList.subList(pageNum, pageSize));
|
rspData.setRows(userList.subList(pageNum, pageSize));
|
||||||
|
|
@ -354,83 +319,95 @@ public class DemoTableController extends BaseController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class UserTableColumn
|
class UserTableColumn {
|
||||||
{
|
/**
|
||||||
/** 表头 */
|
* 表头
|
||||||
|
*/
|
||||||
private String title;
|
private String title;
|
||||||
/** 字段 */
|
/**
|
||||||
|
* 字段
|
||||||
|
*/
|
||||||
private String field;
|
private String field;
|
||||||
|
|
||||||
public UserTableColumn()
|
public UserTableColumn() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserTableColumn(String title, String field)
|
public UserTableColumn(String title, String field) {
|
||||||
{
|
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.field = field;
|
this.field = field;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle()
|
public String getTitle() {
|
||||||
{
|
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String title)
|
public void setTitle(String title) {
|
||||||
{
|
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getField()
|
public String getField() {
|
||||||
{
|
|
||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setField(String field)
|
public void setField(String field) {
|
||||||
{
|
|
||||||
this.field = field;
|
this.field = field;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class UserTableModel
|
class UserTableModel {
|
||||||
{
|
/**
|
||||||
/** 用户ID */
|
* 用户ID
|
||||||
|
*/
|
||||||
private int userId;
|
private int userId;
|
||||||
|
|
||||||
/** 用户编号 */
|
/**
|
||||||
|
* 用户编号
|
||||||
|
*/
|
||||||
private String userCode;
|
private String userCode;
|
||||||
|
|
||||||
/** 用户姓名 */
|
/**
|
||||||
|
* 用户姓名
|
||||||
|
*/
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
/** 用户性别 */
|
/**
|
||||||
|
* 用户性别
|
||||||
|
*/
|
||||||
private String userSex;
|
private String userSex;
|
||||||
|
|
||||||
/** 用户手机 */
|
/**
|
||||||
|
* 用户手机
|
||||||
|
*/
|
||||||
private String userPhone;
|
private String userPhone;
|
||||||
|
|
||||||
/** 用户邮箱 */
|
/**
|
||||||
|
* 用户邮箱
|
||||||
|
*/
|
||||||
private String userEmail;
|
private String userEmail;
|
||||||
|
|
||||||
/** 用户余额 */
|
/**
|
||||||
|
* 用户余额
|
||||||
|
*/
|
||||||
private double userBalance;
|
private double userBalance;
|
||||||
|
|
||||||
/** 用户状态(0正常 1停用) */
|
/**
|
||||||
|
* 用户状态(0正常 1停用)
|
||||||
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/** 创建时间 */
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
public UserTableModel()
|
public UserTableModel() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserTableModel(int userId, String userCode, String userName, String userSex, String userPhone,
|
public UserTableModel(int userId, String userCode, String userName, String userSex, String userPhone,
|
||||||
String userEmail, double userBalance, String status)
|
String userEmail, double userBalance, String status) {
|
||||||
{
|
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.userCode = userCode;
|
this.userCode = userCode;
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
|
|
@ -442,93 +419,75 @@ class UserTableModel
|
||||||
this.createTime = DateUtils.getNowDate();
|
this.createTime = DateUtils.getNowDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserId()
|
public int getUserId() {
|
||||||
{
|
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserId(int userId)
|
public void setUserId(int userId) {
|
||||||
{
|
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserCode()
|
public String getUserCode() {
|
||||||
{
|
|
||||||
return userCode;
|
return userCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserCode(String userCode)
|
public void setUserCode(String userCode) {
|
||||||
{
|
|
||||||
this.userCode = userCode;
|
this.userCode = userCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserName()
|
public String getUserName() {
|
||||||
{
|
|
||||||
return userName;
|
return userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserName(String userName)
|
public void setUserName(String userName) {
|
||||||
{
|
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserSex()
|
public String getUserSex() {
|
||||||
{
|
|
||||||
return userSex;
|
return userSex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserSex(String userSex)
|
public void setUserSex(String userSex) {
|
||||||
{
|
|
||||||
this.userSex = userSex;
|
this.userSex = userSex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserPhone()
|
public String getUserPhone() {
|
||||||
{
|
|
||||||
return userPhone;
|
return userPhone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserPhone(String userPhone)
|
public void setUserPhone(String userPhone) {
|
||||||
{
|
|
||||||
this.userPhone = userPhone;
|
this.userPhone = userPhone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserEmail()
|
public String getUserEmail() {
|
||||||
{
|
|
||||||
return userEmail;
|
return userEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserEmail(String userEmail)
|
public void setUserEmail(String userEmail) {
|
||||||
{
|
|
||||||
this.userEmail = userEmail;
|
this.userEmail = userEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getUserBalance()
|
public double getUserBalance() {
|
||||||
{
|
|
||||||
return userBalance;
|
return userBalance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserBalance(double userBalance)
|
public void setUserBalance(double userBalance) {
|
||||||
{
|
|
||||||
this.userBalance = userBalance;
|
this.userBalance = userBalance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStatus()
|
public String getStatus() {
|
||||||
{
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(String status)
|
public void setStatus(String status) {
|
||||||
{
|
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getCreateTime()
|
public Date getCreateTime() {
|
||||||
{
|
|
||||||
return createTime;
|
return createTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreateTime(Date createTime)
|
public void setCreateTime(Date createTime) {
|
||||||
{
|
|
||||||
this.createTime = createTime;
|
this.createTime = createTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
package com.ruoyi.web.controller.demo.domain;
|
package com.ruoyi.web.controller.demo.domain;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户测试信息
|
* 客户测试信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class CustomerModel
|
public class CustomerModel {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 客户姓名
|
* 客户姓名
|
||||||
*/
|
*/
|
||||||
|
|
@ -41,70 +41,58 @@ public class CustomerModel
|
||||||
*/
|
*/
|
||||||
private List<GoodsModel> goods;
|
private List<GoodsModel> goods;
|
||||||
|
|
||||||
public String getName()
|
public String getName() {
|
||||||
{
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name)
|
public void setName(String name) {
|
||||||
{
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPhonenumber()
|
public String getPhonenumber() {
|
||||||
{
|
|
||||||
return phonenumber;
|
return phonenumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPhonenumber(String phonenumber)
|
public void setPhonenumber(String phonenumber) {
|
||||||
{
|
|
||||||
this.phonenumber = phonenumber;
|
this.phonenumber = phonenumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getSex()
|
public String getSex() {
|
||||||
{
|
|
||||||
return sex;
|
return sex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSex(String sex)
|
public void setSex(String sex) {
|
||||||
{
|
|
||||||
this.sex = sex;
|
this.sex = sex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBirthday()
|
public String getBirthday() {
|
||||||
{
|
|
||||||
return birthday;
|
return birthday;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBirthday(String birthday)
|
public void setBirthday(String birthday) {
|
||||||
{
|
|
||||||
this.birthday = birthday;
|
this.birthday = birthday;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRemark()
|
public String getRemark() {
|
||||||
{
|
|
||||||
return remark;
|
return remark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRemark(String remark)
|
public void setRemark(String remark) {
|
||||||
{
|
|
||||||
this.remark = remark;
|
this.remark = remark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GoodsModel> getGoods()
|
public List<GoodsModel> getGoods() {
|
||||||
{
|
|
||||||
return goods;
|
return goods;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGoods(List<GoodsModel> goods)
|
public void setGoods(List<GoodsModel> goods) {
|
||||||
{
|
|
||||||
this.goods = goods;
|
this.goods = goods;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("name", getName())
|
.append("name", getName())
|
||||||
.append("phonenumber", getPhonenumber())
|
.append("phonenumber", getPhonenumber())
|
||||||
.append("sex", getSex())
|
.append("sex", getSex())
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
package com.ruoyi.web.controller.demo.domain;
|
package com.ruoyi.web.controller.demo.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品测试信息
|
* 商品测试信息
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class GoodsModel
|
public class GoodsModel {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 商品名称
|
* 商品名称
|
||||||
*/
|
*/
|
||||||
|
|
@ -36,59 +36,49 @@ public class GoodsModel
|
||||||
*/
|
*/
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
public String getName()
|
public String getName() {
|
||||||
{
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name)
|
public void setName(String name) {
|
||||||
{
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getWeight()
|
public Integer getWeight() {
|
||||||
{
|
|
||||||
return weight;
|
return weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWeight(Integer weight)
|
public void setWeight(Integer weight) {
|
||||||
{
|
|
||||||
this.weight = weight;
|
this.weight = weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getPrice()
|
public Double getPrice() {
|
||||||
{
|
|
||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrice(Double price)
|
public void setPrice(Double price) {
|
||||||
{
|
|
||||||
this.price = price;
|
this.price = price;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDate()
|
public Date getDate() {
|
||||||
{
|
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDate(Date date)
|
public void setDate(Date date) {
|
||||||
{
|
|
||||||
this.date = date;
|
this.date = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getType()
|
public String getType() {
|
||||||
{
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(String type)
|
public void setType(String type) {
|
||||||
{
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("name", getName())
|
.append("name", getName())
|
||||||
.append("weight", getWeight())
|
.append("weight", getWeight())
|
||||||
.append("price", getPrice())
|
.append("price", getPrice())
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
package com.ruoyi.web.controller.demo.domain;
|
package com.ruoyi.web.controller.demo.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.common.annotation.Excel.Type;
|
import com.ruoyi.common.annotation.Excel.Type;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
|
||||||
public class UserOperateModel extends BaseEntity
|
import java.util.Date;
|
||||||
{
|
|
||||||
|
public class UserOperateModel extends BaseEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private int userId;
|
private int userId;
|
||||||
|
|
@ -36,14 +36,12 @@ public class UserOperateModel extends BaseEntity
|
||||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
public UserOperateModel()
|
public UserOperateModel() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserOperateModel(int userId, String userCode, String userName, String userSex, String userPhone,
|
public UserOperateModel(int userId, String userCode, String userName, String userSex, String userPhone,
|
||||||
String userEmail, double userBalance, String status)
|
String userEmail, double userBalance, String status) {
|
||||||
{
|
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.userCode = userCode;
|
this.userCode = userCode;
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
|
|
@ -55,95 +53,77 @@ public class UserOperateModel extends BaseEntity
|
||||||
this.createTime = DateUtils.getNowDate();
|
this.createTime = DateUtils.getNowDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserId()
|
public int getUserId() {
|
||||||
{
|
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserId(int userId)
|
public void setUserId(int userId) {
|
||||||
{
|
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserCode()
|
public String getUserCode() {
|
||||||
{
|
|
||||||
return userCode;
|
return userCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserCode(String userCode)
|
public void setUserCode(String userCode) {
|
||||||
{
|
|
||||||
this.userCode = userCode;
|
this.userCode = userCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserName()
|
public String getUserName() {
|
||||||
{
|
|
||||||
return userName;
|
return userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserName(String userName)
|
public void setUserName(String userName) {
|
||||||
{
|
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserSex()
|
public String getUserSex() {
|
||||||
{
|
|
||||||
return userSex;
|
return userSex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserSex(String userSex)
|
public void setUserSex(String userSex) {
|
||||||
{
|
|
||||||
this.userSex = userSex;
|
this.userSex = userSex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserPhone()
|
public String getUserPhone() {
|
||||||
{
|
|
||||||
return userPhone;
|
return userPhone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserPhone(String userPhone)
|
public void setUserPhone(String userPhone) {
|
||||||
{
|
|
||||||
this.userPhone = userPhone;
|
this.userPhone = userPhone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserEmail()
|
public String getUserEmail() {
|
||||||
{
|
|
||||||
return userEmail;
|
return userEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserEmail(String userEmail)
|
public void setUserEmail(String userEmail) {
|
||||||
{
|
|
||||||
this.userEmail = userEmail;
|
this.userEmail = userEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getUserBalance()
|
public double getUserBalance() {
|
||||||
{
|
|
||||||
return userBalance;
|
return userBalance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserBalance(double userBalance)
|
public void setUserBalance(double userBalance) {
|
||||||
{
|
|
||||||
this.userBalance = userBalance;
|
this.userBalance = userBalance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStatus()
|
public String getStatus() {
|
||||||
{
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(String status)
|
public void setStatus(String status) {
|
||||||
{
|
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date getCreateTime()
|
public Date getCreateTime() {
|
||||||
{
|
|
||||||
return createTime;
|
return createTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCreateTime(Date createTime)
|
public void setCreateTime(Date createTime) {
|
||||||
{
|
|
||||||
this.createTime = createTime;
|
this.createTime = createTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.framework.web.service.CacheService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
|
|
@ -7,9 +10,6 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
|
||||||
import com.ruoyi.framework.web.service.CacheService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存监控
|
* 缓存监控
|
||||||
|
|
@ -18,38 +18,33 @@ import com.ruoyi.framework.web.service.CacheService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/cache")
|
@RequestMapping("/monitor/cache")
|
||||||
public class CacheController extends BaseController
|
public class CacheController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "monitor/cache";
|
private String prefix = "monitor/cache";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CacheService cacheService;
|
private CacheService cacheService;
|
||||||
|
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String cache(ModelMap mmap)
|
public String cache(ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("cacheNames", cacheService.getCacheNames());
|
mmap.put("cacheNames", cacheService.getCacheNames());
|
||||||
return prefix + "/cache";
|
return prefix + "/cache";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/getNames")
|
@PostMapping("/getNames")
|
||||||
public String getCacheNames(String fragment, ModelMap mmap)
|
public String getCacheNames(String fragment, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("cacheNames", cacheService.getCacheNames());
|
mmap.put("cacheNames", cacheService.getCacheNames());
|
||||||
return prefix + "/cache::" + fragment;
|
return prefix + "/cache::" + fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/getKeys")
|
@PostMapping("/getKeys")
|
||||||
public String getCacheKeys(String fragment, String cacheName, ModelMap mmap)
|
public String getCacheKeys(String fragment, String cacheName, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("cacheName", cacheName);
|
mmap.put("cacheName", cacheName);
|
||||||
mmap.put("cacheKyes", cacheService.getCacheKeys(cacheName));
|
mmap.put("cacheKyes", cacheService.getCacheKeys(cacheName));
|
||||||
return prefix + "/cache::" + fragment;
|
return prefix + "/cache::" + fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/getValue")
|
@PostMapping("/getValue")
|
||||||
public String getCacheValue(String fragment, String cacheName, String cacheKey, ModelMap mmap)
|
public String getCacheValue(String fragment, String cacheName, String cacheKey, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("cacheName", cacheName);
|
mmap.put("cacheName", cacheName);
|
||||||
mmap.put("cacheKey", cacheKey);
|
mmap.put("cacheKey", cacheKey);
|
||||||
mmap.put("cacheValue", cacheService.getCacheValue(cacheName, cacheKey));
|
mmap.put("cacheValue", cacheService.getCacheValue(cacheName, cacheKey));
|
||||||
|
|
@ -58,24 +53,21 @@ public class CacheController extends BaseController
|
||||||
|
|
||||||
@PostMapping("/clearCacheName")
|
@PostMapping("/clearCacheName")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult clearCacheName(String cacheName, ModelMap mmap)
|
public AjaxResult clearCacheName(String cacheName, ModelMap mmap) {
|
||||||
{
|
|
||||||
cacheService.clearCacheName(cacheName);
|
cacheService.clearCacheName(cacheName);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/clearCacheKey")
|
@PostMapping("/clearCacheKey")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult clearCacheKey(String cacheName, String cacheKey, ModelMap mmap)
|
public AjaxResult clearCacheKey(String cacheName, String cacheKey, ModelMap mmap) {
|
||||||
{
|
|
||||||
cacheService.clearCacheKey(cacheName, cacheKey);
|
cacheService.clearCacheKey(cacheName, cacheKey);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/clearAll")
|
@GetMapping("/clearAll")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult clearAll(ModelMap mmap)
|
public AjaxResult clearAll(ModelMap mmap) {
|
||||||
{
|
|
||||||
cacheService.clearAll();
|
cacheService.clearAll();
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* druid 监控
|
* druid 监控
|
||||||
|
|
@ -13,14 +13,12 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/data")
|
@RequestMapping("/monitor/data")
|
||||||
public class DruidController extends BaseController
|
public class DruidController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "/druid";
|
private String prefix = "/druid";
|
||||||
|
|
||||||
@RequiresPermissions("monitor:data:view")
|
@RequiresPermissions("monitor:data:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String index()
|
public String index() {
|
||||||
{
|
|
||||||
return redirect(prefix + "/index");
|
return redirect(prefix + "/index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.framework.web.domain.Server;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
import com.ruoyi.framework.web.domain.Server;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务器监控
|
* 服务器监控
|
||||||
|
|
@ -15,14 +15,12 @@ import com.ruoyi.framework.web.domain.Server;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/server")
|
@RequestMapping("/monitor/server")
|
||||||
public class ServerController extends BaseController
|
public class ServerController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "monitor/server";
|
private String prefix = "monitor/server";
|
||||||
|
|
||||||
@RequiresPermissions("monitor:server:view")
|
@RequiresPermissions("monitor:server:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String server(ModelMap mmap) throws Exception
|
public String server(ModelMap mmap) throws Exception {
|
||||||
{
|
|
||||||
Server server = new Server();
|
Server server = new Server();
|
||||||
server.copyTo();
|
server.copyTo();
|
||||||
mmap.put("server", server);
|
mmap.put("server", server);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,14 @@
|
||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
|
import com.ruoyi.system.domain.SysLogininfor;
|
||||||
|
import com.ruoyi.system.service.ISysLogininforService;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
@ -9,14 +16,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import java.util.List;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
||||||
import com.ruoyi.system.domain.SysLogininfor;
|
|
||||||
import com.ruoyi.system.service.ISysLogininforService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统访问记录
|
* 系统访问记录
|
||||||
|
|
@ -25,8 +26,7 @@ import com.ruoyi.system.service.ISysLogininforService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/logininfor")
|
@RequestMapping("/monitor/logininfor")
|
||||||
public class SysLogininforController extends BaseController
|
public class SysLogininforController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "monitor/logininfor";
|
private String prefix = "monitor/logininfor";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -37,16 +37,14 @@ public class SysLogininforController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("monitor:logininfor:view")
|
@RequiresPermissions("monitor:logininfor:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String logininfor()
|
public String logininfor() {
|
||||||
{
|
|
||||||
return prefix + "/logininfor";
|
return prefix + "/logininfor";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:logininfor:list")
|
@RequiresPermissions("monitor:logininfor:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysLogininfor logininfor)
|
public TableDataInfo list(SysLogininfor logininfor) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -56,8 +54,7 @@ public class SysLogininforController extends BaseController
|
||||||
@RequiresPermissions("monitor:logininfor:export")
|
@RequiresPermissions("monitor:logininfor:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysLogininfor logininfor)
|
public AjaxResult export(SysLogininfor logininfor) {
|
||||||
{
|
|
||||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||||
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||||
return util.exportExcel(list, "登录日志");
|
return util.exportExcel(list, "登录日志");
|
||||||
|
|
@ -67,8 +64,7 @@ public class SysLogininforController extends BaseController
|
||||||
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids) {
|
||||||
{
|
|
||||||
return toAjax(logininforService.deleteLogininforByIds(ids));
|
return toAjax(logininforService.deleteLogininforByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,8 +72,7 @@ public class SysLogininforController extends BaseController
|
||||||
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||||
@PostMapping("/clean")
|
@PostMapping("/clean")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult clean()
|
public AjaxResult clean() {
|
||||||
{
|
|
||||||
logininforService.cleanLogininfor();
|
logininforService.cleanLogininfor();
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
@ -86,8 +81,7 @@ public class SysLogininforController extends BaseController
|
||||||
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||||
@PostMapping("/unlock")
|
@PostMapping("/unlock")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult unlock(String loginName)
|
public AjaxResult unlock(String loginName) {
|
||||||
{
|
|
||||||
passwordService.clearLoginRecordCache(loginName);
|
passwordService.clearLoginRecordCache(loginName);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,5 @@
|
||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
|
@ -18,6 +8,13 @@ import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.system.domain.SysOperLog;
|
import com.ruoyi.system.domain.SysOperLog;
|
||||||
import com.ruoyi.system.service.ISysOperLogService;
|
import com.ruoyi.system.service.ISysOperLogService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志记录
|
* 操作日志记录
|
||||||
|
|
@ -26,8 +23,7 @@ import com.ruoyi.system.service.ISysOperLogService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/operlog")
|
@RequestMapping("/monitor/operlog")
|
||||||
public class SysOperlogController extends BaseController
|
public class SysOperlogController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "monitor/operlog";
|
private String prefix = "monitor/operlog";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -35,16 +31,14 @@ public class SysOperlogController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("monitor:operlog:view")
|
@RequiresPermissions("monitor:operlog:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String operlog()
|
public String operlog() {
|
||||||
{
|
|
||||||
return prefix + "/operlog";
|
return prefix + "/operlog";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:operlog:list")
|
@RequiresPermissions("monitor:operlog:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysOperLog operLog)
|
public TableDataInfo list(SysOperLog operLog) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -54,8 +48,7 @@ public class SysOperlogController extends BaseController
|
||||||
@RequiresPermissions("monitor:operlog:export")
|
@RequiresPermissions("monitor:operlog:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysOperLog operLog)
|
public AjaxResult export(SysOperLog operLog) {
|
||||||
{
|
|
||||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||||
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
||||||
return util.exportExcel(list, "操作日志");
|
return util.exportExcel(list, "操作日志");
|
||||||
|
|
@ -64,15 +57,13 @@ public class SysOperlogController extends BaseController
|
||||||
@RequiresPermissions("monitor:operlog:remove")
|
@RequiresPermissions("monitor:operlog:remove")
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids) {
|
||||||
{
|
|
||||||
return toAjax(operLogService.deleteOperLogByIds(ids));
|
return toAjax(operLogService.deleteOperLogByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:operlog:detail")
|
@RequiresPermissions("monitor:operlog:detail")
|
||||||
@GetMapping("/detail/{operId}")
|
@GetMapping("/detail/{operId}")
|
||||||
public String detail(@PathVariable("operId") Long operId, ModelMap mmap)
|
public String detail(@PathVariable("operId") Long operId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("operLog", operLogService.selectOperLogById(operId));
|
mmap.put("operLog", operLogService.selectOperLogById(operId));
|
||||||
return prefix + "/detail";
|
return prefix + "/detail";
|
||||||
}
|
}
|
||||||
|
|
@ -81,8 +72,7 @@ public class SysOperlogController extends BaseController
|
||||||
@RequiresPermissions("monitor:operlog:remove")
|
@RequiresPermissions("monitor:operlog:remove")
|
||||||
@PostMapping("/clean")
|
@PostMapping("/clean")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult clean()
|
public AjaxResult clean() {
|
||||||
{
|
|
||||||
operLogService.cleanOperLog();
|
operLogService.cleanOperLog();
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,5 @@
|
||||||
package com.ruoyi.web.controller.monitor;
|
package com.ruoyi.web.controller.monitor;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.shiro.authz.annotation.Logical;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
|
@ -21,6 +12,16 @@ import com.ruoyi.framework.shiro.session.OnlineSession;
|
||||||
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
||||||
import com.ruoyi.system.domain.SysUserOnline;
|
import com.ruoyi.system.domain.SysUserOnline;
|
||||||
import com.ruoyi.system.service.ISysUserOnlineService;
|
import com.ruoyi.system.service.ISysUserOnlineService;
|
||||||
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 在线用户监控
|
* 在线用户监控
|
||||||
|
|
@ -29,8 +30,7 @@ import com.ruoyi.system.service.ISysUserOnlineService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/monitor/online")
|
@RequestMapping("/monitor/online")
|
||||||
public class SysUserOnlineController extends BaseController
|
public class SysUserOnlineController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "monitor/online";
|
private String prefix = "monitor/online";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -41,41 +41,34 @@ public class SysUserOnlineController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("monitor:online:view")
|
@RequiresPermissions("monitor:online:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String online()
|
public String online() {
|
||||||
{
|
|
||||||
return prefix + "/online";
|
return prefix + "/online";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("monitor:online:list")
|
@RequiresPermissions("monitor:online:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysUserOnline userOnline)
|
public TableDataInfo list(SysUserOnline userOnline) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline);
|
List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions(value = { "monitor:online:batchForceLogout", "monitor:online:forceLogout" }, logical = Logical.OR)
|
@RequiresPermissions(value = {"monitor:online:batchForceLogout", "monitor:online:forceLogout"}, logical = Logical.OR)
|
||||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||||
@PostMapping("/batchForceLogout")
|
@PostMapping("/batchForceLogout")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult batchForceLogout(String ids)
|
public AjaxResult batchForceLogout(String ids) {
|
||||||
{
|
for (String sessionId : Convert.toStrArray(ids)) {
|
||||||
for (String sessionId : Convert.toStrArray(ids))
|
|
||||||
{
|
|
||||||
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
|
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
|
||||||
if (online == null)
|
if (online == null) {
|
||||||
{
|
|
||||||
return error("用户已下线");
|
return error("用户已下线");
|
||||||
}
|
}
|
||||||
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
|
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
|
||||||
if (onlineSession == null)
|
if (onlineSession == null) {
|
||||||
{
|
|
||||||
return error("用户已下线");
|
return error("用户已下线");
|
||||||
}
|
}
|
||||||
if (sessionId.equals(ShiroUtils.getSessionId()))
|
if (sessionId.equals(ShiroUtils.getSessionId())) {
|
||||||
{
|
|
||||||
return error("当前登录用户无法强退");
|
return error("当前登录用户无法强退");
|
||||||
}
|
}
|
||||||
onlineSessionDAO.delete(onlineSession);
|
onlineSessionDAO.delete(onlineSession);
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,21 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import com.google.code.kaptcha.Constants;
|
||||||
import java.io.IOException;
|
import com.google.code.kaptcha.Producer;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import org.springframework.stereotype.Controller;
|
import java.awt.image.BufferedImage;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import java.io.IOException;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
import com.google.code.kaptcha.Constants;
|
|
||||||
import com.google.code.kaptcha.Producer;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图片验证码(支持算术形式)
|
* 图片验证码(支持算术形式)
|
||||||
|
|
@ -23,8 +24,8 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/captcha")
|
@RequestMapping("/captcha")
|
||||||
public class SysCaptchaController extends BaseController
|
public class SysCaptchaController extends BaseController {
|
||||||
{
|
|
||||||
@Resource(name = "captchaProducer")
|
@Resource(name = "captchaProducer")
|
||||||
private Producer captchaProducer;
|
private Producer captchaProducer;
|
||||||
|
|
||||||
|
|
@ -35,11 +36,9 @@ public class SysCaptchaController extends BaseController
|
||||||
* 验证码生成
|
* 验证码生成
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/captchaImage")
|
@GetMapping(value = "/captchaImage")
|
||||||
public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response)
|
public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response) {
|
||||||
{
|
|
||||||
ServletOutputStream out = null;
|
ServletOutputStream out = null;
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
response.setDateHeader("Expires", 0);
|
response.setDateHeader("Expires", 0);
|
||||||
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
|
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
|
||||||
|
|
@ -51,15 +50,13 @@ public class SysCaptchaController extends BaseController
|
||||||
String capStr = null;
|
String capStr = null;
|
||||||
String code = null;
|
String code = null;
|
||||||
BufferedImage bi = null;
|
BufferedImage bi = null;
|
||||||
if ("math".equals(type))
|
if ("math".equals(type)) {
|
||||||
{
|
|
||||||
String capText = captchaProducerMath.createText();
|
String capText = captchaProducerMath.createText();
|
||||||
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||||
code = capText.substring(capText.lastIndexOf("@") + 1);
|
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||||
bi = captchaProducerMath.createImage(capStr);
|
bi = captchaProducerMath.createImage(capStr);
|
||||||
}
|
}
|
||||||
else if ("char".equals(type))
|
else if ("char".equals(type)) {
|
||||||
{
|
|
||||||
capStr = code = captchaProducer.createText();
|
capStr = code = captchaProducer.createText();
|
||||||
bi = captchaProducer.createImage(capStr);
|
bi = captchaProducer.createImage(capStr);
|
||||||
}
|
}
|
||||||
|
|
@ -67,23 +64,17 @@ public class SysCaptchaController extends BaseController
|
||||||
out = response.getOutputStream();
|
out = response.getOutputStream();
|
||||||
ImageIO.write(bi, "jpg", out);
|
ImageIO.write(bi, "jpg", out);
|
||||||
out.flush();
|
out.flush();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
finally
|
finally {
|
||||||
{
|
try {
|
||||||
try
|
if (out != null) {
|
||||||
{
|
|
||||||
if (out != null)
|
|
||||||
{
|
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e) {
|
||||||
{
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,5 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
@ -21,6 +10,14 @@ import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.system.domain.SysConfig;
|
import com.ruoyi.system.domain.SysConfig;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数配置 信息操作处理
|
* 参数配置 信息操作处理
|
||||||
|
|
@ -29,8 +26,7 @@ import com.ruoyi.system.service.ISysConfigService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/config")
|
@RequestMapping("/system/config")
|
||||||
public class SysConfigController extends BaseController
|
public class SysConfigController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "system/config";
|
private String prefix = "system/config";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -38,8 +34,7 @@ public class SysConfigController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("system:config:view")
|
@RequiresPermissions("system:config:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String config()
|
public String config() {
|
||||||
{
|
|
||||||
return prefix + "/config";
|
return prefix + "/config";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -49,8 +44,7 @@ public class SysConfigController extends BaseController
|
||||||
@RequiresPermissions("system:config:list")
|
@RequiresPermissions("system:config:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysConfig config)
|
public TableDataInfo list(SysConfig config) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<SysConfig> list = configService.selectConfigList(config);
|
List<SysConfig> list = configService.selectConfigList(config);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -60,8 +54,7 @@ public class SysConfigController extends BaseController
|
||||||
@RequiresPermissions("system:config:export")
|
@RequiresPermissions("system:config:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysConfig config)
|
public AjaxResult export(SysConfig config) {
|
||||||
{
|
|
||||||
List<SysConfig> list = configService.selectConfigList(config);
|
List<SysConfig> list = configService.selectConfigList(config);
|
||||||
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
||||||
return util.exportExcel(list, "参数数据");
|
return util.exportExcel(list, "参数数据");
|
||||||
|
|
@ -71,8 +64,7 @@ public class SysConfigController extends BaseController
|
||||||
* 新增参数配置
|
* 新增参数配置
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add()
|
public String add() {
|
||||||
{
|
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -83,10 +75,8 @@ public class SysConfigController extends BaseController
|
||||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysConfig config)
|
public AjaxResult addSave(@Validated SysConfig config) {
|
||||||
{
|
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
|
||||||
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
|
||||||
{
|
|
||||||
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
}
|
}
|
||||||
config.setCreateBy(ShiroUtils.getLoginName());
|
config.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
|
@ -97,8 +87,7 @@ public class SysConfigController extends BaseController
|
||||||
* 修改参数配置
|
* 修改参数配置
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{configId}")
|
@GetMapping("/edit/{configId}")
|
||||||
public String edit(@PathVariable("configId") Long configId, ModelMap mmap)
|
public String edit(@PathVariable("configId") Long configId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("config", configService.selectConfigById(configId));
|
mmap.put("config", configService.selectConfigById(configId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
@ -110,10 +99,8 @@ public class SysConfigController extends BaseController
|
||||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysConfig config)
|
public AjaxResult editSave(@Validated SysConfig config) {
|
||||||
{
|
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
|
||||||
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
|
||||||
{
|
|
||||||
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
}
|
}
|
||||||
config.setUpdateBy(ShiroUtils.getLoginName());
|
config.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
|
@ -127,8 +114,7 @@ public class SysConfigController extends BaseController
|
||||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids) {
|
||||||
{
|
|
||||||
return toAjax(configService.deleteConfigByIds(ids));
|
return toAjax(configService.deleteConfigByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -139,8 +125,7 @@ public class SysConfigController extends BaseController
|
||||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||||
@GetMapping("/clearCache")
|
@GetMapping("/clearCache")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult clearCache()
|
public AjaxResult clearCache() {
|
||||||
{
|
|
||||||
configService.clearCache();
|
configService.clearCache();
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
@ -150,8 +135,7 @@ public class SysConfigController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkConfigKeyUnique")
|
@PostMapping("/checkConfigKeyUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkConfigKeyUnique(SysConfig config)
|
public String checkConfigKeyUnique(SysConfig config) {
|
||||||
{
|
|
||||||
return configService.checkConfigKeyUnique(config);
|
return configService.checkConfigKeyUnique(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,5 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
@ -22,6 +11,14 @@ import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.ShiroUtils;
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.system.service.ISysDeptService;
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门信息
|
* 部门信息
|
||||||
|
|
@ -30,8 +27,7 @@ import com.ruoyi.system.service.ISysDeptService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/dept")
|
@RequestMapping("/system/dept")
|
||||||
public class SysDeptController extends BaseController
|
public class SysDeptController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "system/dept";
|
private String prefix = "system/dept";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -39,16 +35,14 @@ public class SysDeptController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("system:dept:view")
|
@RequiresPermissions("system:dept:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String dept()
|
public String dept() {
|
||||||
{
|
|
||||||
return prefix + "/dept";
|
return prefix + "/dept";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:dept:list")
|
@RequiresPermissions("system:dept:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<SysDept> list(SysDept dept)
|
public List<SysDept> list(SysDept dept) {
|
||||||
{
|
|
||||||
List<SysDept> deptList = deptService.selectDeptList(dept);
|
List<SysDept> deptList = deptService.selectDeptList(dept);
|
||||||
return deptList;
|
return deptList;
|
||||||
}
|
}
|
||||||
|
|
@ -57,8 +51,7 @@ public class SysDeptController extends BaseController
|
||||||
* 新增部门
|
* 新增部门
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add/{parentId}")
|
@GetMapping("/add/{parentId}")
|
||||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("dept", deptService.selectDeptById(parentId));
|
mmap.put("dept", deptService.selectDeptById(parentId));
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
@ -70,10 +63,8 @@ public class SysDeptController extends BaseController
|
||||||
@RequiresPermissions("system:dept:add")
|
@RequiresPermissions("system:dept:add")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysDept dept)
|
public AjaxResult addSave(@Validated SysDept dept) {
|
||||||
{
|
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
|
||||||
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
|
||||||
{
|
|
||||||
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
}
|
}
|
||||||
dept.setCreateBy(ShiroUtils.getLoginName());
|
dept.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
|
@ -84,11 +75,9 @@ public class SysDeptController extends BaseController
|
||||||
* 修改
|
* 修改
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{deptId}")
|
@GetMapping("/edit/{deptId}")
|
||||||
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap) {
|
||||||
{
|
|
||||||
SysDept dept = deptService.selectDeptById(deptId);
|
SysDept dept = deptService.selectDeptById(deptId);
|
||||||
if (StringUtils.isNotNull(dept) && 100L == deptId)
|
if (StringUtils.isNotNull(dept) && 100L == deptId) {
|
||||||
{
|
|
||||||
dept.setParentName("无");
|
dept.setParentName("无");
|
||||||
}
|
}
|
||||||
mmap.put("dept", dept);
|
mmap.put("dept", dept);
|
||||||
|
|
@ -102,19 +91,15 @@ public class SysDeptController extends BaseController
|
||||||
@RequiresPermissions("system:dept:edit")
|
@RequiresPermissions("system:dept:edit")
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysDept dept)
|
public AjaxResult editSave(@Validated SysDept dept) {
|
||||||
{
|
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
|
||||||
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
|
||||||
{
|
|
||||||
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
}
|
}
|
||||||
else if (dept.getParentId().equals(dept.getDeptId()))
|
else if (dept.getParentId().equals(dept.getDeptId())) {
|
||||||
{
|
|
||||||
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||||
}
|
}
|
||||||
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
|
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
|
||||||
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
|
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0) {
|
||||||
{
|
|
||||||
return AjaxResult.error("该部门包含未停用的子部门!");
|
return AjaxResult.error("该部门包含未停用的子部门!");
|
||||||
}
|
}
|
||||||
dept.setUpdateBy(ShiroUtils.getLoginName());
|
dept.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
|
@ -128,14 +113,11 @@ public class SysDeptController extends BaseController
|
||||||
@RequiresPermissions("system:dept:remove")
|
@RequiresPermissions("system:dept:remove")
|
||||||
@GetMapping("/remove/{deptId}")
|
@GetMapping("/remove/{deptId}")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(@PathVariable("deptId") Long deptId)
|
public AjaxResult remove(@PathVariable("deptId") Long deptId) {
|
||||||
{
|
if (deptService.selectDeptCount(deptId) > 0) {
|
||||||
if (deptService.selectDeptCount(deptId) > 0)
|
|
||||||
{
|
|
||||||
return AjaxResult.warn("存在下级部门,不允许删除");
|
return AjaxResult.warn("存在下级部门,不允许删除");
|
||||||
}
|
}
|
||||||
if (deptService.checkDeptExistUser(deptId))
|
if (deptService.checkDeptExistUser(deptId)) {
|
||||||
{
|
|
||||||
return AjaxResult.warn("部门存在用户,不允许删除");
|
return AjaxResult.warn("部门存在用户,不允许删除");
|
||||||
}
|
}
|
||||||
return toAjax(deptService.deleteDeptById(deptId));
|
return toAjax(deptService.deleteDeptById(deptId));
|
||||||
|
|
@ -146,8 +128,7 @@ public class SysDeptController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkDeptNameUnique")
|
@PostMapping("/checkDeptNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkDeptNameUnique(SysDept dept)
|
public String checkDeptNameUnique(SysDept dept) {
|
||||||
{
|
|
||||||
return deptService.checkDeptNameUnique(dept);
|
return deptService.checkDeptNameUnique(dept);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -157,10 +138,9 @@ public class SysDeptController extends BaseController
|
||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @param excludeId 排除ID
|
* @param excludeId 排除ID
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = { "/selectDeptTree/{deptId}", "/selectDeptTree/{deptId}/{excludeId}" })
|
@GetMapping(value = {"/selectDeptTree/{deptId}", "/selectDeptTree/{deptId}/{excludeId}"})
|
||||||
public String selectDeptTree(@PathVariable("deptId") Long deptId,
|
public String selectDeptTree(@PathVariable("deptId") Long deptId,
|
||||||
@PathVariable(value = "excludeId", required = false) String excludeId, ModelMap mmap)
|
@PathVariable(value = "excludeId", required = false) String excludeId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("dept", deptService.selectDeptById(deptId));
|
mmap.put("dept", deptService.selectDeptById(deptId));
|
||||||
mmap.put("excludeId", excludeId);
|
mmap.put("excludeId", excludeId);
|
||||||
return prefix + "/tree";
|
return prefix + "/tree";
|
||||||
|
|
@ -171,8 +151,7 @@ public class SysDeptController extends BaseController
|
||||||
*/
|
*/
|
||||||
@GetMapping("/treeData")
|
@GetMapping("/treeData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Ztree> treeData()
|
public List<Ztree> treeData() {
|
||||||
{
|
|
||||||
List<Ztree> ztrees = deptService.selectDeptTree(new SysDept());
|
List<Ztree> ztrees = deptService.selectDeptTree(new SysDept());
|
||||||
return ztrees;
|
return ztrees;
|
||||||
}
|
}
|
||||||
|
|
@ -182,8 +161,7 @@ public class SysDeptController extends BaseController
|
||||||
*/
|
*/
|
||||||
@GetMapping("/treeData/{excludeId}")
|
@GetMapping("/treeData/{excludeId}")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Ztree> treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId)
|
public List<Ztree> treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId) {
|
||||||
{
|
|
||||||
SysDept dept = new SysDept();
|
SysDept dept = new SysDept();
|
||||||
dept.setDeptId(excludeId);
|
dept.setDeptId(excludeId);
|
||||||
List<Ztree> ztrees = deptService.selectDeptTreeExcludeChild(dept);
|
List<Ztree> ztrees = deptService.selectDeptTreeExcludeChild(dept);
|
||||||
|
|
@ -195,8 +173,7 @@ public class SysDeptController extends BaseController
|
||||||
*/
|
*/
|
||||||
@GetMapping("/roleDeptTreeData")
|
@GetMapping("/roleDeptTreeData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Ztree> deptTreeData(SysRole role)
|
public List<Ztree> deptTreeData(SysRole role) {
|
||||||
{
|
|
||||||
List<Ztree> ztrees = deptService.roleDeptTreeData(role);
|
List<Ztree> ztrees = deptService.roleDeptTreeData(role);
|
||||||
return ztrees;
|
return ztrees;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,5 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
|
@ -20,6 +9,14 @@ import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.ShiroUtils;
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.system.service.ISysDictDataService;
|
import com.ruoyi.system.service.ISysDictDataService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据字典信息
|
* 数据字典信息
|
||||||
|
|
@ -28,8 +25,7 @@ import com.ruoyi.system.service.ISysDictDataService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/dict/data")
|
@RequestMapping("/system/dict/data")
|
||||||
public class SysDictDataController extends BaseController
|
public class SysDictDataController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "system/dict/data";
|
private String prefix = "system/dict/data";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -37,16 +33,14 @@ public class SysDictDataController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("system:dict:view")
|
@RequiresPermissions("system:dict:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String dictData()
|
public String dictData() {
|
||||||
{
|
|
||||||
return prefix + "/data";
|
return prefix + "/data";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@RequiresPermissions("system:dict:list")
|
@RequiresPermissions("system:dict:list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysDictData dictData)
|
public TableDataInfo list(SysDictData dictData) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -56,8 +50,7 @@ public class SysDictDataController extends BaseController
|
||||||
@RequiresPermissions("system:dict:export")
|
@RequiresPermissions("system:dict:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysDictData dictData)
|
public AjaxResult export(SysDictData dictData) {
|
||||||
{
|
|
||||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||||
return util.exportExcel(list, "字典数据");
|
return util.exportExcel(list, "字典数据");
|
||||||
|
|
@ -67,8 +60,7 @@ public class SysDictDataController extends BaseController
|
||||||
* 新增字典类型
|
* 新增字典类型
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add/{dictType}")
|
@GetMapping("/add/{dictType}")
|
||||||
public String add(@PathVariable("dictType") String dictType, ModelMap mmap)
|
public String add(@PathVariable("dictType") String dictType, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("dictType", dictType);
|
mmap.put("dictType", dictType);
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
@ -80,8 +72,7 @@ public class SysDictDataController extends BaseController
|
||||||
@RequiresPermissions("system:dict:add")
|
@RequiresPermissions("system:dict:add")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysDictData dict)
|
public AjaxResult addSave(@Validated SysDictData dict) {
|
||||||
{
|
|
||||||
dict.setCreateBy(ShiroUtils.getLoginName());
|
dict.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(dictDataService.insertDictData(dict));
|
return toAjax(dictDataService.insertDictData(dict));
|
||||||
}
|
}
|
||||||
|
|
@ -90,8 +81,7 @@ public class SysDictDataController extends BaseController
|
||||||
* 修改字典类型
|
* 修改字典类型
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{dictCode}")
|
@GetMapping("/edit/{dictCode}")
|
||||||
public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap)
|
public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("dict", dictDataService.selectDictDataById(dictCode));
|
mmap.put("dict", dictDataService.selectDictDataById(dictCode));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
@ -103,8 +93,7 @@ public class SysDictDataController extends BaseController
|
||||||
@RequiresPermissions("system:dict:edit")
|
@RequiresPermissions("system:dict:edit")
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysDictData dict)
|
public AjaxResult editSave(@Validated SysDictData dict) {
|
||||||
{
|
|
||||||
dict.setUpdateBy(ShiroUtils.getLoginName());
|
dict.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(dictDataService.updateDictData(dict));
|
return toAjax(dictDataService.updateDictData(dict));
|
||||||
}
|
}
|
||||||
|
|
@ -113,8 +102,7 @@ public class SysDictDataController extends BaseController
|
||||||
@RequiresPermissions("system:dict:remove")
|
@RequiresPermissions("system:dict:remove")
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids) {
|
||||||
{
|
|
||||||
return toAjax(dictDataService.deleteDictDataByIds(ids));
|
return toAjax(dictDataService.deleteDictDataByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,5 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
@ -22,6 +11,14 @@ import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.ShiroUtils;
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.system.service.ISysDictTypeService;
|
import com.ruoyi.system.service.ISysDictTypeService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据字典信息
|
* 数据字典信息
|
||||||
|
|
@ -30,8 +27,7 @@ import com.ruoyi.system.service.ISysDictTypeService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/dict")
|
@RequestMapping("/system/dict")
|
||||||
public class SysDictTypeController extends BaseController
|
public class SysDictTypeController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "system/dict/type";
|
private String prefix = "system/dict/type";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -39,16 +35,14 @@ public class SysDictTypeController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("system:dict:view")
|
@RequiresPermissions("system:dict:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String dictType()
|
public String dictType() {
|
||||||
{
|
|
||||||
return prefix + "/type";
|
return prefix + "/type";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@RequiresPermissions("system:dict:list")
|
@RequiresPermissions("system:dict:list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysDictType dictType)
|
public TableDataInfo list(SysDictType dictType) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -58,8 +52,7 @@ public class SysDictTypeController extends BaseController
|
||||||
@RequiresPermissions("system:dict:export")
|
@RequiresPermissions("system:dict:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysDictType dictType)
|
public AjaxResult export(SysDictType dictType) {
|
||||||
{
|
|
||||||
|
|
||||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||||
|
|
@ -70,8 +63,7 @@ public class SysDictTypeController extends BaseController
|
||||||
* 新增字典类型
|
* 新增字典类型
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add()
|
public String add() {
|
||||||
{
|
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,10 +74,8 @@ public class SysDictTypeController extends BaseController
|
||||||
@RequiresPermissions("system:dict:add")
|
@RequiresPermissions("system:dict:add")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysDictType dict)
|
public AjaxResult addSave(@Validated SysDictType dict) {
|
||||||
{
|
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) {
|
||||||
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
|
||||||
{
|
|
||||||
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
}
|
}
|
||||||
dict.setCreateBy(ShiroUtils.getLoginName());
|
dict.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
|
@ -96,8 +86,7 @@ public class SysDictTypeController extends BaseController
|
||||||
* 修改字典类型
|
* 修改字典类型
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{dictId}")
|
@GetMapping("/edit/{dictId}")
|
||||||
public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap)
|
public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
@ -109,10 +98,8 @@ public class SysDictTypeController extends BaseController
|
||||||
@RequiresPermissions("system:dict:edit")
|
@RequiresPermissions("system:dict:edit")
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysDictType dict)
|
public AjaxResult editSave(@Validated SysDictType dict) {
|
||||||
{
|
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) {
|
||||||
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
|
||||||
{
|
|
||||||
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
}
|
}
|
||||||
dict.setUpdateBy(ShiroUtils.getLoginName());
|
dict.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
|
@ -123,8 +110,7 @@ public class SysDictTypeController extends BaseController
|
||||||
@RequiresPermissions("system:dict:remove")
|
@RequiresPermissions("system:dict:remove")
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids) {
|
||||||
{
|
|
||||||
return toAjax(dictTypeService.deleteDictTypeByIds(ids));
|
return toAjax(dictTypeService.deleteDictTypeByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -135,8 +121,7 @@ public class SysDictTypeController extends BaseController
|
||||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||||
@GetMapping("/clearCache")
|
@GetMapping("/clearCache")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult clearCache()
|
public AjaxResult clearCache() {
|
||||||
{
|
|
||||||
dictTypeService.clearCache();
|
dictTypeService.clearCache();
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
@ -146,8 +131,7 @@ public class SysDictTypeController extends BaseController
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:dict:list")
|
@RequiresPermissions("system:dict:list")
|
||||||
@GetMapping("/detail/{dictId}")
|
@GetMapping("/detail/{dictId}")
|
||||||
public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap)
|
public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
||||||
mmap.put("dictList", dictTypeService.selectDictTypeAll());
|
mmap.put("dictList", dictTypeService.selectDictTypeAll());
|
||||||
return "system/dict/data/data";
|
return "system/dict/data/data";
|
||||||
|
|
@ -158,8 +142,7 @@ public class SysDictTypeController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkDictTypeUnique")
|
@PostMapping("/checkDictTypeUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkDictTypeUnique(SysDictType dictType)
|
public String checkDictTypeUnique(SysDictType dictType) {
|
||||||
{
|
|
||||||
return dictTypeService.checkDictTypeUnique(dictType);
|
return dictTypeService.checkDictTypeUnique(dictType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -168,8 +151,7 @@ public class SysDictTypeController extends BaseController
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectDictTree/{columnId}/{dictType}")
|
@GetMapping("/selectDictTree/{columnId}/{dictType}")
|
||||||
public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType,
|
public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType,
|
||||||
ModelMap mmap)
|
ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("columnId", columnId);
|
mmap.put("columnId", columnId);
|
||||||
mmap.put("dict", dictTypeService.selectDictTypeByType(dictType));
|
mmap.put("dict", dictTypeService.selectDictTypeByType(dictType));
|
||||||
return prefix + "/tree";
|
return prefix + "/tree";
|
||||||
|
|
@ -180,8 +162,7 @@ public class SysDictTypeController extends BaseController
|
||||||
*/
|
*/
|
||||||
@GetMapping("/treeData")
|
@GetMapping("/treeData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Ztree> treeData()
|
public List<Ztree> treeData() {
|
||||||
{
|
|
||||||
List<Ztree> ztrees = dictTypeService.selectDictTree(new SysDictType());
|
List<Ztree> ztrees = dictTypeService.selectDictTree(new SysDictType());
|
||||||
return ztrees;
|
return ztrees;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,5 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.servlet.http.Cookie;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.ruoyi.common.config.RuoYiConfig;
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
import com.ruoyi.common.constant.ShiroConstants;
|
import com.ruoyi.common.constant.ShiroConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
@ -18,14 +7,22 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.entity.SysMenu;
|
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.text.Convert;
|
import com.ruoyi.common.core.text.Convert;
|
||||||
import com.ruoyi.common.utils.CookieUtils;
|
import com.ruoyi.common.utils.*;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
|
||||||
import com.ruoyi.common.utils.ServletUtils;
|
|
||||||
import com.ruoyi.common.utils.ShiroUtils;
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
|
||||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import com.ruoyi.system.service.ISysMenuService;
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import javax.servlet.http.Cookie;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页 业务处理
|
* 首页 业务处理
|
||||||
|
|
@ -33,8 +30,8 @@ import com.ruoyi.system.service.ISysMenuService;
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class SysIndexController extends BaseController
|
public class SysIndexController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysMenuService menuService;
|
private ISysMenuService menuService;
|
||||||
|
|
||||||
|
|
@ -46,8 +43,7 @@ public class SysIndexController extends BaseController
|
||||||
|
|
||||||
// 系统首页
|
// 系统首页
|
||||||
@GetMapping("/index")
|
@GetMapping("/index")
|
||||||
public String index(ModelMap mmap)
|
public String index(ModelMap mmap) {
|
||||||
{
|
|
||||||
// 取身份信息
|
// 取身份信息
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
// 根据用户id取出菜单
|
// 根据用户id取出菜单
|
||||||
|
|
@ -69,10 +65,8 @@ public class SysIndexController extends BaseController
|
||||||
|
|
||||||
// 优先Cookie配置导航菜单
|
// 优先Cookie配置导航菜单
|
||||||
Cookie[] cookies = ServletUtils.getRequest().getCookies();
|
Cookie[] cookies = ServletUtils.getRequest().getCookies();
|
||||||
for (Cookie cookie : cookies)
|
for (Cookie cookie : cookies) {
|
||||||
{
|
if (StringUtils.isNotEmpty(cookie.getName()) && "nav-style".equalsIgnoreCase(cookie.getName())) {
|
||||||
if (StringUtils.isNotEmpty(cookie.getName()) && "nav-style".equalsIgnoreCase(cookie.getName()))
|
|
||||||
{
|
|
||||||
indexStyle = cookie.getValue();
|
indexStyle = cookie.getValue();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -83,8 +77,7 @@ public class SysIndexController extends BaseController
|
||||||
|
|
||||||
// 锁定屏幕
|
// 锁定屏幕
|
||||||
@GetMapping("/lockscreen")
|
@GetMapping("/lockscreen")
|
||||||
public String lockscreen(ModelMap mmap)
|
public String lockscreen(ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("user", ShiroUtils.getSysUser());
|
mmap.put("user", ShiroUtils.getSysUser());
|
||||||
ServletUtils.getSession().setAttribute(ShiroConstants.LOCK_SCREEN, true);
|
ServletUtils.getSession().setAttribute(ShiroConstants.LOCK_SCREEN, true);
|
||||||
return "lock";
|
return "lock";
|
||||||
|
|
@ -93,15 +86,12 @@ public class SysIndexController extends BaseController
|
||||||
// 解锁屏幕
|
// 解锁屏幕
|
||||||
@PostMapping("/unlockscreen")
|
@PostMapping("/unlockscreen")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult unlockscreen(String password)
|
public AjaxResult unlockscreen(String password) {
|
||||||
{
|
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
if (StringUtils.isNull(user))
|
if (StringUtils.isNull(user)) {
|
||||||
{
|
|
||||||
return AjaxResult.error("服务器超时,请重新登陆");
|
return AjaxResult.error("服务器超时,请重新登陆");
|
||||||
}
|
}
|
||||||
if (passwordService.matches(user, password))
|
if (passwordService.matches(user, password)) {
|
||||||
{
|
|
||||||
ServletUtils.getSession().removeAttribute(ShiroConstants.LOCK_SCREEN);
|
ServletUtils.getSession().removeAttribute(ShiroConstants.LOCK_SCREEN);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
@ -110,41 +100,35 @@ public class SysIndexController extends BaseController
|
||||||
|
|
||||||
// 切换主题
|
// 切换主题
|
||||||
@GetMapping("/system/switchSkin")
|
@GetMapping("/system/switchSkin")
|
||||||
public String switchSkin()
|
public String switchSkin() {
|
||||||
{
|
|
||||||
return "skin";
|
return "skin";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 切换菜单
|
// 切换菜单
|
||||||
@GetMapping("/system/menuStyle/{style}")
|
@GetMapping("/system/menuStyle/{style}")
|
||||||
public void menuStyle(@PathVariable String style, HttpServletResponse response)
|
public void menuStyle(@PathVariable String style) {
|
||||||
{
|
HttpServletResponse response = ServletUtils.getResponse();
|
||||||
CookieUtils.setCookie(response, "nav-style", style);
|
CookieUtils.setCookie(response, "nav-style", style);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 系统介绍
|
// 系统介绍
|
||||||
@GetMapping("/system/main")
|
@GetMapping("/system/main")
|
||||||
public String main(ModelMap mmap)
|
public String main(ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("version", RuoYiConfig.getVersion());
|
mmap.put("version", RuoYiConfig.getVersion());
|
||||||
return "main";
|
return "main";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查初始密码是否提醒修改
|
// 检查初始密码是否提醒修改
|
||||||
public boolean initPasswordIsModify(Date pwdUpdateDate)
|
public boolean initPasswordIsModify(Date pwdUpdateDate) {
|
||||||
{
|
|
||||||
Integer initPasswordModify = Convert.toInt(configService.selectConfigByKey("sys.account.initPasswordModify"));
|
Integer initPasswordModify = Convert.toInt(configService.selectConfigByKey("sys.account.initPasswordModify"));
|
||||||
return initPasswordModify != null && initPasswordModify == 1 && pwdUpdateDate == null;
|
return initPasswordModify != null && initPasswordModify == 1 && pwdUpdateDate == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查密码是否过期
|
// 检查密码是否过期
|
||||||
public boolean passwordIsExpiration(Date pwdUpdateDate)
|
public boolean passwordIsExpiration(Date pwdUpdateDate) {
|
||||||
{
|
|
||||||
Integer passwordValidateDays = Convert.toInt(configService.selectConfigByKey("sys.account.passwordValidateDays"));
|
Integer passwordValidateDays = Convert.toInt(configService.selectConfigByKey("sys.account.passwordValidateDays"));
|
||||||
if (passwordValidateDays != null && passwordValidateDays > 0)
|
if (passwordValidateDays != null && passwordValidateDays > 0) {
|
||||||
{
|
if (StringUtils.isNull(pwdUpdateDate)) {
|
||||||
if (StringUtils.isNull(pwdUpdateDate))
|
|
||||||
{
|
|
||||||
// 如果从未修改过初始密码,直接提醒过期
|
// 如果从未修改过初始密码,直接提醒过期
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.apache.shiro.authc.AuthenticationException;
|
import org.apache.shiro.authc.AuthenticationException;
|
||||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||||
|
|
@ -10,10 +12,9 @@ import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import com.ruoyi.common.utils.ServletUtils;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录验证
|
* 登录验证
|
||||||
|
|
@ -21,14 +22,13 @@ import com.ruoyi.common.utils.StringUtils;
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class SysLoginController extends BaseController
|
public class SysLoginController extends BaseController {
|
||||||
{
|
|
||||||
@GetMapping("/login")
|
@GetMapping("/login")
|
||||||
public String login(HttpServletRequest request, HttpServletResponse response)
|
public String login(HttpServletRequest request, HttpServletResponse response) {
|
||||||
{
|
|
||||||
// 如果是Ajax请求,返回Json字符串。
|
// 如果是Ajax请求,返回Json字符串。
|
||||||
if (ServletUtils.isAjaxRequest(request))
|
if (ServletUtils.isAjaxRequest(request)) {
|
||||||
{
|
|
||||||
return ServletUtils.renderString(response, "{\"code\":\"1\",\"msg\":\"未登录或登录超时。请重新登录\"}");
|
return ServletUtils.renderString(response, "{\"code\":\"1\",\"msg\":\"未登录或登录超时。请重新登录\"}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,20 +37,19 @@ public class SysLoginController extends BaseController
|
||||||
|
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult ajaxLogin(String username, String password, Boolean rememberMe)
|
public AjaxResult ajaxLogin(String username,
|
||||||
{
|
String password,
|
||||||
|
Boolean rememberMe) {
|
||||||
|
|
||||||
UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe);
|
UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe);
|
||||||
Subject subject = SecurityUtils.getSubject();
|
Subject subject = SecurityUtils.getSubject();
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
subject.login(token);
|
subject.login(token);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
catch (AuthenticationException e)
|
catch (AuthenticationException e) {
|
||||||
{
|
|
||||||
String msg = "用户或密码错误";
|
String msg = "用户或密码错误";
|
||||||
if (StringUtils.isNotEmpty(e.getMessage()))
|
if (StringUtils.isNotEmpty(e.getMessage())) {
|
||||||
{
|
|
||||||
msg = e.getMessage();
|
msg = e.getMessage();
|
||||||
}
|
}
|
||||||
return error(msg);
|
return error(msg);
|
||||||
|
|
@ -58,8 +57,7 @@ public class SysLoginController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/unauth")
|
@GetMapping("/unauth")
|
||||||
public String unauth()
|
public String unauth() {
|
||||||
{
|
|
||||||
return "error/unauth";
|
return "error/unauth";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,5 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
@ -22,6 +11,14 @@ import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.ShiroUtils;
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import com.ruoyi.framework.shiro.util.AuthorizationUtils;
|
import com.ruoyi.framework.shiro.util.AuthorizationUtils;
|
||||||
import com.ruoyi.system.service.ISysMenuService;
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单信息
|
* 菜单信息
|
||||||
|
|
@ -30,8 +27,7 @@ import com.ruoyi.system.service.ISysMenuService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/menu")
|
@RequestMapping("/system/menu")
|
||||||
public class SysMenuController extends BaseController
|
public class SysMenuController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "system/menu";
|
private String prefix = "system/menu";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -39,16 +35,14 @@ public class SysMenuController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("system:menu:view")
|
@RequiresPermissions("system:menu:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String menu()
|
public String menu() {
|
||||||
{
|
|
||||||
return prefix + "/menu";
|
return prefix + "/menu";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:menu:list")
|
@RequiresPermissions("system:menu:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<SysMenu> list(SysMenu menu)
|
public List<SysMenu> list(SysMenu menu) {
|
||||||
{
|
|
||||||
Long userId = ShiroUtils.getUserId();
|
Long userId = ShiroUtils.getUserId();
|
||||||
List<SysMenu> menuList = menuService.selectMenuList(menu, userId);
|
List<SysMenu> menuList = menuService.selectMenuList(menu, userId);
|
||||||
return menuList;
|
return menuList;
|
||||||
|
|
@ -61,14 +55,11 @@ public class SysMenuController extends BaseController
|
||||||
@RequiresPermissions("system:menu:remove")
|
@RequiresPermissions("system:menu:remove")
|
||||||
@GetMapping("/remove/{menuId}")
|
@GetMapping("/remove/{menuId}")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
public AjaxResult remove(@PathVariable("menuId") Long menuId) {
|
||||||
{
|
if (menuService.selectCountMenuByParentId(menuId) > 0) {
|
||||||
if (menuService.selectCountMenuByParentId(menuId) > 0)
|
|
||||||
{
|
|
||||||
return AjaxResult.warn("存在子菜单,不允许删除");
|
return AjaxResult.warn("存在子菜单,不允许删除");
|
||||||
}
|
}
|
||||||
if (menuService.selectCountRoleMenuByMenuId(menuId) > 0)
|
if (menuService.selectCountRoleMenuByMenuId(menuId) > 0) {
|
||||||
{
|
|
||||||
return AjaxResult.warn("菜单已分配,不允许删除");
|
return AjaxResult.warn("菜单已分配,不允许删除");
|
||||||
}
|
}
|
||||||
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||||
|
|
@ -79,15 +70,12 @@ public class SysMenuController extends BaseController
|
||||||
* 新增
|
* 新增
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add/{parentId}")
|
@GetMapping("/add/{parentId}")
|
||||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) {
|
||||||
{
|
|
||||||
SysMenu menu = null;
|
SysMenu menu = null;
|
||||||
if (0L != parentId)
|
if (0L != parentId) {
|
||||||
{
|
|
||||||
menu = menuService.selectMenuById(parentId);
|
menu = menuService.selectMenuById(parentId);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
menu = new SysMenu();
|
menu = new SysMenu();
|
||||||
menu.setMenuId(0L);
|
menu.setMenuId(0L);
|
||||||
menu.setMenuName("主目录");
|
menu.setMenuName("主目录");
|
||||||
|
|
@ -103,10 +91,8 @@ public class SysMenuController extends BaseController
|
||||||
@RequiresPermissions("system:menu:add")
|
@RequiresPermissions("system:menu:add")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysMenu menu)
|
public AjaxResult addSave(@Validated SysMenu menu) {
|
||||||
{
|
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) {
|
||||||
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
|
||||||
{
|
|
||||||
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
}
|
}
|
||||||
menu.setCreateBy(ShiroUtils.getLoginName());
|
menu.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
|
@ -118,8 +104,7 @@ public class SysMenuController extends BaseController
|
||||||
* 修改菜单
|
* 修改菜单
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{menuId}")
|
@GetMapping("/edit/{menuId}")
|
||||||
public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("menu", menuService.selectMenuById(menuId));
|
mmap.put("menu", menuService.selectMenuById(menuId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
@ -131,10 +116,8 @@ public class SysMenuController extends BaseController
|
||||||
@RequiresPermissions("system:menu:edit")
|
@RequiresPermissions("system:menu:edit")
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysMenu menu)
|
public AjaxResult editSave(@Validated SysMenu menu) {
|
||||||
{
|
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) {
|
||||||
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
|
||||||
{
|
|
||||||
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
}
|
}
|
||||||
menu.setUpdateBy(ShiroUtils.getLoginName());
|
menu.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
|
@ -146,8 +129,7 @@ public class SysMenuController extends BaseController
|
||||||
* 选择菜单图标
|
* 选择菜单图标
|
||||||
*/
|
*/
|
||||||
@GetMapping("/icon")
|
@GetMapping("/icon")
|
||||||
public String icon()
|
public String icon() {
|
||||||
{
|
|
||||||
return prefix + "/icon";
|
return prefix + "/icon";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,8 +138,7 @@ public class SysMenuController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkMenuNameUnique")
|
@PostMapping("/checkMenuNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkMenuNameUnique(SysMenu menu)
|
public String checkMenuNameUnique(SysMenu menu) {
|
||||||
{
|
|
||||||
return menuService.checkMenuNameUnique(menu);
|
return menuService.checkMenuNameUnique(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,8 +147,7 @@ public class SysMenuController extends BaseController
|
||||||
*/
|
*/
|
||||||
@GetMapping("/roleMenuTreeData")
|
@GetMapping("/roleMenuTreeData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Ztree> roleMenuTreeData(SysRole role)
|
public List<Ztree> roleMenuTreeData(SysRole role) {
|
||||||
{
|
|
||||||
Long userId = ShiroUtils.getUserId();
|
Long userId = ShiroUtils.getUserId();
|
||||||
List<Ztree> ztrees = menuService.roleMenuTreeData(role, userId);
|
List<Ztree> ztrees = menuService.roleMenuTreeData(role, userId);
|
||||||
return ztrees;
|
return ztrees;
|
||||||
|
|
@ -178,8 +158,7 @@ public class SysMenuController extends BaseController
|
||||||
*/
|
*/
|
||||||
@GetMapping("/menuTreeData")
|
@GetMapping("/menuTreeData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Ztree> menuTreeData()
|
public List<Ztree> menuTreeData() {
|
||||||
{
|
|
||||||
Long userId = ShiroUtils.getUserId();
|
Long userId = ShiroUtils.getUserId();
|
||||||
List<Ztree> ztrees = menuService.menuTreeData(userId);
|
List<Ztree> ztrees = menuService.menuTreeData(userId);
|
||||||
return ztrees;
|
return ztrees;
|
||||||
|
|
@ -189,8 +168,7 @@ public class SysMenuController extends BaseController
|
||||||
* 选择菜单树
|
* 选择菜单树
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectMenuTree/{menuId}")
|
@GetMapping("/selectMenuTree/{menuId}")
|
||||||
public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("menu", menuService.selectMenuById(menuId));
|
mmap.put("menu", menuService.selectMenuById(menuId));
|
||||||
return prefix + "/tree";
|
return prefix + "/tree";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,5 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
|
@ -18,6 +8,13 @@ import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.ShiroUtils;
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import com.ruoyi.system.domain.SysNotice;
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
import com.ruoyi.system.service.ISysNoticeService;
|
import com.ruoyi.system.service.ISysNoticeService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告 信息操作处理
|
* 公告 信息操作处理
|
||||||
|
|
@ -26,8 +23,7 @@ import com.ruoyi.system.service.ISysNoticeService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/notice")
|
@RequestMapping("/system/notice")
|
||||||
public class SysNoticeController extends BaseController
|
public class SysNoticeController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "system/notice";
|
private String prefix = "system/notice";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -35,8 +31,7 @@ public class SysNoticeController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("system:notice:view")
|
@RequiresPermissions("system:notice:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String notice()
|
public String notice() {
|
||||||
{
|
|
||||||
return prefix + "/notice";
|
return prefix + "/notice";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,8 +41,7 @@ public class SysNoticeController extends BaseController
|
||||||
@RequiresPermissions("system:notice:list")
|
@RequiresPermissions("system:notice:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysNotice notice)
|
public TableDataInfo list(SysNotice notice) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -57,8 +51,7 @@ public class SysNoticeController extends BaseController
|
||||||
* 新增公告
|
* 新增公告
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add()
|
public String add() {
|
||||||
{
|
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,8 +62,7 @@ public class SysNoticeController extends BaseController
|
||||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(SysNotice notice)
|
public AjaxResult addSave(SysNotice notice) {
|
||||||
{
|
|
||||||
notice.setCreateBy(ShiroUtils.getLoginName());
|
notice.setCreateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(noticeService.insertNotice(notice));
|
return toAjax(noticeService.insertNotice(notice));
|
||||||
}
|
}
|
||||||
|
|
@ -79,8 +71,7 @@ public class SysNoticeController extends BaseController
|
||||||
* 修改公告
|
* 修改公告
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{noticeId}")
|
@GetMapping("/edit/{noticeId}")
|
||||||
public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap)
|
public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("notice", noticeService.selectNoticeById(noticeId));
|
mmap.put("notice", noticeService.selectNoticeById(noticeId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
@ -92,8 +83,7 @@ public class SysNoticeController extends BaseController
|
||||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(SysNotice notice)
|
public AjaxResult editSave(SysNotice notice) {
|
||||||
{
|
|
||||||
notice.setUpdateBy(ShiroUtils.getLoginName());
|
notice.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
return toAjax(noticeService.updateNotice(notice));
|
return toAjax(noticeService.updateNotice(notice));
|
||||||
}
|
}
|
||||||
|
|
@ -105,8 +95,7 @@ public class SysNoticeController extends BaseController
|
||||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids) {
|
||||||
{
|
|
||||||
return toAjax(noticeService.deleteNoticeByIds(ids));
|
return toAjax(noticeService.deleteNoticeByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,5 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
@ -21,6 +10,14 @@ import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
import com.ruoyi.system.service.ISysPostService;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位信息操作处理
|
* 岗位信息操作处理
|
||||||
|
|
@ -29,8 +26,7 @@ import com.ruoyi.system.service.ISysPostService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/post")
|
@RequestMapping("/system/post")
|
||||||
public class SysPostController extends BaseController
|
public class SysPostController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "system/post";
|
private String prefix = "system/post";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -38,16 +34,14 @@ public class SysPostController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("system:post:view")
|
@RequiresPermissions("system:post:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String operlog()
|
public String operlog() {
|
||||||
{
|
|
||||||
return prefix + "/post";
|
return prefix + "/post";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:post:list")
|
@RequiresPermissions("system:post:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysPost post)
|
public TableDataInfo list(SysPost post) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<SysPost> list = postService.selectPostList(post);
|
List<SysPost> list = postService.selectPostList(post);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -57,8 +51,7 @@ public class SysPostController extends BaseController
|
||||||
@RequiresPermissions("system:post:export")
|
@RequiresPermissions("system:post:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysPost post)
|
public AjaxResult export(SysPost post) {
|
||||||
{
|
|
||||||
List<SysPost> list = postService.selectPostList(post);
|
List<SysPost> list = postService.selectPostList(post);
|
||||||
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
||||||
return util.exportExcel(list, "岗位数据");
|
return util.exportExcel(list, "岗位数据");
|
||||||
|
|
@ -68,14 +61,11 @@ public class SysPostController extends BaseController
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return toAjax(postService.deletePostByIds(ids));
|
return toAjax(postService.deletePostByIds(ids));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
return error(e.getMessage());
|
return error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -84,8 +74,7 @@ public class SysPostController extends BaseController
|
||||||
* 新增岗位
|
* 新增岗位
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add()
|
public String add() {
|
||||||
{
|
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,14 +85,11 @@ public class SysPostController extends BaseController
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysPost post)
|
public AjaxResult addSave(@Validated SysPost post) {
|
||||||
{
|
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
|
||||||
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
|
||||||
{
|
|
||||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
|
||||||
{
|
|
||||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
}
|
}
|
||||||
post.setCreateBy(ShiroUtils.getLoginName());
|
post.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
|
@ -114,8 +100,7 @@ public class SysPostController extends BaseController
|
||||||
* 修改岗位
|
* 修改岗位
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{postId}")
|
@GetMapping("/edit/{postId}")
|
||||||
public String edit(@PathVariable("postId") Long postId, ModelMap mmap)
|
public String edit(@PathVariable("postId") Long postId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("post", postService.selectPostById(postId));
|
mmap.put("post", postService.selectPostById(postId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
@ -127,14 +112,11 @@ public class SysPostController extends BaseController
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysPost post)
|
public AjaxResult editSave(@Validated SysPost post) {
|
||||||
{
|
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
|
||||||
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
|
||||||
{
|
|
||||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
|
||||||
{
|
|
||||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
}
|
}
|
||||||
post.setUpdateBy(ShiroUtils.getLoginName());
|
post.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
|
@ -146,8 +128,7 @@ public class SysPostController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkPostNameUnique")
|
@PostMapping("/checkPostNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkPostNameUnique(SysPost post)
|
public String checkPostNameUnique(SysPost post) {
|
||||||
{
|
|
||||||
return postService.checkPostNameUnique(post);
|
return postService.checkPostNameUnique(post);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,8 +137,7 @@ public class SysPostController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkPostCodeUnique")
|
@PostMapping("/checkPostCodeUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkPostCodeUnique(SysPost post)
|
public String checkPostCodeUnique(SysPost post) {
|
||||||
{
|
|
||||||
return postService.checkPostCodeUnique(post);
|
return postService.checkPostCodeUnique(post);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,5 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.config.RuoYiConfig;
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
@ -22,6 +11,13 @@ import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 个人信息 业务处理
|
* 个人信息 业务处理
|
||||||
|
|
@ -30,8 +26,7 @@ import com.ruoyi.system.service.ISysUserService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/user/profile")
|
@RequestMapping("/system/user/profile")
|
||||||
public class SysProfileController extends BaseController
|
public class SysProfileController extends BaseController {
|
||||||
{
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(SysProfileController.class);
|
private static final Logger log = LoggerFactory.getLogger(SysProfileController.class);
|
||||||
|
|
||||||
private String prefix = "system/user/profile";
|
private String prefix = "system/user/profile";
|
||||||
|
|
@ -46,8 +41,7 @@ public class SysProfileController extends BaseController
|
||||||
* 个人信息
|
* 个人信息
|
||||||
*/
|
*/
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String profile(ModelMap mmap)
|
public String profile(ModelMap mmap) {
|
||||||
{
|
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
mmap.put("user", user);
|
mmap.put("user", user);
|
||||||
mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
|
mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
|
||||||
|
|
@ -57,19 +51,16 @@ public class SysProfileController extends BaseController
|
||||||
|
|
||||||
@GetMapping("/checkPassword")
|
@GetMapping("/checkPassword")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public boolean checkPassword(String password)
|
public boolean checkPassword(String password) {
|
||||||
{
|
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
if (passwordService.matches(user, password))
|
if (passwordService.matches(user, password)) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/resetPwd")
|
@GetMapping("/resetPwd")
|
||||||
public String resetPwd(ModelMap mmap)
|
public String resetPwd(ModelMap mmap) {
|
||||||
{
|
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
mmap.put("user", userService.selectUserById(user.getUserId()));
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
return prefix + "/resetPwd";
|
return prefix + "/resetPwd";
|
||||||
|
|
@ -78,22 +69,18 @@ public class SysProfileController extends BaseController
|
||||||
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/resetPwd")
|
@PostMapping("/resetPwd")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult resetPwd(String oldPassword, String newPassword)
|
public AjaxResult resetPwd(String oldPassword, String newPassword) {
|
||||||
{
|
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
if (!passwordService.matches(user, oldPassword))
|
if (!passwordService.matches(user, oldPassword)) {
|
||||||
{
|
|
||||||
return error("修改密码失败,旧密码错误");
|
return error("修改密码失败,旧密码错误");
|
||||||
}
|
}
|
||||||
if (passwordService.matches(user, newPassword))
|
if (passwordService.matches(user, newPassword)) {
|
||||||
{
|
|
||||||
return error("新密码不能与旧密码相同");
|
return error("新密码不能与旧密码相同");
|
||||||
}
|
}
|
||||||
user.setSalt(ShiroUtils.randomSalt());
|
user.setSalt(ShiroUtils.randomSalt());
|
||||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
|
||||||
user.setPwdUpdateDate(DateUtils.getNowDate());
|
user.setPwdUpdateDate(DateUtils.getNowDate());
|
||||||
if (userService.resetUserPwd(user) > 0)
|
if (userService.resetUserPwd(user) > 0) {
|
||||||
{
|
|
||||||
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
@ -104,8 +91,7 @@ public class SysProfileController extends BaseController
|
||||||
* 修改用户
|
* 修改用户
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit")
|
@GetMapping("/edit")
|
||||||
public String edit(ModelMap mmap)
|
public String edit(ModelMap mmap) {
|
||||||
{
|
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
mmap.put("user", userService.selectUserById(user.getUserId()));
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
|
|
@ -115,8 +101,7 @@ public class SysProfileController extends BaseController
|
||||||
* 修改头像
|
* 修改头像
|
||||||
*/
|
*/
|
||||||
@GetMapping("/avatar")
|
@GetMapping("/avatar")
|
||||||
public String avatar(ModelMap mmap)
|
public String avatar(ModelMap mmap) {
|
||||||
{
|
|
||||||
SysUser user = ShiroUtils.getSysUser();
|
SysUser user = ShiroUtils.getSysUser();
|
||||||
mmap.put("user", userService.selectUserById(user.getUserId()));
|
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||||
return prefix + "/avatar";
|
return prefix + "/avatar";
|
||||||
|
|
@ -128,15 +113,13 @@ public class SysProfileController extends BaseController
|
||||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult update(SysUser user)
|
public AjaxResult update(SysUser user) {
|
||||||
{
|
|
||||||
SysUser currentUser = ShiroUtils.getSysUser();
|
SysUser currentUser = ShiroUtils.getSysUser();
|
||||||
currentUser.setUserName(user.getUserName());
|
currentUser.setUserName(user.getUserName());
|
||||||
currentUser.setEmail(user.getEmail());
|
currentUser.setEmail(user.getEmail());
|
||||||
currentUser.setPhonenumber(user.getPhonenumber());
|
currentUser.setPhonenumber(user.getPhonenumber());
|
||||||
currentUser.setSex(user.getSex());
|
currentUser.setSex(user.getSex());
|
||||||
if (userService.updateUserInfo(currentUser) > 0)
|
if (userService.updateUserInfo(currentUser) > 0) {
|
||||||
{
|
|
||||||
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
|
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
@ -149,25 +132,20 @@ public class SysProfileController extends BaseController
|
||||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/updateAvatar")
|
@PostMapping("/updateAvatar")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file)
|
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file) {
|
||||||
{
|
|
||||||
SysUser currentUser = ShiroUtils.getSysUser();
|
SysUser currentUser = ShiroUtils.getSysUser();
|
||||||
try
|
try {
|
||||||
{
|
if (!file.isEmpty()) {
|
||||||
if (!file.isEmpty())
|
|
||||||
{
|
|
||||||
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
|
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
|
||||||
currentUser.setAvatar(avatar);
|
currentUser.setAvatar(avatar);
|
||||||
if (userService.updateUserInfo(currentUser) > 0)
|
if (userService.updateUserInfo(currentUser) > 0) {
|
||||||
{
|
|
||||||
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
|
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return error();
|
return error();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
log.error("修改头像失败!", e);
|
log.error("修改头像失败!", e);
|
||||||
return error(e.getMessage());
|
return error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.framework.shiro.service.SysRegisterService;
|
||||||
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
||||||
import com.ruoyi.framework.shiro.service.SysRegisterService;
|
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册验证
|
* 注册验证
|
||||||
|
|
@ -18,8 +18,7 @@ import com.ruoyi.system.service.ISysConfigService;
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class SysRegisterController extends BaseController
|
public class SysRegisterController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysRegisterService registerService;
|
private SysRegisterService registerService;
|
||||||
|
|
||||||
|
|
@ -27,17 +26,14 @@ public class SysRegisterController extends BaseController
|
||||||
private ISysConfigService configService;
|
private ISysConfigService configService;
|
||||||
|
|
||||||
@GetMapping("/register")
|
@GetMapping("/register")
|
||||||
public String register()
|
public String register() {
|
||||||
{
|
|
||||||
return "register";
|
return "register";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/register")
|
@PostMapping("/register")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult ajaxRegister(SysUser user)
|
public AjaxResult ajaxRegister(SysUser user) {
|
||||||
{
|
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
|
||||||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
|
||||||
{
|
|
||||||
return error("当前系统没有开启注册功能!");
|
return error("当前系统没有开启注册功能!");
|
||||||
}
|
}
|
||||||
String msg = registerService.register(user);
|
String msg = registerService.register(user);
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,5 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
@ -25,6 +14,14 @@ import com.ruoyi.framework.shiro.util.AuthorizationUtils;
|
||||||
import com.ruoyi.system.domain.SysUserRole;
|
import com.ruoyi.system.domain.SysUserRole;
|
||||||
import com.ruoyi.system.service.ISysRoleService;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色信息
|
* 角色信息
|
||||||
|
|
@ -33,8 +30,7 @@ import com.ruoyi.system.service.ISysUserService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/role")
|
@RequestMapping("/system/role")
|
||||||
public class SysRoleController extends BaseController
|
public class SysRoleController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "system/role";
|
private String prefix = "system/role";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -45,16 +41,14 @@ public class SysRoleController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("system:role:view")
|
@RequiresPermissions("system:role:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String role()
|
public String role() {
|
||||||
{
|
|
||||||
return prefix + "/role";
|
return prefix + "/role";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:role:list")
|
@RequiresPermissions("system:role:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysRole role)
|
public TableDataInfo list(SysRole role) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<SysRole> list = roleService.selectRoleList(role);
|
List<SysRole> list = roleService.selectRoleList(role);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -64,8 +58,7 @@ public class SysRoleController extends BaseController
|
||||||
@RequiresPermissions("system:role:export")
|
@RequiresPermissions("system:role:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysRole role)
|
public AjaxResult export(SysRole role) {
|
||||||
{
|
|
||||||
List<SysRole> list = roleService.selectRoleList(role);
|
List<SysRole> list = roleService.selectRoleList(role);
|
||||||
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
||||||
return util.exportExcel(list, "角色数据");
|
return util.exportExcel(list, "角色数据");
|
||||||
|
|
@ -75,8 +68,7 @@ public class SysRoleController extends BaseController
|
||||||
* 新增角色
|
* 新增角色
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add()
|
public String add() {
|
||||||
{
|
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,14 +79,11 @@ public class SysRoleController extends BaseController
|
||||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysRole role)
|
public AjaxResult addSave(@Validated SysRole role) {
|
||||||
{
|
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
|
||||||
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
|
||||||
{
|
|
||||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
|
||||||
{
|
|
||||||
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
}
|
}
|
||||||
role.setCreateBy(ShiroUtils.getLoginName());
|
role.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
|
@ -107,8 +96,7 @@ public class SysRoleController extends BaseController
|
||||||
* 修改角色
|
* 修改角色
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{roleId}")
|
@GetMapping("/edit/{roleId}")
|
||||||
public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("role", roleService.selectRoleById(roleId));
|
mmap.put("role", roleService.selectRoleById(roleId));
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
@ -120,15 +108,12 @@ public class SysRoleController extends BaseController
|
||||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysRole role)
|
public AjaxResult editSave(@Validated SysRole role) {
|
||||||
{
|
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
|
||||||
{
|
|
||||||
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
|
||||||
{
|
|
||||||
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
}
|
}
|
||||||
role.setUpdateBy(ShiroUtils.getLoginName());
|
role.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
|
@ -140,8 +125,7 @@ public class SysRoleController extends BaseController
|
||||||
* 角色分配数据权限
|
* 角色分配数据权限
|
||||||
*/
|
*/
|
||||||
@GetMapping("/authDataScope/{roleId}")
|
@GetMapping("/authDataScope/{roleId}")
|
||||||
public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("role", roleService.selectRoleById(roleId));
|
mmap.put("role", roleService.selectRoleById(roleId));
|
||||||
return prefix + "/dataScope";
|
return prefix + "/dataScope";
|
||||||
}
|
}
|
||||||
|
|
@ -153,12 +137,10 @@ public class SysRoleController extends BaseController
|
||||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/authDataScope")
|
@PostMapping("/authDataScope")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult authDataScopeSave(SysRole role)
|
public AjaxResult authDataScopeSave(SysRole role) {
|
||||||
{
|
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
role.setUpdateBy(ShiroUtils.getLoginName());
|
role.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
if (roleService.authDataScope(role) > 0)
|
if (roleService.authDataScope(role) > 0) {
|
||||||
{
|
|
||||||
ShiroUtils.setSysUser(userService.selectUserById(ShiroUtils.getSysUser().getUserId()));
|
ShiroUtils.setSysUser(userService.selectUserById(ShiroUtils.getSysUser().getUserId()));
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
@ -169,8 +151,7 @@ public class SysRoleController extends BaseController
|
||||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids) {
|
||||||
{
|
|
||||||
return toAjax(roleService.deleteRoleByIds(ids));
|
return toAjax(roleService.deleteRoleByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -179,8 +160,7 @@ public class SysRoleController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkRoleNameUnique")
|
@PostMapping("/checkRoleNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkRoleNameUnique(SysRole role)
|
public String checkRoleNameUnique(SysRole role) {
|
||||||
{
|
|
||||||
return roleService.checkRoleNameUnique(role);
|
return roleService.checkRoleNameUnique(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,8 +169,7 @@ public class SysRoleController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkRoleKeyUnique")
|
@PostMapping("/checkRoleKeyUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkRoleKeyUnique(SysRole role)
|
public String checkRoleKeyUnique(SysRole role) {
|
||||||
{
|
|
||||||
return roleService.checkRoleKeyUnique(role);
|
return roleService.checkRoleKeyUnique(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -198,8 +177,7 @@ public class SysRoleController extends BaseController
|
||||||
* 选择菜单树
|
* 选择菜单树
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectMenuTree")
|
@GetMapping("/selectMenuTree")
|
||||||
public String selectMenuTree()
|
public String selectMenuTree() {
|
||||||
{
|
|
||||||
return prefix + "/tree";
|
return prefix + "/tree";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -210,8 +188,7 @@ public class SysRoleController extends BaseController
|
||||||
@RequiresPermissions("system:role:edit")
|
@RequiresPermissions("system:role:edit")
|
||||||
@PostMapping("/changeStatus")
|
@PostMapping("/changeStatus")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult changeStatus(SysRole role)
|
public AjaxResult changeStatus(SysRole role) {
|
||||||
{
|
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
return toAjax(roleService.changeStatus(role));
|
return toAjax(roleService.changeStatus(role));
|
||||||
}
|
}
|
||||||
|
|
@ -221,8 +198,7 @@ public class SysRoleController extends BaseController
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:role:edit")
|
@RequiresPermissions("system:role:edit")
|
||||||
@GetMapping("/authUser/{roleId}")
|
@GetMapping("/authUser/{roleId}")
|
||||||
public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("role", roleService.selectRoleById(roleId));
|
mmap.put("role", roleService.selectRoleById(roleId));
|
||||||
return prefix + "/authUser";
|
return prefix + "/authUser";
|
||||||
}
|
}
|
||||||
|
|
@ -233,8 +209,7 @@ public class SysRoleController extends BaseController
|
||||||
@RequiresPermissions("system:role:list")
|
@RequiresPermissions("system:role:list")
|
||||||
@PostMapping("/authUser/allocatedList")
|
@PostMapping("/authUser/allocatedList")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo allocatedList(SysUser user)
|
public TableDataInfo allocatedList(SysUser user) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<SysUser> list = userService.selectAllocatedList(user);
|
List<SysUser> list = userService.selectAllocatedList(user);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -246,8 +221,7 @@ public class SysRoleController extends BaseController
|
||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@PostMapping("/authUser/cancel")
|
@PostMapping("/authUser/cancel")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult cancelAuthUser(SysUserRole userRole)
|
public AjaxResult cancelAuthUser(SysUserRole userRole) {
|
||||||
{
|
|
||||||
return toAjax(roleService.deleteAuthUser(userRole));
|
return toAjax(roleService.deleteAuthUser(userRole));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -257,8 +231,7 @@ public class SysRoleController extends BaseController
|
||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@PostMapping("/authUser/cancelAll")
|
@PostMapping("/authUser/cancelAll")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult cancelAuthUserAll(Long roleId, String userIds)
|
public AjaxResult cancelAuthUserAll(Long roleId, String userIds) {
|
||||||
{
|
|
||||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -266,8 +239,7 @@ public class SysRoleController extends BaseController
|
||||||
* 选择用户
|
* 选择用户
|
||||||
*/
|
*/
|
||||||
@GetMapping("/authUser/selectUser/{roleId}")
|
@GetMapping("/authUser/selectUser/{roleId}")
|
||||||
public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("role", roleService.selectRoleById(roleId));
|
mmap.put("role", roleService.selectRoleById(roleId));
|
||||||
return prefix + "/selectUser";
|
return prefix + "/selectUser";
|
||||||
}
|
}
|
||||||
|
|
@ -278,8 +250,7 @@ public class SysRoleController extends BaseController
|
||||||
@RequiresPermissions("system:role:list")
|
@RequiresPermissions("system:role:list")
|
||||||
@PostMapping("/authUser/unallocatedList")
|
@PostMapping("/authUser/unallocatedList")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo unallocatedList(SysUser user)
|
public TableDataInfo unallocatedList(SysUser user) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<SysUser> list = userService.selectUnallocatedList(user);
|
List<SysUser> list = userService.selectUnallocatedList(user);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -291,8 +262,7 @@ public class SysRoleController extends BaseController
|
||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@PostMapping("/authUser/selectAll")
|
@PostMapping("/authUser/selectAll")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult selectAuthUserAll(Long roleId, String userIds)
|
public AjaxResult selectAuthUserAll(Long roleId, String userIds) {
|
||||||
{
|
|
||||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,18 +1,5 @@
|
||||||
package com.ruoyi.web.controller.system;
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.ModelMap;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
@ -28,6 +15,16 @@ import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
import com.ruoyi.system.service.ISysPostService;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
import com.ruoyi.system.service.ISysRoleService;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户信息
|
||||||
|
|
@ -36,8 +33,7 @@ import com.ruoyi.system.service.ISysUserService;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/system/user")
|
@RequestMapping("/system/user")
|
||||||
public class SysUserController extends BaseController
|
public class SysUserController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "system/user";
|
private String prefix = "system/user";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -54,16 +50,14 @@ public class SysUserController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("system:user:view")
|
@RequiresPermissions("system:user:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String user()
|
public String user() {
|
||||||
{
|
|
||||||
return prefix + "/user";
|
return prefix + "/user";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:user:list")
|
@RequiresPermissions("system:user:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(SysUser user)
|
public TableDataInfo list(SysUser user) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<SysUser> list = userService.selectUserList(user);
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -73,8 +67,7 @@ public class SysUserController extends BaseController
|
||||||
@RequiresPermissions("system:user:export")
|
@RequiresPermissions("system:user:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult export(SysUser user)
|
public AjaxResult export(SysUser user) {
|
||||||
{
|
|
||||||
List<SysUser> list = userService.selectUserList(user);
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
return util.exportExcel(list, "用户数据");
|
return util.exportExcel(list, "用户数据");
|
||||||
|
|
@ -84,8 +77,7 @@ public class SysUserController extends BaseController
|
||||||
@RequiresPermissions("system:user:import")
|
@RequiresPermissions("system:user:import")
|
||||||
@PostMapping("/importData")
|
@PostMapping("/importData")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
|
||||||
{
|
|
||||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
List<SysUser> userList = util.importExcel(file.getInputStream());
|
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||||
String operName = ShiroUtils.getSysUser().getLoginName();
|
String operName = ShiroUtils.getSysUser().getLoginName();
|
||||||
|
|
@ -96,8 +88,7 @@ public class SysUserController extends BaseController
|
||||||
@RequiresPermissions("system:user:view")
|
@RequiresPermissions("system:user:view")
|
||||||
@GetMapping("/importTemplate")
|
@GetMapping("/importTemplate")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult importTemplate()
|
public AjaxResult importTemplate() {
|
||||||
{
|
|
||||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||||
return util.importTemplateExcel("用户数据");
|
return util.importTemplateExcel("用户数据");
|
||||||
}
|
}
|
||||||
|
|
@ -106,8 +97,7 @@ public class SysUserController extends BaseController
|
||||||
* 新增用户
|
* 新增用户
|
||||||
*/
|
*/
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add(ModelMap mmap)
|
public String add(ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
mmap.put("posts", postService.selectPostAll());
|
mmap.put("posts", postService.selectPostAll());
|
||||||
return prefix + "/add";
|
return prefix + "/add";
|
||||||
|
|
@ -120,20 +110,16 @@ public class SysUserController extends BaseController
|
||||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult addSave(@Validated SysUser user)
|
public AjaxResult addSave(@Validated SysUser user) {
|
||||||
{
|
if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName()))) {
|
||||||
if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName())))
|
|
||||||
{
|
|
||||||
return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
|
return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
|
||||||
}
|
}
|
||||||
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||||
{
|
|
||||||
return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
||||||
}
|
}
|
||||||
else if (StringUtils.isNotEmpty(user.getEmail())
|
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
||||||
{
|
|
||||||
return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
user.setSalt(ShiroUtils.randomSalt());
|
user.setSalt(ShiroUtils.randomSalt());
|
||||||
|
|
@ -146,8 +132,7 @@ public class SysUserController extends BaseController
|
||||||
* 修改用户
|
* 修改用户
|
||||||
*/
|
*/
|
||||||
@GetMapping("/edit/{userId}")
|
@GetMapping("/edit/{userId}")
|
||||||
public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
|
public String edit(@PathVariable("userId") Long userId, ModelMap mmap) {
|
||||||
{
|
|
||||||
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||||
mmap.put("user", userService.selectUserById(userId));
|
mmap.put("user", userService.selectUserById(userId));
|
||||||
mmap.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
mmap.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||||
|
|
@ -162,17 +147,14 @@ public class SysUserController extends BaseController
|
||||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated SysUser user)
|
public AjaxResult editSave(@Validated SysUser user) {
|
||||||
{
|
|
||||||
userService.checkUserAllowed(user);
|
userService.checkUserAllowed(user);
|
||||||
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||||
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||||
{
|
|
||||||
return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
||||||
}
|
}
|
||||||
else if (StringUtils.isNotEmpty(user.getEmail())
|
else if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
||||||
{
|
|
||||||
return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
user.setUpdateBy(ShiroUtils.getLoginName());
|
user.setUpdateBy(ShiroUtils.getLoginName());
|
||||||
|
|
@ -181,8 +163,7 @@ public class SysUserController extends BaseController
|
||||||
|
|
||||||
@RequiresPermissions("system:user:resetPwd")
|
@RequiresPermissions("system:user:resetPwd")
|
||||||
@GetMapping("/resetPwd/{userId}")
|
@GetMapping("/resetPwd/{userId}")
|
||||||
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
|
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap) {
|
||||||
{
|
|
||||||
mmap.put("user", userService.selectUserById(userId));
|
mmap.put("user", userService.selectUserById(userId));
|
||||||
return prefix + "/resetPwd";
|
return prefix + "/resetPwd";
|
||||||
}
|
}
|
||||||
|
|
@ -191,15 +172,12 @@ public class SysUserController extends BaseController
|
||||||
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/resetPwd")
|
@PostMapping("/resetPwd")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult resetPwdSave(SysUser user)
|
public AjaxResult resetPwdSave(SysUser user) {
|
||||||
{
|
|
||||||
userService.checkUserAllowed(user);
|
userService.checkUserAllowed(user);
|
||||||
user.setSalt(ShiroUtils.randomSalt());
|
user.setSalt(ShiroUtils.randomSalt());
|
||||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
||||||
if (userService.resetUserPwd(user) > 0)
|
if (userService.resetUserPwd(user) > 0) {
|
||||||
{
|
if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue()) {
|
||||||
if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue())
|
|
||||||
{
|
|
||||||
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
||||||
}
|
}
|
||||||
return success();
|
return success();
|
||||||
|
|
@ -211,8 +189,7 @@ public class SysUserController extends BaseController
|
||||||
* 进入授权角色页
|
* 进入授权角色页
|
||||||
*/
|
*/
|
||||||
@GetMapping("/authRole/{userId}")
|
@GetMapping("/authRole/{userId}")
|
||||||
public String authRole(@PathVariable("userId") Long userId, ModelMap mmap)
|
public String authRole(@PathVariable("userId") Long userId, ModelMap mmap) {
|
||||||
{
|
|
||||||
SysUser user = userService.selectUserById(userId);
|
SysUser user = userService.selectUserById(userId);
|
||||||
// 获取用户所属的角色列表
|
// 获取用户所属的角色列表
|
||||||
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||||
|
|
@ -228,8 +205,7 @@ public class SysUserController extends BaseController
|
||||||
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||||
@PostMapping("/authRole/insertAuthRole")
|
@PostMapping("/authRole/insertAuthRole")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
|
public AjaxResult insertAuthRole(Long userId, Long[] roleIds) {
|
||||||
{
|
|
||||||
userService.insertUserAuth(userId, roleIds);
|
userService.insertUserAuth(userId, roleIds);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
@ -238,8 +214,7 @@ public class SysUserController extends BaseController
|
||||||
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(String ids)
|
public AjaxResult remove(String ids) {
|
||||||
{
|
|
||||||
return toAjax(userService.deleteUserByIds(ids));
|
return toAjax(userService.deleteUserByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -248,8 +223,7 @@ public class SysUserController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkLoginNameUnique")
|
@PostMapping("/checkLoginNameUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkLoginNameUnique(SysUser user)
|
public String checkLoginNameUnique(SysUser user) {
|
||||||
{
|
|
||||||
return userService.checkLoginNameUnique(user.getLoginName());
|
return userService.checkLoginNameUnique(user.getLoginName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -258,8 +232,7 @@ public class SysUserController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkPhoneUnique")
|
@PostMapping("/checkPhoneUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkPhoneUnique(SysUser user)
|
public String checkPhoneUnique(SysUser user) {
|
||||||
{
|
|
||||||
return userService.checkPhoneUnique(user);
|
return userService.checkPhoneUnique(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -268,8 +241,7 @@ public class SysUserController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PostMapping("/checkEmailUnique")
|
@PostMapping("/checkEmailUnique")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String checkEmailUnique(SysUser user)
|
public String checkEmailUnique(SysUser user) {
|
||||||
{
|
|
||||||
return userService.checkEmailUnique(user);
|
return userService.checkEmailUnique(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -280,8 +252,7 @@ public class SysUserController extends BaseController
|
||||||
@RequiresPermissions("system:user:edit")
|
@RequiresPermissions("system:user:edit")
|
||||||
@PostMapping("/changeStatus")
|
@PostMapping("/changeStatus")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult changeStatus(SysUser user)
|
public AjaxResult changeStatus(SysUser user) {
|
||||||
{
|
|
||||||
userService.checkUserAllowed(user);
|
userService.checkUserAllowed(user);
|
||||||
return toAjax(userService.changeStatus(user));
|
return toAjax(userService.changeStatus(user));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package com.ruoyi.web.controller.tool;
|
package com.ruoyi.web.controller.tool;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* build 表单构建
|
* build 表单构建
|
||||||
|
|
@ -13,14 +13,12 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/tool/build")
|
@RequestMapping("/tool/build")
|
||||||
public class BuildController extends BaseController
|
public class BuildController extends BaseController {
|
||||||
{
|
|
||||||
private String prefix = "tool/build";
|
private String prefix = "tool/build";
|
||||||
|
|
||||||
@RequiresPermissions("tool:build:view")
|
@RequiresPermissions("tool:build:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String build()
|
public String build() {
|
||||||
{
|
|
||||||
return prefix + "/build";
|
return prefix + "/build";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package com.ruoyi.web.controller.tool;
|
package com.ruoyi.web.controller.tool;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* swagger 接口
|
* swagger 接口
|
||||||
|
|
@ -13,12 +13,10 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/tool/swagger")
|
@RequestMapping("/tool/swagger")
|
||||||
public class SwaggerController extends BaseController
|
public class SwaggerController extends BaseController {
|
||||||
{
|
|
||||||
@RequiresPermissions("tool:swagger:view")
|
@RequiresPermissions("tool:swagger:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String index()
|
public String index() {
|
||||||
{
|
|
||||||
return redirect("/swagger-ui.html");
|
return redirect("/swagger-ui.html");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,15 @@
|
||||||
package com.ruoyi.web.controller.tool;
|
package com.ruoyi.web.controller.tool;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* swagger 用户测试方法
|
* swagger 用户测试方法
|
||||||
|
|
@ -28,9 +19,9 @@ import io.swagger.annotations.ApiOperation;
|
||||||
@Api("用户信息管理")
|
@Api("用户信息管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/test/user")
|
@RequestMapping("/test/user")
|
||||||
public class TestController extends BaseController
|
public class TestController extends BaseController {
|
||||||
{
|
|
||||||
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
|
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
|
||||||
|
|
||||||
{
|
{
|
||||||
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
|
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
|
||||||
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
|
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
|
||||||
|
|
@ -38,8 +29,7 @@ public class TestController extends BaseController
|
||||||
|
|
||||||
@ApiOperation("获取用户列表")
|
@ApiOperation("获取用户列表")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public AjaxResult userList()
|
public AjaxResult userList() {
|
||||||
{
|
|
||||||
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
|
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
|
||||||
return AjaxResult.success(userList);
|
return AjaxResult.success(userList);
|
||||||
}
|
}
|
||||||
|
|
@ -47,14 +37,11 @@ public class TestController extends BaseController
|
||||||
@ApiOperation("获取用户详细")
|
@ApiOperation("获取用户详细")
|
||||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
||||||
@GetMapping("/{userId}")
|
@GetMapping("/{userId}")
|
||||||
public AjaxResult getUser(@PathVariable Integer userId)
|
public AjaxResult getUser(@PathVariable Integer userId) {
|
||||||
{
|
if (!users.isEmpty() && users.containsKey(userId)) {
|
||||||
if (!users.isEmpty() && users.containsKey(userId))
|
|
||||||
{
|
|
||||||
return AjaxResult.success(users.get(userId));
|
return AjaxResult.success(users.get(userId));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
return error("用户不存在");
|
return error("用户不存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -62,10 +49,8 @@ public class TestController extends BaseController
|
||||||
@ApiOperation("新增用户")
|
@ApiOperation("新增用户")
|
||||||
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public AjaxResult save(UserEntity user)
|
public AjaxResult save(UserEntity user) {
|
||||||
{
|
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) {
|
||||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
|
||||||
{
|
|
||||||
return error("用户ID不能为空");
|
return error("用户ID不能为空");
|
||||||
}
|
}
|
||||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||||
|
|
@ -74,14 +59,11 @@ public class TestController extends BaseController
|
||||||
@ApiOperation("更新用户")
|
@ApiOperation("更新用户")
|
||||||
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
public AjaxResult update(UserEntity user)
|
public AjaxResult update(UserEntity user) {
|
||||||
{
|
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) {
|
||||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
|
||||||
{
|
|
||||||
return error("用户ID不能为空");
|
return error("用户ID不能为空");
|
||||||
}
|
}
|
||||||
if (users.isEmpty() || !users.containsKey(user.getUserId()))
|
if (users.isEmpty() || !users.containsKey(user.getUserId())) {
|
||||||
{
|
|
||||||
return error("用户不存在");
|
return error("用户不存在");
|
||||||
}
|
}
|
||||||
users.remove(user.getUserId());
|
users.remove(user.getUserId());
|
||||||
|
|
@ -91,23 +73,19 @@ public class TestController extends BaseController
|
||||||
@ApiOperation("删除用户信息")
|
@ApiOperation("删除用户信息")
|
||||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
||||||
@DeleteMapping("/{userId}")
|
@DeleteMapping("/{userId}")
|
||||||
public AjaxResult delete(@PathVariable Integer userId)
|
public AjaxResult delete(@PathVariable Integer userId) {
|
||||||
{
|
if (!users.isEmpty() && users.containsKey(userId)) {
|
||||||
if (!users.isEmpty() && users.containsKey(userId))
|
|
||||||
{
|
|
||||||
users.remove(userId);
|
users.remove(userId);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
return error("用户不存在");
|
return error("用户不存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiModel("用户实体")
|
@ApiModel("用户实体")
|
||||||
class UserEntity
|
class UserEntity {
|
||||||
{
|
|
||||||
@ApiModelProperty("用户ID")
|
@ApiModelProperty("用户ID")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
|
|
@ -120,56 +98,46 @@ class UserEntity
|
||||||
@ApiModelProperty("用户手机")
|
@ApiModelProperty("用户手机")
|
||||||
private String mobile;
|
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.userId = userId;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.mobile = mobile;
|
this.mobile = mobile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getUserId()
|
public Integer getUserId() {
|
||||||
{
|
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserId(Integer userId)
|
public void setUserId(Integer userId) {
|
||||||
{
|
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsername()
|
public String getUsername() {
|
||||||
{
|
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsername(String username)
|
public void setUsername(String username) {
|
||||||
{
|
|
||||||
this.username = username;
|
this.username = username;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPassword()
|
public String getPassword() {
|
||||||
{
|
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPassword(String password)
|
public void setPassword(String password) {
|
||||||
{
|
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMobile()
|
public String getMobile() {
|
||||||
{
|
|
||||||
return mobile;
|
return mobile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMobile(String mobile)
|
public void setMobile(String mobile) {
|
||||||
{
|
|
||||||
this.mobile = mobile;
|
this.mobile = mobile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package com.ruoyi.web.core.config;
|
package com.ruoyi.web.core.config;
|
||||||
|
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import com.ruoyi.common.config.RuoYiConfig;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import springfox.documentation.builders.ApiInfoBuilder;
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
import springfox.documentation.builders.PathSelectors;
|
import springfox.documentation.builders.PathSelectors;
|
||||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
|
|
@ -21,9 +21,11 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableSwagger2
|
@EnableSwagger2
|
||||||
public class SwaggerConfig
|
public class SwaggerConfig {
|
||||||
{
|
|
||||||
/** 是否开启swagger */
|
/**
|
||||||
|
* 是否开启swagger
|
||||||
|
*/
|
||||||
@Value("${swagger.enabled}")
|
@Value("${swagger.enabled}")
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
|
|
||||||
|
|
@ -31,8 +33,7 @@ public class SwaggerConfig
|
||||||
* 创建API
|
* 创建API
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public Docket createRestApi()
|
public Docket createRestApi() {
|
||||||
{
|
|
||||||
return new Docket(DocumentationType.SWAGGER_2)
|
return new Docket(DocumentationType.SWAGGER_2)
|
||||||
// 是否启用Swagger
|
// 是否启用Swagger
|
||||||
.enable(enabled)
|
.enable(enabled)
|
||||||
|
|
@ -52,8 +53,7 @@ public class SwaggerConfig
|
||||||
/**
|
/**
|
||||||
* 添加摘要信息
|
* 添加摘要信息
|
||||||
*/
|
*/
|
||||||
private ApiInfo apiInfo()
|
private ApiInfo apiInfo() {
|
||||||
{
|
|
||||||
// 用ApiInfoBuilder进行定制
|
// 用ApiInfoBuilder进行定制
|
||||||
return new ApiInfoBuilder()
|
return new ApiInfoBuilder()
|
||||||
// 设置标题
|
// 设置标题
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ spring:
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
password: password
|
password: root!@#
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
# 从数据源开关/默认关闭
|
# 从数据源开关/默认关闭
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ ruoyi:
|
||||||
# 开发环境配置
|
# 开发环境配置
|
||||||
server:
|
server:
|
||||||
# 服务器的HTTP端口,默认为80
|
# 服务器的HTTP端口,默认为80
|
||||||
port: 80
|
port: 8090
|
||||||
servlet:
|
servlet:
|
||||||
# 应用的访问路径
|
# 应用的访问路径
|
||||||
context-path: /
|
context-path: /
|
||||||
|
|
@ -98,7 +98,7 @@ shiro:
|
||||||
# 验证码开关
|
# 验证码开关
|
||||||
captchaEnabled: true
|
captchaEnabled: true
|
||||||
# 验证码类型 math 数组计算 char 字符
|
# 验证码类型 math 数组计算 char 字符
|
||||||
captchaType: math
|
captchaType: char
|
||||||
cookie:
|
cookie:
|
||||||
# 设置Cookie的域名 默认空,即当前访问的域名
|
# 设置Cookie的域名 默认空,即当前访问的域名
|
||||||
domain:
|
domain:
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||||
|
|
||||||
<!-- 日志存放路径 -->
|
<!-- 日志存放路径 -->
|
||||||
<property name="log.path" value="/home/ruoyi/logs"/>
|
<property name="log.path" value="/Users/zail/Workspace/logs"/>
|
||||||
<!-- 日志输出格式 -->
|
<!-- 日志输出格式 -->
|
||||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<link th:href="@{/css/style.css}" rel="stylesheet"/>
|
<link th:href="@{/css/style.css}" rel="stylesheet"/>
|
||||||
</head>
|
</head>
|
||||||
<body class="gray-bg">
|
<body class="gray-bg">
|
||||||
<div class="middle-box text-center animated fadeInDown">
|
<div class="middle-box text-center animated fadeInDown">
|
||||||
<h1>403</h1>
|
<h1>403</h1>
|
||||||
<h3 class="font-bold">您没有访问权限!</h3>
|
<h3 class="font-bold">您没有访问权限!</h3>
|
||||||
|
|
||||||
|
|
@ -17,12 +17,14 @@
|
||||||
对不起,您没有访问权限,请不要进行非法操作!您可以返回主页面
|
对不起,您没有访问权限,请不要进行非法操作!您可以返回主页面
|
||||||
<a href="javascript:index()" class="btn btn-outline btn-primary btn-xs">返回主页</a>
|
<a href="javascript:index()" class="btn btn-outline btn-primary btn-xs">返回主页</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script th:inline="javascript">
|
|
||||||
|
<script th:inline="javascript">
|
||||||
var ctx = [[@{/}]];
|
var ctx = [[@{/}]];
|
||||||
function index() {
|
function index() {
|
||||||
window.top.location = ctx + "index";
|
window.top.location = ctx + "index";
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -36,35 +36,54 @@
|
||||||
<a class="menuItem noactive" title="个人中心" th:href="@{/system/user/profile}">
|
<a class="menuItem noactive" title="个人中心" th:href="@{/system/user/profile}">
|
||||||
<div class="hide" th:text="个人中心"></div>
|
<div class="hide" th:text="个人中心"></div>
|
||||||
<div class="pull-left image">
|
<div class="pull-left image">
|
||||||
<img th:src="(${#strings.isEmpty(user.avatar)}) ? @{/img/profile.jpg} : @{${user.avatar}}" th:onerror="this.src='img/profile.jpg'" class="img-circle" alt="User Image">
|
<img th:src="(${#strings.isEmpty(user.avatar)}) ? @{/img/profile.jpg} : @{${user.avatar}}"
|
||||||
|
th:onerror="this.src='img/profile.jpg'" class="img-circle" alt="User Image">
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<div class="pull-left info">
|
<div class="pull-left info">
|
||||||
<p>[[${user.loginName}]]</p>
|
<p th:text="${user.loginName}"></p>
|
||||||
<a href="#"><i class="fa fa-circle text-success"></i> 在线</a>
|
<a href="#"><i class="fa fa-circle text-success"></i> 在线</a>
|
||||||
<a th:href="@{logout}" style="padding-left:5px;"><i class="fa fa-sign-out text-danger"></i> 注销</a>
|
<a th:href="@{logout}" style="padding-left:5px;">
|
||||||
|
<i class="fa fa-sign-out text-danger"></i>
|
||||||
|
注销
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="menuItem" th:href="@{/system/main}"><i class="fa fa-home"></i> <span class="nav-label">首页</span> </a>
|
<a class="menuItem" th:href="@{/system/main}"><i class="fa fa-home"></i> <span
|
||||||
|
class="nav-label">首页</span> </a>
|
||||||
</li>
|
</li>
|
||||||
<li th:each="menu : ${menus}">
|
<li th:each="menu : ${menus}">
|
||||||
<a th:class="@{${!#strings.isEmpty(menu.url) && menu.url != '#'} ? ${menu.target}}" th:href="@{${#strings.isEmpty(menu.url)} ? |#| : ${menu.url}}" th:data-refresh="${menu.isRefresh == '0'}">
|
<a th:class="@{${!#strings.isEmpty(menu.url) && menu.url != '#'} ? ${menu.target}}"
|
||||||
|
th:href="@{${#strings.isEmpty(menu.url)} ? |#| : ${menu.url}}"
|
||||||
|
th:data-refresh="${menu.isRefresh == '0'}">
|
||||||
<i class="fa fa-bar-chart-o" th:class="${menu.icon}"></i>
|
<i class="fa fa-bar-chart-o" th:class="${menu.icon}"></i>
|
||||||
<span class="nav-label" th:text="${menu.menuName}">一级菜单</span>
|
<span class="nav-label" th:text="${menu.menuName}">一级菜单</span>
|
||||||
<span th:class="${#strings.isEmpty(menu.url) || menu.url == '#'} ? |fa arrow|"></span>
|
<span th:class="${#strings.isEmpty(menu.url) || menu.url == '#'} ? |fa arrow|"></span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="nav nav-second-level collapse">
|
<ul class="nav nav-second-level collapse">
|
||||||
<li th:each="cmenu : ${menu.children}">
|
<li th:each="cmenu : ${menu.children}">
|
||||||
<a th:if="${#lists.isEmpty(cmenu.children)}" th:class="${#strings.isEmpty(cmenu.target)} ? |menuItem| : ${cmenu.target}" th:utext="${cmenu.menuName}" th:href="@{${cmenu.url}}" th:data-refresh="${cmenu.isRefresh == '0'}">二级菜单</a>
|
<a th:if="${#lists.isEmpty(cmenu.children)}"
|
||||||
<a th:if="${not #lists.isEmpty(cmenu.children)}" href="#">[[${cmenu.menuName}]]<span class="fa arrow"></span></a>
|
th:class="${#strings.isEmpty(cmenu.target)} ? |menuItem| : ${cmenu.target}"
|
||||||
|
th:utext="${cmenu.menuName}" th:href="@{${cmenu.url}}"
|
||||||
|
th:data-refresh="${cmenu.isRefresh == '0'}">二级菜单</a>
|
||||||
|
<a th:if="${not #lists.isEmpty(cmenu.children)}" href="#">[[${cmenu.menuName}]]<span
|
||||||
|
class="fa arrow"></span></a>
|
||||||
<ul th:if="${not #lists.isEmpty(cmenu.children)}" class="nav nav-third-level">
|
<ul th:if="${not #lists.isEmpty(cmenu.children)}" class="nav nav-third-level">
|
||||||
<li th:each="emenu : ${cmenu.children}">
|
<li th:each="emenu : ${cmenu.children}">
|
||||||
<a th:if="${#lists.isEmpty(emenu.children)}" th:class="${#strings.isEmpty(emenu.target)} ? |menuItem| : ${emenu.target}" th:text="${emenu.menuName}" th:href="@{${emenu.url}}" th:data-refresh="${emenu.isRefresh == '0'}">三级菜单</a>
|
<a th:if="${#lists.isEmpty(emenu.children)}"
|
||||||
<a th:if="${not #lists.isEmpty(emenu.children)}" href="#">[[${emenu.menuName}]]<span class="fa arrow"></span></a>
|
th:class="${#strings.isEmpty(emenu.target)} ? |menuItem| : ${emenu.target}"
|
||||||
|
th:text="${emenu.menuName}" th:href="@{${emenu.url}}"
|
||||||
|
th:data-refresh="${emenu.isRefresh == '0'}">三级菜单</a>
|
||||||
|
<a th:if="${not #lists.isEmpty(emenu.children)}" href="#">[[${emenu.menuName}]]<span
|
||||||
|
class="fa arrow"></span></a>
|
||||||
<ul th:if="${not #lists.isEmpty(emenu.children)}" class="nav nav-four-level">
|
<ul th:if="${not #lists.isEmpty(emenu.children)}" class="nav nav-four-level">
|
||||||
<li th:each="fmenu : ${emenu.children}"><a th:if="${#lists.isEmpty(fmenu.children)}" th:class="${#strings.isEmpty(fmenu.target)} ? |menuItem| : ${fmenu.target}" th:text="${fmenu.menuName}" th:href="@{${fmenu.url}}" th:data-refresh="${fmenu.isRefresh == '0'}">四级菜单</a></li>
|
<li th:each="fmenu : ${emenu.children}"><a
|
||||||
|
th:if="${#lists.isEmpty(fmenu.children)}"
|
||||||
|
th:class="${#strings.isEmpty(fmenu.target)} ? |menuItem| : ${fmenu.target}"
|
||||||
|
th:text="${fmenu.menuName}" th:href="@{${fmenu.url}}"
|
||||||
|
th:data-refresh="${fmenu.isRefresh == '0'}">四级菜单</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
@ -72,9 +91,10 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li th:if="${demoEnabled}">
|
<li th:if="${demoEnabled}">
|
||||||
<a href="#"><i class="fa fa-desktop"></i><span class="nav-label">实例演示</span><span class="fa arrow"></span></a>
|
<a href="#"><i class="fa fa-desktop"></i><span class="nav-label">实例演示</span><span
|
||||||
|
class="fa arrow"></span></a>
|
||||||
<ul class="nav nav-second-level collapse">
|
<ul class="nav nav-second-level collapse">
|
||||||
<li> <a>表单<span class="fa arrow"></span></a>
|
<li><a>表单<span class="fa arrow"></span></a>
|
||||||
<ul class="nav nav-third-level">
|
<ul class="nav nav-third-level">
|
||||||
<li><a class="menuItem" th:href="@{/demo/form/button}">按钮</a></li>
|
<li><a class="menuItem" th:href="@{/demo/form/button}">按钮</a></li>
|
||||||
<li><a class="menuItem" th:href="@{/demo/form/grid}">栅格</a></li>
|
<li><a class="menuItem" th:href="@{/demo/form/grid}">栅格</a></li>
|
||||||
|
|
@ -98,7 +118,7 @@
|
||||||
<li><a class="menuItem" th:href="@{/demo/form/localrefresh}">Ajax局部刷新</a></li>
|
<li><a class="menuItem" th:href="@{/demo/form/localrefresh}">Ajax局部刷新</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li> <a>表格<span class="fa arrow"></span></a>
|
<li><a>表格<span class="fa arrow"></span></a>
|
||||||
<ul class="nav nav-third-level">
|
<ul class="nav nav-third-level">
|
||||||
<li><a class="menuItem" th:href="@{/demo/table/search}">查询条件</a></li>
|
<li><a class="menuItem" th:href="@{/demo/table/search}">查询条件</a></li>
|
||||||
<li><a class="menuItem" th:href="@{/demo/table/footer}">数据汇总</a></li>
|
<li><a class="menuItem" th:href="@{/demo/table/footer}">数据汇总</a></li>
|
||||||
|
|
@ -127,20 +147,20 @@
|
||||||
<li><a class="menuItem" th:href="@{/demo/table/other}">表格其他操作</a></li>
|
<li><a class="menuItem" th:href="@{/demo/table/other}">表格其他操作</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li> <a>弹框<span class="fa arrow"></span></a>
|
<li><a>弹框<span class="fa arrow"></span></a>
|
||||||
<ul class="nav nav-third-level">
|
<ul class="nav nav-third-level">
|
||||||
<li><a class="menuItem" th:href="@{/demo/modal/dialog}">模态窗口</a></li>
|
<li><a class="menuItem" th:href="@{/demo/modal/dialog}">模态窗口</a></li>
|
||||||
<li><a class="menuItem" th:href="@{/demo/modal/layer}">弹层组件</a></li>
|
<li><a class="menuItem" th:href="@{/demo/modal/layer}">弹层组件</a></li>
|
||||||
<li><a class="menuItem" th:href="@{/demo/modal/table}">弹层表格</a></li>
|
<li><a class="menuItem" th:href="@{/demo/modal/table}">弹层表格</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li> <a>操作<span class="fa arrow"></span></a>
|
<li><a>操作<span class="fa arrow"></span></a>
|
||||||
<ul class="nav nav-third-level">
|
<ul class="nav nav-third-level">
|
||||||
<li><a class="menuItem" th:href="@{/demo/operate/table}">表格</a></li>
|
<li><a class="menuItem" th:href="@{/demo/operate/table}">表格</a></li>
|
||||||
<li><a class="menuItem" th:href="@{/demo/operate/other}">其他</a></li>
|
<li><a class="menuItem" th:href="@{/demo/operate/other}">其他</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li> <a>报表<span class="fa arrow"></span></a>
|
<li><a>报表<span class="fa arrow"></span></a>
|
||||||
<ul class="nav nav-third-level">
|
<ul class="nav nav-third-level">
|
||||||
<li><a class="menuItem" th:href="@{/demo/report/echarts}">百度ECharts</a></li>
|
<li><a class="menuItem" th:href="@{/demo/report/echarts}">百度ECharts</a></li>
|
||||||
<li><a class="menuItem" th:href="@{/demo/report/peity}">peity</a></li>
|
<li><a class="menuItem" th:href="@{/demo/report/peity}">peity</a></li>
|
||||||
|
|
@ -148,7 +168,7 @@
|
||||||
<li><a class="menuItem" th:href="@{/demo/report/metrics}">图表组合</a></li>
|
<li><a class="menuItem" th:href="@{/demo/report/metrics}">图表组合</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li> <a>图标<span class="fa arrow"></span></a>
|
<li><a>图标<span class="fa arrow"></span></a>
|
||||||
<ul class="nav nav-third-level">
|
<ul class="nav nav-third-level">
|
||||||
<li><a class="menuItem" th:href="@{/demo/icon/fontawesome}">Font Awesome</a></li>
|
<li><a class="menuItem" th:href="@{/demo/icon/fontawesome}">Font Awesome</a></li>
|
||||||
<li><a class="menuItem" th:href="@{/demo/icon/glyphicons}">Glyphicons</a></li>
|
<li><a class="menuItem" th:href="@{/demo/icon/glyphicons}">Glyphicons</a></li>
|
||||||
|
|
@ -188,12 +208,17 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<ul class="nav navbar-top-links navbar-right welcome-message">
|
<ul class="nav navbar-top-links navbar-right welcome-message">
|
||||||
<li><a data-toggle="tooltip" data-trigger="hover" data-placement="bottom" title="开发文档" href="http://doc.ruoyi.vip/ruoyi" target="_blank"><i class="fa fa-question-circle"></i> 文档</a></li>
|
<li><a data-toggle="tooltip" data-trigger="hover" data-placement="bottom" title="开发文档"
|
||||||
<li><a data-toggle="tooltip" data-trigger="hover" data-placement="bottom" title="锁定屏幕" href="#" id="lockScreen"><i class="fa fa-lock"></i> 锁屏</a></li>
|
href="http://doc.ruoyi.vip/ruoyi" target="_blank"><i class="fa fa-question-circle"></i>
|
||||||
<li><a data-toggle="tooltip" data-trigger="hover" data-placement="bottom" title="全屏显示" href="#" id="fullScreen"><i class="fa fa-arrows-alt"></i> 全屏</a></li>
|
文档</a></li>
|
||||||
|
<li><a data-toggle="tooltip" data-trigger="hover" data-placement="bottom" title="锁定屏幕" href="#"
|
||||||
|
id="lockScreen"><i class="fa fa-lock"></i> 锁屏</a></li>
|
||||||
|
<li><a data-toggle="tooltip" data-trigger="hover" data-placement="bottom" title="全屏显示" href="#"
|
||||||
|
id="fullScreen"><i class="fa fa-arrows-alt"></i> 全屏</a></li>
|
||||||
<li class="dropdown user-menu">
|
<li class="dropdown user-menu">
|
||||||
<a href="javascript:void(0)" class="dropdown-toggle" data-hover="dropdown">
|
<a href="javascript:void(0)" class="dropdown-toggle" data-hover="dropdown">
|
||||||
<img th:src="(${#strings.isEmpty(user.avatar)}) ? @{/img/profile.jpg} : @{${user.avatar}}" th:onerror="this.src='img/profile.jpg'" class="user-image">
|
<img th:src="(${#strings.isEmpty(user.avatar)}) ? @{/img/profile.jpg} : @{${user.avatar}}"
|
||||||
|
th:onerror="this.src='img/profile.jpg'" class="user-image">
|
||||||
<span class="hidden-xs">[[${#strings.defaultString(user.userName, '-')}]]</span>
|
<span class="hidden-xs">[[${#strings.defaultString(user.userName, '-')}]]</span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
|
|
@ -240,13 +265,14 @@
|
||||||
|
|
||||||
<a id="ax_close_max" class="ax_close_max" href="#" title="关闭全屏"> <i class="fa fa-times-circle-o"></i> </a>
|
<a id="ax_close_max" class="ax_close_max" href="#" title="关闭全屏"> <i class="fa fa-times-circle-o"></i> </a>
|
||||||
|
|
||||||
<div class="row mainContent" id="content-main" th:style="${#bools.isFalse(ignoreFooter)} ? |height: calc(100% - 91px)|">
|
<div class="row mainContent" id="content-main"
|
||||||
|
th:style="${#bools.isFalse(ignoreFooter)} ? |height: calc(100% - 91px)|">
|
||||||
<iframe class="RuoYi_iframe" name="iframe0" width="100%" height="100%" th:data-id="@{/system/main}"
|
<iframe class="RuoYi_iframe" name="iframe0" width="100%" height="100%" th:data-id="@{/system/main}"
|
||||||
th:src="@{/system/main}" frameborder="0" seamless></iframe>
|
th:src="@{/system/main}" frameborder="0" seamless></iframe>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div th:if="${ignoreFooter}" class="footer">
|
<div th:if="${ignoreFooter}" class="footer">
|
||||||
<div class="pull-right">© [[${copyrightYear}]] RuoYi Copyright </div>
|
<div class="pull-right">© [[${copyrightYear}]] RuoYi Copyright</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--右侧部分结束-->
|
<!--右侧部分结束-->
|
||||||
|
|
@ -264,86 +290,91 @@
|
||||||
<script th:src="@{/ruoyi/index.js?v=20201208}"></script>
|
<script th:src="@{/ruoyi/index.js?v=20201208}"></script>
|
||||||
<script th:src="@{/ajax/libs/fullscreen/jquery.fullscreen.js}"></script>
|
<script th:src="@{/ajax/libs/fullscreen/jquery.fullscreen.js}"></script>
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
window.history.forward(1);
|
window.history.forward(1);
|
||||||
var ctx = [[@{/}]];
|
var ctx = [[@{/}]];
|
||||||
var lockscreen = [[${session.lockscreen}]];
|
var lockscreen = [[${session.lockscreen}]];
|
||||||
if(lockscreen){window.top.location=ctx+"lockscreen";}
|
if (lockscreen) {
|
||||||
// 皮肤缓存
|
window.top.location = ctx + "lockscreen";
|
||||||
var skin = storage.get("skin");
|
}
|
||||||
// history(表示去掉地址的#)否则地址以"#"形式展示
|
// 皮肤缓存
|
||||||
var mode = "history";
|
var skin = storage.get("skin");
|
||||||
// 历史访问路径缓存
|
// history(表示去掉地址的#)否则地址以"#"形式展示
|
||||||
var historyPath = storage.get("historyPath");
|
var mode = "history";
|
||||||
// 是否页签与菜单联动
|
// 历史访问路径缓存
|
||||||
var isLinkage = true;
|
var historyPath = storage.get("historyPath");
|
||||||
|
// 是否页签与菜单联动
|
||||||
|
var isLinkage = true;
|
||||||
|
|
||||||
// 本地主题优先,未设置取系统配置
|
// 本地主题优先,未设置取系统配置
|
||||||
if($.common.isNotEmpty(skin)){
|
if ($.common.isNotEmpty(skin)) {
|
||||||
$("body").addClass(skin.split('|')[0]);
|
$("body").addClass(skin.split('|')[0]);
|
||||||
$("body").addClass(skin.split('|')[1]);
|
$("body").addClass(skin.split('|')[1]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$("body").addClass([[${sideTheme}]]);
|
$("body").addClass([[${sideTheme}]]);
|
||||||
$("body").addClass([[${skinName}]]);
|
$("body").addClass([[${skinName}]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 用户管理-重置密码 */
|
/* 用户管理-重置密码 */
|
||||||
function resetPwd() {
|
function resetPwd() {
|
||||||
var url = ctx + 'system/user/profile/resetPwd';
|
var url = ctx + 'system/user/profile/resetPwd';
|
||||||
$.modal.open("重置密码", url, '770', '380');
|
$.modal.open("重置密码", url, '770', '380');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 切换主题 */
|
/* 切换主题 */
|
||||||
function switchSkin() {
|
function switchSkin() {
|
||||||
layer.open({
|
layer.open({
|
||||||
type : 2,
|
type: 2,
|
||||||
shadeClose : true,
|
shadeClose: true,
|
||||||
title : "切换主题",
|
title: "切换主题",
|
||||||
area : ["530px", "386px"],
|
area: ["530px", "386px"],
|
||||||
content : [ctx + "system/switchSkin", 'no']
|
content: [ctx + "system/switchSkin", 'no']
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 切换菜单 */
|
/* 切换菜单 */
|
||||||
function toggleMenu() {
|
function toggleMenu() {
|
||||||
$.modal.confirm("确认要切换成横向菜单吗?", function() {
|
$.modal.confirm("确认要切换成横向菜单吗?", function () {
|
||||||
$.get(ctx + 'system/menuStyle/topnav', function(result) {
|
$.get(ctx + 'system/menuStyle/topnav', function (result) {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 刷新时访问路径页签 */
|
/** 刷新时访问路径页签 */
|
||||||
function applyPath(url) {
|
function applyPath(url) {
|
||||||
$('a[href$="' + decodeURI(url) + '"]').click();
|
$('a[href$="' + decodeURI(url) + '"]').click();
|
||||||
if (!$('a[href$="' + url + '"]').hasClass("noactive")) {
|
if (!$('a[href$="' + url + '"]').hasClass("noactive")) {
|
||||||
$('a[href$="' + url + '"]').parent("li").addClass("selected").parents("li").addClass("active").end().parents("ul").addClass("in");
|
$('a[href$="' + url + '"]').parent("li").addClass("selected").parents("li").addClass("active").end().parents("ul").addClass("in");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function() {
|
$(function () {
|
||||||
if($.common.equals("history", mode) && window.performance.navigation.type == 1) {
|
if ($.common.equals("history", mode) && window.performance.navigation.type == 1) {
|
||||||
var url = storage.get('publicPath');
|
var url = storage.get('publicPath');
|
||||||
if ($.common.isNotEmpty(url)) {
|
if ($.common.isNotEmpty(url)) {
|
||||||
applyPath(url);
|
applyPath(url);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
var hash = location.hash;
|
var hash = location.hash;
|
||||||
if ($.common.isNotEmpty(hash)) {
|
if ($.common.isNotEmpty(hash)) {
|
||||||
var url = hash.substring(1, hash.length);
|
var url = hash.substring(1, hash.length);
|
||||||
applyPath(url);
|
applyPath(url);
|
||||||
} else {
|
}
|
||||||
if($.common.equals("history", mode)) {
|
else {
|
||||||
|
if ($.common.equals("history", mode)) {
|
||||||
storage.set('publicPath', "");
|
storage.set('publicPath', "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 初始密码提示 */
|
/* 初始密码提示 */
|
||||||
if([[${isDefaultModifyPwd}]]) {
|
if ([[${isDefaultModifyPwd}]]) {
|
||||||
layer.confirm("您的密码还是初始密码,请修改密码!", {
|
layer.confirm("您的密码还是初始密码,请修改密码!", {
|
||||||
icon: 0,
|
icon: 0,
|
||||||
title: "安全提示",
|
title: "安全提示",
|
||||||
btn: ['确认' , '取消'],
|
btn: ['确认', '取消'],
|
||||||
offset: ['30%']
|
offset: ['30%']
|
||||||
}, function (index) {
|
}, function (index) {
|
||||||
resetPwd();
|
resetPwd();
|
||||||
|
|
@ -352,11 +383,11 @@ $(function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 过期密码提示 */
|
/* 过期密码提示 */
|
||||||
if([[${isPasswordExpired}]]) {
|
if ([[${isPasswordExpired}]]) {
|
||||||
layer.confirm("您的密码已过期,请尽快修改密码!", {
|
layer.confirm("您的密码已过期,请尽快修改密码!", {
|
||||||
icon: 0,
|
icon: 0,
|
||||||
title: "安全提示",
|
title: "安全提示",
|
||||||
btn: ['确认' , '取消'],
|
btn: ['确认', '取消'],
|
||||||
offset: ['30%']
|
offset: ['30%']
|
||||||
}, function (index) {
|
}, function (index) {
|
||||||
resetPwd();
|
resetPwd();
|
||||||
|
|
@ -364,7 +395,7 @@ $(function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$("[data-toggle='tooltip']").tooltip();
|
$("[data-toggle='tooltip']").tooltip();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,91 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<!--360浏览器优先以webkit内核解析-->
|
<!-- 360浏览器优先以webkit内核解析 -->
|
||||||
<title>锁定屏幕</title>
|
<title>锁定屏幕</title>
|
||||||
<link th:href="@{favicon.ico}" rel="shortcut icon"/>
|
<link th:href="@{favicon.ico}" rel="shortcut icon"/>
|
||||||
<link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
|
<link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
|
||||||
<link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
|
<link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
|
||||||
<style>.lockscreen{background:#d2d6de;height:auto;}.lockscreen .lockscreen-name{text-align:center;font-weight:600;margin-top:50px;margin-bottom:30px;}.lockscreen-wrapper{max-width:400px;margin:10% auto;z-index:800;position:relative;}.lockscreen .lockscreen-name{text-align:center;font-weight:600;margin-top:50px;margin-bottom:30px;}.lockscreen-item{border-radius:4px;padding:0;background:#fff;position:relative;margin:10px auto 30px auto;width:290px}.lockscreen-image{border-radius:50%;position:absolute;left:-10px;top:-25px;background:#fff;padding:5px;z-index:10}.lockscreen-image>img{border-radius:50%;width:70px;height:70px}.lockscreen-credentials{margin-left:70px}.lockscreen-credentials .form-control{border:0}.lockscreen-credentials .btn{background-color:#fff;border:0;padding:0 10px}.lockscreen-footer{margin-top:150px}.lockscreen-time{width:100%;color:#fff;font-size:60px;display:inline-block;text-align:center;font-family:'Open Sans',sans-serif;font-weight:300;}</style>
|
<style>
|
||||||
|
.lockscreen {
|
||||||
|
background: #d2d6de;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lockscreen .lockscreen-name {
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-top: 50px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lockscreen-wrapper {
|
||||||
|
max-width: 400px;
|
||||||
|
margin: 10% auto;
|
||||||
|
z-index: 800;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lockscreen .lockscreen-name {
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-top: 50px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lockscreen-item {
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 0;
|
||||||
|
background: #fff;
|
||||||
|
position: relative;
|
||||||
|
margin: 10px auto 30px auto;
|
||||||
|
width: 290px
|
||||||
|
}
|
||||||
|
|
||||||
|
.lockscreen-image {
|
||||||
|
border-radius: 50%;
|
||||||
|
position: absolute;
|
||||||
|
left: -10px;
|
||||||
|
top: -25px;
|
||||||
|
background: #fff;
|
||||||
|
padding: 5px;
|
||||||
|
z-index: 10
|
||||||
|
}
|
||||||
|
|
||||||
|
.lockscreen-image > img {
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 70px;
|
||||||
|
height: 70px
|
||||||
|
}
|
||||||
|
|
||||||
|
.lockscreen-credentials {
|
||||||
|
margin-left: 70px
|
||||||
|
}
|
||||||
|
|
||||||
|
.lockscreen-credentials .form-control {
|
||||||
|
border: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.lockscreen-credentials .btn {
|
||||||
|
background-color: #fff;
|
||||||
|
border: 0;
|
||||||
|
padding: 0 10px
|
||||||
|
}
|
||||||
|
|
||||||
|
.lockscreen-footer {
|
||||||
|
margin-top: 150px
|
||||||
|
}
|
||||||
|
|
||||||
|
.lockscreen-time {
|
||||||
|
width: 100%;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 60px;
|
||||||
|
display: inline-block;
|
||||||
|
text-align: center;
|
||||||
|
font-family: 'Open Sans', sans-serif;
|
||||||
|
font-weight: 300;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body class="lockscreen">
|
<body class="lockscreen">
|
||||||
<div class="lockscreen-wrapper">
|
<div class="lockscreen-wrapper">
|
||||||
|
|
@ -17,13 +96,15 @@
|
||||||
|
|
||||||
<div class="lockscreen-item">
|
<div class="lockscreen-item">
|
||||||
<div class="lockscreen-image">
|
<div class="lockscreen-image">
|
||||||
<img th:src="(${#strings.isEmpty(user.avatar)}) ? @{/img/profile.jpg} : @{${user.avatar}}" th:onerror="this.src='img/profile.jpg'" class="img-circle" alt="User Image">
|
<img th:src="(${#strings.isEmpty(user.avatar)}) ? @{/img/profile.jpg} : @{${user.avatar}}"
|
||||||
|
th:onerror="this.src='img/profile.jpg'" class="img-circle" alt="User Image">
|
||||||
</div>
|
</div>
|
||||||
<form class="lockscreen-credentials" method="post" action="#" onsubmit="return false;">
|
<form class="lockscreen-credentials" method="post" action="#" onsubmit="return false;">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="password" name="password" autocomplete="off" class="form-control" placeholder="密码">
|
<input type="password" name="password" autocomplete="off" class="form-control" placeholder="密码">
|
||||||
<div class="input-group-btn">
|
<div class="input-group-btn">
|
||||||
<button type="button" class="btn" onclick="unlock()"><i class="fa fa-arrow-right text-muted"></i></button>
|
<button type="button" class="btn" onclick="unlock()"><i class="fa fa-arrow-right text-muted"></i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
@ -42,15 +123,15 @@
|
||||||
</body>
|
</body>
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
var ctx = [[@{/}]];
|
var ctx = [[@{/}]];
|
||||||
Date.prototype.format = function(fmt) {
|
Date.prototype.format = function (fmt) {
|
||||||
var o = {
|
var o = {
|
||||||
"M+" : this.getMonth()+1, //月份
|
"M+": this.getMonth() + 1, //月份
|
||||||
"d+" : this.getDate(), //日
|
"d+": this.getDate(), //日
|
||||||
"h+" : this.getHours(), //小时
|
"h+": this.getHours(), //小时
|
||||||
"m+" : this.getMinutes(), //分
|
"m+": this.getMinutes(), //分
|
||||||
"s+" : this.getSeconds(), //秒
|
"s+": this.getSeconds(), //秒
|
||||||
"q+" : Math.floor((this.getMonth()+3)/3), //季度
|
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
|
||||||
"S" : this.getMilliseconds() //毫秒
|
"S": this.getMilliseconds() //毫秒
|
||||||
};
|
};
|
||||||
|
|
||||||
if (/(y+)/.test(fmt)) {
|
if (/(y+)/.test(fmt)) {
|
||||||
|
|
@ -65,16 +146,16 @@
|
||||||
return fmt;
|
return fmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function() {
|
$(function () {
|
||||||
$('.lockscreen-time').text((new Date()).format('hh:mm:ss'));
|
$('.lockscreen-time').text((new Date()).format('hh:mm:ss'));
|
||||||
setInterval(function() {
|
setInterval(function () {
|
||||||
$('.lockscreen-time').text((new Date()).format('hh:mm:ss'));
|
$('.lockscreen-time').text((new Date()).format('hh:mm:ss'));
|
||||||
}, 500);
|
}, 500);
|
||||||
init();
|
init();
|
||||||
animate();
|
animate();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).keydown(function(event) {
|
$(document).keydown(function (event) {
|
||||||
if (event.keyCode == 13) {
|
if (event.keyCode == 13) {
|
||||||
unlock();
|
unlock();
|
||||||
}
|
}
|
||||||
|
|
@ -93,14 +174,15 @@
|
||||||
url: ctx + "unlockscreen",
|
url: ctx + "unlockscreen",
|
||||||
type: "post",
|
type: "post",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: { password: password },
|
data: {password: password},
|
||||||
beforeSend: function() {
|
beforeSend: function () {
|
||||||
index = layer.load(2, {shade: false});
|
index = layer.load(2, {shade: false});
|
||||||
},
|
},
|
||||||
success: function(result) {
|
success: function (result) {
|
||||||
if (result.code == web_status.SUCCESS) {
|
if (result.code == web_status.SUCCESS) {
|
||||||
location.href = ctx + 'index';
|
location.href = ctx + 'index';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$.modal.msg(result.msg);
|
$.modal.msg(result.msg);
|
||||||
$("input[name='password']").val("");
|
$("input[name='password']").val("");
|
||||||
}
|
}
|
||||||
|
|
@ -108,28 +190,29 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$.ajax(config);
|
$.ajax(config);
|
||||||
};
|
}
|
||||||
|
|
||||||
var container;
|
var container;
|
||||||
var camera, scene, projector, renderer;
|
var camera, scene, projector, renderer;
|
||||||
var PI2 = Math.PI * 2;
|
var PI2 = Math.PI * 2;
|
||||||
|
|
||||||
var programFill = function(context) {
|
var programFill = function (context) {
|
||||||
context.beginPath();
|
context.beginPath();
|
||||||
context.arc(0, 0, 1, 0, PI2, true);
|
context.arc(0, 0, 1, 0, PI2, true);
|
||||||
context.closePath();
|
context.closePath();
|
||||||
context.fill();
|
context.fill();
|
||||||
};
|
};
|
||||||
|
|
||||||
var programStroke = function(context) {
|
var programStroke = function (context) {
|
||||||
context.lineWidth = 0.05;
|
context.lineWidth = 0.05;
|
||||||
context.beginPath();
|
context.beginPath();
|
||||||
context.arc(0, 0, 1, 0, PI2, true);
|
context.arc(0, 0, 1, 0, PI2, true);
|
||||||
context.closePath();
|
context.closePath();
|
||||||
context.stroke();
|
context.stroke();
|
||||||
};
|
}
|
||||||
|
|
||||||
|
var mouse = {x: 0, y: 0}, INTERSECTED;
|
||||||
|
|
||||||
var mouse = { x: 0, y: 0 }, INTERSECTED;
|
|
||||||
function init() {
|
function init() {
|
||||||
container = document.createElement('div');
|
container = document.createElement('div');
|
||||||
container.id = 'bgc';
|
container.id = 'bgc';
|
||||||
|
|
@ -143,7 +226,10 @@
|
||||||
scene = new THREE.Scene();
|
scene = new THREE.Scene();
|
||||||
|
|
||||||
for (var i = 0; i < 100; i++) {
|
for (var i = 0; i < 100; i++) {
|
||||||
var particle = new THREE.Particle(new THREE.ParticleCanvasMaterial({ color: Math.random() * 0x808080 + 0x808080, program: programStroke }));
|
var particle = new THREE.Particle(new THREE.ParticleCanvasMaterial({
|
||||||
|
color: Math.random() * 0x808080 + 0x808080,
|
||||||
|
program: programStroke
|
||||||
|
}));
|
||||||
particle.position.x = Math.random() * 800 - 400;
|
particle.position.x = Math.random() * 800 - 400;
|
||||||
particle.position.y = Math.random() * 800 - 400;
|
particle.position.y = Math.random() * 800 - 400;
|
||||||
particle.position.z = Math.random() * 800 - 400;
|
particle.position.z = Math.random() * 800 - 400;
|
||||||
|
|
@ -156,24 +242,24 @@
|
||||||
container.appendChild(renderer.domElement);
|
container.appendChild(renderer.domElement);
|
||||||
document.addEventListener('mousemove', onDocumentMouseMove, false);
|
document.addEventListener('mousemove', onDocumentMouseMove, false);
|
||||||
window.addEventListener('resize', onWindowResize, false);
|
window.addEventListener('resize', onWindowResize, false);
|
||||||
};
|
}
|
||||||
|
|
||||||
function onWindowResize() {
|
function onWindowResize() {
|
||||||
camera.aspect = window.innerWidth / window.innerHeight;
|
camera.aspect = window.innerWidth / window.innerHeight;
|
||||||
camera.updateProjectionMatrix();
|
camera.updateProjectionMatrix();
|
||||||
renderer.setSize(window.innerWidth, window.innerHeight - 10);
|
renderer.setSize(window.innerWidth, window.innerHeight - 10);
|
||||||
};
|
}
|
||||||
|
|
||||||
function onDocumentMouseMove(event) {
|
function onDocumentMouseMove(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
|
mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
|
||||||
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
|
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
|
||||||
};
|
}
|
||||||
|
|
||||||
function animate() {
|
function animate() {
|
||||||
requestAnimationFrame(animate);
|
requestAnimationFrame(animate);
|
||||||
render();
|
render();
|
||||||
};
|
}
|
||||||
|
|
||||||
var radius = 600;
|
var radius = 600;
|
||||||
var theta = 0;
|
var theta = 0;
|
||||||
|
|
@ -198,7 +284,8 @@
|
||||||
INTERSECTED = intersects[0].object;
|
INTERSECTED = intersects[0].object;
|
||||||
INTERSECTED.material.program = programFill;
|
INTERSECTED.material.program = programFill;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (INTERSECTED) INTERSECTED.material.program = programStroke;
|
if (INTERSECTED) INTERSECTED.material.program = programStroke;
|
||||||
INTERSECTED = null;
|
INTERSECTED = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,20 @@
|
||||||
<!-- 避免IE使用兼容模式 -->
|
<!-- 避免IE使用兼容模式 -->
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<link rel="shortcut icon" href="../static/favicon.ico" th:href="@{favicon.ico}"/>
|
<link rel="shortcut icon" href="../static/favicon.ico" th:href="@{favicon.ico}"/>
|
||||||
<style type="text/css">label.error { position:inherit; }</style>
|
<style type="text/css">
|
||||||
|
label.error {
|
||||||
|
position: inherit;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<script>
|
<script>
|
||||||
if(window.top!==window.self){alert('未登录或登录超时。请重新登录');window.top.location=window.location};
|
if (window.top !== window.self) {
|
||||||
|
alert('未登录或登录超时。请重新登录');
|
||||||
|
window.top.location = window.location
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body class="signin">
|
<body class="signin">
|
||||||
<div class="signinpanel">
|
<div class="signinpanel">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-7">
|
<div class="col-sm-7">
|
||||||
<div class="signin-info">
|
<div class="signin-info">
|
||||||
|
|
@ -44,11 +51,15 @@
|
||||||
<form id="signupForm" autocomplete="off">
|
<form id="signupForm" autocomplete="off">
|
||||||
<h4 class="no-margins">登录:</h4>
|
<h4 class="no-margins">登录:</h4>
|
||||||
<p class="m-t-md">你若不离不弃,我必生死相依</p>
|
<p class="m-t-md">你若不离不弃,我必生死相依</p>
|
||||||
<input type="text" name="username" class="form-control uname" placeholder="用户名" value="admin" />
|
<input type="text" name="username" class="form-control uname" placeholder="用户名" value="admin"/>
|
||||||
<input type="password" name="password" class="form-control pword" placeholder="密码" value="admin123" />
|
<input type="password" name="password" class="form-control pword" placeholder="密码" value="admin123"/>
|
||||||
<div class="row m-t" th:if="${captchaEnabled==true}">
|
<div class="row m-t" th:if="${captchaEnabled==true}">
|
||||||
<div class="col-xs-6">
|
<div class="col-xs-6">
|
||||||
<input type="text" name="validateCode" class="form-control code" placeholder="验证码" maxlength="5" />
|
<input type="text"
|
||||||
|
name="validateCode"
|
||||||
|
class="form-control code"
|
||||||
|
placeholder="验证码"
|
||||||
|
maxlength="5"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-6">
|
<div class="col-xs-6">
|
||||||
<a href="javascript:void(0);" title="点击更换验证码">
|
<a href="javascript:void(0);" title="点击更换验证码">
|
||||||
|
|
@ -68,14 +79,16 @@
|
||||||
Copyright © 2018-2021 ruoyi.vip All Rights Reserved. <br>
|
Copyright © 2018-2021 ruoyi.vip All Rights Reserved. <br>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script th:inline="javascript"> var ctx = [[@{/}]]; var captchaType = [[${captchaType}]]; </script>
|
<script th:inline="javascript"> var ctx = [[@{/}]]; var captchaType = [[${captchaType}]]; </script>
|
||||||
<!-- 全局js -->
|
<!-- 全局js -->
|
||||||
<script src="../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
|
<script src="../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
|
||||||
<script src="../static/js/bootstrap.min.js" th:src="@{/js/bootstrap.min.js}"></script>
|
<script src="../static/js/bootstrap.min.js" th:src="@{/js/bootstrap.min.js}"></script>
|
||||||
<!-- 验证插件 -->
|
<!-- 验证插件 -->
|
||||||
<script src="../static/ajax/libs/validate/jquery.validate.min.js" th:src="@{/ajax/libs/validate/jquery.validate.min.js}"></script>
|
<script src="../static/ajax/libs/validate/jquery.validate.min.js"
|
||||||
<script src="../static/ajax/libs/validate/messages_zh.min.js" th:src="@{/ajax/libs/validate/messages_zh.min.js}"></script>
|
th:src="@{/ajax/libs/validate/jquery.validate.min.js}"></script>
|
||||||
|
<script src="../static/ajax/libs/validate/messages_zh.min.js"
|
||||||
|
th:src="@{/ajax/libs/validate/messages_zh.min.js}"></script>
|
||||||
<script src="../static/ajax/libs/layer/layer.min.js" th:src="@{/ajax/libs/layer/layer.min.js}"></script>
|
<script src="../static/ajax/libs/layer/layer.min.js" th:src="@{/ajax/libs/layer/layer.min.js}"></script>
|
||||||
<script src="../static/ajax/libs/blockUI/jquery.blockUI.js" th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>
|
<script src="../static/ajax/libs/blockUI/jquery.blockUI.js" th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>
|
||||||
<script src="../static/ruoyi/js/ry-ui.js" th:src="@{/ruoyi/js/ry-ui.js?v=4.6.0}"></script>
|
<script src="../static/ruoyi/js/ry-ui.js" th:src="@{/ruoyi/js/ry-ui.js?v=4.6.0}"></script>
|
||||||
|
|
|
||||||
|
|
@ -12,15 +12,26 @@
|
||||||
<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
|
<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
|
||||||
<link th:href="@{/css/style.css}" rel="stylesheet"/>
|
<link th:href="@{/css/style.css}" rel="stylesheet"/>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.list-unstyled{margin:10px;}
|
.list-unstyled {
|
||||||
.full-opacity-hover{opacity:1;filter:alpha(opacity=1);border:1px solid #fff}
|
margin: 10px;
|
||||||
.full-opacity-hover:hover{border:1px solid #f00;}
|
}
|
||||||
|
|
||||||
|
.full-opacity-hover {
|
||||||
|
opacity: 1;
|
||||||
|
filter: alpha(opacity=1);
|
||||||
|
border: 1px solid #fff
|
||||||
|
}
|
||||||
|
|
||||||
|
.full-opacity-hover:hover {
|
||||||
|
border: 1px solid #f00;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body class="gray-bg">
|
<body class="gray-bg">
|
||||||
<ul class="list-unstyled clearfix">
|
<ul class="list-unstyled clearfix">
|
||||||
<li style="float:left; width: 33.33333%; padding: 5px;">
|
<li style="float:left; width: 33.33333%; padding: 5px;">
|
||||||
<a href="javascript:" data-skin="skin-blue|theme-dark" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
<a href="javascript:" data-skin="skin-blue|theme-dark"
|
||||||
|
style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
||||||
<span style="width: 20%; float: left; height: 13px; background: #367fa9"></span>
|
<span style="width: 20%; float: left; height: 13px; background: #367fa9"></span>
|
||||||
<span style="width: 80%; float: left; height: 13px; background: #3c8dbc"></span>
|
<span style="width: 80%; float: left; height: 13px; background: #3c8dbc"></span>
|
||||||
<span style="width: 20%; float: left; height: 30px; background: #2f4050"></span>
|
<span style="width: 20%; float: left; height: 30px; background: #2f4050"></span>
|
||||||
|
|
@ -30,7 +41,8 @@
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li style="float:left; width: 33.33333%; padding: 5px;">
|
<li style="float:left; width: 33.33333%; padding: 5px;">
|
||||||
<a href="javascript:" data-skin="skin-green|theme-dark" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
<a href="javascript:" data-skin="skin-green|theme-dark"
|
||||||
|
style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
||||||
<span style="width: 20%; float: left; height: 13px; background: #008d4c"></span>
|
<span style="width: 20%; float: left; height: 13px; background: #008d4c"></span>
|
||||||
<span style="width: 80%; float: left; height: 13px; background: #00a65a"></span>
|
<span style="width: 80%; float: left; height: 13px; background: #00a65a"></span>
|
||||||
<span style="width: 20%; float: left; height: 30px; background: #222d32"></span>
|
<span style="width: 20%; float: left; height: 30px; background: #222d32"></span>
|
||||||
|
|
@ -40,7 +52,8 @@
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li style="float:left; width: 33.33333%; padding: 5px;">
|
<li style="float:left; width: 33.33333%; padding: 5px;">
|
||||||
<a href="javascript:" data-skin="skin-purple|theme-dark" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
<a href="javascript:" data-skin="skin-purple|theme-dark"
|
||||||
|
style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
||||||
<span style="width: 20%; float: left; height: 13px; background: #555299"></span>
|
<span style="width: 20%; float: left; height: 13px; background: #555299"></span>
|
||||||
<span style="width: 80%; float: left; height: 13px; background: #605ca8"></span>
|
<span style="width: 80%; float: left; height: 13px; background: #605ca8"></span>
|
||||||
<span style="width: 20%; float: left; height: 30px; background: #222d32"></span>
|
<span style="width: 20%; float: left; height: 30px; background: #222d32"></span>
|
||||||
|
|
@ -50,7 +63,8 @@
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li style="float:left; width: 33.33333%; padding: 5px;">
|
<li style="float:left; width: 33.33333%; padding: 5px;">
|
||||||
<a href="javascript:" data-skin="skin-red|theme-dark" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
<a href="javascript:" data-skin="skin-red|theme-dark"
|
||||||
|
style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
||||||
<span style="width: 20%; float: left; height: 13px; background: #dd4b39"></span>
|
<span style="width: 20%; float: left; height: 13px; background: #dd4b39"></span>
|
||||||
<span style="width: 80%; float: left; height: 13px; background: #d73925"></span>
|
<span style="width: 80%; float: left; height: 13px; background: #d73925"></span>
|
||||||
<span style="width: 20%; float: left; height: 30px; background: #222d32"></span>
|
<span style="width: 20%; float: left; height: 30px; background: #222d32"></span>
|
||||||
|
|
@ -60,7 +74,8 @@
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li style="float:left; width: 33.33333%; padding: 5px;">
|
<li style="float:left; width: 33.33333%; padding: 5px;">
|
||||||
<a href="javascript:" data-skin="skin-yellow|theme-dark" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
<a href="javascript:" data-skin="skin-yellow|theme-dark"
|
||||||
|
style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
||||||
<span style="width: 20%; float: left; height: 13px; background: #f39c12"></span>
|
<span style="width: 20%; float: left; height: 13px; background: #f39c12"></span>
|
||||||
<span style="width: 80%; float: left; height: 13px; background: #e08e0b"></span>
|
<span style="width: 80%; float: left; height: 13px; background: #e08e0b"></span>
|
||||||
<span style="width: 20%; float: left; height: 30px; background: #222d32"></span>
|
<span style="width: 20%; float: left; height: 30px; background: #222d32"></span>
|
||||||
|
|
@ -70,7 +85,8 @@
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li style="float:left; width: 33.33333%; padding: 5px;">
|
<li style="float:left; width: 33.33333%; padding: 5px;">
|
||||||
<a href="javascript:" data-skin="skin-blue|theme-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
<a href="javascript:" data-skin="skin-blue|theme-light"
|
||||||
|
style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
||||||
<span style="width: 20%; float: left; height: 13px; background: #367fa9"></span>
|
<span style="width: 20%; float: left; height: 13px; background: #367fa9"></span>
|
||||||
<span style="width: 80%; float: left; height: 13px; background: #3c8dbc"></span>
|
<span style="width: 80%; float: left; height: 13px; background: #3c8dbc"></span>
|
||||||
<span style="width: 20%; float: left; height: 30px; background: #f9fafc"></span>
|
<span style="width: 20%; float: left; height: 30px; background: #f9fafc"></span>
|
||||||
|
|
@ -80,7 +96,8 @@
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li style="float:left; width: 33.33333%; padding: 5px;">
|
<li style="float:left; width: 33.33333%; padding: 5px;">
|
||||||
<a href="javascript:" data-skin="skin-green|theme-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
<a href="javascript:" data-skin="skin-green|theme-light"
|
||||||
|
style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
||||||
<span style="width: 20%; float: left; height: 13px; background: #008d4c"></span>
|
<span style="width: 20%; float: left; height: 13px; background: #008d4c"></span>
|
||||||
<span style="width: 80%; float: left; height: 13px; background: #00a65a"></span>
|
<span style="width: 80%; float: left; height: 13px; background: #00a65a"></span>
|
||||||
<span style="width: 20%; float: left; height: 30px; background: #f9fafc"></span>
|
<span style="width: 20%; float: left; height: 30px; background: #f9fafc"></span>
|
||||||
|
|
@ -90,7 +107,8 @@
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li style="float:left; width: 33.33333%; padding: 5px;">
|
<li style="float:left; width: 33.33333%; padding: 5px;">
|
||||||
<a href="javascript:" data-skin="skin-purple|theme-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
<a href="javascript:" data-skin="skin-purple|theme-light"
|
||||||
|
style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
||||||
<span style="width: 20%; float: left; height: 13px; background: #555299"></span>
|
<span style="width: 20%; float: left; height: 13px; background: #555299"></span>
|
||||||
<span style="width: 80%; float: left; height: 13px; background: #605ca8"></span>
|
<span style="width: 80%; float: left; height: 13px; background: #605ca8"></span>
|
||||||
<span style="width: 20%; float: left; height: 30px; background: #f9fafc"></span>
|
<span style="width: 20%; float: left; height: 30px; background: #f9fafc"></span>
|
||||||
|
|
@ -100,7 +118,8 @@
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li style="float:left; width: 33.33333%; padding: 5px;">
|
<li style="float:left; width: 33.33333%; padding: 5px;">
|
||||||
<a href="javascript:" data-skin="skin-red|theme-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
<a href="javascript:" data-skin="skin-red|theme-light"
|
||||||
|
style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
||||||
<span style="width: 20%; float: left; height: 13px; background: #dd4b39"></span>
|
<span style="width: 20%; float: left; height: 13px; background: #dd4b39"></span>
|
||||||
<span style="width: 80%; float: left; height: 13px; background: #d73925"></span>
|
<span style="width: 80%; float: left; height: 13px; background: #d73925"></span>
|
||||||
<span style="width: 20%; float: left; height: 30px; background: #f9fafc"></span>
|
<span style="width: 20%; float: left; height: 30px; background: #f9fafc"></span>
|
||||||
|
|
@ -110,7 +129,8 @@
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li style="float:left; width: 33.33333%; padding: 5px;">
|
<li style="float:left; width: 33.33333%; padding: 5px;">
|
||||||
<a href="javascript:" data-skin="skin-yellow|theme-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
<a href="javascript:" data-skin="skin-yellow|theme-light"
|
||||||
|
style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
||||||
<span style="width: 20%; float: left; height: 13px; background: #f39c12"></span>
|
<span style="width: 20%; float: left; height: 13px; background: #f39c12"></span>
|
||||||
<span style="width: 80%; float: left; height: 13px; background: #e08e0b"></span>
|
<span style="width: 80%; float: left; height: 13px; background: #e08e0b"></span>
|
||||||
<span style="width: 20%; float: left; height: 30px; background: #f9fafc"></span>
|
<span style="width: 20%; float: left; height: 30px; background: #f9fafc"></span>
|
||||||
|
|
@ -120,7 +140,8 @@
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li style="float:left; width: 33.33333%; padding: 5px;">
|
<li style="float:left; width: 33.33333%; padding: 5px;">
|
||||||
<a href="javascript:" data-skin="skin-blue|theme-blue" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
<a href="javascript:" data-skin="skin-blue|theme-blue"
|
||||||
|
style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
||||||
<span style="width: 20%; float: left; height: 13px; background: #367fa9"></span>
|
<span style="width: 20%; float: left; height: 13px; background: #367fa9"></span>
|
||||||
<span style="width: 80%; float: left; height: 13px; background: #3c8dbc"></span>
|
<span style="width: 80%; float: left; height: 13px; background: #3c8dbc"></span>
|
||||||
<span style="width: 20%; float: left; height: 30px; background: rgba(15,41,80,1)"></span>
|
<span style="width: 20%; float: left; height: 30px; background: rgba(15,41,80,1)"></span>
|
||||||
|
|
@ -129,7 +150,8 @@
|
||||||
<p class="text-center">蓝浅(新)</p>
|
<p class="text-center">蓝浅(新)</p>
|
||||||
</li>
|
</li>
|
||||||
<li style="float:left; width: 33.33333%; padding: 5px;">
|
<li style="float:left; width: 33.33333%; padding: 5px;">
|
||||||
<a href="javascript:" data-skin="skin-green|theme-blue" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
<a href="javascript:" data-skin="skin-green|theme-blue"
|
||||||
|
style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover">
|
||||||
<span style="width: 20%; float: left; height: 13px; background: #008d4c"></span>
|
<span style="width: 20%; float: left; height: 13px; background: #008d4c"></span>
|
||||||
<span style="width: 80%; float: left; height: 13px; background: #00a65a"></span>
|
<span style="width: 80%; float: left; height: 13px; background: #00a65a"></span>
|
||||||
<span style="width: 20%; float: left; height: 30px; background: rgba(15,41,80,1)"></span>
|
<span style="width: 20%; float: left; height: 30px; background: rgba(15,41,80,1)"></span>
|
||||||
|
|
@ -142,24 +164,24 @@
|
||||||
<script th:src="@{/js/jquery.min.js}"></script>
|
<script th:src="@{/js/jquery.min.js}"></script>
|
||||||
<script th:src="@{/ruoyi/js/common.js?v=4.6.0}"></script>
|
<script th:src="@{/ruoyi/js/common.js?v=4.6.0}"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//皮肤样式列表
|
// 皮肤样式列表
|
||||||
var skins = ["skin-blue", "skin-green", "skin-purple", "skin-red", "skin-yellow"];
|
var skins = ["skin-blue", "skin-green", "skin-purple", "skin-red", "skin-yellow"];
|
||||||
|
|
||||||
// 主题样式列表
|
// 主题样式列表
|
||||||
var themes = ["theme-dark", "theme-light", "theme-blue"];
|
var themes = ["theme-dark", "theme-light", "theme-blue"];
|
||||||
|
|
||||||
$("[data-skin]").on('click',
|
$("[data-skin]").on('click',
|
||||||
function(e) {
|
function (e) {
|
||||||
var skin = $(this).data('skin');
|
var skin = $(this).data('skin');
|
||||||
$.each(skins, function(i) {
|
$.each(skins, function (i) {
|
||||||
parent.$("body").removeClass(skins[i]);
|
parent.$("body").removeClass(skins[i]);
|
||||||
});
|
});
|
||||||
$.each(themes, function(i) {
|
$.each(themes, function (i) {
|
||||||
parent.$("body").removeClass(themes[i]);
|
parent.$("body").removeClass(themes[i]);
|
||||||
});
|
});
|
||||||
parent.$("body").addClass(skin.split('|')[0]);
|
parent.$("body").addClass(skin.split('|')[0]);
|
||||||
parent.$("body").addClass(skin.split('|')[1]);
|
parent.$("body").addClass(skin.split('|')[1]);
|
||||||
storage.set('skin', skin);
|
storage.set('skin', skin);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -10,107 +10,104 @@ import org.springframework.stereotype.Component;
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@ConfigurationProperties(prefix = "ruoyi")
|
@ConfigurationProperties(prefix = "ruoyi")
|
||||||
public class RuoYiConfig
|
public class RuoYiConfig {
|
||||||
{
|
|
||||||
/** 项目名称 */
|
/**
|
||||||
|
* 项目名称
|
||||||
|
*/
|
||||||
private static String name;
|
private static String name;
|
||||||
|
|
||||||
/** 版本 */
|
/**
|
||||||
|
* 版本
|
||||||
|
*/
|
||||||
private static String version;
|
private static String version;
|
||||||
|
|
||||||
/** 版权年份 */
|
/**
|
||||||
|
* 版权年份
|
||||||
|
*/
|
||||||
private static String copyrightYear;
|
private static String copyrightYear;
|
||||||
|
|
||||||
/** 实例演示开关 */
|
/**
|
||||||
|
* 实例演示开关
|
||||||
|
*/
|
||||||
private static boolean demoEnabled;
|
private static boolean demoEnabled;
|
||||||
|
|
||||||
/** 上传路径 */
|
/**
|
||||||
|
* 上传路径
|
||||||
|
*/
|
||||||
private static String profile;
|
private static String profile;
|
||||||
|
|
||||||
/** 获取地址开关 */
|
/**
|
||||||
|
* 获取地址开关
|
||||||
|
*/
|
||||||
private static boolean addressEnabled;
|
private static boolean addressEnabled;
|
||||||
|
|
||||||
public static String getName()
|
public static String getName() {
|
||||||
{
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name)
|
public void setName(String name) {
|
||||||
{
|
|
||||||
RuoYiConfig.name = name;
|
RuoYiConfig.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getVersion()
|
public static String getVersion() {
|
||||||
{
|
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVersion(String version)
|
public void setVersion(String version) {
|
||||||
{
|
|
||||||
RuoYiConfig.version = version;
|
RuoYiConfig.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getCopyrightYear()
|
public static String getCopyrightYear() {
|
||||||
{
|
|
||||||
return copyrightYear;
|
return copyrightYear;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCopyrightYear(String copyrightYear)
|
public void setCopyrightYear(String copyrightYear) {
|
||||||
{
|
|
||||||
RuoYiConfig.copyrightYear = copyrightYear;
|
RuoYiConfig.copyrightYear = copyrightYear;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDemoEnabled()
|
public static boolean isDemoEnabled() {
|
||||||
{
|
|
||||||
return demoEnabled;
|
return demoEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDemoEnabled(boolean demoEnabled)
|
public void setDemoEnabled(boolean demoEnabled) {
|
||||||
{
|
|
||||||
RuoYiConfig.demoEnabled = demoEnabled;
|
RuoYiConfig.demoEnabled = demoEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getProfile()
|
public static String getProfile() {
|
||||||
{
|
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProfile(String profile)
|
public void setProfile(String profile) {
|
||||||
{
|
|
||||||
RuoYiConfig.profile = profile;
|
RuoYiConfig.profile = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAddressEnabled()
|
public static boolean isAddressEnabled() {
|
||||||
{
|
|
||||||
return addressEnabled;
|
return addressEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAddressEnabled(boolean addressEnabled)
|
public void setAddressEnabled(boolean addressEnabled) {
|
||||||
{
|
|
||||||
RuoYiConfig.addressEnabled = addressEnabled;
|
RuoYiConfig.addressEnabled = addressEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取头像上传路径
|
* 获取头像上传路径
|
||||||
*/
|
*/
|
||||||
public static String getAvatarPath()
|
public static String getAvatarPath() {
|
||||||
{
|
|
||||||
return getProfile() + "/avatar";
|
return getProfile() + "/avatar";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取下载路径
|
* 获取下载路径
|
||||||
*/
|
*/
|
||||||
public static String getDownloadPath()
|
public static String getDownloadPath() {
|
||||||
{
|
|
||||||
return getProfile() + "/download/";
|
return getProfile() + "/download/";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取上传路径
|
* 获取上传路径
|
||||||
*/
|
*/
|
||||||
public static String getUploadPath()
|
public static String getUploadPath() {
|
||||||
{
|
|
||||||
return getProfile() + "/upload";
|
return getProfile() + "/upload";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ package com.ruoyi.common.constant;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class ShiroConstants
|
public class ShiroConstants {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 当前登录的用户
|
* 当前登录的用户
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,5 @@
|
||||||
package com.ruoyi.common.core.controller;
|
package com.ruoyi.common.core.controller;
|
||||||
|
|
||||||
import java.beans.PropertyEditorSupport;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.web.bind.WebDataBinder;
|
|
||||||
import org.springframework.web.bind.annotation.InitBinder;
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
|
@ -21,28 +11,36 @@ import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.ServletUtils;
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.sql.SqlUtil;
|
import com.ruoyi.common.utils.sql.SqlUtil;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.web.bind.WebDataBinder;
|
||||||
|
import org.springframework.web.bind.annotation.InitBinder;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.beans.PropertyEditorSupport;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web层通用数据处理
|
* web层通用数据处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class BaseController
|
public class BaseController {
|
||||||
{
|
|
||||||
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将前台传递过来的日期格式的字符串,自动转化为Date类型
|
* 将前台传递过来的日期格式的字符串,自动转化为Date类型
|
||||||
*/
|
*/
|
||||||
@InitBinder
|
@InitBinder
|
||||||
public void initBinder(WebDataBinder binder)
|
public void initBinder(WebDataBinder binder) {
|
||||||
{
|
|
||||||
// Date 类型转换
|
// Date 类型转换
|
||||||
binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
|
binder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public void setAsText(String text)
|
public void setAsText(String text) {
|
||||||
{
|
|
||||||
setValue(DateUtils.parseDate(text));
|
setValue(DateUtils.parseDate(text));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -51,13 +49,11 @@ public class BaseController
|
||||||
/**
|
/**
|
||||||
* 设置请求分页数据
|
* 设置请求分页数据
|
||||||
*/
|
*/
|
||||||
protected void startPage()
|
protected void startPage() {
|
||||||
{
|
|
||||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
Integer pageNum = pageDomain.getPageNum();
|
Integer pageNum = pageDomain.getPageNum();
|
||||||
Integer pageSize = pageDomain.getPageSize();
|
Integer pageSize = pageDomain.getPageSize();
|
||||||
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
|
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
|
||||||
{
|
|
||||||
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
||||||
PageHelper.startPage(pageNum, pageSize, orderBy);
|
PageHelper.startPage(pageNum, pageSize, orderBy);
|
||||||
}
|
}
|
||||||
|
|
@ -66,11 +62,9 @@ public class BaseController
|
||||||
/**
|
/**
|
||||||
* 设置请求排序数据
|
* 设置请求排序数据
|
||||||
*/
|
*/
|
||||||
protected void startOrderBy()
|
protected void startOrderBy() {
|
||||||
{
|
|
||||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
if (StringUtils.isNotEmpty(pageDomain.getOrderBy()))
|
if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) {
|
||||||
{
|
|
||||||
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
||||||
PageHelper.orderBy(orderBy);
|
PageHelper.orderBy(orderBy);
|
||||||
}
|
}
|
||||||
|
|
@ -79,33 +73,29 @@ public class BaseController
|
||||||
/**
|
/**
|
||||||
* 获取request
|
* 获取request
|
||||||
*/
|
*/
|
||||||
public HttpServletRequest getRequest()
|
public HttpServletRequest getRequest() {
|
||||||
{
|
|
||||||
return ServletUtils.getRequest();
|
return ServletUtils.getRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取response
|
* 获取response
|
||||||
*/
|
*/
|
||||||
public HttpServletResponse getResponse()
|
public HttpServletResponse getResponse() {
|
||||||
{
|
|
||||||
return ServletUtils.getResponse();
|
return ServletUtils.getResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取session
|
* 获取session
|
||||||
*/
|
*/
|
||||||
public HttpSession getSession()
|
public HttpSession getSession() {
|
||||||
{
|
|
||||||
return getRequest().getSession();
|
return getRequest().getSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 响应请求分页数据
|
* 响应请求分页数据
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
protected TableDataInfo getDataTable(List<?> list)
|
protected TableDataInfo getDataTable(List<?> list) {
|
||||||
{
|
|
||||||
TableDataInfo rspData = new TableDataInfo();
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
rspData.setCode(0);
|
rspData.setCode(0);
|
||||||
rspData.setRows(list);
|
rspData.setRows(list);
|
||||||
|
|
@ -119,8 +109,7 @@ public class BaseController
|
||||||
* @param rows 影响行数
|
* @param rows 影响行数
|
||||||
* @return 操作结果
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
protected AjaxResult toAjax(int rows)
|
protected AjaxResult toAjax(int rows) {
|
||||||
{
|
|
||||||
return rows > 0 ? success() : error();
|
return rows > 0 ? success() : error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,56 +119,49 @@ public class BaseController
|
||||||
* @param result 结果
|
* @param result 结果
|
||||||
* @return 操作结果
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
protected AjaxResult toAjax(boolean result)
|
protected AjaxResult toAjax(boolean result) {
|
||||||
{
|
|
||||||
return result ? success() : error();
|
return result ? success() : error();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回成功
|
* 返回成功
|
||||||
*/
|
*/
|
||||||
public AjaxResult success()
|
public AjaxResult success() {
|
||||||
{
|
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回失败消息
|
* 返回失败消息
|
||||||
*/
|
*/
|
||||||
public AjaxResult error()
|
public AjaxResult error() {
|
||||||
{
|
|
||||||
return AjaxResult.error();
|
return AjaxResult.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回成功消息
|
* 返回成功消息
|
||||||
*/
|
*/
|
||||||
public AjaxResult success(String message)
|
public AjaxResult success(String message) {
|
||||||
{
|
|
||||||
return AjaxResult.success(message);
|
return AjaxResult.success(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回失败消息
|
* 返回失败消息
|
||||||
*/
|
*/
|
||||||
public AjaxResult error(String message)
|
public AjaxResult error(String message) {
|
||||||
{
|
|
||||||
return AjaxResult.error(message);
|
return AjaxResult.error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回错误码消息
|
* 返回错误码消息
|
||||||
*/
|
*/
|
||||||
public AjaxResult error(Type type, String message)
|
public AjaxResult error(Type type, String message) {
|
||||||
{
|
|
||||||
return new AjaxResult(type, message);
|
return new AjaxResult(type, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面跳转
|
* 页面跳转
|
||||||
*/
|
*/
|
||||||
public String redirect(String url)
|
public String redirect(String url) {
|
||||||
{
|
|
||||||
return StringUtils.format("redirect:{}", url);
|
return StringUtils.format("redirect:{}", url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,46 +1,56 @@
|
||||||
package com.ruoyi.common.core.domain;
|
package com.ruoyi.common.core.domain;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作消息提醒
|
* 操作消息提醒
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class AjaxResult extends HashMap<String, Object>
|
public class AjaxResult extends HashMap<String, Object> {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 状态码 */
|
/**
|
||||||
|
* 状态码
|
||||||
|
*/
|
||||||
public static final String CODE_TAG = "code";
|
public static final String CODE_TAG = "code";
|
||||||
|
|
||||||
/** 返回内容 */
|
/**
|
||||||
|
* 返回内容
|
||||||
|
*/
|
||||||
public static final String MSG_TAG = "msg";
|
public static final String MSG_TAG = "msg";
|
||||||
|
|
||||||
/** 数据对象 */
|
/**
|
||||||
|
* 数据对象
|
||||||
|
*/
|
||||||
public static final String DATA_TAG = "data";
|
public static final String DATA_TAG = "data";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态类型
|
* 状态类型
|
||||||
*/
|
*/
|
||||||
public enum Type
|
public enum Type {
|
||||||
{
|
/**
|
||||||
/** 成功 */
|
* 成功
|
||||||
|
*/
|
||||||
SUCCESS(0),
|
SUCCESS(0),
|
||||||
/** 警告 */
|
/**
|
||||||
|
* 警告
|
||||||
|
*/
|
||||||
WARN(301),
|
WARN(301),
|
||||||
/** 错误 */
|
/**
|
||||||
|
* 错误
|
||||||
|
*/
|
||||||
ERROR(500);
|
ERROR(500);
|
||||||
private final int value;
|
private final int value;
|
||||||
|
|
||||||
Type(int value)
|
Type(int value) {
|
||||||
{
|
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int value()
|
public int value() {
|
||||||
{
|
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -48,8 +58,7 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
/**
|
/**
|
||||||
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
|
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
|
||||||
*/
|
*/
|
||||||
public AjaxResult()
|
public AjaxResult() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -58,8 +67,7 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
* @param type 状态类型
|
* @param type 状态类型
|
||||||
* @param msg 返回内容
|
* @param msg 返回内容
|
||||||
*/
|
*/
|
||||||
public AjaxResult(Type type, String msg)
|
public AjaxResult(Type type, String msg) {
|
||||||
{
|
|
||||||
super.put(CODE_TAG, type.value);
|
super.put(CODE_TAG, type.value);
|
||||||
super.put(MSG_TAG, msg);
|
super.put(MSG_TAG, msg);
|
||||||
}
|
}
|
||||||
|
|
@ -71,12 +79,10 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
* @param msg 返回内容
|
* @param msg 返回内容
|
||||||
* @param data 数据对象
|
* @param data 数据对象
|
||||||
*/
|
*/
|
||||||
public AjaxResult(Type type, String msg, Object data)
|
public AjaxResult(Type type, String msg, Object data) {
|
||||||
{
|
|
||||||
super.put(CODE_TAG, type.value);
|
super.put(CODE_TAG, type.value);
|
||||||
super.put(MSG_TAG, msg);
|
super.put(MSG_TAG, msg);
|
||||||
if (StringUtils.isNotNull(data))
|
if (StringUtils.isNotNull(data)) {
|
||||||
{
|
|
||||||
super.put(DATA_TAG, data);
|
super.put(DATA_TAG, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -89,8 +95,7 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
* @return 数据对象
|
* @return 数据对象
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult put(String key, Object value)
|
public AjaxResult put(String key, Object value) {
|
||||||
{
|
|
||||||
super.put(key, value);
|
super.put(key, value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
@ -100,8 +105,7 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
*
|
*
|
||||||
* @return 成功消息
|
* @return 成功消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult success()
|
public static AjaxResult success() {
|
||||||
{
|
|
||||||
return AjaxResult.success("操作成功");
|
return AjaxResult.success("操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,8 +114,7 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
*
|
*
|
||||||
* @return 成功消息
|
* @return 成功消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult success(Object data)
|
public static AjaxResult success(Object data) {
|
||||||
{
|
|
||||||
return AjaxResult.success("操作成功", data);
|
return AjaxResult.success("操作成功", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,8 +124,7 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
* @param msg 返回内容
|
* @param msg 返回内容
|
||||||
* @return 成功消息
|
* @return 成功消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult success(String msg)
|
public static AjaxResult success(String msg) {
|
||||||
{
|
|
||||||
return AjaxResult.success(msg, null);
|
return AjaxResult.success(msg, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -133,8 +135,7 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
* @param data 数据对象
|
* @param data 数据对象
|
||||||
* @return 成功消息
|
* @return 成功消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult success(String msg, Object data)
|
public static AjaxResult success(String msg, Object data) {
|
||||||
{
|
|
||||||
return new AjaxResult(Type.SUCCESS, msg, data);
|
return new AjaxResult(Type.SUCCESS, msg, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,8 +145,7 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
* @param msg 返回内容
|
* @param msg 返回内容
|
||||||
* @return 警告消息
|
* @return 警告消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult warn(String msg)
|
public static AjaxResult warn(String msg) {
|
||||||
{
|
|
||||||
return AjaxResult.warn(msg, null);
|
return AjaxResult.warn(msg, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,8 +156,7 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
* @param data 数据对象
|
* @param data 数据对象
|
||||||
* @return 警告消息
|
* @return 警告消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult warn(String msg, Object data)
|
public static AjaxResult warn(String msg, Object data) {
|
||||||
{
|
|
||||||
return new AjaxResult(Type.WARN, msg, data);
|
return new AjaxResult(Type.WARN, msg, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,8 +165,7 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static AjaxResult error()
|
public static AjaxResult error() {
|
||||||
{
|
|
||||||
return AjaxResult.error("操作失败");
|
return AjaxResult.error("操作失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -177,8 +175,7 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
* @param msg 返回内容
|
* @param msg 返回内容
|
||||||
* @return 警告消息
|
* @return 警告消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult error(String msg)
|
public static AjaxResult error(String msg) {
|
||||||
{
|
|
||||||
return AjaxResult.error(msg, null);
|
return AjaxResult.error(msg, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,8 +186,7 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
* @param data 数据对象
|
* @param data 数据对象
|
||||||
* @return 警告消息
|
* @return 警告消息
|
||||||
*/
|
*/
|
||||||
public static AjaxResult error(String msg, Object data)
|
public static AjaxResult error(String msg, Object data) {
|
||||||
{
|
|
||||||
return new AjaxResult(Type.ERROR, msg, data);
|
return new AjaxResult(Type.ERROR, msg, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,21 @@
|
||||||
package com.ruoyi.common.core.text;
|
package com.ruoyi.common.core.text;
|
||||||
|
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类型转换器
|
* 类型转换器
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class Convert
|
public class Convert {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 转换为字符串<br>
|
* 转换为字符串<br>
|
||||||
* 如果给定的值为null,或者转换失败,返回默认值<br>
|
* 如果给定的值为null,或者转换失败,返回默认值<br>
|
||||||
|
|
@ -24,14 +25,11 @@ public class Convert
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static String toStr(Object value, String defaultValue)
|
public static String toStr(Object value, String defaultValue) {
|
||||||
{
|
if (null == value) {
|
||||||
if (null == value)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof String)
|
if (value instanceof String) {
|
||||||
{
|
|
||||||
return (String) value;
|
return (String) value;
|
||||||
}
|
}
|
||||||
return value.toString();
|
return value.toString();
|
||||||
|
|
@ -45,8 +43,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static String toStr(Object value)
|
public static String toStr(Object value) {
|
||||||
{
|
|
||||||
return toStr(value, null);
|
return toStr(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,14 +56,11 @@ public class Convert
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Character toChar(Object value, Character defaultValue)
|
public static Character toChar(Object value, Character defaultValue) {
|
||||||
{
|
if (null == value) {
|
||||||
if (null == value)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Character)
|
if (value instanceof Character) {
|
||||||
{
|
|
||||||
return (Character) value;
|
return (Character) value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,8 +76,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Character toChar(Object value)
|
public static Character toChar(Object value) {
|
||||||
{
|
|
||||||
return toChar(value, null);
|
return toChar(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,31 +89,24 @@ public class Convert
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Byte toByte(Object value, Byte defaultValue)
|
public static Byte toByte(Object value, Byte defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Byte)
|
if (value instanceof Byte) {
|
||||||
{
|
|
||||||
return (Byte) value;
|
return (Byte) value;
|
||||||
}
|
}
|
||||||
if (value instanceof Number)
|
if (value instanceof Number) {
|
||||||
{
|
|
||||||
return ((Number) value).byteValue();
|
return ((Number) value).byteValue();
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return Byte.parseByte(valueStr);
|
return Byte.parseByte(valueStr);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -133,8 +119,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Byte toByte(Object value)
|
public static Byte toByte(Object value) {
|
||||||
{
|
|
||||||
return toByte(value, null);
|
return toByte(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -147,31 +132,24 @@ public class Convert
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Short toShort(Object value, Short defaultValue)
|
public static Short toShort(Object value, Short defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Short)
|
if (value instanceof Short) {
|
||||||
{
|
|
||||||
return (Short) value;
|
return (Short) value;
|
||||||
}
|
}
|
||||||
if (value instanceof Number)
|
if (value instanceof Number) {
|
||||||
{
|
|
||||||
return ((Number) value).shortValue();
|
return ((Number) value).shortValue();
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return Short.parseShort(valueStr.trim());
|
return Short.parseShort(valueStr.trim());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -184,8 +162,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Short toShort(Object value)
|
public static Short toShort(Object value) {
|
||||||
{
|
|
||||||
return toShort(value, null);
|
return toShort(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -198,27 +175,21 @@ public class Convert
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Number toNumber(Object value, Number defaultValue)
|
public static Number toNumber(Object value, Number defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Number)
|
if (value instanceof Number) {
|
||||||
{
|
|
||||||
return (Number) value;
|
return (Number) value;
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return NumberFormat.getInstance().parse(valueStr);
|
return NumberFormat.getInstance().parse(valueStr);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -231,8 +202,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Number toNumber(Object value)
|
public static Number toNumber(Object value) {
|
||||||
{
|
|
||||||
return toNumber(value, null);
|
return toNumber(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -245,31 +215,24 @@ public class Convert
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Integer toInt(Object value, Integer defaultValue)
|
public static Integer toInt(Object value, Integer defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Integer)
|
if (value instanceof Integer) {
|
||||||
{
|
|
||||||
return (Integer) value;
|
return (Integer) value;
|
||||||
}
|
}
|
||||||
if (value instanceof Number)
|
if (value instanceof Number) {
|
||||||
{
|
|
||||||
return ((Number) value).intValue();
|
return ((Number) value).intValue();
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return Integer.parseInt(valueStr.trim());
|
return Integer.parseInt(valueStr.trim());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -282,8 +245,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Integer toInt(Object value)
|
public static Integer toInt(Object value) {
|
||||||
{
|
|
||||||
return toInt(value, null);
|
return toInt(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -293,8 +255,7 @@ public class Convert
|
||||||
* @param str 被转换的值
|
* @param str 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Integer[] toIntArray(String str)
|
public static Integer[] toIntArray(String str) {
|
||||||
{
|
|
||||||
return toIntArray(",", str);
|
return toIntArray(",", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -304,8 +265,7 @@ public class Convert
|
||||||
* @param str 被转换的值
|
* @param str 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Long[] toLongArray(String str)
|
public static Long[] toLongArray(String str) {
|
||||||
{
|
|
||||||
return toLongArray(",", str);
|
return toLongArray(",", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -316,16 +276,13 @@ public class Convert
|
||||||
* @param split 被转换的值
|
* @param split 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Integer[] toIntArray(String split, String str)
|
public static Integer[] toIntArray(String split, String str) {
|
||||||
{
|
if (StringUtils.isEmpty(str)) {
|
||||||
if (StringUtils.isEmpty(str))
|
return new Integer[]{};
|
||||||
{
|
|
||||||
return new Integer[] {};
|
|
||||||
}
|
}
|
||||||
String[] arr = str.split(split);
|
String[] arr = str.split(split);
|
||||||
final Integer[] ints = new Integer[arr.length];
|
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);
|
final Integer v = toInt(arr[i], 0);
|
||||||
ints[i] = v;
|
ints[i] = v;
|
||||||
}
|
}
|
||||||
|
|
@ -339,16 +296,13 @@ public class Convert
|
||||||
* @param str 被转换的值
|
* @param str 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Long[] toLongArray(String split, String str)
|
public static Long[] toLongArray(String split, String str) {
|
||||||
{
|
if (StringUtils.isEmpty(str)) {
|
||||||
if (StringUtils.isEmpty(str))
|
return new Long[]{};
|
||||||
{
|
|
||||||
return new Long[] {};
|
|
||||||
}
|
}
|
||||||
String[] arr = str.split(split);
|
String[] arr = str.split(split);
|
||||||
final Long[] longs = new Long[arr.length];
|
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);
|
final Long v = toLong(arr[i], null);
|
||||||
longs[i] = v;
|
longs[i] = v;
|
||||||
}
|
}
|
||||||
|
|
@ -361,8 +315,7 @@ public class Convert
|
||||||
* @param str 被转换的值
|
* @param str 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static String[] toStrArray(String str)
|
public static String[] toStrArray(String str) {
|
||||||
{
|
|
||||||
return toStrArray(",", str);
|
return toStrArray(",", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -373,8 +326,7 @@ public class Convert
|
||||||
* @param split 被转换的值
|
* @param split 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static String[] toStrArray(String split, String str)
|
public static String[] toStrArray(String split, String str) {
|
||||||
{
|
|
||||||
return str.split(split);
|
return str.split(split);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -387,32 +339,25 @@ public class Convert
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Long toLong(Object value, Long defaultValue)
|
public static Long toLong(Object value, Long defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Long)
|
if (value instanceof Long) {
|
||||||
{
|
|
||||||
return (Long) value;
|
return (Long) value;
|
||||||
}
|
}
|
||||||
if (value instanceof Number)
|
if (value instanceof Number) {
|
||||||
{
|
|
||||||
return ((Number) value).longValue();
|
return ((Number) value).longValue();
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
// 支持科学计数法
|
// 支持科学计数法
|
||||||
return new BigDecimal(valueStr.trim()).longValue();
|
return new BigDecimal(valueStr.trim()).longValue();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -425,8 +370,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Long toLong(Object value)
|
public static Long toLong(Object value) {
|
||||||
{
|
|
||||||
return toLong(value, null);
|
return toLong(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -439,32 +383,25 @@ public class Convert
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Double toDouble(Object value, Double defaultValue)
|
public static Double toDouble(Object value, Double defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Double)
|
if (value instanceof Double) {
|
||||||
{
|
|
||||||
return (Double) value;
|
return (Double) value;
|
||||||
}
|
}
|
||||||
if (value instanceof Number)
|
if (value instanceof Number) {
|
||||||
{
|
|
||||||
return ((Number) value).doubleValue();
|
return ((Number) value).doubleValue();
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
// 支持科学计数法
|
// 支持科学计数法
|
||||||
return new BigDecimal(valueStr.trim()).doubleValue();
|
return new BigDecimal(valueStr.trim()).doubleValue();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -477,8 +414,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Double toDouble(Object value)
|
public static Double toDouble(Object value) {
|
||||||
{
|
|
||||||
return toDouble(value, null);
|
return toDouble(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -491,31 +427,24 @@ public class Convert
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Float toFloat(Object value, Float defaultValue)
|
public static Float toFloat(Object value, Float defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Float)
|
if (value instanceof Float) {
|
||||||
{
|
|
||||||
return (Float) value;
|
return (Float) value;
|
||||||
}
|
}
|
||||||
if (value instanceof Number)
|
if (value instanceof Number) {
|
||||||
{
|
|
||||||
return ((Number) value).floatValue();
|
return ((Number) value).floatValue();
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return Float.parseFloat(valueStr.trim());
|
return Float.parseFloat(valueStr.trim());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -528,8 +457,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Float toFloat(Object value)
|
public static Float toFloat(Object value) {
|
||||||
{
|
|
||||||
return toFloat(value, null);
|
return toFloat(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -542,24 +470,19 @@ public class Convert
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Boolean toBool(Object value, Boolean defaultValue)
|
public static Boolean toBool(Object value, Boolean defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof Boolean)
|
if (value instanceof Boolean) {
|
||||||
{
|
|
||||||
return (Boolean) value;
|
return (Boolean) value;
|
||||||
}
|
}
|
||||||
String valueStr = toStr(value, null);
|
String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
valueStr = valueStr.trim().toLowerCase();
|
valueStr = valueStr.trim().toLowerCase();
|
||||||
switch (valueStr)
|
switch (valueStr) {
|
||||||
{
|
|
||||||
case "true":
|
case "true":
|
||||||
return true;
|
return true;
|
||||||
case "false":
|
case "false":
|
||||||
|
|
@ -587,8 +510,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Boolean toBool(Object value)
|
public static Boolean toBool(Object value) {
|
||||||
{
|
|
||||||
return toBool(value, null);
|
return toBool(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -601,29 +523,23 @@ public class Convert
|
||||||
* @param defaultValue 默认值
|
* @param defaultValue 默认值
|
||||||
* @return Enum
|
* @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) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (clazz.isAssignableFrom(value.getClass()))
|
if (clazz.isAssignableFrom(value.getClass())) {
|
||||||
{
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
E myE = (E) value;
|
E myE = (E) value;
|
||||||
return myE;
|
return myE;
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return Enum.valueOf(clazz, valueStr);
|
return Enum.valueOf(clazz, valueStr);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -636,8 +552,7 @@ public class Convert
|
||||||
* @param value 值
|
* @param value 值
|
||||||
* @return Enum
|
* @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);
|
return toEnum(clazz, value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -650,31 +565,24 @@ public class Convert
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static BigInteger toBigInteger(Object value, BigInteger defaultValue)
|
public static BigInteger toBigInteger(Object value, BigInteger defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof BigInteger)
|
if (value instanceof BigInteger) {
|
||||||
{
|
|
||||||
return (BigInteger) value;
|
return (BigInteger) value;
|
||||||
}
|
}
|
||||||
if (value instanceof Long)
|
if (value instanceof Long) {
|
||||||
{
|
|
||||||
return BigInteger.valueOf((Long) value);
|
return BigInteger.valueOf((Long) value);
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return new BigInteger(valueStr);
|
return new BigInteger(valueStr);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -687,8 +595,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static BigInteger toBigInteger(Object value)
|
public static BigInteger toBigInteger(Object value) {
|
||||||
{
|
|
||||||
return toBigInteger(value, null);
|
return toBigInteger(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -701,39 +608,30 @@ public class Convert
|
||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue)
|
public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) {
|
||||||
{
|
if (value == null) {
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
if (value instanceof BigDecimal)
|
if (value instanceof BigDecimal) {
|
||||||
{
|
|
||||||
return (BigDecimal) value;
|
return (BigDecimal) value;
|
||||||
}
|
}
|
||||||
if (value instanceof Long)
|
if (value instanceof Long) {
|
||||||
{
|
|
||||||
return new BigDecimal((Long) value);
|
return new BigDecimal((Long) value);
|
||||||
}
|
}
|
||||||
if (value instanceof Double)
|
if (value instanceof Double) {
|
||||||
{
|
|
||||||
return new BigDecimal((Double) value);
|
return new BigDecimal((Double) value);
|
||||||
}
|
}
|
||||||
if (value instanceof Integer)
|
if (value instanceof Integer) {
|
||||||
{
|
|
||||||
return new BigDecimal((Integer) value);
|
return new BigDecimal((Integer) value);
|
||||||
}
|
}
|
||||||
final String valueStr = toStr(value, null);
|
final String valueStr = toStr(value, null);
|
||||||
if (StringUtils.isEmpty(valueStr))
|
if (StringUtils.isEmpty(valueStr)) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return new BigDecimal(valueStr);
|
return new BigDecimal(valueStr);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) {
|
||||||
{
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -746,8 +644,7 @@ public class Convert
|
||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static BigDecimal toBigDecimal(Object value)
|
public static BigDecimal toBigDecimal(Object value) {
|
||||||
{
|
|
||||||
return toBigDecimal(value, null);
|
return toBigDecimal(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -758,8 +655,7 @@ public class Convert
|
||||||
* @param obj 对象
|
* @param obj 对象
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
*/
|
*/
|
||||||
public static String utf8Str(Object obj)
|
public static String utf8Str(Object obj) {
|
||||||
{
|
|
||||||
return str(obj, CharsetKit.CHARSET_UTF_8);
|
return str(obj, CharsetKit.CHARSET_UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -771,8 +667,7 @@ public class Convert
|
||||||
* @param charsetName 字符集
|
* @param charsetName 字符集
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
*/
|
*/
|
||||||
public static String str(Object obj, String charsetName)
|
public static String str(Object obj, String charsetName) {
|
||||||
{
|
|
||||||
return str(obj, Charset.forName(charsetName));
|
return str(obj, Charset.forName(charsetName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -784,23 +679,18 @@ public class Convert
|
||||||
* @param charset 字符集
|
* @param charset 字符集
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
*/
|
*/
|
||||||
public static String str(Object obj, Charset charset)
|
public static String str(Object obj, Charset charset) {
|
||||||
{
|
if (null == obj) {
|
||||||
if (null == obj)
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj instanceof String)
|
if (obj instanceof String) {
|
||||||
{
|
|
||||||
return (String) obj;
|
return (String) obj;
|
||||||
}
|
}
|
||||||
else if (obj instanceof byte[] || obj instanceof Byte[])
|
else if (obj instanceof byte[] || obj instanceof Byte[]) {
|
||||||
{
|
|
||||||
return str((Byte[]) obj, charset);
|
return str((Byte[]) obj, charset);
|
||||||
}
|
}
|
||||||
else if (obj instanceof ByteBuffer)
|
else if (obj instanceof ByteBuffer) {
|
||||||
{
|
|
||||||
return str((ByteBuffer) obj, charset);
|
return str((ByteBuffer) obj, charset);
|
||||||
}
|
}
|
||||||
return obj.toString();
|
return obj.toString();
|
||||||
|
|
@ -813,8 +703,7 @@ public class Convert
|
||||||
* @param charset 字符集
|
* @param charset 字符集
|
||||||
* @return 字符串
|
* @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));
|
return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -825,15 +714,12 @@ public class Convert
|
||||||
* @param charset 字符集,如果此字段为空,则解码的结果取决于平台
|
* @param charset 字符集,如果此字段为空,则解码的结果取决于平台
|
||||||
* @return 解码后的字符串
|
* @return 解码后的字符串
|
||||||
*/
|
*/
|
||||||
public static String str(byte[] data, Charset charset)
|
public static String str(byte[] data, Charset charset) {
|
||||||
{
|
if (data == null) {
|
||||||
if (data == null)
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null == charset)
|
if (null == charset) {
|
||||||
{
|
|
||||||
return new String(data);
|
return new String(data);
|
||||||
}
|
}
|
||||||
return new String(data, charset);
|
return new String(data, charset);
|
||||||
|
|
@ -846,10 +732,8 @@ public class Convert
|
||||||
* @param charset 字符集,如果为空使用当前系统字符集
|
* @param charset 字符集,如果为空使用当前系统字符集
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
*/
|
*/
|
||||||
public static String str(ByteBuffer data, String charset)
|
public static String str(ByteBuffer data, String charset) {
|
||||||
{
|
if (data == null) {
|
||||||
if (data == null)
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -863,24 +747,22 @@ public class Convert
|
||||||
* @param charset 字符集,如果为空使用当前系统字符集
|
* @param charset 字符集,如果为空使用当前系统字符集
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
*/
|
*/
|
||||||
public static String str(ByteBuffer data, Charset charset)
|
public static String str(ByteBuffer data, Charset charset) {
|
||||||
{
|
if (null == charset) {
|
||||||
if (null == charset)
|
|
||||||
{
|
|
||||||
charset = Charset.defaultCharset();
|
charset = Charset.defaultCharset();
|
||||||
}
|
}
|
||||||
return charset.decode(data).toString();
|
return charset.decode(data).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------- 全角半角转换
|
// ----------------------------------------------------------------------- 全角半角转换
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 半角转全角
|
* 半角转全角
|
||||||
*
|
*
|
||||||
* @param input String.
|
* @param input String.
|
||||||
* @return 全角字符串.
|
* @return 全角字符串.
|
||||||
*/
|
*/
|
||||||
public static String toSBC(String input)
|
public static String toSBC(String input) {
|
||||||
{
|
|
||||||
return toSBC(input, null);
|
return toSBC(input, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -891,23 +773,18 @@ public class Convert
|
||||||
* @param notConvertSet 不替换的字符集合
|
* @param notConvertSet 不替换的字符集合
|
||||||
* @return 全角字符串.
|
* @return 全角字符串.
|
||||||
*/
|
*/
|
||||||
public static String toSBC(String input, Set<Character> notConvertSet)
|
public static String toSBC(String input, Set<Character> notConvertSet) {
|
||||||
{
|
|
||||||
char c[] = input.toCharArray();
|
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])) {
|
||||||
if (null != notConvertSet && notConvertSet.contains(c[i]))
|
|
||||||
{
|
|
||||||
// 跳过不替换的字符
|
// 跳过不替换的字符
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c[i] == ' ')
|
if (c[i] == ' ') {
|
||||||
{
|
|
||||||
c[i] = '\u3000';
|
c[i] = '\u3000';
|
||||||
}
|
}
|
||||||
else if (c[i] < '\177')
|
else if (c[i] < '\177') {
|
||||||
{
|
|
||||||
c[i] = (char) (c[i] + 65248);
|
c[i] = (char) (c[i] + 65248);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -921,8 +798,7 @@ public class Convert
|
||||||
* @param input String.
|
* @param input String.
|
||||||
* @return 半角字符串
|
* @return 半角字符串
|
||||||
*/
|
*/
|
||||||
public static String toDBC(String input)
|
public static String toDBC(String input) {
|
||||||
{
|
|
||||||
return toDBC(input, null);
|
return toDBC(input, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -933,23 +809,18 @@ public class Convert
|
||||||
* @param notConvertSet 不替换的字符集合
|
* @param notConvertSet 不替换的字符集合
|
||||||
* @return 替换后的字符
|
* @return 替换后的字符
|
||||||
*/
|
*/
|
||||||
public static String toDBC(String text, Set<Character> notConvertSet)
|
public static String toDBC(String text, Set<Character> notConvertSet) {
|
||||||
{
|
|
||||||
char c[] = text.toCharArray();
|
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])) {
|
||||||
if (null != notConvertSet && notConvertSet.contains(c[i]))
|
|
||||||
{
|
|
||||||
// 跳过不替换的字符
|
// 跳过不替换的字符
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c[i] == '\u3000')
|
if (c[i] == '\u3000') {
|
||||||
{
|
|
||||||
c[i] = ' ';
|
c[i] = ' ';
|
||||||
}
|
}
|
||||||
else if (c[i] > '\uFF00' && c[i] < '\uFF5F')
|
else if (c[i] > '\uFF00' && c[i] < '\uFF5F') {
|
||||||
{
|
|
||||||
c[i] = (char) (c[i] - 65248);
|
c[i] = (char) (c[i] - 65248);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -964,31 +835,26 @@ public class Convert
|
||||||
* @param n 数字
|
* @param n 数字
|
||||||
* @return 中文大写数字
|
* @return 中文大写数字
|
||||||
*/
|
*/
|
||||||
public static String digitUppercase(double n)
|
public static String digitUppercase(double n) {
|
||||||
{
|
String[] fraction = {"角", "分"};
|
||||||
String[] fraction = { "角", "分" };
|
String[] digit = {"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"};
|
||||||
String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
|
String[][] unit = {{"元", "万", "亿"}, {"", "拾", "佰", "仟"}};
|
||||||
String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } };
|
|
||||||
|
|
||||||
String head = n < 0 ? "负" : "";
|
String head = n < 0 ? "负" : "";
|
||||||
n = Math.abs(n);
|
n = Math.abs(n);
|
||||||
|
|
||||||
String s = "";
|
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("(零.)+", "");
|
s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", "");
|
||||||
}
|
}
|
||||||
if (s.length() < 1)
|
if (s.length() < 1) {
|
||||||
{
|
|
||||||
s = "整";
|
s = "整";
|
||||||
}
|
}
|
||||||
int integerPart = (int) Math.floor(n);
|
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 = "";
|
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;
|
p = digit[integerPart % 10] + unit[1][j] + p;
|
||||||
integerPart = integerPart / 10;
|
integerPart = integerPart / 10;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,84 +1,77 @@
|
||||||
package com.ruoyi.common.utils;
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import com.ruoyi.common.core.text.Convert;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import org.springframework.web.context.request.RequestAttributes;
|
import org.springframework.web.context.request.RequestAttributes;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
import com.ruoyi.common.core.text.Convert;
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户端工具类
|
* 客户端工具类
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class ServletUtils
|
public class ServletUtils {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 定义移动端请求的所有可能类型
|
* 定义移动端请求的所有可能类型
|
||||||
*/
|
*/
|
||||||
private final static String[] agent = { "Android", "iPhone", "iPod", "iPad", "Windows Phone", "MQQBrowser" };
|
private final static String[] agent = {"Android", "iPhone", "iPod", "iPad", "Windows Phone", "MQQBrowser"};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取String参数
|
* 获取String参数
|
||||||
*/
|
*/
|
||||||
public static String getParameter(String name)
|
public static String getParameter(String name) {
|
||||||
{
|
|
||||||
return getRequest().getParameter(name);
|
return getRequest().getParameter(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取String参数
|
* 获取String参数
|
||||||
*/
|
*/
|
||||||
public static String getParameter(String name, String defaultValue)
|
public static String getParameter(String name, String defaultValue) {
|
||||||
{
|
|
||||||
return Convert.toStr(getRequest().getParameter(name), defaultValue);
|
return Convert.toStr(getRequest().getParameter(name), defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取Integer参数
|
* 获取Integer参数
|
||||||
*/
|
*/
|
||||||
public static Integer getParameterToInt(String name)
|
public static Integer getParameterToInt(String name) {
|
||||||
{
|
|
||||||
return Convert.toInt(getRequest().getParameter(name));
|
return Convert.toInt(getRequest().getParameter(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取Integer参数
|
* 获取Integer参数
|
||||||
*/
|
*/
|
||||||
public static Integer getParameterToInt(String name, Integer defaultValue)
|
public static Integer getParameterToInt(String name, Integer defaultValue) {
|
||||||
{
|
|
||||||
return Convert.toInt(getRequest().getParameter(name), defaultValue);
|
return Convert.toInt(getRequest().getParameter(name), defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取request
|
* 获取request
|
||||||
*/
|
*/
|
||||||
public static HttpServletRequest getRequest()
|
public static HttpServletRequest getRequest() {
|
||||||
{
|
|
||||||
return getRequestAttributes().getRequest();
|
return getRequestAttributes().getRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取response
|
* 获取response
|
||||||
*/
|
*/
|
||||||
public static HttpServletResponse getResponse()
|
public static HttpServletResponse getResponse() {
|
||||||
{
|
|
||||||
return getRequestAttributes().getResponse();
|
return getRequestAttributes().getResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取session
|
* 获取session
|
||||||
*/
|
*/
|
||||||
public static HttpSession getSession()
|
public static HttpSession getSession() {
|
||||||
{
|
|
||||||
return getRequest().getSession();
|
return getRequest().getSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ServletRequestAttributes getRequestAttributes()
|
public static ServletRequestAttributes getRequestAttributes() {
|
||||||
{
|
|
||||||
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
|
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
|
||||||
return (ServletRequestAttributes) attributes;
|
return (ServletRequestAttributes) attributes;
|
||||||
}
|
}
|
||||||
|
|
@ -90,16 +83,13 @@ public class ServletUtils
|
||||||
* @param string 待渲染的字符串
|
* @param string 待渲染的字符串
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
public static String renderString(HttpServletResponse response, String string)
|
public static String renderString(HttpServletResponse response, String string) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
response.setContentType("application/json");
|
response.setContentType("application/json");
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding("utf-8");
|
||||||
response.getWriter().print(string);
|
response.getWriter().print(string);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e) {
|
||||||
{
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -110,29 +100,24 @@ public class ServletUtils
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
*/
|
*/
|
||||||
public static boolean isAjaxRequest(HttpServletRequest request)
|
public static boolean isAjaxRequest(HttpServletRequest request) {
|
||||||
{
|
|
||||||
String accept = request.getHeader("accept");
|
String accept = request.getHeader("accept");
|
||||||
if (accept != null && accept.indexOf("application/json") != -1)
|
if (accept != null && accept.indexOf("application/json") != -1) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String xRequestedWith = request.getHeader("X-Requested-With");
|
String xRequestedWith = request.getHeader("X-Requested-With");
|
||||||
if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1)
|
if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String uri = request.getRequestURI();
|
String uri = request.getRequestURI();
|
||||||
if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml"))
|
if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml")) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String ajax = request.getParameter("__ajax");
|
String ajax = request.getParameter("__ajax");
|
||||||
if (StringUtils.inStringIgnoreCase(ajax, "json", "xml"))
|
if (StringUtils.inStringIgnoreCase(ajax, "json", "xml")) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -141,18 +126,13 @@ public class ServletUtils
|
||||||
/**
|
/**
|
||||||
* 判断User-Agent 是不是来自于手机
|
* 判断User-Agent 是不是来自于手机
|
||||||
*/
|
*/
|
||||||
public static boolean checkAgentIsMobile(String ua)
|
public static boolean checkAgentIsMobile(String ua) {
|
||||||
{
|
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
if (!ua.contains("Windows NT") || (ua.contains("Windows NT") && ua.contains("compatible; MSIE 9.0;")))
|
if (!ua.contains("Windows NT") || (ua.contains("Windows NT") && ua.contains("compatible; MSIE 9.0;"))) {
|
||||||
{
|
|
||||||
// 排除 苹果桌面系统
|
// 排除 苹果桌面系统
|
||||||
if (!ua.contains("Windows NT") && !ua.contains("Macintosh"))
|
if (!ua.contains("Windows NT") && !ua.contains("Macintosh")) {
|
||||||
{
|
for (String item : agent) {
|
||||||
for (String item : agent)
|
if (ua.contains(item)) {
|
||||||
{
|
|
||||||
if (ua.contains(item))
|
|
||||||
{
|
|
||||||
flag = true;
|
flag = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,50 +1,44 @@
|
||||||
package com.ruoyi.common.utils;
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
|
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
|
||||||
import org.apache.shiro.session.Session;
|
import org.apache.shiro.session.Session;
|
||||||
import org.apache.shiro.subject.Subject;
|
|
||||||
import org.apache.shiro.subject.PrincipalCollection;
|
import org.apache.shiro.subject.PrincipalCollection;
|
||||||
import org.apache.shiro.subject.SimplePrincipalCollection;
|
import org.apache.shiro.subject.SimplePrincipalCollection;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import org.apache.shiro.subject.Subject;
|
||||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* shiro 工具类
|
* shiro 工具类
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class ShiroUtils
|
public class ShiroUtils {
|
||||||
{
|
|
||||||
public static Subject getSubject()
|
public static Subject getSubject() {
|
||||||
{
|
|
||||||
return SecurityUtils.getSubject();
|
return SecurityUtils.getSubject();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Session getSession()
|
public static Session getSession() {
|
||||||
{
|
|
||||||
return SecurityUtils.getSubject().getSession();
|
return SecurityUtils.getSubject().getSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void logout()
|
public static void logout() {
|
||||||
{
|
|
||||||
getSubject().logout();
|
getSubject().logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SysUser getSysUser()
|
public static SysUser getSysUser() {
|
||||||
{
|
|
||||||
SysUser user = null;
|
SysUser user = null;
|
||||||
Object obj = getSubject().getPrincipal();
|
Object obj = getSubject().getPrincipal();
|
||||||
if (StringUtils.isNotNull(obj))
|
if (StringUtils.isNotNull(obj)) {
|
||||||
{
|
|
||||||
user = new SysUser();
|
user = new SysUser();
|
||||||
BeanUtils.copyBeanProp(user, obj);
|
BeanUtils.copyBeanProp(user, obj);
|
||||||
}
|
}
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setSysUser(SysUser user)
|
public static void setSysUser(SysUser user) {
|
||||||
{
|
|
||||||
Subject subject = getSubject();
|
Subject subject = getSubject();
|
||||||
PrincipalCollection principalCollection = subject.getPrincipals();
|
PrincipalCollection principalCollection = subject.getPrincipals();
|
||||||
String realmName = principalCollection.getRealmNames().iterator().next();
|
String realmName = principalCollection.getRealmNames().iterator().next();
|
||||||
|
|
@ -53,31 +47,26 @@ public class ShiroUtils
|
||||||
subject.runAs(newPrincipalCollection);
|
subject.runAs(newPrincipalCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Long getUserId()
|
public static Long getUserId() {
|
||||||
{
|
|
||||||
return getSysUser().getUserId().longValue();
|
return getSysUser().getUserId().longValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getLoginName()
|
public static String getLoginName() {
|
||||||
{
|
|
||||||
return getSysUser().getLoginName();
|
return getSysUser().getLoginName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getIp()
|
public static String getIp() {
|
||||||
{
|
|
||||||
return getSubject().getSession().getHost();
|
return getSubject().getSession().getHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSessionId()
|
public static String getSessionId() {
|
||||||
{
|
|
||||||
return String.valueOf(getSubject().getSession().getId());
|
return String.valueOf(getSubject().getSession().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成随机盐
|
* 生成随机盐
|
||||||
*/
|
*/
|
||||||
public static String randomSalt()
|
public static String randomSalt() {
|
||||||
{
|
|
||||||
// 一个Byte占两个字节,此处生成的3字节,字符串长度为6
|
// 一个Byte占两个字节,此处生成的3字节,字符串长度为6
|
||||||
SecureRandomNumberGenerator secureRandom = new SecureRandomNumberGenerator();
|
SecureRandomNumberGenerator secureRandom = new SecureRandomNumberGenerator();
|
||||||
String hex = secureRandom.nextBytes(3).toHex();
|
String hex = secureRandom.nextBytes(3).toHex();
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
package com.ruoyi.framework.config;
|
package com.ruoyi.framework.config;
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import com.google.code.kaptcha.impl.DefaultKaptcha;
|
import com.google.code.kaptcha.impl.DefaultKaptcha;
|
||||||
import com.google.code.kaptcha.util.Config;
|
import com.google.code.kaptcha.util.Config;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import static com.google.code.kaptcha.Constants.*;
|
import static com.google.code.kaptcha.Constants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -13,11 +15,10 @@ import static com.google.code.kaptcha.Constants.*;
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class CaptchaConfig
|
public class CaptchaConfig {
|
||||||
{
|
|
||||||
@Bean(name = "captchaProducer")
|
@Bean(name = "captchaProducer")
|
||||||
public DefaultKaptcha getKaptchaBean()
|
public DefaultKaptcha getKaptchaBean() {
|
||||||
{
|
|
||||||
DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
|
DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
// 是否有边框 默认为true 我们可以自己设置yes,no
|
// 是否有边框 默认为true 我们可以自己设置yes,no
|
||||||
|
|
@ -44,8 +45,7 @@ public class CaptchaConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "captchaProducerMath")
|
@Bean(name = "captchaProducerMath")
|
||||||
public DefaultKaptcha getKaptchaBeanMath()
|
public DefaultKaptcha getKaptchaBeanMath() {
|
||||||
{
|
|
||||||
DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
|
DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
// 是否有边框 默认为true 我们可以自己设置yes,no
|
// 是否有边框 默认为true 我们可以自己设置yes,no
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue