Compare commits

...

2 Commits

Author SHA1 Message Date
wobeitaoleshigexuruo
5f63b16145 Merge branch 'master' of https://git.xtaolabs.com/xtaodada/java_web_repair 2024-06-06 23:34:25 +08:00
wobeitaoleshigexuruo
0d9a1416e0 feat: stu info 2024-06-06 23:34:15 +08:00
6 changed files with 190 additions and 16 deletions

View File

@ -82,7 +82,7 @@ public class AdminManageController {
return "* 用户名不合法!";
} else if (password == null || !password.matches("\\w{6,20}")) {
return "* 密码不合法!";
} else if (!("系统管理员".equals(group) || "招生管理员".equals(group) || "教务管理员".equals(group))) {
} else if (!("超级管理员".equals(group))) {
return "* 管理组错误!";
}
return "";

View File

@ -3,6 +3,8 @@ package cn.edu.cqwu.repair.controller.stu;
import cn.edu.cqwu.repair.dao.OrderDao;
import cn.edu.cqwu.repair.dao.StuDao;
import cn.edu.cqwu.repair.entity.Order;
import cn.edu.cqwu.repair.entity.OrderStatus;
import cn.edu.cqwu.repair.entity.Stu;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -10,8 +12,10 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttribute;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
@Controller
public class StuCommentsController {
@ -31,16 +35,27 @@ public class StuCommentsController {
}
@RequestMapping("/stu/comment.do")
public String stuComment(int starRating, int id, HttpServletRequest request){
public String stuComment(int rating, int id, HttpServletRequest request,@SessionAttribute Stu stu){
Order byOrderId = orderDao.findByOrderId(id);
byOrderId.setScore(starRating);
byOrderId.setOrderStatus(OrderStatus.SCORED.value);
byOrderId.setScore(rating);
int update = orderDao.update(byOrderId);
if(update>0){
request.setAttribute("stuCurrentMess","评价成功");
ArrayList<Order> orders = orderDao.findCurrent(stu.getUserid());
if (orders != null) {
request.setAttribute("Orders", orders);
} else {
request.setAttribute("stuCurrentMess", "订单为空");
}
return "/stu/current";
}
request.setAttribute("stuUpdateScoreMess","评价失败");
return "/stu/updateScore";
}
}

View File

@ -0,0 +1,46 @@
package cn.edu.cqwu.repair.controller.stu;
import cn.edu.cqwu.repair.dao.OrderDao;
import cn.edu.cqwu.repair.dao.StuDao;
import cn.edu.cqwu.repair.entity.Order;
import cn.edu.cqwu.repair.entity.OrderStatus;
import cn.edu.cqwu.repair.entity.Stu;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttribute;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
@Controller
public class StuDetailController {
StuDao stuDao;
OrderDao orderDao;
@Autowired
public StuDetailController(StuDao stuDao,OrderDao orderDao) {
this.stuDao = stuDao;
this.orderDao = orderDao;
}
@RequestMapping("/stu/detail")
public String stuComment1(int id,Model model) {
Order byOrderId = orderDao.findByOrderId(id);
if(byOrderId!=null){
model.addAttribute("detail", byOrderId);
model.addAttribute("stuDetailMess", "成功");
return "/stu/detail";
}
model.addAttribute("stuDetailMess", "失败");
return "/stu/current";
}
}

View File

@ -78,7 +78,7 @@
</c:choose>
</td>
<td>
<a href="${webroot}/stu/detail.do?id=${repairOrder.orderId}">详情</a>
<a href="${webroot}/stu/detail?id=${repairOrder.orderId}">详情</a>
<a href="${webroot}/stu/comment?id=${repairOrder.orderId}">评价</a>
</td>
</tr>

View File

@ -0,0 +1,96 @@
<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2024/5/16
Time: 10:22
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="title" value="当前维修单"/>
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
<c:set var="repairOrder" value="${requestScope.detail}"/>
<html>
<head>
<link rel="stylesheet" href="${webroot}/styles/bootstrap.min.css">
<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 scrollspy" style="min-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 requestScope.stuDetailMess}">
<div class="alert alert-warning" role="alert">
${requestScope.stuDetailMess}
</div>
</c:if>
<form>
<div class="input-group mb-3">
<label for="serialNumber" class="input-group-text">序号:</label>
<input class="form-control" type="text" id="serialNumber" value="${detail.orderId}" readonly>
</div>
<div class="input-group mb-3">
<label for="contactName" class="input-group-text">联系人名称:</label>
<input class="form-control" type="text" id="contactName" value="${detail.contact}" readonly>
</div>
<div class="input-group mb-3">
<label for="contactPhone" class="input-group-text">联系人电话:</label>
<input class="form-control" type="text" id="contactPhone" value="${detail.phone}" readonly>
</div>
<div class="input-group mb-3">
<label for="location" class="input-group-text">详细地点:</label>
<input class="form-control" type="text" id="location" value="${detail.address}" readonly>
</div>
<div class="input-group mb-3">
<label for="faultDescription" class="input-group-text">故障描述:</label>
<input class="form-control" type="text" id="faultDescription" value="${detail.faultDesc}" readonly>
</div>
<div class="input-group mb-3">
<label for="processingStatus" class="input-group-text">处理状态:</label>
<input class="form-control" type="text" id="processingStatus" value="
<c:choose>
<c:when test="${repairOrder.orderStatus==0}">
待安排维修人员
</c:when>
<c:when test="${repairOrder.orderStatus==1}">
正在维修中
</c:when>
<c:when test="${repairOrder.orderStatus==2}">
等待评价
</c:when>
<c:otherwise>
维修已完成
</c:otherwise>
</c:choose>
" readonly>
</div>
<div class="input-group mb-3">
<c:if test="${detail.faultImg.length() > 0}">
<c:forEach items="${detail.faultImgArray}" var="img">
<img class="form-control" src="${webroot}${img}" style="width: 600px; height: auto"/>
</c:forEach>
</c:if>
</div>
</form>
</main>
</main>
</body>
</html>

View File

@ -6,30 +6,47 @@
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>javascript星级评分</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<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">
<title>星级评分</title>
<style type="text/css">
*{margin:0;padding:0;}
.wrapper{height:20px;padding:5px;width:130px;margin:100px auto 10px;background-color: #6c757d}
a{float:left;width:26px;height:20px;background:url(${webroot}/images/rating.png) 0 -20px no-repeat;}
p{font:24px SimSun;width:130px;margin-left:auto;margin-right:auto;}
.wrapper{
height:20px;padding:5px;width:130px;margin:100px auto 10px;background-color: #6c757d;
}
.aa{float:left;width:26px;height:20px;background:url(${webroot}/images/rating.png) 0 -20px no-repeat;}
.pp{font:24px SimSun;width:130px;margin-left:auto;margin-right:auto;}
</style>
</head>
<body>
<main class="d-flex flex-nowrap">
<%@ include file="../includes/header.jsp" %>
<main class="form-signin w-100 m-auto">
<img class="mb-4" src="${webroot}/images/logo.jpg" alt="" width="72" height="72">
<h1 class="h3 mb-3 fw-normal">用户中心</h1>
<form action="/stu/comment.do?id=${id}" method="post">
<div class="wrapper">
<input type="hidden" name="rating" id="rating" value="0"> <!-- 用于存储评分值 -->
<a href="javascript:;"></a>
<a href="javascript:;"></a>
<a href="javascript:;"></a>
<a href="javascript:;"></a>
<a href="javascript:;"></a>
<a class="aa" href="javascript:;"></a>
<a class="aa" href="javascript:;"></a>
<a class="aa" href="javascript:;"></a>
<a class="aa" href="javascript:;"></a>
<a class="aa" href="javascript:;"></a>
</div>
<p></p>
<p class="pp"></p>
<input type="submit" value="提交评分">
</form>
<p></p>
</main>
</main>
</body>
</html>
<script type="text/javascript">
window.onload = function(){