Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一些简单BUG修改 #21

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 0 additions & 62 deletions README.md

This file was deleted.

6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
<scope>provided</scope>
</dependency>

</dependencies>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public String execute() throws Exception {
String qid = ctx.getParameters().get("qid").getValue();
logger.info("根据id查找填空题详细信息");
question = bankQuestionDao.findBlankFillingById(Integer.parseInt(qid.trim()));

return SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import javax.annotation.Resource;

import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
Expand All @@ -16,56 +17,21 @@

@Component("blankQuestionSearch")
@Scope("prototype")
@Data
public class BlankQuestionSearchAction extends ActionSupport{
private static final long serialVersionUID = -1106576639902301220L;
private final static Logger logger = LoggerFactory.getLogger(BlankQuestionSearchAction.class);
private String contentSearch;
private String answerSearch;
private String knowledgeSearch;
private String CourseSearch;
private List<BankBlankFillingQuestion> questionList;
private int totalPage;
private int pageIndex;
private static final int PAGE_SIZE = 10;

public int[] blankChecked;
@Resource
private BankQuestionDao bankQuestionDao;

public String getContentSearch() {
return contentSearch;
}
public void setContentSearch(String contentSearch) {
this.contentSearch = contentSearch;
}
public String getAnswerSearch() {
return answerSearch;
}
public void setAnswerSearch(String answerSearch) {
this.answerSearch = answerSearch;
}
public String getKnowledgeSearch() {
return knowledgeSearch;
}
public void setKnowledgeSearch(String knowledgeSearch) {
this.knowledgeSearch = knowledgeSearch;
}
public List<BankBlankFillingQuestion> getQuestionList() {
return questionList;
}
public void setQuestionList(List<BankBlankFillingQuestion> questionList) {
this.questionList = questionList;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getPageIndex() {
return pageIndex;
}
public void setPageIndex(int pageIndex) {
this.pageIndex = pageIndex;
}
@Override
public String execute() throws Exception {//初始结果
// questionList = bankQuestionDao.findAllBlankFilling();
Expand All @@ -79,7 +45,16 @@ public String executeForSearch(){//搜索后结果
logger.debug("contentSearch="+contentSearch);
logger.debug("answerSearch="+answerSearch);
logger.debug("knowledgeSearch="+knowledgeSearch);
logger.debug("CourseSearch", CourseSearch);
questionList = bankQuestionDao.findBlankForSearch(contentSearch,answerSearch,knowledgeSearch);
return SUCCESS;
}

public String deleteQuestion(){
for (int cid:blankChecked){
logger.info("删除id为"+cid+"的填空题");
bankQuestionDao.delete(bankQuestionDao.findBlankFillingById(cid));
}
return SUCCESS;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package cn.lynu.lyq.java_exam.actions;

import java.util.Arrays;
import java.util.List;

import javax.annotation.Resource;

import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
Expand All @@ -15,6 +17,7 @@
import cn.lynu.lyq.java_exam.entity.BankChoiceQuestion;
@Component("choiceQuestionSearch")
@Scope("prototype")
@Data
public class ChoiceQuestionSearchAction extends ActionSupport{
private static final long serialVersionUID = -1106576639902301220L;
private final static Logger logger = LoggerFactory.getLogger(ChoiceQuestionSearchAction.class);
Expand All @@ -23,90 +26,17 @@ public class ChoiceQuestionSearchAction extends ActionSupport{
private String answerSearch;
private String answerSearch2;//对于checkbox不选时,不提交的问题,做判断修正
private String knowledgeSearch;
private String CourseSearch;
private List<BankChoiceQuestion> questionList;
private int totalPage;
private int pageIndex;
private static final int PAGE_SIZE = 10;

@Resource
private BankQuestionDao bankQuestionDao;

public String getContentSearch() {
return contentSearch;
}

public void setContentSearch(String contentSearch) {
logger.debug("setting contentSearch========================"+contentSearch);
this.contentSearch = contentSearch;
}

public String getChoiceSearch() {
return choiceSearch;
}

public void setChoiceSearch(String choiceSearch) {
this.choiceSearch = choiceSearch;
}

public String getAnswerSearch() {
return answerSearch;
}

public void setAnswerSearch(String answerSearch) {
this.answerSearch = answerSearch;
}

public String getAnswerSearch2() {
return answerSearch2;
}

public void setAnswerSearch2(String answerSearch2) {
logger.debug("setting answerSearch2========================"+answerSearch2);
this.answerSearch2 = answerSearch2;
}

public String getKnowledgeSearch() {
return knowledgeSearch;
}

public void setKnowledgeSearch(String knowledgeSearch) {
this.knowledgeSearch = knowledgeSearch;
}

public List<BankChoiceQuestion> getQuestionList() {
return questionList;
}

public void setQuestionList(List<BankChoiceQuestion> questionList) {
this.questionList = questionList;
}

public int getTotalPage() {
return totalPage;
}

public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}

public int getPageIndex() {
return pageIndex;
}

public void setPageIndex(int pageIndex) {
this.pageIndex = pageIndex;
}

public int[] choiceChecked;
@Override
public String execute() throws Exception {//初始结果
// contentSearch="";
// choiceSearch="";
// answerSearch="";
// answerSearch2="";
// knowledgeSearch="";

// questionList = bankQuestionDao.findAllChoice();


int totalCnt = bankQuestionDao.countAllChoice();
totalPage = (totalCnt%PAGE_SIZE > 0)?(totalCnt/PAGE_SIZE+1):(totalCnt/PAGE_SIZE);
questionList = bankQuestionDao.findAllChoiceWithPage(pageIndex,PAGE_SIZE);
Expand All @@ -122,9 +52,18 @@ public String executeForSearch(){//搜索后结果
logger.debug("answerSearch="+answerSearch);
logger.debug("answerSearch2="+answerSearch2);
logger.debug("knowledgeSearch="+knowledgeSearch);
logger.debug("CourseSearch", CourseSearch);
questionList = bankQuestionDao.findChoiceForSearch(contentSearch,choiceSearch,answerSearch,knowledgeSearch);
return SUCCESS;
}

public String deleteQuestion(){
// bankQuestionDao.delete(bankQuestionDao.findJudgeById(1))
for (int cid:choiceChecked){
logger.info("删除id为"+cid+"的选择题");
bankQuestionDao.delete(bankQuestionDao.findChoiceById(cid));
}
return SUCCESS;
}

}
63 changes: 63 additions & 0 deletions src/main/java/cn/lynu/lyq/java_exam/actions/CourseAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package cn.lynu.lyq.java_exam.actions;

import cn.lynu.lyq.java_exam.dao.CourseDao;
import cn.lynu.lyq.java_exam.entity.Course;
import com.opensymphony.xwork2.ActionSupport;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component("Course")
@Scope("prototype")
@EqualsAndHashCode(callSuper = true)
@Slf4j
@Data
public class CourseAction extends ActionSupport {
@Resource
private CourseDao courseDao;
private List<Course> courses;
private String name;
private int totalPage;
private int courseId;
private int pageIndex;
private static final int PAGE_SIZE = 10;
private String actionName = "addCourse";

@Override
public String execute() throws Exception {
int totalCnt = courseDao.countAllCourse();
totalPage = (totalCnt % PAGE_SIZE > 0) ? (totalCnt / PAGE_SIZE + 1) : (totalCnt / PAGE_SIZE);
courses = courseDao.findAllWithPage(pageIndex, PAGE_SIZE);
return SUCCESS;
}

public String delCourse() throws Exception {
courseDao.delete(courseDao.findById(courseId));
log.info("删除id为" + courseId + "的课程");
return SUCCESS;
}

public String update() throws Exception {
Course course = courseDao.findById(courseId);
course.setName(name);
courseDao.update(course);
return SUCCESS;
}

public String updatePage() throws Exception {
Course course = courseDao.findById(courseId);
name = course.getName();
courseId = courseId;
return SUCCESS;
}

public String create() throws Exception {
courseDao.save(new Course(name));
return SUCCESS;
}
}
15 changes: 11 additions & 4 deletions src/main/java/cn/lynu/lyq/java_exam/actions/ExamHandInAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,20 @@ public String execute() throws Exception {
return ERROR;
}else{
// int scorePerChoice = 10, scorePerBlank = 5, scorePerJudge = 10;
String examStrategyIds = (String)session.get("EXAM_STRATEGY_ID");
int examStrategyId = Integer.parseInt(examStrategyIds);
ExamStrategy strategy= examStrategyDao.findById(examStrategyId);
// String examStrategyIds = (String)session.get("EXAM_STRATEGY_ID");
// int examStrategyId = Integer.parseInt(examStrategyIds);
List<ExamStrategy> strategys = examStrategyDao.findByExam(theExam);
ExamStrategy strategy;
if (strategys.size() > 0){
strategy = strategys.get(0);
} else {
this.addActionError("问卷未添加分数分配策略,请联系管理员添加");
return ERROR;
}

int scorePerChoice = strategy.getChoicePerScore();
int scorePerBlank = strategy.getBlankPerScore();
int scorePerJudge = strategy.getJudgePerScore();

List<Object> choiceAnswerList = answerMap.get(QuestionType.CHOICE);
List<Object> choiceSubmittedList = submitMap.get(QuestionType.CHOICE);
for(int i=0; choiceAnswerList!=null && i<choiceAnswerList.size(); i++){
Expand Down
Loading