You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
5.0 KiB

package com.dsideal.newUniversityExamination.selectcourse.controller;
import java.util.HashMap;
import com.alibaba.fastjson.JSONObject;
import com.dsideal.exception.SelectCourseException;
import com.dsideal.newUniversityExamination.selectcourse.service.TaskClassRoomService;
import com.dsideal.newUniversityExamination.selectcourse.util.SelectCourseUtil;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Record;
public class TaskClassRoomController extends Controller {
public void getTaskClassRooms() {
JSONObject returnJson = new JSONObject();
String taskId = getPara("taskId");
//参数非空判断
HashMap<String,String> parameters=new HashMap<String,String>();
parameters.put("taskId", taskId);
try {
SelectCourseUtil.checkoutParameters(parameters);
returnJson = TaskClassRoomService.service.getTaskClassRooms(taskId);
} catch (SelectCourseException e) {
returnJson.put("success", false);
returnJson.put("info", e.getMessage());
}
renderJson(returnJson);
return;
}
//设置班级接口
public void setTaskClassRoom() {
JSONObject returnJson = new JSONObject();
String id = getPara("id")==null?"":getPara("id");
String taskId = getPara("taskId");
String classId = getPara("classId");
String classRoomId = getPara("classRoomId");
String type = getPara("type");
//参数非空判断
HashMap<String,String> parameters=new HashMap<String,String>();
parameters.put("taskId", taskId);
parameters.put("classId", classId);
parameters.put("classRoomId", classRoomId);
parameters.put("type", type);
Record record = new Record();
record.set("id", id);
record.set("taskId", taskId);
record.set("classId", classId);
record.set("classRoomId", classRoomId);
record.set("type", type);
try {
SelectCourseUtil.checkoutParameters(parameters);
returnJson = TaskClassRoomService.service.setTaskClassRoom(record);;
} catch (SelectCourseException e) {
returnJson.put("success", false);
returnJson.put("info", e.getMessage());
}
renderJson(returnJson);
return;
}
//获取教室接口
public void getClassRoomList(){
JSONObject returnJson = new JSONObject();
String taskId = getPara("taskId");
String type = getPara("type");
String bureauId = getPara("bureauId");
String calculateType = getPara("calculateType");
String groupId = getPara("groupId");
//参数非空判断
HashMap<String,String> parameters=new HashMap<String,String>();
parameters.put("taskId", taskId);
parameters.put("type", type);
parameters.put("bureauId", bureauId);
parameters.put("calculateType", calculateType);
parameters.put("groupId", groupId);
try {
SelectCourseUtil.checkoutParameters(parameters);
String result = TaskClassRoomService.service.getClassRoomList(taskId, type, bureauId, calculateType, groupId);
returnJson = JSONObject.parseObject(result);
} catch (SelectCourseException e) {
returnJson.put("success", false);
returnJson.put("info", e.getMessage());
}
renderJson(returnJson);
return;
}
//删除排课任务接口
public void delClassRoom(){
JSONObject returnJson= new JSONObject();
String id = getPara("id")==null?"":getPara("id");
returnJson = TaskClassRoomService.service.delClassRoom(id);
renderJson(returnJson);
return;
}
/**
* 批量设置教室
*
*/
public void setBatchClassRoom(){
JSONObject returnJson = new JSONObject();
String classRoomId = getPara("class_room_id");
String taskId = getPara("task_id");
String calculateType = getPara("calculate_type");
//参数非空判断
HashMap<String,String> parameters=new HashMap<String,String>();
parameters.put("task_id", taskId);
parameters.put("class_room_id", classRoomId);
parameters.put("calculate_type", calculateType);
try {
SelectCourseUtil.checkoutParameters(parameters);
String result = TaskClassRoomService.service.setBatchClassRoom(taskId,classRoomId,calculateType);
returnJson = JSONObject.parseObject(result);
} catch (SelectCourseException e) {
returnJson.put("success", false);
returnJson.put("info", e.getMessage());
}
renderJson(returnJson);
return ;
}
public void getBatchClassRoom(){
String taskId = getPara("task_id");
String bureauId = getPara("bureau_id");
//参数非空判断
HashMap<String,String> parameters=new HashMap<String,String>();
parameters.put("task_id", taskId);
parameters.put("bureau_id", bureauId);
JSONObject returnJson = new JSONObject();
try {
SelectCourseUtil.checkoutParameters(parameters);
String result = TaskClassRoomService.service.getBatchClassRoom(taskId,bureauId);
returnJson = JSONObject.parseObject(result);
} catch (SelectCourseException e) {
returnJson.put("success", false);
returnJson.put("info", e.getMessage());
}
renderJson(returnJson);
return ;
}
}