Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
395d43c7a3
@ -3,6 +3,7 @@
|
||||
<component name="WebContextManager">
|
||||
<option name="state">
|
||||
<map>
|
||||
<entry key="file://$PROJECT_DIR$/src/main/webapp/admin/device.jsp" value="file://$PROJECT_DIR$/src/main/webapp/admin" />
|
||||
<entry key="file://$PROJECT_DIR$/src/main/webapp/student/register.jsp" value="file://$PROJECT_DIR$/src/main/webapp/student" />
|
||||
<entry key="file://$PROJECT_DIR$/src/main/webapp/worker/worker_center_index.jsp" value="file://$PROJECT_DIR$/src/main/webapp/worker" />
|
||||
</map>
|
||||
|
@ -0,0 +1,36 @@
|
||||
package cn.edu.cqwu.repair.controller.admin;
|
||||
|
||||
import cn.edu.cqwu.repair.dao.DeviceDao;
|
||||
import cn.edu.cqwu.repair.entity.Device;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author xtaod
|
||||
*/
|
||||
@Controller
|
||||
public class AdminDeviceController {
|
||||
private final DeviceDao deviceDao;
|
||||
|
||||
public AdminDeviceController(DeviceDao deviceDao) {
|
||||
this.deviceDao = deviceDao;
|
||||
}
|
||||
|
||||
@RequestMapping("/admin/device/query.do")
|
||||
public String query(int deviceTypeId, int deviceAddressId, int deviceStatus, Model model) {
|
||||
model.addAttribute("deviceTypeId", deviceTypeId);
|
||||
model.addAttribute("deviceAddressId", deviceAddressId);
|
||||
model.addAttribute("deviceStatus", deviceStatus);
|
||||
ArrayList<Device> deviceList = deviceDao.findAllDevice(deviceTypeId, deviceAddressId, deviceStatus);
|
||||
if (deviceList == null || deviceList.isEmpty()) {
|
||||
model.addAttribute("deviceMess", "没有查询到设备信息");
|
||||
} else {
|
||||
model.addAttribute("deviceMess", "查询到" + deviceList.size() + "条设备信息");
|
||||
}
|
||||
model.addAttribute("devices", deviceList);
|
||||
return "/admin/device";
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package cn.edu.cqwu.repair.controller.admin;
|
||||
|
||||
import cn.edu.cqwu.repair.dao.AdminUserDao;
|
||||
import cn.edu.cqwu.repair.entity.AdminUser;
|
||||
import cn.edu.cqwu.repair.util.Encrypt;
|
||||
import cn.edu.cqwu.repair.util.Verify;
|
||||
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.SessionAttribute;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
/**
|
||||
* @author xtaod
|
||||
*/
|
||||
@Controller
|
||||
public class AdminPassController {
|
||||
AdminUserDao adminUserDao;
|
||||
|
||||
@Autowired
|
||||
public AdminPassController(AdminUserDao adminUserDao) {
|
||||
this.adminUserDao = adminUserDao;
|
||||
}
|
||||
|
||||
@RequestMapping("/admin/pass.do")
|
||||
public String pass(
|
||||
@SessionAttribute AdminUser adminUser,
|
||||
String oldPassword,
|
||||
String password,
|
||||
String confirmpass,
|
||||
String code,
|
||||
HttpSession session,
|
||||
HttpServletRequest request,
|
||||
Model model
|
||||
) {
|
||||
String username = adminUser.getAdminName();
|
||||
String mess = Verify.validateForm1(username, oldPassword, password, confirmpass, code);
|
||||
if (!mess.isEmpty()) {
|
||||
model.addAttribute("adminPassMess", mess);
|
||||
return "/admin/pass";
|
||||
}
|
||||
if (!Verify.verifyCode(session, code)) {
|
||||
model.addAttribute("adminPassMess", "* 验证码错误!");
|
||||
return "/admin/pass";
|
||||
}
|
||||
AdminUser byUsername = adminUserDao.validateLogin(username, Encrypt.SHA(oldPassword));
|
||||
if (byUsername == null) {
|
||||
model.addAttribute("adminPassMess", "* 旧密码错误!");
|
||||
return "/admin/pass";
|
||||
}
|
||||
if (adminUserDao.passModify(username, Encrypt.SHA(password)) == 1) {
|
||||
request.setAttribute("adminPassMess", "* 修改成功!");
|
||||
} else {
|
||||
request.setAttribute("adminPassMess", "* 修改失败!");
|
||||
}
|
||||
return "/admin/pass";
|
||||
}
|
||||
}
|
@ -1,12 +1,16 @@
|
||||
package cn.edu.cqwu.repair.dao;
|
||||
|
||||
import cn.edu.cqwu.repair.entity.Device;
|
||||
import cn.edu.cqwu.repair.entity.Stu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author wobeitaoleshigexuruo
|
||||
*/
|
||||
public interface DeviceDao {
|
||||
|
||||
public ArrayList<Device> findAllDevice();
|
||||
ArrayList<Device> findAllDevice();
|
||||
|
||||
ArrayList<Device> findAllDevice(int deviceTypeId, int deviceAddressId, int deviceStatus);
|
||||
|
||||
}
|
||||
|
@ -1,17 +1,19 @@
|
||||
package cn.edu.cqwu.repair.dao.impl;
|
||||
|
||||
import cn.edu.cqwu.repair.dao.DeviceDao;
|
||||
import cn.edu.cqwu.repair.dao.StuDao;
|
||||
import cn.edu.cqwu.repair.db.ConnectionFactory;
|
||||
import cn.edu.cqwu.repair.entity.Device;
|
||||
import cn.edu.cqwu.repair.entity.Stu;
|
||||
import cn.edu.cqwu.repair.entity.mapper.AdminUserMapper;
|
||||
import cn.edu.cqwu.repair.entity.mapper.DeviceMapper;
|
||||
import cn.edu.cqwu.repair.service.RecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static cn.edu.cqwu.repair.entity.table.DeviceTableDef.DEVICE;
|
||||
|
||||
/**
|
||||
* @author wobeitaoleshigexuruo
|
||||
*/
|
||||
@Component
|
||||
public class DeviceDaoImpl implements DeviceDao {
|
||||
private static final DeviceMapper mapper = ConnectionFactory.getMapper(DeviceMapper.class);
|
||||
@ -20,4 +22,19 @@ public class DeviceDaoImpl implements DeviceDao {
|
||||
public ArrayList<Device> findAllDevice() {
|
||||
return (ArrayList<Device>) mapper.selectAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Device> findAllDevice(int deviceTypeId, int deviceAddressId, int deviceStatus) {
|
||||
QueryWrapper qw = new QueryWrapper();
|
||||
if (deviceTypeId > 0) {
|
||||
qw.where(DEVICE.DEVICE_TYPE_ID.eq(deviceTypeId));
|
||||
}
|
||||
if (deviceAddressId > 0) {
|
||||
qw.where(DEVICE.DEVICE_ADDRESS_ID.eq(deviceAddressId));
|
||||
}
|
||||
if (deviceStatus >= 0) {
|
||||
qw.where(DEVICE.DEVICE_STATUS.eq(deviceStatus));
|
||||
}
|
||||
return (ArrayList<Device>) mapper.selectListByQuery(qw);
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public class ConnectionFactory {
|
||||
public static final String PASSWORD = "J3YNtU6v2dvio3gj6M7r";
|
||||
public static final String HOST = "10.151.0.67";
|
||||
public static final String DATABASE = "repair";
|
||||
public static final String URL = "jdbc:mysql://" + HOST + ":3306/" + DATABASE + "?useSSL=false&serverTimezone=Asia/Shanghai";
|
||||
public static final String URL = "jdbc:mysql://" + HOST + ":3306/" + DATABASE + "?allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai";
|
||||
public static MybatisFlexBootstrap bootstrap;
|
||||
|
||||
public static HashMap<String, Object> mappers = new HashMap<>();
|
||||
|
@ -23,9 +23,9 @@ public class Verify {
|
||||
}
|
||||
|
||||
public static String validateForm1(String username, String oldPasswrd, String password, String confirmpass, String code) {
|
||||
if (username == null || !username.matches("\\w{6,20}")) {
|
||||
if (username == null || !username.matches("\\w{5,20}")) {
|
||||
return "* 用户名不合法!";
|
||||
} else if (password == null || !password.matches("\\w{6,20}")) {
|
||||
} else if (password == null || !password.matches("\\w{5,20}")) {
|
||||
return "* 密码不合法!";
|
||||
} else if (password.equals(oldPasswrd)) {
|
||||
return "* 新密码不能与旧密码相同!";
|
||||
@ -41,9 +41,9 @@ public class Verify {
|
||||
if (stuNo == null || !stuNo.matches("\\d{12}")) {
|
||||
return "* 学号不合法!";
|
||||
}
|
||||
if (username == null || !username.matches("\\w{6,20}")) {
|
||||
if (username == null || !username.matches("\\w{5,20}")) {
|
||||
return "* 用户名不合法!";
|
||||
} else if (password == null || !password.matches("\\w{6,20}")) {
|
||||
} else if (password == null || !password.matches("\\w{5,20}")) {
|
||||
return "* 密码不合法!";
|
||||
} else if (!password.equals(confirmpass)) {
|
||||
return "* 两次输入的密码不一致,请重新输入!";
|
||||
|
107
src/main/webapp/admin/device.jsp
Normal file
107
src/main/webapp/admin/device.jsp
Normal file
@ -0,0 +1,107 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: xtaod
|
||||
Date: 2024/5/16
|
||||
Time: 上午8:29
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ page isELIgnored="false" %>
|
||||
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
|
||||
<c:set var="title" value="设备维护"/>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>${title}</title>
|
||||
<link rel="stylesheet" href="${webroot}/styles/bootstrap.min.css" crossorigin="anonymous">
|
||||
<script src="${webroot}/js/bootstrap.bundle.min.js"></script>
|
||||
<link rel="stylesheet" href="${webroot}/styles/sidebar.css" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="${webroot}/styles/index.css" crossorigin="anonymous">
|
||||
</head>
|
||||
<body>
|
||||
<main class="d-flex flex-nowrap">
|
||||
<%@ include file="../includes/header.jsp" %>
|
||||
|
||||
<main class="form-signin w-100 m-auto" style="max-width: 800px;">
|
||||
<img class="mb-4" src="${webroot}/images/logo.jpg" alt="" width="72" height="72">
|
||||
<h1 class="h3 mb-3 fw-normal">${title}</h1>
|
||||
<c:if test="${not empty deviceMess}">
|
||||
<div class="alert alert-warning" role="alert">
|
||||
${deviceMess}
|
||||
</div>
|
||||
</c:if>
|
||||
|
||||
<form action="${webroot}/admin/device/query.do" method="post">
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text">设备类型</span>
|
||||
<select class="form-select" name="deviceTypeId" id="deviceTypeId" required>
|
||||
<option value="0">所有</option>
|
||||
<c:forEach items="${applicationScope.faults}" var="deviceType">
|
||||
<option value="${deviceType.faultId}" <c:if test="${deviceType.faultId == deviceTypeId}">selected</c:if>>
|
||||
${deviceType.faultName}
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text">设备区域</span>
|
||||
<select class="form-select" name="deviceAddressId" id="deviceAddressId" required>
|
||||
<option value="0">所有</option>
|
||||
<c:forEach items="${applicationScope.addresses0}" var="address">
|
||||
<option value="${address.addressId}" <c:if test="${address.addressId == deviceAddressId}">selected</c:if>>
|
||||
${address.addressName}
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text">设备状态</span>
|
||||
<select class="form-select" name="deviceStatus" id="deviceStatus" required>
|
||||
<option value="-1" <c:if test="${deviceStatus == -1}">selected</c:if>>所有</option>
|
||||
<option value="0" <c:if test="${deviceStatus == 0}">selected</c:if>>正常</option>
|
||||
<option value="1" <c:if test="${deviceStatus == 1}">selected</c:if>>维修中</option>
|
||||
</select>
|
||||
</div>
|
||||
<input class="btn btn-primary w-100 py-2" type="submit" id="submit" value="查询">
|
||||
<br/><br/>
|
||||
</form>
|
||||
|
||||
<c:if test="${not empty devices}">
|
||||
<h5>查询到的设备列表</h5>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">序号</th>
|
||||
<th scope="col">设备名称</th>
|
||||
<th scope="col">设备状态</th>
|
||||
<th scope="col">详细地址</th>
|
||||
<th scope="col">创建时间</th>
|
||||
<th scope="col">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${devices}" var="device" varStatus="rows">
|
||||
<tr>
|
||||
<td>${rows.count}</td>
|
||||
<td>${device.deviceName}</td>
|
||||
<td>
|
||||
<c:if test="${device.deviceStatus == 0}">正常</c:if>
|
||||
<c:if test="${device.deviceStatus == 1}">维修中</c:if>
|
||||
</td>
|
||||
<td>${device.deviceAddressDetail}</td>
|
||||
<td>${device.createTime}</td>
|
||||
<td>
|
||||
<a href="${webroot}/admin/device/queryEdit.do?deviceId=${device.deviceId}">编辑</a><br/>
|
||||
<a href="${webroot}/admin/device/delete.do?deviceId=${device.deviceId}">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</c:if>
|
||||
</main>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
69
src/main/webapp/admin/pass.jsp
Normal file
69
src/main/webapp/admin/pass.jsp
Normal file
@ -0,0 +1,69 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: xtaod
|
||||
Date: 2024/5/16
|
||||
Time: 上午8:29
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ page isELIgnored="false" %>
|
||||
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
|
||||
<c:set var="title" value="修改密码"/>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>${title}</title>
|
||||
<link rel="stylesheet" href="${webroot}/styles/bootstrap.min.css" crossorigin="anonymous">
|
||||
<script src="${webroot}/js/bootstrap.bundle.min.js"></script>
|
||||
<link rel="stylesheet" href="${webroot}/styles/sidebar.css" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="${webroot}/styles/index.css" crossorigin="anonymous">
|
||||
</head>
|
||||
<body>
|
||||
<main class="d-flex flex-nowrap">
|
||||
<%@ include file="../includes/header.jsp" %>
|
||||
|
||||
<main class="form-signin w-100 m-auto">
|
||||
<form action="${webroot}/admin/pass.do" method="post">
|
||||
<img class="mb-4" src="${webroot}/images/logo.jpg" alt="" width="72" height="72">
|
||||
<h1 class="h3 mb-3 fw-normal">修改密码</h1>
|
||||
|
||||
<c:if test="${not empty requestScope.adminPassMess}">
|
||||
<div class="alert alert-warning" role="alert">
|
||||
${requestScope.adminPassMess}
|
||||
</div>
|
||||
</c:if>
|
||||
|
||||
<div class="form-floating">
|
||||
<input type="password" class="form-control" name="oldPassword" id="oldPassword" value="${oldPassword}"
|
||||
required>
|
||||
<label for="oldPassword">旧密码</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="password" class="form-control" name="password" id="password" value="${password}" required>
|
||||
<label for="password">密码</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="password" class="form-control" name="confirmpass" id="confirmpass" value="${confirmpass}"
|
||||
required>
|
||||
<label for="confirmpass">确认密码</label>
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control" placeholder="验证码" name="code" id="code" required>
|
||||
<span class="input-group-text">
|
||||
<img src="${pageContext.request.contextPath}/includes/code.jsp" id="imagecode"
|
||||
title="点击图片可刷新验证码"
|
||||
onclick="this.src='${pageContext.request.contextPath}/includes/code.jsp?'+Math.random()">
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<input class="btn btn-primary w-100 py-2" type="submit" id="submit">
|
||||
<br/><br/>
|
||||
</form>
|
||||
</main>
|
||||
</main>
|
||||
<script src="${webroot}/js/pass.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -77,7 +77,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="${webroot}/admin/state.jsp" class="nav-link link-body-emphasis" aria-current="page">
|
||||
<a href="${webroot}/admin/device.jsp" class="nav-link link-body-emphasis" aria-current="page">
|
||||
>> 设备管理
|
||||
</a>
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user