|
|
package com.ibeetl.jlw.web;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import cn.jlw.Interceptor.GetFile;
|
|
|
import cn.jlw.Interceptor.RFile;
|
|
|
import cn.jlw.Interceptor.SCoreUser;
|
|
|
import cn.jlw.util.JupyterNotebookUtils;
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
import cn.jlw.util.excel.ExcelUtil;
|
|
|
import cn.jlw.util.excel.listener.MyValidateExcelCellDataListener;
|
|
|
import cn.jlw.validate.ValidateConfig;
|
|
|
import com.ibeetl.admin.core.annotation.Function;
|
|
|
import com.ibeetl.admin.core.entity.CoreUser;
|
|
|
import com.ibeetl.admin.core.file.FileService;
|
|
|
import com.ibeetl.admin.core.service.CorePlatformService;
|
|
|
import com.ibeetl.admin.core.util.BeanCopyUtil;
|
|
|
import com.ibeetl.admin.core.util.PlatformException;
|
|
|
import com.ibeetl.admin.core.util.TimeTool;
|
|
|
import com.ibeetl.admin.core.web.JsonResult;
|
|
|
import com.ibeetl.jlw.dao.UniversitiesCollegesDao;
|
|
|
import com.ibeetl.jlw.entity.*;
|
|
|
import com.ibeetl.jlw.entity.dto.TeacherBatchImportDTO;
|
|
|
import com.ibeetl.jlw.service.*;
|
|
|
import com.ibeetl.jlw.web.query.*;
|
|
|
import lombok.SneakyThrows;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.commons.logging.Log;
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.beetl.sql.core.engine.PageQuery;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static cn.jlw.util.CacheUserUtil.getStudent;
|
|
|
import static com.ibeetl.admin.console.service.OrgConsoleService.setObjectOrgId;
|
|
|
import static com.ibeetl.admin.core.util.ExcelUtil.convertData;
|
|
|
import static com.ibeetl.admin.core.util.ExcelUtil.write;
|
|
|
import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser;
|
|
|
import static com.ibeetl.admin.core.web.JsonReturnCode.DIY_ERROR;
|
|
|
|
|
|
/**
|
|
|
* Teacher 接口
|
|
|
* 切记不要对非线程安全的静态变量进行写操作,增删改后,请使用@LoadInit重新加载
|
|
|
*/
|
|
|
|
|
|
@Controller
|
|
|
public class TeacherController extends BaseController {
|
|
|
|
|
|
private final Log log = LogFactory.getLog(this.getClass());
|
|
|
private static final String MODEL = "/jlw/teacher";
|
|
|
private static final String API = "/api/teacher";
|
|
|
|
|
|
@Autowired private CorePlatformService platformService;
|
|
|
|
|
|
@Autowired private StudentService studentService;
|
|
|
|
|
|
@Autowired private TeacherService teacherService;
|
|
|
|
|
|
@Autowired private UniversitiesCollegesService universitiesCollegesService;
|
|
|
|
|
|
@Autowired private CompetitionTeacherEvaluationService competitionTeacherEvaluationService;
|
|
|
|
|
|
@Autowired private CompetitionService competitionService;
|
|
|
@Autowired private CompetitionStudentsService competitionStudentsService;
|
|
|
@Autowired private CompetitionTaskOneQuestionService competitionTaskOneQuestionService;
|
|
|
@Autowired private CompetitionTaskSecondQuestionService competitionTaskSecondQuestionService;
|
|
|
@Autowired private CompetitionTaskSecondQuestionStepService competitionTaskSecondQuestionStepService;
|
|
|
|
|
|
@Autowired private ExamService examService;
|
|
|
@Autowired private ExamStudentsService examStudentsService;
|
|
|
@Autowired private ExamTaskOneQuestionService examTaskOneQuestionService;
|
|
|
@Autowired private ExamTaskSecondQuestionService examTaskSecondQuestionService;
|
|
|
@Autowired private ExamTaskSecondQuestionStepService examTaskSecondQuestionStepService;
|
|
|
@Autowired private ExamTaskThreeQuestionService examTaskThreeQuestionService;
|
|
|
@Autowired private ExamTaskThreeQuestionStepService examTaskThreeQuestionStepService;
|
|
|
|
|
|
@Autowired private CourseInfoService courseInfoService;
|
|
|
@Autowired private ResourcesQuestionService resourcesQuestionService;
|
|
|
@Autowired private ResourcesCompetitionService resourcesCompetitionService;
|
|
|
@Autowired private ResourcesCompetitionStepService resourcesCompetitionStepService;
|
|
|
@Autowired private ResourcesTrainingService resourcesTrainingService;
|
|
|
@Autowired private ResourcesTrainingStepService resourcesTrainingStepService;
|
|
|
|
|
|
@Autowired private ResourcesApplicationService resourcesApplicationService;
|
|
|
|
|
|
@Autowired private StudentDefenceLogService studentDefenceLogService;
|
|
|
@Autowired private StudentDefenceLogInfoService studentDefenceLogInfoService;
|
|
|
@Autowired private UniversitiesCollegesDao universitiesCollegesDao;
|
|
|
|
|
|
@Autowired
|
|
|
FileService fileService;
|
|
|
|
|
|
/* 前端接口 */
|
|
|
|
|
|
|
|
|
|
|
|
/* 后台页面 */
|
|
|
|
|
|
@GetMapping(MODEL + "/index.do")
|
|
|
@Function("teacher.query")
|
|
|
@ResponseBody
|
|
|
public ModelAndView index(@SCoreUser CoreUser coreUser) {
|
|
|
|
|
|
CompetitionQuery competitionQuery = new CompetitionQuery();
|
|
|
competitionQuery.setCompetitionStatus(1);
|
|
|
//1报名未开始 2报名中 3报名结束或大赛未开始 4大赛开始或任务一未开始 5任务一进行中 6任务一结束或任务二未开始 7任务二进行中 8任务二结束或任务三未开始 9任务三进行中 10任务三结束 11大赛结束
|
|
|
competitionQuery.setCompetitionDetailedStatuses("2,3,4,5,6,7,8,9,10");
|
|
|
competitionQuery.setOrgId(coreUser.getOrgId());
|
|
|
List<Competition> competitionList = competitionService.getValuesByQuery(competitionQuery);
|
|
|
|
|
|
ModelAndView view = new ModelAndView("/jlw/teacher/index.html") ;
|
|
|
view.addObject("search", TeacherQuery.class.getName());
|
|
|
view.addObject("beAdministrator",null != coreUser && "JT_S_01".equals(coreUser.getJobType1())?1:2);//是否是管理员 1是 2否
|
|
|
view.addObject("competitionList",competitionList);
|
|
|
return view;
|
|
|
}
|
|
|
|
|
|
@GetMapping(MODEL + "/edit.do")
|
|
|
@Function("teacher.edit")
|
|
|
@ResponseBody
|
|
|
public ModelAndView edit(Long teacherId) {
|
|
|
ModelAndView view = new ModelAndView("/jlw/teacher/edit.html");
|
|
|
Teacher teacher = teacherService.queryById(teacherId);
|
|
|
view.addObject("teacher", teacher);
|
|
|
return view;
|
|
|
}
|
|
|
|
|
|
@GetMapping(MODEL + "/add.do")
|
|
|
@Function("teacher.add")
|
|
|
@ResponseBody
|
|
|
public ModelAndView add(Long teacherId, @SCoreUser CoreUser coreUser) {
|
|
|
ModelAndView view = new ModelAndView("/jlw/teacher/add.html");
|
|
|
if(teacherId != null){
|
|
|
Teacher teacher = teacherService.queryById(teacherId);
|
|
|
view.addObject("teacher", teacher);
|
|
|
}else {
|
|
|
view.addObject("teacher", new Teacher());
|
|
|
}
|
|
|
// 如果是学校管理员则查询所在院校的信息
|
|
|
if (coreUser.isUniAdmin()) {
|
|
|
UniversitiesColleges universitiesColleges = universitiesCollegesService.getByOrgId(coreUser.getOrgId());
|
|
|
view.addObject("universitiesCollegesInfo", universitiesColleges);
|
|
|
}
|
|
|
return view;
|
|
|
}
|
|
|
|
|
|
//跳转至批量导入页面
|
|
|
@GetMapping(MODEL + "/importPage.do")
|
|
|
@Function("teacher.add")
|
|
|
@ResponseBody
|
|
|
public ModelAndView importPage() {
|
|
|
ModelAndView view = new ModelAndView("/jlw/teacher/importPage.html");
|
|
|
return view;
|
|
|
}
|
|
|
|
|
|
//跳转至登录日志页面
|
|
|
@GetMapping(MODEL + "/studentLogin.do")
|
|
|
@Function("teacher.login")
|
|
|
@ResponseBody
|
|
|
public ModelAndView studentLogin(@SCoreUser CoreUser coreUser) {
|
|
|
ModelAndView view = new ModelAndView("/jlw/teacher/studentLogin.html");
|
|
|
view.addObject("universitiesCollegesName", null);
|
|
|
|
|
|
ResourcesApplication resourcesApplication = new ResourcesApplication();
|
|
|
if(!coreUser.isAdmin()){//非超管
|
|
|
UniversitiesColleges universitiesColleges = new UniversitiesColleges();
|
|
|
universitiesColleges.setOrgId(coreUser.getOrgId());
|
|
|
List<UniversitiesColleges> universitiesCollegesList = universitiesCollegesService.getValues(universitiesColleges);
|
|
|
if(universitiesCollegesList.size() > 0){
|
|
|
universitiesColleges = universitiesCollegesList.get(0);
|
|
|
view.addObject("universitiesCollegesName", universitiesColleges.getUniversitiesCollegesName());
|
|
|
view.addObject("universitiesCollegesId", universitiesColleges.getUniversitiesCollegesId());
|
|
|
}
|
|
|
|
|
|
|
|
|
UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem)platformService.getOther();
|
|
|
if(null != uSystem && ((Integer)1).equals(uSystem.getType())){
|
|
|
resourcesApplication.setResourcesApplicationId(uSystem.getTypeId());
|
|
|
}
|
|
|
}
|
|
|
view.addObject("resourcesApplicationList",resourcesApplicationService.getValues(resourcesApplication));
|
|
|
|
|
|
view.addObject("orgId", coreUser.getOrgId());
|
|
|
view.addObject("beTeacher",null != coreUser && "JT_S_02".equals(coreUser.getJobType1())?1:2);//是否是教师 1是 2否
|
|
|
return view;
|
|
|
}
|
|
|
|
|
|
//跳转至使用日志页面
|
|
|
@GetMapping(MODEL + "/studentUsageLog.do")
|
|
|
@Function("teacher.usageLog")
|
|
|
@ResponseBody
|
|
|
public ModelAndView studentUsageLog(@SCoreUser CoreUser coreUser) {
|
|
|
ModelAndView view = new ModelAndView("/jlw/teacher/studentUsageLog.html");
|
|
|
view.addObject("universitiesCollegesName", null);
|
|
|
|
|
|
ResourcesApplication resourcesApplication = new ResourcesApplication();
|
|
|
if(!coreUser.isAdmin()){//非超管
|
|
|
UniversitiesColleges universitiesColleges = new UniversitiesColleges();
|
|
|
universitiesColleges.setOrgId(coreUser.getOrgId());
|
|
|
List<UniversitiesColleges> universitiesCollegesList = universitiesCollegesService.getValues(universitiesColleges);
|
|
|
if(universitiesCollegesList.size() > 0){
|
|
|
universitiesColleges = universitiesCollegesList.get(0);
|
|
|
view.addObject("universitiesCollegesName", universitiesColleges.getUniversitiesCollegesName());
|
|
|
view.addObject("universitiesCollegesId", universitiesColleges.getUniversitiesCollegesId());
|
|
|
}
|
|
|
|
|
|
|
|
|
UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem)platformService.getOther();
|
|
|
if(null != uSystem && ((Integer)1).equals(uSystem.getType())){
|
|
|
resourcesApplication.setResourcesApplicationId(uSystem.getTypeId());
|
|
|
}
|
|
|
}
|
|
|
view.addObject("resourcesApplicationList",resourcesApplicationService.getValues(resourcesApplication));
|
|
|
view.addObject("beTeacher",null != coreUser && "JT_S_02".equals(coreUser.getJobType1())?1:2);//是否是教师 1是 2否
|
|
|
return view;
|
|
|
}
|
|
|
|
|
|
//跳转至统计报表页面
|
|
|
@GetMapping(MODEL + "/statisticalReport.do")
|
|
|
@Function("teacher.statisticalReport")
|
|
|
@ResponseBody
|
|
|
public ModelAndView statisticalReport(@SCoreUser CoreUser coreUser) {
|
|
|
ModelAndView view = new ModelAndView("/jlw/teacher/statisticalReport.html");
|
|
|
UniversitiesColleges universitiesColleges = new UniversitiesColleges();
|
|
|
universitiesColleges.setOrgId(coreUser.getOrgId());
|
|
|
List<UniversitiesColleges> universitiesCollegesList = universitiesCollegesService.getValues(universitiesColleges);
|
|
|
if(universitiesCollegesList.size() > 0){
|
|
|
universitiesColleges = universitiesCollegesList.get(0);
|
|
|
view.addObject("universitiesCollegesName", universitiesColleges.getUniversitiesCollegesName());
|
|
|
}else {
|
|
|
view.addObject("universitiesCollegesName", null);
|
|
|
}
|
|
|
|
|
|
view.addObject("beTeacher",null != coreUser && "JT_S_02".equals(coreUser.getJobType1())?1:2);//是否是教师 1是 2否
|
|
|
return view;
|
|
|
}
|
|
|
|
|
|
|
|
|
/* 后台接口 */
|
|
|
|
|
|
//教师端首页大赛数据
|
|
|
@GetMapping(MODEL + "/indexInfo.json")
|
|
|
@Function("teacher.query")
|
|
|
@ResponseBody
|
|
|
public JsonResult indexInfo(Long competitionId) {
|
|
|
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
|
|
|
Competition competition = competitionService.getById(competitionId);
|
|
|
Integer competitionType = null != competition && null != competition.getCompetitionType()?competition.getCompetitionType():null;
|
|
|
|
|
|
map.put("competition",competition);
|
|
|
map.put("competitionCount", null);
|
|
|
map.put("competitionStudentsList", null);
|
|
|
map.put("competitionTeamCount", null);
|
|
|
|
|
|
//竞赛人数
|
|
|
if(((Integer)1).equals(competitionType)){
|
|
|
CompetitionStudentsQuery competitionStudentsQuery = new CompetitionStudentsQuery();
|
|
|
competitionStudentsQuery.setCompetitionId(competitionId);
|
|
|
competitionStudentsQuery.setCompetitionStatus(1);
|
|
|
competitionStudentsQuery.setOrderByCompetitionRanking(1);
|
|
|
List<CompetitionStudents> competitionStudentsList = competitionStudentsService.getCompetitionPersonalInfo(competitionStudentsQuery);
|
|
|
map.put("competitionCount", competitionStudentsList.size());
|
|
|
map.put("competitionStudentsList",competitionStudentsList);
|
|
|
}else if(((Integer)2).equals(competitionType)) {
|
|
|
CompetitionStudentsQuery competitionStudentsQuery = new CompetitionStudentsQuery();
|
|
|
competitionStudentsQuery.setCompetitionId(competitionId);
|
|
|
competitionStudentsQuery.setCompetitionStatus(1);
|
|
|
List<CompetitionStudents> competitionStudentsList = competitionStudentsService.getCompetitionTeamPersonalInfo(competitionStudentsQuery);
|
|
|
map.put("competitionCount", competitionStudentsList.size());
|
|
|
}
|
|
|
|
|
|
//竞赛团队
|
|
|
if(((Integer)2).equals(competitionType)){
|
|
|
CompetitionStudentsQuery competitionStudentsQuery = new CompetitionStudentsQuery();
|
|
|
competitionStudentsQuery.setCompetitionId(competitionId);
|
|
|
competitionStudentsQuery.setCompetitionStatus(1);
|
|
|
competitionStudentsQuery.setOrderByCompetitionRanking(1);
|
|
|
List<CompetitionStudents> competitionStudentsList = competitionStudentsService.getCompetitionTeamInfo(competitionStudentsQuery);
|
|
|
map.put("competitionStudentsList",competitionStudentsList);
|
|
|
map.put("competitionTeamCount",competitionStudentsList.size());
|
|
|
}
|
|
|
|
|
|
return JsonResult.successMap(map);
|
|
|
}
|
|
|
|
|
|
|
|
|
//题库中客观题 预览
|
|
|
@GetMapping(MODEL + "/getResourcesQuestionMap.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult getResourcesQuestionMap(Long courseInfoId){
|
|
|
if(null == courseInfoId){
|
|
|
return JsonResult.failMessage("参数丢失");
|
|
|
}
|
|
|
|
|
|
Map<String,Object>map = new HashMap<>();
|
|
|
CourseInfo[] courseInfos = courseInfoService.getSurroundChapterInfo(courseInfoId);
|
|
|
|
|
|
CourseInfo courseInfo = courseInfos[1];
|
|
|
|
|
|
map.put("courseInfo",courseInfo);//当前章节信息
|
|
|
|
|
|
//上一个章节ID
|
|
|
map.put("backCourseInfoId",courseInfos[0].getCourseInfoId());
|
|
|
|
|
|
//下一个章节ID
|
|
|
map.put("nextCourseInfoId",courseInfos[2].getCourseInfoId());
|
|
|
|
|
|
map.put("headImg",null);
|
|
|
map.put("studentName",null);
|
|
|
map.put("studentSn",null);//学生账号
|
|
|
map.put("className",null);//班级名称
|
|
|
|
|
|
List<ResourcesQuestion> resourcesQuestionList = null;
|
|
|
if(ToolUtils.isNotSplitBlank(courseInfo.getResourcesQuestionIds(),",",0)){
|
|
|
ResourcesQuestionQuery resourcesQuestionQuery = new ResourcesQuestionQuery();
|
|
|
resourcesQuestionQuery.setResourcesQuestionIds(courseInfo.getResourcesQuestionIds());
|
|
|
resourcesQuestionList = resourcesQuestionService.getValuesByQuery(resourcesQuestionQuery);
|
|
|
}
|
|
|
Map<Integer, List<ResourcesQuestion>> groupByQuestionType = null;
|
|
|
try{
|
|
|
groupByQuestionType = resourcesQuestionList.stream().collect(Collectors.groupingBy(e -> e.getQuestionType()));
|
|
|
}catch (Exception e){}
|
|
|
|
|
|
map.put("data",groupByQuestionType);
|
|
|
map.put("nowTime",System.currentTimeMillis());
|
|
|
|
|
|
return JsonResult.successMap(map);
|
|
|
}
|
|
|
|
|
|
//题库中竞赛案例 预览
|
|
|
@GetMapping(MODEL + "/getResourcesCompetitionList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult getResourcesCompetitionList(Long courseInfoId,ResourcesCompetitionQuery resourcesCompetitionQuery){
|
|
|
if(null == courseInfoId){
|
|
|
return JsonResult.failMessage("参数丢失");
|
|
|
}
|
|
|
|
|
|
Map<String,Object>map = new HashMap<>();
|
|
|
CourseInfo[] courseInfos = courseInfoService.getSurroundChapterInfo(courseInfoId);
|
|
|
|
|
|
CourseInfo courseInfo = courseInfos[1];
|
|
|
|
|
|
map.put("courseInfo",courseInfo);//当前章节信息
|
|
|
|
|
|
//上一个章节ID
|
|
|
map.put("backCourseInfoId",courseInfos[0].getCourseInfoId());
|
|
|
|
|
|
//下一个章节ID
|
|
|
map.put("nextCourseInfoId",courseInfos[2].getCourseInfoId());
|
|
|
|
|
|
//目录
|
|
|
map.put("chapterList",courseInfoService.getChapterList(courseInfoId));
|
|
|
|
|
|
map.put("headImg",null);
|
|
|
map.put("studentName",null);
|
|
|
|
|
|
if(null == courseInfo.getResourcesCompetitionIds()){
|
|
|
courseInfo.setResourcesCompetitionIds("");
|
|
|
}
|
|
|
|
|
|
ResourcesCompetitionQuery r = new ResourcesCompetitionQuery();
|
|
|
r.setLimit(1L);
|
|
|
r.setPage(resourcesCompetitionQuery.getPage());
|
|
|
if(ToolUtils.findInSet(courseInfo.getResourcesCompetitionIds(),resourcesCompetitionQuery.getResourcesCompetitionId()) || null == resourcesCompetitionQuery.getResourcesCompetitionId()){
|
|
|
r.setResourcesCompetitionIds(resourcesCompetitionQuery.getResourcesCompetitionId()+","+courseInfo.getResourcesCompetitionIds().replace(resourcesCompetitionQuery.getResourcesCompetitionId().toString(),""));
|
|
|
}else {
|
|
|
r.setResourcesCompetitionId(resourcesCompetitionQuery.getResourcesCompetitionId());
|
|
|
}
|
|
|
PageQuery page = r.getPageQuery();
|
|
|
resourcesCompetitionService.queryByCondition(page);
|
|
|
List<ResourcesCompetition> resourcesCompetitionList = page.getList();
|
|
|
for(int i=0;null != resourcesCompetitionList && i<resourcesCompetitionList.size();i++){
|
|
|
ResourcesCompetitionStepQuery resourcesCompetitionStepQuery = new ResourcesCompetitionStepQuery();
|
|
|
resourcesCompetitionStepQuery.setResourcesCompetitionId(resourcesCompetitionList.get(i).getResourcesCompetitionId());
|
|
|
resourcesCompetitionList.get(i).set("resourcesCompetitionStepList",(resourcesCompetitionStepService.getValues(resourcesCompetitionStepQuery)));
|
|
|
}
|
|
|
|
|
|
map.put("count",page.getTotalRow());
|
|
|
map.put("data",resourcesCompetitionList);
|
|
|
map.put("nowTime",System.currentTimeMillis());
|
|
|
|
|
|
return JsonResult.successMap(map);
|
|
|
}
|
|
|
|
|
|
//题库中实训案例 预览
|
|
|
@GetMapping(MODEL + "/getResourcesTrainingList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult getResourcesTrainingList(Long courseInfoId,ResourcesTrainingQuery resourcesTrainingQuery){
|
|
|
if(null == courseInfoId){
|
|
|
return JsonResult.failMessage("参数丢失");
|
|
|
}
|
|
|
|
|
|
Map<String,Object>map = new HashMap<>();
|
|
|
CourseInfo[] courseInfos = courseInfoService.getSurroundChapterInfo(courseInfoId);
|
|
|
|
|
|
CourseInfo courseInfo = courseInfos[1];
|
|
|
|
|
|
map.put("courseInfo",courseInfo);//当前章节信息
|
|
|
|
|
|
//上一个章节ID
|
|
|
map.put("backCourseInfoId",courseInfos[0].getCourseInfoId());
|
|
|
|
|
|
//下一个章节ID
|
|
|
map.put("nextCourseInfoId",courseInfos[2].getCourseInfoId());
|
|
|
|
|
|
//目录
|
|
|
map.put("chapterList",courseInfoService.getChapterList(courseInfoId));
|
|
|
|
|
|
map.put("headImg",null);
|
|
|
map.put("studentName",null);
|
|
|
|
|
|
if(null == courseInfo.getResourcesTrainingIds()){
|
|
|
courseInfo.setResourcesTrainingIds("");
|
|
|
}
|
|
|
|
|
|
ResourcesTrainingQuery r = new ResourcesTrainingQuery();
|
|
|
r.setLimit(1L);
|
|
|
r.setPage(resourcesTrainingQuery.getPage());
|
|
|
if(ToolUtils.findInSet(courseInfo.getResourcesTrainingIds(),resourcesTrainingQuery.getResourcesTrainingId()) || null == resourcesTrainingQuery.getResourcesTrainingId()){
|
|
|
|
|
|
r.setResourcesTrainingIds(resourcesTrainingQuery.getResourcesTrainingId()+","+courseInfo.getResourcesTrainingIds().replace(resourcesTrainingQuery.getResourcesTrainingId().toString(),""));
|
|
|
}else {
|
|
|
r.setResourcesTrainingId(resourcesTrainingQuery.getResourcesTrainingId());
|
|
|
}
|
|
|
PageQuery page = r.getPageQuery();
|
|
|
resourcesTrainingService.queryByCondition(page);
|
|
|
List<ResourcesTraining> resourcesTrainingList = page.getList();
|
|
|
for(int i=0;null != resourcesTrainingList && i<resourcesTrainingList.size();i++){
|
|
|
ResourcesTrainingStepQuery resourcesTrainingStepQuery = new ResourcesTrainingStepQuery();
|
|
|
resourcesTrainingStepQuery.setResourcesTrainingId(resourcesTrainingList.get(i).getResourcesTrainingId());
|
|
|
resourcesTrainingList.get(i).set("resourcesTrainingStepList",(resourcesTrainingStepService.getValues(resourcesTrainingStepQuery)));
|
|
|
}
|
|
|
|
|
|
map.put("count",page.getTotalRow());
|
|
|
map.put("data",resourcesTrainingList);
|
|
|
map.put("nowTime",System.currentTimeMillis());
|
|
|
|
|
|
return JsonResult.successMap(map);
|
|
|
}
|
|
|
|
|
|
//全部大赛列表
|
|
|
@PostMapping(MODEL + "/allCompetitionList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult<PageQuery> allCompetitionList(CompetitionQuery condition,@SCoreUser CoreUser coreUser) {
|
|
|
condition.setOrgId(coreUser.getOrgId());
|
|
|
|
|
|
UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem)platformService.getOther();
|
|
|
if(null != uSystem && ((Integer)1).equals(uSystem.getType())){
|
|
|
condition.setResourcesApplicationId(uSystem.getTypeId());
|
|
|
}
|
|
|
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
competitionService.queryByCondition(page);
|
|
|
return JsonResult.success(page);
|
|
|
}
|
|
|
|
|
|
//大赛详情 (除了大赛任务、排行榜、参赛学员(或团队)、大赛答辩)
|
|
|
@GetMapping(MODEL + "/getCompetitionInfo.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult getCompetitionInfo(Long competitionId,Integer part) {
|
|
|
//part 代表部分值 1大赛概况 2大赛任务 3排行榜 4大赛答辩 5参赛学员(参赛团队) 6获奖名单 7大赛动态 8常见问题
|
|
|
Competition competition = competitionService.queryInfo2Teacher(competitionId,part);
|
|
|
|
|
|
return JsonResult.success(competition);
|
|
|
}
|
|
|
|
|
|
//大赛任务 人员列表
|
|
|
@PostMapping(MODEL + "/competitionStudentsTaskList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult<PageQuery> competitionStudentsTaskList(CompetitionStudentsQuery condition) {
|
|
|
Competition competition = competitionService.getById(condition.getCompetitionId());
|
|
|
if(null != competition){
|
|
|
if(((Integer)1).equals(competition.getCompetitionType())){
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
competitionStudentsService.queryPersonalByCondition(page);
|
|
|
return JsonResult.success(page);
|
|
|
}else if(((Integer)2).equals(competition.getCompetitionType())){
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
competitionStudentsService.queryTeamPersonalByCondition(page);
|
|
|
return JsonResult.success(page);
|
|
|
}
|
|
|
}
|
|
|
return JsonResult.failMessage("参数有误");
|
|
|
}
|
|
|
|
|
|
//大赛答辩 人员列表
|
|
|
@PostMapping(MODEL + "/competitionStudentsDefenseList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult<PageQuery> competitionStudentsDefenseList(CompetitionStudentsQuery condition) {
|
|
|
Competition competition = competitionService.getById(condition.getCompetitionId());
|
|
|
if(null != competition){
|
|
|
if(((Integer)1).equals(competition.getCompetitionType())){
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
competitionStudentsService.queryPersonalByCondition(page);
|
|
|
return JsonResult.success(page);
|
|
|
}else if(((Integer)2).equals(competition.getCompetitionType())){
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
competitionStudentsService.queryTeamDefenceByCondition(page);
|
|
|
return JsonResult.success(page);
|
|
|
}
|
|
|
}
|
|
|
return JsonResult.failMessage("参数有误");
|
|
|
}
|
|
|
|
|
|
//排行榜
|
|
|
@PostMapping(MODEL + "/competitionRankingList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult<PageQuery> competitionRankingList(CompetitionStudentsQuery condition) {
|
|
|
Competition competition = competitionService.getById(condition.getCompetitionId());
|
|
|
if(null != competition){
|
|
|
if(((Integer)1).equals(competition.getCompetitionType())){
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
competitionStudentsService.queryPersonalByCondition(page);
|
|
|
return JsonResult.success(page);
|
|
|
}else if(((Integer)2).equals(competition.getCompetitionType())){
|
|
|
//团队赛排行榜类型(1团队赛排行 2团队赛个人排行 3团队赛答辩排行)
|
|
|
if(((Integer)1).equals(condition.getCompetitionRankingType())){
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
competitionStudentsService.queryTeamByCondition(page);
|
|
|
return JsonResult.success(page);
|
|
|
}else if(((Integer)2).equals(condition.getCompetitionRankingType())){
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
competitionStudentsService.queryTeamPersonalByCondition(page);
|
|
|
return JsonResult.success(page);
|
|
|
}else if(((Integer)3).equals(condition.getCompetitionRankingType())){
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
competitionStudentsService.queryTeamDefenceByCondition(page);
|
|
|
return JsonResult.success(page);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return JsonResult.failMessage("参数有误");
|
|
|
}
|
|
|
|
|
|
//参赛学员(或团队)
|
|
|
@PostMapping(MODEL + "/competitionStudentsList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult<PageQuery> competitionStudentsList(CompetitionStudentsQuery condition) {
|
|
|
Competition competition = competitionService.getById(condition.getCompetitionId());
|
|
|
if(null != competition){
|
|
|
if(((Integer)1).equals(competition.getCompetitionType())){
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
competitionStudentsService.queryPersonalByCondition(page);
|
|
|
return JsonResult.success(page);
|
|
|
}else if(((Integer)2).equals(competition.getCompetitionType())){
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
competitionStudentsService.queryTeamByCondition(page);
|
|
|
return JsonResult.success(page);
|
|
|
}
|
|
|
}
|
|
|
return JsonResult.failMessage("参数有误");
|
|
|
}
|
|
|
|
|
|
//大赛任务一 阅卷
|
|
|
@GetMapping(MODEL + "/getCT1QuestionMap.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult getCT1QuestionMap(CompetitionTaskOneQuestionQuery competitionTaskOneQuestionQuery,Long studentsId){
|
|
|
if(null == competitionTaskOneQuestionQuery.getCompetitionId()){
|
|
|
return JsonResult.failMessage("参数丢失");
|
|
|
}
|
|
|
if(null == studentsId){
|
|
|
return JsonResult.failMessage("请选择相应的学生");
|
|
|
}
|
|
|
|
|
|
Student student = studentService.queryById(studentsId);
|
|
|
Competition competition = competitionService.getById(competitionTaskOneQuestionQuery.getCompetitionId());
|
|
|
|
|
|
Map<String,Object>map = new HashMap<>();
|
|
|
|
|
|
map.put("competitionName",competition.getCompetitionName());//大赛名称
|
|
|
map.put("cT1StartTime",competition.getCompetitionTaskOneStartTime());//开始时间
|
|
|
map.put("cT1EndTime",competition.getCompetitionTaskOneEndTime());//结束时间
|
|
|
map.put("competitionType",competition.getCompetitionType());//大赛类型:1:个人 2:团队
|
|
|
map.put("headImg",student.getHeadImg());//头像
|
|
|
map.put("studentName",student.getStudentName());//学生姓名
|
|
|
map.put("studentSn",student.getStudentSn());//学生账号
|
|
|
|
|
|
CompetitionStudentsQuery competitionStudentsQuery = new CompetitionStudentsQuery();
|
|
|
competitionStudentsQuery.setCompetitionId(competitionTaskOneQuestionQuery.getCompetitionId());
|
|
|
competitionStudentsQuery.setStudentsId(student.getStudentId());
|
|
|
List<CompetitionStudents> competitionStudentsList = competitionStudentsService.getCompetitionTeamInfo(competitionStudentsQuery);
|
|
|
|
|
|
map.put("teamName",null != competitionStudentsList && competitionStudentsList.size()>0?competitionStudentsList.get(0).getTeamName():null);//队伍名称
|
|
|
|
|
|
competitionTaskOneQuestionQuery.setStudentsId(student.getStudentId());
|
|
|
List<CompetitionTaskOneQuestion> cT1QuestionList = competitionTaskOneQuestionService.getValuesByQuery(competitionTaskOneQuestionQuery);
|
|
|
|
|
|
Map<Integer, List<CompetitionTaskOneQuestion>> groupByQuestionType = null;
|
|
|
try{
|
|
|
groupByQuestionType = cT1QuestionList.stream().collect(Collectors.groupingBy(e -> e.getQuestionType()));
|
|
|
}catch (Exception e){}
|
|
|
|
|
|
map.put("data",groupByQuestionType);//所有数据
|
|
|
map.put("nowTime",System.currentTimeMillis());
|
|
|
|
|
|
return JsonResult.successMap(map);
|
|
|
}
|
|
|
|
|
|
//大赛任务二 阅卷
|
|
|
@GetMapping(MODEL + "/getCT2QuestionList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult getCT2QuestionList(CompetitionTaskSecondQuestionQuery competitionTaskSecondQuestionQuery,Long studentsId){
|
|
|
if(null == competitionTaskSecondQuestionQuery.getCompetitionId()){
|
|
|
return JsonResult.failMessage("参数丢失");
|
|
|
}
|
|
|
if(null == studentsId){
|
|
|
return JsonResult.failMessage("请选择相应的学生");
|
|
|
}
|
|
|
|
|
|
Student student = studentService.queryById(studentsId);
|
|
|
Competition competition = competitionService.getById(competitionTaskSecondQuestionQuery.getCompetitionId());
|
|
|
|
|
|
Map<String,Object>map = new HashMap<>();
|
|
|
|
|
|
map.put("competitionName",competition.getCompetitionName());
|
|
|
map.put("cT2StartTime",competition.getCompetitionTaskSecondStartTime());
|
|
|
map.put("cT2EndTime",competition.getCompetitionTaskSecondEndTime());
|
|
|
map.put("competitionType",competition.getCompetitionType());
|
|
|
map.put("headImg",student.getHeadImg());
|
|
|
map.put("studentName",student.getStudentName());
|
|
|
|
|
|
CompetitionStudentsQuery competitionStudentsQuery = new CompetitionStudentsQuery();
|
|
|
competitionStudentsQuery.setCompetitionId(competitionTaskSecondQuestionQuery.getCompetitionId());
|
|
|
competitionStudentsQuery.setStudentsId(student.getStudentId());
|
|
|
List<CompetitionStudents> competitionStudentsList = competitionStudentsService.getCompetitionTeamInfo(competitionStudentsQuery);
|
|
|
|
|
|
map.put("teamName",null != competitionStudentsList && competitionStudentsList.size()>0?competitionStudentsList.get(0).getTeamName():null);
|
|
|
|
|
|
competitionTaskSecondQuestionQuery.setStudentsId(student.getStudentId());
|
|
|
PageQuery page = competitionTaskSecondQuestionQuery.getPageQuery();
|
|
|
competitionTaskSecondQuestionService.queryByConditionWithOutAnswer(page);
|
|
|
List<CompetitionTaskSecondQuestion> cT2QuestionList = page.getList();
|
|
|
for(int i=0;i<cT2QuestionList.size();i++){
|
|
|
CompetitionTaskSecondQuestionStepQuery competitionTaskSecondQuestionStepQuery = new CompetitionTaskSecondQuestionStepQuery();
|
|
|
competitionTaskSecondQuestionStepQuery.setCompetitionTaskSecondQuestionId(cT2QuestionList.get(i).getCompetitionTaskSecondQuestionId());
|
|
|
cT2QuestionList.get(i).set("cT2QStepList",competitionTaskSecondQuestionStepService.getValuesByQuery(competitionTaskSecondQuestionStepQuery));
|
|
|
}
|
|
|
|
|
|
map.put("count",page.getTotalRow());
|
|
|
map.put("data",cT2QuestionList);
|
|
|
map.put("nowTime",System.currentTimeMillis());
|
|
|
|
|
|
return JsonResult.successMap(map);
|
|
|
}
|
|
|
|
|
|
|
|
|
//大赛任务二 评分
|
|
|
@PostMapping(MODEL + "/setCT2QuestionScore.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult setCT2QuestionScore(CompetitionTaskSecondQuestionStepQuery competitionTaskSecondQuestionStepQuery){
|
|
|
if(null == competitionTaskSecondQuestionStepQuery.getCompetitionTaskSecondQuestionStepId()){
|
|
|
return JsonResult.failMessage("参数丢失");
|
|
|
}
|
|
|
if(null == competitionTaskSecondQuestionStepQuery.getCompetitionTaskSecondQuestionStepGetScore()){
|
|
|
return JsonResult.failMessage("请填写分数");
|
|
|
}
|
|
|
|
|
|
teacherService.setCT2QuestionScore(competitionTaskSecondQuestionStepQuery);
|
|
|
|
|
|
return JsonResult.success();
|
|
|
}
|
|
|
|
|
|
|
|
|
//大赛任务三 阅卷
|
|
|
@GetMapping(MODEL + "/getCT3Question.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult getCT3Question(CompetitionTeacherEvaluationQuery competitionTeacherEvaluationQuery,@SCoreUser CoreUser coreUser){
|
|
|
if(null == competitionTeacherEvaluationQuery.getCompetitionId()){
|
|
|
return JsonResult.failMessage("参数丢失");
|
|
|
}
|
|
|
if(null == competitionTeacherEvaluationQuery.getCompetitionStudentsId()){
|
|
|
return JsonResult.failMessage("请选择需要查看的学员");
|
|
|
}
|
|
|
if(null == coreUser){
|
|
|
return JsonResult.failMessage("请登录后再操作");
|
|
|
}
|
|
|
|
|
|
CompetitionQuery competitionQuery = new CompetitionQuery();
|
|
|
competitionQuery.setCompetitionId(competitionTeacherEvaluationQuery.getCompetitionId());
|
|
|
competitionQuery.setShowCompetitionDefenceScoreStandard(1);
|
|
|
List<Competition> competitionList = competitionService.getValuesByQuery(competitionQuery);
|
|
|
if(null != competitionList && competitionList.size()>0){
|
|
|
Competition competition = competitionList.get(0);
|
|
|
if(null != competition){
|
|
|
Teacher teacher = teacherService.getByUserId(coreUser.getId());
|
|
|
|
|
|
//判断是否为评委 1是 2否
|
|
|
competition.set("beCompetitionJudge",ToolUtils.findInSet(competition.getCompetitionJudgeIds(),teacher.getTeacherId())?1:2);
|
|
|
|
|
|
CompetitionTeacherEvaluation competitionTeacherEvaluation = new CompetitionTeacherEvaluation();
|
|
|
if(null != teacher){
|
|
|
competitionTeacherEvaluation.setCompetitionStudentsId(competitionTeacherEvaluationQuery.getCompetitionStudentsId());
|
|
|
competitionTeacherEvaluation.setTeacherId(teacher.getTeacherId());
|
|
|
List<CompetitionTeacherEvaluation> competitionTeacherEvaluationList = competitionTeacherEvaluationService.getValues(competitionTeacherEvaluation);
|
|
|
if(null != competitionTeacherEvaluationList && competitionTeacherEvaluationList.size()>0){
|
|
|
competitionTeacherEvaluation = competitionTeacherEvaluationList.get(0);
|
|
|
}
|
|
|
//处理空的分数
|
|
|
String competitionTaskThreeFractions ="";
|
|
|
if(null != competitionTeacherEvaluation.get("competitionTaskThreeFractions") && StringUtils.isNotBlank(competitionTeacherEvaluation.get("competitionTaskThreeFractions").toString())){
|
|
|
String[] cT3Fraction = competitionTeacherEvaluation.get("competitionTaskThreeFractions").toString().split(",");
|
|
|
//平均分
|
|
|
BigDecimal avg = BigDecimal.ZERO;
|
|
|
|
|
|
for(int i=0;i<cT3Fraction.length;i++){
|
|
|
competitionTaskThreeFractions += cT3Fraction[i] + ",";
|
|
|
avg = avg.add(new BigDecimal(StringUtils.isNotBlank(cT3Fraction[i])?cT3Fraction[i]:"0"));
|
|
|
}
|
|
|
avg = avg.divide(new BigDecimal(cT3Fraction.length),2, RoundingMode.DOWN);
|
|
|
|
|
|
competitionTaskThreeFractions += avg.setScale(1, RoundingMode.HALF_UP).toString();
|
|
|
}else{
|
|
|
String[] competitionJudgeId = competition.getCompetitionJudgeIds().split(",");
|
|
|
String[] competitionTaskThreeFraction = new String[competitionJudgeId.length+1];
|
|
|
|
|
|
for(int i=0;i<competitionTaskThreeFraction.length;i++){
|
|
|
competitionTaskThreeFraction[i] = " ";
|
|
|
}
|
|
|
|
|
|
for(int i=0;i<competitionTaskThreeFraction.length;i++){//多一条是平均分的
|
|
|
competitionTaskThreeFractions += competitionTaskThreeFraction[i] + (i == competitionTaskThreeFraction.length - 1?"":",");
|
|
|
}
|
|
|
}
|
|
|
competitionTeacherEvaluation.set("competitionTaskThreeFractions",competitionTaskThreeFractions);
|
|
|
}
|
|
|
|
|
|
Map<String,Object>map = new HashMap<>();
|
|
|
map.put("competition",competition);
|
|
|
map.put("data",competitionTeacherEvaluation);
|
|
|
|
|
|
return JsonResult.successMap(map);
|
|
|
}
|
|
|
}
|
|
|
return JsonResult.failMessage("参数有误");
|
|
|
}
|
|
|
|
|
|
//大赛任务三 评分
|
|
|
@PostMapping(MODEL + "/setCT3QuestionScore.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult setCT3QuestionScore(CompetitionTeacherEvaluationQuery competitionTeacherEvaluationQuery,@SCoreUser CoreUser coreUser){
|
|
|
if(null == competitionTeacherEvaluationQuery.getCompetitionId()){
|
|
|
return JsonResult.failMessage("参数丢失");
|
|
|
}
|
|
|
if(null == competitionTeacherEvaluationQuery.getCompetitionStudentsId()){
|
|
|
return JsonResult.failMessage("参数丢失");
|
|
|
}
|
|
|
if(null == competitionTeacherEvaluationQuery.getCompetitionTaskThreeResultsInfo()){
|
|
|
return JsonResult.failMessage("请填写评分详情");
|
|
|
}
|
|
|
if(null == coreUser){
|
|
|
return JsonResult.failMessage("请登录后再操作");
|
|
|
}
|
|
|
|
|
|
|
|
|
boolean flag = teacherService.setCT3QuestionScore(competitionTeacherEvaluationQuery,coreUser);
|
|
|
if(flag){
|
|
|
return JsonResult.success();
|
|
|
}else {
|
|
|
return JsonResult.failMessage("评分失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//全部考试列表
|
|
|
@PostMapping(MODEL + "/allExamList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult<PageQuery> allExamList(ExamQuery condition,@SCoreUser CoreUser coreUser) {
|
|
|
condition.setOrgId(coreUser.getOrgId());
|
|
|
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
examService.queryByCondition(page);
|
|
|
return JsonResult.success(page);
|
|
|
}
|
|
|
|
|
|
//成绩排名
|
|
|
@PostMapping(MODEL + "/examRankingList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult<PageQuery> examRankingList(ExamStudentsQuery condition) {
|
|
|
Exam exam = examService.queryById(condition.getExamId());
|
|
|
if(null != exam){
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
examStudentsService.queryExamByCondition(page);
|
|
|
return JsonResult.success(page);
|
|
|
}
|
|
|
return JsonResult.failMessage("参数有误");
|
|
|
}
|
|
|
|
|
|
//成绩详情列表
|
|
|
@PostMapping(MODEL + "/examGradeList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult<PageQuery> examGradeList(ExamStudentsQuery condition) {
|
|
|
Exam exam = examService.queryById(condition.getExamId());
|
|
|
if(null != exam){
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
examStudentsService.queryExamByCondition(page);
|
|
|
return JsonResult.success(page);
|
|
|
}
|
|
|
return JsonResult.failMessage("参数有误");
|
|
|
}
|
|
|
|
|
|
|
|
|
//参赛学员
|
|
|
@PostMapping(MODEL + "/examStudentsList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult<PageQuery> examStudentsList(ExamStudentsQuery condition) {
|
|
|
Exam exam = examService.queryById(condition.getExamId());
|
|
|
if(null != exam){
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
examStudentsService.queryExamByCondition(page);
|
|
|
return JsonResult.success(page);
|
|
|
}
|
|
|
return JsonResult.failMessage("参数有误");
|
|
|
}
|
|
|
|
|
|
//考试任务一 阅卷
|
|
|
@GetMapping(MODEL + "/getET1QuestionMap.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult getET1QuestionMap(ExamTaskOneQuestionQuery examTaskOneQuestionQuery,Long studentsId){
|
|
|
if(null == examTaskOneQuestionQuery.getExamId()){
|
|
|
return JsonResult.failMessage("参数丢失");
|
|
|
}
|
|
|
if(null == studentsId){
|
|
|
return JsonResult.failMessage("请选择相应的学生");
|
|
|
}
|
|
|
|
|
|
Student student = studentService.queryById(studentsId);
|
|
|
Exam exam = examService.queryById(examTaskOneQuestionQuery.getExamId());
|
|
|
|
|
|
Map<String,Object>map = new HashMap<>();
|
|
|
|
|
|
map.put("examName",exam.getExamName());//大赛名称
|
|
|
map.put("eT1StartTime",exam.getExamTaskOneStartTime());//开始时间
|
|
|
map.put("eT1EndTime",exam.getExamTaskOneEndTime());//结束时间
|
|
|
map.put("headImg",student.getHeadImg());//头像
|
|
|
map.put("studentName",student.getStudentName());//学生姓名
|
|
|
map.put("studentSn",student.getStudentSn());//学生账号
|
|
|
|
|
|
examTaskOneQuestionQuery.setStudentsId(student.getStudentId());
|
|
|
List<ExamTaskOneQuestion> cT1QuestionList = examTaskOneQuestionService.getValuesByQuery(examTaskOneQuestionQuery);
|
|
|
|
|
|
Map<Integer, List<ExamTaskOneQuestion>> groupByQuestionType = null;
|
|
|
try{
|
|
|
groupByQuestionType = cT1QuestionList.stream().collect(Collectors.groupingBy(e -> e.getQuestionType()));
|
|
|
}catch (Exception e){}
|
|
|
|
|
|
map.put("data",groupByQuestionType);//所有数据
|
|
|
map.put("nowTime",System.currentTimeMillis());
|
|
|
|
|
|
return JsonResult.successMap(map);
|
|
|
}
|
|
|
|
|
|
//考试任务二 阅卷
|
|
|
@GetMapping(MODEL + "/getET2QuestionList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult getET2QuestionList(ExamTaskSecondQuestionQuery examTaskSecondQuestionQuery,Long studentsId){
|
|
|
if(null == examTaskSecondQuestionQuery.getExamId()){
|
|
|
return JsonResult.failMessage("参数丢失");
|
|
|
}
|
|
|
if(null == studentsId){
|
|
|
return JsonResult.failMessage("请选择相应的学生");
|
|
|
}
|
|
|
|
|
|
Student student = studentService.queryById(studentsId);
|
|
|
Exam exam = examService.queryById(examTaskSecondQuestionQuery.getExamId());
|
|
|
|
|
|
Map<String,Object>map = new HashMap<>();
|
|
|
|
|
|
map.put("examName",exam.getExamName());
|
|
|
map.put("eT2StartTime",exam.getExamTaskSecondStartTime());
|
|
|
map.put("eT2EndTime",exam.getExamTaskSecondEndTime());
|
|
|
map.put("headImg",student.getHeadImg());
|
|
|
map.put("studentName",student.getStudentName());
|
|
|
|
|
|
examTaskSecondQuestionQuery.setStudentsId(student.getStudentId());
|
|
|
PageQuery page = examTaskSecondQuestionQuery.getPageQuery();
|
|
|
examTaskSecondQuestionService.queryByConditionWithOutAnswer(page);
|
|
|
List<ExamTaskSecondQuestion> eT2QuestionList = page.getList();
|
|
|
for(int i=0;i<eT2QuestionList.size();i++){
|
|
|
ExamTaskSecondQuestionStepQuery examTaskSecondQuestionStepQuery = new ExamTaskSecondQuestionStepQuery();
|
|
|
examTaskSecondQuestionStepQuery.setExamTaskSecondQuestionId(eT2QuestionList.get(i).getExamTaskSecondQuestionId());
|
|
|
eT2QuestionList.get(i).set("eT2QStepList",examTaskSecondQuestionStepService.getValuesByQuery(examTaskSecondQuestionStepQuery));
|
|
|
}
|
|
|
|
|
|
map.put("count",page.getTotalRow());
|
|
|
map.put("data",eT2QuestionList);
|
|
|
map.put("nowTime",System.currentTimeMillis());
|
|
|
|
|
|
return JsonResult.successMap(map);
|
|
|
}
|
|
|
|
|
|
|
|
|
//考试任务二 评分
|
|
|
@PostMapping(MODEL + "/setET2QuestionScore.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult setET2QuestionScore(ExamTaskSecondQuestionStepQuery examTaskSecondQuestionStepQuery){
|
|
|
if(null == examTaskSecondQuestionStepQuery.getExamTaskSecondQuestionStepId()){
|
|
|
return JsonResult.failMessage("参数丢失");
|
|
|
}
|
|
|
if(null == examTaskSecondQuestionStepQuery.getExamTaskSecondQuestionStepGetScore()){
|
|
|
return JsonResult.failMessage("请填写分数");
|
|
|
}
|
|
|
|
|
|
teacherService.setET2QuestionScore(examTaskSecondQuestionStepQuery);
|
|
|
|
|
|
return JsonResult.success();
|
|
|
}
|
|
|
|
|
|
|
|
|
//考试任务三 阅卷
|
|
|
@GetMapping(MODEL + "/getET3QuestionList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult getET3QuestionList(ExamTaskThreeQuestionQuery examTaskThreeQuestionQuery,Long studentsId){
|
|
|
if(null == examTaskThreeQuestionQuery.getExamId()){
|
|
|
return JsonResult.failMessage("参数丢失");
|
|
|
}
|
|
|
if(null == examTaskThreeQuestionQuery.getExamStudentsId()){
|
|
|
return JsonResult.failMessage("参数丢失");
|
|
|
}
|
|
|
if(null == studentsId){
|
|
|
return JsonResult.failMessage("请选择相应的学生");
|
|
|
}
|
|
|
|
|
|
Student student = studentService.queryById(studentsId);
|
|
|
Exam exam = examService.queryById(examTaskThreeQuestionQuery.getExamId());
|
|
|
ExamStudents examStudents = examStudentsService.queryById(examTaskThreeQuestionQuery.getExamStudentsId());
|
|
|
|
|
|
Map<String,Object>map = new HashMap<>();
|
|
|
|
|
|
map.put("examName",exam.getExamName());
|
|
|
map.put("eT3StartTime",exam.getExamTaskThreeStartTime());
|
|
|
map.put("eT3EndTime",exam.getExamTaskThreeEndTime());
|
|
|
map.put("headImg",student.getHeadImg());
|
|
|
map.put("studentName",student.getStudentName());
|
|
|
|
|
|
map.put("examStudents",examStudents);
|
|
|
|
|
|
examTaskThreeQuestionQuery.setStudentsId(student.getStudentId());
|
|
|
PageQuery page = examTaskThreeQuestionQuery.getPageQuery();
|
|
|
examTaskThreeQuestionService.queryByConditionWithOutAnswer(page);
|
|
|
List<ExamTaskThreeQuestion> eT3QuestionList = page.getList();
|
|
|
for(int i=0;i<eT3QuestionList.size();i++){
|
|
|
ExamTaskThreeQuestionStepQuery examTaskThreeQuestionStepQuery = new ExamTaskThreeQuestionStepQuery();
|
|
|
examTaskThreeQuestionStepQuery.setExamTaskThreeQuestionId(eT3QuestionList.get(i).getExamTaskThreeQuestionId());
|
|
|
eT3QuestionList.get(i).set("eT3QStepList",examTaskThreeQuestionStepService.getValuesByQuery(examTaskThreeQuestionStepQuery));
|
|
|
}
|
|
|
|
|
|
map.put("count",page.getTotalRow());
|
|
|
map.put("data",eT3QuestionList);
|
|
|
map.put("nowTime",System.currentTimeMillis());
|
|
|
|
|
|
return JsonResult.successMap(map);
|
|
|
}
|
|
|
|
|
|
//考试任务三 评分
|
|
|
@PostMapping(MODEL + "/setET3QuestionScore.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult setET3QuestionScore(ExamStudentsQuery examStudentsQuery,@SCoreUser CoreUser coreUser){
|
|
|
if(null == examStudentsQuery.getExamId()){
|
|
|
return JsonResult.failMessage("参数丢失");
|
|
|
}
|
|
|
if(null == examStudentsQuery.getExamStudentsId()){
|
|
|
return JsonResult.failMessage("参数丢失");
|
|
|
}
|
|
|
if(null == examStudentsQuery.getExamTaskThreeFraction()){
|
|
|
return JsonResult.failMessage("请填写评分");
|
|
|
}
|
|
|
if(null == coreUser){
|
|
|
return JsonResult.failMessage("请登录后再操作");
|
|
|
}
|
|
|
|
|
|
boolean flag = teacherService.setET3QuestionScore(examStudentsQuery);
|
|
|
if(flag){
|
|
|
return JsonResult.success();
|
|
|
}else {
|
|
|
return JsonResult.failMessage("评分失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping(MODEL + "/list.json")
|
|
|
@Function("teacher.query")
|
|
|
@ResponseBody
|
|
|
public JsonResult<PageQuery> list(TeacherQuery condition,@SCoreUser CoreUser coreUser){
|
|
|
if(null == condition.getTeacherStatus() && StringUtils.isBlank(condition.getTeacherStatuses())){
|
|
|
condition.setTeacherStatus(1);
|
|
|
}
|
|
|
|
|
|
if (!coreUser.isAdmin()) {
|
|
|
condition.setOrgId(coreUser.getOrgId());
|
|
|
}
|
|
|
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
teacherService.queryByCondition(page);
|
|
|
|
|
|
Map<String,Object>map = new HashMap<>();
|
|
|
map.put("count",page.getTotalRow());
|
|
|
map.put("data",page.getList());
|
|
|
map.put("beAdministrator",null != coreUser && "JT_S_01".equals(coreUser.getJobType1())?1:2);//是否是管理员 1是 2否
|
|
|
map.put("tempTeacherIds",teacherService.getIdsByQuery(condition));
|
|
|
|
|
|
return JsonResult.successMap(map);
|
|
|
}
|
|
|
|
|
|
@PostMapping(MODEL + "/add.json")
|
|
|
@Function("teacher.add")
|
|
|
@ResponseBody
|
|
|
public JsonResult add(@Validated(ValidateConfig.ADD.class)Teacher teacher, BindingResult result,@SCoreUser CoreUser coreUser){
|
|
|
if(result.hasErrors()){
|
|
|
return JsonResult.failMessage(result);
|
|
|
}else{
|
|
|
if(null == teacher.getUniversitiesCollegesId()){
|
|
|
UniversitiesColleges universitiesColleges = new UniversitiesColleges();
|
|
|
universitiesColleges.setOrgId(coreUser.getOrgId());
|
|
|
List<UniversitiesColleges> universitiesCollegesList = universitiesCollegesService.getValues(universitiesColleges);
|
|
|
if(universitiesCollegesList.size() > 0){
|
|
|
universitiesColleges = universitiesCollegesList.get(0);
|
|
|
teacher.setUniversitiesCollegesId(universitiesColleges.getUniversitiesCollegesId());
|
|
|
teacher.setOrgId(universitiesColleges.getOrgId());
|
|
|
}
|
|
|
}else {
|
|
|
UniversitiesColleges universitiesColleges = universitiesCollegesService.queryById(teacher.getUniversitiesCollegesId());
|
|
|
teacher.setOrgId(universitiesColleges.getOrgId());
|
|
|
}
|
|
|
return teacherService.add(teacher);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(MODEL + "/edit.json")
|
|
|
@Function("teacher.edit")
|
|
|
@ResponseBody
|
|
|
public JsonResult<String> edit(@Validated(ValidateConfig.UPDATE.class) Teacher teacher, BindingResult result) {
|
|
|
if(result.hasErrors()){
|
|
|
return JsonResult.failMessage(result);
|
|
|
}else {
|
|
|
teacher.setUniversitiesCollegesId(null);
|
|
|
teacher.setAddTime(null);
|
|
|
teacher.setUserId(null);
|
|
|
teacher.setOrgId(null);
|
|
|
boolean success = teacherService.edit(teacher);
|
|
|
if (success) {
|
|
|
|
|
|
return JsonResult.success();
|
|
|
} else {
|
|
|
return JsonResult.failMessage("更新失败");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//初始化密码
|
|
|
@PostMapping(MODEL + "/initPassword.json")
|
|
|
@Function("teacher.edit")
|
|
|
@ResponseBody
|
|
|
public JsonResult<String> initPassword(@Validated(ValidateConfig.UPDATE.class) Teacher teacher, BindingResult result) {
|
|
|
if(result.hasErrors()){
|
|
|
return JsonResult.failMessage(result);
|
|
|
}else {
|
|
|
boolean success = teacherService.initPassword(teacher);
|
|
|
if (success) {
|
|
|
return JsonResult.success();
|
|
|
} else {
|
|
|
return JsonResult.failMessage("更新失败");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@GetMapping(MODEL + "/view.json")
|
|
|
@Function("teacher.query")
|
|
|
@ResponseBody
|
|
|
public JsonResult<Teacher>queryInfo(Long teacherId) {
|
|
|
Teacher teacher = teacherService.queryById( teacherId);
|
|
|
return JsonResult.success(teacher);
|
|
|
}
|
|
|
|
|
|
@GetMapping(MODEL + "/getValues.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult<List<Teacher>>getValues(TeacherQuery param) {
|
|
|
List<Teacher> list = teacherService.getValues(param);
|
|
|
return JsonResult.success(list);
|
|
|
}
|
|
|
|
|
|
|
|
|
@PostMapping(MODEL + "/delete.json")
|
|
|
@Function("teacher.delete")
|
|
|
@ResponseBody
|
|
|
public JsonResult delete(String ids) {
|
|
|
teacherService.deleteTeacher(ids);
|
|
|
return JsonResult.success();
|
|
|
}
|
|
|
|
|
|
//教师登录日志
|
|
|
@PostMapping(MODEL + "/logList.json")
|
|
|
@Function("teacher.query")
|
|
|
@ResponseBody
|
|
|
public JsonResult<PageQuery> logList(TeacherQuery condition,@SCoreUser CoreUser coreUser){
|
|
|
condition.setLog(1);
|
|
|
|
|
|
condition.setOrgId(null != coreUser && "JT_S_02".equals(coreUser.getJobType1())?coreUser.getOrgId():null);
|
|
|
|
|
|
if(null == condition.getTeacherStatus()){
|
|
|
condition.setTeacherStatus(1);
|
|
|
}
|
|
|
|
|
|
if(null != coreUser && "JT_S_02".equals(coreUser.getJobType1())){
|
|
|
UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem)platformService.getOther();
|
|
|
if(null != uSystem && ((Integer)1).equals(uSystem.getType())){
|
|
|
condition.setResourcesApplicationId(uSystem.getTypeId());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
teacherService.queryLogByCondition(page);
|
|
|
|
|
|
return JsonResult.success(page);
|
|
|
}
|
|
|
|
|
|
//日志统计
|
|
|
@PostMapping(MODEL + "/statisticsLog.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult statisticsLog(@SCoreUser CoreUser coreUser){
|
|
|
|
|
|
if(null == coreUser){
|
|
|
return JsonResult.failMessage("请登录后再操作");
|
|
|
}
|
|
|
|
|
|
return JsonResult.success(teacherService.getStatisticsLog());
|
|
|
}
|
|
|
|
|
|
//练习成绩
|
|
|
@PostMapping(MODEL + "/queryPracticePerformanceStatistic.json")
|
|
|
@Function("student.query")
|
|
|
@ResponseBody
|
|
|
public JsonResult<PageQuery> queryPracticePerformanceStatistic(StudentQuery condition,@SCoreUser CoreUser coreUser){
|
|
|
condition.setOrgId(null != coreUser && "JT_S_02".equals(coreUser.getJobType1())?coreUser.getOrgId():null);
|
|
|
|
|
|
if(null == condition.getStudentStatus()){
|
|
|
condition.setStudentStatus(1);
|
|
|
}
|
|
|
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
studentService.queryPracticePerformanceStatistic(page);
|
|
|
|
|
|
return JsonResult.success(page);
|
|
|
}
|
|
|
|
|
|
//查课程名称
|
|
|
@GetMapping(MODEL + "/getCourseResourcesList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult getCourseResourcesList(){
|
|
|
List<CourseInfo>list = courseInfoService.getListByCourseLabelTypes("应用课程类");
|
|
|
return JsonResult.success(list);
|
|
|
}
|
|
|
|
|
|
//练习成绩详情
|
|
|
@GetMapping(MODEL + "/getPracticePerformanceStatisticInfoList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult<List<CourseInfo>>getPracticePerformanceStatisticInfoList(StudentQuery studentQuery,@SCoreUser CoreUser coreUser) {
|
|
|
studentQuery.setOrgId(null != coreUser && "JT_S_02".equals(coreUser.getJobType1())?coreUser.getOrgId():null);
|
|
|
|
|
|
List<CourseInfo>list = studentService.getPracticePerformanceStatisticInfoList(studentQuery);
|
|
|
return JsonResult.success(list);
|
|
|
}
|
|
|
|
|
|
//练习进度
|
|
|
@GetMapping(MODEL + "/getPracticeProgressList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult<List<CourseInfo>>getPracticeProgressList(StudentQuery studentQuery,@SCoreUser CoreUser coreUser) {
|
|
|
studentQuery.setOrgId(null != coreUser && "JT_S_02".equals(coreUser.getJobType1())?coreUser.getOrgId():null);
|
|
|
|
|
|
List<CourseInfo>list = studentService.getPracticeProgressList(studentQuery);
|
|
|
return JsonResult.success(list);
|
|
|
}
|
|
|
|
|
|
//错题统计
|
|
|
@PostMapping(MODEL + "/getErrorStatistics.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult<PageQuery> getErrorStatistics(StudentQuery condition,@SCoreUser CoreUser coreUser) {
|
|
|
condition.setOrgId(null != coreUser && "JT_S_02".equals(coreUser.getJobType1())?coreUser.getOrgId():null);
|
|
|
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
studentService.getErrorStatistics(page);
|
|
|
return JsonResult.success(page);
|
|
|
}
|
|
|
|
|
|
//实训案例列表
|
|
|
@PostMapping(MODEL + "/getStudentTrainingList.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult<PageQuery> getStudentTrainingList(StudentDefenceLogInfoQuery condition,@SCoreUser CoreUser coreUser){
|
|
|
condition.setOrgId(null != coreUser && "JT_S_02".equals(coreUser.getJobType1())?coreUser.getOrgId():null);
|
|
|
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
studentDefenceLogInfoService.queryByCondition(page);
|
|
|
return JsonResult.success(page);
|
|
|
}
|
|
|
|
|
|
//实训案例详情
|
|
|
@GetMapping(MODEL + "/getStudentTrainingInfo.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult getStudentTrainingInfo(StudentDefenceLogInfoQuery studentDefenceLogInfoQuery){
|
|
|
if(null == studentDefenceLogInfoQuery.getStudentDefenceLogInfoId()){
|
|
|
return JsonResult.failMessage("请选择相应的记录");
|
|
|
}
|
|
|
|
|
|
StudentDefenceLogInfo studentDefenceLogInfo = studentDefenceLogInfoService.getById(studentDefenceLogInfoQuery.getStudentDefenceLogInfoId());
|
|
|
|
|
|
StudentDefenceLog studentDefenceLog = studentDefenceLogService.queryById(studentDefenceLogInfo.getStudentDefenceLogId());
|
|
|
|
|
|
Long resourcesTrainingId = null != studentDefenceLogInfo.get("resourcesTrainingId") && StringUtils.isNotBlank(studentDefenceLogInfo.get("resourcesTrainingId").toString())?Long.parseLong(studentDefenceLogInfo.get("resourcesTrainingId").toString()):null;
|
|
|
if(null == resourcesTrainingId){
|
|
|
return JsonResult.failMessage("案例信息丢失");
|
|
|
}
|
|
|
ResourcesTraining resourcesTraining = resourcesTrainingService.queryById(resourcesTrainingId);
|
|
|
if(null == resourcesTraining){
|
|
|
return JsonResult.failMessage("案例信息丢失");
|
|
|
}
|
|
|
|
|
|
resourcesTraining.set("studentFraction",studentDefenceLogInfo.getStudentFraction());
|
|
|
resourcesTraining.set("studentDefenceData",studentDefenceLogInfo.getStudentDefenceData());
|
|
|
resourcesTraining.set("defenceComment",studentDefenceLogInfo.getDefenceComment());
|
|
|
|
|
|
ResourcesTrainingStepQuery resourcesTrainingStepQuery = new ResourcesTrainingStepQuery();
|
|
|
resourcesTrainingStepQuery.setResourcesTrainingId(resourcesTraining.getResourcesTrainingId());
|
|
|
resourcesTrainingStepQuery.setStudentId(studentDefenceLog.getStudentId());
|
|
|
List<ResourcesTrainingStep> resourcesTrainingStepList = resourcesTrainingStepService.getValuesByQuery(resourcesTrainingStepQuery);
|
|
|
resourcesTraining.set("resourcesTrainingStepList",resourcesTrainingStepList);
|
|
|
|
|
|
return JsonResult.success(resourcesTraining);
|
|
|
}
|
|
|
|
|
|
//实训案例评分
|
|
|
@PostMapping(MODEL + "/setDefenceFraction.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult setDefenceFraction(StudentDefenceLogInfoQuery studentDefenceLogInfoQuery,@SCoreUser CoreUser coreUser){
|
|
|
if(null == coreUser){
|
|
|
return JsonResult.failMessage("请登录后再操作");
|
|
|
}
|
|
|
if(null == studentDefenceLogInfoQuery.getStudentDefenceLogInfoId()){
|
|
|
return JsonResult.failMessage("请选择相应的记录");
|
|
|
}
|
|
|
if(null == studentDefenceLogInfoQuery.getStudentFraction()){
|
|
|
return JsonResult.failMessage("请填写相应的分数");
|
|
|
}
|
|
|
|
|
|
StudentDefenceLogInfo studentDefenceLogInfo = new StudentDefenceLogInfo();
|
|
|
studentDefenceLogInfo.setStudentDefenceLogInfoId(studentDefenceLogInfoQuery.getStudentDefenceLogInfoId());
|
|
|
studentDefenceLogInfo.setStudentFraction(studentDefenceLogInfoQuery.getStudentFraction());
|
|
|
studentDefenceLogInfo.setDefenceComment(studentDefenceLogInfoQuery.getDefenceComment());
|
|
|
studentDefenceLogInfo.setTeacherId(teacherService.getByUserId(coreUser.getId()).getTeacherId());
|
|
|
studentDefenceLogInfoService.updateTemplate(studentDefenceLogInfo);
|
|
|
|
|
|
return JsonResult.success();
|
|
|
}
|
|
|
|
|
|
//打开在线编译器
|
|
|
@PostMapping(MODEL + "/createJupyterNotebook.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult createJupyterNotebook(@SCoreUser CoreUser coreUser){
|
|
|
if(null == coreUser){
|
|
|
return JsonResult.failMessage("请登录后操作");
|
|
|
}
|
|
|
|
|
|
String JupyterNotebookUrl = JupyterNotebookUtils.createJupyterNotebook(coreUser.getCode());
|
|
|
|
|
|
if(StringUtils.isNotBlank(JupyterNotebookUrl)){
|
|
|
return JsonResult.success(JupyterNotebookUrl);
|
|
|
}else {
|
|
|
return JsonResult.failMessage("开启失败,请重试,如果重试失败,请联系管理员");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//下载模板信息
|
|
|
@GetMapping(MODEL + "/downloadTemplate_old.json")
|
|
|
public void download(HttpServletResponse response,@SCoreUser CoreUser coreUser) {
|
|
|
XSSFWorkbook workbook = null;
|
|
|
InputStream is = null;
|
|
|
try {
|
|
|
is = new FileInputStream(GetFile.p + File.separator +"filesystem"+ File.separator +"template"+ File.separator+ "教师导入模板.xlsx");
|
|
|
|
|
|
workbook = new XSSFWorkbook(is);
|
|
|
|
|
|
//获取第一个sheet
|
|
|
Sheet sheet = workbook.getSheet("院校信息");
|
|
|
|
|
|
UniversitiesColleges universitiesColleges = new UniversitiesColleges();
|
|
|
universitiesColleges.setUniversitiesCollegesStatus(1);
|
|
|
if("JT_S_02".equals(coreUser.getJobType1())){//老师
|
|
|
universitiesColleges.setOrgId(coreUser.getOrgId());
|
|
|
}
|
|
|
List<UniversitiesColleges> universitiesCollegesList = universitiesCollegesService.getValues(universitiesColleges);
|
|
|
|
|
|
if(null != universitiesCollegesList && universitiesCollegesList.size()>0){
|
|
|
for(int i=0;i<universitiesCollegesList.size();i++){
|
|
|
Row row = sheet.createRow(i);
|
|
|
Cell cell = row.createCell(0);
|
|
|
cell.setCellValue(universitiesCollegesList.get(i).getUniversitiesCollegesName()+"_"+universitiesCollegesList.get(i).getUniversitiesCollegesId());
|
|
|
}
|
|
|
}else {
|
|
|
throw new PlatformException("请先添加院校");
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
if(null != is){
|
|
|
is.close();
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
//准备将Excel的输出流通过response输出到页面下载
|
|
|
//八进制输出流
|
|
|
response.setContentType("application/octet-stream");
|
|
|
|
|
|
//这后面可以设置导出Excel的名称,此例中名为template.xls
|
|
|
response.setHeader("Content-disposition", "attachment;filename=teacherTemplate(" + TimeTool.getNowTime("YMD") + ").xlsx");
|
|
|
|
|
|
//刷新缓冲
|
|
|
response.flushBuffer();
|
|
|
|
|
|
//workbook将Excel写入到response的输出流中,供页面下载
|
|
|
workbook.write(response.getOutputStream());
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
} finally {
|
|
|
try {
|
|
|
if (null != workbook) {
|
|
|
workbook.close();
|
|
|
}
|
|
|
if (null != response && null != response.getOutputStream()) {
|
|
|
response.getOutputStream().close();
|
|
|
}
|
|
|
} catch (Exception e) { }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//导入模板信息
|
|
|
@PostMapping(MODEL + "/importTemplate_old.json")
|
|
|
@ResponseBody
|
|
|
public JsonResult importTemplate(@RFile FileEntity fileEntity) {
|
|
|
List<Long>list=new ArrayList<>();
|
|
|
JsonResult jsonResult = teacherService.importTemplate(fileEntity,list);
|
|
|
if(list.size()>0){
|
|
|
teacherService.deleteByList(list);
|
|
|
}
|
|
|
return jsonResult;
|
|
|
}
|
|
|
|
|
|
@GetMapping(MODEL + "/export.json")
|
|
|
@ResponseBody
|
|
|
public void export(TeacherQuery condition, @SCoreUser CoreUser coreUser) throws IOException {
|
|
|
|
|
|
Assert.isFalse(coreUser.isStudent(), "学生无法访问该接口!");
|
|
|
|
|
|
if (!coreUser.isAdmin()) {
|
|
|
condition.setOrgId(coreUser.getOrgId());
|
|
|
}
|
|
|
|
|
|
condition.setTeacherStatus(1);
|
|
|
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
page.setPageNumber(1); page.setPageSize(Integer.MAX_VALUE);
|
|
|
|
|
|
PageQuery<Teacher> pageQuery = teacherService.queryByCondition(page);
|
|
|
|
|
|
List<Teacher> list = pageQuery.getList();
|
|
|
|
|
|
/** 构建表头 */
|
|
|
Map<String, String> header = new LinkedHashMap<>(11);
|
|
|
header.put("teacherName", "教师姓名");
|
|
|
header.put("teacherJobNumber", "教师工号");
|
|
|
header.put("universitiesCollegesName", "所属院校");
|
|
|
header.put("universityFacultyIdText", "所属院系");
|
|
|
header.put("universitySystemIdText", "所属专业");
|
|
|
header.put("studentMobile", "电话");
|
|
|
header.put("studentEmail", "邮箱");
|
|
|
header.put("addTime", "创建时间");
|
|
|
|
|
|
List<Map<String, Object>> maps = BeanCopyUtil.baseEntity2MapWithParallel(list);
|
|
|
|
|
|
String filename = StrUtil.format("教师列表导出{}.xlsx", System.currentTimeMillis());
|
|
|
write(response, filename, "Sheet1", header.values(), convertData(header.keySet(), maps));
|
|
|
}
|
|
|
|
|
|
//导出信息
|
|
|
@GetMapping(MODEL + "/export1.json")
|
|
|
@ResponseBody
|
|
|
public void export(HttpServletResponse response,TeacherQuery teacherQuery) {
|
|
|
HSSFWorkbook workbook = null;
|
|
|
try {
|
|
|
//表头数据
|
|
|
String[] header = {"院校名称", "教师姓名", "工号", "电话", "邮箱"};
|
|
|
String[] headerCode = {"universitiesCollegesName","teacherName","teacherJobNumber", "teacherMobile", "teacherEmail"};
|
|
|
|
|
|
//数据内容
|
|
|
List<Map<String, Object>> mapList = teacherService.getExcelValues(teacherQuery);
|
|
|
|
|
|
//内容宽度
|
|
|
Map<String, Object> widthMap = mapList.get(0);
|
|
|
mapList.remove(0);
|
|
|
|
|
|
//声明一个工作簿
|
|
|
workbook = new HSSFWorkbook();
|
|
|
|
|
|
//生成一个表格,设置表格名称为"Sheet1"
|
|
|
HSSFSheet sheet = workbook.createSheet("Sheet1");
|
|
|
|
|
|
//冻结表头
|
|
|
sheet.createFreezePane(0, 1, 0, 1);
|
|
|
|
|
|
//设置默认列宽度为5个字节
|
|
|
sheet.setDefaultColumnWidth(5);
|
|
|
|
|
|
//创建第一行表头
|
|
|
HSSFRow headRow = sheet.createRow(0);
|
|
|
|
|
|
//头部样式
|
|
|
HSSFCellStyle headerStyle = workbook.createCellStyle();
|
|
|
//垂直居中
|
|
|
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
//水平居中
|
|
|
headerStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
|
|
//单元格样式
|
|
|
HSSFCellStyle cellStyle = workbook.createCellStyle();
|
|
|
//垂直居中
|
|
|
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
//水平居左
|
|
|
cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
//自动换行
|
|
|
cellStyle.setWrapText(true);
|
|
|
|
|
|
//遍历添加表头
|
|
|
for (int i = 0; i < header.length; i++) {
|
|
|
|
|
|
//设置表格特定的列宽度
|
|
|
if (null != widthMap.get(headerCode[i])) {
|
|
|
String width = widthMap.get(headerCode[i]).toString().split("\\.")[0];
|
|
|
Integer w = Integer.parseInt(width) > header[i].length()*3?Integer.parseInt(width):header[i].length()*3;
|
|
|
sheet.setColumnWidth(i, w * 190);
|
|
|
}
|
|
|
|
|
|
//创建一个单元格
|
|
|
HSSFCell cell = headRow.createCell(i);
|
|
|
|
|
|
//创建一个内容对象
|
|
|
HSSFRichTextString text = new HSSFRichTextString(header[i]);
|
|
|
|
|
|
//将内容对象的文字内容写入到单元格中
|
|
|
cell.setCellValue(text);
|
|
|
|
|
|
//设置样式
|
|
|
cell.setCellStyle(headerStyle);
|
|
|
}
|
|
|
|
|
|
//遍历结果集,把内容加入表格
|
|
|
for (int i = 0; i < mapList.size(); i++) {
|
|
|
HSSFRow row = sheet.createRow(i + 1);
|
|
|
|
|
|
row.setHeight((short) (50*10));
|
|
|
|
|
|
Map<String, Object> map = mapList.get(i);
|
|
|
for (int j = 0; j < headerCode.length; j++) {
|
|
|
HSSFCell cell = row.createCell(j);
|
|
|
cell.setCellStyle(cellStyle);
|
|
|
HSSFRichTextString text = new HSSFRichTextString(null != map.get(headerCode[j]) ? map.get(headerCode[j]).toString() : " ");
|
|
|
cell.setCellValue(text);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//准备将Excel的输出流通过response输出到页面下载
|
|
|
//八进制输出流
|
|
|
response.setContentType("application/octet-stream");
|
|
|
|
|
|
//这后面可以设置导出Excel的名称,此例中名为student.xls
|
|
|
response.setHeader("Content-disposition", "attachment;filename=teacher(" + TimeTool.getNowTime("YMD") + ").xls");
|
|
|
|
|
|
//刷新缓冲
|
|
|
response.flushBuffer();
|
|
|
|
|
|
//workbook将Excel写入到response的输出流中,供页面下载
|
|
|
workbook.write(response.getOutputStream());
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
} finally {
|
|
|
try {
|
|
|
if (null != workbook) {
|
|
|
workbook.close();
|
|
|
}
|
|
|
if (null != response && null != response.getOutputStream()) {
|
|
|
response.getOutputStream().close();
|
|
|
}
|
|
|
} catch (Exception e) { }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 导出批量模板
|
|
|
* @return
|
|
|
*/
|
|
|
@SneakyThrows
|
|
|
@GetMapping({ API + "/exportBatchTemplate.do", MODEL + "/downloadTemplate.json" })
|
|
|
@ResponseBody
|
|
|
public void exportBatchTemplate() {
|
|
|
|
|
|
Assert.notNull(getUser(), "请登录后再操作");
|
|
|
|
|
|
String filename = StrUtil.format("批量教师导入模板{}.xlsx", System.currentTimeMillis());
|
|
|
|
|
|
setExcelResponse(filename);
|
|
|
// 输出 Excel
|
|
|
com.ibeetl.admin.core.util.excelGroupValidation.ExcelUtil.createExcel(Arrays.asList(new TeacherBatchImportDTO()), response.getOutputStream());
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 功能描述: <br>
|
|
|
* 〈导入批量模板数据〉
|
|
|
* 批量导入题目 excel版本,只支持单选多选,对错吧
|
|
|
* @param file
|
|
|
* @return {@link JsonResult}
|
|
|
* @Author: 87966
|
|
|
* @Date: 2022/11/28 10:04
|
|
|
*/
|
|
|
@SneakyThrows
|
|
|
@PostMapping({MODEL + "/importTemplate.json", API + "/importBatchTemplate.do"})
|
|
|
@ResponseBody
|
|
|
public JsonResult importBatchTemplate(@NotNull(message = "导入的文件不能为空!") MultipartFile file, @SCoreUser CoreUser coreUser) {
|
|
|
|
|
|
try {
|
|
|
Assert.isNull(getStudent(), "学生无法访问该接口");
|
|
|
|
|
|
// 输出 Excel
|
|
|
MyValidateExcelCellDataListener<TeacherBatchImportDTO> listener = new MyValidateExcelCellDataListener<>();
|
|
|
|
|
|
ExcelUtil.readExcelNotContainHeader(file, TeacherBatchImportDTO.class, listener);
|
|
|
// 判断错误的结果集
|
|
|
Assert.isTrue(CollectionUtil.isEmpty(listener.getFailMessage()), JSONUtil.toJsonStr(listener.getFailMessage()));
|
|
|
// 类型转换
|
|
|
List<Teacher> list = listener.getData().stream().map(TeacherBatchImportDTO::pojo)
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
// 设置机构ID
|
|
|
setObjectOrgId(list, (e) -> {
|
|
|
UniversitiesColleges params = new UniversitiesColleges();
|
|
|
params.setUniversitiesCollegesId(e.getUniversitiesCollegesId());
|
|
|
params.setUniversitiesCollegesStatus(1);
|
|
|
UniversitiesColleges sc = universitiesCollegesDao.templateOne(params);
|
|
|
if (sc != null) {
|
|
|
return sc.getOrgId();
|
|
|
}
|
|
|
return null;
|
|
|
}, true);
|
|
|
|
|
|
teacherService.validateTeacherSnListIsExistsThrow(list, listener);
|
|
|
// 再次判断错误的结果集
|
|
|
Assert.isTrue(CollectionUtil.isEmpty(listener.getFailMessage()), JSONUtil.toJsonStr(listener.getFailMessage()));
|
|
|
|
|
|
// 导入并添加身份信息
|
|
|
list.forEach(teacherService::add);
|
|
|
}
|
|
|
catch (IllegalArgumentException exception) {
|
|
|
return JsonResult.failMessage(exception.getMessage()).setCode(DIY_ERROR.getCode());
|
|
|
}
|
|
|
return JsonResult.successMessage("导入成功!");
|
|
|
}
|
|
|
|
|
|
}
|