merge
This commit is contained in:
@@ -37,7 +37,6 @@ public class DispatcherServletConfig extends WebMvcConfigurerAdapter {
|
||||
*/
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
logger.info("addInterceptors......");
|
||||
//拦截器1:登录判断
|
||||
registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**");
|
||||
// registry.addInterceptor(new LoginInterceptor())
|
||||
|
||||
@@ -19,7 +19,7 @@ public class SchedulingConfig {
|
||||
|
||||
@Scheduled(cron = "0 */30 * * * ?") // 每半小时执行一次
|
||||
public void scheduler() {
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> scheduled ... ");
|
||||
logger.info("scheduled ==================");
|
||||
//TODO
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.xwbing.configuration;
|
||||
|
||||
import com.xwbing.util.captcah.CaptchaServlet;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -13,6 +15,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
*/
|
||||
@Configuration
|
||||
public class ServletConfig {
|
||||
private final Logger logger = LoggerFactory.getLogger(ServletConfig.class);
|
||||
|
||||
@Bean
|
||||
public CaptchaServlet captchaServlet() {
|
||||
return new CaptchaServlet();
|
||||
@@ -20,6 +24,7 @@ public class ServletConfig {
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean captchaServletRegistrationBean(CaptchaServlet captchaServlet) {
|
||||
logger.info("注册验证码servlet ======================= ");
|
||||
ServletRegistrationBean registration = new ServletRegistrationBean(captchaServlet);
|
||||
registration.setEnabled(true);
|
||||
registration.addUrlMappings("/servlet/captchaCode");
|
||||
|
||||
@@ -36,7 +36,7 @@ public class SwaggerConfig {
|
||||
.title("Document RESTful APIs")
|
||||
.description("API接口文档")
|
||||
.termsOfServiceUrl("http://localhost:8080/swagger-ui.html")
|
||||
.contact(new Contact("xiangwb", "http://localhost:8080/swagger-ui.html", "xiangwbs@163.com"))
|
||||
.contact(new Contact("项伟兵", "https://github.com/xiangwbs/boot-module-demo.git", "xiangwbs@163.com"))
|
||||
.version("1.0.0")
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.xwbing.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xwbing.annotation.LogInfo;
|
||||
import com.xwbing.service.MailService;
|
||||
import com.xwbing.util.JSONObjResult;
|
||||
import com.xwbing.util.RestMessage;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -16,28 +18,21 @@ import javax.annotation.Resource;
|
||||
* 作者: xiangwb
|
||||
* 说明:邮件测试控制层
|
||||
*/
|
||||
@Api(tags = "mailApi", description = "邮件测试相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/mail/")
|
||||
public class MailTestControl {
|
||||
@Resource
|
||||
private MailService mailService;
|
||||
|
||||
/**
|
||||
* 发送纯文本邮件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@LogInfo("发送纯文本邮件")
|
||||
@GetMapping("sendSimpleMail")
|
||||
public JSONObject sendSimpleMail() {
|
||||
RestMessage restMessage = mailService.sendSimpleMail("786461501@qq.com", "测试邮件", "收到一个纯文本邮件");
|
||||
return JSONObjResult.toJSONObj(restMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送html格式邮件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@LogInfo("发送html格式邮件")
|
||||
@GetMapping("sendHtmlMail")
|
||||
public JSONObject sendHtmlMail() {
|
||||
String content = "<html>" +
|
||||
@@ -49,11 +44,7 @@ public class MailTestControl {
|
||||
return JSONObjResult.toJSONObj(restMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送带附件邮件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@LogInfo("发送带附件邮件")
|
||||
@GetMapping("sendAttachmentsMail")
|
||||
public JSONObject sendAttachmentsMail() {
|
||||
String path = "C:\\Users\\admin\\Desktop\\qq.txt";
|
||||
@@ -61,11 +52,7 @@ public class MailTestControl {
|
||||
return JSONObjResult.toJSONObj(restMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送文本内嵌图片邮件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@LogInfo("发送文本内嵌图片邮件")
|
||||
@GetMapping("sendInlineResourceMail")
|
||||
public JSONObject sendInlineResourceMail() {
|
||||
String rscId = "pic";
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
* 创建时间: 2017/5/10 16:36
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
@Api(tags = "configApi", description = "系统配置")
|
||||
@Api(tags = "configApi", description = "系统配置相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/config/")
|
||||
public class SysConfigControl {
|
||||
|
||||
@@ -3,10 +3,10 @@ package com.xwbing.controller;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xwbing.annotation.LogInfo;
|
||||
import com.xwbing.entity.SysUser;
|
||||
import com.xwbing.service.SysUserLoginInOutService;
|
||||
import com.xwbing.service.SysUserService;
|
||||
import com.xwbing.util.JSONObjResult;
|
||||
import com.xwbing.util.RestMessage;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -23,13 +23,12 @@ import java.util.List;
|
||||
* 创建时间: 2017/5/10 16:36
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
@Api(tags = "userApi", description = "用户相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/user/")
|
||||
public class SysUserControl {
|
||||
@Resource
|
||||
private SysUserService sysUserService;
|
||||
@Resource
|
||||
private SysUserLoginInOutService loginInOutService;
|
||||
private final Logger logger = LoggerFactory.getLogger(SysUserControl.class);
|
||||
|
||||
@LogInfo("添加用户")
|
||||
@@ -80,7 +79,7 @@ public class SysUserControl {
|
||||
}
|
||||
|
||||
@LogInfo("登录")
|
||||
@GetMapping("login")
|
||||
@PostMapping("login")
|
||||
public JSONObject login(HttpServletRequest request, @RequestParam String userName, @RequestParam String passWord, @RequestParam String checkCode) {
|
||||
if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(passWord))
|
||||
return JSONObjResult.toJSONObj("用户名或密码不能为空");
|
||||
@@ -98,7 +97,7 @@ public class SysUserControl {
|
||||
}
|
||||
|
||||
@LogInfo("修改密码")
|
||||
@GetMapping("updatePassWord")
|
||||
@PostMapping("updatePassWord")
|
||||
public JSONObject updatePassWord(@RequestParam String newPassWord, @RequestParam String oldPassWord, @RequestParam String id) {
|
||||
if (StringUtils.isEmpty(newPassWord) || StringUtils.isEmpty(oldPassWord))
|
||||
return JSONObjResult.toJSONObj("原密码或新密码不能为空");
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.xwbing.annotation.LogInfo;
|
||||
import com.xwbing.entity.SysUserLoginInOut;
|
||||
import com.xwbing.service.SysUserLoginInOutService;
|
||||
import com.xwbing.util.JSONObjResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -19,6 +20,7 @@ import java.util.List;
|
||||
* 作者: xiangwb
|
||||
* 说明: 用户登录登出控制层
|
||||
*/
|
||||
@Api(tags = "inoutApi", description = "登陆登出相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/inout/")
|
||||
public class SysUserLoginInOutControl {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.xwbing.controller;
|
||||
|
||||
import com.xwbing.annotation.LogInfo;
|
||||
import com.xwbing.redis.RedisService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -16,6 +17,7 @@ import javax.annotation.Resource;
|
||||
* 创建时间: 2017/5/5 9:21
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
@Api(tags = "testApi", description = "测试相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/test/")
|
||||
public class TestControl {
|
||||
@@ -35,7 +37,7 @@ public class TestControl {
|
||||
@LogInfo("log")
|
||||
@GetMapping("log")
|
||||
public void log() {
|
||||
logger.info("info");
|
||||
logger.error("error");
|
||||
logger.info("info test");
|
||||
logger.error("error test");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user