From 2bd6e8c4c993901b8a43936b825633c55317084e Mon Sep 17 00:00:00 2001 From: zhai_lw Date: Mon, 14 Jan 2019 22:34:13 +0800 Subject: [PATCH] =?UTF-8?q?S=5FServlet=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/misc.xml | 2 +- .../process/C_StudentUploadOpeningReport.java | 28 +++++++++---------- .../C_TeacherFillTopicInformation.java | 6 ++-- .../S_CollegeFillOpeningReportOpinion.java | 12 ++++---- src/servlet/S_CollegeFillScoreOpinion.java | 12 ++++---- .../S_MentorFillOpeningReportOpinion.java | 12 ++++---- src/servlet/S_MentorFillReview.java | 12 ++++---- src/servlet/S_ReviewerFillReview.java | 12 ++++---- src/servlet/S_SchoolFillScoreOpinion.java | 12 ++++---- .../S_SecretaryFillOpeningReportRecord.java | 12 ++++---- src/servlet/S_SecretaryFillReplyRecord.java | 12 ++++---- ...tudentFillGraduationDesignInformation.java | 20 ++++++++----- src/servlet/S_StudentSelectTeacher.java | 8 +++--- .../S_StudentUploadFinishedProduct.java | 8 ++---- src/servlet/S_TeacherSelectStudent.java | 8 +++--- ...S_TeacherTeamFillOpeningReportOpinion.java | 14 ++++++---- .../S_TeacherTeamFillScoreOpinion.java | 14 ++++++---- src/servlet/Utils.java | 14 ++++++++++ 18 files changed, 128 insertions(+), 90 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 9486b47..11bca97 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/core/process/C_StudentUploadOpeningReport.java b/src/core/process/C_StudentUploadOpeningReport.java index 88ed26e..736c2fb 100644 --- a/src/core/process/C_StudentUploadOpeningReport.java +++ b/src/core/process/C_StudentUploadOpeningReport.java @@ -1,6 +1,6 @@ package core.process; -import core.operation.UploadFileOperation; +import core.operation.UploadFile; import error.GExcptInit; import java.io.File; @@ -9,24 +9,24 @@ import java.util.Map; public class C_StudentUploadOpeningReport extends TempProcess{ File openingReport; - String gaduationDesignId; + String graduationDesignId; static String file_type = "opening_report"; public void uploadOpeningReport() throws Exception{ if(!check()) throw new GExcptInit("Upload OpeningReport Attrs init error!"); - UploadFileOperation uploadFileOperation=new UploadFileOperation(); - uploadFileOperation.setOptions(new HashMap<>()); - uploadFileOperation.addOptions("file",this.getOpeningReport()); - uploadFileOperation.addOptions("file_type",file_type); + UploadFile uploadFile=new UploadFile(); + uploadFile.setOptions(new HashMap<>()); + uploadFile.addOptions("file",this.getOpeningReport()); + uploadFile.addOptions("file_type",file_type); Maplimits = new HashMap<>(); - limits.put("id",this.getGaduationDesignId()); - uploadFileOperation.addOptions("limits",limits); - uploadFileOperation.execute(null); + limits.put("id",this.getGraduationDesignId()); + uploadFile.addOptions("limits",limits); + uploadFile.execute(null); } protected boolean check() { - if(this.getGaduationDesignId()==null||this.getOpeningReport()==null) + if(this.getGraduationDesignId()==null||this.getOpeningReport()==null) return false; return true; } @@ -39,11 +39,11 @@ public class C_StudentUploadOpeningReport extends TempProcess{ this.openingReport = openingReport; } - public String getGaduationDesignId() { - return gaduationDesignId; + public String getGraduationDesignId() { + return graduationDesignId; } - public void setGaduationDesignId(String gaduationDesignId) { - this.gaduationDesignId = gaduationDesignId; + public void setGraduationDesignId(String graduationDesignId) { + this.graduationDesignId = graduationDesignId; } } diff --git a/src/core/process/C_TeacherFillTopicInformation.java b/src/core/process/C_TeacherFillTopicInformation.java index 6d72cd4..fe0b59c 100644 --- a/src/core/process/C_TeacherFillTopicInformation.java +++ b/src/core/process/C_TeacherFillTopicInformation.java @@ -9,7 +9,7 @@ import java.util.Map; public class C_TeacherFillTopicInformation extends TempProcess{ - String StudentId; + String studentId; String mentor_opinion; Date mentor_opinion_date; @@ -36,11 +36,11 @@ public class C_TeacherFillTopicInformation extends TempProcess{ return true; } public String getStudentId() { - return StudentId; + return studentId; } public void setStudentId(String studentId) { - StudentId = studentId; + this.studentId = studentId; } public String getMentor_opinion() { return mentor_opinion; diff --git a/src/servlet/S_CollegeFillOpeningReportOpinion.java b/src/servlet/S_CollegeFillOpeningReportOpinion.java index 774b28f..6162fa5 100644 --- a/src/servlet/S_CollegeFillOpeningReportOpinion.java +++ b/src/servlet/S_CollegeFillOpeningReportOpinion.java @@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Map; @WebServlet(name = "S_CollegeFillOpeningReportOpinion") public class S_CollegeFillOpeningReportOpinion extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String id = request.getParameter("id"); + Map vMap = servlet.Utils.getVMap(vName,request); } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - } -} + static String[] vName = { + "" + }; +} \ No newline at end of file diff --git a/src/servlet/S_CollegeFillScoreOpinion.java b/src/servlet/S_CollegeFillScoreOpinion.java index e937d1d..0d25745 100644 --- a/src/servlet/S_CollegeFillScoreOpinion.java +++ b/src/servlet/S_CollegeFillScoreOpinion.java @@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Map; @WebServlet(name = "S_CollegeFillScoreOpinion") public class S_CollegeFillScoreOpinion extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String id = request.getParameter("id"); + Map vMap = servlet.Utils.getVMap(vName,request); } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - } -} + static String[] vName = { + "" + }; +} \ No newline at end of file diff --git a/src/servlet/S_MentorFillOpeningReportOpinion.java b/src/servlet/S_MentorFillOpeningReportOpinion.java index 409ff1f..625520f 100644 --- a/src/servlet/S_MentorFillOpeningReportOpinion.java +++ b/src/servlet/S_MentorFillOpeningReportOpinion.java @@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Map; @WebServlet(name = "S_MentorFillOpeningReportOpinion") public class S_MentorFillOpeningReportOpinion extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String id = request.getParameter("id"); + Map vMap = servlet.Utils.getVMap(vName,request); } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - } -} + static String[] vName = { + "" + }; +} \ No newline at end of file diff --git a/src/servlet/S_MentorFillReview.java b/src/servlet/S_MentorFillReview.java index 732bf0e..f28b2d1 100644 --- a/src/servlet/S_MentorFillReview.java +++ b/src/servlet/S_MentorFillReview.java @@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Map; @WebServlet(name = "S_MentorFillReview") public class S_MentorFillReview extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String id = request.getParameter("id"); + Map vMap = servlet.Utils.getVMap(vName,request); } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - } -} + static String[] vName = { + "" + }; +} \ No newline at end of file diff --git a/src/servlet/S_ReviewerFillReview.java b/src/servlet/S_ReviewerFillReview.java index 437556e..a23d80a 100644 --- a/src/servlet/S_ReviewerFillReview.java +++ b/src/servlet/S_ReviewerFillReview.java @@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Map; @WebServlet(name = "S_ReviewerFillReview") public class S_ReviewerFillReview extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String id = request.getParameter("id"); + Map vMap = servlet.Utils.getVMap(vName,request); } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - } -} + static String[] vName = { + "" + }; +} \ No newline at end of file diff --git a/src/servlet/S_SchoolFillScoreOpinion.java b/src/servlet/S_SchoolFillScoreOpinion.java index 4ece4f4..97d7cd5 100644 --- a/src/servlet/S_SchoolFillScoreOpinion.java +++ b/src/servlet/S_SchoolFillScoreOpinion.java @@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Map; @WebServlet(name = "S_SchoolFillScoreOpinion") public class S_SchoolFillScoreOpinion extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String id = request.getParameter("id"); + Map vMap = servlet.Utils.getVMap(vName,request); } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - } -} + static String[] vName = { + "" + }; +} \ No newline at end of file diff --git a/src/servlet/S_SecretaryFillOpeningReportRecord.java b/src/servlet/S_SecretaryFillOpeningReportRecord.java index 74926a9..0fc9fb5 100644 --- a/src/servlet/S_SecretaryFillOpeningReportRecord.java +++ b/src/servlet/S_SecretaryFillOpeningReportRecord.java @@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Map; @WebServlet(name = "S_SecretaryFillOpeningReportRecord") public class S_SecretaryFillOpeningReportRecord extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String id = request.getParameter("id"); + Map vMap = servlet.Utils.getVMap(vName,request); } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - } -} + static String[] vName = { + "" + }; +} \ No newline at end of file diff --git a/src/servlet/S_SecretaryFillReplyRecord.java b/src/servlet/S_SecretaryFillReplyRecord.java index ea217f6..7b20ab4 100644 --- a/src/servlet/S_SecretaryFillReplyRecord.java +++ b/src/servlet/S_SecretaryFillReplyRecord.java @@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Map; -@WebServlet(name = "S_SecretaryFillReplyRecord") +@WebServlet(name = "secretary-fill-reply-record") public class S_SecretaryFillReplyRecord extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String id = request.getParameter("id"); + Map vMap = servlet.Utils.getVMap(vName,request); } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - } + static String[] vName = { + "" + }; } diff --git a/src/servlet/S_StudentFillGraduationDesignInformation.java b/src/servlet/S_StudentFillGraduationDesignInformation.java index 142b43d..d91779c 100644 --- a/src/servlet/S_StudentFillGraduationDesignInformation.java +++ b/src/servlet/S_StudentFillGraduationDesignInformation.java @@ -1,23 +1,29 @@ package servlet; +import core.user.User; + import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Map; @WebServlet("/student-fill-graduation-design-information") public class S_StudentFillGraduationDesignInformation extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - super.doPost(request, response); - String content1=new String(request.getParameter("text").getBytes("ISO8859-1"),"UTF-8"); - String content2=request.getParameter("score"); - try { + String id = request.getParameter("id"); + Map vMap = servlet.Utils.getVMap(vName,request); - } catch (Exception e) { - e.printStackTrace(); - } } + static String[] vName = { + "chinese_name", + "english_name", + "type_of_topic", + "source_of_design", + "nature_of_design", + "description_of_topic" + }; } diff --git a/src/servlet/S_StudentSelectTeacher.java b/src/servlet/S_StudentSelectTeacher.java index bc76e6c..69b8893 100644 --- a/src/servlet/S_StudentSelectTeacher.java +++ b/src/servlet/S_StudentSelectTeacher.java @@ -13,13 +13,13 @@ import java.io.IOException; public class S_StudentSelectTeacher extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { super.doPost(request, response); - String teacher_id=request.getParameter("id"); + String teacherId=request.getParameter("id"); User user=(User)request.getSession().getAttribute("user"); - String student_id=user.getId(); + String studentId=user.getId(); try { C_StudentSelectTeacher SST=new C_StudentSelectTeacher(); - SST.setTeacherId(teacher_id); - SST.setStudentId(student_id); + SST.setTeacherId(teacherId); + SST.setStudentId(studentId); SST.select(); } catch (Exception e) { e.printStackTrace(); diff --git a/src/servlet/S_StudentUploadFinishedProduct.java b/src/servlet/S_StudentUploadFinishedProduct.java index 0389973..9eaec19 100644 --- a/src/servlet/S_StudentUploadFinishedProduct.java +++ b/src/servlet/S_StudentUploadFinishedProduct.java @@ -1,19 +1,17 @@ package servlet; import javax.servlet.ServletException; +import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -@WebServlet(name = "S_StudentUploadFinishedProduct") +@WebServlet(name = "student-upload-finished-product") +@MultipartConfig public class S_StudentUploadFinishedProduct extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - } } diff --git a/src/servlet/S_TeacherSelectStudent.java b/src/servlet/S_TeacherSelectStudent.java index fe20103..ab880eb 100644 --- a/src/servlet/S_TeacherSelectStudent.java +++ b/src/servlet/S_TeacherSelectStudent.java @@ -13,13 +13,13 @@ import java.io.IOException; public class S_TeacherSelectStudent extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { super.doPost(request, response); - String student_id=request.getParameter("id"); + String studentId=request.getParameter("id"); User user=(User)request.getSession().getAttribute("user"); - String teacher_id=user.getId(); + String teacherId=user.getId(); try { C_TeacherSelectStudent TSS=new C_TeacherSelectStudent(); - TSS.setTeacherId(teacher_id); - TSS.setStudentId(student_id); + TSS.setTeacherId(teacherId); + TSS.setStudentId(studentId); TSS.select(); } catch (Exception e) { e.printStackTrace(); diff --git a/src/servlet/S_TeacherTeamFillOpeningReportOpinion.java b/src/servlet/S_TeacherTeamFillOpeningReportOpinion.java index ac47c5b..4e55b0a 100644 --- a/src/servlet/S_TeacherTeamFillOpeningReportOpinion.java +++ b/src/servlet/S_TeacherTeamFillOpeningReportOpinion.java @@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Map; -@WebServlet(name = "S_TeacherTeamFillOpeningReportOpinion") +@WebServlet(name = "teacher-team-fill-opening-report-opinion") public class S_TeacherTeamFillOpeningReportOpinion extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String id = request.getParameter("id"); + Map vMap = servlet.Utils.getVMap(vName,request); } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - } -} + static String[] vName = { + "" + }; +} \ No newline at end of file diff --git a/src/servlet/S_TeacherTeamFillScoreOpinion.java b/src/servlet/S_TeacherTeamFillScoreOpinion.java index e3418ef..a72ac08 100644 --- a/src/servlet/S_TeacherTeamFillScoreOpinion.java +++ b/src/servlet/S_TeacherTeamFillScoreOpinion.java @@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Map; -@WebServlet(name = "S_TeacherFillTeamFillScoreOpinion") -public class S_TeacherFillTeamFillScoreOpinion extends HttpServlet { +@WebServlet(name = "S_TeacherTeamFillScoreOpinion") +public class S_TeacherTeamFillScoreOpinion extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String id = request.getParameter("id"); + Map vMap = servlet.Utils.getVMap(vName,request); } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - } + static String[] vName = { + "" + }; } diff --git a/src/servlet/Utils.java b/src/servlet/Utils.java index 06037af..7176796 100644 --- a/src/servlet/Utils.java +++ b/src/servlet/Utils.java @@ -1,4 +1,18 @@ package servlet; +import org.apache.coyote.Request; + +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + public interface Utils { + static Map getVMap(String[] vName, HttpServletRequest request){ + Map vMap = new HashMap<>(); + for(int i=0;i