package com.notebook.controller;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.baomidou.mybatisplus.plugins.Page;
import com.notebook.config.email.EmailConfig;
import com.notebook.entities.SysNotice;
import com.notebook.entities.UserInfo;
import com.notebook.entities.UserNote;
import com.notebook.entities.UserNotetag;
import com.notebook.model.admin.AdminIndexModel;
import com.notebook.model.common.LoginRecordModel;
import com.notebook.model.common.NoticeModel;
import com.notebook.service.NoticeService;
import com.notebook.service.UserInfoService;
import com.notebook.service.UserLoginRecordService;
import com.notebook.service.UserNoteService;
import com.notebook.service.UserNoteTagService;
import com.notebook.util.CommonUtil;
import com.notebook.util.ConstantUtil;
import com.notebook.util.EmailUtil;
import com.notebook.util.StringUtil;
@Controller
@RequestMapping(value="/admin")
public class AdminController {
@Autowired
UserInfoService userInfoService;
@Autowired
NoticeService noticeService;
@Autowired
UserLoginRecordService userLoginRecordService;
@Autowired
UserNoteService userNoteService;
@Autowired
UserNoteTagService userNoteTagService;
/**
*
* @author 2ing
* @createTime 2018年1月22日
* @remarks 管理员登录后首页
*/
@RequestMapping(value="/index", method=RequestMethod.GET)
public ModelAndView adminIndex(final Model model, final HttpServletRequest request, HttpServletResponse response){
try {
//获取当前用户
UserInfo user = (UserInfo)SecurityUtils.getSubject().getPrincipal();
AdminIndexModel adminIndexModel = userInfoService.getAdminIndexModel();
List<NoticeModel> notices = noticeService.getIndexNoticeModel();
List<LoginRecordModel> loginRecords = userLoginRecordService.getIndexLoginRecordModel(user.getUserId());
model.addAttribute(ConstantUtil.ADMININDEXMODEL, adminIndexModel);
model.addAttribute(ConstantUtil.NOTICEMODELS, notices);
model.addAttribute(ConstantUtil.LOGINRECORDMODELS, loginRecords);
} catch (Exception e) {
e.printStackTrace();
}
//模板没写Null判断
model.addAttribute(ConstantUtil.CONTENT, ConstantUtil.INDEX);
return new ModelAndView(ConstantUtil.ADMINMAIN);
}
/**
*
* @author 2ing
* @createTime 2018年1月22日
* @remarks 系统邮箱设置页面
*/
@RequestMapping(value="/systemMail", method=RequestMethod.GET)
public ModelAndView systemMail(final Model model, final HttpServletRequest request, HttpServletResponse response){
model.addAttribute(ConstantUtil.EMAILHOST, EmailConfig.getHost());
model.addAttribute(ConstantUtil.EMAILUSERNAME, EmailConfig.getUsername());
model.addAttribute(ConstantUtil.EMAILPASSWORD, EmailConfig.getPassword());
model.addAttribute(ConstantUtil.CONTENT, ConstantUtil.SYSTEMMAIL);
return new ModelAndView(ConstantUtil.ADMINMAIN);
}
/**
*
* @author 2ing
* @createTime 2018年1月24日
* @remarks AJAX测试公用email账号
*/
@RequestMapping(value = "/emailConnectTest", method = RequestMethod.POST)
@ResponseBody
public String emailConnectTest(String host,String username, String password) {
try {
EmailUtil.emailconnectTest(host, username, password);
return ConstantUtil.AJAX_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ConstantUtil.AJAX_ERROR;
}
}
/**
*
* @author 2ing
* @createTime 2018年1月24日
* @remarks 保存邮箱信息
*/
@RequestMapping(value="/emailSave", method=RequestMethod.POST)
public ModelAndView emailSave(final Model model, final HttpServletRequest request, HttpServletResponse response){
String host = request.getParameter("emailHost");
String username = request.getParameter("emailUserName");
String password = request.getParameter("emailPassword");
try {
EmailUtil.emailUtilSet(host, username, password);
} catch (Exception e) {
e.printStackTrace();
}
return new ModelAndView(ConstantUtil.TOSYSTEMMAIL);
}
/**
*
* @author 2ing
* @createTime 2018年1月22日
* @remarks 公告notice管理
*/
@RequestMapping(value="/notices", method=RequestMethod.GET)
public ModelAndView notices(final Model model, final HttpServletRequest request, HttpServletResponse response){
String noticeTitle = request.getParameter("noticeTitle");
String pagenow = request.getParameter("pagenow");
Page<NoticeModel> noticesPage = null;
if(!StringUtil.isEmpty(pagenow)){
noticesPage = new Page<NoticeModel>(Integer.valueOf(pagenow).intValue(), 5);
}else{
noticesPage = new Page<NoticeModel>(1, 5);
}
try {
noticesPage = noticeService.getNoticeModelsByPageAndCondition(noticesPage, noticeTitle);//分页之后的信息
noticesPage.setTotal(noticeService.getAllNoticeNumByCondition(noticeTitle));//总数
//pagemodel
model.addAttribute(ConstantUtil.PAGEMODELS, noticesPage);
//用于pagemodel跳转的url
model.addAttribute(ConstantUtil.PAGEMODEL_URL, ConstantUtil.NOTICESURL);
//url参数
if(!StringUtil.isEmpty(noticeTitle)){
model.addAttribute(ConstantUtil.PAGEMODEL_PARAM, "noticeTitle="+noticeTitle);
}
} catch (Exception e) {
e.printStackTrace();
}
model.addAttribute(ConstantUtil.CONTENT, ConstantUtil.NOTICESPAGE);
return new ModelAndView(ConstantUtil.ADMINMAIN);
}
/**
*
* @author 2ing
* @createTime 2018年1月22日
* @remarks 公告notice删除
*/
@RequestMapping(value="/noticeDelete", method=RequestMethod.GET)
public ModelAndView noticeDelete(final Model model, final HttpServletRequest request, HttpServletResponse response){
String noticeId = request.getParameter("noticeId");
try {
noticeService.deleteNoticeById(Integer.valueOf(noticeId).intValue());
} catch (Exception e) {
e.printStackTrace();
}
return new ModelAndView(ConstantUtil.TONOTICESPAGE);
}
/**
*
* @author 2ing
* @createTime 2018年1月25日
* @remarks 编辑notice公告
*/
@RequestMapping(value="/notice", method=RequestMethod.GET)
public ModelAndView notice(final Model model, final HttpServletRequest request, HttpServletResponse response){
try {
String noticeId = request.getParameter("noticeId");
if(!StringUtil.isEmpty(noticeId)){
SysNotice notice = noticeService.getNoticeById(Integer.valueOf(noticeId).intValue());
model.addAttribute(ConstantUtil.NOTICE, notice);
}
} catch (Exception e) {
e.printStackTrace();
}
model.addAttribute(ConstantUtil.CONTENT, ConstantUtil.NOTICEPAGE);
return new ModelAndView(ConstantUtil.ADMINMAIN);
}
/**
*
* @author 2ing
* @createTime 2018年1月25日
* @remarks 公告notice保存
*/
@RequestMapping(value="/savenotice", method=RequestMethod.POST)
public ModelAndView savenotice(final Model model, final HttpServletRequest request, HttpServletResponse response){
try {
String noticeId = request.getParameter("noticeID");
String noticeTitle = request.getParameter("noticeTitle");
String noticeContent = request.getParameter("noticeContent");
SysNotice notice = null;
if(!StringUtil.isEmpty(noticeId)){//update
notice = noticeService.getNoticeById(Integer.valueOf(noticeId).intValue());
notice.setNoticeTitle(noticeTitle);
notice.setNoticeContent
没有合适的资源?快使用搜索试试~ 我知道了~
毕业设计项目,使用Java语言、mysql数据库,使用springboot+shiro+mybaits框架
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共196个文件
java:60个
js:44个
ftl:32个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 5 浏览量
2024-02-24
12:59:52
上传
评论
收藏 6.58MB ZIP 举报
温馨提示
毕业设计项目,使用Java语言、mysql数据库,使用springboot+shiro+mybaits框架搭建,模板语言使用freemaker。.zip
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![exe](https://img-home.csdnimg.cn/images/20210720083343.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 196 条
- 1
- 2
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/f40b27f659cf4356877369aa7344c2b6_qqrrjj2011.jpg!1)
极致人生-010
- 粉丝: 3418
- 资源: 3074
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)