Commit 162534b4 authored by 李良停's avatar 李良停

llt

parent bce817ef
package com.chineseall.eden.authcenter.agent.client;
import lombok.Data;
/**
* @author zhangjiaquan
*/
@Data
public class AuthUserInfo {
private String id;//uuid
private String realName;//姓名
private UserType userType;//教师、学生
private String source;//来源
/**
* 学生
*/
private String studentId;//学生id
private String studentCode;//学籍号
private EducationSystem studentStage;//学段
private GradeLevel studentGrade;//年级
private String studentClass;//班级
private String studentStageName;//学段名称
private String studentGradeName;//年级名称
private String studentClassName;//班级名称
private String studentSchoolId;//学籍学校id
private String studentCodeStatus;//学籍当前状态
private String studentSchoolCode;//学籍学校代码
private String studentSchoolName;//学籍学校名称
private String studentRegionCode;//学籍区县代码
private String studentRegionName;//学籍区县名称
/**
* 教师
*/
private String teacherTrainingNo;//师训号
private String teacherCertificateNo;
private String teacherTrainingUserName;//师训用户名
private String teacherRegionCode;//师训区县id
private String teacherCampusCode;//师训学区id
private String teacherTrainingSchoolType;//师训学校类型
private EducationSystem teacherStage;//师训学段id
private GradeLevel teacherGrade;//师训年级id
private SubjectType teacherSubject;//师训专业
private String teacherSchoolId;//师训学校id
private String teacherSchoolName;//师训学校名称
}
package com.chineseall.eden.authcenter.agent.client; package com.chineseall.eden.authcenter.agent.client;
import com.chineseall.eden.authcenter.agent.oauth.OauthType; import com.chineseall.eden.authcenter.agent.oauth.OauthType;
import com.chineseall.eden.service.user.entities.AuthUserInfo;
import lombok.Data; import lombok.Data;
@Data @Data
......
package com.chineseall.eden.authcenter.agent.client;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
/**
* 学制
* Created by yuchunlin on 2019/3/5.
*/
public enum EducationSystem {
P5(new GradeLevel[]{
GradeLevel.FIRST_GRADE,
GradeLevel.SECOND_GRADE,
GradeLevel.THIRD_GRADE,
GradeLevel.FOURTH_GRADE,
GradeLevel.FIFTH_GRADE,
}, "小学五年制"),
P6(new GradeLevel[]{
GradeLevel.FIRST_GRADE,
GradeLevel.SECOND_GRADE,
GradeLevel.THIRD_GRADE,
GradeLevel.FOURTH_GRADE,
GradeLevel.FIFTH_GRADE,
GradeLevel.SIXTH_GRADE,
}, "小学六年制"), // 小学六年制
J3(new GradeLevel[]{
GradeLevel.SEVENTH_GRADE,
GradeLevel.EIGHTH_GRADE,
GradeLevel.NINTH_GRADE,
}, "初中三年制"),
J4(new GradeLevel[]{
GradeLevel.SIXTH_GRADE,
GradeLevel.SEVENTH_GRADE,
GradeLevel.EIGHTH_GRADE,
GradeLevel.NINTH_GRADE,
}, "初中四年制"),
S3(new GradeLevel[]{
GradeLevel.TENTH_GRADE,
GradeLevel.ELEVENTH_GRADE,
GradeLevel.TWELFTH_GRADE,
}, "高中三年制"),
J_S(new GradeLevel[]{
GradeLevel.SIXTH_GRADE,
GradeLevel.SEVENTH_GRADE,
GradeLevel.EIGHTH_GRADE,
GradeLevel.NINTH_GRADE,
GradeLevel.TENTH_GRADE,
GradeLevel.ELEVENTH_GRADE,
GradeLevel.TWELFTH_GRADE,
}, "完全中学"),
P_J(new GradeLevel[]{
GradeLevel.FIRST_GRADE,
GradeLevel.SECOND_GRADE,
GradeLevel.THIRD_GRADE,
GradeLevel.FOURTH_GRADE,
GradeLevel.FIFTH_GRADE,
GradeLevel.SIXTH_GRADE,
GradeLevel.SEVENTH_GRADE,
GradeLevel.EIGHTH_GRADE,
GradeLevel.NINTH_GRADE,
}, "九年一贯制"),
P_J_S(new GradeLevel[]{
GradeLevel.FIRST_GRADE,
GradeLevel.SECOND_GRADE,
GradeLevel.THIRD_GRADE,
GradeLevel.FOURTH_GRADE,
GradeLevel.FIFTH_GRADE,
GradeLevel.SIXTH_GRADE,
GradeLevel.SEVENTH_GRADE,
GradeLevel.EIGHTH_GRADE,
GradeLevel.NINTH_GRADE,
GradeLevel.TENTH_GRADE,
GradeLevel.ELEVENTH_GRADE,
GradeLevel.TWELFTH_GRADE,
}, "十二年一贯制"),;
@Getter
private final GradeLevel[] gradeLevels;
@Getter
private final String description;
private final static Map<String, EducationSystem> descriptionMap;
EducationSystem(GradeLevel[] gradeLevels, String description) {
this.gradeLevels = gradeLevels;
this.description = description;
}
public static EducationSystem safeParse(String name) {
try {
return EducationSystem.valueOf(name);
} catch (Exception ignore) {
return null;
}
}
static {
descriptionMap = new HashMap<>();
for (EducationSystem educationSystem : EducationSystem.values()) {
descriptionMap.put(educationSystem.getDescription(), educationSystem);
}
}
public static EducationSystem getByDescription(String description) {
try {
return descriptionMap.get(description);
} catch (Exception ex) {
return null;
}
}
/**
* 学制的下一个年级
* @param gradeLevel
* @return
*/
public GradeLevel nextGradeLevel(GradeLevel gradeLevel){
GradeLevel[] values = this.getGradeLevels();
for (int i = 0; i < values.length; i++) {
GradeLevel value = values[i];
if (value == gradeLevel){
if (values.length - 1 == i){
return null;
}
return values[i + 1];
}
}
return null;
}
}
package com.chineseall.eden.authcenter.agent.client;
import lombok.Getter;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Created by yuchunlin on 2019/3/5.
*/
public enum GradeLevel {
FIRST_GRADE("01", "一年级",1),
SECOND_GRADE("02", "二年级",2),
THIRD_GRADE("03", "三年级",3),
FOURTH_GRADE("04", "四年级",4),
FIFTH_GRADE("05", "五年级",5),
SIXTH_GRADE("06", "六年级",6),
SEVENTH_GRADE("07", "七年级",7),
EIGHTH_GRADE("08", "八年级",8),
NINTH_GRADE("09", "九年级",9),
TENTH_GRADE("10", "高一",10),
ELEVENTH_GRADE("11", "高二",11),
TWELFTH_GRADE("12", "高三",12);
@Getter
private final String code;
@Getter
private final String description;
@Getter
private final int level;
private final static Map<String, GradeLevel> gradeLevelMap;
private final static Map<String, GradeLevel> descriptionMap;
static {
gradeLevelMap = new LinkedHashMap<>();
descriptionMap = new HashMap<>();
for (GradeLevel gradeLevel : GradeLevel.values()) {
gradeLevelMap.put(gradeLevel.getCode(), gradeLevel);
descriptionMap.put(gradeLevel.getDescription(), gradeLevel);
}
}
GradeLevel(String code, String description, int level) {
this.code = code;
this.description = description;
this.level = level;
}
public static GradeLevel getByName(String name) {
try {
return GradeLevel.valueOf(name);
} catch (Exception ex) {
return null;
}
}
public static GradeLevel getByCode(String code) {
try {
return gradeLevelMap.get(code);
} catch (Exception ex) {
return null;
}
}
public static GradeLevel getByDescription(String description) {
return descriptionMap.get(description);
}
public GradeLevel nextGradeLevel(){
GradeLevel[] values = GradeLevel.values();
for (int i = 0; i < values.length; i++) {
GradeLevel value = values[i];
if (value == this){
if (values.length - 1 == i){
return null;
}
return values[i + 1];
}
}
return null;
}
/**
* 级差
* @param gradeLevel
* @return
*/
public int differLevel(GradeLevel gradeLevel){
return gradeLevel.getLevel() - this.getLevel();
}
}
package com.chineseall.eden.authcenter.agent.client;
import lombok.Getter;
import java.util.*;
import java.util.stream.Collectors;
public enum SubjectType {
SX("SX", "数学", 1),
YW("YW", "语文", 2),
YY("YY", "英语", 3),
WL("WL", "物理", 4),
SW("SW", "生物", 5),
HX("HX", "化学", 6),
LS("LS", "历史", 7),
DL("DL", "地理", 8),
ZZ("ZZ", "思想政治", 9),
PD("PD", "思想品德", 10),
PS("PS", "品德与社会", 11),
LD("LD", "劳动技术", 12),
XX("XX", "信息科技", 13),
TY("TY", "体育", 14),
SM("SM", "生命科学", 15),
KJ("KJ", "科学与技术", 16),
MS("MS", "美术", 17),
ZR("ZR", "自然", 18),
YU("YU", "音乐", 19),
TJ("TJ", "体育与健身", 20),
FZ("FZ", "法制", 21),
KX("KX", "科学", 22),
YS("YS", "艺术", 23),
ZJ("ZJ", "专题教育", 24),
ZH("ZH", "综合", 25),
SH("SH", "社会", 26),
DF("DF", "道德与法治", 27),
TS("TS", "通用技术", 28),
QT("QT", "其它", 29),
;
private final static Map<String, SubjectType> subjectTypeMap;
private final static Map<String, SubjectType> descriptionMap;
static {
subjectTypeMap = new LinkedHashMap<>();
descriptionMap = new HashMap<>();
for (SubjectType subjectType : SubjectType.values()) {
subjectTypeMap.put(subjectType.getCode(), subjectType);
descriptionMap.put(subjectType.getDescription(), subjectType);
}
}
@Getter
private final String code;
@Getter
private final String description;
@Getter
private final int sort;
SubjectType(String code, String description, int sort) {
this.code = code;
this.description = description;
this.sort = sort;
}
public static SubjectType getByName(String name) {
try {
return SubjectType.valueOf(name);
} catch (Exception ex) {
return null;
}
}
public static SubjectType getByCode(String code) {
try {
return subjectTypeMap.get(code);
} catch (Exception ex) {
return null;
}
}
public static SubjectType getByDescription(String description) {
try {
return descriptionMap.get(description);
} catch (Exception ex) {
return null;
}
}
public static List<Map<String, Object>> getAll() {
try {
List<Map<String, Object>> result = new ArrayList<>();
List<SubjectType> list = descriptionMap.values().stream().sorted(Comparator.comparing(SubjectType::getSort)).collect(Collectors.toList());
list.forEach(subjectType -> {
Map<String, Object> map = new LinkedHashMap<>();
map.put("code", subjectType.getCode());
map.put("name", subjectType.getDescription());
map.put("sort", subjectType.getSort());
result.add(map);
});
return result;
} catch (Exception ex) {
return null;
}
}
}
package com.chineseall.eden.authcenter.agent.client;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by yuchunlin on 2019/2/12.
*/
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public enum UserType {
STUDENT(2, "学生"),
TEACHER(3, "老师"),
MUNICIPAL_ADMIN(10, "市管理员"),
ASSOCIATE_MUNICIPAL_ADMIN(11, "市级业务管理员"),
COUNTY_ADMIN(20, "区县管理员"),
ASSOCIATE_COUNTY_ADMIN(21, "区县业务管理员"),
SCHOOL_ADMIN(30, "学校管理员"),
ASSOCIATE_SCHOOL_ADMIN(31, "学校业务管理员"),
OPERATING_ADMIN(1,"运营管理员"),
UNKNOWN(99, "未指定");
@Getter
private final Integer code;
@Getter
private final String description;
private final static Map<Integer, UserType> userTypeMap;
private final static Map<String, UserType> descriptionMap;
static {
userTypeMap = Arrays.asList(values()).stream()
.collect(Collectors.toMap(UserType::getCode, t -> t));
descriptionMap = new HashMap<>();
for (UserType userType : UserType.values()) {
descriptionMap.put(userType.getDescription(), userType);
}
}
public static UserType getByDescription(String description) {
try {
return descriptionMap.get(description);
} catch (Exception ex) {
return null;
}
}
public static UserType safeParse(Integer value) {
return safeParse(value, UNKNOWN);
}
public static UserType safeParse(Integer value, UserType defaultLevel) {
if (value == null) return defaultLevel;
return userTypeMap.getOrDefault(value, defaultLevel);
}
public static List<UserType> schoolAdmins() {
return Arrays.asList(UserType.SCHOOL_ADMIN, UserType.ASSOCIATE_SCHOOL_ADMIN);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment