|
|
package com.dsideal.newUniversityExamination.selectcourse.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.dsideal.exception.SelectCourseException;
|
|
|
import com.dsideal.newUniversityExamination.selectcourse.service.CoursetableRulesService;
|
|
|
import com.dsideal.newUniversityExamination.selectcourse.util.SelectCourseUtil;
|
|
|
import com.dsideal.newUniversityExamination.util.Constant;
|
|
|
import com.jfinal.core.Controller;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
/**
|
|
|
* 课程规则
|
|
|
* 尚显奇 2018-04-09
|
|
|
* @author Administrator
|
|
|
*
|
|
|
*/
|
|
|
public class SchedulingLockSubjectController extends Controller{
|
|
|
/**课程规则 11 不授课 12 授课 13每天授课上限 14同时授课上限 15互斥课程 16单双周 17 不分配教师*/
|
|
|
private static final String type ="1";
|
|
|
|
|
|
/**
|
|
|
* 保存课程规则—不授课/授课 11 不授课 12 必须授课
|
|
|
*/
|
|
|
public void saveLockSubject(){
|
|
|
JSONObject returnJson=new JSONObject();
|
|
|
String subjectId=getPara("subject_id");
|
|
|
String taskId=getPara("task_id");
|
|
|
String classNumberArrayStr=getPara("class_number_array");
|
|
|
String typeSecondary = getPara("type_secondary");
|
|
|
|
|
|
//参数非空判断
|
|
|
HashMap<String,String> parameters=new HashMap<>(4);
|
|
|
parameters.put("subject_id", subjectId);
|
|
|
parameters.put("task_id", taskId);
|
|
|
parameters.put("class_number_array", classNumberArrayStr);
|
|
|
parameters.put("type_secondary", typeSecondary);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = CoursetableRulesService.service.saveLockSubject(taskId, type, typeSecondary, classNumberArrayStr, subjectId);
|
|
|
} catch (SelectCourseException e) {
|
|
|
returnJson.put("success", Constant.FALSE);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
returnJson.put("type", type);
|
|
|
returnJson.put("type_secondary", typeSecondary);
|
|
|
renderJson(returnJson);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取课程规则-不授课/授课 规则内容 11不授课 12 授课 13每天课节上限 14同时授课上限 15互斥课程 16单双周,18 功能教室
|
|
|
*/
|
|
|
public void getLockSubject(){
|
|
|
JSONObject returnJson=new JSONObject();
|
|
|
String subjectId=getPara("subject_id");
|
|
|
String taskId=getPara("task_id");
|
|
|
String typeSecondary = getPara("type_secondary");
|
|
|
//参数非空判断
|
|
|
HashMap<String,String> parameters=new HashMap<>(3);
|
|
|
parameters.put("task_id", taskId);
|
|
|
parameters.put("subject_id", subjectId);
|
|
|
parameters.put("type_secondary", typeSecondary);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = CoursetableRulesService.service.getLockSubject(subjectId, taskId,type, typeSecondary);
|
|
|
} catch (SelectCourseException e) {
|
|
|
returnJson.put("success", Constant.FALSE);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
returnJson.put("type", type);
|
|
|
returnJson.put("type_secondary", typeSecondary);
|
|
|
renderJson(returnJson);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 不授课获取所有规则 11 不授课 12 授课 13每天课节上限 14同时授课上限 15互斥课程 16单双周 ,17 课程不分配教师 18 功能教室
|
|
|
*/
|
|
|
public void getLockSubjectList(){
|
|
|
JSONObject returnJson=new JSONObject();
|
|
|
String taskId=getPara("task_id");
|
|
|
String typeSecondary = getPara("type_secondary");
|
|
|
int pageNumber=getParaToInt("pageNumber") == null ? 1: getParaToInt("pageNumber");
|
|
|
int pageSize=getParaToInt("pageSize") == null ? 20: getParaToInt("pageSize");
|
|
|
//参数非空判断
|
|
|
HashMap<String,String> parameters=new HashMap<>(2);
|
|
|
parameters.put("task_id", taskId);
|
|
|
parameters.put("type_secondary", typeSecondary);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = CoursetableRulesService.service.getLockSubjectJson(type,typeSecondary, taskId, pageNumber, pageSize);
|
|
|
}catch (SelectCourseException e) {
|
|
|
returnJson.put("success", Constant.FALSE);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
returnJson.put("type", type);
|
|
|
returnJson.put("type_secondary", typeSecondary);
|
|
|
renderJson(returnJson);
|
|
|
}
|
|
|
/**
|
|
|
* 保存课程规则—13每天课节上限 14同时授课上限
|
|
|
*/
|
|
|
public void saveLockSubjectLimit(){
|
|
|
JSONObject returnJson=new JSONObject();
|
|
|
String taskId=getPara("task_id");
|
|
|
String subjectId=getPara("subject_id");
|
|
|
String number =getPara("number");
|
|
|
String typeSecondary = getPara("type_secondary");
|
|
|
//参数非空判断
|
|
|
HashMap<String,String> parameters=new HashMap<>(4);
|
|
|
parameters.put("task_id", taskId);
|
|
|
parameters.put("subject_id", subjectId);
|
|
|
parameters.put("number", number);
|
|
|
parameters.put("type_secondary", typeSecondary);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = CoursetableRulesService.service.saveLockSubjectLimit(taskId, type, typeSecondary, subjectId, number);
|
|
|
}catch (SelectCourseException e) {
|
|
|
returnJson.put("success", Constant.FALSE);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
returnJson.put("type", type);
|
|
|
returnJson.put("type_secondary", typeSecondary);
|
|
|
renderJson(returnJson);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 保存课程规则— 15互斥课程 16单双周
|
|
|
*/
|
|
|
public void saveLockSubjectAndSubject(){
|
|
|
JSONObject returnJson=new JSONObject();
|
|
|
String typeSecondary = getPara("type_secondary");
|
|
|
String taskId=getPara("task_id");
|
|
|
String subjectId=getPara("subject_id");
|
|
|
String subjectIdOther =getPara("subject_id_other");
|
|
|
//参数非空判断
|
|
|
HashMap<String,String> parameters=new HashMap<>(4);
|
|
|
parameters.put("subject_id", subjectId);
|
|
|
parameters.put("task_id", taskId);
|
|
|
parameters.put("subject_id_other", subjectIdOther);
|
|
|
parameters.put("type_secondary", typeSecondary);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = CoursetableRulesService.service.saveLockSubjectAndSubject(taskId, type, typeSecondary, subjectId, subjectIdOther);
|
|
|
} catch (SelectCourseException e) {
|
|
|
returnJson.put("success", Constant.FALSE);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
returnJson.put("type", type);
|
|
|
returnJson.put("type_secondary", typeSecondary);
|
|
|
renderJson(returnJson);
|
|
|
}
|
|
|
/**
|
|
|
* 不分配教师保存 17 不分配教师
|
|
|
*/
|
|
|
public void saveNoAssignSubject(){
|
|
|
JSONObject returnJson=new JSONObject();
|
|
|
String taskId=getPara("task_id");
|
|
|
String subjectId=getPara("subject_id");
|
|
|
String typeSecondary = getPara("type_secondary");
|
|
|
//参数非空判断
|
|
|
HashMap<String,String> parameters=new HashMap<>(3);
|
|
|
parameters.put("subject_id", subjectId);
|
|
|
parameters.put("task_id", taskId);
|
|
|
parameters.put("type_secondary", typeSecondary);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = CoursetableRulesService.service.saveNoAssignSubject(taskId, type, typeSecondary, subjectId);
|
|
|
} catch (SelectCourseException e) {
|
|
|
returnJson.put("success", Constant.FALSE);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
returnJson.put("type", type);
|
|
|
returnJson.put("type_secondary", typeSecondary);
|
|
|
renderJson(returnJson);
|
|
|
}
|
|
|
/**
|
|
|
* @description 保存功能教室 18 功能教室
|
|
|
* @author Mr.zms
|
|
|
* @date 2019/4/22
|
|
|
* @return void
|
|
|
*/
|
|
|
public void saveFunctionRoom(){
|
|
|
JSONObject returnJson=new JSONObject();
|
|
|
String taskId=getPara("task_id");
|
|
|
String typeSecondary = getPara("type_secondary");
|
|
|
String subjectId=getPara("subject_id");
|
|
|
String labelId = getPara("label_id");
|
|
|
String classRoomIds = getPara("class_room_ids");
|
|
|
//参数非空判断
|
|
|
HashMap<String,String> parameters=new HashMap<>(5);
|
|
|
parameters.put("subject_id", subjectId);
|
|
|
parameters.put("task_id", taskId);
|
|
|
parameters.put("type_secondary", typeSecondary);
|
|
|
parameters.put("label_id", labelId);
|
|
|
parameters.put("class_room_ids", classRoomIds);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = CoursetableRulesService.service.saveFunctionRoom(taskId, type, typeSecondary, subjectId,labelId,classRoomIds);
|
|
|
} catch (SelectCourseException e) {
|
|
|
returnJson.put("success", Constant.FALSE);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
returnJson.put("type", type);
|
|
|
returnJson.put("type_secondary", typeSecondary);
|
|
|
renderJson(returnJson);
|
|
|
}
|
|
|
public void getSchoolFacilityListByTaskId(){
|
|
|
String bureauId = getPara("bureau_id");
|
|
|
String labelId = getPara("label_id");
|
|
|
String taskId = getPara("task_id");
|
|
|
String Str = CoursetableRulesService.service.getSchoolFacilityListByTaskId(taskId,bureauId,labelId);
|
|
|
renderJson(Str);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
}
|