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.

154 lines
5.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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);
}
}