Merge remote-tracking branch 'origin/master'

# Conflicts:
#	.idea/misc.xml
#	src/core/process/C_StudentUploadOpeningReport.java
wmj
wan 6 years ago
commit 6ed473563d

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="false" project-jdk-name="11" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="false" project-jdk-name="10" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>

@ -14,18 +14,12 @@ import java.util.Map;
public class UploadFile extends Operation { public class UploadFile extends Operation {
@Override @Override
public Map<String, Object> execute(User subject) throws Exception { public Map<String, Object> execute(User subject) throws Exception {
File file = (File) this.getOptions().get("file");
String table = (String) this.getOptions().get("file_type"); String table = (String) this.getOptions().get("file_type");
Map<String,String> limits = (Map<String, String>) this.getOptions().get("limits"); Map<String,String> limits = (Map<String, String>) this.getOptions().get("limits");
String field = core.operation.utils.Utils.getFileField(table); 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<String,String> vMap = new HashMap<>(); Map<String,String> vMap = new HashMap<>();
vMap.put(field,filePath); vMap.put(field,filePath);
file.renameTo(new File(filePath));
//todo
List<String> ls = new ArrayList<>(); List<String> ls = new ArrayList<>();
ls.add(field); ls.add(field);
List<String[]> resultLs = DBManagement.select(ls,table,limits,0,1); List<String[]> resultLs = DBManagement.select(ls,table,limits,0,1);

@ -1,6 +1,6 @@
{ {
"options":{ "options":{
"file": "File", "file_url": "String",
"file_type": "String", "file_type": "String",
"limits":"Map<String,String>" "limits":"Map<String,String>"
}, },

@ -35,19 +35,4 @@ public interface Utils {
static String getFileField(String table){ static String getFileField(String table){
return fileTableField.get(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);
}
} }

@ -10,7 +10,7 @@ import java.util.Map;
public class C_MentorFillOpeningReportOpinion extends TempProcess{ public class C_MentorFillOpeningReportOpinion extends TempProcess{
String StudentId; String studentId;
String mentor_opinion; String mentor_opinion;
Map<String,String> vMap; Map<String,String> vMap;
@ -36,11 +36,11 @@ public class C_MentorFillOpeningReportOpinion extends TempProcess{
return true; return true;
} }
public String getStudentId() { public String getStudentId() {
return StudentId; return studentId;
} }
public void setStudentId(String studentId) { public void setStudentId(String studentId) {
StudentId = studentId; this.studentId = studentId;
} }
public String getMentor_opinion() { public String getMentor_opinion() {
return mentor_opinion; return mentor_opinion;

@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map;
@WebServlet(name = "S_CollegeFillOpeningReportOpinion") @WebServlet(name = "S_CollegeFillOpeningReportOpinion")
public class S_CollegeFillOpeningReportOpinion extends HttpServlet { public class S_CollegeFillOpeningReportOpinion extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
Map<String,String> vMap = servlet.Utils.getVMap(vName,request);
} }
static String[] vName = {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ""
};
} }
}

@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map;
@WebServlet(name = "S_CollegeFillScoreOpinion") @WebServlet(name = "S_CollegeFillScoreOpinion")
public class S_CollegeFillScoreOpinion extends HttpServlet { public class S_CollegeFillScoreOpinion extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
Map<String,String> vMap = servlet.Utils.getVMap(vName,request);
} }
static String[] vName = {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ""
};
} }
}

@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map;
@WebServlet(name = "S_MentorFillOpeningReportOpinion") @WebServlet(name = "S_MentorFillOpeningReportOpinion")
public class S_MentorFillOpeningReportOpinion extends HttpServlet { public class S_MentorFillOpeningReportOpinion extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
Map<String,String> vMap = servlet.Utils.getVMap(vName,request);
} }
static String[] vName = {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ""
};
} }
}

@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map;
@WebServlet(name = "S_MentorFillReview") @WebServlet(name = "S_MentorFillReview")
public class S_MentorFillReview extends HttpServlet { public class S_MentorFillReview extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
Map<String,String> vMap = servlet.Utils.getVMap(vName,request);
} }
static String[] vName = {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ""
};
} }
}

@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map;
@WebServlet(name = "S_ReviewerFillReview") @WebServlet(name = "S_ReviewerFillReview")
public class S_ReviewerFillReview extends HttpServlet { public class S_ReviewerFillReview extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
Map<String,String> vMap = servlet.Utils.getVMap(vName,request);
} }
static String[] vName = {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ""
};
} }
}

@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map;
@WebServlet(name = "S_SchoolFillScoreOpinion") @WebServlet(name = "S_SchoolFillScoreOpinion")
public class S_SchoolFillScoreOpinion extends HttpServlet { public class S_SchoolFillScoreOpinion extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
Map<String,String> vMap = servlet.Utils.getVMap(vName,request);
} }
static String[] vName = {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ""
};
} }
}

@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map;
@WebServlet(name = "S_SecretaryFillOpeningReportRecord") @WebServlet(name = "S_SecretaryFillOpeningReportRecord")
public class S_SecretaryFillOpeningReportRecord extends HttpServlet { public class S_SecretaryFillOpeningReportRecord extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
Map<String,String> vMap = servlet.Utils.getVMap(vName,request);
} }
static String[] vName = {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ""
};
} }
}

@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map;
@WebServlet(name = "S_SecretaryFillReplyRecord") @WebServlet(name = "secretary-fill-reply-record")
public class S_SecretaryFillReplyRecord extends HttpServlet { public class S_SecretaryFillReplyRecord extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
Map<String,String> vMap = servlet.Utils.getVMap(vName,request);
} }
static String[] vName = {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ""
};
}
} }

@ -6,18 +6,22 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map;
@WebServlet("/student-fill-graduation-design-information") @WebServlet("/student-fill-graduation-design-information")
public class S_StudentFillGraduationDesignInformation extends HttpServlet { public class S_StudentFillGraduationDesignInformation extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 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<String,String> 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"
};
} }

@ -13,13 +13,13 @@ import java.io.IOException;
public class S_StudentSelectTeacher extends HttpServlet { public class S_StudentSelectTeacher extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
super.doPost(request, response); super.doPost(request, response);
String teacher_id=request.getParameter("id"); String teacherId=request.getParameter("id");
User user=(User)request.getSession().getAttribute("user"); User user=(User)request.getSession().getAttribute("user");
String student_id=user.getId(); String studentId=user.getId();
try { try {
C_StudentSelectTeacher SST=new C_StudentSelectTeacher(); C_StudentSelectTeacher SST=new C_StudentSelectTeacher();
SST.setTeacherId(teacher_id); SST.setTeacherId(teacherId);
SST.setStudentId(student_id); SST.setStudentId(studentId);
SST.select(); SST.select();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

@ -1,19 +1,19 @@
package servlet; package servlet;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet; import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
@WebServlet(name = "S_StudentUploadFinishedProduct") @WebServlet("/student-upload-finished-product")
@MultipartConfig
public class S_StudentUploadFinishedProduct extends HttpServlet { public class S_StudentUploadFinishedProduct extends HttpServlet {
static String fileType = "graduation_design_finished_product";
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
} String fileURL = servlet.Utils.saveFile(request, fileType);
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
} }
} }

@ -14,30 +14,10 @@ import java.util.UUID;
@WebServlet("/student-upload-opening-report") @WebServlet("/student-upload-opening-report")
@MultipartConfig @MultipartConfig
//学生id+文件
public class S_StudentUploadOpeningReport extends HttpServlet { public class S_StudentUploadOpeningReport extends HttpServlet {
private static final long serialVersionUID = 1L; static String fileType = "graduation_design_opening_report";
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
super.doPost(request, response); String id = request.getParameter("id");
User user=(User) request.getSession().getAttribute("user"); String fileURL = servlet.Utils.saveFile(request, fileType);
String student_id=user.getId();
try {
//获取上传的文件
Part part=request.getPart("file");
//获取请求的信息
String name=part.getHeader("content-disposition");
//获取上传文件的目录
String root=request.getServletContext().getRealPath("/upload");
request.setAttribute("info", "上传文件成功");
} catch (Exception e) {
e.printStackTrace();
request.setAttribute("info", "上传文件失败");
}
request.getRequestDispatcher("/upload.jsp").forward(request, response);
} }
} }

@ -13,13 +13,13 @@ import java.io.IOException;
public class S_TeacherSelectStudent extends HttpServlet { public class S_TeacherSelectStudent extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
super.doPost(request, response); super.doPost(request, response);
String student_id=request.getParameter("id"); String studentId=request.getParameter("id");
User user=(User)request.getSession().getAttribute("user"); User user=(User)request.getSession().getAttribute("user");
String teacher_id=user.getId(); String teacherId=user.getId();
try { try {
C_TeacherSelectStudent TSS=new C_TeacherSelectStudent(); C_TeacherSelectStudent TSS=new C_TeacherSelectStudent();
TSS.setTeacherId(teacher_id); TSS.setTeacherId(teacherId);
TSS.setStudentId(student_id); TSS.setStudentId(studentId);
TSS.select(); TSS.select();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; 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 { public class S_TeacherTeamFillOpeningReportOpinion extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
Map<String,String> vMap = servlet.Utils.getVMap(vName,request);
} }
static String[] vName = {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ""
};
} }
}

@ -6,14 +6,16 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map;
@WebServlet(name = "S_TeacherFillTeamFillScoreOpinion") @WebServlet(name = "S_TeacherTeamFillScoreOpinion")
public class S_TeacherFillTeamFillScoreOpinion extends HttpServlet { public class S_TeacherTeamFillScoreOpinion extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
Map<String,String> vMap = servlet.Utils.getVMap(vName,request);
} }
static String[] vName = {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ""
};
}
} }

@ -0,0 +1,60 @@
package servlet;
import gdms.Configuration;
import org.apache.coyote.Request;
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<String,String> getVMap(String[] vName, HttpServletRequest request){
Map<String,String> vMap = new HashMap<>();
for(int i=0;i<vName.length;i++){
vMap.put(vName[i],request.getParameter(vName[i]));
}
return vMap;
}
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);
}
static String saveFile(HttpServletRequest request, String table) throws IOException, ServletException {
Part part = request.getPart("graduation_design");
String header = part.getHeader("content-disposition");
String path = header.substring(header.indexOf("filename=") + 10, header.length() - 1);
String filePathName = servlet.Utils.getFilePathName(table,path);
File file = new File(filePathName);
InputStream inputStream = part.getInputStream();
FileOutputStream outputStream = new FileOutputStream(file);
int len;
byte[] bytes = new byte[1024];
while ((len = inputStream.read(bytes)) != -1) {
outputStream.write(bytes, 0, len);
}
outputStream.close();
inputStream.close();
part.delete();
return filePathName;
}
}
Loading…
Cancel
Save