配置上传

master
yz 8 months ago
parent b109048649
commit eeb745dfe7

@ -38,6 +38,6 @@ public class Constant {
public static final String THEORY = "理论考试模块"; public static final String THEORY = "理论考试模块";
public static final String RESOURCE = "资源中心模块"; public static final String RESOURCE = "资源中心模块";
public static final String API_URL = "http://120.79.54.255:8889"; public static final String API_URL = "http://120.79.54.255:8889";
// public static final String API_URL = "http://192.168.2.11:8889"; // public static final String API_URL = "http://192.168.2.29:8889";
} }

@ -244,7 +244,7 @@ public class TeaGradeManageController {
List<String> list = Arrays.asList(caseIdList.split(",")); List<String> list = Arrays.asList(caseIdList.split(","));
List<TestTestSysCaseQuestionStepWithBLOBs> resultList = null; List<TestTestSysCaseQuestionStepWithBLOBs> resultList = null;
try { try {
resultList = CaseApi.getGradeReportCase(list, schoolId, systemOwner); resultList = CaseApi.getGradeReportCase(list, schoolId,systemOwner);
} catch (IOException e) { } catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常"); return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常");
} }

@ -323,10 +323,10 @@ public class CaseApi {
* *
* --questionOriginalcontentOriginal,Sort * --questionOriginalcontentOriginal,Sort
*/ */
public static List<TestTestSysCaseQuestionStepWithBLOBs> getGradeReportCase(List<String> caseIdList, String schoolId, String systemOwner) throws IOException { public static List<TestTestSysCaseQuestionStepWithBLOBs> getGradeReportCase(List<String> caseIdList, String schoolId,String systemOwner) throws IOException {
Gson gson = new Gson(); Gson gson = new Gson();
// 构建带有 schoolId 的 URL // 构建带有 schoolId 的 URL
String urlWithParams = getGradeReportCase + "?schoolId=" + URLEncoder.encode(schoolId, "UTF-8"); String urlWithParams = getGradeReportCase + "?schoolId=" + URLEncoder.encode(schoolId, "UTF-8")+"&systemOwner="+ systemOwner;
JSONObject object = HttpUtils.sendPost( JSONObject object = HttpUtils.sendPost(
urlWithParams, urlWithParams,
gson.toJson(caseIdList), "application/json", null); gson.toJson(caseIdList), "application/json", null);

@ -30,13 +30,13 @@ public class ResourceCenterApi {
* local: * local:
* rsapi: * rsapi:
*/ */
public static Boolean uploadResource(MultipartFile file, String schoolId, String courseId,String type,String systemOwner,String courseName) throws IOException { public static Boolean uploadResource(MultipartFile file, String schoolId, String courseId, String type, String systemOwner, String courseName) throws IOException {
String returnStr = HttpUtils.sendPostRequestWithMultipartFile( String returnStr = HttpUtils.sendPostRequestWithMultipartFile(
uploadResource + "?schoolId=" + schoolId+"&twoId="+courseId+"&resourceType="+type+"&systemOwner="+systemOwner+"&twoName"+courseName, uploadResource + "?schoolId=" + schoolId + "&twoId=" + courseId + "&resourceType=" + type + "&systemOwner=" + systemOwner + "&twoName" + courseName,
file); file);
if("true".equals(returnStr)){ if ("true".equals(returnStr)) {
return true; return true;
}else { } else {
return false; return false;
} }
} }
@ -45,15 +45,16 @@ public class ResourceCenterApi {
* local: * local:
* rsapi: * rsapi:
*/ */
public static List<SysResource> selectResource(String schoolId, String courseId,String systemOwner) throws IOException { public static List<SysResource> selectResource(String schoolId, String courseId, String systemOwner) throws IOException {
String requestBody="schoolId="+schoolId+"&twoId="+courseId+"&oneId="+systemOwner; String requestBody = "schoolId=" + schoolId + "&twoId=" + courseId + "&oneId=" + systemOwner;
JSONObject object = HttpUtils.sendPost( JSONObject object = HttpUtils.sendPost(
selectResource, selectResource,
requestBody); requestBody);
Gson gson = new GsonBuilder() Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter()) .registerTypeAdapter(Date.class, new DateTypeAdapter())
.create(); .create();
Type listType = new TypeToken<List<SysResource>>() {}.getType(); Type listType = new TypeToken<List<SysResource>>() {
}.getType();
List<SysResource> resourceList = gson.fromJson(object.get("respString").toString(), listType); List<SysResource> resourceList = gson.fromJson(object.get("respString").toString(), listType);
return resourceList; return resourceList;
} }
@ -63,15 +64,16 @@ public class ResourceCenterApi {
* rsapi: * rsapi:
*/ */
public static List<SysResource> selectResourceByChapterId(String chapterId,String systemOwner) throws IOException { public static List<SysResource> selectResourceByChapterId(String chapterId, String systemOwner) throws IOException {
String requestBody="threeId="+chapterId+"&oneId="+systemOwner; String requestBody = "threeId=" + chapterId + "&oneId=" + systemOwner;
JSONObject object = HttpUtils.sendPost( JSONObject object = HttpUtils.sendPost(
selectResourceByChapterId, selectResourceByChapterId,
requestBody); requestBody);
Gson gson = new GsonBuilder() Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter()) .registerTypeAdapter(Date.class, new DateTypeAdapter())
.create(); .create();
Type listType = new TypeToken<List<SysResource>>() {}.getType(); Type listType = new TypeToken<List<SysResource>>() {
}.getType();
List<SysResource> resourceList = gson.fromJson(object.get("respString").toString(), listType); List<SysResource> resourceList = gson.fromJson(object.get("respString").toString(), listType);
return resourceList; return resourceList;
} }
@ -82,15 +84,15 @@ public class ResourceCenterApi {
* rsapi: * rsapi:
*/ */
public static void downloadResource(String resourceDataName, String resourceId, HttpServletResponse response) throws Exception { public static void downloadResource(String resourceDataName, String resourceId, HttpServletResponse response) throws Exception {
String downloadResourceUrl = downloadResource+"?resourceId=" + resourceId; String downloadResourceUrl = downloadResource + "?resourceId=" + resourceId;
DownLoadUtil.downLoadFile(downloadResourceUrl,resourceDataName,response); DownLoadUtil.downLoadFile(downloadResourceUrl, resourceDataName, response);
} }
/** /**
* *
*/ */
public static Map<String,Integer> getResourceTypeCount(String schoolId ,String systemOwner){ public static Map<String, Integer> getResourceTypeCount(String schoolId, String systemOwner) {
String requestBody="schoolId="+schoolId+"&systemOwner="+systemOwner; String requestBody = "schoolId=" + schoolId + "&systemOwner=" + systemOwner;
JSONObject object = null; JSONObject object = null;
try { try {
object = HttpUtils.sendPost( object = HttpUtils.sendPost(
@ -99,22 +101,23 @@ public class ResourceCenterApi {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
if(object==null){ if (object == null) {
return new HashMap<>(); return new HashMap<>();
} }
Gson gson = new GsonBuilder() Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter()) .registerTypeAdapter(Date.class, new DateTypeAdapter())
.create(); .create();
Type listType = new TypeToken<Map<String,Integer>>() {}.getType(); Type listType = new TypeToken<Map<String, Integer>>() {
Map<String,Integer> map = gson.fromJson(object.get("respString").toString(), listType); }.getType();
Map<String, Integer> map = gson.fromJson(object.get("respString").toString(), listType);
return map; return map;
} }
/** /**
* *
*/ */
public static Integer getTotalResource(String systemOwner,String schoolId) throws IOException { public static Integer getTotalResource(String systemOwner, String schoolId) throws IOException {
String requestBody="schoolId="+schoolId+"&systemOwner="+systemOwner; String requestBody = "schoolId=" + schoolId + "&systemOwner=" + systemOwner;
JSONObject object = HttpUtils.sendPost( JSONObject object = HttpUtils.sendPost(
getTotalResource, getTotalResource,
requestBody); requestBody);
@ -125,8 +128,8 @@ public class ResourceCenterApi {
/** /**
* *
*/ */
public static String getMostPopularName(String systemOwner,String schoolId) throws IOException { public static String getMostPopularName(String systemOwner, String schoolId) throws IOException {
String requestBody="schoolId="+schoolId+"&systemOwner="+systemOwner; String requestBody = "schoolId=" + schoolId + "&systemOwner=" + systemOwner;
JSONObject object = HttpUtils.sendPost( JSONObject object = HttpUtils.sendPost(
getMostPopularName, getMostPopularName,
requestBody); requestBody);

@ -1,6 +1,5 @@
package com.sztzjy.financial_bigdata.service.stu.impl; package com.sztzjy.financial_bigdata.service.stu.impl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.sztzjy.financial_bigdata.config.Constant; import com.sztzjy.financial_bigdata.config.Constant;
@ -11,7 +10,6 @@ import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestDto;
import com.sztzjy.financial_bigdata.mapper.*; import com.sztzjy.financial_bigdata.mapper.*;
import com.sztzjy.financial_bigdata.resourceCenterAPI.ObjectiveApi; import com.sztzjy.financial_bigdata.resourceCenterAPI.ObjectiveApi;
import com.sztzjy.financial_bigdata.service.stu.ITheoryTestService; import com.sztzjy.financial_bigdata.service.stu.ITheoryTestService;
import com.sztzjy.financial_bigdata.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -37,25 +35,25 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
// 之前没有进行考试 从客观题库表中查询 35道单选每题2分5道多选每题4分10道判断每题1分 并将id保存至理论考试表中 // 之前没有进行考试 从客观题库表中查询 35道单选每题2分5道多选每题4分10道判断每题1分 并将id保存至理论考试表中
// 注意 开始考试后 要生成理论记录表基础数据 // 注意 开始考试后 要生成理论记录表基础数据
@Override @Override
public List<SysObjectiveQuestions> startTheoryTest(String userId,String systemOwner) throws IOException { public List<SysObjectiveQuestions> startTheoryTest(String userId, String systemOwner) throws IOException {
StuTheoryExamExample example = new StuTheoryExamExample(); StuTheoryExamExample example = new StuTheoryExamExample();
example.createCriteria().andUserIdEqualTo(userId); example.createCriteria().andUserIdEqualTo(userId);
example.setOrderByClause("exam_time DESC"); example.setOrderByClause("exam_time DESC");
List<StuTheoryExamWithBLOBs> stuTheoryExams = theoryExamMapper.selectByExampleWithBLOBs(example); List<StuTheoryExamWithBLOBs> stuTheoryExams = theoryExamMapper.selectByExampleWithBLOBs(example);
if (stuTheoryExams.isEmpty()) { //之前没有进行考试 if (stuTheoryExams.isEmpty()) { //之前没有进行考试
List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId,systemOwner); List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId, systemOwner);
GenerateTheoryRecordFirst(userId); GenerateTheoryRecordFirst(userId, systemOwner);
return objectiveQuestionList; return objectiveQuestionList;
} else { //根据考试时间排序 查询最近的一条 } else { //根据考试时间排序 查询最近的一条
StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0); StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0);
Date currentTime = new Date(); Date currentTime = new Date();
Date twoHoursAgo = new Date(currentTime.getTime() - (2 * 60 * 60 * 1000)); // 当前时间减去两个小时 Date twoHoursAgo = new Date(currentTime.getTime() - (2 * 60 * 60 * 1000)); // 当前时间减去两个小时
if(stuTheoryExam.getAnswered()){ if (stuTheoryExam.getAnswered()) {
List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId,systemOwner); List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId, systemOwner);
return objectiveQuestionList; return objectiveQuestionList;
} }
if (stuTheoryExam.getExamTime().before(twoHoursAgo)) { //已超出两个小时 从新生成新试卷 if (stuTheoryExam.getExamTime().before(twoHoursAgo)) { //已超出两个小时 从新生成新试卷
List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId,systemOwner); List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId, systemOwner);
return objectiveQuestionList; return objectiveQuestionList;
} else { //在两个小时内 返回最近的一条试卷 } else { //在两个小时内 返回最近的一条试卷
String singleIds = stuTheoryExam.getSingleIds(); String singleIds = stuTheoryExam.getSingleIds();
@ -77,9 +75,9 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
} }
//第一次生成理论考试记录数据 先判断是否生成过理论考试记录数据 //第一次生成理论考试记录数据 先判断是否生成过理论考试记录数据
public void GenerateTheoryRecordFirst(String userId){ public void GenerateTheoryRecordFirst(String userId, String systemOwner) {
StuTheoryRecord record = theoryRecordMapper.selectByPrimaryKey(userId); StuTheoryRecord record = theoryRecordMapper.selectByPrimaryKey(userId);
if(record==null){ if (record == null) {
StuUser stuUser = userMapper.selectByPrimaryKey(userId); StuUser stuUser = userMapper.selectByPrimaryKey(userId);
StuTheoryRecord stuTheoryRecord = new StuTheoryRecord(); StuTheoryRecord stuTheoryRecord = new StuTheoryRecord();
stuTheoryRecord.setUserId(userId); stuTheoryRecord.setUserId(userId);
@ -88,36 +86,37 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
stuTheoryRecord.setName(stuUser.getName()); stuTheoryRecord.setName(stuUser.getName());
stuTheoryRecord.setStudentId(stuUser.getStudentId()); stuTheoryRecord.setStudentId(stuUser.getStudentId());
stuTheoryRecord.setExamCount(0); stuTheoryRecord.setExamCount(0);
stuTheoryRecord.setSystemOwner(systemOwner);
theoryRecordMapper.insert(stuTheoryRecord); theoryRecordMapper.insert(stuTheoryRecord);
} }
} }
public void UpdateTheoryRecord(String userId,BigDecimal score,Integer examDuration){ public void UpdateTheoryRecord(String userId, BigDecimal score, Integer examDuration) {
StuTheoryRecord record = theoryRecordMapper.selectByPrimaryKey(userId); StuTheoryRecord record = theoryRecordMapper.selectByPrimaryKey(userId);
if(record!=null){ if (record != null) {
record.setExamCount(record.getExamCount()+1); record.setExamCount(record.getExamCount() + 1);
if(record.getHighestScore()==null){ if (record.getHighestScore() == null) {
record.setHighestScore(score); record.setHighestScore(score);
}else { } else {
if(record.getHighestScore().compareTo(score)<0){ if (record.getHighestScore().compareTo(score) < 0) {
record.setHighestScore(score); record.setHighestScore(score);
} }
} }
if(record.getLowestScore()==null){ if (record.getLowestScore() == null) {
record.setLowestScore(score); record.setLowestScore(score);
}else { } else {
if(record.getLowestScore().compareTo(score)>0){ if (record.getLowestScore().compareTo(score) > 0) {
record.setLowestScore(score); record.setLowestScore(score);
} }
} }
if(record.getTotalDuration()==null){ if (record.getTotalDuration() == null) {
record.setTotalDuration(examDuration); record.setTotalDuration(examDuration);
}else { } else {
record.setTotalDuration(examDuration+record.getTotalDuration()); record.setTotalDuration(examDuration + record.getTotalDuration());
} }
if(record.getAverageScore()==null){ if (record.getAverageScore() == null) {
record.setAverageScore(score); record.setAverageScore(score);
}else { } else {
Integer examCount = record.getExamCount(); Integer examCount = record.getExamCount();
BigDecimal averageScore = record.getAverageScore(); BigDecimal averageScore = record.getAverageScore();
BigDecimal multiply = averageScore.multiply(BigDecimal.valueOf(examCount)); BigDecimal multiply = averageScore.multiply(BigDecimal.valueOf(examCount));
@ -130,11 +129,11 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
//随机生成100分题目 //随机生成100分题目
public List<SysObjectiveQuestions> GenerateTest(String userId,String systemOwner) throws IOException { public List<SysObjectiveQuestions> GenerateTest(String userId, String systemOwner) throws IOException {
List<SysObjectiveQuestions> objectiveQuestionList1 = ObjectiveApi.selectRandomObjectiveSingle(systemOwner); List<SysObjectiveQuestions> objectiveQuestionList1 = ObjectiveApi.selectRandomObjectiveSingle(systemOwner);
List<SysObjectiveQuestions> objectiveQuestionList2 = ObjectiveApi.selectRandomObjectiveMany(systemOwner); List<SysObjectiveQuestions> objectiveQuestionList2 = ObjectiveApi.selectRandomObjectiveMany(systemOwner);
List<SysObjectiveQuestions> objectiveQuestionList3 = ObjectiveApi.selectRandomObjectiveJudge(systemOwner); List<SysObjectiveQuestions> objectiveQuestionList3 = ObjectiveApi.selectRandomObjectiveJudge(systemOwner);
List<SysObjectiveQuestions> objectiveQuestionList=new ArrayList<>(); List<SysObjectiveQuestions> objectiveQuestionList = new ArrayList<>();
objectiveQuestionList.addAll(objectiveQuestionList1); objectiveQuestionList.addAll(objectiveQuestionList1);
objectiveQuestionList.addAll(objectiveQuestionList2); objectiveQuestionList.addAll(objectiveQuestionList2);
objectiveQuestionList.addAll(objectiveQuestionList3); objectiveQuestionList.addAll(objectiveQuestionList3);
@ -202,7 +201,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
errorMapper.insert(stuError); errorMapper.insert(stuError);
} else { } else {
StuErrorWithBLOBs stuError = stuErrors.get(0); StuErrorWithBLOBs stuError = stuErrors.get(0);
if (stuError.getSingleIds()!=null) { if (stuError.getSingleIds() != null) {
List<String> stringList = Arrays.asList(stuError.getSingleIds().substring(1, stuError.getSingleIds().length() - 1).split(", ")); List<String> stringList = Arrays.asList(stuError.getSingleIds().substring(1, stuError.getSingleIds().length() - 1).split(", "));
List<String> singleErrorIds = theoryTestDto.getSingleErrorIds(); List<String> singleErrorIds = theoryTestDto.getSingleErrorIds();
@ -214,7 +213,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
} else { } else {
stuError.setSingleIds(String.valueOf(theoryTestDto.getSingleErrorIds())); stuError.setSingleIds(String.valueOf(theoryTestDto.getSingleErrorIds()));
} }
if (stuError.getMultipleIds()!=null) { if (stuError.getMultipleIds() != null) {
List<String> stringList = Arrays.asList(stuError.getMultipleIds().substring(1, stuError.getMultipleIds().length() - 1).split(", ")); List<String> stringList = Arrays.asList(stuError.getMultipleIds().substring(1, stuError.getMultipleIds().length() - 1).split(", "));
List<String> multipleErrorIds = theoryTestDto.getMultipleErrorIds(); List<String> multipleErrorIds = theoryTestDto.getMultipleErrorIds();
@ -226,7 +225,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
} else { } else {
stuError.setMultipleIds(String.valueOf(theoryTestDto.getMultipleErrorIds())); stuError.setMultipleIds(String.valueOf(theoryTestDto.getMultipleErrorIds()));
} }
if (stuError.getJudgeIds()!=null) { if (stuError.getJudgeIds() != null) {
List<String> stringList = Arrays.asList(stuError.getJudgeIds().substring(1, stuError.getJudgeIds().length() - 1).split(", ")); List<String> stringList = Arrays.asList(stuError.getJudgeIds().substring(1, stuError.getJudgeIds().length() - 1).split(", "));
List<String> judgeErrorIds = theoryTestDto.getJudgeErrorIds(); List<String> judgeErrorIds = theoryTestDto.getJudgeErrorIds();
List<String> combinedList = new ArrayList<>(stringList); List<String> combinedList = new ArrayList<>(stringList);
@ -239,12 +238,12 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
} }
errorMapper.updateByPrimaryKey(stuError); errorMapper.updateByPrimaryKey(stuError);
} }
UpdateTheoryRecord(theoryTestDto.getUserId(),theoryTestDto.getScore(),theoryTestDto.getExamDuration()); UpdateTheoryRecord(theoryTestDto.getUserId(), theoryTestDto.getScore(), theoryTestDto.getExamDuration());
return i; return i;
} }
@Override @Override
public List<SysObjectiveQuestions> selectErrors(String userId,String schoolId,String systemOwner) throws IOException { public List<SysObjectiveQuestions> selectErrors(String userId, String schoolId, String systemOwner) throws IOException {
StuErrorExample example = new StuErrorExample(); StuErrorExample example = new StuErrorExample();
example.createCriteria().andUserIdEqualTo(userId); example.createCriteria().andUserIdEqualTo(userId);
List<StuErrorWithBLOBs> stuErrors = errorMapper.selectByExampleWithBLOBs(example); List<StuErrorWithBLOBs> stuErrors = errorMapper.selectByExampleWithBLOBs(example);
@ -294,9 +293,9 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
List<String> stringList = Arrays.asList(error.getSingleIds().substring(1, stuErrors.get(0).getSingleIds().length() - 1).split(", ")); List<String> stringList = Arrays.asList(error.getSingleIds().substring(1, stuErrors.get(0).getSingleIds().length() - 1).split(", "));
Set<String> set = new LinkedHashSet<>(stringList); Set<String> set = new LinkedHashSet<>(stringList);
set.remove(objectiveQuestionId); set.remove(objectiveQuestionId);
if(set.isEmpty()){ if (set.isEmpty()) {
error.setSingleIds(null); error.setSingleIds(null);
}else { } else {
List<String> list = new ArrayList<>(set); List<String> list = new ArrayList<>(set);
error.setSingleIds(String.valueOf(list)); error.setSingleIds(String.valueOf(list));
} }
@ -304,25 +303,25 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
if (Constant.OBJECTIVE_TYPE_Many.equals(type)) { if (Constant.OBJECTIVE_TYPE_Many.equals(type)) {
Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getMultipleIds().substring(1, error.getMultipleIds().length() - 1).split(", "))); Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getMultipleIds().substring(1, error.getMultipleIds().length() - 1).split(", ")));
set.remove(objectiveQuestionId); set.remove(objectiveQuestionId);
if(set.isEmpty()){ if (set.isEmpty()) {
error.setMultipleIds(null); error.setMultipleIds(null);
}else { } else {
List<String> list = new ArrayList<>(set); List<String> list = new ArrayList<>(set);
error.setMultipleIds(String.valueOf(list)); error.setMultipleIds(String.valueOf(list));
} }
} }
if(Constant.OBJECTIVE_TYPE_JUDGE.equals(type)){ if (Constant.OBJECTIVE_TYPE_JUDGE.equals(type)) {
Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getJudgeIds().substring(1, error.getJudgeIds().length() - 1).split(", "))); Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getJudgeIds().substring(1, error.getJudgeIds().length() - 1).split(", ")));
set.remove(objectiveQuestionId); set.remove(objectiveQuestionId);
if(set.isEmpty()){ if (set.isEmpty()) {
error.setJudgeIds(null); error.setJudgeIds(null);
}else { } else {
List<String> list = new ArrayList<>(set); List<String> list = new ArrayList<>(set);
error.setJudgeIds(String.valueOf(list)); error.setJudgeIds(String.valueOf(list));
} }
} }
int i = errorMapper.updateByPrimaryKeyWithBLOBs(error); int i = errorMapper.updateByPrimaryKeyWithBLOBs(error);
return i==1; return i == 1;
} }
@Override @Override
@ -337,7 +336,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
} }
@Override @Override
public List<StuTheoryExamDetailDto> getTheoryTestDetail(String theoryExamId, Integer index, Integer size,String schoolId,String systemOwner) throws IOException { public List<StuTheoryExamDetailDto> getTheoryTestDetail(String theoryExamId, Integer index, Integer size, String schoolId, String systemOwner) throws IOException {
StuTheoryExamWithBLOBs theoryExam = theoryExamMapper.selectByPrimaryKey(theoryExamId); StuTheoryExamWithBLOBs theoryExam = theoryExamMapper.selectByPrimaryKey(theoryExamId);
String singleIds = theoryExam.getSingleIds(); String singleIds = theoryExam.getSingleIds();
ArrayList<String> idsList = new ArrayList<>(); ArrayList<String> idsList = new ArrayList<>();
@ -350,7 +349,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
idsList.addAll(multipleIdList); idsList.addAll(multipleIdList);
idsList.addAll(judgeIdList); idsList.addAll(judgeIdList);
ArrayList<String> answerList = new ArrayList<>(); ArrayList<String> answerList = new ArrayList<>();
if(theoryExam.getSingleStuAnswer()!=null){ if (theoryExam.getSingleStuAnswer() != null) {
String[] singleSplit = theoryExam.getSingleStuAnswer().substring(1, theoryExam.getSingleStuAnswer().length() - 1).split(","); String[] singleSplit = theoryExam.getSingleStuAnswer().substring(1, theoryExam.getSingleStuAnswer().length() - 1).split(",");
for (String str : singleSplit) { for (String str : singleSplit) {
if (str.equals("") || str.equals(" ")) { if (str.equals("") || str.equals(" ")) {
@ -360,7 +359,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
} }
} }
} }
if(theoryExam.getMultipleStuAnswer()!=null){ if (theoryExam.getMultipleStuAnswer() != null) {
String[] multipleSplit = theoryExam.getMultipleStuAnswer().substring(1, theoryExam.getMultipleStuAnswer().length() - 1).split(","); String[] multipleSplit = theoryExam.getMultipleStuAnswer().substring(1, theoryExam.getMultipleStuAnswer().length() - 1).split(",");
for (String str : multipleSplit) { for (String str : multipleSplit) {
if (str.equals("") || str.equals(" ")) { if (str.equals("") || str.equals(" ")) {
@ -371,7 +370,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
} }
} }
} }
if(theoryExam.getJudgeStuAnswer()!=null){ if (theoryExam.getJudgeStuAnswer() != null) {
String[] judgeSplit = theoryExam.getJudgeStuAnswer().substring(1, theoryExam.getJudgeStuAnswer().length() - 1).split(","); String[] judgeSplit = theoryExam.getJudgeStuAnswer().substring(1, theoryExam.getJudgeStuAnswer().length() - 1).split(",");
for (String str : judgeSplit) { for (String str : judgeSplit) {
if (str.equals("") || str.equals(" ")) { if (str.equals("") || str.equals(" ")) {
@ -381,17 +380,17 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
} }
} }
} }
List<StuTheoryExamDetailDto> detailDtos=new ArrayList<>(); List<StuTheoryExamDetailDto> detailDtos = new ArrayList<>();
if(answerList.size()==0){ if (answerList.size() == 0) {
return null; return null;
} }
for (int i = 0; i < answerList.size(); i++) { for (int i = 0; i < answerList.size(); i++) {
if(answerList.get(i)==null){ if (answerList.get(i) == null) {
answerList.set(i,"空"); answerList.set(i, "空");
} }
} }
for (Integer i = (index-1)*size; i < (index-1)*size+size; i++) { for (Integer i = (index - 1) * size; i < (index - 1) * size + size; i++) {
StuTheoryExamDetailDto detailDto = new StuTheoryExamDetailDto(); StuTheoryExamDetailDto detailDto = new StuTheoryExamDetailDto();
String objectiveQuestionId = idsList.get(i); String objectiveQuestionId = idsList.get(i);
String stuAnswer = answerList.get(i).trim(); String stuAnswer = answerList.get(i).trim();
@ -399,22 +398,22 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
BigDecimal score = objectiveQuestion.getScore(); BigDecimal score = objectiveQuestion.getScore();
String content = objectiveQuestion.getContent(); String content = objectiveQuestion.getContent();
String answer = objectiveQuestion.getAnswer(); String answer = objectiveQuestion.getAnswer();
if(stuAnswer.equals("true")){ if (stuAnswer.equals("true")) {
stuAnswer="对"; stuAnswer = "对";
} }
if(stuAnswer.equals("false")){ if (stuAnswer.equals("false")) {
stuAnswer="错"; stuAnswer = "错";
} }
if(answer.replaceAll(",","").equals(stuAnswer)){ if (answer.replaceAll(",", "").equals(stuAnswer)) {
detailDto.setScore(String.valueOf(score)); detailDto.setScore(String.valueOf(score));
detailDto.setStatus("正确"); detailDto.setStatus("正确");
}else { } else {
detailDto.setScore("0"); detailDto.setScore("0");
detailDto.setStatus("错误"); detailDto.setStatus("错误");
} }
detailDto.setContent(content); detailDto.setContent(content);
detailDto.setMychoice(stuAnswer); detailDto.setMychoice(stuAnswer);
detailDto.setAnswer(answer.replaceAll(",","")); detailDto.setAnswer(answer.replaceAll(",", ""));
detailDtos.add(detailDto); detailDtos.add(detailDto);
} }
return detailDtos; return detailDtos;
@ -430,7 +429,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
return null; return null;
} else { //根据考试时间排序 查询最近的一条 } else { //根据考试时间排序 查询最近的一条
StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0); StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0);
if(stuTheoryExam.getAnswered()){ if (stuTheoryExam.getAnswered()) {
return null; return null;
} }
Date currentTime = new Date(); Date currentTime = new Date();

@ -180,7 +180,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
TeaTrainingDto newData = new TeaTrainingDto(); TeaTrainingDto newData = new TeaTrainingDto();
BeanUtils.copyProperties(stuTrainingWithBLOB, newData); BeanUtils.copyProperties(stuTrainingWithBLOB, newData);
if (sysCourseChapter != null) { if (sysCourseChapter != null) {
newData.setTaskModule(sysCourseChapter.getThreeId()); newData.setTaskModule(sysCourseChapter.getThreeName());
} }
if (StringUtils.isNotBlank(stuTrainingWithBLOB.getReportId())) { if (StringUtils.isNotBlank(stuTrainingWithBLOB.getReportId())) {
String reportId = stuTrainingWithBLOB.getReportId(); String reportId = stuTrainingWithBLOB.getReportId();

Loading…
Cancel
Save