diff --git a/.idea/artifacts/GDMS_war_exploded.xml b/.idea/artifacts/GDMS_war_exploded.xml index 12d7fe5..e0e575f 100644 --- a/.idea/artifacts/GDMS_war_exploded.xml +++ b/.idea/artifacts/GDMS_war_exploded.xml @@ -8,7 +8,14 @@ - + + + + + + + + diff --git a/.idea/dataSources/356b1cbb-8e8d-401f-bdfc-b3e917bc8301.xml b/.idea/dataSources/356b1cbb-8e8d-401f-bdfc-b3e917bc8301.xml index f80b89c..fbbe276 100644 --- a/.idea/dataSources/356b1cbb-8e8d-401f-bdfc-b3e917bc8301.xml +++ b/.idea/dataSources/356b1cbb-8e8d-401f-bdfc-b3e917bc8301.xml @@ -1626,516 +1626,536 @@ 1 normal - + 2 - float|0s + char(20)|0s normal - + 3 - text|0s + float|0s normal - + 4 - date|0s + text|0s normal - + 5 + date|0s + normal + + + 6 char(1)|0s normal - + 1 id 1 - + 1 char(20)|0s 1 normal - + 2 varchar(255)|0s normal - + 3 varchar(255)|0s normal - + 4 varchar(255)|0s normal - + 5 varchar(255)|0s normal - + 6 varchar(255)|0s normal - + 7 text|0s normal - + 8 char(1)|0s normal - + 1 id 1 - + 1 char(20)|0s 1 normal - + 2 date|0s normal - + 3 varchar(255)|0s normal - + 4 varchar(255)|0s normal - + 5 char(20)|0s normal - + 6 char(20)|0s normal - + 7 int(11)|0s normal - + 8 char(1)|0s normal - + 1 id 1 - + 1 char(20)|0s 1 normal - + 2 - text|0s + char(20)|0s normal - + 3 - date|0s + text|0s normal - + 4 - text|0s + date|0s normal - + 5 - date|0s + text|0s normal - + 6 - text|0s + date|0s normal - + 7 - date|0s + text|0s normal - + 8 - text|0s + date|0s normal - + 9 - date|0s + text|0s normal - + 10 - char(1)|0s + date|0s normal - + 11 char(1)|0s normal - + 12 char(1)|0s normal - + 13 char(1)|0s normal - + + 14 + char(1)|0s + normal + + 1 id 1 - + 1 char(20)|0s 1 normal - + 2 date|0s normal - + 3 varchar(255)|0s normal - + 4 char(20)|0s normal - + 5 char(20)|0s normal - + 1 id 1 - + 1 char(20)|0s 1 normal - + 2 - text|0s + char(20)|0s normal - + 3 - date|0s + char(20)|0s normal - + 4 text|0s normal - + 5 date|0s normal - + 6 text|0s normal - + 7 - float|0s + date|0s normal - + 8 - date|0s + text|0s normal - + 9 - text|0s + float|0s normal - + 10 - float|0s + date|0s normal - + 11 - date|0s + text|0s normal - + 12 - text|0s + float|0s normal - + 13 - float|0s + date|0s normal - + 14 - date|0s + text|0s normal - + 15 - char(1)|0s + float|0s normal - + 16 - char(1)|0s + date|0s normal - + 17 char(1)|0s normal - + 18 char(1)|0s normal - + + 19 + char(1)|0s + normal + + + 20 + char(1)|0s + normal + + 1 id 1 - + 1 char(20)|0s 1 normal - + 2 char(20)|0s normal - + 3 char(20)|0s normal - + 1 leader_student_id 1 - + 1 char(20)|0s 1 normal - + 2 char(20)|0s normal - + 3 char(20)|0s normal - + 1 leader_teacher_id 1 - + 1 char(8)|0s 1 normal - + 2 varchar(255)|0s normal - + 3 varchar(255)|0s normal - + 4 varchar(255)|0s normal - + 1 profession_code 1 - + 1 char(20)|0s 1 normal - + 2 char(20)|0s normal - + 3 char(20)|0s normal - + 1 leader_student_id 1 - + 1 char(20)|0s 1 normal - + 2 char(20)|0s normal - + 3 char(20)|0s normal - + 1 leader_teacher_id 1 - + 1 char(20)|0s 1 normal - + 2 char(255)|0s 1 normal - + 3 char(30)|0s normal - + 4 char(40)|0s normal - + 5 char(20)|0s normal - + 6 char(4)|0s normal - + 7 char(8)|0s normal - + 1 id 1 - + 1 char(20)|0s 1 normal - + 2 char(255)|0s 1 normal - + 3 char(30)|0s normal - + 4 char(40)|0s normal - + 5 char(20)|0s normal - + 6 varchar(255)|0s normal - + 7 varchar(255)|0s normal - + 8 char(8)|0s normal - + 1 id 1 diff --git a/.idea/misc.xml b/.idea/misc.xml index 35bdbab..11bca97 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/GDMS.iml b/GDMS.iml index 17b0b6c..23fde1f 100644 --- a/GDMS.iml +++ b/GDMS.iml @@ -17,14 +17,14 @@ - + + - - + diff --git a/deployment/context.xml b/deployment/context.xml index 9e9d9af..70d970a 100644 --- a/deployment/context.xml +++ b/deployment/context.xml @@ -4,7 +4,7 @@ name="jdbc/gdms" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" driverClassName="com.mysql.jdbc.Driver" - url="jdbc:mariadb://localhost:3306/gdms" + targetURL="jdbc:mariadb://localhost:3306/gdms" username="gdms" password="GDMS"/> diff --git a/documents/GDMS_DB_Design .txt b/documents/GDMS_DB_Design .txt index 5cc8f24..af8b8f1 100644 --- a/documents/GDMS_DB_Design .txt +++ b/documents/GDMS_DB_Design .txt @@ -3,7 +3,7 @@ password char 256 name varchar 50 e_mail_location varchar 50 phonenumber varchar 30 -url varchar 256 +targetURL varchar 256 administrator id diff --git a/documents/数据库.txt b/documents/数据库.txt index 635fa76..37f6ce0 100644 --- a/documents/数据库.txt +++ b/documents/数据库.txt @@ -3,7 +3,7 @@ password char 255//用户密码 name char 30//用户姓名 e_mail_location char 40//邮箱 phone_number char 20//电话号码 -url varchar 255//......路径 +targetURL varchar 255//......路径 administrator//管理员 id//管理员ID diff --git a/src/core/operation/UploadFileOperation.java b/src/core/operation/UploadFile.java similarity index 78% rename from src/core/operation/UploadFileOperation.java rename to src/core/operation/UploadFile.java index ff26329..75c76cb 100644 --- a/src/core/operation/UploadFileOperation.java +++ b/src/core/operation/UploadFile.java @@ -11,21 +11,15 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -public class UploadFileOperation extends Operation { +public class UploadFile extends Operation { @Override public Map execute(User subject) throws Exception { - File file = (File) this.getOptions().get("file"); String table = (String) this.getOptions().get("file_type"); Map limits = (Map) this.getOptions().get("limits"); - String field = core.operation.utils.Utils.getFileField(table); - String filePath = core.operation.utils.Utils.getFilePathName(table,file.getName()); + String filePath = (String) this.getOptions().get("file_url"); Map vMap = new HashMap<>(); vMap.put(field,filePath); - - file.renameTo(new File(filePath)); - //todo - List ls = new ArrayList<>(); ls.add(field); List resultLs = DBManagement.select(ls,table,limits,0,1); diff --git a/src/core/operation/UploadFileOperation.json b/src/core/operation/UploadFile.json similarity index 78% rename from src/core/operation/UploadFileOperation.json rename to src/core/operation/UploadFile.json index c2a2f65..0181176 100644 --- a/src/core/operation/UploadFileOperation.json +++ b/src/core/operation/UploadFile.json @@ -1,6 +1,6 @@ { "options":{ - "file": "File", + "file_url": "String", "file_type": "String", "limits":"Map" }, diff --git a/src/core/operation/utils/Utils.java b/src/core/operation/utils/Utils.java index 217e8be..6b09955 100644 --- a/src/core/operation/utils/Utils.java +++ b/src/core/operation/utils/Utils.java @@ -35,19 +35,4 @@ public interface Utils { static String getFileField(String table){ return fileTableField.get(table); } - static String getFilePath(String table){ - return Configuration.filePath+table+"/"; - } - static String getFileName(String fileName){ - SimpleDateFormat simpleDateFormat; - simpleDateFormat = new SimpleDateFormat("yyMMddHHmmssSSS"); - Date date = new Date(); - String str = simpleDateFormat.format(date); - str+=(int)(Math.random()*100000); - str+= utils.Utils.getFileType(fileName); - return str; - } - static String getFilePathName(String table, String fileName){ - return getFilePath(table)+getFileName(fileName); - } } diff --git a/src/core/process/C_CollegeFillOpeningReportOpinion.java b/src/core/process/C_CollegeFillOpeningReportOpinion.java new file mode 100644 index 0000000..27cae0f --- /dev/null +++ b/src/core/process/C_CollegeFillOpeningReportOpinion.java @@ -0,0 +1,50 @@ +package core.process; + +import core.operation.FillInformation; +import error.GExcptInit; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +public class C_CollegeFillOpeningReportOpinion extends TempProcess{ + String graduationDesignId; + Map vMap; + + static String table="graduation_design_opening_report_opinion_record"; + + public void fillInformation() throws Exception { + if(!check()) throw new GExcptInit("FillInformation Attrs init error!"); + FillInformation fillInformation =new FillInformation(); + fillInformation.setOptions(new HashMap<>()); + fillInformation.addOptions("table",table); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-ddHH:mm:ss"); + String date=df.format(new Date()); + vMap.put("college_opinion_date",date); + Maplimits = new HashMap<>(); + limits.put("id",this.getGraduationDesignId()); + fillInformation.addOptions("limits",limits); + fillInformation.execute(null); + } + protected boolean check() { + if(this.getGraduationDesignId()==null||this.getVMap()==null) + return false; + return true; + } + public String getGraduationDesignId() { + return graduationDesignId; + } + + public void setGraduationDesignId(String graduationDesignId) { + this.graduationDesignId = graduationDesignId; + } + + public void setVMap(Map vMap) { + this.vMap = vMap; + } + + public Map getVMap() { + return vMap; + } +} diff --git a/src/core/process/C_CollegeFillScoreOpinion.java b/src/core/process/C_CollegeFillScoreOpinion.java new file mode 100644 index 0000000..96e4e7d --- /dev/null +++ b/src/core/process/C_CollegeFillScoreOpinion.java @@ -0,0 +1,45 @@ +package core.process; + +import core.operation.FillInformation; +import error.GExcptInit; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +public class C_CollegeFillScoreOpinion extends TempProcess{ + + String graduationDesignId; + Map vMap; + + static String table="graduation_design_reply_opinion_record_score"; + + public void fillInformation() throws Exception{ + if(!check()) throw new GExcptInit("FillInformation Attrs Init error!"); + FillInformation fillInformation=new FillInformation(); + fillInformation.setOptions(new HashMap<>()); + fillInformation.addOptions("table",table); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-ddHH:mm:ss"); + String date=df.format(new Date()); + vMap.put("college_opinion_date",date); + Maplimits = new HashMap<>(); + limits.put("id",this.getGraduationDesignId()); + fillInformation.addOptions("limits",limits); + fillInformation.execute(null); + + } + protected boolean check() { + if(this.getGraduationDesignId()==null) + return false; + return true; + } + + public Map getVMap() { + return vMap; + } + + public void setVMap(Map vMap) { + this.vMap = vMap; + } +} diff --git a/src/core/process/C_MentorFillOpeningReportOpinion.java b/src/core/process/C_MentorFillOpeningReportOpinion.java new file mode 100644 index 0000000..139904e --- /dev/null +++ b/src/core/process/C_MentorFillOpeningReportOpinion.java @@ -0,0 +1,43 @@ +package core.process; + +import core.operation.FillInformation; +import error.GExcptInit; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +public class C_MentorFillOpeningReportOpinion extends TempProcess{ + + Map vMap; + + static String table="graduation_design_opening_report_opinion_record"; + + public void fillInformation() throws Exception{ + if(!check()) throw new GExcptInit("FillInformation Attrs init error!"); + FillInformation fillInformation=new FillInformation(); + fillInformation.setOptions(new HashMap<>()); + fillInformation.addOptions("table",table); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-ddHH:mm:ss"); + String date=df.format(new Date()); + vMap.put("mentor_opinion_date",date); + Maplimits = new HashMap<>(); + limits.put("id",this.getGraduationDesignId()); + fillInformation.addOptions("limits",limits); + fillInformation.execute(null); + + } + protected boolean check() { + if(this.getVMap()==null||this.getGraduationDesignId()==null) + return false; + return true; + } + public void setVMap(Map vMap) { + this.vMap = vMap; + } + + public Map getVMap() { + return vMap; + } +} diff --git a/src/core/process/C_MentorFillReview.java b/src/core/process/C_MentorFillReview.java new file mode 100644 index 0000000..d9a3128 --- /dev/null +++ b/src/core/process/C_MentorFillReview.java @@ -0,0 +1,58 @@ +package core.process; + +import core.operation.FillInformation; +import error.GExcptInit; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +public class C_MentorFillReview extends TempProcess { + public String teacherID; + public String teacher_opinion; + public Map vMap; + + static String table="graduation_design_finished_product_mentor_score"; + public String getTeacher_opinion() { + return teacher_opinion; + } + public void setTeacher_opinion(String teacher_opinion) { + this.teacher_opinion = teacher_opinion; + } + public String getTeacherID() { + return teacherID; + } + public void setTeacherID(String teacherID) { + this.teacherID = teacherID; + } + public Map getvMap() { + return vMap; + } + public void setvMap(Map vMap) { + this.vMap = vMap; + } + public void TeacherTeamFillOpeningReportOpinion() throws Exception{ + if(!check()) throw new GExcptInit("MentorFillReview Attrs init error!"); + FillInformation fillInformation=new FillInformation(); + fillInformation.setOptions(new HashMap<>()); + fillInformation.addOptions("table",table); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-ddHH:mm:ss"); + String date=df.format(new Date()); + vMap.put("review_opinion_date",date); + Maplimits = new HashMap<>(); + limits.put("id",this.getTeacherID()); + fillInformation.addOptions("limits",limits); + fillInformation.execute(null); + } + + + @Override + protected boolean check() { + if(this.getTeacherID().equals(null)||this.getTeacher_opinion().equals(null)||this.getvMap().equals(null)) + return false; + else + return true; + } +} + diff --git a/src/core/process/C_SchoolFillScoreOpinion.java b/src/core/process/C_SchoolFillScoreOpinion.java new file mode 100644 index 0000000..652cf1b --- /dev/null +++ b/src/core/process/C_SchoolFillScoreOpinion.java @@ -0,0 +1,53 @@ +package core.process; + +import core.operation.FillInformation; +import error.GExcptInit; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +public class C_SchoolFillScoreOpinion extends TempProcess { + + String graduationDesignId; + Map vMap; + + static String table="graduation_design_reply_opinion_record_score"; + public void fillInformation() throws Exception{ + if(!check()) throw new GExcptInit("FillInformation Attrs init error!"); + FillInformation fillInformation=new FillInformation(); + fillInformation.setOptions(new HashMap<>()); + fillInformation.addOptions("table",table); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-ddHH:mm:ss"); + String date=df.format(new Date()); + vMap.put("school_opinion_date",date); + Maplimits = new HashMap<>(); + limits.put("id",this.getGraduationDesignId()); + fillInformation.addOptions("limits",limits); + fillInformation.execute(null); + } + protected boolean check() { + if(this.getGraduationDesignId()==null) + return false; + return true; + } + @Override + public String getGraduationDesignId() { + return graduationDesignId; + } + + @Override + public void setGraduationDesignId(String graduationDesignId) { + this.graduationDesignId = graduationDesignId; + } + public void setVMap(Map vMap) { + this.vMap = vMap; + } + +} + + + + + diff --git a/src/core/process/C_SecretaryFillOpeningReportOpinion.java b/src/core/process/C_SecretaryFillOpeningReportOpinion.java new file mode 100644 index 0000000..d0398a3 --- /dev/null +++ b/src/core/process/C_SecretaryFillOpeningReportOpinion.java @@ -0,0 +1,50 @@ +package core.process; + +import core.operation.FillInformation; +import error.GExcptInit; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +public class C_SecretaryFillOpeningReportOpinion extends TempProcess{ + + String graduationDesignId; + Map vMap; + + static String table="graduation_design_opening_report_opinion_record"; + + public void fillInformation() throws Exception{ + if(!check()) throw new GExcptInit("FillInformation Attrs init error!"); + FillInformation fillInformation=new FillInformation(); + fillInformation.setOptions(new HashMap<>()); + fillInformation.addOptions("table",table); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-ddHH:mm:ss"); + String date=df.format(new Date()); + vMap.put("secretary_record_date",date); + Maplimits = new HashMap<>(); + limits.put("id",this.getGraduationDesignId()); + fillInformation.addOptions("limits",limits); + fillInformation.execute(null); + } + protected boolean check() { + if(this.getGraduationDesignId()==null) + return false; + return true; + } + @Override + public String getGraduationDesignId() { + return graduationDesignId; + } + + @Override + public void setGraduationDesignId(String graduationDesignId) { + this.graduationDesignId = graduationDesignId; + } + + public void setVMap(Map vMap) { + this.vMap = vMap; + } + +} diff --git a/src/core/process/C_SecretaryFillReplyRecord.java b/src/core/process/C_SecretaryFillReplyRecord.java new file mode 100644 index 0000000..0c8c478 --- /dev/null +++ b/src/core/process/C_SecretaryFillReplyRecord.java @@ -0,0 +1,51 @@ +package core.process; + +import core.operation.FillInformation; +import error.GExcptInit; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +public class C_SecretaryFillReplyRecord extends TempProcess{ + + String graduationDesignId; + Map vMap; + + static String table="graduation_design_reply_opinion_record_score"; + + public void fillInformation() throws Exception{ + if(!check()) throw new GExcptInit("FillInformation Attrs Init error!"); + FillInformation fillInformation=new FillInformation(); + fillInformation.setOptions(new HashMap<>()); + fillInformation.addOptions("table",table); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-ddHH:mm:ss"); + String date=df.format(new Date()); + vMap.put("secretary_record_date",date); + Maplimits = new HashMap<>(); + limits.put("id",this.getGraduationDesignId()); + fillInformation.addOptions("limits",limits); + fillInformation.execute(null); + + } + protected boolean check() { + if(this.getGraduationDesignId()==null) + return false; + return true; + } + public String getGraduationDesignId() { + return graduationDesignId; + } + @Override + public void setGraduationDesignId(String graduationDesignId) { + this.graduationDesignId = graduationDesignId; + } + + public void setVMap(Map vMap) { + this.vMap = vMap; + } + + + +} diff --git a/src/core/process/C_StudentFillGraduationDesignInformation.java b/src/core/process/C_StudentFillGraduationDesignInformation.java new file mode 100644 index 0000000..33e6df4 --- /dev/null +++ b/src/core/process/C_StudentFillGraduationDesignInformation.java @@ -0,0 +1,47 @@ +package core.process; + +import core.operation.FillInformation; +import error.GExcptInit; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +public class C_StudentFillGraduationDesignInformation extends TempProcess{ + String graduationDesignId; + Map vMap; + + static String table="graduation_design_opening_report_opinion_record"; + + public void fillInformation() throws Exception{ + if(!check()) throw new GExcptInit("FillInformation Attrs init error!"); + FillInformation fillInformation=new FillInformation(); + fillInformation.setOptions(new HashMap<>()); + fillInformation.addOptions("table",table); + Maplimits = new HashMap<>(); + limits.put("id",this.getGraduationDesignId()); + fillInformation.addOptions("limits",limits); + fillInformation.execute(null); + } + protected boolean check() { + if(this.getGraduationDesignId()==null) + return false; + return true; + } + @Override + public String getGraduationDesignId() { + return graduationDesignId; + } + + @Override + public void setGraduationDesignId(String graduationDesignId) { + this.graduationDesignId = graduationDesignId; + } + + public void setVMap(Map vMap) { + this.vMap = vMap; + } + + +} \ No newline at end of file diff --git a/src/core/process/C_StudentSearchTeacher.java b/src/core/process/C_StudentSearchTeacher.java index 2bb3080..65931e4 100644 --- a/src/core/process/C_StudentSearchTeacher.java +++ b/src/core/process/C_StudentSearchTeacher.java @@ -1,24 +1,29 @@ package core.process; import core.operation.Search; +import error.GExcptInit; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -public class C_StudentSearchTeacher { +public class C_StudentSearchTeacher extends TempProcess{ + String teacherID; + + static String table = "teacher"; + Map TeacherInfo=new HashMap(); - public Map search(String teacherID) throws Exception { + public Map search() throws Exception { + if(!check()) throw new GExcptInit("teacherID Attrs init error!"); Search search = new Search() ; search.setOptions(new HashMap<>()); - String table = "teacher"; search.addOptions("table",table); List fields = new ArrayList<>(); fields.add("*"); search.addOptions("field",fields); Map limits = new HashMap<>(); - limits.put("id",teacherID); + limits.put("id",this.getTeacherID()); search.addOptions("limits",limits); search.addOptions("start",0); search.addOptions("end",1); @@ -27,6 +32,20 @@ public class C_StudentSearchTeacher { String[] s = result.get(0); TeacherInfo.put("id",s[0]); TeacherInfo.put("name",s[2]); + TeacherInfo.put("e_mail_location",s[3]); + TeacherInfo.put("phone_number",s[4]); return TeacherInfo; } + + protected boolean check() { + if(this.getTeacherID()==null) + return false; + return true; + } + public String getTeacherID(){ + return teacherID; + } + public void setTeacherID(String teacherID){ + this.teacherID=teacherID; + } } diff --git a/src/core/process/C_StudentSelectTeacher.java b/src/core/process/C_StudentSelectTeacher.java index d2b9b93..ee8ada0 100644 --- a/src/core/process/C_StudentSelectTeacher.java +++ b/src/core/process/C_StudentSelectTeacher.java @@ -1,22 +1,46 @@ package core.process; import core.operation.Select; +import error.GExcptInit; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -public class C_StudentSelectTeacher extends core.process.Process { - public void select(String studentID,String teacherID)throws Exception{ +public class C_StudentSelectTeacher extends TempProcess { + String studentId; + String teacherId; + + public void select()throws Exception{ + if(!check()) throw new GExcptInit("ID Attrs init error!"); Select select=new Select(); select.setOptions(new HashMap<>()); - String student_id=studentID; - select.addOptions("student_id",student_id); - String teacher_id=teacherID; - select.addOptions("teacher_id",teacher_id); + select.addOptions("student_id",this.getStudentId()); + select.addOptions("teacher_id",this.getTeacherId()); Map options=select.execute(null); } + protected boolean check() { + if(this.getStudentId()==null||this.getTeacherId()==null) + return false; + return true; + } + public String getTeacherId() { + return teacherId; + } + + public void setTeacherId(String teacherId) { + this.teacherId = teacherId; + } + + public String getStudentId() { + return studentId; + } + + public void setStudentId(String studentId) { + this.studentId = studentId; + } + } diff --git a/src/core/process/C_StudentUploadFinishedProduct.java b/src/core/process/C_StudentUploadFinishedProduct.java new file mode 100644 index 0000000..efd36a8 --- /dev/null +++ b/src/core/process/C_StudentUploadFinishedProduct.java @@ -0,0 +1,48 @@ +package core.process; + +import core.operation.UploadFile; +import error.GExcptInit; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +public class C_StudentUploadFinishedProduct { + + File finishedProduct; + String graduationDesignId; + + static String file_type = "finished_product"; + public void uploadOpeningReport() throws Exception{ + if(!check()) throw new GExcptInit("Upload FinishedProduct Attrs init error!"); + UploadFile uploadFile=new UploadFile(); + uploadFile.setOptions(new HashMap<>()); + uploadFile.addOptions("file",this.getFinishedProduct()); + uploadFile.addOptions("file_type",file_type); + Maplimits = new HashMap<>(); + limits.put("id",this.getGraduationDesignId()); + uploadFile.addOptions("limits",limits); + uploadFile.execute(null); + } + + protected boolean check() { + if(this.getFinishedProduct()==null||this.getGraduationDesignId()==null) + return false; + return true; + } + public File getFinishedProduct() { + return finishedProduct; + } + + public void setFinishedProduct(File finishedProduct) { + this.finishedProduct = finishedProduct; + } + public String getGraduationDesignId() { + return graduationDesignId; + } + + public void setGraduationDesignId(String graduationDesignId) { + this.graduationDesignId = graduationDesignId; + } + +} diff --git a/src/core/process/C_StudentUploadOpeningReport.java b/src/core/process/C_StudentUploadOpeningReport.java new file mode 100644 index 0000000..69c70b3 --- /dev/null +++ b/src/core/process/C_StudentUploadOpeningReport.java @@ -0,0 +1,49 @@ +package core.process; + +import core.operation.UploadFile; +import error.GExcptInit; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +public class C_StudentUploadOpeningReport extends TempProcess{ + File openingReport; + String graduationDesignId; + + static String file_type = "opening_report"; + + public void uploadOpeningReport() throws Exception{ + if(!check()) throw new GExcptInit("Upload OpeningReport Attrs init error!"); + UploadFile uploadFileOperation=new UploadFile(); + uploadFileOperation.setOptions(new HashMap<>()); + uploadFileOperation.addOptions("file",this.getOpeningReport()); + uploadFileOperation.addOptions("file_type",file_type); + Maplimits = new HashMap<>(); + limits.put("id",this.getGraduationDesignId()); + uploadFileOperation.addOptions("limits",limits); + uploadFileOperation.execute(null); + } + + protected boolean check() { + if(this.getGraduationDesignId()==null||this.getOpeningReport()==null) + return false; + return true; + } + + public File getOpeningReport() { + return openingReport; + } + + public void setOpeningReport(File openingReport) { + this.openingReport = openingReport; + } + + public String getGraduationDesignId() { + return graduationDesignId; + } + + public void setGraduationDesignId(String graduationDesignId) { + this.graduationDesignId = graduationDesignId; + } +} diff --git a/src/core/process/C_TeacherSearchStudent.java b/src/core/process/C_TeacherSearchStudent.java index 6c90275..c915c93 100644 --- a/src/core/process/C_TeacherSearchStudent.java +++ b/src/core/process/C_TeacherSearchStudent.java @@ -1,34 +1,77 @@ package core.process; import core.operation.Search; +import error.GExcptInit; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -public class C_TeacherSearchStudent { - Map StudentInfo=new HashMap(); - public Map search(String studentID) throws Exception{ +public class C_TeacherSearchStudent extends TempProcess { + String studentId; + + static String table="student"; + + public Map search() throws Exception{ + if(!check()) throw new GExcptInit("studentId Attrs init error!"); + Map studentInfo =new HashMap<>(); Search search = new Search() ; search.setOptions(new HashMap<>()); - String table = "student"; search.addOptions("table",table); List fields = new ArrayList<>(); fields.add("*"); search.addOptions("field",fields); Map limits = new HashMap<>(); - limits.put("id",studentID); + limits.put("id",this.getStudentId()); search.addOptions("limits",limits); search.addOptions("start",0); search.addOptions("end",1); Map options = search.execute(null); List result = (List) options.get("result"); String[] s = result.get(0); - StudentInfo.put("学号",s[0]); - StudentInfo.put("名字",s[2]); - StudentInfo.put("邮箱",s[3]); - StudentInfo.put("电话",s[4]); - return StudentInfo; + studentInfo.put("id",s[0]); + studentInfo.put("name",s[2]); + studentInfo.put("e_mail_location",s[3]); + studentInfo.put("phone_number",s[4]); + return studentInfo; } + public List> _search() throws Exception{ + if(!check()) throw new GExcptInit("studentId Attrs init error!"); + Search search = new Search() ; + search.setOptions(new HashMap<>()); + search.addOptions("table",table); + List fields = new ArrayList<>(); + fields.add("*"); + search.addOptions("field",fields); + Map limits = new HashMap<>(); + limits.put("id",this.getStudentId()); + search.addOptions("limits",limits); + search.addOptions("start",0); + search.addOptions("end",1); + Map options = search.execute(null); + List result = (List) options.get("result"); + List> studentsInfo = new ArrayList<>(); + for(String[] s:result){ + Map studentInfo = new HashMap<>(); + studentInfo.put("id",s[0]); + studentInfo.put("name",s[2]); + studentInfo.put("e_mail_location",s[3]); + studentInfo.put("phone_number",s[4]); + studentsInfo.add(studentInfo); + } + return studentsInfo; + } + protected boolean check() { + if(this.getStudentId()==null) + return false; + return true; + } + public String getStudentId(){ + return studentId; + } + public void setStudentId(String studentId){ + this.studentId=studentId; + } + } diff --git a/src/core/process/C_TeacherSelectStudent.java b/src/core/process/C_TeacherSelectStudent.java index a13ef73..643b493 100644 --- a/src/core/process/C_TeacherSelectStudent.java +++ b/src/core/process/C_TeacherSelectStudent.java @@ -1,33 +1,46 @@ package core.process; import core.operation.Select; +import error.GExcptInit; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -public class C_TeacherSelectStudent extends Process { - List list; - - public C_TeacherSelectStudent clone(){ - C_TeacherSelectStudent tst = new C_TeacherSelectStudent(); - tst.setInfo( this.getInfo()); - List list = new ArrayList<>(); - for(String s:this.list){ - list.add(new String(s)); - } - return null; - } - public void select(String teacherID,String studentID)throws Exception{ +public class C_TeacherSelectStudent extends TempProcess { + String studentId; + String teacherId; + + public void select()throws Exception{ + if(!check()) throw new GExcptInit("ID Attrs init error!"); Select select=new Select(); select.setOptions(new HashMap<>()); - String teacher_id=teacherID; - select.addOptions("teacher_id",teacher_id); - String student_id=studentID; - select.addOptions("student_id",student_id); + select.addOptions("teacher_id",this.getTeacherId()); + select.addOptions("student_id",this.getStudentId()); Map options=select.execute(null); } + protected boolean check() { + if(this.getStudentId()==null||this.getTeacherId()==null) + return false; + return true; + } + public String getTeacherId() { + return teacherId; + } + + public void setTeacherId(String teacherId) { + this.teacherId = teacherId; + } + + public String getStudentId() { + return studentId; + } + + public void setStudentId(String studentId) { + this.studentId = studentId; + } + } diff --git a/src/core/process/C_TeacherTeamFillOpeningReportOpinion.java b/src/core/process/C_TeacherTeamFillOpeningReportOpinion.java new file mode 100644 index 0000000..cc0bf06 --- /dev/null +++ b/src/core/process/C_TeacherTeamFillOpeningReportOpinion.java @@ -0,0 +1,50 @@ +package core.process; + +import core.operation.FillInformation; +import error.GExcptInit; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +public class C_TeacherTeamFillOpeningReportOpinion extends TempProcess{ + + String graduationDesignId; + Map vMap; + + static String table="graduation_design_opening_report_opinion_record"; + + public void fillInformation() throws Exception{ + if(!check()) throw new GExcptInit("FillInformation Attrs init error!"); + FillInformation fillInformation=new FillInformation(); + fillInformation.setOptions(new HashMap<>()); + fillInformation.addOptions("table",table); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-ddHH:mm:ss"); + String date=df.format(new Date()); + vMap.put("report_teacher_team_opinion_date",date); + Maplimits = new HashMap<>(); + limits.put("id",this.getGraduationDesignId()); + fillInformation.addOptions("limits",limits); + fillInformation.execute(null); + } + protected boolean check() { + if(this.getGraduationDesignId()==null) + return false; + return true; + } + @Override + public String getGraduationDesignId() { + return graduationDesignId; + } + + @Override + public void setGraduationDesignId(String graduationDesignId) { + this.graduationDesignId = graduationDesignId; + } + + public void setVMap(Map vMap) { + this.vMap = vMap; + } + +} diff --git a/src/core/process/C_TeacherTeamFillScoreOpinion.java b/src/core/process/C_TeacherTeamFillScoreOpinion.java new file mode 100644 index 0000000..e87c937 --- /dev/null +++ b/src/core/process/C_TeacherTeamFillScoreOpinion.java @@ -0,0 +1,49 @@ +package core.process; + +import core.operation.FillInformation; +import error.GExcptInit; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +public class C_TeacherTeamFillScoreOpinion extends TempProcess { + + String graduationDesignId; + Map vMap; + + static String table="graduation_design_reply_opinion_record_score"; + + public void fillInformation() throws Exception{ + if(!check()) throw new GExcptInit("FillInformation Attrs init error!"); + FillInformation fillInformation=new FillInformation(); + fillInformation.setOptions(new HashMap<>()); + fillInformation.addOptions("table",table); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-ddHH:mm:ss"); + String date=df.format(new Date()); + vMap.put("teacher_team_opinion_date",date); + Maplimits = new HashMap<>(); + limits.put("id",this.getGraduationDesignId()); + fillInformation.addOptions("limits",limits); + fillInformation.execute(null); + } + protected boolean check() { + if(this.getGraduationDesignId()==null) + return false; + return true; + } + @Override + public String getGraduationDesignId() { + return graduationDesignId; + } + + @Override + public void setGraduationDesignId(String graduationDesignId) { + this.graduationDesignId = graduationDesignId; + } + public void setVMap(Map vMap) { + this.vMap = vMap; + } + +} diff --git a/src/core/process/Process.java b/src/core/process/Process.java index a79f94f..91c5d63 100644 --- a/src/core/process/Process.java +++ b/src/core/process/Process.java @@ -4,13 +4,16 @@ import core.operation.Operation; public abstract class Process{ - private char status; + private String status; private String permission; private Operation operation; - private String buttonName; private String info; + private static String buttonName; + protected static String targetURL; + protected static String iconURL; + protected abstract boolean check(); public String getPermission() { return permission; } @@ -31,10 +34,6 @@ public abstract class Process{ return buttonName; } - public void setButtonName(String buttonName) { - this.buttonName = buttonName; - } - public String getInfo() { return info; } @@ -43,11 +42,19 @@ public abstract class Process{ this.info = info; } - public char getStatus() { + public String getStatus() { return status; } - public void setStatus(char status) { + public void setStatus(String status) { this.status = status; } + + public static String getTargetURL() { + return targetURL; + } + + public static String getIconURL() { + return iconURL; + } } diff --git a/src/core/process/ProcessManagement.java b/src/core/process/ProcessManagement.java index 7e9f354..ee0fae9 100644 --- a/src/core/process/ProcessManagement.java +++ b/src/core/process/ProcessManagement.java @@ -2,17 +2,19 @@ package core.process; import core.user.User; import dao.DBManagement; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; public class ProcessManagement { - public static Condition getCondition(User user) { - Map status = getStatus(user); + public static Condition getCondition(User user) throws Exception { + Map status = getStatus(user); return getCondition(user,status); } - public static Condition getCondition(User user, Map status){ + public static Condition getCondition(User user, Map status){ Condition condition = new Condition(); - for(Map.Entry entry:status.entrySet()){ + for(Map.Entry entry:status.entrySet()){ String[] s = entry.getKey().split("."); TempProcess tempProcess = (TempProcess) getProcess(s[1]); tempProcess.setGraduationDesignId(s[0]); @@ -28,17 +30,29 @@ public class ProcessManagement { } //Map - public static Map getStatus(User user){ - + public static Map getStatus(User user) throws Exception { + Map status = new HashMap<>(); Map userTables = DBManagement.getUserStatusTables(user.getType()); String graduationDesignId = null; for(Map.Entry entry:userTables.entrySet()){ String[] ti = entry.getKey().split("."); String[] ts = entry.getValue().split("."); + List ls = new ArrayList<>(); + ls.add("id"); + Map limits = new HashMap<>(); + limits.put(ti[1],user.getId()); + List resultLs = DBManagement.select(ls,ti[0],limits,0,1); + if(resultLs.size()==0) continue; + graduationDesignId = resultLs.get(0)[0]; + ls = new ArrayList<>(); + ls.add(ts[1]); + limits = new HashMap<>(); + limits.put("id",graduationDesignId); + resultLs = DBManagement.select(ls,ts[0],limits,0,1); + status.put(graduationDesignId+"."+ts[1],resultLs.get(0)[0]); } - - return null; + return status; } public static Process getProcess(String process){ return null; diff --git a/src/dao/DBManagement.java b/src/dao/DBManagement.java index f338435..23c8ec5 100644 --- a/src/dao/DBManagement.java +++ b/src/dao/DBManagement.java @@ -5,7 +5,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - import error.GExcptSQL; import gdms.Configuration; import org.apache.tomcat.jdbc.pool.DataSource; @@ -60,19 +59,32 @@ public class DBManagement { public static Map graduationDesignStudentTables = new HashMap<>(){ { put("graduation_design.student_id","graduation_design.student_chooser_teacher_status"); - - - put("opening_report_secretary_team.leader_student_id",""); - put("opening_report_secretary_team.student1_id",""); - put("opening_report_secretary_team.student2_id",""); - put("reply_secretary_team.leader_student_id",""); - put("reply_secretary_team.student1_id",""); - put("reply_secretary_team.student2_id",""); + put("graduation_design.student_id","graduation_design_information.student_fill_graduation_design_information_status"); + put("graduation_design.student_id","graduation_design_opening_report.opening_report_status"); + put("opening_report_secretary_team.leader_student_id","graduation_design_opening_report_opinion_record.opening_report_secretary_record_status"); + put("opening_report_secretary_team.student1_id","graduation_design_opening_report_opinion_record.opening_report_secretary_record_status"); + put("opening_report_secretary_team.student2_id","graduation_design_opening_report_opinion_record.opening_report_secretary_record_status"); + put("graduation_design.student_id","graduation_design_finished_product.finished_product_status"); + put("reply_secretary_team.leader_student_id","graduation_design_reply_opinion_record_score.reply_ secretary_record_status"); + put("reply_secretary_team.teacher1_id","graduation_design_reply_opinion_record_score.reply_ secretary_record_status"); + put("reply_secretary_team.teacher2_id","graduation_design_reply_opinion_record_score.reply_ secretary_record_status"); } }; public static Map graduationDesignTeacherTables = new HashMap<>(){ { - put("",""); + put("graduation_design.teacher_id","graduation_design.teacher_choose_student_status"); + put("graduation_design.teacher_id","graduation_design_opening_report_opinion_record.opening_report_mentor_opinion_status"); + put("opening_report_teacher_team.leader_teacher_id","graduation_design_opening_report_opinion_record.opening_report_teacher_team_opinion_status"); + put("opening_report_teacher_team.teacher1_id","graduation_design_opening_report_opinion_record.opening_report_teacher_team_opinion_status"); + put("opening_report_teacher_team.teacher2_id","graduation_design_opening_report_opinion_record.opening_report_teacher_team_opinion_status"); + put("graduation_design_opening_report_opinion_record.opening_report_college_teacher_id","graduation_design_opening_report_opinion_record.opening_report_college_opinion_status"); + put("graduation_design.teacher_id","graduation_design_finished_product_mentor_score.finished_product_mentor_score_status"); + put("graduation_design_finished_product_reviewer_score.reviewer_teacher_id","graduation_design_finished_product_reviewer_score.finished_product_reviewer_score_status"); + put("reply_teacher_team.leader_teacher_id","graduation_design_reply_opinion_record_score.reply_ teacher_team_score_status"); + put("reply_teacher_team. teacher1_id","graduation_design_reply_opinion_record_score.reply_ teacher_team_score_status"); + put("reply_teacher_team. teacher2_id","graduation_design_reply_opinion_record_score.reply_ teacher_team_score_status"); + put("graduation_design_reply_opinion_record_score.reply_college_teacher_id","graduation_design_reply_opinion_record_score.reply_college_score_status"); + put("graduation_design_reply_opinion_record_score.reply_school_teacher_id","graduation_design_reply_opinion_record_score.reply_school_score_status"); } }; public static String driverClassName="org.mariadb.jdbc.Driver"; diff --git a/src/error/GExcptInit.java b/src/error/GExcptInit.java new file mode 100644 index 0000000..ad1ec99 --- /dev/null +++ b/src/error/GExcptInit.java @@ -0,0 +1,7 @@ +package error; + +public class GExcptInit extends GExcpt { + public GExcptInit(String info) { + super(info); + } +} diff --git a/src/gdms/GDMS.java b/src/gdms/GDMS.java new file mode 100644 index 0000000..3a10322 --- /dev/null +++ b/src/gdms/GDMS.java @@ -0,0 +1,34 @@ +package gdms; + +import error.GExcptInit; + +import java.util.*; + +public class GDMS { + static Map schedules; + static String schedulePath = ""; + public static void init() throws GExcptInit { + initSchedule(); + Timer timer = new Timer(true); + for(Map.Entry schedule:schedules.entrySet()){ + timer.schedule(getTimerTask(schedule.getKey()),schedule.getValue()); + } + } + + private static TimerTask getTimerTask(String s) throws GExcptInit { + if(s==""){ + return new TimerTask() { + @Override + public void run() { + ; + } + }; + } + + throw new GExcptInit("GlobalTimePoint.json error"); + } + + private static void initSchedule() { + + } +} diff --git a/src/gdms/GlobalTimePoint.json b/src/gdms/GlobalTimePoint.json new file mode 100644 index 0000000..97d7da8 --- /dev/null +++ b/src/gdms/GlobalTimePoint.json @@ -0,0 +1,9 @@ +{ + "teacher_choose_student_start_date":"", + "student_choose_teacher_start_date": "", + "choose_end_date": "", + "opening_report_opinion_deadline_date": "", + "finished_product_deadline_date": "", + "finished_product_review_deadline_date": "", + "reply_option_deadline_date": "" +} \ No newline at end of file diff --git a/src/gdms/main.java b/src/gdms/main.java deleted file mode 100644 index a6931aa..0000000 --- a/src/gdms/main.java +++ /dev/null @@ -1,18 +0,0 @@ -package gdms; - -public class main { - public static void check()throws Exception{ - checkJson(); - } - - private static void checkJson() throws Exception{ - //todo - } - - public static void init(){ - } - public static void run() throws Exception { - check(); - init(); - } -} diff --git a/src/gdms/test.java b/src/gdms/test.java index ffdddc1..55dbfa0 100644 --- a/src/gdms/test.java +++ b/src/gdms/test.java @@ -17,18 +17,6 @@ public class test { System.out.println(i); }while(i<3); - List list = new ArrayList<>(); - list.add("q"); - list.add("w"); - Map map=new HashMap<>(); - map.put("a","b"); - map.put("c","d"); - Select sql = new Select(list,"zx",map,1,2); - System.out.println(sql.getSQL()); - System.out.println(Utils.getFilePathName("a","b")); - String a = "a"; - changeB(a); - System.out.println(a); } static void changeB(String a){ a="B"; diff --git a/src/servlet/S_CollegeFillOpeningReportOpinion.java b/src/servlet/S_CollegeFillOpeningReportOpinion.java new file mode 100644 index 0000000..f84de95 --- /dev/null +++ b/src/servlet/S_CollegeFillOpeningReportOpinion.java @@ -0,0 +1,31 @@ +package servlet; + +import core.process.C_CollegeFillOpeningReportOpinion; + +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("college-fill-opening-report-opinion") +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); + C_CollegeFillOpeningReportOpinion p =new C_CollegeFillOpeningReportOpinion(); + p.setGraduationDesignId(id); + p.setVMap(vMap); + try { + p.fillInformation(); + } catch (Exception e) { + e.printStackTrace(); + response.sendRedirect("/op_fail.jsp"); + } + } + static String[] vName = { + "college_opinion" + }; +} \ No newline at end of file diff --git a/src/servlet/S_CollegeFillScoreOpinion.java b/src/servlet/S_CollegeFillScoreOpinion.java new file mode 100644 index 0000000..b66ec58 --- /dev/null +++ b/src/servlet/S_CollegeFillScoreOpinion.java @@ -0,0 +1,32 @@ +package servlet; + +import core.process.C_CollegeFillScoreOpinion; + +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("college-fill-score-opinion") +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); + C_CollegeFillScoreOpinion p =new C_CollegeFillScoreOpinion(); + p.setGraduationDesignId(id); + p.setVMap(vMap); + try { + p.fillInformation(); + } catch (Exception e) { + e.printStackTrace(); + response.sendRedirect("/op_fail.jsp"); + } + } + static String[] vName = { + "college_opinion", + "college_score" + }; +} \ No newline at end of file diff --git a/src/servlet/S_MentorFillOpeningReportOpinion.java b/src/servlet/S_MentorFillOpeningReportOpinion.java new file mode 100644 index 0000000..588215b --- /dev/null +++ b/src/servlet/S_MentorFillOpeningReportOpinion.java @@ -0,0 +1,31 @@ +package servlet; + +import core.process.C_MentorFillOpeningReportOpinion; + +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("mentor-fill-opening-report-opinion") +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); + C_MentorFillOpeningReportOpinion p = new C_MentorFillOpeningReportOpinion(); + p.setGraduationDesignId(id); + p.setVMap(vMap); + try { + p.fillInformation(); + } catch (Exception e) { + e.printStackTrace(); + response.sendRedirect("/op_fail.jsp"); + } + } + static String[] vName = { + "mentor_opinion" + }; +} \ No newline at end of file diff --git a/src/servlet/S_MentorFillReview.java b/src/servlet/S_MentorFillReview.java new file mode 100644 index 0000000..1ece272 --- /dev/null +++ b/src/servlet/S_MentorFillReview.java @@ -0,0 +1,22 @@ +package servlet; + +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("mentor-fill-review") +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); + + } + static String[] vName = { + "total_grade", + "review_opinion" + }; +} \ No newline at end of file diff --git a/src/servlet/S_ReviewerFillReview.java b/src/servlet/S_ReviewerFillReview.java new file mode 100644 index 0000000..f950771 --- /dev/null +++ b/src/servlet/S_ReviewerFillReview.java @@ -0,0 +1,22 @@ +package servlet; + +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("reviewer-fill-review") +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); + + } + static String[] vName = { + "score", + "opinion" + }; +} \ No newline at end of file diff --git a/src/servlet/S_SchoolFillScoreOpinion.java b/src/servlet/S_SchoolFillScoreOpinion.java new file mode 100644 index 0000000..d6b0e9d --- /dev/null +++ b/src/servlet/S_SchoolFillScoreOpinion.java @@ -0,0 +1,22 @@ +package servlet; + +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("school-fill-score-opinion") +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); + + } + static String[] vName = { + "school_opinion", + "school_score" + }; +} \ No newline at end of file diff --git a/src/servlet/S_SecretaryFillOpeningReportRecord.java b/src/servlet/S_SecretaryFillOpeningReportRecord.java new file mode 100644 index 0000000..2ef4f62 --- /dev/null +++ b/src/servlet/S_SecretaryFillOpeningReportRecord.java @@ -0,0 +1,21 @@ +package servlet; + +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("secretary-fill-opening-report-record") +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); + + } + static String[] vName = { + "secretary_record" + }; +} \ No newline at end of file diff --git a/src/servlet/S_SecretaryFillReplyRecord.java b/src/servlet/S_SecretaryFillReplyRecord.java new file mode 100644 index 0000000..90a10fa --- /dev/null +++ b/src/servlet/S_SecretaryFillReplyRecord.java @@ -0,0 +1,21 @@ +package servlet; + +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("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); + + } + static String[] vName = { + "secretary_record" + }; +} diff --git a/src/servlet/S_StudentFillGraduationDesignInformation.java b/src/servlet/S_StudentFillGraduationDesignInformation.java new file mode 100644 index 0000000..9838562 --- /dev/null +++ b/src/servlet/S_StudentFillGraduationDesignInformation.java @@ -0,0 +1,27 @@ +package servlet; + +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 { + + String id = request.getParameter("id"); + Map vMap = servlet.Utils.getVMap(vName,request); + + } + 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 57d6432..69b8893 100644 --- a/src/servlet/S_StudentSelectTeacher.java +++ b/src/servlet/S_StudentSelectTeacher.java @@ -4,21 +4,26 @@ import core.process.C_StudentSearchTeacher; import core.process.C_StudentSelectTeacher; 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; - +@WebServlet("/student-select-teacher") public class S_StudentSelectTeacher extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { super.doPost(request, response); - String student_id=request.getParameter("id"); + String teacherId=request.getParameter("id"); User user=(User)request.getSession().getAttribute("user"); - String teacher_id=user.getId(); + String studentId=user.getId(); try { - new C_StudentSelectTeacher().select(student_id,teacher_id); + C_StudentSelectTeacher SST=new C_StudentSelectTeacher(); + SST.setTeacherId(teacherId); + SST.setStudentId(studentId); + SST.select(); } catch (Exception e) { e.printStackTrace(); + response.sendRedirect("/op_fail.jsp"); } } } diff --git a/src/servlet/S_StudentUploadFinishedProduct.java b/src/servlet/S_StudentUploadFinishedProduct.java new file mode 100644 index 0000000..20f2fb5 --- /dev/null +++ b/src/servlet/S_StudentUploadFinishedProduct.java @@ -0,0 +1,20 @@ +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("/student-upload-finished-product") +@MultipartConfig +public class S_StudentUploadFinishedProduct extends HttpServlet { + static String fileType = "graduation_design_finished_product"; + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String id = "000"; + //String id = request.getParameter("id"); + String fileURL = servlet.Utils.saveFile(request, fileType); + } +} diff --git a/src/servlet/S_StudentUploadOpeningReport.java b/src/servlet/S_StudentUploadOpeningReport.java new file mode 100644 index 0000000..4102e91 --- /dev/null +++ b/src/servlet/S_StudentUploadOpeningReport.java @@ -0,0 +1,23 @@ +package servlet; + +import core.user.User; + +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 javax.servlet.http.Part; +import java.io.IOException; +import java.util.UUID; + +@WebServlet("/student-upload-opening-report") +@MultipartConfig +public class S_StudentUploadOpeningReport extends HttpServlet { + static String fileType = "graduation_design_opening_report"; + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String id = request.getParameter("id"); + String fileURL = servlet.Utils.saveFile(request, fileType); + } +} diff --git a/src/servlet/S_TeacherSelectStudent.java b/src/servlet/S_TeacherSelectStudent.java index 0d3d44d..ab880eb 100644 --- a/src/servlet/S_TeacherSelectStudent.java +++ b/src/servlet/S_TeacherSelectStudent.java @@ -4,21 +4,26 @@ import core.process.C_TeacherSelectStudent; 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; - +@WebServlet("/teacher-select-student") public class S_TeacherSelectStudent extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { super.doPost(request, response); - String teacher_id=request.getParameter("id"); + String studentId=request.getParameter("id"); User user=(User)request.getSession().getAttribute("user"); - String student_id=user.getId(); + String teacherId=user.getId(); try { - new C_TeacherSelectStudent().select(teacher_id,student_id); + C_TeacherSelectStudent TSS=new C_TeacherSelectStudent(); + TSS.setTeacherId(teacherId); + TSS.setStudentId(studentId); + TSS.select(); } catch (Exception e) { e.printStackTrace(); + response.sendRedirect("/op_fail.jsp"); } } } diff --git a/src/servlet/S_TeacherTeamFillOpeningReportOpinion.java b/src/servlet/S_TeacherTeamFillOpeningReportOpinion.java new file mode 100644 index 0000000..c43e7fd --- /dev/null +++ b/src/servlet/S_TeacherTeamFillOpeningReportOpinion.java @@ -0,0 +1,21 @@ +package servlet; + +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("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); + + } + static String[] vName = { + "report_teacher_team_opinion" + }; +} \ No newline at end of file diff --git a/src/servlet/S_TeacherTeamFillScoreOpinion.java b/src/servlet/S_TeacherTeamFillScoreOpinion.java new file mode 100644 index 0000000..a82b234 --- /dev/null +++ b/src/servlet/S_TeacherTeamFillScoreOpinion.java @@ -0,0 +1,22 @@ +package servlet; + +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("teacher-team-fill-score-opinion") +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); + + } + static String[] vName = { + "teacher_team_opinion", + "teacher_team_score" + }; +} diff --git a/src/servlet/Utils.java b/src/servlet/Utils.java new file mode 100644 index 0000000..3cea1d0 --- /dev/null +++ b/src/servlet/Utils.java @@ -0,0 +1,59 @@ +package servlet; + +import gdms.Configuration; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.Part; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.Date; +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 user_info=new HashMap<>(); diff --git a/src/servlet/account/login.java b/src/servlet/account/login.java deleted file mode 100644 index ee72254..0000000 --- a/src/servlet/account/login.java +++ /dev/null @@ -1,44 +0,0 @@ -package servlet.account; - -import java.io.IOException; -import java.sql.SQLException; - -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 core.user.Student; -import core.user.User; -import core.user.utils.AccountManagement; -import error.GExcptAccount; -import error.GExcptSQL; - -@WebServlet("/login") -public class login extends HttpServlet { - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - String id=request.getParameter("id"); - String password=request.getParameter("password"); - User user = null; - try { - user = AccountManagement.login(id,password); - } catch (GExcptSQL | SQLException gExcptSQL) { - gExcptSQL.printStackTrace(); - response.sendRedirect("/op_fail.jsp"); - return; - } catch (GExcptAccount gExcptAccount) { - gExcptAccount.printStackTrace(); - response.sendRedirect("/op_fail.jsp"); - return; - } catch (Exception e) { - e.printStackTrace(); - response.sendRedirect("/op_fail.jsp"); - return; - } - request.getSession().setAttribute("user",user); - response.sendRedirect("/home.jsp"); - return; - } -} diff --git a/web/WEB-INF/tld/c-1_0-rt.tld b/web/WEB-INF/tld/c-1_0-rt.tld index 2203657..3700a9e 100644 --- a/web/WEB-INF/tld/c-1_0-rt.tld +++ b/web/WEB-INF/tld/c-1_0-rt.tld @@ -82,7 +82,7 @@ to either the page, a String in 'var', or a Reader in 'varReader'. - url + targetURL true true @@ -281,7 +281,7 @@ false - url + targetURL false true @@ -346,7 +346,7 @@ - url + targetURL org.apache.taglibs.standard.tag.rt.core.UrlTag JSP diff --git a/web/WEB-INF/tld/c-1_0.tld b/web/WEB-INF/tld/c-1_0.tld index ce80e8d..aea9d26 100644 --- a/web/WEB-INF/tld/c-1_0.tld +++ b/web/WEB-INF/tld/c-1_0.tld @@ -21,7 +21,7 @@ out:default out:escapeXml if:test - import:url + import:targetURL import:context import:charEncoding forEach:items @@ -36,12 +36,12 @@ param:name param:value redirect:context - redirect:url + redirect:targetURL set:property set:target set:value - url:context - url:value + targetURL:context + targetURL:value when:test @@ -139,7 +139,7 @@ to either the page, a String in 'var', or a Reader in 'varReader'. - url + targetURL true false @@ -304,7 +304,7 @@ false - url + targetURL true false @@ -369,7 +369,7 @@ - url + targetURL org.apache.taglibs.standard.tag.el.core.UrlTag JSP diff --git a/web/WEB-INF/tld/c.tld b/web/WEB-INF/tld/c.tld index 22698c9..5ae8dd8 100644 --- a/web/WEB-INF/tld/c.tld +++ b/web/WEB-INF/tld/c.tld @@ -103,7 +103,7 @@ Scope for var. The URL of the resource to import. - url + targetURL true true @@ -403,7 +403,7 @@ Value of the parameter. The URL of the resource to redirect to. - url + targetURL false true @@ -500,13 +500,13 @@ Scope for var. Creates a URL with optional query parameters. - url + targetURL org.apache.taglibs.standard.tag.rt.core.UrlTag JSP Name of the exported scoped variable for the -processed url. The type of the scoped variable is +processed targetURL. The type of the scoped variable is String. var diff --git a/web/WEB-INF/tld/sql-1_0-rt.tld b/web/WEB-INF/tld/sql-1_0-rt.tld index c2fe525..d1b895b 100644 --- a/web/WEB-INF/tld/sql-1_0-rt.tld +++ b/web/WEB-INF/tld/sql-1_0-rt.tld @@ -170,7 +170,7 @@ true - url + targetURL false true diff --git a/web/WEB-INF/tld/sql-1_0.tld b/web/WEB-INF/tld/sql-1_0.tld index 2f8a328..4cd3e3f 100644 --- a/web/WEB-INF/tld/sql-1_0.tld +++ b/web/WEB-INF/tld/sql-1_0.tld @@ -30,7 +30,7 @@ dateParam:type setDataSource:dataSource setDataSource:driver - setDataSource:url + setDataSource:targetURL setDataSource:user setDataSource:password @@ -195,7 +195,7 @@ ue. false - url + targetURL false false diff --git a/web/WEB-INF/tld/sql.tld b/web/WEB-INF/tld/sql.tld index e53445b..4f8e76b 100644 --- a/web/WEB-INF/tld/sql.tld +++ b/web/WEB-INF/tld/sql.tld @@ -263,7 +263,7 @@ JDBC parameter: driver class name. JDBC parameter: URL associated with the database. - url + targetURL false true diff --git a/web/fill_Information.jsp b/web/fill_Information.jsp index 1bcd5ca..f3ae370 100644 --- a/web/fill_Information.jsp +++ b/web/fill_Information.jsp @@ -56,7 +56,6 @@ - diff --git a/web/jsFile/upload_action.js b/web/jsFile/upload_action.js index 906fe1c..c756a06 100644 --- a/web/jsFile/upload_action.js +++ b/web/jsFile/upload_action.js @@ -5,7 +5,7 @@ $(document).ready(function () { }) function sendFile() { var fileData =new FormData(); - var Url4='testfrom.jsp'; + var Url4='student-upload-finished-product'; var file=$('.true-select').files; if($('.true-select').val()=='') {