lenos一款快速开发模块化脚手架,优化日志监控

This commit is contained in:
zxm 2018-01-03 12:52:39 +08:00
parent 6e30f5a9d8
commit dc21a54316
10 changed files with 26 additions and 125 deletions

View File

@ -30,6 +30,7 @@
## ps ## ps
- 如果您喜欢本项目可以clone下来使用您的star将是本人前进的动力本项目无丝毫保留开源如果您有技术疑问可以加群交流。 - 如果您喜欢本项目可以clone下来使用您的star将是本人前进的动力本项目无丝毫保留开源如果您有技术疑问可以加群交流。
- 本项目处于未成年阶段如果您有好的idea欢迎参与开源。 - 本项目处于未成年阶段如果您有好的idea欢迎参与开源。
* lenos脚手架会一直更新下去我们的征途是星辰大海
## 项目图片 ## 项目图片
* 登录账号admin 密码123456 * 登录账号admin 密码123456

View File

@ -1,12 +1,14 @@
package com.len.controller; package com.len.controller;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.len.core.annotation.Log;
import com.len.core.shiro.ShiroUtil; import com.len.core.shiro.ShiroUtil;
import com.len.entity.SysMenu; import com.len.entity.SysMenu;
import com.len.entity.SysUser; import com.len.entity.SysUser;
import com.len.service.MenuService; import com.len.service.MenuService;
import com.len.service.SysUserService; import com.len.service.SysUserService;
import com.len.util.VerifyCodeUtils; import com.len.util.VerifyCodeUtils;
import io.swagger.annotations.ApiOperation;
import java.util.List; import java.util.List;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -74,7 +76,7 @@ public class LoginController {
* @param rememberMe * @param rememberMe
* @return * @return
*/ */
//@ApiOperation(value = "/login", httpMethod = "POST", notes = "登录method") @ApiOperation(value = "/login", httpMethod = "POST", notes = "登录method")
@PostMapping(value = "/login") @PostMapping(value = "/login")
public String login(SysUser user,Model model,String rememberMe,HttpServletRequest request){ public String login(SysUser user,Model model,String rememberMe,HttpServletRequest request){
String codeMsg = (String)request.getAttribute("shiroLoginFailure"); String codeMsg = (String)request.getAttribute("shiroLoginFailure");
@ -104,7 +106,7 @@ public class LoginController {
return "/login"; return "/login";
} }
//@Log(desc = "用户退出平台") @Log(desc = "用户退出平台")
@GetMapping(value = "/logout") @GetMapping(value = "/logout")
public String logout(){ public String logout(){
Subject sub=SecurityUtils.getSubject(); Subject sub=SecurityUtils.getSubject();
@ -136,64 +138,9 @@ public class LoginController {
} }
return sysMenu; return sysMenu;
} }
/*public JSONArray getMenu(){
SysMenu root=new SysMenu("系统管理","url");
SysMenu root1=new SysMenu("其他管理","url");
SysMenu m1=new SysMenu("用户管理","user/ShowUser");
SysMenu m2=new SysMenu("角色管理","user/ShowUser");
SysMenu m3=new SysMenu("权限管理","user/ShowUser");
SysMenu m4=new SysMenu("用户列表","user/ShowUser");
SysMenu m5=new SysMenu("会员管理","user/ShowUser");
SysMenu m6=new SysMenu("VIP管理","user/ShowUser");
SysMenu m7=new SysMenu("VIP管理1","user/ShowUser");
m6.addChild(m7);
m3.addChild(m5);
m3.addChild(m6);
root.addChild(m1);
root.addChild(m2);
root.addChild(m3);
root1.addChild(m4);
JSONArray json=new JSONArray();
json.add(root);
json.add(root1);
System.out.println(json);
return json;
}
@GetMapping(value = "test")
public String test(Model model){
//model.addAttribute("menu",getMenu());
return "ftl/main/tab";
}*/
public void jxJson(JSONArray ja,int x,int end){
if(x==0){
System.out.println("begin");
}
String str=" ";
x++;
for(int k=0;k<x;k++){
str+=str;
}
for(int i=0;i<ja.size();i++){
SysMenu menu= (SysMenu) ja.get(i);
if(menu.getChildren().size()>0){
System.out.println(str+menu.getName()+"-----------"+x+"级菜单");
JSONArray js=new JSONArray();
for(int j=0;j<menu.getChildren().size();j++){
js.add(menu.getChildren().get(j));
}
jxJson(js,x,end);
}else{
System.out.println(str+x+"级子菜单-----------"+menu.getName());
}
}
}
@GetMapping(value="/getCode") @GetMapping(value="/getCode")
public void getYzm(HttpServletResponse response, HttpServletRequest request){ public void getYzm(HttpServletResponse response, HttpServletRequest request){
try { try {
@ -214,10 +161,4 @@ public class LoginController {
e.printStackTrace(); e.printStackTrace();
} }
} }
/*@Test
public void test(){
jxJson(getMenu(),0,getMenu().size());
System.out.println("结束");
}*/
} }

View File

@ -2,10 +2,12 @@ package com.len.controller;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.len.base.BaseController; import com.len.base.BaseController;
import com.len.core.annotation.Log;
import com.len.entity.SysMenu; import com.len.entity.SysMenu;
import com.len.exception.MyException; import com.len.exception.MyException;
import com.len.service.MenuService; import com.len.service.MenuService;
import com.len.util.JsonUtil; import com.len.util.JsonUtil;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -33,8 +35,8 @@ public class MenuController extends BaseController{
* @param model * @param model
* @return * @return
*/ */
/*@ApiOperation(value = "/showMenu", httpMethod = "GET", notes = "展示菜单") @ApiOperation(value = "/showMenu", httpMethod = "GET", notes = "展示菜单")
@Log(desc = "展示菜单",type = Log.LOG_TYPE.SELECT)*/ @Log(desc = "展示菜单",type = Log.LOG_TYPE.SELECT)
@GetMapping(value = "showMenu") @GetMapping(value = "showMenu")
public String showMenu(Model model){ public String showMenu(Model model){
JSONArray ja=menuService.getMenuJsonList(); JSONArray ja=menuService.getMenuJsonList();
@ -50,13 +52,10 @@ public class MenuController extends BaseController{
return "/system/menu/add-menu"; return "/system/menu/add-menu";
} }
//@ApiOperation(value = "/addMenu", httpMethod = "POST", notes = "添加菜单") @ApiOperation(value = "/addMenu", httpMethod = "POST", notes = "添加菜单")
@PostMapping(value = "addMenu") @PostMapping(value = "addMenu")
@ResponseBody @ResponseBody
public JsonUtil addMenu(SysMenu sysMenu,Model model){ public JsonUtil addMenu(SysMenu sysMenu,Model model){
if(sysMenu.getMenuType()==2){
sysMenu.setMenuType((byte)0);
}
if(StringUtils.isEmpty(sysMenu.getPId())){ if(StringUtils.isEmpty(sysMenu.getPId())){
sysMenu.setPId(null); sysMenu.setPId(null);
} }

View File

@ -2,6 +2,7 @@ package com.len.controller;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.len.base.BaseController; import com.len.base.BaseController;
import com.len.core.annotation.Log;
import com.len.entity.SysRole; import com.len.entity.SysRole;
import com.len.entity.SysRoleMenu; import com.len.entity.SysRoleMenu;
import com.len.entity.SysRoleUser; import com.len.entity.SysRoleUser;
@ -12,6 +13,7 @@ import com.len.service.RoleService;
import com.len.service.RoleUserService; import com.len.service.RoleUserService;
import com.len.util.BeanUtil; import com.len.util.BeanUtil;
import com.len.util.JsonUtil; import com.len.util.JsonUtil;
import io.swagger.annotations.ApiOperation;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -49,7 +51,7 @@ public class RoleController extends BaseController {
return "/system/role/roleList"; return "/system/role/roleList";
} }
//@ApiOperation(value = "/showRoleList", httpMethod = "GET", notes = "展示角色") @ApiOperation(value = "/showRoleList", httpMethod = "GET", notes = "展示角色")
@GetMapping(value = "showRoleList",produces = "text/json;charset=UTF-8") @GetMapping(value = "showRoleList",produces = "text/json;charset=UTF-8")
@ResponseBody @ResponseBody
public String showRoleList(SysRole role,Model model,String page,String limit){ public String showRoleList(SysRole role,Model model,String page,String limit){
@ -63,8 +65,8 @@ public class RoleController extends BaseController {
return "/system/role/add-role"; return "/system/role/add-role";
} }
//@ApiOperation(value = "/addRole", httpMethod = "POST", notes = "添加角色") @ApiOperation(value = "/addRole", httpMethod = "POST", notes = "添加角色")
//@Log(desc = "添加角色") @Log(desc = "添加角色")
@PostMapping(value = "addRole") @PostMapping(value = "addRole")
@ResponseBody @ResponseBody
public String addRole(SysRole sysRole,String[] menus){ public String addRole(SysRole sysRole,String[] menus){
@ -98,8 +100,8 @@ public class RoleController extends BaseController {
return "system/role/update-role"; return "system/role/update-role";
} }
/* @ApiOperation(value = "/updateRole", httpMethod = "POST", notes = "更新角色") @ApiOperation(value = "/updateRole", httpMethod = "POST", notes = "更新角色")
@Log(desc = "更新角色")*/ @Log(desc = "更新角色")
@PostMapping(value = "updateRole") @PostMapping(value = "updateRole")
@ResponseBody @ResponseBody
public JsonUtil updateUser(SysRole role,String[] menus) { public JsonUtil updateUser(SysRole role,String[] menus) {

View File

@ -1,21 +0,0 @@
package com.len.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author zhuxiaomeng
* @date 2018/1/1.
* @email 154040976@qq.com
*/
@RestController
@RequestMapping(value = "/test")
public class TestController {
@GetMapping(value = "/demo1")
public String demo1(){
return "hello spring boot";
}
}

View File

@ -1,6 +1,7 @@
package com.len.controller; package com.len.controller;
import com.len.base.BaseController; import com.len.base.BaseController;
import com.len.core.annotation.Log;
import com.len.entity.SysRoleUser; import com.len.entity.SysRoleUser;
import com.len.entity.SysUser; import com.len.entity.SysUser;
import com.len.exception.MyException; import com.len.exception.MyException;
@ -9,6 +10,7 @@ import com.len.service.SysUserService;
import com.len.util.BeanUtil; import com.len.util.BeanUtil;
import com.len.util.Checkbox; import com.len.util.Checkbox;
import com.len.util.JsonUtil; import com.len.util.JsonUtil;
import io.swagger.annotations.ApiOperation;
import java.io.File; import java.io.File;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
@ -70,8 +72,8 @@ public class UserController extends BaseController{
return "/system/user/add-user"; return "/system/user/add-user";
} }
/* @ApiOperation(value = "/addUser", httpMethod = "POST", notes = "添加用户") @ApiOperation(value = "/addUser", httpMethod = "POST", notes = "添加用户")
@Log(desc = "添加用户")*/ @Log(desc = "添加用户")
@PostMapping(value = "addUser") @PostMapping(value = "addUser")
@ResponseBody @ResponseBody
public String addUser(SysUser user,String[] role) { public String addUser(SysUser user,String[] role) {
@ -118,8 +120,8 @@ public class UserController extends BaseController{
return "system/user/update-user"; return "system/user/update-user";
} }
/* @ApiOperation(value = "/updateUser", httpMethod = "POST", notes = "更新用户") @ApiOperation(value = "/updateUser", httpMethod = "POST", notes = "更新用户")
@Log(desc = "更新用户")*/ @Log(desc = "更新用户")
@PostMapping(value = "updateUser") @PostMapping(value = "updateUser")
@ResponseBody @ResponseBody
public JsonUtil updateUser(SysUser user,String role[]) { public JsonUtil updateUser(SysUser user,String role[]) {
@ -153,7 +155,7 @@ public class UserController extends BaseController{
return jsonUtil; return jsonUtil;
} }
// @ApiOperation(value = "/del", httpMethod = "POST", notes = "删除用户") @ApiOperation(value = "/del", httpMethod = "POST", notes = "删除用户")
@PostMapping(value = "del") @PostMapping(value = "del")
@ResponseBody @ResponseBody
public String del(String id, boolean flag) { public String del(String id, boolean flag) {

View File

@ -23,5 +23,5 @@ public @interface Log {
/**内容*/ /**内容*/
String desc(); String desc();
/**类型 curd*/ /**类型 curd*/
LOG_TYPE type() default LOG_TYPE.ADD; LOG_TYPE type() default LOG_TYPE.ATHOR;
} }

View File

@ -1,10 +0,0 @@
package com.len.core.annotation;
/**
* @author zhuxiaomeng
* @date 2017/12/28.
* @email 154040976@qq.com
*/
public enum LogType {
}

View File

@ -48,7 +48,7 @@ public class VerifyCodeUtils{
/** /**
* 使用系统默认字符源生成验证码 * 使用系统默认字符源生成验证码
* @param verifySize 验证码长度 * @param
* @return * @return
*/ */
public static Verify generateVerify(){ public static Verify generateVerify(){

13
pom.xml
View File

@ -128,19 +128,6 @@
  <version>1.7.25</version>   <version>1.7.25</version>
</dependency> </dependency>
<!--<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-log4j12</artifactId>
  <version>1.7.25</version>
</dependency>-->
<!-- https://mvnrepository.com/artifact/org.freemarker/freemarker -->
<!--<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.20</version>
</dependency>-->
<dependency> <dependency>
<groupId>org.apache.shiro</groupId> <groupId>org.apache.shiro</groupId>