klxedu / blog

2 stars 0 forks source link

班级扩展点设计(状态变更、用户通过) #23

Open songhuiqing88 opened 7 years ago

songhuiqing88 commented 7 years ago

班级状态说明,见班级组件常量类:org.gtiles.components.gtclasses.base.ClassConstant

// 班级状态 1.撤回 2.未开班 3.已开班 4.已结束 5.草稿
public static final int CLASS_STATE_UNPUBLISH = 1;
public static final int CLASS_STATE_UNBEGIN = 2;
public static final int CLASS_STATE_BEGIN = 3;
public static final int CLASS_STATE_FINISH = 4;
public static final int CLASS_STATE_DRAFT = 5;
// 审核状态(交流,人员,班级),1.已审核 2.未审核 3.驳回
public static final int VERIFY_STATE_YES = 1;
public static final int VERIFY_STATE_NO = 2;
public static final int VERIFY_STATE_AGAINST = 3;
//4.审核中  仅班级有此审核状态
public static final int VERIFY_STATE_CHECKING = 4;

班级状态变更

创建观察者,观察主题 org.gtiles.components.gtclasses.subject.ClassStateChangeSubject

@SubjectDesc(beanid = "org.gtiles.components.gtclasses.subject.ClassStateChangeSubject")
@Component("org.gtiles.components.gtclasses.observable.ClassStateChangeObservable")
public class ClassStateChangeObservable implements Observer{
@Override
public boolean update(Object obj) {
Map<String,String> map = (Map<String,String>)obj;
String classId = map.get(ClassConstant.CLASS_ID);//班级ID
String className = map.get(ClassConstant.CLASS_NAME);//班级名称
String beforeCheckState = map.get(ClassConstant.BEFORE_CHECK_STATE);//变更前审核状态
String beforeClassState = map.get(ClassConstant.BEFORE_CLASS_STATE);//变更前班级状态
String checkState = map.get(ClassConstant.CHECK_STATE);//变更后审核状态
String classState = map.get(ClassConstant.CLASS_STATE);//变更后班级状态
// 业务逻辑
return true;
}
}

学员通过班级

创建观察者,观察主题 org.gtiles.components.gtclasses.subject.StuPassClassSubject


@SubjectDesc(beanid = "org.gtiles.components.gtclasses.subject.StuPassClassSubject")
@Component("org.gtiles.components.gtclasses.observable.StuPassClassObservable")
public class StuPassClassObservable implements Observer{
@Override
public boolean update(Object obj) {
Map<String,String> map = (Map<String,String>)obj;
String classId = map.get(ClassConstant.CLASS_ID);//班级ID
String className = map.get(ClassConstant.CLASS_NAME);//班级名称
String classType = map.get(ClassConstant.CLASS_TYPE);//班级类型
String userId = map.get(ClassConstant.USER_ID);//用户Id
String score = map.get(ClassConstant.TARGET_SCORE_REQUIRE);//学时
String passIncreaseNum = map.get(ClassConstant.PASS_INCREASE_NUM);//通过状态 1:表示通过,-1:表示从原来的通过变成现在的不通过
// 业务逻辑
return true;
}
}
## 班级学员状态变更接口 - updateStuInfoState
- 接口路径 org.gtiles.components.gtclasses.classstu.service.IClassStuService.updateStuInfoState
- 输入参数 org.gtiles.components.gtclasses.classstu.bean.ClassStuBean
- 返回值 int

int org.gtiles.components.gtclasses.classstu.service.IClassStuService.updateStuInfoState(ClassStuBean classStu);