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]); TeacherInfo.put("phone_number",s[4]);
return TeacherInfo; 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() { protected boolean check() {
if(this.getTeacherID()==null) if(this.getTeacherID()==null)

@ -1,5 +1,6 @@
package core.process; package core.process;
import core.operation.Search;
import core.operation.Select; import core.operation.Select;
import error.GExcptInit; import error.GExcptInit;
@ -20,6 +21,24 @@ public class C_StudentSelectTeacher extends TempProcess {
select.addOptions("teacher_id",this.getTeacherId()); select.addOptions("teacher_id",this.getTeacherId());
Map<String,Object> options=select.execute(null); 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() { protected boolean check() {
if(this.getStudentId()==null||this.getTeacherId()==null) if(this.getStudentId()==null||this.getTeacherId()==null)
return false; return false;

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

@ -1,5 +1,6 @@
package core.process; package core.process;
import core.operation.Search;
import core.operation.Select; import core.operation.Select;
import error.GExcptInit; import error.GExcptInit;
@ -20,6 +21,24 @@ public class C_TeacherSelectStudent extends TempProcess {
select.addOptions("student_id",this.getStudentId()); select.addOptions("student_id",this.getStudentId());
Map<String,Object> options=select.execute(null); 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() { protected boolean check() {
if(this.getStudentId()==null||this.getTeacherId()==null) if(this.getStudentId()==null||this.getTeacherId()==null)
return false; 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 javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
@WebFilter(filterName = "OnlineCheck",urlPatterns = "/home.jsp") @WebFilter(filterName = "OnlineCheck",urlPatterns = "/home*")
public class OnlineCheck implements Filter { public class OnlineCheck implements Filter {
public void destroy() { public void destroy() {
} }

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

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

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

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

Loading…
Cancel
Save