Process调整

Condition完善
Processmanagement完善
status约定
zgl
zhai_lw 6 years ago
parent 8f599b3e18
commit 7c09829e78

@ -0,0 +1,7 @@
status有五种
1, 0 000 未开始
2, 1 001 开始未完成
3, 3 011 开始已完成未结束
4, 5 101 开始未完成已结束
5, 7 111 开始已完成已结束
,,,其余无效

@ -1,11 +1,44 @@
package core.process; package core.process;
import core.user.User;
import dao.DBManagement;
import java.util.List; import java.util.List;
import java.util.Map;
public class ProcessManagement { public class ProcessManagement {
public Condition getCondition(String userType, List<Integer> index){ public static Condition getCondition(User user) {
Map<String,Character> status = getStatus(user);
return getCondition(user,status);
}
public static Condition getCondition(User user, Map<String,Character> status){
Condition condition = new Condition();
for(Map.Entry<String,Character> entry:status.entrySet()){
String[] s = entry.getKey().split(".");
TempProcess tempProcess = (TempProcess) getProcess(s[1]);
tempProcess.setGraduationDesignId(s[0]);
tempProcess.setStatus(entry.getValue());
condition.add(tempProcess);
}
condition.add(getLastProcesses(user));
return condition;
}
private static List<Process> getLastProcesses(User user) {
return null;
}
//Map<graduation_design_id.x_status,status>
public static Map<String,Character> getStatus(User user){
Map<String,String> userTables = DBManagement.getUserTables(user.getType());
for(Map.Entry<String,String> entry:userTables.entrySet()){
String[] ti = entry.getKey().split(".");
String[] ts = entry.getValue().split(".");
}
return null; return null;
} }
public Process getProcess(int index){ public static Process getProcess(String process){
return null; return null;
} }
} }

@ -1,8 +1,17 @@
package core.process; package core.process;
public abstract class TempProcess extends Process { public abstract class TempProcess extends Process {
public static String process; private static String process;
public static String nextProcess; private static String nextProcess;
private String graduationDesignId;
public String getGraduationDesignId() {
return graduationDesignId;
}
public void setGraduationDesignId(String graduationDesignId) {
this.graduationDesignId = graduationDesignId;
}
public static String getProcess() { public static String getProcess() {
return process; return process;

@ -6,6 +6,12 @@ import java.util.Map;
public class Student extends User { public class Student extends User {
private String grade; private String grade;
private String profession_code; private String profession_code;
@Override
public String getType() {
return "student";
}
public void setAttr(Map<String, String> vMap){ public void setAttr(Map<String, String> vMap){
super.setAttr(vMap); super.setAttr(vMap);
this.setGrade(vMap.get("grade")); this.setGrade(vMap.get("grade"));

@ -7,6 +7,12 @@ public class Teacher extends User {
String job_title; String job_title;
String education; String education;
String profession_code; String profession_code;
@Override
public String getType() {
return "teacher";
}
@Override @Override
public void setAttr(Map<String, String> vMap){ public void setAttr(Map<String, String> vMap){
super.setAttr(vMap); super.setAttr(vMap);

@ -89,9 +89,7 @@ public abstract class User implements AccountManageable, ProcessConfigurable{
super(); super();
} }
public String getType(){ public abstract String getType();
return this.getClass().getName();
}
public void destroy(){ public void destroy(){
core.user.utils.AccountManagement.destroy(this); core.user.utils.AccountManagement.destroy(this);

@ -7,9 +7,9 @@ public interface GetObjectByName {
String userClassPath = "core.user"; String userClassPath = "core.user";
String operationClassPath = "core.operation"; String operationClassPath = "core.operation";
static User getUserByName(String name) throws Exception { static User getUserByName(String name) throws Exception {
return (User)Class.forName(userClassPath+"."+name).getDeclaredConstructor().newInstance(); return (User)Class.forName(userClassPath+"."+utils.Utils.toUpperFirstChar(name)).getDeclaredConstructor().newInstance();
} }
static Operation getOperationByName(String name) throws Exception{ static Operation getOperationByName(String name) throws Exception{
return (Operation)Class.forName(operationClassPath+"."+name).getDeclaredConstructor().newInstance(); return (Operation)Class.forName(operationClassPath+"."+utils.Utils.toUpperFirstChar(name)).getDeclaredConstructor().newInstance();
} }
} }

@ -29,16 +29,23 @@ public class DBManagement {
"graduation_design_reply", "graduation_design_reply",
"graduation_design_reply_opinion_record_score" "graduation_design_reply_opinion_record_score"
}; };
//<table.field,permission> //<table1.x_id,table2.x_status>
public static Map<String,String> graduationDesignStudentTables = new HashMap<>(){ public static Map<String,String> graduationDesignStudentTables = new HashMap<>(){
{ {
put("graduation_design.student_id","student"); put("graduation_design.student_id","graduation_design.student_chooser_teacher_status");
put("opening_report_secretary_team.leader_student_id","opening_report_secretary_leader");
put("opening_report_secretary_team.student1_id","opening_report_secretary_member");
put("opening_report_secretary_team.student2_id","opening_report_secretary_member"); put("opening_report_secretary_team.leader_student_id","");
put("reply_secretary_team.leader_student_id","reply_secretary_leader"); put("opening_report_secretary_team.student1_id","");
put("reply_secretary_team.student1_id","reply_secretary_member"); put("opening_report_secretary_team.student2_id","");
put("reply_secretary_team.student2_id","reply_secretary_member"); put("reply_secretary_team.leader_student_id","");
put("reply_secretary_team.student1_id","");
put("reply_secretary_team.student2_id","");
}
};
public static Map<String,String> graduationDesignTeacherTables = new HashMap<>(){
{
put("","");
} }
}; };
public static String driverClassName="org.mariadb.jdbc.Driver"; public static String driverClassName="org.mariadb.jdbc.Driver";
@ -72,6 +79,15 @@ public class DBManagement {
} }
return null; return null;
} }
public static Map<String,String> getUserTables(String userType){
if(userType.equals("student")){
return graduationDesignStudentTables;
}
if(userType.equals("teacher")){
return graduationDesignTeacherTables;
}
return null;
}
public static void delete(String table, Map<String,String> limits) throws GExcptSQL { public static void delete(String table, Map<String,String> limits) throws GExcptSQL {
Delete delete = new Delete(table, limits); Delete delete = new Delete(table, limits);

Loading…
Cancel
Save