|
|
|
@ -30,6 +30,7 @@ import org.springframework.util.Assert;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
import org.ujmp.core.util.R;
|
|
|
|
|
import util.convertPDF.PDFConvertUtil;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -49,14 +50,12 @@ import java.util.zip.ZipOutputStream;
|
|
|
|
|
public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IFileUtil fileUtil;
|
|
|
|
|
@Resource
|
|
|
|
|
StuPracticalTrainingReportMapper stuPracticalTrainingReportMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private StuScoreDetailsMapper stuScoreDetailsMapper;
|
|
|
|
|
|
|
|
|
@ -93,7 +92,6 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
ScoringUtil scoringUtil;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//区块链学习资源查看
|
|
|
|
|
@Override
|
|
|
|
|
public List<StuResources> getConceptBlockResources() {
|
|
|
|
@ -105,17 +103,14 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 学习测评查看
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<StuAssessmentQuestionDetailsDTO> getLearningAssessment( String userId) {
|
|
|
|
|
StuAssessmentQuestionDetailsExample detailsExample=new StuAssessmentQuestionDetailsExample();
|
|
|
|
|
public List<StuAssessmentQuestionDetailsDTO> getLearningAssessment(String userId) {
|
|
|
|
|
StuAssessmentQuestionDetailsExample detailsExample = new StuAssessmentQuestionDetailsExample();
|
|
|
|
|
detailsExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
List<StuAssessmentQuestionDetails> stuAssessmentQuestionDetails = stuAssessmentQuestionDetailsMapper.selectByExample(detailsExample);
|
|
|
|
|
|
|
|
|
@ -124,10 +119,10 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
criteria.andLogicEqualTo(1);
|
|
|
|
|
List<StuLearningAssessment> stuLearningAssessments = stuLearningAssessmentMapper.selectByExample(example);
|
|
|
|
|
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 j = 0; j < stuAssessmentQuestionDetailsDTOS.size(); j++) {
|
|
|
|
|
if(stuAssessmentQuestionDetails.get(i).getTopicId().equals(stuLearningAssessments.get(j).getTopicId())){
|
|
|
|
|
if (stuAssessmentQuestionDetails.get(i).getTopicId().equals(stuLearningAssessments.get(j).getTopicId())) {
|
|
|
|
|
String rightOrWrong = stuAssessmentQuestionDetails.get(i).getRightOrWrong();
|
|
|
|
|
String studentAnswer = stuAssessmentQuestionDetails.get(i).getStudentAnswer();
|
|
|
|
|
stuAssessmentQuestionDetailsDTOS.get(j).setRightOrWrong(rightOrWrong);
|
|
|
|
@ -290,194 +285,47 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
throw new RuntimeException("模块或用户ID不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查询是否已有分数
|
|
|
|
|
StuPracticalTrainingReportExample stuPracticalTrainingReportExample = new StuPracticalTrainingReportExample();
|
|
|
|
|
stuPracticalTrainingReportExample.createCriteria().andUseridEqualTo(stuBlockProductWithBLOBs.getUserId());
|
|
|
|
|
stuPracticalTrainingReportExample.createCriteria().andUseridEqualTo(stuBlockProductWithBLOBs.getUserId())
|
|
|
|
|
.andModuleEqualTo(stuBlockProductWithBLOBs.getModule()).andAscriptionEqualTo(stuBlockProductWithBLOBs.getCount());
|
|
|
|
|
List<StuPracticalTrainingReport> stuPracticalTrainingReports = stuPracticalTrainingReportMapper.selectByExample(stuPracticalTrainingReportExample);
|
|
|
|
|
String originalFilename = file.getOriginalFilename();
|
|
|
|
|
|
|
|
|
|
if (stuPracticalTrainingReports.size()>0)
|
|
|
|
|
{
|
|
|
|
|
if (stuPracticalTrainingReports.get(0).getRating()!=null)
|
|
|
|
|
{
|
|
|
|
|
throw new RuntimeException("老师已评分,请勿再次提交报告");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String name = originalFilename.substring(0, originalFilename.lastIndexOf("."));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String fileExtension = originalFilename.substring(originalFilename.lastIndexOf(".")).toLowerCase();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//上传实验报告后写入学习成绩
|
|
|
|
|
TchModuleWeithExample weightExample = new TchModuleWeithExample();
|
|
|
|
|
weightExample.createCriteria().andSchoolIdEqualTo(stuBlockProductWithBLOBs.getSchoolId());
|
|
|
|
|
List<TchModuleWeith> weights = tchModuleWeithMapper.selectByExample(weightExample);
|
|
|
|
|
String id = UUID.randomUUID().toString().replaceAll("-", "");
|
|
|
|
|
|
|
|
|
|
if (".pdf".equals(fileExtension)) {
|
|
|
|
|
//第一次上传
|
|
|
|
|
if (stuPracticalTrainingReports.size() == 0) {
|
|
|
|
|
StuPracticalTrainingReport stuPracticalTrainingReport = new StuPracticalTrainingReport();
|
|
|
|
|
|
|
|
|
|
long fileSize = file.getSize() / 1024;
|
|
|
|
|
String url = localFileUtil.upload(file);
|
|
|
|
|
int i = UUID.randomUUID().hashCode();
|
|
|
|
|
int info = i > 0 ? i : -i;
|
|
|
|
|
stuPracticalTrainingReport.setId(info);
|
|
|
|
|
stuPracticalTrainingReport.setReportName(name + ".pdf");
|
|
|
|
|
stuPracticalTrainingReport.setSize((int) fileSize);
|
|
|
|
|
stuPracticalTrainingReport.setUploadTime(new Date());
|
|
|
|
|
stuPracticalTrainingReport.setUrl(url);
|
|
|
|
|
stuPracticalTrainingReport.setUserid(stuBlockProductWithBLOBs.getUserId());
|
|
|
|
|
stuPracticalTrainingReport.setSchoolId(stuBlockProductWithBLOBs.getSchoolId());
|
|
|
|
|
stuPracticalTrainingReportMapper.insert(stuPracticalTrainingReport);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (weights.isEmpty()) {
|
|
|
|
|
throw new RuntimeException("没有查询到实验报告权重信息");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TchModuleWeith tchConceptualTechnologyWeight = weights.get(0);
|
|
|
|
|
if (tchConceptualTechnologyWeight != null) {
|
|
|
|
|
//获取权重信息
|
|
|
|
|
BigDecimal reportWeight = tchConceptualTechnologyWeight.getReportWeight();
|
|
|
|
|
if (reportWeight != null) {
|
|
|
|
|
StuScoreDetails scoreDetails = new StuScoreDetails();
|
|
|
|
|
scoreDetails.setUserId(stuBlockProductWithBLOBs.getUserId());
|
|
|
|
|
//
|
|
|
|
|
scoreDetails.setScoreWeight(reportWeight.doubleValue());
|
|
|
|
|
scoreDetails.setId(id);
|
|
|
|
|
scoreDetails.setLearningProjects("实训报告");
|
|
|
|
|
scoreDetails.setSerialNumber(5);
|
|
|
|
|
scoreDetails.setCompletionStatus("已提交");
|
|
|
|
|
stuScoreDetailsMapper.insert(scoreDetails);
|
|
|
|
|
}
|
|
|
|
|
if (!CollectionUtils.isEmpty(stuPracticalTrainingReports)) {
|
|
|
|
|
for (StuPracticalTrainingReport report : stuPracticalTrainingReports) {
|
|
|
|
|
if (report.getRating() != null) {
|
|
|
|
|
throw new RuntimeException("老师已评分,请勿再次提交报告");
|
|
|
|
|
}
|
|
|
|
|
return stuPracticalTrainingReport;
|
|
|
|
|
}
|
|
|
|
|
//多次上传
|
|
|
|
|
StuPracticalTrainingReport TrainingReport = stuPracticalTrainingReports.get(0);
|
|
|
|
|
// String fileName = file.getOriginalFilename();
|
|
|
|
|
long fileSize = file.getSize() / 1024;
|
|
|
|
|
String url = localFileUtil.upload(file);
|
|
|
|
|
TrainingReport.setReportName(name + ".pdf");
|
|
|
|
|
TrainingReport.setSize((int) fileSize);
|
|
|
|
|
TrainingReport.setUploadTime(new Date());
|
|
|
|
|
TrainingReport.setUrl(url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StuScoreDetailsExample stuScoreDetailsExample = new StuScoreDetailsExample();
|
|
|
|
|
stuScoreDetailsExample.createCriteria().andUserIdEqualTo(stuBlockProductWithBLOBs.getUserId());
|
|
|
|
|
List<StuScoreDetails> stuScoreDetails = stuScoreDetailsMapper.selectByExample(stuScoreDetailsExample);
|
|
|
|
|
if (stuScoreDetails.size() != 0) {
|
|
|
|
|
if (stuScoreDetails.get(0).getScoreWeight() != (weights.get(0).getReportWeight().doubleValue())) {
|
|
|
|
|
stuScoreDetails.get(0).setScoreWeight(weights.get(0).getReportWeight().doubleValue());
|
|
|
|
|
stuScoreDetailsMapper.updateByPrimaryKeySelective(stuScoreDetails.get(0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
stuPracticalTrainingReportMapper.updateByPrimaryKeySelective(TrainingReport);
|
|
|
|
|
return TrainingReport;
|
|
|
|
|
StuPracticalTrainingReport report = stuPracticalTrainingReports.get(0);
|
|
|
|
|
//更新操作
|
|
|
|
|
String upload = fileUtil.upload(file);
|
|
|
|
|
report.setUrl(upload);
|
|
|
|
|
report.setUploadTime(new Date());
|
|
|
|
|
report.setSize((int) file.getSize());
|
|
|
|
|
report.setReportName(file.getOriginalFilename());
|
|
|
|
|
stuPracticalTrainingReportMapper.updateByPrimaryKey(report);
|
|
|
|
|
return report;
|
|
|
|
|
} else {
|
|
|
|
|
//第一次上传
|
|
|
|
|
String upload = fileUtil.upload(file);
|
|
|
|
|
StuPracticalTrainingReport report = new StuPracticalTrainingReport();
|
|
|
|
|
report.setId((int) IdUtil.getSnowflakeNextId());
|
|
|
|
|
report.setUrl(upload);
|
|
|
|
|
report.setAscription(stuBlockProductWithBLOBs.getCount());
|
|
|
|
|
report.setUploadTime(new Date());
|
|
|
|
|
report.setModule(stuBlockProductWithBLOBs.getModule());
|
|
|
|
|
report.setUserid(stuBlockProductWithBLOBs.getUserId());
|
|
|
|
|
report.setSize((int) file.getSize());
|
|
|
|
|
report.setSchoolId(stuBlockProductWithBLOBs.getSchoolId());
|
|
|
|
|
report.setReportName(file.getOriginalFilename());
|
|
|
|
|
stuPracticalTrainingReportMapper.insertSelective(report);
|
|
|
|
|
return report;
|
|
|
|
|
|
|
|
|
|
//格式不为pdf,转换
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
BufferedInputStream inputStream = FileUtil.getInputStream(convertMultipartFileToFile(file));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String s = IdUtil.simpleUUID();
|
|
|
|
|
|
|
|
|
|
File file1 = new File(filePath + "/pdf");
|
|
|
|
|
if (!file1.exists()){
|
|
|
|
|
file1.mkdir();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FileOutputStream fileOutputStream = new FileOutputStream(filePath+"/pdf/"+s+".pdf");
|
|
|
|
|
|
|
|
|
|
PDFConvertUtil.convertToPDFByFileNameSuffix(originalFilename, inputStream, fileOutputStream);
|
|
|
|
|
|
|
|
|
|
FileInputStream fileInputStream = new FileInputStream(filePath+"/pdf/"+s+".pdf");
|
|
|
|
|
|
|
|
|
|
MultipartFile multipartFile = new MockMultipartFile(
|
|
|
|
|
"example.txt", // 文件名
|
|
|
|
|
s + ".pdf", // 原始文件名
|
|
|
|
|
"pdf", // 文件类型
|
|
|
|
|
fileInputStream
|
|
|
|
|
);
|
|
|
|
|
String upload = localFileUtil.upload(multipartFile);
|
|
|
|
|
fileInputStream.close();
|
|
|
|
|
fileOutputStream.close();
|
|
|
|
|
if (stuPracticalTrainingReports.size() == 0) {
|
|
|
|
|
StuPracticalTrainingReport stuPracticalTrainingReport = new StuPracticalTrainingReport();
|
|
|
|
|
//文件大小
|
|
|
|
|
long fileSize = multipartFile.getSize() / 1024;
|
|
|
|
|
int i = UUID.randomUUID().hashCode();
|
|
|
|
|
int info = i > 0 ? i : -i;
|
|
|
|
|
stuPracticalTrainingReport.setId(info);
|
|
|
|
|
stuPracticalTrainingReport.setReportName(name + ".pdf");
|
|
|
|
|
stuPracticalTrainingReport.setSize((int) fileSize);
|
|
|
|
|
stuPracticalTrainingReport.setUploadTime(new Date());
|
|
|
|
|
stuPracticalTrainingReport.setUrl(upload);
|
|
|
|
|
stuPracticalTrainingReport.setUserid(stuBlockProductWithBLOBs.getUserId());
|
|
|
|
|
stuPracticalTrainingReport.setSchoolId(stuBlockProductWithBLOBs.getSchoolId());
|
|
|
|
|
stuPracticalTrainingReportMapper.insert(stuPracticalTrainingReport);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//上传实验报告后写入学习成绩
|
|
|
|
|
|
|
|
|
|
if (weights.isEmpty()) {
|
|
|
|
|
throw new RuntimeException("没有查询到实验报告权重信息");
|
|
|
|
|
}
|
|
|
|
|
TchModuleWeith tchConceptualTechnologyWeight = weights.get(0);
|
|
|
|
|
if (tchConceptualTechnologyWeight != null) {
|
|
|
|
|
//获取权重信息
|
|
|
|
|
BigDecimal reportWeight = tchConceptualTechnologyWeight.getReportWeight();
|
|
|
|
|
if (reportWeight != null) {
|
|
|
|
|
StuScoreDetails scoreDetails = new StuScoreDetails();
|
|
|
|
|
scoreDetails.setUserId(stuBlockProductWithBLOBs.getUserId());
|
|
|
|
|
scoreDetails.setScoreWeight(reportWeight.doubleValue());
|
|
|
|
|
scoreDetails.setId(id);
|
|
|
|
|
scoreDetails.setLearningProjects("实训报告");
|
|
|
|
|
scoreDetails.setSerialNumber(5);
|
|
|
|
|
scoreDetails.setCompletionStatus("已提交");
|
|
|
|
|
stuScoreDetailsMapper.insert(scoreDetails);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return stuPracticalTrainingReport;
|
|
|
|
|
} else {
|
|
|
|
|
StuPracticalTrainingReport TrainingReport = stuPracticalTrainingReports.get(0);
|
|
|
|
|
long fileSize = multipartFile.getSize() / 1024;
|
|
|
|
|
TrainingReport.setReportName(name + ".pdf");
|
|
|
|
|
TrainingReport.setSize((int) fileSize);
|
|
|
|
|
TrainingReport.setUploadTime(new Date());
|
|
|
|
|
TrainingReport.setUrl(upload);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StuScoreDetailsExample stuScoreDetailsExample = new StuScoreDetailsExample();
|
|
|
|
|
stuScoreDetailsExample.createCriteria().andUserIdEqualTo(stuBlockProductWithBLOBs.getUserId());
|
|
|
|
|
List<StuScoreDetails> stuScoreDetails = stuScoreDetailsMapper.selectByExample(stuScoreDetailsExample);
|
|
|
|
|
if (stuScoreDetails.size() != 0) {
|
|
|
|
|
if (stuScoreDetails.get(0).getScoreWeight() != (weights.get(0).getReportWeight().doubleValue())) {
|
|
|
|
|
stuScoreDetails.get(0).setScoreWeight(weights.get(0).getReportWeight().doubleValue());
|
|
|
|
|
stuScoreDetailsMapper.updateByPrimaryKeySelective(stuScoreDetails.get(0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stuPracticalTrainingReportMapper.updateByPrimaryKeySelective(TrainingReport);
|
|
|
|
|
return TrainingReport;
|
|
|
|
|
}
|
|
|
|
|
} catch (FileNotFoundException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -489,17 +337,14 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
@Override
|
|
|
|
|
public void download(Integer id, HttpServletResponse response) {
|
|
|
|
|
|
|
|
|
|
StuUploadImgAi stuUploadImgAi = stuUploadImgAiMapper.selectByPrimaryKey(id);
|
|
|
|
|
StuPracticalTrainingReport report = stuPracticalTrainingReportMapper.selectByPrimaryKey(id);
|
|
|
|
|
|
|
|
|
|
Assert.isTrue(stuUploadImgAi != null && stuUploadImgAi.getFilePath() != null, "文件不存在");
|
|
|
|
|
|
|
|
|
|
fileUtil.download(response, stuUploadImgAi.getFileName(), stuUploadImgAi.getFilePath());
|
|
|
|
|
Assert.isTrue(report != null && report.getUrl() != null, "文件不存在");
|
|
|
|
|
|
|
|
|
|
fileUtil.download(response, report.getReportName(), report.getUrl());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuUploadImgAiMapper stuUploadImgAiMapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取实验报告
|
|
|
|
@ -508,32 +353,29 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<StuUploadImgAi> getReport(String userId) {
|
|
|
|
|
public List<StuPracticalTrainingReport> getReport(String userId) {
|
|
|
|
|
|
|
|
|
|
//获取实验报告
|
|
|
|
|
StuUploadImgAiExample export = new StuUploadImgAiExample();
|
|
|
|
|
export.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
StuPracticalTrainingReportExample stuPracticalTrainingReportExample = new StuPracticalTrainingReportExample();
|
|
|
|
|
stuPracticalTrainingReportExample.createCriteria().andUseridEqualTo(userId);
|
|
|
|
|
|
|
|
|
|
List<StuUploadImgAi> stuUploadImgAiList = stuUploadImgAiMapper.selectByExampleWithBLOBs(export);
|
|
|
|
|
if (CollectionUtils.isEmpty(stuUploadImgAiList)){
|
|
|
|
|
List<StuPracticalTrainingReport> stuUploadImgAiList = stuPracticalTrainingReportMapper.selectByExample(stuPracticalTrainingReportExample);
|
|
|
|
|
if (CollectionUtils.isEmpty(stuUploadImgAiList)) {
|
|
|
|
|
return null;
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
return stuUploadImgAiList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void OutPdf(HttpServletResponse response, String context) {
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
String s = IdUtil.simpleUUID();
|
|
|
|
|
FileOutputStream fileOutputStream = new FileOutputStream(filePath+"/pdf/"+s+".pdf");
|
|
|
|
|
PdfUtil.htmlStringToPdf(context,fileOutputStream);
|
|
|
|
|
fileUtil.download(response, s+".pdf", "/pdf/"+s+".pdf");
|
|
|
|
|
FileOutputStream fileOutputStream = new FileOutputStream(filePath + "/pdf/" + s + ".pdf");
|
|
|
|
|
PdfUtil.htmlStringToPdf(context, fileOutputStream);
|
|
|
|
|
fileUtil.download(response, s + ".pdf", "/pdf/" + s + ".pdf");
|
|
|
|
|
|
|
|
|
|
} catch (FileNotFoundException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
@ -541,7 +383,6 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 计算资源学习得分
|
|
|
|
|
*
|
|
|
|
@ -557,8 +398,8 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
TchModuleWeithExample example = new TchModuleWeithExample();
|
|
|
|
|
example.createCriteria().andSchoolIdEqualTo(stuUser.getSchoolId());
|
|
|
|
|
List<TchModuleWeith> tchModuleWeiths = tchModuleWeithMapper.selectByExample(example);
|
|
|
|
|
if(tchModuleWeiths.size()==0){
|
|
|
|
|
TchModuleWeith tchConceptualTechnologyWeight=new TchModuleWeith(stuUser.getSchoolId());
|
|
|
|
|
if (tchModuleWeiths.size() == 0) {
|
|
|
|
|
TchModuleWeith tchConceptualTechnologyWeight = new TchModuleWeith(stuUser.getSchoolId());
|
|
|
|
|
tchModuleWeithMapper.insert(tchConceptualTechnologyWeight);
|
|
|
|
|
tchModuleWeiths.add(tchConceptualTechnologyWeight);
|
|
|
|
|
}
|
|
|
|
@ -595,8 +436,8 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
Double scoreProject1 = stuScoreDetails.getScoreProject();
|
|
|
|
|
BigDecimal add = bigDecimalUtils.add(scoreProject.toString(), scoreProject1.toString());
|
|
|
|
|
|
|
|
|
|
if(add.compareTo(BigDecimal.valueOf(100))==1){
|
|
|
|
|
add=BigDecimal.valueOf(100);
|
|
|
|
|
if (add.compareTo(BigDecimal.valueOf(100)) == 1) {
|
|
|
|
|
add = BigDecimal.valueOf(100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//时间累加
|
|
|
|
@ -612,19 +453,18 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询出学生成绩信息更新到学生列表
|
|
|
|
|
StuScoreDetailsExample stuScoreDetailsExample=new StuScoreDetailsExample();
|
|
|
|
|
StuScoreDetailsExample stuScoreDetailsExample = new StuScoreDetailsExample();
|
|
|
|
|
stuScoreDetailsExample.createCriteria().andUserIdEqualTo(stuScoreDetailsDTO.getUserId());
|
|
|
|
|
|
|
|
|
|
List<StuScoreDetails> stuScoreDetailsList = stuScoreDetailsMapper.selectByExample(stuScoreDetailsExample);
|
|
|
|
|
|
|
|
|
|
//将分数统计到学生表中
|
|
|
|
|
anaService.personalScoreEntry(stuScoreDetailsList,tchConceptualTechnologyWeight);
|
|
|
|
|
anaService.personalScoreEntry(stuScoreDetailsList, tchConceptualTechnologyWeight);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 计算知识概要得分
|
|
|
|
|
*
|
|
|
|
@ -640,8 +480,8 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
TchModuleWeithExample example = new TchModuleWeithExample();
|
|
|
|
|
example.createCriteria().andSchoolIdEqualTo(stuUser.getSchoolId());
|
|
|
|
|
List<TchModuleWeith> tchModuleWeiths = tchModuleWeithMapper.selectByExample(example);
|
|
|
|
|
if(tchModuleWeiths.isEmpty()){
|
|
|
|
|
TchModuleWeith tchConceptualTechnologyWeight=new TchModuleWeith(stuUser.getSchoolId());
|
|
|
|
|
if (tchModuleWeiths.isEmpty()) {
|
|
|
|
|
TchModuleWeith tchConceptualTechnologyWeight = new TchModuleWeith(stuUser.getSchoolId());
|
|
|
|
|
tchModuleWeithMapper.insert(tchConceptualTechnologyWeight);
|
|
|
|
|
tchModuleWeiths.add(tchConceptualTechnologyWeight);
|
|
|
|
|
}
|
|
|
|
@ -681,8 +521,8 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
Double scoreProject1 = stuScoreDetails.getScoreProject();
|
|
|
|
|
BigDecimal add = bigDecimalUtils.add(scoreProject.toString(), scoreProject1.toString());
|
|
|
|
|
|
|
|
|
|
if(add.compareTo(BigDecimal.valueOf(100))==1){
|
|
|
|
|
add=BigDecimal.valueOf(100);
|
|
|
|
|
if (add.compareTo(BigDecimal.valueOf(100)) == 1) {
|
|
|
|
|
add = BigDecimal.valueOf(100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//时间累加
|
|
|
|
@ -698,31 +538,28 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查询出学生成绩信息更新到学生列表
|
|
|
|
|
StuScoreDetailsExample stuScoreDetailsExample=new StuScoreDetailsExample();
|
|
|
|
|
StuScoreDetailsExample stuScoreDetailsExample = new StuScoreDetailsExample();
|
|
|
|
|
stuScoreDetailsExample.createCriteria().andUserIdEqualTo(stuScoreDetailsDTO.getUserId());
|
|
|
|
|
|
|
|
|
|
List<StuScoreDetails> stuScoreDetailsList = stuScoreDetailsMapper.selectByExample(stuScoreDetailsExample);
|
|
|
|
|
|
|
|
|
|
//将分数统计到学生表中
|
|
|
|
|
anaService.personalScoreEntry(stuScoreDetailsList,tchConceptualTechnologyWeight);
|
|
|
|
|
anaService.personalScoreEntry(stuScoreDetailsList, tchConceptualTechnologyWeight);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//上传实验报告
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public ResultEntity newUpload(MultipartFile file, StuBlockProductWithDTO stuBlockProductWithBLOBs) {
|
|
|
|
|
if (!StringUtils.hasText(stuBlockProductWithBLOBs.getSchoolId()))
|
|
|
|
|
{
|
|
|
|
|
if (!StringUtils.hasText(stuBlockProductWithBLOBs.getSchoolId())) {
|
|
|
|
|
throw new RuntimeException("学校ID不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.hasText(stuBlockProductWithBLOBs.getUserId()))
|
|
|
|
|
{
|
|
|
|
|
if (!StringUtils.hasText(stuBlockProductWithBLOBs.getUserId())) {
|
|
|
|
|
throw new RuntimeException("用户ID不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.hasText(stuBlockProductWithBLOBs.getModule()))
|
|
|
|
|
{
|
|
|
|
|
if (!StringUtils.hasText(stuBlockProductWithBLOBs.getModule())) {
|
|
|
|
|
throw new RuntimeException("模块不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -731,9 +568,9 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
String sp = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String [] array = {"docx","doc", "pdf", "jpg", "png", "mp4", "avi"};
|
|
|
|
|
String[] array = {"docx", "doc", "pdf", "jpg", "png", "mp4", "avi"};
|
|
|
|
|
List<String> collect = Arrays.stream(array).collect(Collectors.toList());
|
|
|
|
|
if (!collect.contains(sp)){
|
|
|
|
|
if (!collect.contains(sp)) {
|
|
|
|
|
throw new RuntimeException("上传格式仅支持:Word,PDF,图片,视频");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -744,43 +581,43 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
.andUseridEqualTo(stuBlockProductWithBLOBs.getUserId());
|
|
|
|
|
|
|
|
|
|
List<StuPracticalTrainingReport> stuPracticalTrainingReportList = stuPracticalTrainingReportMapper.selectByExample(example);
|
|
|
|
|
if (CollectionUtils.isEmpty(stuPracticalTrainingReportList)){
|
|
|
|
|
if (CollectionUtils.isEmpty(stuPracticalTrainingReportList)) {
|
|
|
|
|
//第一次上传
|
|
|
|
|
|
|
|
|
|
StuPracticalTrainingReport stuPracticalTrainingReport = uploadByReport(file,stuBlockProductWithBLOBs);
|
|
|
|
|
StuPracticalTrainingReport stuPracticalTrainingReport = uploadByReport(file, stuBlockProductWithBLOBs);
|
|
|
|
|
|
|
|
|
|
stuPracticalTrainingReport.setAscription(String.valueOf(1));
|
|
|
|
|
stuPracticalTrainingReportMapper.insertSelective(stuPracticalTrainingReport);
|
|
|
|
|
|
|
|
|
|
stuPracticalTrainingReportList.add(stuPracticalTrainingReport);
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,stuPracticalTrainingReportList);
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, stuPracticalTrainingReportList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else if (stuPracticalTrainingReportList.size() == 1){
|
|
|
|
|
} else if (stuPracticalTrainingReportList.size() == 1) {
|
|
|
|
|
|
|
|
|
|
StuPracticalTrainingReport stuPracticalTrainingReport = uploadByReport(file,stuBlockProductWithBLOBs);
|
|
|
|
|
StuPracticalTrainingReport stuPracticalTrainingReport = uploadByReport(file, stuBlockProductWithBLOBs);
|
|
|
|
|
stuPracticalTrainingReport.setAscription(String.valueOf(2));
|
|
|
|
|
stuPracticalTrainingReportMapper.insertSelective(stuPracticalTrainingReport);
|
|
|
|
|
|
|
|
|
|
stuPracticalTrainingReportList.add(stuPracticalTrainingReport);
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,stuPracticalTrainingReportList);
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, stuPracticalTrainingReportList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else if (stuPracticalTrainingReportList.size() == 2){
|
|
|
|
|
} else if (stuPracticalTrainingReportList.size() == 2) {
|
|
|
|
|
|
|
|
|
|
StuPracticalTrainingReport stuPracticalTrainingReport = uploadByReport(file,stuBlockProductWithBLOBs);
|
|
|
|
|
StuPracticalTrainingReport stuPracticalTrainingReport = uploadByReport(file, stuBlockProductWithBLOBs);
|
|
|
|
|
stuPracticalTrainingReport.setAscription(String.valueOf(3));
|
|
|
|
|
stuPracticalTrainingReportMapper.insertSelective(stuPracticalTrainingReport);
|
|
|
|
|
stuPracticalTrainingReportList.add(stuPracticalTrainingReport);
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,stuPracticalTrainingReportList);
|
|
|
|
|
}else {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST,"系统允许您上传至多三份实验报告!",stuPracticalTrainingReportList);
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, stuPracticalTrainingReportList);
|
|
|
|
|
} else {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "系统允许您上传至多三份实验报告!", stuPracticalTrainingReportList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity downReportByZip(HttpServletResponse response,String userId,String module,String reportName) {
|
|
|
|
|
public ResultEntity downReportByZip(HttpServletResponse response, String userId, String module, String reportName) {
|
|
|
|
|
StuPracticalTrainingReportExample example = new StuPracticalTrainingReportExample();
|
|
|
|
|
StuPracticalTrainingReportExample.Criteria criteria = example.createCriteria()
|
|
|
|
|
.andModuleEqualTo(module)
|
|
|
|
@ -839,8 +676,6 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -864,7 +699,7 @@ public class StuConceptBlockServiceImpl implements StuConceptBlockService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public File convertMultipartFileToFile(MultipartFile multipartFile) throws IOException {
|
|
|
|
|
public File convertMultipartFileToFile(MultipartFile multipartFile) throws IOException {
|
|
|
|
|
// 创建一个临时文件
|
|
|
|
|
File tempFile = File.createTempFile("temp", null);
|
|
|
|
|
|
|
|
|
|