|
|
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.CoursetableRulesService;
|
|
|
import com.dsideal.newUniversityExamination.selectcourse.util.SelectCourseUtil;
|
|
|
import com.dsideal.newUniversityExamination.util.Constant;
|
|
|
import com.jfinal.core.Controller;
|
|
|
|
|
|
/**
|
|
|
* 排课规则总数据查询
|
|
|
* 尚显奇 2018-04-12
|
|
|
* @author Administrator
|
|
|
*
|
|
|
*/
|
|
|
public class SchedulingRegulationController extends Controller {
|
|
|
/**
|
|
|
* 获取当前排课计划中存在的各类规则种类
|
|
|
*/
|
|
|
public void getRegulationList(){
|
|
|
JSONObject returnJson=new JSONObject();
|
|
|
String taskId=getPara("task_id");
|
|
|
String type=getPara("type");
|
|
|
int pageNumber=getParaToInt("pageNumber") == null ? 1: getParaToInt("pageNumber");
|
|
|
int pageSize=getParaToInt("pageSize") == null ? 20: getParaToInt("pageSize");
|
|
|
//参数非空判断
|
|
|
HashMap<String,String> parameters=new HashMap<>(1);
|
|
|
parameters.put("task_id", taskId);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = CoursetableRulesService.service.getRegulationList(taskId, type, pageNumber, pageSize);
|
|
|
}catch (SelectCourseException e) {
|
|
|
returnJson.put("success", Constant.FALSE);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 根据排课计划ID 和 规则ID,删除规则
|
|
|
*/
|
|
|
public void deleteRegulation(){
|
|
|
JSONObject returnJson=new JSONObject();
|
|
|
String regulationId=getPara("regulation_id");
|
|
|
String taskId=getPara("task_id");
|
|
|
String type=getPara("type");
|
|
|
String typeSecondary=getPara("type_secondary");
|
|
|
//参数非空判断
|
|
|
HashMap<String,String> parameters=new HashMap<>(3);
|
|
|
parameters.put("task_id", taskId);
|
|
|
parameters.put("type", type);
|
|
|
parameters.put("type_secondary", typeSecondary);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = CoursetableRulesService.service.deleteRegulation(taskId, regulationId, type, typeSecondary);
|
|
|
}catch (SelectCourseException e) {
|
|
|
returnJson.put("success", Constant.FALSE);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
}
|
|
|
/**
|
|
|
* @description 获取优先级列表
|
|
|
* @author Mr.zms
|
|
|
* @date 2019/5/17
|
|
|
* @return void
|
|
|
*/
|
|
|
public void getRegulationPriorityList(){
|
|
|
JSONObject returnJson=new JSONObject();
|
|
|
String taskId=getPara("task_id");
|
|
|
//参数非空判断
|
|
|
HashMap<String,String> parameters=new HashMap<>(1);
|
|
|
parameters.put("task_id", taskId);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = CoursetableRulesService.service.getRegulationPriorityList(taskId);
|
|
|
}catch (SelectCourseException e) {
|
|
|
returnJson.put("success", Constant.FALSE);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
}
|
|
|
|
|
|
public void saveRegulationPriority(){
|
|
|
JSONObject returnJson=new JSONObject();
|
|
|
String taskId=getPara("task_id");
|
|
|
String priority = getPara("priority");
|
|
|
//参数非空判断
|
|
|
HashMap<String,String> parameters=new HashMap<>(2);
|
|
|
parameters.put("task_id", taskId);
|
|
|
parameters.put("priority", priority);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = CoursetableRulesService.service.saveRegulationPriority(taskId,priority);
|
|
|
}catch (SelectCourseException e) {
|
|
|
returnJson.put("success", Constant.FALSE);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}catch (Exception e){
|
|
|
returnJson.put("success", Constant.FALSE);
|
|
|
returnJson.put("info", "参数格式错误");
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
}
|
|
|
/**
|
|
|
* @description 获取排课结果优先级
|
|
|
* @author Mr.zms
|
|
|
* @date 2019/5/17
|
|
|
* @return void
|
|
|
*/
|
|
|
public void getResultRegulationPriorityList(){
|
|
|
JSONObject returnJson=new JSONObject();
|
|
|
String taskId=getPara("task_id");
|
|
|
//参数非空判断
|
|
|
HashMap<String,String> parameters=new HashMap<>(1);
|
|
|
parameters.put("task_id", taskId);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = CoursetableRulesService.service.getResultRegulationPriorityList(taskId);
|
|
|
}catch (SelectCourseException e) {
|
|
|
returnJson.put("success", Constant.FALSE);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
}
|
|
|
public void setRegulationUse(){
|
|
|
JSONObject returnJson=new JSONObject();
|
|
|
String taskId=getPara("task_id");
|
|
|
String type=getPara("type");
|
|
|
String typeSecondary=getPara("type_secondary");
|
|
|
//0 取消 1应用
|
|
|
String bUse=getPara("b_use");
|
|
|
//参数非空判断
|
|
|
HashMap<String,String> parameters=new HashMap<>(4);
|
|
|
parameters.put("task_id", taskId);
|
|
|
parameters.put("type", type);
|
|
|
parameters.put("type_secondary", typeSecondary);
|
|
|
parameters.put("b_use", bUse);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = CoursetableRulesService.service.setRegulationUse(taskId, type, typeSecondary, bUse);
|
|
|
}catch (SelectCourseException e) {
|
|
|
returnJson.put("success", Constant.FALSE);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|