958 lines
33 KiB
Plaintext
958 lines
33 KiB
Plaintext
|
|
package com.bonus.grade.controller;
|
|||
|
|
|
|||
|
|
|
|||
|
|
import com.bonus.core.DateTimeHelper;
|
|||
|
|
import com.bonus.grade.beans.gradeBean;
|
|||
|
|
import com.bonus.grade.service.gradeService;
|
|||
|
|
import com.bonus.operation.Beans.OperationBean;
|
|||
|
|
import com.bonus.question.beans.QuestionBean;
|
|||
|
|
import com.bonus.question.service.QuestionService;
|
|||
|
|
import com.bonus.registration.beans.RegistrationBean;
|
|||
|
|
import com.bonus.registration.service.RegistrationService;
|
|||
|
|
import com.bonus.score.beans.ScoreBean;
|
|||
|
|
import com.bonus.sys.*;
|
|||
|
|
import com.bonus.sys.beans.CheckCard;
|
|||
|
|
import com.bonus.sys.beans.UserBean;
|
|||
|
|
import com.gexin.fastjson.JSON;
|
|||
|
|
import com.gexin.fastjson.JSONArray;
|
|||
|
|
import com.gexin.fastjson.JSONObject;
|
|||
|
|
import org.apache.commons.lang3.StringUtils;
|
|||
|
|
import org.apache.http.auth.UsernamePasswordCredentials;
|
|||
|
|
import org.apache.ibatis.annotations.Param;
|
|||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|||
|
|
import org.springframework.stereotype.Controller;
|
|||
|
|
import org.springframework.ui.Model;
|
|||
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|||
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|||
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|||
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|||
|
|
|
|||
|
|
import javax.servlet.http.HttpServletRequest;
|
|||
|
|
import java.text.DateFormat;
|
|||
|
|
import java.text.ParseException;
|
|||
|
|
import java.text.SimpleDateFormat;
|
|||
|
|
import java.util.*;
|
|||
|
|
|
|||
|
|
@Controller
|
|||
|
|
@RequestMapping("/backstage/grade/")
|
|||
|
|
public class gradeController extends BaseController<gradeBean> {
|
|||
|
|
|
|||
|
|
@Autowired
|
|||
|
|
private gradeService service;
|
|||
|
|
|
|||
|
|
@Autowired
|
|||
|
|
private QuestionService questionService;
|
|||
|
|
|
|||
|
|
|
|||
|
|
@Autowired
|
|||
|
|
RegistrationService regiservice;
|
|||
|
|
|
|||
|
|
|
|||
|
|
@RequestMapping("gradeList")
|
|||
|
|
public String launchList(Model model) {
|
|||
|
|
return "/grade/gradeList";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// @RequestMapping("details")
|
|||
|
|
// public String details(Model model) {
|
|||
|
|
// return "/person/gradeForm";
|
|||
|
|
// }
|
|||
|
|
//
|
|||
|
|
|
|||
|
|
@RequestMapping(value = "findByPageTwo", method = RequestMethod.POST)
|
|||
|
|
@ResponseBody
|
|||
|
|
public AjaxRes findByPageTwo(Page<ScoreBean> page, ScoreBean o) {
|
|||
|
|
|
|||
|
|
AjaxRes ar = getAjaxRes();
|
|||
|
|
try {
|
|||
|
|
Page<ScoreBean> result = service.findByPageTwo(o, page);
|
|||
|
|
Map<String, Object> p = new HashMap<String, Object>();
|
|||
|
|
p.put("list", result);
|
|||
|
|
ar.setSucceed(p);
|
|||
|
|
} catch (Exception e) {
|
|||
|
|
logger.error(e.toString(), e);
|
|||
|
|
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
|||
|
|
}
|
|||
|
|
return ar;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
@RequestMapping(value = "toStartStatus", method = RequestMethod.POST)
|
|||
|
|
@ResponseBody
|
|||
|
|
public AjaxRes toStartStatus(ScoreBean o,String times) {
|
|||
|
|
AjaxRes ar = getAjaxRes();
|
|||
|
|
try {
|
|||
|
|
ar = service.toStartStatus(o);
|
|||
|
|
List<RegistrationBean> examLists = regiservice.showExamPerson(o.getExamId());
|
|||
|
|
for(RegistrationBean bean : examLists) {
|
|||
|
|
if(bean.getIsActive() == 1 && bean.getTimes().equals(times)) {
|
|||
|
|
queryInformation(bean);
|
|||
|
|
}else if(bean.getIsActive() == 0 && bean.getTimes().equals(times)) {
|
|||
|
|
queryInformation(bean);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
} catch (Exception e) {
|
|||
|
|
logger.error(e.toString(), e);
|
|||
|
|
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
|||
|
|
}
|
|||
|
|
return ar;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void queryInformation(RegistrationBean rb){
|
|||
|
|
gradeBean o = new gradeBean();
|
|||
|
|
RegistrationBean bean = regiservice.findByidcard(rb.getIdcard());
|
|||
|
|
UserBean user = new UserBean();
|
|||
|
|
Integer userId = rb.getUserId();
|
|||
|
|
user.setId(userId);
|
|||
|
|
String userName = rb.getName();
|
|||
|
|
user.setName(userName);
|
|||
|
|
if(bean != null) {
|
|||
|
|
o.setExamPerfession(bean.getSpecialty());
|
|||
|
|
o.setExamCount(bean.getTimes());
|
|||
|
|
o = service.findExamPage(o);
|
|||
|
|
o.setExamPerfession(bean.getSpecialty());
|
|||
|
|
}
|
|||
|
|
String examId = o.getExamId();
|
|||
|
|
String difficultId = o.getDifficultId();
|
|||
|
|
String professId = o.getExamPerfession();
|
|||
|
|
QuestionBean quest = new QuestionBean();
|
|||
|
|
quest.setQuestionType(professId);
|
|||
|
|
quest.setDifficultId(difficultId);
|
|||
|
|
quest.setExamId(examId);
|
|||
|
|
quest.setUser(user);
|
|||
|
|
questionService.makeExamPage(quest);
|
|||
|
|
bean.setExamId(examId);
|
|||
|
|
bean.setIdcard(userId + "");
|
|||
|
|
regiservice.setExamId(bean);
|
|||
|
|
//------------------------------------------------------------------------------------------
|
|||
|
|
String examName = service.findIsActice(o.getExamId()).getExamName();
|
|||
|
|
o.setExamName(examName);
|
|||
|
|
//题目集合
|
|||
|
|
List<QuestionBean> single = new ArrayList<QuestionBean>();
|
|||
|
|
quest.setClassification("");
|
|||
|
|
single=questionService.findExamPage(quest);
|
|||
|
|
saveExamInfo(o,single,user);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@RequestMapping("showExamPerson")
|
|||
|
|
public String showExamPerson(String id, String times, Model model) {
|
|||
|
|
List<RegistrationBean> examLists = regiservice.showExamPerson(id);
|
|||
|
|
gradeBean gradeis = service.findIsActice(id);
|
|||
|
|
//是这场考试的人并且来了
|
|||
|
|
List<RegistrationBean> yLists = new ArrayList<RegistrationBean>();
|
|||
|
|
//是这场考试的人并且没来
|
|||
|
|
List<RegistrationBean> nLists = new ArrayList<RegistrationBean>();
|
|||
|
|
//不是这场考试的人并且来了
|
|||
|
|
List<RegistrationBean> fLists = new ArrayList<RegistrationBean>();
|
|||
|
|
|
|||
|
|
for(RegistrationBean bean : examLists) {
|
|||
|
|
if(bean.getIsActive() == 1 && bean.getTimes().equals(times)) {
|
|||
|
|
|
|||
|
|
yLists.add(bean);
|
|||
|
|
}else if(bean.getIsActive() == 0 && bean.getTimes().equals(times)) {
|
|||
|
|
nLists.add(bean);
|
|||
|
|
}else if(bean.getIsActive() == 1 && !bean.getTimes().equals(times)) {
|
|||
|
|
fLists.add(bean);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
model.addAttribute("yLists", yLists);
|
|||
|
|
model.addAttribute("nLists", nLists);
|
|||
|
|
model.addAttribute("fLists", fLists);
|
|||
|
|
model.addAttribute("examId", id);
|
|||
|
|
model.addAttribute("gradeis", gradeis);
|
|||
|
|
model.addAttribute("times", times);
|
|||
|
|
return "/grade/showExamPersonPage";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@RequestMapping("showExamingPerson")
|
|||
|
|
public String showExamingPerson(String id, Model model) {
|
|||
|
|
List<RegistrationBean> examLists = regiservice.showExamingPerson(id);
|
|||
|
|
//是这场考试的人并且来了
|
|||
|
|
List<RegistrationBean> yLists = new ArrayList<RegistrationBean>();
|
|||
|
|
//是这场考试的人并且没来
|
|||
|
|
List<RegistrationBean> nLists = new ArrayList<RegistrationBean>();
|
|||
|
|
for(RegistrationBean bean : examLists) {
|
|||
|
|
if(bean.getIsActive() == 1) {
|
|||
|
|
yLists.add(bean);
|
|||
|
|
} else if(bean.getIsActive() == 0) {
|
|||
|
|
nLists.add(bean);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
List<RegistrationBean> scoreLists = regiservice.findExamPerson(id); //本场考试提前提交的人员
|
|||
|
|
for(RegistrationBean bean : scoreLists) {
|
|||
|
|
yLists.add(bean);
|
|||
|
|
}
|
|||
|
|
model.addAttribute("yLists", yLists);
|
|||
|
|
model.addAttribute("nLists", nLists);
|
|||
|
|
return "/grade/showExamingPersonPage";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@RequestMapping("showPersonScore")
|
|||
|
|
public String showPersonScore(String id, Model model) {
|
|||
|
|
List<RegistrationBean> nLists = regiservice.findMissingTest(id); //缺考人员
|
|||
|
|
List<RegistrationBean> yLists = regiservice.findExamPerson(id);
|
|||
|
|
model.addAttribute("yLists", yLists);
|
|||
|
|
model.addAttribute("nLists", nLists);
|
|||
|
|
return "/grade/showExamingPersonPage";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@RequestMapping("showPersonScoreResult")
|
|||
|
|
public String showPersonScoreResult(String id, Model model) {
|
|||
|
|
List<RegistrationBean> lists = regiservice.showPersonScoreResult(id);
|
|||
|
|
model.addAttribute("Lists", lists);
|
|||
|
|
return "/grade/showExamingPersonPageResult";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@RequestMapping("addFormPage")
|
|||
|
|
public String addFormPage(HttpServletRequest request,String id,Model model) {
|
|||
|
|
if(id != null) {
|
|||
|
|
gradeBean bean=service.getinfoByid(id);
|
|||
|
|
List<gradeBean> list = service.getProfessById(id);
|
|||
|
|
String profess = "";
|
|||
|
|
String pName = "";
|
|||
|
|
if(list != null && list.size() != 0) {
|
|||
|
|
for(int i = 0; i < list.size(); i++) {
|
|||
|
|
profess += list.get(i).getExamPerfession() + ",";
|
|||
|
|
pName += list.get(i).getPerfessionName() + ",";
|
|||
|
|
}
|
|||
|
|
request.setAttribute("type", "edit");
|
|||
|
|
request.setAttribute("profess", profess);
|
|||
|
|
request.setAttribute("pName", pName);
|
|||
|
|
}
|
|||
|
|
request.setAttribute("bean", bean);
|
|||
|
|
}
|
|||
|
|
String examCounts = "";
|
|||
|
|
List<gradeBean> gradeList = service.selectExamCount();
|
|||
|
|
for (gradeBean l:gradeList){
|
|||
|
|
examCounts += l.getExamCount() + ";";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
request.setAttribute("examCounts",examCounts);
|
|||
|
|
return "/grade/addFromPage";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@RequestMapping("startExam")
|
|||
|
|
@ResponseBody
|
|||
|
|
public AjaxRes startExam(gradeBean o) {
|
|||
|
|
AjaxRes ar = getAjaxRes();
|
|||
|
|
try {
|
|||
|
|
int processTime = Integer.parseInt(o.getExamTime());
|
|||
|
|
String nowTime = DateTimeHelper.getNowTime();
|
|||
|
|
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|||
|
|
Date date = df.parse(nowTime);
|
|||
|
|
Date date2 = new Date(date.getTime() + processTime*60*1000);
|
|||
|
|
String endTime = df.format(date2);
|
|||
|
|
o.setEndTime(endTime);
|
|||
|
|
o.setStartTime(nowTime);
|
|||
|
|
o.setIsActive("1");
|
|||
|
|
service.update(o);
|
|||
|
|
ar.setSucceedMsg("成功开始考试");
|
|||
|
|
new Timer().schedule(new TimerTask() { //开启定时器
|
|||
|
|
@Override
|
|||
|
|
public void run() {
|
|||
|
|
try {
|
|||
|
|
service.updateStatus(o);
|
|||
|
|
//插入缺考人员表
|
|||
|
|
List<RegistrationBean> examLists = regiservice.showExamingPerson(o.getExamId());
|
|||
|
|
for(RegistrationBean bean : examLists) {
|
|||
|
|
if(bean.getIsActive() == 0) {
|
|||
|
|
regiservice.insertMissingTest(bean);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
service.deleteRegistration(o); //逻辑删除报名表中参与本场考试的人员
|
|||
|
|
} catch (Exception e) {
|
|||
|
|
e.printStackTrace();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}, processTime*60*1000);
|
|||
|
|
} catch(Exception e) {
|
|||
|
|
ar.setFailMsg("考试失败");
|
|||
|
|
e.printStackTrace();
|
|||
|
|
}
|
|||
|
|
return ar;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@RequestMapping("findIsEnd")
|
|||
|
|
@ResponseBody
|
|||
|
|
public AjaxRes findIsEnd(gradeBean o) {
|
|||
|
|
AjaxRes ar = getAjaxRes();
|
|||
|
|
try {
|
|||
|
|
o = service.findIsActice(o.getExamId());
|
|||
|
|
if(o.getIsActive().equals("2")) {
|
|||
|
|
ar.setSucceedMsg("考试已结束");
|
|||
|
|
} else {
|
|||
|
|
ar.setFailMsg("考试未结束");
|
|||
|
|
}
|
|||
|
|
} catch(Exception e) {
|
|||
|
|
ar.setFailMsg("考试未结束");
|
|||
|
|
e.printStackTrace();
|
|||
|
|
}
|
|||
|
|
return ar;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@RequestMapping("addPerson")
|
|||
|
|
public String addPserson(HttpServletRequest request,String id) {
|
|||
|
|
// if(id != null) {
|
|||
|
|
// gradeBean bean=service.getinfoByid(id);
|
|||
|
|
// request.setAttribute("bean", bean);
|
|||
|
|
// }
|
|||
|
|
return "/grade/addPerson";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 新增发布考试
|
|||
|
|
* @param
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
@RequestMapping("FormPageinfo")
|
|||
|
|
@ResponseBody
|
|||
|
|
public AjaxRes FormPageinfo(HttpServletRequest request,@RequestBody JSONObject obj){
|
|||
|
|
AjaxRes ar = getAjaxRes();
|
|||
|
|
try {
|
|||
|
|
String data=obj.toJSONString();
|
|||
|
|
JSONObject json = JSON.parseObject(data);
|
|||
|
|
String createArr=json.getString("createArr");
|
|||
|
|
String modifyArr=json.getString("modifyArr");
|
|||
|
|
String type = json.getString("type");
|
|||
|
|
gradeBean o=new gradeBean();
|
|||
|
|
if(type.equals("1")) {
|
|||
|
|
if(StringUtils.isNotEmpty(modifyArr)){
|
|||
|
|
JSONObject jsonObject=JSONObject.parseObject(modifyArr);
|
|||
|
|
String examName=jsonObject.get("examName").toString();
|
|||
|
|
String examCount=jsonObject.get("examCount").toString();
|
|||
|
|
String fabuUserid=jsonObject.get("fabuUserid").toString();
|
|||
|
|
String examTime=jsonObject.get("examTime").toString();
|
|||
|
|
String viewGrade=jsonObject.get("viewGrade").toString();
|
|||
|
|
String nowTime = DateTimeHelper.getNowTime();
|
|||
|
|
o.setReleaseTime(nowTime);
|
|||
|
|
o.setIsActive("3");
|
|||
|
|
o.setExamTime(examTime);
|
|||
|
|
o.setExamCount(examCount);
|
|||
|
|
o.setExamName(examName);
|
|||
|
|
o.setFabuUserid(fabuUserid);
|
|||
|
|
o.setViewGrade(viewGrade);
|
|||
|
|
service.insert(o);
|
|||
|
|
}
|
|||
|
|
if(StringUtils.isNotEmpty(createArr)){
|
|||
|
|
JSONArray createArray=JSONArray.parseArray(createArr);
|
|||
|
|
for(int i=0;i<createArray.size();i++){
|
|||
|
|
String examPerfession=JSONObject.parseObject(JSONObject.toJSONString(createArray.get(i))).getString("examPerfession");
|
|||
|
|
String difficultId=JSONObject.parseObject(JSONObject.toJSONString(createArray.get(i))).getString("difficultId");
|
|||
|
|
service.professsave(examPerfession,difficultId,o.getExamId());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ar.setSucceedMsg("新增成功");
|
|||
|
|
}else if(type.equals("2")) {
|
|||
|
|
String examId = json.getString("examId");
|
|||
|
|
JSONObject jsonObject = JSONObject.parseObject(modifyArr);
|
|||
|
|
String examName = jsonObject.get("examName").toString();
|
|||
|
|
String examCount = jsonObject.get("examCount").toString();
|
|||
|
|
String examTime = jsonObject.get("examTime").toString();
|
|||
|
|
String viewGrade = jsonObject.getString("viewGrade").toString();
|
|||
|
|
o.setExamTime(examTime);
|
|||
|
|
o.setExamCount(examCount);
|
|||
|
|
o.setExamName(examName);
|
|||
|
|
o.setExamId(examId);
|
|||
|
|
o.setViewGrade(viewGrade);
|
|||
|
|
service.update(o);
|
|||
|
|
if(StringUtils.isNotEmpty(createArr)) {
|
|||
|
|
JSONArray createArray = JSONArray.parseArray(createArr);
|
|||
|
|
List<gradeBean> list = service.getProfessById(examId);
|
|||
|
|
if(list != null && list.size() != 0) {
|
|||
|
|
for(int i = 0; i < list.size(); i++) {
|
|||
|
|
service.deleteProfess(list.get(i));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
for(int i = 0; i < createArray.size(); i++) {
|
|||
|
|
String examPerfession = JSONObject.parseObject(JSONObject.toJSONString(createArray.get(i))).getString("examPerfession");
|
|||
|
|
String difficultId = JSONObject.parseObject(JSONObject.toJSONString(createArray.get(i))).getString("difficultId");
|
|||
|
|
service.professsave(examPerfession, difficultId, examId);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ar.setSucceedMsg("修改成功");
|
|||
|
|
}
|
|||
|
|
} catch (Exception e) {
|
|||
|
|
e.printStackTrace();
|
|||
|
|
ar.setFailMsg("操作失败!");
|
|||
|
|
}
|
|||
|
|
return ar;
|
|||
|
|
}
|
|||
|
|
/**
|
|||
|
|
* 删除
|
|||
|
|
* @param o
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
@RequestMapping("delgrade")
|
|||
|
|
@ResponseBody
|
|||
|
|
public AjaxRes delgrade(gradeBean o){
|
|||
|
|
AjaxRes ar = getAjaxRes();
|
|||
|
|
try {
|
|||
|
|
service.delete(o);
|
|||
|
|
ar.setSucceedMsg("删除成功");
|
|||
|
|
} catch (Exception e) {
|
|||
|
|
e.printStackTrace();
|
|||
|
|
ar.setFailMsg("操作失败!");
|
|||
|
|
}
|
|||
|
|
return ar;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@RequestMapping("saveQuestionContent")
|
|||
|
|
@ResponseBody
|
|||
|
|
public AjaxRes saveQuestionContent(gradeBean o){
|
|||
|
|
AjaxRes ar = getAjaxRes();
|
|||
|
|
try {
|
|||
|
|
//service.saveQuestionContent(o);
|
|||
|
|
ar.setSucceedMsg("保存成功!");
|
|||
|
|
} catch (Exception e) {
|
|||
|
|
e.printStackTrace();
|
|||
|
|
ar.setFailMsg("操作失败!");
|
|||
|
|
}
|
|||
|
|
return ar;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@RequestMapping("stopExam")
|
|||
|
|
@ResponseBody
|
|||
|
|
public AjaxRes stopExam(gradeBean o){
|
|||
|
|
AjaxRes ar = getAjaxRes();
|
|||
|
|
try {
|
|||
|
|
Integer res = service.stopExam(o);
|
|||
|
|
if(res == 1){
|
|||
|
|
ar.setSucceedMsg("考试终止!");
|
|||
|
|
}else{
|
|||
|
|
ar.setFailMsg("考试终止失败!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} catch (Exception e) {
|
|||
|
|
e.printStackTrace();
|
|||
|
|
ar.setFailMsg("操作失败!");
|
|||
|
|
}
|
|||
|
|
return ar;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@RequestMapping("toSelfExam")
|
|||
|
|
@ResponseBody
|
|||
|
|
public AjaxRes toSelfExam(Model model, HttpServletRequest request, @RequestBody gradeBean o) {
|
|||
|
|
AjaxRes ar = getAjaxRes();
|
|||
|
|
Map<String, Object> p = new HashMap<String, Object>();
|
|||
|
|
try {
|
|||
|
|
String typeId = o.getTypeId();
|
|||
|
|
String examId = service.genSelfExam(o);
|
|||
|
|
if(examId !=null){
|
|||
|
|
p.put("examId", examId);
|
|||
|
|
p.put("typeId", typeId);
|
|||
|
|
ar.setSucceed(p);
|
|||
|
|
ar.setSucceedMsg("出题成功!");
|
|||
|
|
}else{
|
|||
|
|
ar.setFailMsg("出题失败!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} catch(Exception e) {
|
|||
|
|
e.printStackTrace();
|
|||
|
|
ar.setFailMsg("出题过程出现异常!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
return ar;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
@RequestMapping("toExam")
|
|||
|
|
@ResponseBody
|
|||
|
|
public AjaxRes toExam(Model model, HttpServletRequest request, @RequestBody gradeBean gbean) {
|
|||
|
|
// shiro获取用户信息
|
|||
|
|
UserBean user = UserShiroHelper.getCurrentUser();//id=22997, name=李四, orgId=69,orgName=一般管理人员,internalEmp=null, loginName=622421199311133217, picUrl=/SCEquipWeb/static/css/sys/images/user/hpic0.jpg, skin=skin-0, salt=13bf58ad2ffc6da1a5802e4025e1b9bc, passwd=nRF0RJqiRAbQCBeDDutZkg==, sex=1, mail=ddd@163.com,telphone=112, createTime=Wed Sep 22 00:00:00 CST 2021,isActive=1,brother=0,ifPermiss=0,greenScore=1.0,roleId=0
|
|||
|
|
String examId = gbean.getExamId();//162
|
|||
|
|
String difficultId = gbean.getDifficultId();//1
|
|||
|
|
String professId = gbean.getExamPerfession();//67
|
|||
|
|
//1.简单;2.一般;3.困难;
|
|||
|
|
QuestionBean quest = new QuestionBean();
|
|||
|
|
quest.setQuestionType(professId);
|
|||
|
|
quest.setDifficultId(difficultId);
|
|||
|
|
quest.setExamId(examId);
|
|||
|
|
quest.setUser(user);
|
|||
|
|
AjaxRes ar = getAjaxRes();
|
|||
|
|
try {
|
|||
|
|
Integer res = 0;
|
|||
|
|
List<QuestionBean> re= new ArrayList<QuestionBean>();
|
|||
|
|
re= questionService.findUserExamPage(quest);
|
|||
|
|
if(re.size()==0) {
|
|||
|
|
res = questionService.makeExamPage(quest);
|
|||
|
|
}
|
|||
|
|
ar.setSucceedMsg("出题成功");
|
|||
|
|
} catch(Exception e) {
|
|||
|
|
e.printStackTrace();
|
|||
|
|
ar.setFailMsg("出题过程出现异常");
|
|||
|
|
}
|
|||
|
|
return ar;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@RequestMapping("toExamPage")
|
|||
|
|
public String toExamPage(Model model, HttpServletRequest request) {
|
|||
|
|
UserBean user = UserShiroHelper.getRealCurrentUser();
|
|||
|
|
String examId = request.getParameter("examId");
|
|||
|
|
RegistrationBean reg = new RegistrationBean();
|
|||
|
|
reg.setExamId(examId);
|
|||
|
|
reg.setIdcard(user.getLoginName());
|
|||
|
|
regiservice.setExamId(reg);
|
|||
|
|
model.addAttribute("examId",examId);
|
|||
|
|
//获取当前的剩余考试时间
|
|||
|
|
//去查询当前报名的信息
|
|||
|
|
gradeBean o = new gradeBean();
|
|||
|
|
RegistrationBean bean=regiservice.findByidcard(user.getLoginName());
|
|||
|
|
o.setExamPerfession(bean.getSpecialty());
|
|||
|
|
o.setExamCount(bean.getTimes());
|
|||
|
|
o = service.findExamPage(o);
|
|||
|
|
o.setExamPerfession(bean.getSpecialty());
|
|||
|
|
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|||
|
|
String startTime = o.getStartTime();
|
|||
|
|
long end=0;
|
|||
|
|
try {
|
|||
|
|
String endTime=o.getEndTime();
|
|||
|
|
end = fmt.parse(endTime).getTime();
|
|||
|
|
} catch (ParseException e) {
|
|||
|
|
// TODO Auto-generated catch block
|
|||
|
|
e.printStackTrace();
|
|||
|
|
}
|
|||
|
|
Date date = new Date();
|
|||
|
|
long nowTime = date.getTime();
|
|||
|
|
long shteam=end-nowTime;
|
|||
|
|
long days = shteam / (1000 * 60 * 60 * 24);
|
|||
|
|
long hours = (shteam-days*(1000 * 60 * 60 * 24))/(1000* 60 * 60);
|
|||
|
|
long minutes = (shteam-days*(1000 * 60 * 60 * 24)-hours*(1000* 60 * 60))/(1000* 60);
|
|||
|
|
System.out.println(""+days+"天"+hours+"小时"+minutes+"分");
|
|||
|
|
o.setKstime(shteam);
|
|||
|
|
request.setAttribute("kssj", shteam);
|
|||
|
|
return "/sys/examPage";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@RequestMapping("toExamingPage")
|
|||
|
|
public String toExamingPage(Model model, HttpServletRequest request) {
|
|||
|
|
String examId = request.getParameter("examId");
|
|||
|
|
String typeId = request.getParameter("typeId");
|
|||
|
|
String testId = request.getParameter("testId");
|
|||
|
|
|
|||
|
|
model.addAttribute("examId",examId);
|
|||
|
|
model.addAttribute("typeId",typeId);
|
|||
|
|
model.addAttribute("testId",testId);
|
|||
|
|
|
|||
|
|
//获取当前的剩余考试时间
|
|||
|
|
//去查询当前报名的信息
|
|||
|
|
gradeBean o = service.getSelfInfoBy(examId);
|
|||
|
|
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|||
|
|
long end=0;
|
|||
|
|
try {
|
|||
|
|
String endTime= o.getEndTime();
|
|||
|
|
end = fmt.parse(endTime).getTime();
|
|||
|
|
} catch (ParseException e) {
|
|||
|
|
e.printStackTrace();
|
|||
|
|
}
|
|||
|
|
Date date = new Date();
|
|||
|
|
long nowTime = date.getTime();
|
|||
|
|
long shteam=end-nowTime;
|
|||
|
|
long days = shteam / (1000 * 60 * 60 * 24);
|
|||
|
|
long hours = (shteam-days*(1000 * 60 * 60 * 24))/(1000* 60 * 60);
|
|||
|
|
long minutes = (shteam-days*(1000 * 60 * 60 * 24)-hours*(1000* 60 * 60))/(1000* 60);
|
|||
|
|
System.out.println(""+days+"天"+hours+"小时"+minutes+"分");
|
|||
|
|
o.setKstime(shteam);
|
|||
|
|
request.setAttribute("kssj", shteam);
|
|||
|
|
return "/sys/selfExamingPage";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
@RequestMapping(value = "findByPage")
|
|||
|
|
public String findByPage(@RequestBody Page<gradeBean> page, gradeBean o, Model model) {
|
|||
|
|
try {
|
|||
|
|
Integer re = 0;
|
|||
|
|
o = page.getObj();
|
|||
|
|
page = service.findByPage(o, page);
|
|||
|
|
for(gradeBean seat : page.getResults()){
|
|||
|
|
gradeBean seats = service.findExamPersonNum(seat);
|
|||
|
|
seat.setExamPersonNum(seats.getExamPersonNum());
|
|||
|
|
}
|
|||
|
|
List<gradeBean> res = service.findExaming();
|
|||
|
|
if(res.size()!=0) {
|
|||
|
|
re = 1;
|
|||
|
|
}else {
|
|||
|
|
re=0;
|
|||
|
|
}
|
|||
|
|
model.addAttribute("page", page);
|
|||
|
|
model.addAttribute("re", re);
|
|||
|
|
} catch (Exception e) {
|
|||
|
|
logger.error(e.toString(), e);
|
|||
|
|
e.printStackTrace();
|
|||
|
|
}
|
|||
|
|
return "/grade/gradeListDetails";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 查询题目信息
|
|||
|
|
* @param o
|
|||
|
|
* @param model
|
|||
|
|
* @return
|
|||
|
|
*/
|
|||
|
|
@RequestMapping("findExamContentPage")
|
|||
|
|
public String findExamContentPage(gradeBean o,Model model) {
|
|||
|
|
UserBean user = UserShiroHelper.getRealCurrentUser();
|
|||
|
|
String selectValue = o.getSelectValue();
|
|||
|
|
String examName = service.findIsActice(o.getExamId()).getExamName();
|
|||
|
|
o.setExamName(examName);
|
|||
|
|
//单选题集合
|
|||
|
|
List<QuestionBean> single = new ArrayList<QuestionBean>();
|
|||
|
|
//多选题集合
|
|||
|
|
List<QuestionBean> multiple = new ArrayList<QuestionBean>();
|
|||
|
|
//判断选题集合
|
|||
|
|
List<QuestionBean> judge = new ArrayList<QuestionBean>();
|
|||
|
|
//填空题集合
|
|||
|
|
List<QuestionBean> completion = new ArrayList<QuestionBean>();
|
|||
|
|
//简答题集合
|
|||
|
|
List<QuestionBean> shortAnswer = new ArrayList<QuestionBean>();
|
|||
|
|
//案例分析题集合
|
|||
|
|
List<QuestionBean> caseAnalysis = new ArrayList<QuestionBean>();
|
|||
|
|
String url = "";
|
|||
|
|
QuestionBean quest = new QuestionBean();
|
|||
|
|
quest.setExamId(o.getExamId());
|
|||
|
|
quest.setUser(user);
|
|||
|
|
|
|||
|
|
if(selectValue.equals("1")) {
|
|||
|
|
quest.setClassification("1");
|
|||
|
|
single=questionService.findExamPage(quest);
|
|||
|
|
if(single.size() !=0) {
|
|||
|
|
//查询是否是第一次更新相关内容
|
|||
|
|
String questionTitle=questionService.findtitleby(single.get(0));
|
|||
|
|
System.out.println(questionTitle);
|
|||
|
|
String question1 = questionTitle+"1";
|
|||
|
|
if(question1.equals("null1")) {
|
|||
|
|
saveExamInfo(o,single,user);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
operationList(single);
|
|||
|
|
Integer singleNum = single.size();
|
|||
|
|
model.addAttribute("singleNum", singleNum);
|
|||
|
|
model.addAttribute("single", single);
|
|||
|
|
url="/exampage/singleChoice";
|
|||
|
|
}else if(selectValue.equals("2")) {
|
|||
|
|
quest.setClassification("2");
|
|||
|
|
multiple = questionService.findExamPage(quest);
|
|||
|
|
if(multiple.size() !=0) {
|
|||
|
|
//查询是否是第一次更新相关内容
|
|||
|
|
String questionTitle=questionService.findtitleby(multiple.get(0));
|
|||
|
|
String question1 = questionTitle+"1";
|
|||
|
|
if(question1.equals("null1")) {
|
|||
|
|
saveExamInfo(o,multiple,user);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
operationList(multiple);
|
|||
|
|
Integer multipleNum = multiple.size();
|
|||
|
|
model.addAttribute("multipleNum", multipleNum);
|
|||
|
|
model.addAttribute("multiple", multiple);
|
|||
|
|
url="/exampage/multipleChoice";
|
|||
|
|
}else if(selectValue.equals("3")) {
|
|||
|
|
quest.setClassification("3");
|
|||
|
|
judge = questionService.findExamPage(quest);
|
|||
|
|
if(judge.size() !=0) {
|
|||
|
|
//查询是否是第一次更新相关内容
|
|||
|
|
String questionTitle=questionService.findtitleby(judge.get(0));
|
|||
|
|
String question1 = questionTitle+"1";
|
|||
|
|
if(question1.equals("null1")) {
|
|||
|
|
saveExamInfo(o,judge,user);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
operationList(judge);
|
|||
|
|
Integer judgeNum = judge.size();
|
|||
|
|
model.addAttribute("judgeNum", judgeNum);
|
|||
|
|
model.addAttribute("judge", judge);
|
|||
|
|
url="/exampage/judge";
|
|||
|
|
}else if(selectValue.equals("4")) {
|
|||
|
|
quest.setClassification("4");
|
|||
|
|
completion = questionService.findExamPage(quest);
|
|||
|
|
//查询是否是第一次更新相关内容
|
|||
|
|
if(completion.size() !=0) {
|
|||
|
|
String questionTitle=questionService.findtitleby(completion.get(0));
|
|||
|
|
String question1 = questionTitle+"1";
|
|||
|
|
if(question1.equals("null1")) {
|
|||
|
|
saveExamInfo(o,completion,user);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
operationList(completion);
|
|||
|
|
Integer completionNum = completion.size();
|
|||
|
|
model.addAttribute("completionNum", completionNum);
|
|||
|
|
model.addAttribute("completion", completion);
|
|||
|
|
url="/exampage/completion";
|
|||
|
|
}else if(selectValue.equals("5")) {
|
|||
|
|
quest.setClassification("5");
|
|||
|
|
shortAnswer = questionService.findExamPage(quest);
|
|||
|
|
if(shortAnswer.size() !=0) {
|
|||
|
|
//查询是否是第一次更新相关内容
|
|||
|
|
String questionTitle=questionService.findtitleby(shortAnswer.get(0));
|
|||
|
|
String question1 = questionTitle+"1";
|
|||
|
|
if(question1.equals("null1")) {
|
|||
|
|
saveExamInfo(o,shortAnswer,user);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
operationList(shortAnswer);
|
|||
|
|
Integer shortAnswerNum = shortAnswer.size();
|
|||
|
|
model.addAttribute("shortAnswerNum", shortAnswerNum);
|
|||
|
|
model.addAttribute("shortAnswer", shortAnswer);
|
|||
|
|
url="/exampage/shortAnswer";
|
|||
|
|
}else{
|
|||
|
|
quest.setClassification("6");
|
|||
|
|
caseAnalysis = questionService.findExamPage(quest);
|
|||
|
|
//查询是否是第一次更新相关内容
|
|||
|
|
if(caseAnalysis.size() !=0) {
|
|||
|
|
String questionTitle=questionService.findtitleby(caseAnalysis.get(0));
|
|||
|
|
String question1 = questionTitle+"1";
|
|||
|
|
if(question1.equals("null1")) {
|
|||
|
|
saveExamInfo(o,caseAnalysis,user);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
operationList(caseAnalysis);
|
|||
|
|
Integer caseAnalysisNum = caseAnalysis.size();
|
|||
|
|
model.addAttribute("caseAnalysisNum", caseAnalysisNum);
|
|||
|
|
model.addAttribute("caseAnalysis", caseAnalysis);
|
|||
|
|
url="/exampage/caseAnalysis";
|
|||
|
|
}
|
|||
|
|
//System.out.println("试卷题目---变序:"+single);
|
|||
|
|
return url;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@RequestMapping("findExamSelfContentPage")
|
|||
|
|
public String findExamSelfContentPage(gradeBean o,Model model) {
|
|||
|
|
UserBean user = UserShiroHelper.getRealCurrentUser();
|
|||
|
|
String selectValue = o.getSelectValue();
|
|||
|
|
//String examName = service.findIsActice(o.getExamId()).getExamName();
|
|||
|
|
o.setExamName("自测练习");
|
|||
|
|
//单选题集合
|
|||
|
|
List<QuestionBean> single = new ArrayList<QuestionBean>();
|
|||
|
|
//多选题集合
|
|||
|
|
List<QuestionBean> multiple = new ArrayList<QuestionBean>();
|
|||
|
|
//判断选题集合
|
|||
|
|
List<QuestionBean> judge = new ArrayList<QuestionBean>();
|
|||
|
|
//填空题集合
|
|||
|
|
List<QuestionBean> completion = new ArrayList<QuestionBean>();
|
|||
|
|
//简答题集合
|
|||
|
|
List<QuestionBean> shortAnswer = new ArrayList<QuestionBean>();
|
|||
|
|
//案例分析题集合
|
|||
|
|
List<QuestionBean> caseAnalysis = new ArrayList<QuestionBean>();
|
|||
|
|
String url = "";
|
|||
|
|
QuestionBean quest = new QuestionBean();
|
|||
|
|
quest.setExamId(o.getExamId());
|
|||
|
|
quest.setUser(user);
|
|||
|
|
if (o.getTestId().equals("1")){
|
|||
|
|
if(selectValue.equals("1")) {
|
|||
|
|
quest.setClassification("1");
|
|||
|
|
single=questionService.findSelfExamPage(quest);
|
|||
|
|
saveExamInfo1(o,single,user);
|
|||
|
|
operationList(single);
|
|||
|
|
Integer singleNum = single.size();
|
|||
|
|
model.addAttribute("singleNum", singleNum);
|
|||
|
|
model.addAttribute("single", single);
|
|||
|
|
url="/exampage/singleSelfChoice";
|
|||
|
|
}else if(selectValue.equals("2")) {
|
|||
|
|
quest.setClassification("2");
|
|||
|
|
multiple = questionService.findSelfExamPage(quest);
|
|||
|
|
saveExamInfo1(o,multiple,user);
|
|||
|
|
operationList(multiple);
|
|||
|
|
Integer multipleNum = multiple.size();
|
|||
|
|
model.addAttribute("multipleNum", multipleNum);
|
|||
|
|
model.addAttribute("multiple", multiple);
|
|||
|
|
url="/exampage/multipleSelfChoice";
|
|||
|
|
}else if(selectValue.equals("3")) {
|
|||
|
|
quest.setClassification("3");
|
|||
|
|
judge = questionService.findSelfExamPage(quest);
|
|||
|
|
saveExamInfo1(o,judge,user);
|
|||
|
|
operationList(judge);
|
|||
|
|
Integer judgeNum = judge.size();
|
|||
|
|
model.addAttribute("judgeNum", judgeNum);
|
|||
|
|
model.addAttribute("judge", judge);
|
|||
|
|
url="/exampage/judgeSelf";
|
|||
|
|
}else if(selectValue.equals("4")) {
|
|||
|
|
quest.setClassification("4");
|
|||
|
|
completion = questionService.findSelfExamPage(quest);
|
|||
|
|
saveExamInfo1(o,completion,user);
|
|||
|
|
operationList(completion);
|
|||
|
|
Integer completionNum = completion.size();
|
|||
|
|
model.addAttribute("completionNum", completionNum);
|
|||
|
|
model.addAttribute("completion", completion);
|
|||
|
|
url="/exampage/completionSelf";
|
|||
|
|
}else if(selectValue.equals("5")) {
|
|||
|
|
quest.setClassification("5");
|
|||
|
|
shortAnswer = questionService.findSelfExamPage(quest);
|
|||
|
|
saveExamInfo1(o,shortAnswer,user);
|
|||
|
|
operationList(shortAnswer);
|
|||
|
|
Integer shortAnswerNum = shortAnswer.size();
|
|||
|
|
model.addAttribute("shortAnswerNum", shortAnswerNum);
|
|||
|
|
model.addAttribute("shortAnswer", shortAnswer);
|
|||
|
|
url="/exampage/shortSelfAnswer";
|
|||
|
|
}else{
|
|||
|
|
quest.setClassification("6");
|
|||
|
|
caseAnalysis = questionService.findSelfExamPage(quest);
|
|||
|
|
saveExamInfo1(o,caseAnalysis,user);
|
|||
|
|
operationList(caseAnalysis);
|
|||
|
|
Integer caseAnalysisNum = caseAnalysis.size();
|
|||
|
|
model.addAttribute("caseAnalysisNum", caseAnalysisNum);
|
|||
|
|
model.addAttribute("caseAnalysis", caseAnalysis);
|
|||
|
|
url="/exampage/caseSelfAnalysis";
|
|||
|
|
}
|
|||
|
|
}else {
|
|||
|
|
if(selectValue.equals("1")) {
|
|||
|
|
quest.setClassification("1");
|
|||
|
|
single=questionService.findSelfExamPage(quest);
|
|||
|
|
saveExamInfo(o,single,user);
|
|||
|
|
operationList(single);
|
|||
|
|
Integer singleNum = single.size();
|
|||
|
|
model.addAttribute("singleNum", singleNum);
|
|||
|
|
model.addAttribute("single", single);
|
|||
|
|
url="/exampage/singleSelfChoice";
|
|||
|
|
}else if(selectValue.equals("2")) {
|
|||
|
|
quest.setClassification("2");
|
|||
|
|
multiple = questionService.findSelfExamPage(quest);
|
|||
|
|
saveExamInfo(o,multiple,user);
|
|||
|
|
operationList(multiple);
|
|||
|
|
Integer multipleNum = multiple.size();
|
|||
|
|
model.addAttribute("multipleNum", multipleNum);
|
|||
|
|
model.addAttribute("multiple", multiple);
|
|||
|
|
url="/exampage/multipleSelfChoice";
|
|||
|
|
}else if(selectValue.equals("3")) {
|
|||
|
|
quest.setClassification("3");
|
|||
|
|
judge = questionService.findSelfExamPage(quest);
|
|||
|
|
saveExamInfo(o,judge,user);
|
|||
|
|
operationList(judge);
|
|||
|
|
Integer judgeNum = judge.size();
|
|||
|
|
model.addAttribute("judgeNum", judgeNum);
|
|||
|
|
model.addAttribute("judge", judge);
|
|||
|
|
url="/exampage/judgeSelf";
|
|||
|
|
}else if(selectValue.equals("4")) {
|
|||
|
|
quest.setClassification("4");
|
|||
|
|
completion = questionService.findSelfExamPage(quest);
|
|||
|
|
saveExamInfo(o,completion,user);
|
|||
|
|
operationList(completion);
|
|||
|
|
Integer completionNum = completion.size();
|
|||
|
|
model.addAttribute("completionNum", completionNum);
|
|||
|
|
model.addAttribute("completion", completion);
|
|||
|
|
url="/exampage/completionSelf";
|
|||
|
|
}else if(selectValue.equals("5")) {
|
|||
|
|
quest.setClassification("5");
|
|||
|
|
shortAnswer = questionService.findSelfExamPage(quest);
|
|||
|
|
saveExamInfo(o,shortAnswer,user);
|
|||
|
|
operationList(shortAnswer);
|
|||
|
|
Integer shortAnswerNum = shortAnswer.size();
|
|||
|
|
model.addAttribute("shortAnswerNum", shortAnswerNum);
|
|||
|
|
model.addAttribute("shortAnswer", shortAnswer);
|
|||
|
|
url="/exampage/shortSelfAnswer";
|
|||
|
|
}else{
|
|||
|
|
quest.setClassification("6");
|
|||
|
|
caseAnalysis = questionService.findSelfExamPage(quest);
|
|||
|
|
saveExamInfo(o,caseAnalysis,user);
|
|||
|
|
operationList(caseAnalysis);
|
|||
|
|
Integer caseAnalysisNum = caseAnalysis.size();
|
|||
|
|
model.addAttribute("caseAnalysisNum", caseAnalysisNum);
|
|||
|
|
model.addAttribute("caseAnalysis", caseAnalysis);
|
|||
|
|
url="/exampage/caseSelfAnalysis";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//System.out.println("试卷题目---变序:"+single);
|
|||
|
|
return url;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 保存试卷相关信息
|
|||
|
|
public void saveExamInfo(gradeBean o,List<QuestionBean> list,UserBean user){
|
|||
|
|
for(QuestionBean unList: list){
|
|||
|
|
unList.setGrade(o);
|
|||
|
|
unList.setUser(user);
|
|||
|
|
QuestionBean qbean = questionService.findById(unList);
|
|||
|
|
if(qbean != null) {
|
|||
|
|
unList.setTrueOperation(qbean.getOperation()); //乱序前的选项
|
|||
|
|
int eqid= questionService.findIdbyequ(unList); //通过三个条件查询主键id
|
|||
|
|
unList.setEqId(eqid);
|
|||
|
|
}
|
|||
|
|
service.saveExamInfo(unList);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public void saveExamInfo1(gradeBean o,List<QuestionBean> list,UserBean user){
|
|||
|
|
for(QuestionBean unList: list){
|
|||
|
|
unList.setGrade(o);
|
|||
|
|
unList.setUser(user);
|
|||
|
|
QuestionBean qbean = questionService.findById(unList);
|
|||
|
|
if(qbean != null) {
|
|||
|
|
unList.setTrueOperation(qbean.getOperation()); //乱序前的选项
|
|||
|
|
int eqid= questionService.findIdbyequ1(unList); //通过三个条件查询主键id
|
|||
|
|
unList.setEqId(eqid);
|
|||
|
|
}
|
|||
|
|
service.saveExamInfo1(unList);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//选项乱序
|
|||
|
|
public void operationList(List<QuestionBean> list) {
|
|||
|
|
for (QuestionBean q : list) {
|
|||
|
|
//获取每题选项
|
|||
|
|
String operation = q.getOperation();
|
|||
|
|
//System.out.println("题目选项数组:"+operation);
|
|||
|
|
//正则赛选出选项
|
|||
|
|
String[] oper = operation.split(";");
|
|||
|
|
|
|||
|
|
List<String> ope = new ArrayList<String>();
|
|||
|
|
List<OperationBean> opp = new ArrayList<OperationBean>();
|
|||
|
|
for(String op:oper) {
|
|||
|
|
ope.add(op);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for(String s:ope) {
|
|||
|
|
OperationBean operat = new OperationBean();
|
|||
|
|
operat.setId(s.substring(0, 1));
|
|||
|
|
operat.setContent(s.substring(1));
|
|||
|
|
operat.setNums(String.valueOf(ope.size()));
|
|||
|
|
opp.add(operat);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//System.out.println("选项集合"+opp);
|
|||
|
|
q.setOperationContent(opp);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@RequestMapping(value = "find", method = RequestMethod.POST)
|
|||
|
|
@ResponseBody
|
|||
|
|
public AjaxRes find(gradeBean o) {
|
|||
|
|
AjaxRes ar = getAjaxRes();
|
|||
|
|
try {
|
|||
|
|
List<gradeBean> list = service.find(o);
|
|||
|
|
gradeBean station = list.get(0);
|
|||
|
|
ar.setSucceed(station);
|
|||
|
|
} catch (Exception e) {
|
|||
|
|
logger.error(e.toString(), e);
|
|||
|
|
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
|||
|
|
}
|
|||
|
|
return ar;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
@RequestMapping("idCardFun")
|
|||
|
|
@ResponseBody
|
|||
|
|
public AjaxRes idCardFun(@Param("idCard") String idCard, Model model) {
|
|||
|
|
AjaxRes ar = getAjaxRes();
|
|||
|
|
try {
|
|||
|
|
CheckCard card = new CheckCard();
|
|||
|
|
boolean flag = card.verify(idCard);
|
|||
|
|
if(flag){
|
|||
|
|
ar.setSucceedMsg("身份证合法");
|
|||
|
|
}else {
|
|||
|
|
ar.setFailMsg("身份证不合法");
|
|||
|
|
}
|
|||
|
|
} catch(Exception e) {
|
|||
|
|
e.printStackTrace();
|
|||
|
|
}
|
|||
|
|
return ar;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|