|
@@ -9,8 +9,12 @@ 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.constant.ShiroConstants;
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.domain.entity.SysMenu;
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.core.text.Convert;
|
|
@@ -19,6 +23,7 @@ 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.system.service.ISysConfigService;
|
|
|
import com.ruoyi.system.service.ISysMenuService;
|
|
|
|
|
@@ -36,6 +41,9 @@ public class SysIndexController extends BaseController
|
|
|
@Autowired
|
|
|
private ISysConfigService configService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysPasswordService passwordService;
|
|
|
+
|
|
|
// 系统首页
|
|
|
@GetMapping("/index")
|
|
|
public String index(ModelMap mmap)
|
|
@@ -73,6 +81,33 @@ public class SysIndexController extends BaseController
|
|
|
return webIndex;
|
|
|
}
|
|
|
|
|
|
+ // 锁定屏幕
|
|
|
+ @GetMapping("/lockscreen")
|
|
|
+ public String lockscreen(ModelMap mmap)
|
|
|
+ {
|
|
|
+ mmap.put("user", ShiroUtils.getSysUser());
|
|
|
+ ServletUtils.getSession().setAttribute(ShiroConstants.LOCK_SCREEN, true);
|
|
|
+ return "lock";
|
|
|
+ }
|
|
|
+
|
|
|
+ // 解锁屏幕
|
|
|
+ @PostMapping("/unlockscreen")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult unlockscreen(String password)
|
|
|
+ {
|
|
|
+ SysUser user = ShiroUtils.getSysUser();
|
|
|
+ if (StringUtils.isNull(user))
|
|
|
+ {
|
|
|
+ return AjaxResult.error("服务器超时,请重新登陆");
|
|
|
+ }
|
|
|
+ if (passwordService.matches(user, password))
|
|
|
+ {
|
|
|
+ ServletUtils.getSession().removeAttribute(ShiroConstants.LOCK_SCREEN);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ return AjaxResult.error("密码不正确,请重新输入。");
|
|
|
+ }
|
|
|
+
|
|
|
// 切换主题
|
|
|
@GetMapping("/system/switchSkin")
|
|
|
public String switchSkin()
|