Compare commits

...

30 Commits

Author SHA1 Message Date
p4fmevgyr f17b613e9b mapper文件
2 years ago
p4fmevgyr 36a9e65f79 后端controller部分
2 years ago
pk9tv8hgp 2a6791e0f8 Add ValidateCodeController
2 years ago
pk9tv8hgp ca209e26d3 Add UserController
2 years ago
pk9tv8hgp 3f1329d342 Add NavigateController
2 years ago
pk9tv8hgp 98f362486d Add EmailController
2 years ago
pk9tv8hgp 1386ee0859 Add BaseBeforeController
2 years ago
pk9tv8hgp fe35e2ed6a Add BaseController
2 years ago
pk9tv8hgp 1c7cf1b777 Add AdminEmailAndUserController
2 years ago
pk9tv8hgp 9c3c368a53 Add AdminController
2 years ago
p4fmevgyr 4fa6203ef9 css前端部分
2 years ago
p4fmevgyr 4086f9d458 admin模板部分
2 years ago
pzkue6pt2 b65420a415 第12组项目代码
2 years ago
pzkue6pt2 914159fc04 Delete 'src/main/resources/static/admin/js/.jsplogin'
2 years ago
pzkue6pt2 a3ebddb019 第12组项目代码
2 years ago
pzkue6pt2 f1ed90aa10 第12组项目代码
2 years ago
pzkue6pt2 9374ecf726 第12组项目代码
2 years ago
pzkue6pt2 2fda730972 第12组项目代码
2 years ago
pzkue6pt2 02af8fc01c Delete 'src/main/resources/static/admin/js/adminEmail.jsp'
2 years ago
pzkue6pt2 a2fe5bf7bc Delete 'src/test/java/com/forum/adminEmail.jsp'
2 years ago
pzkue6pt2 e541827314 第十二组项目代码adminEmail.jsp
2 years ago
pzkue6pt2 c9ac63f7b9 添加adminEmail.jsp
2 years ago
pzkue6pt2 bc89b261d7 Delete 'src/test/java/com/admin'
2 years ago
pzkue6pt2 2c9fed236e 添加一个admin包
2 years ago
pvr7eh5nm 2b76373e1b css设计
2 years ago
pkratnch4 179e44bac0 Update NoticeDao.xml
2 years ago
pkratnch4 0f28b672b0 Update MessageDao.xml
2 years ago
pkratnch4 ba58674784 Update LinkDao.xml
2 years ago
pkratnch4 d9070e8aee Update ForumDao.xml
2 years ago
pkratnch4 7f860eace4 Update CommentDao.xml
2 years ago

@ -0,0 +1,22 @@
package com.controller.admin;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import com.po.Auser;
import com.service.admin.AdminService;
@Controller
public class AdminController {
@Autowired
private AdminService adminService;
@RequestMapping("/admin")
public String toLogin(@ModelAttribute Auser auser) {
return "admin/login";
}
@RequestMapping("admin/login")
public String login(@ModelAttribute Auser auser, Model model, HttpSession session) {
return adminService.login(auser, model, session);
}
}

@ -0,0 +1,36 @@
package com.controller.admin;
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 com.service.admin.AdminEmailAndUserService;
@Controller
@RequestMapping("/admin")
public class AdminEmailAndUserController extends BaseController{
@Autowired
private AdminEmailAndUserService adminEmailAndUserService;
@RequestMapping("/selectEmail")
public String selectAllEmail(Model model) {
return adminEmailAndUserService.selectAllEmail(model);
}
@RequestMapping("/delete")
public String delete(Integer id) {
return adminEmailAndUserService.delete(id);
}
@RequestMapping("/selectUser")
public String selectUser(Model model) {
return adminEmailAndUserService.selectBuserEmail(model);
}
@RequestMapping("/lock")
public String lock(Integer id) {
return adminEmailAndUserService.lock(id);
}
@RequestMapping("/unLock")
public String unLock(Integer id) {
return adminEmailAndUserService.unLock(id);
}
}

@ -0,0 +1,22 @@
package com.controller.before;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import com.exception.UserLoginNoException;
@Controller
public class BaseBeforeController {
/**
* 前台用户登录权限控制,处理方法执行前执行该方法
* @throws UserLoginNoException
*/
@ModelAttribute
public void isLogin(HttpSession session, HttpServletRequest request) throws UserLoginNoException {
if(session.getAttribute("emailuser") == null){
throw new UserLoginNoException("没有登录");
}
}
}

@ -0,0 +1,21 @@
package com.controller.admin;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import com.exception.AdminLoginNoException;
@Controller
public class BaseController {
/**
* 登录权限控制,处理方法执行前执行该方法
* @throws AdminLoginNoException
*/
@ModelAttribute
public void isLogin(HttpSession session, HttpServletRequest request) throws AdminLoginNoException {
if(session.getAttribute("auser") == null){
throw new AdminLoginNoException("没有登录");
}
}
}

@ -0,0 +1,106 @@
package com.controller.before;
import java.io.FileInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
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 com.po.Email;
import com.service.before.EmailService;
import com.util.MyUtil;
@Controller
@RequestMapping("/email")
public class EmailController extends BaseBeforeController{
@Autowired
private EmailService emailService;
/**
* 写信
*/
@RequestMapping("/write")
public String write(Email myemail, Model model, HttpServletRequest request, HttpSession session) {
return emailService.write(myemail,model,request,session);
}
/**
* 回复初始化
*/
@RequestMapping("/reEmailInit")
public String reEmailInit(Integer id, Model model, HttpSession session) {
return emailService.reEmailInit(id, model);
}
/**
* 收信
*/
@RequestMapping("/recieve")
public String recieve(Model model, HttpSession session) {
return emailService.recieve(model, session);
}
/**
* 已发送
*/
@RequestMapping("/send")
public String send(Model model, HttpSession session) {
return emailService.send(model, session);
}
/**
* 打开信件看详情
*/
@RequestMapping("/detail")
public String detail(Model model, Integer id) {//id接收参数id
return emailService.detail(model, id);
}
/**
* 删除一个邮件
*/
@RequestMapping("/deleteOne")
public String deleteOne(Integer id) {//id接收参数id
return emailService.deleteOne(id);
}
/***
* 删除多个邮件
*/
@RequestMapping("/deleteMore")
public String deleteMore(Integer ids[]) {//id接收参数id
return emailService.deleteMore(ids);
}
/**
* 下载附件,该方法不访问数据库,故只写控制层
*/
@RequestMapping("/down")
public String down(String fileid, HttpServletRequest request, HttpServletResponse response) {//fileid接收参数fileid
String aFilePath = null; //要下载的文件路径
FileInputStream in = null; //输入流
ServletOutputStream out = null; //输出流
try {
//从workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps下载
aFilePath = request.getServletContext().getRealPath("uploadfiles");
//设置下载文件使用的报头
response.setHeader("Content-Type", "application/x-msdownload" );
response.setHeader("Content-Disposition", "attachment; filename="
+ MyUtil.toUTF8String(fileid));
// 读入文件
in = new FileInputStream(aFilePath + "\\"+ fileid);
//得到响应对象的输出流,用于向客户端输出二进制数据
out = response.getOutputStream();
out.flush();
int aRead = 0;
byte b[] = new byte[1024];
while ((aRead = in.read(b)) != -1 & in != null) {
out.write(b,0,aRead);
}
out.flush();
in.close();
out.close();
} catch (Throwable e) {
e.printStackTrace();
}
return null;
}
}

@ -0,0 +1,40 @@
package com.controller.before;
import javax.servlet.http.HttpSession;
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 com.po.Buser;
import com.service.before.NavigateService;
@Controller
public class NavigateController extends BaseBeforeController{
@Autowired
private NavigateService navigateService;
/**
* 转到写信页面
*/
@RequestMapping("/toWrite")
public String toWrite(Model model) {
return navigateService.toWrite(model);
}
/***
* 安全退出不需访问数据库这里不需要service层和dao层
*/
@RequestMapping("/exit")
public String exit(HttpSession session, Model model) {
session.invalidate();
model.addAttribute("buser", new Buser());
return "before/login";
}
/***
* 去修改密码页面不需访问数据库这里不需要service层和dao层
*/
@RequestMapping("/toUpdate")
public String toUpdate(HttpSession session, Model model) {
model.addAttribute("buser", (Buser)session.getAttribute("emailuser"));
return "before/update";
}
}

@ -0,0 +1,49 @@
package com.controller.before;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import com.po.Buser;
import com.service.before.UserService;
@Controller
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
@RequestMapping("/register")
public String register(@ModelAttribute Buser buser,Model model, HttpSession session, String code) {
return userService.register(buser, model, session, code);
}
@RequestMapping("/login")
public String login(@ModelAttribute Buser buser,Model model, HttpSession session, String code) {
return userService.login(buser, model, session, code);
}
/**
* 转到登录页面
*/
@RequestMapping("/toLogin")
public String toLogin(Model model) {
return userService.toLogin(model);
}
/**
* 转到注册页面
*/
@RequestMapping("/toRegister")
public String toRegister(Model model) {
return userService.toRegister(model);
}
/**
* 修改密码
*/
@RequestMapping("/update")
public String update(Model model, HttpSession session, String bpwd) {
return userService.update(model, session, bpwd);
}
}

@ -0,0 +1,95 @@
package com.controller.before;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 验证码
*/
@Controller
public class ValidateCodeController {
private char code[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M',
'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '2',
'3', '4', '5', '6', '7', '8', '9' };
private static final int WIDTH = 50;
private static final int HEIGHT = 20;
private static final int LENGTH = 4;
@RequestMapping("/validateCode")
public void validateCode(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
// 设置响应报头信息
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
// 设置响应的MIME类型
response.setContentType("image/jpeg");
BufferedImage image = new BufferedImage(WIDTH, HEIGHT,
BufferedImage.TYPE_INT_RGB);
Font mFont = new Font("Arial", Font.TRUETYPE_FONT, 18);
Graphics g = image.getGraphics();
Random rd = new Random();
// 设置背景颜色
g.setColor(new Color(rd.nextInt(55) + 200, rd.nextInt(55) + 200, rd
.nextInt(55) + 200));
g.fillRect(0, 0, WIDTH, HEIGHT);
// 设置字体
g.setFont(mFont);
// 画边框
g.setColor(Color.black);
g.drawRect(0, 0, WIDTH - 1, HEIGHT - 1);
// 随机产生的验证码
String result = "";
for (int i = 0; i < LENGTH; ++i) {
result += code[rd.nextInt(code.length)];
}
HttpSession se = request.getSession();
se.setAttribute("code", result);
// 画验证码
for (int i = 0; i < result.length(); i++) {
g.setColor(new Color(rd.nextInt(200), rd.nextInt(200), rd
.nextInt(200)));
g.drawString(result.charAt(i) + "", 12 * i + 1, 16);
}
// 随机产生2个干扰线
for (int i = 0; i < 2; i++) {
g.setColor(new Color(rd.nextInt(200), rd.nextInt(200), rd
.nextInt(200)));
int x1 = rd.nextInt(WIDTH);
int x2 = rd.nextInt(WIDTH);
int y1 = rd.nextInt(HEIGHT);
int y2 = rd.nextInt(HEIGHT);
g.drawLine(x1, y1, x2, y2);
}
// 释放图形资源
g.dispose();
try {
OutputStream os = response.getOutputStream();
// 输出图像到页面
ImageIO.write(image, "JPEG", os);
} catch (IOException e) {
e.printStackTrace();
}
}
}

@ -0,0 +1,64 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>receive.jsp</title>
<link href="css/common.css" type="text/css" rel="stylesheet">
<style type="text/css">
table{
text-align: center;
border-collapse: collapse;
}
.bgcolor{
background-color: #F08080;
}
</style>
<script type="text/javascript">
function changeColor(obj){
obj.className = "bgcolor";
}
function changeColor1(obj){
obj.className = "";
}
function confirmDelete(id){
if(window.confirm("真的删除吗really?")){
window.location.href = "/emailSys01/admin/delete?id=" + id;
}
}
</script>
</head>
<body>
<c:if test="${allEmails.size() == 0 }">
您还没有邮件可管理。
</c:if>
<c:if test="${allEmails.size() != 0 }">
<table border="1" bordercolor="PaleGreen">
<tr>
<td width="100px">收件人</td>
<td width="200px">发件人</td>
<td width="300px">主题</td>
<td width="100px">时间</td>
<td width="100px">操作</td>
</tr>
<c:forEach items="${allEmails }" var="email">
<tr onmousemove="changeColor(this)" onmouseout="changeColor1(this)">
<td>${email.email_r }</td>
<td>${email.email_s }</td>
<td>${email.title }</td>
<td>${email.sendtime }</td>
<td><a href="javaScript:confirmDelete('${email.id_email }')">删除</a></td>
</tr>
</c:forEach>
</table>
</c:if>
</body>
</html>

@ -0,0 +1,72 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>receive.jsp</title>
<link href="css/common.css" type="text/css" rel="stylesheet">
<style type="text/css">
table{
text-align: center;
border-collapse: collapse;
}
.bgcolor{
background-color: #F08080;
}
</style>
<script type="text/javascript">
function changeColor(obj){
obj.className = "bgcolor";
}
function changeColor1(obj){
obj.className = "";
}
function confirmLock(id){
if(window.confirm("真的锁定吗really?")){
window.location.href = "/emailSys01/admin/lock?id=" + id;
}
}
function confirmUnlock(id){
if(window.confirm("真的解锁吗really?")){
window.location.href = "/emailSys01/admin/unLock?id=" + id;
}
}
</script>
</head>
<body>
<c:if test="${allUsers.size() == 0 }">
您还没有用户可管理。
</c:if>
<c:if test="${allUsers.size() != 0 }">
<table border="1" bordercolor="PaleGreen">
<tr>
<td width="100px">用户ID</td>
<td width="200px">用户Email</td>
<td width="100px">操作</td>
</tr>
<c:forEach items="${allUsers }" var="u">
<tr onmousemove="changeColor(this)" onmouseout="changeColor1(this)">
<td>${u.id }</td>
<td>${u.bemail }</td>
<td>
<c:if test="${u.islock == 0 }">
<a href="javaScript:confirmLock('${u.id }')">锁定</a>
</c:if>
<c:if test="${u.islock == 1 }">
<a href="javaScript:confirmUnlock('${u.id }')">解锁</a>
</c:if>
</td>
</tr>
</c:forEach>
</table>
</c:if>
</body>
</html>

@ -0,0 +1,71 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>后台登录</title>
<style type="text/css">
table{
text-align: center;
}
.textSize{
width: 120px;
height: 25px;
}
* {
margin: 0px;
padding: 0px;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
margin: 10px 10px auto;
background-image: url(images/bb.jpg);
}
</style>
<script type="text/javascript">
//确定按钮
function gogo(){
document.forms[0].submit();
}
//取消按钮
function cancel(){
document.forms[0].action = "";
}
</script>
</head>
<body>
<form:form action="admin/login" modelAttribute="auser" method="post">
<table>
<tr>
<td colspan="2"><img src="images/login.gif"></td>
</tr>
<tr>
<td>姓名:</td>
<td>
<form:input path="aname" cssClass="textSize"/>
</td>
</tr>
<tr>
<td>密码:</td>
<td>
<form:password path="apwd" cssClass="textSize" maxlength="20"/>
</td>
</tr>
<tr>
<td colspan="2">
<input type="image" src="images/ok.gif" onclick="gogo()" >
<input type="image" src="images/cancel.gif" onclick="cancel()" >
</td>
</tr>
</table>
</form:form>
${msg }
</body>
</html>

@ -0,0 +1,127 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<title>后台主页面</title>
<style type="text/css">
* {
margin: 0px;
padding: 0px;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
margin: 0px auto;
height: auto;
width: 800px;
border: 1px solid #006633;
}
#header {
height: 90px;
width: 800px;
background-image: url(images/bb.jpg);
margin: 0px 0px 3px 0px;
}
#header h1 {
text-align: center;
font-family: 华文彩云;
color: #000000;
font-size: 30px
}
#navigator {
height: 25px;
width: 800px;
font-size: 14px;
background-image: url(images/bb.jpg);
}
#navigator ul {
list-style-type: none;
}
#navigator li {
float: left;
position: relative;
}
#navigator li a {
color: #000000;
text-decoration: none;
padding-top: 4px;
display: block;
width: 98px;
height: 22px;
text-align: center;
background-color: PaleGreen;
margin-left: 2px;
}
#navigator li a:hover {
background-color: #006633;
color: #FFFFFF;
}
#navigator ul li ul {
visibility: hidden;
position: absolute;
}
#navigator ul li:hover ul,
#navigator ul a:hover ul{
visibility: visible;
}
#content {
height: auto;
width: 780px;
padding: 10px;
}
#content iframe {
height: 300px;
width: 780px;
}
#footer {
height: 30px;
width: 780px;
line-height: 2em;
text-align: center;
background-color: PaleGreen;
padding: 10px;
}
</style>
</head>
<body>
<div id="header">
<br>
<br>
<h1>欢迎${auser.aname}进入后台管理系统!</h1>
</div>
<div id="navigator">
<ul>
<li><a>邮件管理</a>
<ul>
<li><a href="admin/selectEmail" target="center">删除邮件</a></li>
</ul>
</li>
<li><a>用户管理</a>
<ul>
<li><a href="admin/selectUser" target="center">解锁用户</a></li>
</ul>
</li>
</ul>
</div>
<div id="content">
<iframe src="admin/selectEmail" name="center" frameborder="0"></iframe>
</div>
<div id="footer">Copyright ©清华大学出版社</div>
</body>
</html>

@ -131,11 +131,17 @@
transform: translate3d(-10px, 0, 0);
}
20%, 40%, 60%, 80% {
transform: translate3d(10px, 0, 0);
}
}
.shake {
animation-name: shake;
}
@ -149,6 +155,8 @@
transform: translateX(-6px) rotateY(-9deg);
}
18.5% {
transform: translateX(5px) rotateY(7deg);
}

Loading…
Cancel
Save