merge
This commit is contained in:
@@ -8,7 +8,7 @@ import org.springframework.boot.web.support.SpringBootServletInitializer;
|
||||
/**
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/11/2 18:19
|
||||
* 作者: xiangwb
|
||||
* 作者: boot-module-demo
|
||||
* 说明: 启动类
|
||||
*/
|
||||
@SpringBootApplication
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 说明: 自定义日志信息注解
|
||||
* 项目名称: sbdemo
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/5/10 16:36
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
/**
|
||||
* 说明: 程序上下文配置
|
||||
* 项目名称: sbdemo
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/5/10 16:36
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xwbing.configuration;
|
||||
|
||||
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
||||
import com.xwbing.handler.LoginInterceptor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -19,7 +20,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明: 程序配置
|
||||
* 项目名称: sbdemo
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/5/10 16:36
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
@@ -37,7 +38,7 @@ public class DispatcherServletConfig extends WebMvcConfigurerAdapter {
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
logger.info("addInterceptors......");
|
||||
//拦截器1:登录判断
|
||||
// registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**");
|
||||
registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**");
|
||||
// registry.addInterceptor(new LoginInterceptor())
|
||||
// .addPathPatterns("/**").excludePathPatterns("/user/login", "/servlet/captchaCode", "/doc.html", "/swagger-ui.html");
|
||||
//拦截器2...
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
||||
/**
|
||||
* 说明: 定时任务定时类
|
||||
* 项目名称: sbdemo
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/5/10 16:36
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 说明: 统一的servlet配置
|
||||
* 项目名称: sbdemo
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/5/10 16:36
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* 说明: swagger config
|
||||
* 项目名称: sbdemo
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/5/10 16:36
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 项目名称: sb-demo
|
||||
* 项目名称: sb-boot-module-demo
|
||||
* 创建时间: 2017/9/18 13:42
|
||||
* 作者: xiangwb
|
||||
* 说明:邮件测试控制层
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.xwbing.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xwbing.domain.SysConfig;
|
||||
import com.xwbing.entity.SysConfig;
|
||||
import com.xwbing.service.SysConfigService;
|
||||
import com.xwbing.util.JSONObjResult;
|
||||
import com.xwbing.util.RestMessage;
|
||||
@@ -20,7 +20,7 @@ import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 说明: 系统配置控制层
|
||||
* 项目名称: sbdemo
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/5/10 16:36
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 说明:
|
||||
* 项目名称: sbdemo
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/5/5 9:21
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.xwbing.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xwbing.domain.SysUser;
|
||||
import com.xwbing.entity.SysUser;
|
||||
import com.xwbing.service.UserService;
|
||||
import com.xwbing.util.JSONObjResult;
|
||||
import com.xwbing.util.RestMessage;
|
||||
@@ -11,13 +11,14 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 说明: user
|
||||
* 项目名称: sbdemo
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/5/10 16:36
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
@@ -53,7 +54,7 @@ public class UserControl {
|
||||
}
|
||||
|
||||
@GetMapping("findById")
|
||||
public JSONObject findById(String id) {
|
||||
public JSONObject findById(@RequestParam String id) {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
}
|
||||
@@ -70,4 +71,25 @@ public class UserControl {
|
||||
return JSONObjResult.toJSONObj(list, true, "");
|
||||
}
|
||||
|
||||
@GetMapping("login")
|
||||
public JSONObject login(HttpServletRequest req, @RequestParam String userName, @RequestParam String passWord, String ckeckCode) {
|
||||
if (StringUtils.isEmpty(userName))
|
||||
return JSONObjResult.toJSONObj("用户名不能为空");
|
||||
if (StringUtils.isEmpty(passWord))
|
||||
return JSONObjResult.toJSONObj("密码不能为空");
|
||||
RestMessage login = userService.login(req, userName, passWord, ckeckCode);
|
||||
return JSONObjResult.toJSONObj(login);
|
||||
}
|
||||
|
||||
@GetMapping("updatePassWord")
|
||||
public JSONObject updatePassWord(@RequestParam String newPassWord, @RequestParam String oldPassWord, @RequestParam String loginUserId) {
|
||||
if (StringUtils.isEmpty(newPassWord))
|
||||
return JSONObjResult.toJSONObj("新密码不能为空");
|
||||
if (StringUtils.isEmpty(oldPassWord))
|
||||
return JSONObjResult.toJSONObj("旧密码不能为空");
|
||||
if (StringUtils.isEmpty(newPassWord))
|
||||
return JSONObjResult.toJSONObj("用户id不能为空");
|
||||
RestMessage restMessage = userService.updatePassWord(newPassWord, oldPassWord, loginUserId);
|
||||
return JSONObjResult.toJSONObj(restMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明: GlobalExceptionHandler
|
||||
* 项目名称: sbdemo
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/5/10 16:36
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Set;
|
||||
|
||||
/**
|
||||
* 说明: 登录拦截器
|
||||
* 项目名称: sbdemo
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/5/10 16:36
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
@@ -32,7 +32,7 @@ public class LoginInterceptor extends HandlerInterceptorAdapter {
|
||||
if(!set.contains(servletPath) && !servletPath.contains("login")){
|
||||
HttpSession session = request.getSession();
|
||||
if (session.getAttribute(CommonConstant.SESSION_CURRENT_USER)!=null) {
|
||||
// TODO: 2017/5/15
|
||||
// TODO: 2017/10/3
|
||||
return true;
|
||||
}else {
|
||||
// TODO: 2017/10/3
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* 说明: web层日志记录切面
|
||||
* 项目名称: sbdemo
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/5/10 16:34
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user