diff --git a/src/main/java/cn/edu/cqwu/repair/controller/stu/StuConsultController.java b/src/main/java/cn/edu/cqwu/repair/controller/stu/StuConsultController.java index ec094d8..10f70ae 100644 --- a/src/main/java/cn/edu/cqwu/repair/controller/stu/StuConsultController.java +++ b/src/main/java/cn/edu/cqwu/repair/controller/stu/StuConsultController.java @@ -32,6 +32,4 @@ public class StuConsultController { return "/stu/consult"; } - - } diff --git a/src/main/java/cn/edu/cqwu/repair/controller/stu/StuCurrentController.java b/src/main/java/cn/edu/cqwu/repair/controller/stu/StuCurrentController.java index 8191fba..7ff76ea 100644 --- a/src/main/java/cn/edu/cqwu/repair/controller/stu/StuCurrentController.java +++ b/src/main/java/cn/edu/cqwu/repair/controller/stu/StuCurrentController.java @@ -3,7 +3,6 @@ package cn.edu.cqwu.repair.controller.stu; import cn.edu.cqwu.repair.dao.OrderDao; import cn.edu.cqwu.repair.entity.Order; -import cn.edu.cqwu.repair.entity.OrderStatus; import cn.edu.cqwu.repair.entity.Stu; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -25,24 +24,12 @@ public class StuCurrentController { @GetMapping("/stu/current") public String current(HttpServletRequest request, @SessionAttribute Stu stu) { - ArrayList orders = orderDao.findByStudent_id(stu.getUserid()); - ArrayList orders1 = new ArrayList<>(); - for (Order order : orders) { - if (order.getOrderStatus() == OrderStatus.UNASSIGNED.value || order.getOrderStatus() == OrderStatus.PROGRESS.value) { - - orders1.add(order); - - } - } - if (orders1 != null) { - request.setAttribute("Orders", orders1); + ArrayList orders = orderDao.findCurrent(stu.getUserid()); + if (orders != null) { + request.setAttribute("Orders", orders); } else { request.setAttribute("stuCurrentMess", "订单为空"); } return "/stu/current"; - - } - - } diff --git a/src/main/java/cn/edu/cqwu/repair/controller/stu/StuUploadController.java b/src/main/java/cn/edu/cqwu/repair/controller/stu/StuUploadController.java index 484c295..ebd00e2 100644 --- a/src/main/java/cn/edu/cqwu/repair/controller/stu/StuUploadController.java +++ b/src/main/java/cn/edu/cqwu/repair/controller/stu/StuUploadController.java @@ -17,6 +17,9 @@ import javax.servlet.http.HttpServletRequest; import java.io.File; import java.util.ArrayList; +/** + * @author xtaod + */ @Controller public class StuUploadController { @@ -73,7 +76,7 @@ public class StuUploadController { if (myfile != null) { for (int i = 0; i < myfile.length; i++) { String filepath = saveFile(myfile[i], path, path2, time + "", i); - if (filepath.equals("图片格式不正确")) { + if ("图片格式不正确".equals(filepath)) { req.setAttribute("stuUploadMess", "图片格式不正确"); return "/stu/upload"; } else { diff --git a/src/main/java/cn/edu/cqwu/repair/dao/OrderDao.java b/src/main/java/cn/edu/cqwu/repair/dao/OrderDao.java index 40782b7..d38878d 100644 --- a/src/main/java/cn/edu/cqwu/repair/dao/OrderDao.java +++ b/src/main/java/cn/edu/cqwu/repair/dao/OrderDao.java @@ -8,6 +8,7 @@ public interface OrderDao { int add(Order order); ArrayList findByStudent_id(int stuId); + ArrayList findCurrent(int stuId); ArrayList findByWorkerId(int workerId); public int statusModify(int orderId); diff --git a/src/main/java/cn/edu/cqwu/repair/dao/impl/OrderDaoImpl.java b/src/main/java/cn/edu/cqwu/repair/dao/impl/OrderDaoImpl.java index 313e9ba..2a1c61a 100644 --- a/src/main/java/cn/edu/cqwu/repair/dao/impl/OrderDaoImpl.java +++ b/src/main/java/cn/edu/cqwu/repair/dao/impl/OrderDaoImpl.java @@ -3,6 +3,7 @@ package cn.edu.cqwu.repair.dao.impl; import cn.edu.cqwu.repair.dao.OrderDao; import cn.edu.cqwu.repair.db.ConnectionFactory; import cn.edu.cqwu.repair.entity.Order; +import cn.edu.cqwu.repair.entity.OrderStatus; import cn.edu.cqwu.repair.entity.Worker; import cn.edu.cqwu.repair.entity.mapper.DeviceMapper; import cn.edu.cqwu.repair.entity.mapper.OrderMapper; @@ -34,6 +35,15 @@ public class OrderDaoImpl implements OrderDao { return (ArrayList) mapper.selectListByQuery(qw); } + @Override + public ArrayList findCurrent(int stuId) { + QueryWrapper qw = new QueryWrapper(); + qw.select(ORDER.ALL_COLUMNS) + .where(ORDER.STUDENT_ID.eq(stuId)) + .where(ORDER.ORDER_STATUS.in(OrderStatus.getCurrent())); + return (ArrayList) mapper.selectListByQuery(qw); + } + @Override public ArrayList findByWorkerId(int workerId){ QueryWrapper qw = new QueryWrapper(); diff --git a/src/main/java/cn/edu/cqwu/repair/entity/OrderStatus.java b/src/main/java/cn/edu/cqwu/repair/entity/OrderStatus.java index cb13786..7391535 100644 --- a/src/main/java/cn/edu/cqwu/repair/entity/OrderStatus.java +++ b/src/main/java/cn/edu/cqwu/repair/entity/OrderStatus.java @@ -16,4 +16,7 @@ public enum OrderStatus { this.value = value; } + public static int[] getCurrent() { + return new int[]{0, 1, 2}; + } } diff --git a/src/main/webapp/stu/consult.jsp b/src/main/webapp/stu/consult.jsp index 5794fee..f2743c8 100644 --- a/src/main/webapp/stu/consult.jsp +++ b/src/main/webapp/stu/consult.jsp @@ -4,7 +4,7 @@ <%@ 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" %> - + @@ -23,31 +23,28 @@
<%@ include file="../includes/header.jsp" %> -
+
-

查看订单

+

${title}

-
- - - - - - - - - - - - - - - +
序号联系人名称联系人电话详细地点故障描述故障图片处理状态
+ + + + + + + + + + + + @@ -55,7 +52,6 @@ - +
序号联系人名称联系人电话详细地点故障描述处理状态操作
${loop.index + 1}${repairOrder.phone} ${repairOrder.address} ${repairOrder.faultDesc}故障图片 @@ -64,30 +60,22 @@ 正在维修中 + + 等待评价 + 维修已完成 + 详情 +
-
- -
-
-<%----%> -<%----%> -<%----%> - - diff --git a/src/main/webapp/stu/current.jsp b/src/main/webapp/stu/current.jsp index 33780ab..9ccc984 100644 --- a/src/main/webapp/stu/current.jsp +++ b/src/main/webapp/stu/current.jsp @@ -10,7 +10,7 @@ <%@ 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" %> - + @@ -30,47 +30,38 @@
<%@ include file="../includes/header.jsp" %> -
+
-

查看订单

+

${title}

+ -
- - - - - - - - - - - - - - - - +
序号联系人名称联系人电话详细地点故障描述故障图片处理状态
+ + + + + + + + + + + - - - - - - - - - - - + + + + + - + - - - - -
序号联系人名称联系人电话详细地点故障描述处理状态操作
第 ${loop.index + 1} 项订单联系人名称:${repairOrder.contact}联系人名称:${repairOrder.contact}联系人电话:${repairOrder.phone}详细地点:${repairOrder.address}故障描述:${repairOrder.faultDesc}故障图片:故障图片处理状态: + ${loop.index + 1}${repairOrder.contact}${repairOrder.phone}${repairOrder.address}${repairOrder.faultDesc} 待安排维修人员 @@ -78,21 +69,20 @@ 正在维修中 + + 等待评价 + 维修已完成 + 详情 +
-