|
|
@ -1,18 +1,21 @@
|
|
|
|
package com.sztzjy.block_finance.service.impl;
|
|
|
|
package com.sztzjy.block_finance.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import com.sztzjy.block_finance.entity.StuAssessmentQuestionDetails;
|
|
|
|
import com.sztzjy.block_finance.config.exception.handler.ServiceException;
|
|
|
|
import com.sztzjy.block_finance.entity.StuAssessmentQuestionDetailsExample;
|
|
|
|
import com.sztzjy.block_finance.entity.*;
|
|
|
|
import com.sztzjy.block_finance.entity.StuLearningAssessment;
|
|
|
|
|
|
|
|
import com.sztzjy.block_finance.entity.StuLearningAssessmentExample;
|
|
|
|
|
|
|
|
import com.sztzjy.block_finance.entity.dto.StuAssessmentQuestionDetailsDTO;
|
|
|
|
import com.sztzjy.block_finance.entity.dto.StuAssessmentQuestionDetailsDTO;
|
|
|
|
|
|
|
|
import com.sztzjy.block_finance.entity.dto.StuLearningAssessmentDTO;
|
|
|
|
|
|
|
|
import com.sztzjy.block_finance.entity.dto.StuLearningAssessmentScoreDTO;
|
|
|
|
import com.sztzjy.block_finance.mappers.StuAssessmentQuestionDetailsMapper;
|
|
|
|
import com.sztzjy.block_finance.mappers.StuAssessmentQuestionDetailsMapper;
|
|
|
|
import com.sztzjy.block_finance.mappers.StuLearningAssessmentMapper;
|
|
|
|
import com.sztzjy.block_finance.mappers.StuLearningAssessmentMapper;
|
|
|
|
import com.sztzjy.block_finance.service.StuEvaluationService;
|
|
|
|
import com.sztzjy.block_finance.service.StuEvaluationService;
|
|
|
|
import com.sztzjy.block_finance.util.ConvertUtil;
|
|
|
|
import com.sztzjy.block_finance.util.ConvertUtil;
|
|
|
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @author tz
|
|
|
|
* @author tz
|
|
|
@ -27,16 +30,14 @@ public class StuEvaluationServiceImpl implements StuEvaluationService {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
StuLearningAssessmentMapper stuLearningAssessmentMapper;
|
|
|
|
StuLearningAssessmentMapper stuLearningAssessmentMapper;
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<StuAssessmentQuestionDetailsDTO> getLearningAssessment(String module, String userId) {
|
|
|
|
public List<StuAssessmentQuestionDetailsDTO> getLearningAssessment(String userId) {
|
|
|
|
|
|
|
|
|
|
|
|
StuAssessmentQuestionDetailsExample detailsExample=new StuAssessmentQuestionDetailsExample();
|
|
|
|
StuAssessmentQuestionDetailsExample detailsExample=new StuAssessmentQuestionDetailsExample();
|
|
|
|
detailsExample.createCriteria().andUserIdEqualTo(userId).andModuleEqualTo(module);
|
|
|
|
detailsExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
List<StuAssessmentQuestionDetails> stuAssessmentQuestionDetails = stuAssessmentQuestionDetailsMapper.selectByExample(detailsExample);
|
|
|
|
List<StuAssessmentQuestionDetails> stuAssessmentQuestionDetails = stuAssessmentQuestionDetailsMapper.selectByExample(detailsExample);
|
|
|
|
|
|
|
|
|
|
|
|
StuLearningAssessmentExample example = new StuLearningAssessmentExample();
|
|
|
|
|
|
|
|
StuLearningAssessmentExample.Criteria criteria = example.createCriteria();
|
|
|
|
List<StuLearningAssessment> stuLearningAssessments = stuLearningAssessmentMapper.selectByExample(null);
|
|
|
|
criteria.andModuleEqualTo(module).andLogicEqualTo(1);
|
|
|
|
|
|
|
|
List<StuLearningAssessment> stuLearningAssessments = stuLearningAssessmentMapper.selectByExample(example);
|
|
|
|
|
|
|
|
List<StuAssessmentQuestionDetailsDTO> stuAssessmentQuestionDetailsDTOS = convertUtil.entityToDTOList(stuLearningAssessments, StuAssessmentQuestionDetailsDTO.class);
|
|
|
|
List<StuAssessmentQuestionDetailsDTO> stuAssessmentQuestionDetailsDTOS = convertUtil.entityToDTOList(stuLearningAssessments, StuAssessmentQuestionDetailsDTO.class);
|
|
|
|
if(stuAssessmentQuestionDetails.size()!=0){
|
|
|
|
if(stuAssessmentQuestionDetails.size()!=0){
|
|
|
|
for (int i = 0; i < stuAssessmentQuestionDetails.size(); i++) {
|
|
|
|
for (int i = 0; i < stuAssessmentQuestionDetails.size(); i++) {
|
|
|
@ -56,4 +57,88 @@ public class StuEvaluationServiceImpl implements StuEvaluationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return stuAssessmentQuestionDetailsDTOS;
|
|
|
|
return stuAssessmentQuestionDetailsDTOS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public int submitEarningAssessment(StuLearningAssessmentScoreDTO assessmentScoreDTO) {
|
|
|
|
|
|
|
|
StuAssessmentQuestionDetailsExample detailsExample = new StuAssessmentQuestionDetailsExample();
|
|
|
|
|
|
|
|
detailsExample.createCriteria().andUserIdEqualTo(assessmentScoreDTO.getUserId());
|
|
|
|
|
|
|
|
List<StuAssessmentQuestionDetails> stuAssessmentQuestionDetails = stuAssessmentQuestionDetailsMapper.selectByExample(detailsExample);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<StuLearningAssessment> stuLearningAssessments = stuLearningAssessmentMapper.selectByExample(null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<StuLearningAssessmentDTO> stuLearningAssessmentDTOS = assessmentScoreDTO.getStuLearningAssessmentDTOS();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
if (!stuAssessmentQuestionDetails.isEmpty()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < stuLearningAssessmentDTOS.size(); i++) {
|
|
|
|
|
|
|
|
for (int j = 0; j < stuLearningAssessments.size(); j++) {
|
|
|
|
|
|
|
|
if (stuLearningAssessmentDTOS.get(i).getTopicId().equals(stuLearningAssessments.get(j).getTopicId())) {
|
|
|
|
|
|
|
|
String[] studentAnswer = stuLearningAssessmentDTOS.get(i).getStudentAnswer();
|
|
|
|
|
|
|
|
String saw = "";
|
|
|
|
|
|
|
|
for (int k = 0; k < studentAnswer.length; k++) {
|
|
|
|
|
|
|
|
if (studentAnswer.length - 1 == k) {
|
|
|
|
|
|
|
|
saw += studentAnswer[k];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
saw += studentAnswer[k] + ",";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String string = stuLearningAssessments.get(j).getAnswer();
|
|
|
|
|
|
|
|
for (int k = 0; k < stuAssessmentQuestionDetails.size(); k++) {
|
|
|
|
|
|
|
|
if (stuAssessmentQuestionDetails.get(k).getTopicId().equals(stuLearningAssessmentDTOS.get(i).getTopicId())) {
|
|
|
|
|
|
|
|
StuAssessmentQuestionDetails assessmentQuestionDetails = stuAssessmentQuestionDetails.get(k);
|
|
|
|
|
|
|
|
assessmentQuestionDetails.setStudentAnswer(saw);
|
|
|
|
|
|
|
|
assessmentQuestionDetails.setUserId(assessmentScoreDTO.getUserId());
|
|
|
|
|
|
|
|
if (saw.equals(string)) {
|
|
|
|
|
|
|
|
assessmentQuestionDetails.setRightOrWrong("正确");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
assessmentQuestionDetails.setRightOrWrong("错误");
|
|
|
|
|
|
|
|
count++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
stuAssessmentQuestionDetailsMapper.updateByPrimaryKey(assessmentQuestionDetails);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < stuLearningAssessmentDTOS.size(); i++) {
|
|
|
|
|
|
|
|
for (int j = 0; j < stuLearningAssessments.size(); j++) {
|
|
|
|
|
|
|
|
if (stuLearningAssessmentDTOS.get(i).getTopicId().equals(stuLearningAssessments.get(j).getTopicId())) {
|
|
|
|
|
|
|
|
String[] studentAnswer = stuLearningAssessmentDTOS.get(i).getStudentAnswer();
|
|
|
|
|
|
|
|
String saw = "";
|
|
|
|
|
|
|
|
for (int k = 0; k < studentAnswer.length; k++) {
|
|
|
|
|
|
|
|
if (studentAnswer.length - 1 == k) {
|
|
|
|
|
|
|
|
saw += studentAnswer[k];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
saw += studentAnswer[k] + ",";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String string = stuLearningAssessments.get(j).getAnswer();
|
|
|
|
|
|
|
|
StuAssessmentQuestionDetails details = new StuAssessmentQuestionDetails();
|
|
|
|
|
|
|
|
int uuid = UUID.randomUUID().hashCode();
|
|
|
|
|
|
|
|
if (uuid < 0) {
|
|
|
|
|
|
|
|
uuid = -uuid;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
details.setDetailsId(uuid);
|
|
|
|
|
|
|
|
details.setStudentAnswer(saw);
|
|
|
|
|
|
|
|
details.setTopicId(stuLearningAssessmentDTOS.get(i).getTopicId());
|
|
|
|
|
|
|
|
details.setUserId(assessmentScoreDTO.getUserId());
|
|
|
|
|
|
|
|
if (saw.equals(string)) {
|
|
|
|
|
|
|
|
details.setRightOrWrong("正确");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
details.setRightOrWrong("错误");
|
|
|
|
|
|
|
|
count++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
stuAssessmentQuestionDetailsMapper.insert(details);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|