修复bug

master
whb 7 months ago
parent eb0e4b8701
commit 3a8618dac7

@ -104,20 +104,6 @@ public class StuConceptBlockController {
@GetMapping("/getReport")
@ApiOperation("获取实训报告详情")
//@AnonymousAccess
public ResultEntity getReport(String userId) {
List<StuUploadImgAi> report = stuConceptBlockService.getReport(userId);
return new ResultEntity<>(HttpStatus.OK, report);
}
@PostMapping("/upload")
@ApiOperation("上传实训报告")
@AnonymousAccess
@ -128,43 +114,88 @@ public class StuConceptBlockController {
StuBlockProductWithDTO stuBlockProductWithBLOBs = gson.fromJson(stuBlockProduct, StuBlockProductWithDTO.class);
StuPracticalTrainingReport report = stuConceptBlockService.upload(file, stuBlockProductWithBLOBs);
return new ResultDataEntity<>(HttpStatus.OK, report);
}
@GetMapping("/getReport")
@ApiOperation("获取实训报告详情")
//@AnonymousAccess
public ResultEntity getReport(String userId) {
@PostMapping("/newUpload")
@ApiOperation("新版上传实训报告")
@AnonymousAccess
public ResultEntity newUpload(@RequestParam(required = false) @RequestPart MultipartFile file,
@RequestParam(required = false) String stuBlockProduct) {
Gson gson = new Gson();
StuBlockProductWithDTO stuBlockProductWithBLOBs = gson.fromJson(stuBlockProduct, StuBlockProductWithDTO.class);
// StuPracticalTrainingReport report = stuConceptBlockService.upload(file, stuBlockProductWithBLOBs);
return stuConceptBlockService.newUpload(file, stuBlockProductWithBLOBs);
List<StuPracticalTrainingReport> report = stuConceptBlockService.getReport(userId);
return new ResultEntity<>(HttpStatus.OK, report);
}
@GetMapping("/downReportByZip")
@ApiOperation("新版上传实训报告下载ZIP")
@AnonymousAccess
public ResultEntity downReportByZip(HttpServletResponse response,String userId,String module,String reportName) {
return stuConceptBlockService.downReportByZip(response,userId,module,reportName);
}
// @PostMapping("/upload")
// @ApiOperation("上传实训报告")
// @AnonymousAccess
// public ResultDataEntity<StuPracticalTrainingReport> upload(@RequestParam(required = false) @RequestPart MultipartFile file,
// @RequestParam(required = false) String stuBlockProduct) {
//
// Gson gson = new Gson();
// StuBlockProductWithDTO stuBlockProductWithBLOBs = gson.fromJson(stuBlockProduct, StuBlockProductWithDTO.class);
//
//
//
// StuPracticalTrainingReport report = stuConceptBlockService.upload(file, stuBlockProductWithBLOBs);
//
// return new ResultDataEntity<>(HttpStatus.OK, report);
//
// }
//
//
//
// @PostMapping("/newUpload")
// @ApiOperation("新版上传实训报告")
// @AnonymousAccess
// public ResultEntity newUpload(@RequestParam(required = false) @RequestPart MultipartFile file,
// @RequestParam(required = false) String stuBlockProduct) {
//
// Gson gson = new Gson();
// StuBlockProductWithDTO stuBlockProductWithBLOBs = gson.fromJson(stuBlockProduct, StuBlockProductWithDTO.class);
//
//
//
// // StuPracticalTrainingReport report = stuConceptBlockService.upload(file, stuBlockProductWithBLOBs);
// return stuConceptBlockService.newUpload(file, stuBlockProductWithBLOBs);
//
//
// }
//
// @GetMapping("/downReportByZip")
// @ApiOperation("新版上传实训报告下载ZIP")
// @AnonymousAccess
// public ResultEntity downReportByZip(HttpServletResponse response,String userId,String module,String reportName) {
//
//
// return stuConceptBlockService.downReportByZip(response,userId,module,reportName);
//
//
// }
//
//
// @PostMapping("/newUpload")
// @ApiOperation("新版上传实训报告")
// @AnonymousAccess
// public ResultEntity newUpload(@RequestParam(required = false) @RequestPart MultipartFile file,
// @RequestParam(required = false) String stuBlockProduct) {
//
// Gson gson = new Gson();
// StuBlockProductWithDTO stuBlockProductWithBLOBs = gson.fromJson(stuBlockProduct, StuBlockProductWithDTO.class);
//
//
//
// // StuPracticalTrainingReport report = stuConceptBlockService.upload(file, stuBlockProductWithBLOBs);
// return stuConceptBlockService.newUpload(file, stuBlockProductWithBLOBs);
//
//
// }
/*

@ -1,6 +1,5 @@
package com.sztzjy.marketing.entity;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@ -15,7 +14,7 @@ import lombok.Data;
* stu_machine_learning
*/
@Data
public class StuMachineLearning implements Serializable {
public class StuMachineLearning {
@ApiModelProperty("id")
private Integer id;
@ -234,8 +233,12 @@ public class StuMachineLearning implements Serializable {
@ApiModelProperty("活跃用户分析")
private String activeUserAnalysis;
private List<StuMachineLearningInfoDTO> stuMachineLearningInfoDTOList;
private String stepechartlist1;
private String stepechartlist2;
private String stepechartlist3;
public Integer getId() {
return id;
@ -820,4 +823,28 @@ public class StuMachineLearning implements Serializable {
public void setActiveUserAnalysis(String activeUserAnalysis) {
this.activeUserAnalysis = activeUserAnalysis == null ? null : activeUserAnalysis.trim();
}
public String getStepechartlist1() {
return stepechartlist1;
}
public void setStepechartlist1(String stepechartlist1) {
this.stepechartlist1 = stepechartlist1 == null ? null : stepechartlist1.trim();
}
public String getStepechartlist2() {
return stepechartlist2;
}
public void setStepechartlist2(String stepechartlist2) {
this.stepechartlist2 = stepechartlist2 == null ? null : stepechartlist2.trim();
}
public String getStepechartlist3() {
return stepechartlist3;
}
public void setStepechartlist3(String stepechartlist3) {
this.stepechartlist3 = stepechartlist3 == null ? null : stepechartlist3.trim();
}
}

@ -13,5 +13,6 @@ public class StuBlockProductWithDTO {
private String schoolId;
private String userId;
private String module;
private String count;
}

@ -25,4 +25,5 @@ public class TchrePortPresentationDTO {
@ApiModelProperty("文件大小")
private Double fileSize;
private String ascription;
}

@ -38,16 +38,16 @@ public interface StuUploadImgAiMapper {
int updateByPrimaryKey(StuUploadImgAi record);
@Select(" select s.name as name , s.student_id as studentId, s.class_name as className,\n" +
" i.module as module ,i.file_name as fileName ,i.create_time as createTime ,i.file_size as fileSize\n" +
" from stu_upload_img_ai i\n" +
" join\n" +
" stu_user s\n" +
" on\n" +
" i.user_id = s.user_id\n" +
" where\n" +
" s.school_id = #{schoolId}\n" +
" order by\n" +
" i.create_time asc")
// @Select(" select s.name as name , s.student_id as studentId, s.class_name as className,\n" +
// " i.module as module ,i.file_name as fileName ,i.create_time as createTime ,i.file_size as fileSize\n" +
// " from stu_upload_img_ai i\n" +
// " join\n" +
// " stu_user s\n" +
// " on\n" +
// " i.user_id = s.user_id\n" +
// " where\n" +
// " s.school_id = #{schoolId}\n" +
// " order by\n" +
// " i.create_time asc")
List<TchrePortPresentationDTO> selectInfoBySchoolId(String schoolId);
}

@ -31,7 +31,7 @@ public interface StuConceptBlockService {
void download(Integer id, HttpServletResponse response);
List<StuUploadImgAi> getReport(String userId);
List<StuPracticalTrainingReport> getReport(String userId);
/**
* pdf

@ -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);

@ -65,7 +65,6 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
StuDigitalConfirmationMapper stuDigitalConfirmationMapper;
/**
* Hadoop
*
@ -91,7 +90,6 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
map.put("非关系型数据库", "HBase");
map.put("文件存储", "HDFS");
map.put("数据传递", "Sqoop");
map.put("日志收集", "Flume");
map.put("消息队列", "Kafka");
map.put("数据平台配置和调度", "ZooKeeper");
@ -110,13 +108,12 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
//答案
String info = temp.replaceAll("[12]", "");
// String s1 = context.replaceAll("[12]", "");
// String s1 = context.replaceAll("[12]", "");
//查询有无数据 有数据插入更新状态为1
//没有则插入
//不是第一次做题
if (stuHadoopTrains!=null && stuHadoopTrains.size()>0)
{
if (stuHadoopTrains != null && stuHadoopTrains.size() > 0) {
String append = stuHadoopTrains.get(0).getAppend();
@ -125,22 +122,18 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
//判断是否做过改题目
String[] split = parsed.split(",");
//判断够不够16个
if (split.length==16){
if (split.length == 16) {
//判断是否包含
if (Arrays.asList(split).contains(context)){
if (Arrays.asList(split).contains(context)) {
return info;
}
//判断完成状态
if (stuHadoopTrains.get(0).getState()==0)
{
if (stuHadoopTrains.get(0).getState() == 0) {
String Info = parsed + context +",";
String Info = parsed + context + ",";
String jsonString = JSON.toJSONString(Info);
stuHadoopTrains.get(0).setAppend(jsonString);
@ -151,34 +144,23 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
//提交答题错误
Integer anInt = Convert.toInt(stuHadoopTrains.get(0).getWrongDetail());
// stuDigitalIndustrializationService.practicalTrainingSubmission(userId,"大数据","Hadoop",anInt);
}
return info;
}
if (Arrays.asList(split).contains(context)){
return info;
if (Arrays.asList(split).contains(context)) {
return info;
}
String Info = parsed + context +",";
String Info = parsed + context + ",";
String jsonString = JSON.toJSONString(Info);
stuHadoopTrains.get(0).setAppend(jsonString);
stuHadoopTrainMapper.updateByPrimaryKeySelective(stuHadoopTrains.get(0));
return info;
}else {
} else {
String currentInfo = context + ",";
String jsonString = JSON.toJSONString(currentInfo);
StuHadoopTrain stuHadoopTrain = new StuHadoopTrain();
stuHadoopTrain.setId((int) IdUtil.getSnowflakeNextId());
stuHadoopTrain.setAppend(jsonString);
@ -191,17 +173,14 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
return info;
} else {
//不相同 查看有无数据
if (stuHadoopTrains!=null && stuHadoopTrains.size()>0)
{
if (stuHadoopTrains != null && stuHadoopTrains.size() > 0) {
StuHadoopTrain stuHadoopTrain = stuHadoopTrains.get(0);
String wrongDetail = stuHadoopTrain.getWrongDetail();
int count = Convert.toInt(wrongDetail)+ 1;
int count = Convert.toInt(wrongDetail) + 1;
stuHadoopTrain.setWrongDetail(String.valueOf(count));
stuHadoopTrainMapper.updateByPrimaryKeySelective(stuHadoopTrain);
}else {
} else {
StuHadoopTrain stuHadoopTrain = new StuHadoopTrain();
stuHadoopTrain.setId((int) IdUtil.getSnowflakeNextId());
stuHadoopTrain.setAppend("1");
@ -219,7 +198,6 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
}
/**
*
*/
@ -321,7 +299,7 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
stuDigServiceTradeMapper.updateByPrimaryKeySelective(stuDigServiceTrades.get(0));
} else {
int i = UUID.randomUUID().hashCode();
int id= i > 0 ? i : -i;
int id = i > 0 ? i : -i;
StuDigServiceTrade build = StuDigServiceTrade.builder().id(id).domeLicense(url).userId(userId).build();
@ -347,7 +325,7 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
stuDigServiceTradeMapper.updateByPrimaryKeySelective(stuDigServiceTrades.get(0));
} else {
int i = UUID.randomUUID().hashCode();
int id= i > 0 ? i : -i;
int id = i > 0 ? i : -i;
StuDigServiceTrade build = StuDigServiceTrade.builder().id(id).abroadBusReg(url).userId(userId).build();
@ -367,7 +345,7 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
List<StuImageRecognitionTraining> stuImageRecognitionList = stuImageRecognitionTrainingMapper.selectByExample(Stuexample);
if (stuImageRecognitionList.size()==2){
if (stuImageRecognitionList.size() == 2) {
List<StuImageRecognitionTraining> collect = stuImageRecognitionList.stream().sorted(Comparator.comparing(StuImageRecognitionTraining::getStemContent).reversed()).collect(Collectors.toList());
return collect;
@ -429,19 +407,18 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
if (stuImageRecognitionList.size() > 0) {
List<StuImageRecognitionTraining> collect = stuImageRecognitionList.stream().filter(item -> item.getStemContent().equals("请选择一种最优的方法先获得文章的图片。")).collect(Collectors.toList());
if (collect.size() > 0 ) {
if (collect.get(0).getStudentAnswer().equals("B")){
if (collect.size() > 0) {
if (collect.get(0).getStudentAnswer().equals("B")) {
if ("A".equals(answer) ){
if ("A".equals(answer)) {
return "选择错误!";
}
return "提交成功";
}
if ("A".equals(answer) )
{
if ("A".equals(answer)) {
throw new InvoceTException(HttpStatus.ACCEPTED, "选择错误");
}else {
} else {
collect.get(0).setStudentAnswer("B");
stuImageRecognitionTrainingMapper.updateByPrimaryKey(collect.get(0));
return "选择正确!";
@ -510,25 +487,23 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
String[] select = answer.split(",");
Arrays.sort(select);
String arr[] = {"A","B","C","D","E"};
String arr[] = {"A", "B", "C", "D", "E"};
if (stuImageRecognitionList.size() > 0 ) {
if (stuImageRecognitionList.size() > 0) {
List<StuImageRecognitionTraining> collect = stuImageRecognitionList.stream().filter(item -> item.getStemContent().equals("以下选项属于图片预处理方法的是?")).collect(Collectors.toList());
if (collect.size() > 0 ) {
if (collect.get(0).getStudentAnswer().equals("A,B,C,D,E")){
if (!Arrays.equals(arr, select))
{
if (collect.size() > 0) {
if (collect.get(0).getStudentAnswer().equals("A,B,C,D,E")) {
if (!Arrays.equals(arr, select)) {
return "选择错误!";
}
return "提交成功";
return "提交成功";
}
if (!Arrays.equals(arr, select))
{
if (!Arrays.equals(arr, select)) {
return "选择错误!";
}else {
} else {
collect.get(0).setStudentAnswer(answer);
stuImageRecognitionTrainingMapper.updateByPrimaryKey(collect.get(0));
return "选择正确!";
@ -540,7 +515,6 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
}
String[] stuAnswer = answer.split(",");
StuImageRecognitionTrainingExample example = new StuImageRecognitionTrainingExample();
@ -581,7 +555,8 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
}
/**
*:
* :
*
* @param userId
* @return
*/
@ -606,23 +581,21 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
ArrayList<StuImageRecognitionTraining> arrayList = new ArrayList<>();
if (lastRecognitionTrainingList.size()>0)
{
if (lastRecognitionTrainingList.size() > 0) {
//用户可能未做题,需要返回题目和已做题目和结果
for (int i = 0; i < firstRecognitionTrainingLists.size(); i++) {
for (int j = 0; j < lastRecognitionTrainingList.size(); j++) {
//查询出已做题目 根据题目判断
if (firstRecognitionTrainingLists.get(i).getOptionF().equals(lastRecognitionTrainingList.get(j).getOptionF())){
if (firstRecognitionTrainingLists.get(i).getOptionF().equals(lastRecognitionTrainingList.get(j).getOptionF())) {
arrayList.add(lastRecognitionTrainingList.get(j));
continue;
}else {
} else {
firstCollect.removeAll(lastCollect);
for (int z = 0; z < firstCollect.size(); z++) {
if (firstRecognitionTrainingLists.get(i).getOptionF().equals(firstCollect.get(z)))
{
if (firstRecognitionTrainingLists.get(i).getOptionF().equals(firstCollect.get(z))) {
arrayList.add(firstRecognitionTrainingLists.get(i));
break;
break;
}
}
@ -631,17 +604,16 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
}
Collections.sort(arrayList,Comparator.comparing(StuImageRecognitionTraining::getOptionF));
arrayList.forEach(item->{
Collections.sort(arrayList, Comparator.comparing(StuImageRecognitionTraining::getOptionF));
arrayList.forEach(item -> {
item.setOptionF(null);
item.setModel(null);
});
return arrayList;
}else {
if (firstRecognitionTrainingLists.size()>0)
{
} else {
if (firstRecognitionTrainingLists.size() > 0) {
//不返回正确答案
firstRecognitionTrainingLists.forEach(item->{
firstRecognitionTrainingLists.forEach(item -> {
item.setCorrectAnswer(null);
item.setModel(null);
item.setOptionF(null);
@ -649,40 +621,36 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
);
return firstRecognitionTrainingLists;
}else {
throw new InvoceTException(HttpStatus.ACCEPTED,"未查询到题目");
} else {
throw new InvoceTException(HttpStatus.ACCEPTED, "未查询到题目");
}
}
}
/**
* :
* @param robotTitleSubDTO
* @return
*/
* :
*
* @param robotTitleSubDTO
* @return
*/
@Override
public Integer robotTitleSub(robotTitleSubDTO robotTitleSubDTO) {
//判断是否多次提交
StuImageRecognitionTrainingExample example = new StuImageRecognitionTrainingExample();
example.createCriteria().andUserIdEqualTo(robotTitleSubDTO.getUserId()).andModelEqualTo("机器人");
List<StuImageRecognitionTraining> lists = stuImageRecognitionTrainingMapper.selectByExample(example);
//第n次提交
if (lists.size()>0 && lists != null)
{
if (lists.size() > 0 && lists != null) {
return -10;
}
//记录错误次数
int sum = 0;
//获取所有结果
@ -690,19 +658,19 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
firstExample.createCriteria().andUserIdIsNull().andModelEqualTo("机器人");
List<StuImageRecognitionTraining> firstRecognitionTrainingLists = stuImageRecognitionTrainingMapper.selectByExample(firstExample);
Map<String,String> strings = new HashMap<>();
Map<String, String> strings = new HashMap<>();
strings.put("步骤一",robotTitleSubDTO.getFirstTitle());
strings.put("步骤二",robotTitleSubDTO.getSecondTitle());
strings.put("步骤三",robotTitleSubDTO.getThirdTitle());
strings.put("步骤一", robotTitleSubDTO.getFirstTitle());
strings.put("步骤二", robotTitleSubDTO.getSecondTitle());
strings.put("步骤三", robotTitleSubDTO.getThirdTitle());
if (firstRecognitionTrainingLists.size()>0){
if (firstRecognitionTrainingLists.size() > 0) {
//获取三个题目的结果判断对错
// 第一题
for (int i = 0; i < firstRecognitionTrainingLists.size(); i++) {
// for (Map.Entry<String, String> entry : strings.entrySet()) {
// for (Map.Entry<String, String> entry : strings.entrySet()) {
Iterator<Map.Entry<String, String>> iterator = strings.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, String> entry = iterator.next();
@ -713,9 +681,9 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
sum++;
//用户答案为空 也是错误
StuImageRecognitionTraining stuImageRecognitionTraining = new StuImageRecognitionTraining();
BeanUtils.copyProperties( firstRecognitionTrainingLists.get(i),stuImageRecognitionTraining);
BeanUtils.copyProperties(firstRecognitionTrainingLists.get(i), stuImageRecognitionTraining);
stuImageRecognitionTraining.setUserId(robotTitleSubDTO.getUserId());
stuImageRecognitionTraining.setId((int)IdUtil.getSnowflakeNextId());
stuImageRecognitionTraining.setId((int) IdUtil.getSnowflakeNextId());
stuImageRecognitionTraining.setStudentAnswer("该题未做");
stuImageRecognitionTraining.setRightOrWrong(0);
@ -724,8 +692,7 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
}
if (key.equals(firstRecognitionTrainingLists.get(i).getOptionF())){
if (key.equals(firstRecognitionTrainingLists.get(i).getOptionF())) {
//比较答案判断对错
//用户答案
String[] stuFirst = value.split(",");
@ -736,18 +703,17 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
boolean equals = Arrays.equals(stuFirst, correctAnswer);
StuImageRecognitionTraining stuImageRecognitionTraining = new StuImageRecognitionTraining();
BeanUtils.copyProperties( firstRecognitionTrainingLists.get(i),stuImageRecognitionTraining);
BeanUtils.copyProperties(firstRecognitionTrainingLists.get(i), stuImageRecognitionTraining);
stuImageRecognitionTraining.setUserId(robotTitleSubDTO.getUserId());
stuImageRecognitionTraining.setId((int)IdUtil.getSnowflakeNextId());
stuImageRecognitionTraining.setId((int) IdUtil.getSnowflakeNextId());
stuImageRecognitionTraining.setStudentAnswer(value);
if (!equals)
{
if (!equals) {
stuImageRecognitionTraining.setRightOrWrong(0);
sum++;
}else {
} else {
stuImageRecognitionTraining.setRightOrWrong(1);
@ -762,8 +728,8 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
}
}else {
throw new InvoceTException(HttpStatus.ACCEPTED,"题目不存在");
} else {
throw new InvoceTException(HttpStatus.ACCEPTED, "题目不存在");
}
return sum;
}
@ -777,12 +743,12 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
StuHadoopTrainExample stuHadoopTrainExample = new StuHadoopTrainExample();
stuHadoopTrainExample.createCriteria().andUserIdEqualTo(userId);
List<StuHadoopTrain> stuHadoopTrainList = stuHadoopTrainMapper.selectByExample(stuHadoopTrainExample);
if (!stuHadoopTrainList.isEmpty())
{ String appendOne = stuHadoopTrainList.get(0).getAppend();
if (!stuHadoopTrainList.isEmpty()) {
String appendOne = stuHadoopTrainList.get(0).getAppend();
String parsedOne = JSON.parseObject(appendOne, String.class);
//判断是否做过改题目
String[] split = parsedOne.split(",");
if (split.length!=17){
if (split.length != 17) {
stuHadoopTrainMapper.deleteByPrimaryKey(stuHadoopTrainList.get(0).getId());
@ -792,9 +758,6 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
}
}
@Override
@ -805,8 +768,7 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
StuHadoopTrainExample stuHadoopTrainExample = new StuHadoopTrainExample();
stuHadoopTrainExample.createCriteria().andUserIdEqualTo(userId);
List<StuHadoopTrain> stuHadoopTrainList = stuHadoopTrainMapper.selectByExample(stuHadoopTrainExample);
if (!stuHadoopTrainList.isEmpty())
{
if (!stuHadoopTrainList.isEmpty()) {
StuHadoopTrain stuHadoopTrain = stuHadoopTrainList.get(0);
Integer state = stuHadoopTrain.getState();
return state;
@ -817,18 +779,6 @@ public class StuFiveGTrainingServiceImpl implements StuFiveGTrainingService {
}
// //自然语言处理:获取题目
// @Override
// public List<StuImageRecognitionTraining> getTitles(String userId) {

@ -42,9 +42,6 @@ public class StuUserProfileDatabaseServiceImpl implements StuUserProfileDatabase
private StuUploadExcelUserMapper uploadExcelUserMapper;
/**
*
*
@ -63,9 +60,6 @@ public class StuUserProfileDatabaseServiceImpl implements StuUserProfileDatabase
list.add("用户评论表");
//用户属性表
StuUserAttributeExample userAttributeExample = new StuUserAttributeExample();
userAttributeExample.setOrderByClause("id asc");
List<StuUserAttribute> userAttributeList = userAttributeMapper.selectByExample(userAttributeExample);
@ -85,13 +79,12 @@ public class StuUserProfileDatabaseServiceImpl implements StuUserProfileDatabase
.tableNames(list).build();
return new ResultEntity<>(HttpStatus.OK,userProfileDto);
return new ResultEntity<>(HttpStatus.OK, userProfileDto);
}
/**
*
*
* @param userId
* @param tableName
* @param selfTableName
@ -99,115 +92,112 @@ public class StuUserProfileDatabaseServiceImpl implements StuUserProfileDatabase
*/
@Override
public ResultEntity getBaseInfoBySelect(String userId, String tableName, String selfTableName,Integer index,Integer size) {
public ResultEntity getBaseInfoBySelect(String userId, String tableName, String selfTableName, Integer index, Integer size) {
if (index == null || size == null )
{
if (index == null || size == null) {
throw new RuntimeException( "请输入正确的页码格式!");
throw new RuntimeException("请输入正确的页码格式!");
}
if(tableName!=null && !tableName.isEmpty()){
switch (tableName){
case Constant.YONGHUSHUXINGBIAO:
//开启分页
PageHelper.startPage(index,size);
//用户属性表
StuUserAttributeExample userAttributeExample = new StuUserAttributeExample();
userAttributeExample.setOrderByClause("id asc");
List<StuUserAttribute> userAttributeList = userAttributeMapper.selectByExample(userAttributeExample);
if (userAttributeList.isEmpty()) {
throw new ServiceException(HttpStatus.OK, "未查询到用户数据!");
}
return new ResultEntity<>(HttpStatus.OK,new PageInfo<>(userAttributeList));
case Constant.YONGHUDENGLUHUOYUEBIAO:
//开启分页
PageHelper.startPage(index,size);
//用户登录活跃表
StuUserLoginActiveExample userLoginActiveExample = new StuUserLoginActiveExample();
userLoginActiveExample.setOrderByClause("id asc");
List<StuUserLoginActive> userLoginActiveList = userLoginActiveMapper.selectByExample(userLoginActiveExample);
if (userLoginActiveList.isEmpty()) {
throw new ServiceException(HttpStatus.OK, "未查询到用户数据!");
}
return new ResultEntity<>(HttpStatus.OK,new PageInfo<>(userLoginActiveList));
case Constant.YONGHUXIAOFEINENGLIBIAO:
//开启分页
PageHelper.startPage(index,size);
//用户消费能力表
StuUserConsumptionAbilityExample userConsumptionAbilityExample = new StuUserConsumptionAbilityExample();
userConsumptionAbilityExample.setOrderByClause("id asc");
List<StuUserConsumptionAbility> userConsumptionAbilityList = userConsumptionAbilityMapper.selectByExample(userConsumptionAbilityExample);
if (userConsumptionAbilityList.isEmpty()) {
throw new ServiceException(HttpStatus.OK, "未查询到用户数据!");
}
return new ResultEntity<>(HttpStatus.OK,new PageInfo<>(userConsumptionAbilityList));
case Constant.YONGHUXINGWEIBIAO:
//开启分页
PageHelper.startPage(index,size);
//用户行为表
StuUserAttributeBehaviorExample userAttributeBehaviorExample = new StuUserAttributeBehaviorExample();
userAttributeBehaviorExample.setOrderByClause("id asc");
List<StuUserAttributeBehavior> userAttributeBehaviorList = userAttributeBehaviorMapper.selectByExample(userAttributeBehaviorExample);
if (userAttributeBehaviorList.isEmpty()) {
throw new ServiceException(HttpStatus.OK, "未查询到用户数据!");
}
return new ResultEntity<>(HttpStatus.OK,new PageInfo<>(userAttributeBehaviorList));
if (tableName != null && !tableName.isEmpty()) {
switch (tableName) {
case Constant.YONGHUSHUXINGBIAO:
//开启分页
PageHelper.startPage(index, size);
//用户属性表
StuUserAttributeExample userAttributeExample = new StuUserAttributeExample();
userAttributeExample.setOrderByClause("id asc");
List<StuUserAttribute> userAttributeList = userAttributeMapper.selectByExample(userAttributeExample);
if (userAttributeList.isEmpty()) {
throw new ServiceException(HttpStatus.OK, "未查询到用户数据!");
}
return new ResultEntity<>(HttpStatus.OK, new PageInfo<>(userAttributeList));
case Constant.YONGHUDENGLUHUOYUEBIAO:
//开启分页
PageHelper.startPage(index, size);
//用户登录活跃表
StuUserLoginActiveExample userLoginActiveExample = new StuUserLoginActiveExample();
userLoginActiveExample.setOrderByClause("id asc");
List<StuUserLoginActive> userLoginActiveList = userLoginActiveMapper.selectByExample(userLoginActiveExample);
if (userLoginActiveList.isEmpty()) {
throw new ServiceException(HttpStatus.OK, "未查询到用户数据!");
}
return new ResultEntity<>(HttpStatus.OK, new PageInfo<>(userLoginActiveList));
case Constant.YONGHUXIAOFEINENGLIBIAO:
//开启分页
PageHelper.startPage(index, size);
//用户消费能力表
StuUserConsumptionAbilityExample userConsumptionAbilityExample = new StuUserConsumptionAbilityExample();
userConsumptionAbilityExample.setOrderByClause("id asc");
List<StuUserConsumptionAbility> userConsumptionAbilityList = userConsumptionAbilityMapper.selectByExample(userConsumptionAbilityExample);
if (userConsumptionAbilityList.isEmpty()) {
throw new ServiceException(HttpStatus.OK, "未查询到用户数据!");
}
return new ResultEntity<>(HttpStatus.OK, new PageInfo<>(userConsumptionAbilityList));
case Constant.YONGHUXINGWEIBIAO:
//开启分页
PageHelper.startPage(index, size);
//用户行为表
StuUserAttributeBehaviorExample userAttributeBehaviorExample = new StuUserAttributeBehaviorExample();
userAttributeBehaviorExample.setOrderByClause("id asc");
List<StuUserAttributeBehavior> userAttributeBehaviorList = userAttributeBehaviorMapper.selectByExample(userAttributeBehaviorExample);
if (userAttributeBehaviorList.isEmpty()) {
throw new ServiceException(HttpStatus.OK, "未查询到用户数据!");
}
return new ResultEntity<>(HttpStatus.OK, new PageInfo<>(userAttributeBehaviorList));
//todo 用户评论表
case Constant.YONGHUPINGLUNBIAO:
//开启分页
PageHelper.startPage(index,size);
//用户行为表
StuUserAttributeBehaviorExample behaviorExample = new StuUserAttributeBehaviorExample();
behaviorExample.setOrderByClause("id asc");
List<StuUserAttributeBehavior> behaviorList = userAttributeBehaviorMapper.selectByExample(behaviorExample);
if (behaviorList.isEmpty()) {
throw new ServiceException(HttpStatus.OK, "未查询到用户数据!");
}
return new ResultEntity<>(HttpStatus.OK,new PageInfo<>(behaviorList));
//todo 用户评论表
}
case Constant.YONGHUPINGLUNBIAO:
//开启分页
PageHelper.startPage(index, size);
//用户行为表
StuUserAttributeBehaviorExample behaviorExample = new StuUserAttributeBehaviorExample();
behaviorExample.setOrderByClause("id asc");
List<StuUserAttributeBehavior> behaviorList = userAttributeBehaviorMapper.selectByExample(behaviorExample);
if (behaviorList.isEmpty()) {
throw new ServiceException(HttpStatus.OK, "未查询到用户数据!");
}
return new ResultEntity<>(HttpStatus.OK, new PageInfo<>(behaviorList));
}
//todo 用户评论表
}
}
if(selfTableName!=null && !selfTableName.isEmpty()){
//todo 自建表查询
List<String> nameList = uploadExcelUserMapper.selectDistModuleName(userId);
String module = nameList.stream().filter(item -> item.equals(selfTableName)).findFirst().orElse(null);
if (selfTableName != null && !selfTableName.isEmpty()) {
//todo 自建表查询
if (module==null)
{
return new ResultEntity<>(HttpStatus.BAD_REQUEST,"自建表不存在");
}
PageHelper.startPage(index,size);
StuUploadExcelUserExample uploadExcelUserExample = new StuUploadExcelUserExample();
uploadExcelUserExample.createCriteria().andUserIdEqualTo(userId).andModuleEqualTo(module);
List<StuUploadExcelUser> stuUploadExcelUsers = uploadExcelUserMapper.selectByExample(uploadExcelUserExample);
List<String> nameList = uploadExcelUserMapper.selectDistModuleName(userId);
String module = nameList.stream().filter(item -> item.equals(selfTableName)).findFirst().orElse(null);
if (stuUploadExcelUsers.isEmpty())
{
return new ResultEntity<>(HttpStatus.OK,"数据不存在!");
}
if (module == null) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "自建表不存在");
}
PageHelper.startPage(index, size);
StuUploadExcelUserExample uploadExcelUserExample = new StuUploadExcelUserExample();
uploadExcelUserExample.createCriteria().andUserIdEqualTo(userId).andModuleEqualTo(module);
List<StuUploadExcelUser> stuUploadExcelUsers = uploadExcelUserMapper.selectByExample(uploadExcelUserExample);
if (stuUploadExcelUsers.isEmpty()) {
return new ResultEntity<>(HttpStatus.OK, "数据不存在!");
}
return new ResultEntity<>(HttpStatus.OK,new PageInfo<>(stuUploadExcelUsers));
}
return new ResultEntity<>(HttpStatus.OK, new PageInfo<>(stuUploadExcelUsers));
}
return new ResultEntity<>(HttpStatus.BAD_REQUEST,"请求错误");
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "请求错误");
}
@ -215,8 +205,7 @@ public class StuUserProfileDatabaseServiceImpl implements StuUserProfileDatabase
public ResultEntity selfExcelBaseInfo(String userId) {
List<String> nameList = uploadExcelUserMapper.selectDistModuleName(userId);
return new ResultEntity<>(HttpStatus.OK,nameList);
return new ResultEntity<>(HttpStatus.OK, nameList);
}

@ -99,6 +99,25 @@ public class UserBehaviorProfilingAnaServiceImpl implements UserBehaviorProfilin
}
if (StringUtils.hasText(learning.getStepechartlist1()))
{
String json = JSONObject.toJSONString(learning.getStepechartlist1());
machineLearning.setStepechartlist1(json);
}
if (StringUtils.hasText(learning.getStepechartlist2()))
{
String json = JSONObject.toJSONString(learning.getStepechartlist2());
machineLearning.setStepechartlist2(json);
}
if (StringUtils.hasText(learning.getStepechartlist3()))
{
String json = JSONObject.toJSONString(learning.getStepechartlist3());
machineLearning.setStepechartlist3(json);
}
machineLearningMapper.updateByPrimaryKeySelective(machineLearning);
return new ResultEntity<>(HttpStatus.OK, "保存成功!");
@ -114,7 +133,23 @@ public class UserBehaviorProfilingAnaServiceImpl implements UserBehaviorProfilin
learning.setActiveUserAnalysis(json);
}
if (StringUtils.hasText(learning.getStepechartlist1()))
{
String json = JSONObject.toJSONString(learning.getStepechartlist1());
learning.setStepechartlist1(json);
}
if (StringUtils.hasText(learning.getStepechartlist2()))
{
String json = JSONObject.toJSONString(learning.getStepechartlist2());
learning.setStepechartlist2(json);
}
if (StringUtils.hasText(learning.getStepechartlist3()))
{
String json = JSONObject.toJSONString(learning.getStepechartlist3());
learning.setStepechartlist3(json);
}
machineLearningMapper.insertSelective(learning);
return new ResultEntity<>(HttpStatus.OK, "保存成功!");
@ -142,15 +177,28 @@ public class UserBehaviorProfilingAnaServiceImpl implements UserBehaviorProfilin
}
String activeUserAnalysis = machineLearningList.get(0).getActiveUserAnalysis();
List<StuMachineLearningInfoDTO> stuMachineLearningInfoDTOList = JSONObject.parseArray(activeUserAnalysis, StuMachineLearningInfoDTO.class);
if(StringUtils.hasText(activeUserAnalysis)){
List<StuMachineLearningInfoDTO> stuMachineLearningInfoDTOList = JSONObject.parseArray(activeUserAnalysis, StuMachineLearningInfoDTO.class);
machineLearningList.get(0).setStuMachineLearningInfoDTOList(stuMachineLearningInfoDTOList);
}
if(StringUtils.hasText(machineLearningList.get(0).getStepechartlist1())){
String stuMachineLearningInfoDTOList = JSONObject.parseObject(machineLearningList.get(0).getStepechartlist1(), String.class);
machineLearningList.get(0).setStepechartlist1(stuMachineLearningInfoDTOList);
}
if(StringUtils.hasText(machineLearningList.get(0).getStepechartlist2())){
String stuMachineLearningInfoDTOList = JSONObject.parseObject(machineLearningList.get(0).getStepechartlist2(), String.class);
machineLearningList.get(0).setStepechartlist2(stuMachineLearningInfoDTOList);
}
machineLearningList.get(0).setStuMachineLearningInfoDTOList(stuMachineLearningInfoDTOList);
if(StringUtils.hasText(machineLearningList.get(0).getStepechartlist3())){
String stuMachineLearningInfoDTOList = JSONObject.parseObject(machineLearningList.get(0).getStepechartlist3(), String.class);
machineLearningList.get(0).setStepechartlist3(stuMachineLearningInfoDTOList);
}
return new ResultEntity<>(HttpStatus.OK, "查询成功", machineLearningList.get(0));
}
/**

@ -77,6 +77,9 @@
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.sztzjy.marketing.entity.StuMachineLearning">
<result column="active_user_analysis" jdbcType="LONGVARCHAR" property="activeUserAnalysis" />
<result column="stepEchartList1" jdbcType="LONGVARCHAR" property="stepechartlist1" />
<result column="stepEchartList2" jdbcType="LONGVARCHAR" property="stepechartlist2" />
<result column="stepEchartList3" jdbcType="LONGVARCHAR" property="stepechartlist3" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -151,7 +154,7 @@
step_new_shiliu
</sql>
<sql id="Blob_Column_List">
active_user_analysis
active_user_analysis, stepEchartList1, stepEchartList2, stepEchartList3
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.sztzjy.marketing.entity.StuMachineLearningExample" resultMap="ResultMapWithBLOBs">
select
@ -226,7 +229,9 @@
step_new_nine, step_new_eight, step_new_ten,
step_new_eleven, step_new_shier, step_new_shisan,
step_new_shisi, step_new_shiwu, step_new_shiliu,
active_user_analysis)
active_user_analysis, stepEchartList1,
stepEchartList2, stepEchartList3
)
values (#{id,jdbcType=INTEGER}, #{stepOneA,jdbcType=VARCHAR}, #{stepOneB,jdbcType=VARCHAR},
#{stepOneC,jdbcType=VARCHAR}, #{stepOneD,jdbcType=VARCHAR}, #{stepTwoA,jdbcType=VARCHAR},
#{stepTwoB,jdbcType=VARCHAR}, #{stepTwoC,jdbcType=VARCHAR}, #{stepThreeA,jdbcType=VARCHAR},
@ -251,7 +256,9 @@
#{stepNewNine,jdbcType=VARCHAR}, #{stepNewEight,jdbcType=VARCHAR}, #{stepNewTen,jdbcType=VARCHAR},
#{stepNewEleven,jdbcType=VARCHAR}, #{stepNewShier,jdbcType=VARCHAR}, #{stepNewShisan,jdbcType=VARCHAR},
#{stepNewShisi,jdbcType=VARCHAR}, #{stepNewShiwu,jdbcType=VARCHAR}, #{stepNewShiliu,jdbcType=VARCHAR},
#{activeUserAnalysis,jdbcType=LONGVARCHAR})
#{activeUserAnalysis,jdbcType=LONGVARCHAR}, #{stepechartlist1,jdbcType=LONGVARCHAR},
#{stepechartlist2,jdbcType=LONGVARCHAR}, #{stepechartlist3,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.marketing.entity.StuMachineLearning">
insert into stu_machine_learning
@ -475,6 +482,15 @@
<if test="activeUserAnalysis != null">
active_user_analysis,
</if>
<if test="stepechartlist1 != null">
stepEchartList1,
</if>
<if test="stepechartlist2 != null">
stepEchartList2,
</if>
<if test="stepechartlist3 != null">
stepEchartList3,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -696,6 +712,15 @@
<if test="activeUserAnalysis != null">
#{activeUserAnalysis,jdbcType=LONGVARCHAR},
</if>
<if test="stepechartlist1 != null">
#{stepechartlist1,jdbcType=LONGVARCHAR},
</if>
<if test="stepechartlist2 != null">
#{stepechartlist2,jdbcType=LONGVARCHAR},
</if>
<if test="stepechartlist3 != null">
#{stepechartlist3,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.marketing.entity.StuMachineLearningExample" resultType="java.lang.Long">
@ -926,6 +951,15 @@
<if test="record.activeUserAnalysis != null">
active_user_analysis = #{record.activeUserAnalysis,jdbcType=LONGVARCHAR},
</if>
<if test="record.stepechartlist1 != null">
stepEchartList1 = #{record.stepechartlist1,jdbcType=LONGVARCHAR},
</if>
<if test="record.stepechartlist2 != null">
stepEchartList2 = #{record.stepechartlist2,jdbcType=LONGVARCHAR},
</if>
<if test="record.stepechartlist3 != null">
stepEchartList3 = #{record.stepechartlist3,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -1005,7 +1039,10 @@
step_new_shisi = #{record.stepNewShisi,jdbcType=VARCHAR},
step_new_shiwu = #{record.stepNewShiwu,jdbcType=VARCHAR},
step_new_shiliu = #{record.stepNewShiliu,jdbcType=VARCHAR},
active_user_analysis = #{record.activeUserAnalysis,jdbcType=LONGVARCHAR}
active_user_analysis = #{record.activeUserAnalysis,jdbcType=LONGVARCHAR},
stepEchartList1 = #{record.stepechartlist1,jdbcType=LONGVARCHAR},
stepEchartList2 = #{record.stepechartlist2,jdbcType=LONGVARCHAR},
stepEchartList3 = #{record.stepechartlist3,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -1307,6 +1344,15 @@
<if test="activeUserAnalysis != null">
active_user_analysis = #{activeUserAnalysis,jdbcType=LONGVARCHAR},
</if>
<if test="stepechartlist1 != null">
stepEchartList1 = #{stepechartlist1,jdbcType=LONGVARCHAR},
</if>
<if test="stepechartlist2 != null">
stepEchartList2 = #{stepechartlist2,jdbcType=LONGVARCHAR},
</if>
<if test="stepechartlist3 != null">
stepEchartList3 = #{stepechartlist3,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
@ -1383,7 +1429,10 @@
step_new_shisi = #{stepNewShisi,jdbcType=VARCHAR},
step_new_shiwu = #{stepNewShiwu,jdbcType=VARCHAR},
step_new_shiliu = #{stepNewShiliu,jdbcType=VARCHAR},
active_user_analysis = #{activeUserAnalysis,jdbcType=LONGVARCHAR}
active_user_analysis = #{activeUserAnalysis,jdbcType=LONGVARCHAR},
stepEchartList1 = #{stepechartlist1,jdbcType=LONGVARCHAR},
stepEchartList2 = #{stepechartlist2,jdbcType=LONGVARCHAR},
stepEchartList3 = #{stepechartlist3,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.marketing.entity.StuMachineLearning">

@ -394,17 +394,17 @@
</update>
<!-- <select id="selectInfoBySchoolId" resultType="com.sztzjy.marketing.entity.dto.TchrePortPresentationDTO">-->
<!-- select s.name as name , s.student_id as studentId, s.class_name as className,-->
<!-- i.module as module ,i.file_name as fileName ,i.create_time as createTime ,i.file_size as fileSize-->
<!-- from stu_upload_img_ai i-->
<!-- join-->
<!-- stu_user s-->
<!-- on-->
<!-- i.user_id = s.user_id-->
<!-- where-->
<!-- s.school_id = #{schoolId}-->
<!-- order by-->
<!-- i.create_time asc-->
<!-- </select>-->
<select id="selectInfoBySchoolId" resultType="com.sztzjy.marketing.entity.dto.TchrePortPresentationDTO">
select s.name as name , s.student_id as studentId, s.class_name as className,
i.module as module ,i.report_name as fileName ,i.upload_time as createTime ,i.size as fileSize,i.ascription as ascription
from stu_practical_training_report i
join
stu_user s
on
i.userId = s.user_id
where
s.school_id = #{schoolId}
order by
i.upload_time asc
</select>
</mapper>
Loading…
Cancel
Save