Merge remote-tracking branch 'remotes/origin/hechu1'

# Conflicts:
#	src/core/process/C_TeacherSearchStudent.java
#	web/jsFile/upload_action.js
hechu1
zhai_lw 6 years ago
parent 4e8235598f
commit 1473462317

@ -36,6 +36,25 @@ public class C_StudentSearchTeacher extends TempProcess{
TeacherInfo.put("phone_number",s[4]);
return TeacherInfo;
}
public List<Map<String,String>> _search() throws Exception{
if(!check()) throw new GExcptInit("teacherId Attrs init error!");
Search search = new Search() ;
search.setOptions(new HashMap<>());
search.addOptions("table",table);
List<String> fields = new ArrayList<>();
fields.add("*");
search.addOptions("field",fields);
Map<String,String> limits = new HashMap<>();
limits.put("id",this.getTeacherID());
search.addOptions("limits",limits);
search.addOptions("start",0);
search.addOptions("end",10);
Map<String, Object> options = search.execute(null);
List<String[]> result = (List<String[]>) options.get("result");
List<Map<String,String>> teachersInfo = new ArrayList<>();
core.process.Utils.formatResult(result, teachersInfo);
return teachersInfo;
}
protected boolean check() {
if(this.getTeacherID()==null)

@ -1,5 +1,6 @@
package core.process;
import core.operation.Search;
import core.operation.Select;
import error.GExcptInit;
@ -20,6 +21,24 @@ public class C_StudentSelectTeacher extends TempProcess {
select.addOptions("teacher_id",this.getTeacherId());
Map<String,Object> options=select.execute(null);
}
public List<Map<String,String>> search(String teacherId) throws Exception{
Search search = new Search() ;
search.setOptions(new HashMap<>());
search.addOptions("table","teacher");
List<String> fields = new ArrayList<>();
fields.add("*");
search.addOptions("field",fields);
Map<String,String> limits = new HashMap<>();
limits.put("id",teacherId);
search.addOptions("limits",limits);
search.addOptions("start",0);
search.addOptions("end",10);
Map<String, Object> options = search.execute(null);
List<String[]> result = (List<String[]>) options.get("result");
List<Map<String,String>> teachersInfo = new ArrayList<>();
core.process.Utils.formatResult(result, teachersInfo);
return teachersInfo;
}
protected boolean check() {
if(this.getStudentId()==null||this.getTeacherId()==null)
return false;

@ -48,18 +48,11 @@ public class C_TeacherSearchStudent extends TempProcess {
limits.put("id",this.getStudentId());
search.addOptions("limits",limits);
search.addOptions("start",0);
search.addOptions("end",1);
search.addOptions("end",10);
Map<String, Object> options = search.execute(null);
List<String[]> result = (List<String[]>) options.get("result");
List<Map<String,String>> studentsInfo = new ArrayList<>();
for(String[] s:result){
Map<String,String> 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);
}
core.process.Utils.formatResult(result, studentsInfo);
return studentsInfo;
}
protected boolean check() {

@ -1,5 +1,6 @@
package core.process;
import core.operation.Search;
import core.operation.Select;
import error.GExcptInit;
@ -20,6 +21,24 @@ public class C_TeacherSelectStudent extends TempProcess {
select.addOptions("student_id",this.getStudentId());
Map<String,Object> options=select.execute(null);
}
public List<Map<String,String>> search(String studentId) throws Exception{
Search search = new Search() ;
search.setOptions(new HashMap<>());
search.addOptions("table","student");
List<String> fields = new ArrayList<>();
fields.add("*");
search.addOptions("field",fields);
Map<String,String> limits = new HashMap<>();
limits.put("id",studentId);
search.addOptions("limits",limits);
search.addOptions("start",0);
search.addOptions("end",10);
Map<String, Object> options = search.execute(null);
List<String[]> result = (List<String[]>) options.get("result");
List<Map<String,String>> studentsInfo = new ArrayList<>();
core.process.Utils.formatResult(result, studentsInfo);
return studentsInfo;
}
protected boolean check() {
if(this.getStudentId()==null||this.getTeacherId()==null)
return false;

@ -0,0 +1,18 @@
package core.process;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public interface Utils {
static void formatResult(List<String[]> result, List<Map<String, String>> studentsInfo) {
for(String[] s:result){
Map<String,String> 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);
}
}
}

@ -6,7 +6,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebFilter(filterName = "OnlineCheck",urlPatterns = "/home.jsp")
@WebFilter(filterName = "OnlineCheck",urlPatterns = "/home*")
public class OnlineCheck implements Filter {
public void destroy() {
}

@ -2,7 +2,7 @@ package gdms;
public interface Configuration {
//file
String filePath = "/";
String filePath = "C:/Users/zhai_/Desktop/";
//database
String dbUrl="jdbc:mariadb://localhost:3306/gdms";
String dbUsername="gdms";

@ -26,4 +26,5 @@ public class S_StudentSelectTeacher extends HttpServlet {
response.sendRedirect("/op_fail.jsp");
}
}
}

@ -8,22 +8,19 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/student-upload-finished-product")
@WebServlet("/home/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 files = request.getParameter("file");
System.out.print("123");
System.out.print( request.getPart("file"));
System.out.print("123");
String id = request.getParameter("id");
String fileURL;
try {
String fileURL = servlet.Utils.saveFile(request, fileType);
fileURL = servlet.Utils.saveFile(request, fileType);
}catch (Exception e)
{
System.out.print(e);
response.sendRedirect("/op_fail.jsp");
}
System.out.print("222");
}
}

@ -5,7 +5,7 @@ $(document).ready(function () {
})
function sendFile() {
var fileData =new FormData();
var Url4='student-upload-finished-product';
var Url4='/student-upload-finished-product';
var file=$('#select')[0].files[0];
if($('.true-select').val()=='')
{

Loading…
Cancel
Save