|
|
package com.dsideal.newUniversityExamination.selectcourse.controller;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
import com.dsideal.newUniversityExamination.selectcourse.util.CoreUtil;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.dsideal.exception.ExceptionCode;
|
|
|
import com.dsideal.exception.SelectCourseException;
|
|
|
import com.dsideal.newUniversityExamination.exception.NewUniversityExaminationException;
|
|
|
import com.dsideal.newUniversityExamination.selectcourse.service.StudentApplyService;
|
|
|
import com.dsideal.newUniversityExamination.selectcourse.util.SelectCourseUtil;
|
|
|
import com.dsideal.newUniversityExamination.util.COMMON;
|
|
|
import com.dsideal.newUniversityExamination.util.FileUtil;
|
|
|
import com.dsideal.newUniversityExamination.util.ParamUtil;
|
|
|
import com.jfinal.core.Controller;
|
|
|
import com.jfinal.ext.render.excel.PoiRender;
|
|
|
import com.jfinal.upload.UploadFile;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 学生学科管理 by huyue 2018-01-06
|
|
|
*
|
|
|
* @author Administrator
|
|
|
*
|
|
|
*/
|
|
|
public class StudentApplyController extends Controller {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 单科志愿统计 by huyue 2018-01-20
|
|
|
*/
|
|
|
public void getSingleApplyStatistics() {
|
|
|
String planId = getPara("plan_id");
|
|
|
//参数非空判断
|
|
|
JSONObject returnJson = new JSONObject();
|
|
|
HashMap<String,String> parameters=new HashMap<String,String>();
|
|
|
parameters.put("plan_id", planId);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson =StudentApplyService.service.getSingleApplyStatistics(planId);
|
|
|
} catch (SelectCourseException e) {
|
|
|
returnJson.put("success", false);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Description: 三科志愿统计
|
|
|
* @author huyue
|
|
|
* @date 2018-1-20
|
|
|
*/
|
|
|
public void getThreeApplyStatistics() {
|
|
|
String planId = getPara("plan_id");
|
|
|
//参数非空判断
|
|
|
JSONObject returnJson = new JSONObject();
|
|
|
HashMap<String,String> parameters=new HashMap<String,String>();
|
|
|
parameters.put("plan_id", planId);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson =StudentApplyService.service.getThreeApplyStatistics(planId);
|
|
|
} catch (SelectCourseException e) {
|
|
|
returnJson.put("success", false);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询未分班学生列表
|
|
|
*/
|
|
|
// getPlanInfo
|
|
|
public void getOtherStudentList() {
|
|
|
String planId = getPara("planId");
|
|
|
String calculateType = getPara("calculateType");
|
|
|
String pageSize = getPara("pageSize");
|
|
|
String pageNumber = getPara("pageNumber");
|
|
|
//参数非空判断
|
|
|
JSONObject returnJson = new JSONObject();
|
|
|
HashMap<String,String> parameters=new HashMap<String,String>();
|
|
|
parameters.put("planId", planId);
|
|
|
parameters.put("calculateType", calculateType);
|
|
|
parameters.put("pageSize", pageSize);
|
|
|
parameters.put("pageNumber", pageNumber);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson =StudentApplyService.service.getOtherStudentList(planId, calculateType, pageSize, pageNumber);
|
|
|
} catch (SelectCourseException e) {
|
|
|
returnJson.put("success", false);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取分班失败学生详情
|
|
|
*/
|
|
|
public void getOtherStudentInfo() {
|
|
|
String planId = getPara("planId");
|
|
|
String personId = getPara("personId");
|
|
|
String calculateType = getPara("calculateType");
|
|
|
//参数非空判断
|
|
|
JSONObject returnJson = new JSONObject();
|
|
|
HashMap<String,String> parameters=new HashMap<String,String>();
|
|
|
parameters.put("planId", planId);
|
|
|
parameters.put("personId", personId);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson =StudentApplyService.service.getOtherStudentInfo(planId, personId, calculateType);
|
|
|
} catch (SelectCourseException e) {
|
|
|
returnJson.put("success", false);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 导出学生志愿
|
|
|
*/
|
|
|
|
|
|
public void exportApplyItems() {
|
|
|
String planId= getPara("planId");
|
|
|
String bureauId = getPara("bureauId");
|
|
|
PoiRender excel = StudentApplyService.service.exportApplyItems(planId, bureauId);
|
|
|
render(excel);
|
|
|
return ;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 导出学生模板
|
|
|
*/
|
|
|
|
|
|
public void exportStudnets() {
|
|
|
String planId= getPara("planId");
|
|
|
HSSFWorkbook wb = StudentApplyService.service.getExportStudnets(planId);
|
|
|
String filetypename="学生选科模板.xls";
|
|
|
CoreUtil.exportExcel(this.getResponse(),wb,filetypename);
|
|
|
renderNull();
|
|
|
|
|
|
}
|
|
|
|
|
|
//获取单科志愿学生详细信息
|
|
|
public void getSingleDetail(){
|
|
|
String pageNumber=getPara("pageNumber");
|
|
|
String pageSize=getPara("pageSize");
|
|
|
String planId = getPara("plan_id");
|
|
|
String subject=getPara("subject");
|
|
|
String level=getPara("level");
|
|
|
//参数非空判断
|
|
|
JSONObject returnJson = new JSONObject();
|
|
|
HashMap<String,String> parameters=new HashMap<String,String>();
|
|
|
parameters.put("plan_id", planId);
|
|
|
parameters.put("pageNumber", pageNumber);
|
|
|
parameters.put("pageSize", pageSize);
|
|
|
parameters.put("subject", subject);
|
|
|
parameters.put("level", level);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson =StudentApplyService.service.getSingleDetail(pageNumber, pageSize, planId, subject, level);
|
|
|
} catch (SelectCourseException e) {
|
|
|
returnJson.put("success", false);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//获取三科志愿学生详细信息
|
|
|
public void getThreeDetail(){
|
|
|
String pageNumber=getPara("pageNumber");
|
|
|
String pageSize=getPara("pageSize");
|
|
|
String planId = getPara("plan_id");
|
|
|
String subjcetArry=getPara("subjcetArry");
|
|
|
String level=getPara("level");
|
|
|
//参数非空判断
|
|
|
JSONObject returnJson = new JSONObject();
|
|
|
HashMap<String,String> parameters=new HashMap<String,String>();
|
|
|
parameters.put("plan_id", planId);
|
|
|
parameters.put("pageNumber", pageNumber);
|
|
|
parameters.put("pageSize", pageSize);
|
|
|
parameters.put("subjcetArry", subjcetArry);
|
|
|
parameters.put("level", level);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = StudentApplyService.service.getThreeDetail(planId, subjcetArry, level, pageNumber, pageSize);
|
|
|
} catch (SelectCourseException e) {
|
|
|
returnJson.put("success", false);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
return;
|
|
|
}
|
|
|
//导入学生志愿
|
|
|
public void importStudnetApply() {
|
|
|
String planId = getPara("planId");
|
|
|
UploadFile file = getFile();
|
|
|
JSONObject object = FileUtil.CheckUploadFileObject(
|
|
|
file.getSaveDirectory() + File.separator
|
|
|
+ file.getFileName());
|
|
|
if(false == (Boolean)object.get("success")){
|
|
|
renderJson(object);
|
|
|
return;
|
|
|
}
|
|
|
JSONObject returnJson = new JSONObject();
|
|
|
try {
|
|
|
HSSFWorkbook wookbook = new HSSFWorkbook(new FileInputStream(file.getSaveDirectory() + File.separator + file.getFileName()));
|
|
|
returnJson = StudentApplyService.service.importStudnetApply(planId, wookbook);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}catch (NumberFormatException e){
|
|
|
e.printStackTrace();
|
|
|
returnJson.put("success", false);
|
|
|
returnJson.put("info", "导入的模板志愿存在非数字!");
|
|
|
}catch (Exception e){
|
|
|
returnJson.put("success", false);
|
|
|
returnJson.put("info", "导入的模板不正确!");
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据sn号获取导入后的信息
|
|
|
*/
|
|
|
public void getImportInfo()
|
|
|
{
|
|
|
String sn = getPara("sn");
|
|
|
String planId = getPara("planId");
|
|
|
int pageSize = Integer.parseInt(getPara("pageSize"));
|
|
|
int pageNumber = Integer.parseInt(getPara("pageNumber"));
|
|
|
//参数非空判断
|
|
|
JSONObject returnJson = new JSONObject();
|
|
|
HashMap<String,String> parameters=new HashMap<String,String>();
|
|
|
parameters.put("sn", sn);
|
|
|
parameters.put("planId", planId);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = StudentApplyService.service.getImportErrorInfoArray(sn, planId, pageSize, pageNumber);
|
|
|
} catch (SelectCourseException e) {
|
|
|
returnJson.put("success", false);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
return ;
|
|
|
}
|
|
|
|
|
|
//获取学生志愿临时表详细的信息
|
|
|
public void getStudentDefeatedApply(){
|
|
|
String personId=getPara("personId");
|
|
|
String planId=getPara("planId");
|
|
|
String sn=getPara("sn");
|
|
|
//参数非空判断
|
|
|
JSONObject returnJson = new JSONObject();
|
|
|
HashMap<String,String> parameters=new HashMap<String,String>();
|
|
|
parameters.put("sn", sn);
|
|
|
parameters.put("planId", planId);
|
|
|
parameters.put("personId", personId);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = StudentApplyService.service.getStudentDefeatedApply(personId, planId, sn);
|
|
|
} catch (SelectCourseException e) {
|
|
|
returnJson.put("success", false);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
return ;
|
|
|
}
|
|
|
//保存学生修改后的志愿
|
|
|
public void saveStudentDefeatedApply(){
|
|
|
String personId=getPara("personId");
|
|
|
String personName=getPara("personName");
|
|
|
String className=getPara("className");
|
|
|
String applyIdFirst=getPara("applyIdFirst");
|
|
|
String applyIdSecond=getPara("applyIdSecond");
|
|
|
String subjectFirst=getPara("subjectFirst");
|
|
|
String subjectSecond=getPara("subjectSecond");
|
|
|
String identityId = getPara("identityId");
|
|
|
String planId=getPara("planId");
|
|
|
String sn=getPara("sn");
|
|
|
//参数非空判断
|
|
|
JSONObject returnJson = new JSONObject();
|
|
|
HashMap<String,String> parameters=new HashMap<String,String>();
|
|
|
parameters.put("sn", sn);
|
|
|
parameters.put("planId", planId);
|
|
|
parameters.put("personId", personId);
|
|
|
parameters.put("personName", personName);
|
|
|
parameters.put("className", className);
|
|
|
parameters.put("identityId", identityId);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = StudentApplyService.service.saveStudentDefeatedApply(personId, planId, sn, subjectFirst, subjectSecond, identityId, applyIdFirst, applyIdSecond, personName, className);
|
|
|
} catch (SelectCourseException e) {
|
|
|
returnJson.put("success", false);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
return ;
|
|
|
}
|
|
|
//导入学生志愿
|
|
|
public void importStudenSuccesstApply(){
|
|
|
String sn=getPara("sn");
|
|
|
String planId=getPara("planId");
|
|
|
//参数非空判断
|
|
|
JSONObject returnJson = new JSONObject();
|
|
|
HashMap<String,String> parameters=new HashMap<String,String>();
|
|
|
parameters.put("sn", sn);
|
|
|
parameters.put("planId", planId);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = StudentApplyService.service.importStudenSuccesstApply(sn, planId);
|
|
|
} catch (SelectCourseException e) {
|
|
|
returnJson.put("success", false);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
return ;
|
|
|
}
|
|
|
public void delStudentDefeatedApply(){
|
|
|
String personId=getPara("personId");
|
|
|
String sn=getPara("sn");
|
|
|
String planId=getPara("planId");
|
|
|
//参数非空判断
|
|
|
JSONObject returnJson = new JSONObject();
|
|
|
HashMap<String,String> parameters=new HashMap<String,String>();
|
|
|
parameters.put("sn", sn);
|
|
|
parameters.put("planId", planId);
|
|
|
parameters.put("personId", personId);
|
|
|
try {
|
|
|
SelectCourseUtil.checkoutParameters(parameters);
|
|
|
returnJson = StudentApplyService.service.delStudentDefeatedApply(personId, sn, planId);
|
|
|
} catch (SelectCourseException e) {
|
|
|
returnJson.put("success", false);
|
|
|
returnJson.put("info", e.getMessage());
|
|
|
}
|
|
|
renderJson(returnJson);
|
|
|
return ;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 统计学生选科分数数据
|
|
|
* 对接云成绩
|
|
|
*/
|
|
|
public void getStudentComposeWishScore(){
|
|
|
JSONObject returnJson;
|
|
|
String subjectId;
|
|
|
int planId;
|
|
|
int sortSubject = Integer.parseInt(COMMON.isEmpty(getPara("sortSubject"))?"0":getPara("sortSubject")) ;
|
|
|
//排序类型,0:三科主科排序,1:单科排序
|
|
|
int sortSubjectCount = Integer.parseInt(COMMON.isEmpty(getPara("sortSubjectCount"))?"3":getPara("sortSubjectCount"));
|
|
|
//排序类型,排序类型,0-按分数,1-按排名
|
|
|
int sortType = Integer.parseInt(COMMON.isEmpty(getPara("sortType"))?"0":getPara("sortType"));
|
|
|
//0-倒序 1-正序
|
|
|
int sort = Integer.parseInt(COMMON.isEmpty(getPara("sort"))?"0":getPara("sort"));
|
|
|
try {
|
|
|
if(sortSubjectCount==0){
|
|
|
sortSubjectCount = ParamUtil.isNumber(String.valueOf(sortSubject),"sortSubject");
|
|
|
sortType = ParamUtil.isNumber(String.valueOf(sortType),"sortType");
|
|
|
}
|
|
|
sort = ParamUtil.isNumber(String.valueOf(sort),"sort");
|
|
|
subjectId = ParamUtil.isEmpty(getPara("subjectId"),"subjectId");
|
|
|
planId = ParamUtil.isNumber(getPara("planId"),"planId");
|
|
|
}catch (NewUniversityExaminationException e) {
|
|
|
e.printStackTrace();
|
|
|
returnJson = ParamUtil.getMessage(e.getMessage(), false);
|
|
|
renderJson(returnJson);
|
|
|
return;
|
|
|
}
|
|
|
returnJson = StudentApplyService.service.getStudentComposeWishScore(subjectId,planId,sortType,sortSubjectCount,sortSubject,sort);
|
|
|
// returnJson = ParamUtil.getMessage(ExceptionCode.S00001_MESSAGE, true);
|
|
|
returnJson.put("info", ExceptionCode.S00001_MESSAGE);
|
|
|
returnJson.put("success", true);
|
|
|
renderJson(returnJson.toJSONString());
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|