mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-07 01:46:47 +08:00
Compare commits
8 Commits
dev0525
...
zcwy0912-l
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a8ce10c575 | ||
|
|
70a87ac812 | ||
|
|
5285506f0f | ||
|
|
33df8b0831 | ||
|
|
effb45c6d0 | ||
|
|
3af3c2eedf | ||
|
|
57e04f46c0 | ||
|
|
2e2edbbf57 |
@@ -9,6 +9,7 @@ import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -28,6 +29,7 @@ import com.xboe.module.course.service.ICourseFileService;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/xboe/m/course/cware")
|
||||
@Slf4j
|
||||
public class CourseWareApi extends ApiBaseController {
|
||||
|
||||
private String cookieName = "PLAYSIGN_TIME";
|
||||
@@ -131,6 +133,8 @@ public class CourseWareApi extends ApiBaseController {
|
||||
// 第一个/前端是时间
|
||||
int index = signStr.indexOf("/");
|
||||
if (index <= 0) {
|
||||
log.info("解密后的字符串:"+signStr);
|
||||
log.info("解密后的字符串的时间拼接:"+index);
|
||||
return badRequest("验证错误");
|
||||
}
|
||||
|
||||
@@ -138,9 +142,13 @@ public class CourseWareApi extends ApiBaseController {
|
||||
String cfid = signStr.substring(index+1);// 文件路径
|
||||
|
||||
if (!time.equals(cookieTime)) {
|
||||
log.info("请求头时间和解析后的时间对比:"+"解析时间:"+time+" 请求头时间:"+cookieTime);
|
||||
log.info("解密后的字符串的时间拼接:"+signStr);
|
||||
return badRequest("验证错误");
|
||||
}
|
||||
if(StringUtils.isBlank(cfid) || cfid.length()<10) {
|
||||
log.info("查看时间文件路径:"+cfid);
|
||||
log.info("解密后的字符串的时间拼接:"+signStr);
|
||||
return badRequest("验证错误");
|
||||
}
|
||||
|
||||
|
||||
@@ -355,17 +355,17 @@ public class AloneExamApi extends ApiBaseController {
|
||||
return badRequest("此考试无试卷内容,考试已经过期或试卷已被删除");
|
||||
}
|
||||
try {
|
||||
List<TestQuestionVo> qlist=this.randomQuestion(examTest, paperJson);
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
paperJson=objectMapper.writeValueAsString(qlist);
|
||||
} catch (XaskException e) {
|
||||
log.error("生成试卷错误",e);
|
||||
return error("生成考试试卷错误",e.getMessage(),map);
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("生成试卷,解析生成json错误",e);
|
||||
return error("生成考试试卷解析错误",e.getMessage(),map);
|
||||
}
|
||||
}
|
||||
List<TestQuestionVo> qlist=this.randomQuestion(examTest, paperJson);
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
paperJson=objectMapper.writeValueAsString(qlist);
|
||||
} catch (XaskException e) {
|
||||
log.error("生成试卷错误",e);
|
||||
return error("生成考试试卷错误",e.getMessage(),map);
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("生成试卷,解析生成json错误",e);
|
||||
return error("生成考试试卷解析错误",e.getMessage(),map);
|
||||
}
|
||||
}
|
||||
map.put("paper", paperJson);
|
||||
long end=System.currentTimeMillis();
|
||||
log.info("开始考试用时="+(end-start)+" ms");
|
||||
|
||||
@@ -170,7 +170,7 @@ public class ExamQuestionApi extends ApiBaseController {
|
||||
//从第二行开始获取数据
|
||||
List<ExamQuestion> examQuestions1 = new ArrayList<>();
|
||||
QuestionDto questionDto = new QuestionDto();
|
||||
if(sheetAt.getRow(1).getCell(1).getStringCellValue().equals("标题(*)")){
|
||||
if(sheetAt.getRow(1).getCell(0).getStringCellValue().equals("标题(*)") && !sheetAt.getRow(1).getCell(0).getStringCellValue().equals("")){
|
||||
row = sheetAt.getRow(1);
|
||||
for (int i = 2;i<sheetAt.getPhysicalNumberOfRows();i++) {
|
||||
//获取每一行
|
||||
@@ -190,45 +190,56 @@ public class ExamQuestionApi extends ApiBaseController {
|
||||
if(row1.getCell(1).getStringCellValue().equals("多选题")){
|
||||
examQuestion.setType(2);
|
||||
}
|
||||
examQuestion.setKnowledge(row1.getCell(2).getStringCellValue());
|
||||
if(row1.getCell(3).getStringCellValue().equals("中")){
|
||||
if(row1.getCell(2).getStringCellValue().equals("中")){
|
||||
examQuestion.setDifficulty(2f);
|
||||
}
|
||||
if(row1.getCell(3).getStringCellValue().equals("难")){
|
||||
}else if(row1.getCell(2).getStringCellValue().equals("难")){
|
||||
examQuestion.setDifficulty(3f);
|
||||
}
|
||||
if(row1.getCell(3).getStringCellValue().equals("低")){
|
||||
} else if(row1.getCell(2).getStringCellValue().equals("易")){
|
||||
examQuestion.setDifficulty(1f);
|
||||
}else if(row1.getCell(2).getStringCellValue().equals("")){
|
||||
examQuestion.setDifficulty(null);
|
||||
}
|
||||
Cell cell = row1.getCell(4);
|
||||
Cell cell = row1.getCell(3);
|
||||
cell.setCellType(CellType.STRING);
|
||||
|
||||
// examQuestion.setDefaultScore(Float.valueOf(cell.getStringCellValue()));
|
||||
|
||||
//单选
|
||||
if (!cell.getStringCellValue().contains(",")){
|
||||
examQuestion.setAnswer(row1.getCell(6).getStringCellValue());
|
||||
examQuestion.setDefaultScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
||||
Cell cell1 = row1.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||
examQuestion.setDefaultScore(null);
|
||||
}else {
|
||||
examQuestion.setDefaultScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||
}
|
||||
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||
|
||||
List<ExamOption> examOptions = new ArrayList<>();
|
||||
for (int j=7;j<=13;j++) {
|
||||
for (int j=6;j<=12;j++) {
|
||||
|
||||
if(row1.getCell(j)!=null) {
|
||||
ExamOption examOption = new ExamOption();
|
||||
// 截取表头
|
||||
String substring = row.getCell(j).getStringCellValue().substring(3, 4);
|
||||
if (row1.getCell(6).getStringCellValue().contains(substring)) {
|
||||
if (row1.getCell(5).getStringCellValue().contains(substring)) {
|
||||
|
||||
examOption.setIsAnswer(true);
|
||||
examOption.setScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
||||
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||
examOption.setScore(null);
|
||||
}else {
|
||||
examOption.setScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||
}
|
||||
} else {
|
||||
examOption.setIsAnswer(false);
|
||||
}
|
||||
if (examOption.getIsAnswer()) {
|
||||
examOption.setScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
||||
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||
examOption.setScore(null);
|
||||
}else {
|
||||
examOption.setScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||
}
|
||||
}
|
||||
|
||||
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||
@@ -258,19 +269,19 @@ public class ExamQuestionApi extends ApiBaseController {
|
||||
}
|
||||
}
|
||||
examQuestion.setDefaultScore(Float.valueOf(max));
|
||||
Cell cell1 = row1.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||
examQuestion.setAnswer(row1.getCell(6).getStringCellValue());
|
||||
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||
List<ExamOption> examOptions = new ArrayList<>();
|
||||
//A
|
||||
for (int j=7;j<=13;j++){
|
||||
for (int j=6;j<=12;j++){
|
||||
if(row1.getCell(j)!=null && StringUtil.isNotBlank(row1.getCell(j).getStringCellValue())){
|
||||
ExamOption examOption=new ExamOption();
|
||||
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||
examOption.setContent(row1.getCell(j).getStringCellValue());
|
||||
examOption.setIsAnswer(true);
|
||||
examOption.setScore(Float.valueOf(strings[j-7]));
|
||||
examOption.setScore(Float.valueOf(strings[j-6]));
|
||||
if(examOption!=null && StringUtil.isNotBlank(examOption.getContent())){
|
||||
examOptions.add(examOption);
|
||||
}
|
||||
@@ -301,45 +312,61 @@ public class ExamQuestionApi extends ApiBaseController {
|
||||
if(row1.getCell(1).getStringCellValue().equals("多选题")){
|
||||
examQuestion.setType(2);
|
||||
}
|
||||
examQuestion.setKnowledge(row1.getCell(2).getStringCellValue());
|
||||
if(row1.getCell(3).getStringCellValue().equals("中")){
|
||||
examQuestion.setDifficulty(2f);
|
||||
log.debug("row1.getCell(2) = " + row1.getCell(2));
|
||||
if (row1.getCell(2)==null ||row1.getCell(2).getStringCellValue() == null || row1.getCell(2).getStringCellValue().equals("")){
|
||||
examQuestion.setDifficulty(null);
|
||||
}else{
|
||||
if( row1.getCell(2).getStringCellValue().equals("中")){
|
||||
examQuestion.setDifficulty(2f);
|
||||
}else if(row1.getCell(2).getStringCellValue().equals("难")){
|
||||
examQuestion.setDifficulty(3f);
|
||||
} else if(row1.getCell(2).getStringCellValue().equals("易")){
|
||||
examQuestion.setDifficulty(1f);
|
||||
}else if(row1.getCell(2).getStringCellValue().equals("")){
|
||||
examQuestion.setDifficulty(null);
|
||||
}
|
||||
}
|
||||
if(row1.getCell(3).getStringCellValue().equals("难")){
|
||||
examQuestion.setDifficulty(3f);
|
||||
}
|
||||
if(row1.getCell(3).getStringCellValue().equals("低")){
|
||||
examQuestion.setDifficulty(1f);
|
||||
}
|
||||
Cell cell = row1.getCell(4);
|
||||
Cell cell = row1.getCell(3);
|
||||
cell.setCellType(CellType.STRING);
|
||||
|
||||
// examQuestion.setDefaultScore(Float.valueOf(cell.getStringCellValue()));
|
||||
|
||||
//单选
|
||||
if (!cell.getStringCellValue().contains(",")){
|
||||
examQuestion.setAnswer(row1.getCell(6).getStringCellValue());
|
||||
examQuestion.setDefaultScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
||||
Cell cell1 = row1.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||
examQuestion.setDefaultScore(null);
|
||||
}else {
|
||||
examQuestion.setDefaultScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||
}
|
||||
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||
|
||||
List<ExamOption> examOptions = new ArrayList<>();
|
||||
for (int j=7;j<=13;j++) {
|
||||
for (int j=6;j<=12;j++) {
|
||||
|
||||
if(row1.getCell(j)!=null) {
|
||||
ExamOption examOption = new ExamOption();
|
||||
// 截取表头
|
||||
String substring = row.getCell(j).getStringCellValue().substring(3, 4);
|
||||
if (row1.getCell(6).getStringCellValue().contains(substring)) {
|
||||
if (row1.getCell(5).getStringCellValue().contains(substring)) {
|
||||
|
||||
examOption.setIsAnswer(true);
|
||||
examOption.setScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
||||
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||
examOption.setScore(null);
|
||||
}else {
|
||||
examOption.setScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||
}
|
||||
} else {
|
||||
examOption.setIsAnswer(false);
|
||||
}
|
||||
if (examOption.getIsAnswer()) {
|
||||
examOption.setScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
||||
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||
examOption.setScore(null);
|
||||
}else {
|
||||
examOption.setScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||
}
|
||||
}
|
||||
|
||||
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||
@@ -369,19 +396,19 @@ public class ExamQuestionApi extends ApiBaseController {
|
||||
}
|
||||
}
|
||||
examQuestion.setDefaultScore(Float.valueOf(max));
|
||||
Cell cell1 = row1.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||
examQuestion.setAnswer(row1.getCell(6).getStringCellValue());
|
||||
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||
List<ExamOption> examOptions = new ArrayList<>();
|
||||
//A
|
||||
for (int j=7;j<=13;j++){
|
||||
for (int j=6;j<=13;j++){
|
||||
if(row1.getCell(j)!=null && StringUtil.isNotBlank(row1.getCell(j).getStringCellValue())){
|
||||
ExamOption examOption=new ExamOption();
|
||||
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||
examOption.setContent(row1.getCell(j).getStringCellValue());
|
||||
examOption.setIsAnswer(true);
|
||||
examOption.setScore(Float.valueOf(strings[j-7]));
|
||||
examOption.setScore(Float.valueOf(strings[j-6]));
|
||||
if(examOption!=null && StringUtil.isNotBlank(examOption.getContent())){
|
||||
examOptions.add(examOption);
|
||||
}
|
||||
@@ -413,27 +440,30 @@ public class ExamQuestionApi extends ApiBaseController {
|
||||
ExamQuestion examQuestion1 = new ExamQuestion();
|
||||
examQuestion1.setTitle(row2.getCell(0).getStringCellValue());
|
||||
examQuestion1.setType(3);
|
||||
examQuestion1.setKnowledge(row2.getCell(1).getStringCellValue());
|
||||
if(row2.getCell(2).getStringCellValue().equals("中")){
|
||||
System.out.println("1+++++++"+row2.getCell(1));
|
||||
if(row2.getCell(1).getStringCellValue().equals("中")){
|
||||
examQuestion1.setDifficulty(2f);
|
||||
}
|
||||
if(row2.getCell(2).getStringCellValue().equals("难")){
|
||||
}else if(row2.getCell(1).getStringCellValue().equals("难")){
|
||||
examQuestion1.setDifficulty(3f);
|
||||
}
|
||||
if(row2.getCell(2).getStringCellValue().equals("易")){
|
||||
} else if(row2.getCell(1).getStringCellValue().equals("易")){
|
||||
examQuestion1.setDifficulty(1f);
|
||||
}else if(row2.getCell(1).getStringCellValue().equals("")){
|
||||
examQuestion1.setDifficulty(null);
|
||||
}
|
||||
Cell cell1 = row2.getCell(3);
|
||||
Cell cell1 = row2.getCell(2);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
examQuestion1.setDefaultScore(Float.valueOf(cell1.getStringCellValue()));
|
||||
|
||||
if(row2.getCell(4)!=null) {
|
||||
examQuestion1.setAnalysis(row2.getCell(4).getStringCellValue());
|
||||
if (row2.getCell(2).getStringCellValue().isEmpty()){
|
||||
examQuestion1.setDefaultScore(null);
|
||||
}else {
|
||||
examQuestion1.setDefaultScore(Float.valueOf(row2.getCell(2).getStringCellValue()));
|
||||
}
|
||||
if(row2.getCell(3)!=null) {
|
||||
examQuestion1.setAnalysis(row2.getCell(3).getStringCellValue());
|
||||
}else {
|
||||
examQuestion1.setAnalysis("");
|
||||
}
|
||||
|
||||
String cvalue=row2.getCell(5).getStringCellValue();
|
||||
String cvalue=row2.getCell(4).getStringCellValue();
|
||||
examQuestion1.setAnswer(cvalue.equals("正确")? "true":"false");
|
||||
if(examQuestion1!=null){
|
||||
examQuestions2.add(examQuestion1);
|
||||
|
||||
Reference in New Issue
Block a user