Merge remote-tracking branch 'origin/master'

master
xiaoCJ 8 months ago
commit 9d7ff32697

@ -32,6 +32,6 @@ public class Constant {
public static final String SHIZHAN = "实战考核模块";
public static final String THEORY = "理论考试模块";
public static final String RESOURCE = "资源中心模块";
public static final String API_URL = "http://192.168.2.16:8889";
public static final String API_URL = "http://120.79.54.255:8889";
}

@ -105,88 +105,130 @@ public class ExerciseExperimentalTraining {
}
@AnonymousAccess
@ApiOperation("**实训演练页面查询")
@ApiOperation("实训演练页面查询")
@PostMapping("getCourseChapter")
public ResultEntity<List<SysCourseDto>> getIndexTheoryTest(@RequestParam String userId,@RequestParam String systemOwner) {
// List<SysCourse> sysCourseList = sysCourseMapper.getBySchoolId();
List<SysTwoCatalog> sysCourseList = null;
try {
sysCourseList = CourseAPI.selectTwoCataLogByInnerAndAsc(systemOwner);
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心获取内置二级目录失败");
}
List<SysCourseDto> dtoList = new ArrayList<>();
// 批量查询所有章节
List<String> courseIds = sysCourseList.stream()
.map(SysTwoCatalog::getTwoId)
.collect(Collectors.toList());
List<SysThreeCatalog> sysCourseChapters = null;
try {
sysCourseChapters = CourseAPI.selectChaptersByCourseIdsAndAsc(courseIds);
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心根据课程IDList查询章节集合失败");
}
List<String> courseChapterIds = sysCourseChapters.stream().map(SysThreeCatalog::getTwoId).collect(Collectors.toList());
Map<String, List<String>> idMap = new HashMap<>();
for (SysTwoCatalog sysCourse : sysCourseList) {
String courseId = sysCourse.getTwoId();
List<String> chapterIds = sysCourseChapters.stream()
.filter(chapter -> chapter.getTwoId().equals(courseId))
.map(SysThreeCatalog::getThreeId)
.collect(Collectors.toList());
idMap.put(courseId, chapterIds);
// 批量查询所有案例题步骤
SysCaseQuestionStepExample stepExample = new SysCaseQuestionStepExample();
stepExample.setOrderByClause("sort");
List<TestTestSysCaseQuestionStepWithBLOBs> sysCaseQuestionSteps= null;
try {
sysCaseQuestionSteps = CaseApi.selectAllStepBySystemOwner(systemOwner);
} catch (IOException e) {
e.printStackTrace();
}
Map<String, List<TestTestSysCaseQuestionStepWithBLOBs>> caseStepsMap = sysCaseQuestionSteps.stream()
.collect(Collectors.groupingBy(TestTestSysCaseQuestionStepWithBLOBs::getCaseId));
// 批量查询案例题ID
Map<String, List<String>> caseIdMap = null;
try {
caseIdMap = CaseApi.getMapChapterIdAndCaseIdsByCourseIdAndChapterId(sysCourseChapters,systemOwner);
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心查询失败");
}
//为循环提供数据
List<StuTraining> progressByChapterIds = stuTrainingMapper.getByUserIdAndChapterIds(userId, courseChapterIds); //循环外先查出所有进度
// 批量获取用户对所有章节的进度
List<StuTraining> progressByChapterIds = stuTrainingMapper.getByUserIdAndChapterIds(userId,
sysCourseChapters.stream().map(SysThreeCatalog::getThreeId).collect(Collectors.toList()));
Map<String, BigDecimal> progressMap = progressByChapterIds.stream()
.collect(Collectors.toMap(StuTraining::getChapterId,
stuTraining -> Optional.ofNullable(stuTraining.getProgress()).orElse(BigDecimal.ZERO),
(p1, p2) -> p1)); // 默认值为 BigDecimal.ZERO //进度为空则给0
.collect(Collectors.toMap(StuTraining::getChapterId,stuTraining -> Optional.ofNullable(stuTraining.getProgress()).orElse(BigDecimal.ZERO), (p1, p2) -> p1));
//一层一层查出 课程,章节,章节下案例题
// 构建结果列表
for (SysTwoCatalog sysCourse : sysCourseList) {
SysCourseDto newDto = new SysCourseDto();
BeanUtils.copyProperties(sysCourse, newDto);
String courseId = newDto.getCourseId();
newDto.setCourseId(sysCourse.getTwoId());
newDto.setSequence(sysCourse.getSort());
newDto.setCourseName(sysCourse.getTwoName());
// newDto.setInputType(sysCourse.getCreator());
newDto.setSchoolId(sysCourse.getCreator());
List<SysCourseChapterDto> CourseChapterDtoList = new ArrayList<>();
for (SysThreeCatalog sysCourseChapter : sysCourseChapters) {
SysCourseChapterDto sysCourseChapterDto = new SysCourseChapterDto();
BeanUtils.copyProperties(sysCourseChapter, sysCourseChapterDto);
String chapterId = sysCourseChapter.getThreeId();
BigDecimal progress = progressMap.get(chapterId);
sysCourseChapterDto.setSchedule(progress);
CourseChapterDtoList.add(sysCourseChapterDto);
}
//查询案例题
List<String> list1 = idMap.get(courseId); //取出章节ID
List<TestSysCaseQuestion> list = null;
try {
list = CaseApi.selectCaseByChapterIdList(list1);
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心根据三级IdList查询案例题失败");
List<SysThreeCatalog> chapterList = sysCourseChapters.stream()
.filter(chapter -> sysCourse.getTwoId().equals(chapter.getTwoId()))
.collect(Collectors.toList());
for (SysThreeCatalog chapter : chapterList) {
SysCourseChapterDto chapterDto = new SysCourseChapterDto();
chapterDto.setChapterId(chapter.getThreeId());
chapterDto.setChapterName(chapter.getThreeName());
chapterDto.setSequence(chapter.getSort());
chapterDto.setCourseId(chapter.getTwoId());
BigDecimal progress = progressMap.getOrDefault(chapter.getThreeId(), BigDecimal.ZERO);
chapterDto.setSchedule(progress);
// 获取案例题步骤信息
List<String> caseIds = caseIdMap.get(chapter.getThreeId());
if (caseIds != null && !caseIds.isEmpty()) {
List<AAA>list =new ArrayList<>();
for (String caseId : caseIds) {
List<TestTestSysCaseQuestionStepWithBLOBs> steps = caseStepsMap.get(caseId);
if (steps != null && !steps.isEmpty()) {
for (TestTestSysCaseQuestionStepWithBLOBs step : steps) {
AAA aaa =new AAA();
aaa.setStepID(step.getCaseStepId());
aaa.setTitle(step.getTitle());
aaa.setSort(step.getSort());
list.add(aaa);
}
}
}
//排序
List<AAA> sortedList = list.stream()
.sorted(Comparator
.comparingInt(AAA::getSort)
.thenComparing(AAA::getStepID).reversed())
.collect(Collectors.toList());
List<AAA> orderedList = new ArrayList<>();
for (AAA item : sortedList) {
// 获取sort字段的值
int sort = item.getSort();
// 找到插入位置
int index = 0;
for (; index < orderedList.size(); index++) {
if (orderedList.get(index).getSort() >= sort) {
break;
}
List<String> caseIds = list.stream().map(TestSysCaseQuestion::getCaseId).collect(Collectors.toList());
List<TestTestSysCaseQuestionStepWithBLOBs> sysCaseQuestionSteps = null;
try {
sysCaseQuestionSteps = CaseApi.selectCaseStepListBatchByIdListAndSort(caseIds);
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心根据案例题IDList 查询案例题步骤并排序失败");
}
Map<String, String> collect = sysCaseQuestionSteps.stream().collect(Collectors.toMap(TestTestSysCaseQuestionStepWithBLOBs::getCaseStepId, TestTestSysCaseQuestionStepWithBLOBs::getTitle));
newDto.setSysCourseChapterDtos(CourseChapterDtoList);
dtoList.add(newDto);
newDto.setTitleAndId(collect);
// 插入元素到指定位置
orderedList.add(index, item);
}
chapterDto.setTitleAndId(orderedList);
}
CourseChapterDtoList.add(chapterDto);
}
newDto.setSysCourseChapterDtos(CourseChapterDtoList);
dtoList.add(newDto);
}
return new ResultEntity<List<SysCourseDto>>(dtoList);
return new ResultEntity<>(dtoList);
}
//判断案例是否有数据集
@GetMapping("haveResourceData")
@ApiOperation("判断案例是否有数据集")

@ -32,10 +32,10 @@ public class ExerciseLearningEvaluation {
@ApiOperation("**客观题列表查询,回显")
@AnonymousAccess
public ResultEntity<List<SysObjectiveQuestionDto>> selectObjectQuestionList(@ApiParam("章节Id") @RequestParam String chapterId,
@RequestParam String userId) {
@RequestParam String userId,@RequestParam String schoolId,@RequestParam String systemOwner) {
List<SysObjectiveQuestionDto> list = null;
try {
list = exerciseService.selectObjectQuestionListByChapterId(chapterId,userId);
list = exerciseService.selectObjectQuestionListByChapterId(chapterId,userId,schoolId,systemOwner);
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心查询失败");
}
@ -48,10 +48,10 @@ public class ExerciseLearningEvaluation {
@AnonymousAccess
public ResultEntity commitObjectQuestionList(@RequestBody List<SysObjectiveQuestionDto> objectiveQuestionDtoList,
@RequestParam String userId,
@ApiParam("章节Id")@RequestParam String chapterId){
@ApiParam("章节Id")@RequestParam String chapterId,@RequestParam String schoolId,@RequestParam String systemOwner){
Boolean flag= null;
try {
flag = exerciseService.commitObjectQuestionList(objectiveQuestionDtoList,userId,chapterId);
flag = exerciseService.commitObjectQuestionList(objectiveQuestionDtoList,userId,chapterId, schoolId, systemOwner);
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心客观题主键查询失败");
}

@ -0,0 +1,257 @@
package com.sztzjy.financial_bigdata.controller.stu;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import com.sztzjy.financial_bigdata.annotation.AnonymousAccess;
import com.sztzjy.financial_bigdata.util.ResultEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* @author 17803
* @date 2024-07-22 17:31
*/
@RestController
@Api(tags = "jupyter运行python代码")
@RequestMapping("/api/jupyter")
public class JupyterController {
@ApiOperation("文件校验")
@PostMapping("/validate")
@AnonymousAccess
public ResultEntity getBlockResources(@RequestBody JSONObject upCodeJson) {
//虚拟空间路径
String pyPath = "/usr/local/tianzeProject/financial_bigdata_total/py/";
System.out.println(upCodeJson);
String pythonCodeUp = upCodeJson.getString("code");
String pythonCode = "";
if (pythonCodeUp.contains("/dataResource")) {
pythonCode = pythonCodeUp.replace("/dataResource", pyPath + "dataResource");
} else {
pythonCode = pythonCodeUp;
}
if (pythonCode.contains("show")) {
return validatePythonCodePhoto(upCodeJson);
}
try {
String s = IdUtil.simpleUUID();
// 写入临时Python文件
String tempPythonFile = "/usr/local/tianzeProject/financial_bigdata_total/py/code/" + s + ".py";
try (PrintWriter out = new PrintWriter(tempPythonFile)) {
out.println(pythonCode);
}
String[] command = {"docker", "exec", "pyexe", "python", tempPythonFile};
// 创建一个新的进程来执行Python代码
Process process = Runtime.getRuntime().exec(command);
// 获取进程的输入流
BufferedReader inputStream = new BufferedReader(new InputStreamReader(process.getInputStream()));
// 获取进程的输出流
BufferedReader errorStream = new BufferedReader(new InputStreamReader(process.getErrorStream()));
// // 向进程的输入流写入Python代码
// process.getOutputStream().write(pythonCode.getBytes());
// process.getOutputStream().flush();
// process.getOutputStream().close();
// 读取Python代码的输出
String line;
StringBuilder output = new StringBuilder();
while ((line = inputStream.readLine()) != null) {
output.append(line).append("\n");
}
// 读取Python代码的错误信息
StringBuilder errors = new StringBuilder();
while ((line = errorStream.readLine()) != null) {
errors.append(line).append("\n");
}
// 等待进程执行完成
int exitCode = process.waitFor();
if (exitCode == 0) {
// 执行成功输出Python代码的结果
System.out.println("Python code output:\n" + output.toString());
return new ResultEntity(HttpStatus.OK, output.toString());
} else {
// 执行失败,输出错误信息
System.err.println("Error executing Python code:\n" + errors.toString());
return new ResultEntity(HttpStatus.OK, errors.toString());
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
return new ResultEntity<>(HttpStatus.BAD_REQUEST);
}
@PostMapping("/validatePythonCodeImg")
@ApiOperation("代码检验图片")
@AnonymousAccess
public ResultEntity validatePythonCodePhoto(@RequestBody JSONObject upCodeJson) {
System.out.println(upCodeJson);
String pythonCode = upCodeJson.getString("code");
String s = IdUtil.simpleUUID();
List<String> stringList = new ArrayList<>();
try {
String pyCode = "/usr/local/tianzeProject/financial_bigdata_total/py/code/";
String pyPath = "/usr/local/tianzeProject/financial_bigdata_total/py/img/";
// 写入临时Python文件
String tempPythonFile = pyCode + s + ".py";
// 输出流示例
PrintWriter out = null;
//============
if (pythonCode.contains("show")) {
// 将 pythonCode 按行拆分
String[] lines = pythonCode.split("\\r?\\n");
out = new PrintWriter(tempPythonFile);
int length = lines.length;
for (int i = 0; i < lines.length; i++) {
// 跳过注释行
if (lines[i].trim().startsWith("#")) {
continue;
}
String imgPathv = IdUtil.simpleUUID();
String plotFile = pyPath + imgPathv + ".png";
// 处理最后一行的情况,确保不重复插入 plt.savefig()
if (i == length - 1 && lines[i].contains("plt.show()")) {
out.println("plt.savefig('" + plotFile + "')");
out.println(lines[i]);
System.out.println("最后一次执行"+i);
stringList.add(pyPath + imgPathv + ".png");
System.out.println("保存图片路径:" + pyPath + imgPathv + ".png");
System.out.println("最后一行添加"+lines[i]);
continue;
}
lines[i] = lines[i].trim();
// 判断是否为 plt.show() 相关的语句
if (lines[i].contains("plt.show()")&&i != length - 1) {
out.println("plt.savefig('" + plotFile + "')");
stringList.add(pyPath + imgPathv + ".png");
System.out.println("保存图片路径:" + pyPath + imgPathv + ".png");
}
// 在 plt.savefig() 之后输出原来的 plt.show() 语句
out.println(lines[i]);
}
System.out.println("数据写入完成:"+stringList);
out.close();
}
String[] command = {"docker", "exec", "pyexe", "python", pyCode + s + ".py"};
// 创建一个新的进程来执行Python代码
Process process = Runtime.getRuntime().exec(command);
// 获取进程的输入流
BufferedReader inputStream = new BufferedReader(new InputStreamReader(process.getInputStream()));
// 获取进程的输出流
BufferedReader errorStream = new BufferedReader(new InputStreamReader(process.getErrorStream()));
// 向进程的输入流写入Python代码
process.getOutputStream().write(pythonCode.getBytes());
process.getOutputStream().flush();
process.getOutputStream().close();
// 读取Python代码的输出
String line;
StringBuilder output = new StringBuilder();
while ((line = inputStream.readLine()) != null) {
output.append(line).append("\n");
}
// 读取Python代码的错误信息
StringBuilder errors = new StringBuilder();
while ((line = errorStream.readLine()) != null) {
errors.append(line).append("\n");
}
// 等待进程执行完成
int exitCode = process.waitFor();
System.out.println("代码运行结束!!");
if (exitCode == 0) {
// 执行成功输出Python代码的结果
System.out.println("Python code output:\n" + output.toString());
String base64Image = "";
List<String> base64ImageList = new ArrayList<>();
if (!stringList.isEmpty()) {
for (int i = 0; i < stringList.size(); i++) {
// 读取图片文件并转换为Base64字符串
ByteArrayOutputStream baos = new ByteArrayOutputStream();
System.out.println("读取的stringList文件" + stringList.get(i));
try (FileInputStream fis = new FileInputStream(stringList.get(i))) {
byte[] buffer = new byte[1024];
int len;
while ((len = fis.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
System.out.println("图片读取成功!!!!");
}
base64Image = Base64.encodeBase64String(baos.toByteArray());
base64ImageList.add(base64Image);
}
return new ResultEntity(HttpStatus.OK, output.toString(), base64ImageList);
} else {
return new ResultEntity(HttpStatus.OK, output.toString());
}
}else {
// 执行失败,输出错误信息
System.err.println("Error executing Python code:\n" + errors.toString());
return new ResultEntity(HttpStatus.OK, errors.toString());
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
return new ResultEntity(HttpStatus.BAD_REQUEST, e);
}
}
}

@ -5,9 +5,11 @@ import com.sztzjy.financial_bigdata.annotation.AnonymousAccess;
import com.sztzjy.financial_bigdata.entity.StuTrainingExample;
import com.sztzjy.financial_bigdata.entity.StuTrainingWithBLOBs;
import com.sztzjy.financial_bigdata.entity.SysKnowledgeSummary;
import com.sztzjy.financial_bigdata.entity.resource_entity.TestSysKnowledgeSummary;
import com.sztzjy.financial_bigdata.entity.stu_dto.ReceivingObject;
import com.sztzjy.financial_bigdata.mapper.StuTrainingMapper;
import com.sztzjy.financial_bigdata.mapper.SysKnowledgeSummaryMapper;
import com.sztzjy.financial_bigdata.resourceCenterAPI.KnowledgeSummaryApi;
import com.sztzjy.financial_bigdata.util.PdfUtil;
import com.sztzjy.financial_bigdata.util.ResultEntity;
import com.sztzjy.financial_bigdata.util.file.IFileUtil;
@ -27,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
/**
@ -105,10 +108,15 @@ public class StuKnowledgeNote {
@AnonymousAccess
@ApiOperation("知识概要-获取页面")
@ApiOperation("***知识概要-获取页面")
@PostMapping("getSysKnowledgeSummaryByChapterId")
public ResultEntity<SysKnowledgeSummary> getSysKnowledgeSummaryByChapterId(@RequestParam String chapterId) {
SysKnowledgeSummary sysKnowledgeSummary = sysKnowledgeSummaryMapper.selectByPrimaryKey(chapterId);
public ResultEntity<TestSysKnowledgeSummary> getSysKnowledgeSummaryByChapterId(@RequestParam String chapterId,@RequestParam String courseId, @RequestParam String schoolId, @RequestParam String systemOwner) {
TestSysKnowledgeSummary sysKnowledgeSummary = null;
try {
sysKnowledgeSummary = KnowledgeSummaryApi.getSysKnowledgeSummary(courseId,chapterId, schoolId, systemOwner);
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常");
}
return new ResultEntity<>(sysKnowledgeSummary);
}

@ -80,10 +80,10 @@ public class TheoryTestController {
@GetMapping("selectErrors")
@ApiOperation("**错题集展示")
@AnonymousAccess
public ResultEntity<List<SysObjectiveQuestions>> selectErrors(@RequestParam String userId) {
public ResultEntity<List<SysObjectiveQuestions>> selectErrors(@RequestParam String userId,@RequestParam String schoolId,@RequestParam String systemOwner) {
List<SysObjectiveQuestions> list = null;
try {
list = theoryTestService.selectErrors(userId);
list = theoryTestService.selectErrors(userId, schoolId, systemOwner);
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心查询异常");
}
@ -124,14 +124,14 @@ public class TheoryTestController {
//考试记录详情查询
@GetMapping("getTheoryTestDetail")
@ApiOperation("获取理论考试数据详情")
@ApiOperation("**获取理论考试数据详情")
@AnonymousAccess
public ResultEntity<List<StuTheoryExamDetailDto>> getTheoryTestDetail(@ApiParam("理论考试id") @RequestParam String theoryExamId,
@RequestParam Integer index,
@RequestParam Integer size) {
@RequestParam Integer size,@RequestParam String schoolId,@RequestParam String systemOwner) {
List<StuTheoryExamDetailDto> detailDtoList = null;
try {
detailDtoList = theoryTestService.getTheoryTestDetail(theoryExamId, index, size);
detailDtoList = theoryTestService.getTheoryTestDetail(theoryExamId, index, size, schoolId, systemOwner);
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心主键查询异常");
}

@ -69,9 +69,9 @@ public class TeaCaseController {
@GetMapping("selectCaseDetails")
@ApiOperation("**案例题详情查询、案例题编辑回显")
@AnonymousAccess
public ResultEntity<TestSysCaseQuestion> selectCaseDetails(@RequestParam String caseId) {
public ResultEntity<TestSysCaseQuestion> selectCaseDetails(@RequestParam String caseId,@RequestParam String systemOwner) {
try {
TestSysCaseQuestion caseQuestion = CaseApi.selectCaseDetails(caseId);
TestSysCaseQuestion caseQuestion = CaseApi.selectCaseDetails(caseId,systemOwner);
return new ResultEntity<>(HttpStatus.OK, "案例题详情查询成功", caseQuestion);
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常");
@ -129,4 +129,30 @@ public class TeaCaseController {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常");
}
}
//根据章节ID查询案例题
@GetMapping("selectCaseByChapterId")
@ApiOperation("**根据章节ID查询案例题")
@AnonymousAccess
public ResultEntity<List<TestSysCaseQuestion>> selectCaseByChapterId(@RequestParam String chapterId) {
try {
List<TestSysCaseQuestion> caseQuestionList=CaseApi.selectCaseByChapterId(chapterId);
return new ResultEntity<>(HttpStatus.OK, "根据章节ID查询案例题", caseQuestionList);
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常");
}
}
//根据章节ID查询案例题
@GetMapping("selectCaseByCourseId")
@ApiOperation("**根据课程ID查询案例题")
@AnonymousAccess
public ResultEntity<List<TestSysCaseQuestion>> selectCaseByCourseId(@RequestParam String courseId,@RequestParam String systemOwner,@RequestParam String schoolId) {
try {
List<TestSysCaseQuestion> caseQuestionList=CaseApi.selectCaseByCourseId(courseId,systemOwner,schoolId);
return new ResultEntity<>(HttpStatus.OK, "根据课程ID查询案例题", caseQuestionList);
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常");
}
}
}

@ -5,6 +5,7 @@ import com.github.pagehelper.PageInfo;
import com.sztzjy.financial_bigdata.annotation.AnonymousAccess;
import com.sztzjy.financial_bigdata.entity.*;
import com.sztzjy.financial_bigdata.entity.resource_entity.SysObjectiveQuestions;
import com.sztzjy.financial_bigdata.entity.resource_entity.dto.SysObjectiveQuestionsDto;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageCountDto;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageDto;
import com.sztzjy.financial_bigdata.entity.tea_dto.TrainingDto;
@ -55,9 +56,9 @@ public class TeaExamManageController {
@AnonymousAccess
@PostMapping("/getSelectCountAndScore")
@ApiOperation("新增考试--获取选题量和分数")
public ResultEntity<Map<Integer, BigDecimal>> getsingleId(@RequestBody @ApiParam("所有ID用,隔开一次传过来") List<String> ids) {
public ResultEntity<Map<String, BigDecimal>> getsingleId(@RequestBody @ApiParam("所有ID用,隔开一次传过来") List<String> ids) {
List<String> list = new ArrayList<>(ids);
Map<Integer, BigDecimal> map = null;
Map<String, BigDecimal> map = null;
try {
map = ObjectiveApi.getChooseObjCountAndSorce(ids);
} catch (IOException e) {
@ -87,9 +88,9 @@ public class TeaExamManageController {
@AnonymousAccess
@PostMapping("/selectObjectivityByType")
@ApiOperation("***新增考试--选择客观题时展示")
public ResultEntity<List<SysObjectiveQuestions>> selectObjectivityByType(@ApiParam("0单选 1多选 2判断") @RequestParam String type,
public ResultEntity<List<SysObjectiveQuestionsDto>> selectObjectivityByType(@ApiParam("0单选 1多选 2判断") @RequestParam String type,
@RequestParam String schoolId,@RequestParam String systemOwner) {
List<SysObjectiveQuestions> list = null;
List<SysObjectiveQuestionsDto> list = null;
try {
list = ObjectiveApi.selectObjByType(type, schoolId, systemOwner);
} catch (IOException e) {

@ -45,7 +45,23 @@ public class TeaObjectiveController {
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常");
}
}
//客观题编辑
@PostMapping("updataObjective")
@ApiOperation("**客观题编辑")
@AnonymousAccess
public ResultEntity updataObjective(@RequestBody SysObjectiveQuestionsDto objectiveQuestion, @RequestParam String systemOwner, @RequestParam String schoolId) {
try {
Boolean flag = ObjectiveApi.updateObjective(objectiveQuestion, systemOwner, schoolId);
if (flag) {
return new ResultEntity<>(HttpStatus.OK, "客观题编辑成功");
} else {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "客观题编辑失败");
}
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常");
}
}
//客观题删除
@ -70,7 +86,7 @@ public class TeaObjectiveController {
@GetMapping("/selectObjectiveList")
@ApiOperation("**客观题列表查看")
@AnonymousAccess
public ResultEntity<PageInfo<SysObjectiveQuestions>> selectObjectiveList(@RequestParam String schoolId,
public ResultEntity<PageInfo<SysObjectiveQuestionsDto>> selectObjectiveList(@RequestParam String schoolId,
@ApiParam("课程ID") @RequestParam String courseId,
@ApiParam("章节Id") @RequestParam(required = false) String chapterId,
@ApiParam("题目类型 0单选 1多选 2判断")@RequestParam(required = false)String type,
@ -78,7 +94,7 @@ public class TeaObjectiveController {
@RequestParam Integer index,
@RequestParam Integer size,
@RequestParam String systemOwner) {
PageInfo<SysObjectiveQuestions> pageInfo = null;
PageInfo<SysObjectiveQuestionsDto> pageInfo = null;
try {
pageInfo = ObjectiveApi.selectObjectiveList(schoolId, courseId,chapterId, type, content, index, size,systemOwner);
return new ResultEntity<>(HttpStatus.OK, "客观题列表查看成功",pageInfo);
@ -91,9 +107,9 @@ public class TeaObjectiveController {
@GetMapping("/selectObjectiveDetails")
@ApiOperation("**客观题单个详情查看")
@AnonymousAccess
public ResultEntity<SysObjectiveQuestions> selectObjectiveDetails(@ApiParam("客观题ID") @RequestParam String objectiveId){
public ResultEntity<SysObjectiveQuestionsDto> selectObjectiveDetails(@ApiParam("客观题ID") @RequestParam String objectiveId,@RequestParam String schoolId,@RequestParam String systemOwner){
try {
SysObjectiveQuestions objectiveQuestion = ObjectiveApi.selectObjectiveDetails(objectiveId);
SysObjectiveQuestionsDto objectiveQuestion = ObjectiveApi.selectObjectiveDetails(objectiveId,schoolId,systemOwner);
return new ResultEntity<>(HttpStatus.OK, "客观题删除成功",objectiveQuestion);
} catch (IOException e) {

@ -132,9 +132,11 @@ public class UserController {
map.put("schoolId", user.getSchoolId());
map.put("classId", user.getClassId());
map.put("userId", user.getUserid());
map.put("zyuserid",user.getZyUserid());
String uuid = getIPAndPlace(request, user.getName(), user.getUserid(), user.getStudentId());
map.put("logId", uuid);
map.put("token", token);
map.put("systemOwner",user.getSystemOnwer());
return new ResultEntity(HttpStatus.OK, map);
} else { // 2、智云单点登录
jwtUser = TokenProvider.getJWTUserByZhiYun(TOKEN);

@ -0,0 +1,104 @@
package com.sztzjy.financial_bigdata.entity.resource_entity;
import io.swagger.annotations.ApiModelProperty;
public class TestSysKnowledgeSummary {
@ApiModelProperty("知识概要ID")
private String knowledgeSummaryId;
@ApiModelProperty("一级标签ID")
private String oneTagId;
@ApiModelProperty("一级标签名称")
private String oneTagName;
@ApiModelProperty("二级标签ID")
private String twoTagId;
@ApiModelProperty("二级标签名称")
private String twoTagName;
@ApiModelProperty("三级标签ID")
private String threeTagId;
@ApiModelProperty("三级标签名称")
private String threeTagName;
@ApiModelProperty("管理员/学校ID")
private String source;
@ApiModelProperty("内容")
private String content;
public String getKnowledgeSummaryId() {
return knowledgeSummaryId;
}
public void setKnowledgeSummaryId(String knowledgeSummaryId) {
this.knowledgeSummaryId = knowledgeSummaryId == null ? null : knowledgeSummaryId.trim();
}
public String getOneTagId() {
return oneTagId;
}
public void setOneTagId(String oneTagId) {
this.oneTagId = oneTagId == null ? null : oneTagId.trim();
}
public String getOneTagName() {
return oneTagName;
}
public void setOneTagName(String oneTagName) {
this.oneTagName = oneTagName == null ? null : oneTagName.trim();
}
public String getTwoTagId() {
return twoTagId;
}
public void setTwoTagId(String twoTagId) {
this.twoTagId = twoTagId == null ? null : twoTagId.trim();
}
public String getTwoTagName() {
return twoTagName;
}
public void setTwoTagName(String twoTagName) {
this.twoTagName = twoTagName == null ? null : twoTagName.trim();
}
public String getThreeTagId() {
return threeTagId;
}
public void setThreeTagId(String threeTagId) {
this.threeTagId = threeTagId == null ? null : threeTagId.trim();
}
public String getThreeTagName() {
return threeTagName;
}
public void setThreeTagName(String threeTagName) {
this.threeTagName = threeTagName == null ? null : threeTagName.trim();
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source == null ? null : source.trim();
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
}

@ -7,10 +7,7 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.sztzjy.financial_bigdata.config.Constant;
import com.sztzjy.financial_bigdata.entity.SysCaseQuestion;
import com.sztzjy.financial_bigdata.entity.resource_entity.SysObjectiveQuestions;
import com.sztzjy.financial_bigdata.entity.resource_entity.TestSysCaseQuestion;
import com.sztzjy.financial_bigdata.entity.resource_entity.TestSysCaseQuestionStep;
import com.sztzjy.financial_bigdata.entity.resource_entity.TestTestSysCaseQuestionStepWithBLOBs;
import com.sztzjy.financial_bigdata.entity.resource_entity.*;
import com.sztzjy.financial_bigdata.entity.tea_dto.TrainingDto;
import com.sztzjy.financial_bigdata.util.HttpUtils;
import com.sztzjy.financial_bigdata.util.ResultEntity;
@ -22,6 +19,7 @@ import java.lang.reflect.Type;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;
import java.util.Map;
public class CaseApi {
private final static String insertCase = Constant.API_URL + "/api/tea/CaseApi/insertCase";
@ -31,6 +29,7 @@ public class CaseApi {
private final static String updateCase = Constant.API_URL + "/api/tea/CaseApi/updateCase";
private final static String selectCaseByChapterId = Constant.API_URL + "/api/tea/CaseApi/selectCaseByChapterId";
private final static String selectCaseByChapterIdList = Constant.API_URL + "/api/tea/CaseApi/selectCaseByChapterIdList";
private final static String selectCaseByCourseId = Constant.API_URL + "/api/tea/CaseApi/selectCaseByCourseId";
private final static String selectCaseStepDetailByCaseId = Constant.API_URL + "/api/tea/CaseApi/selectCaseStepDetailByCaseId";
private final static String insertCaseStep = Constant.API_URL + "/api/tea/CaseApi/insertCaseStep";
@ -38,9 +37,12 @@ public class CaseApi {
private final static String deleteCaseStep = Constant.API_URL + "/api/tea/CaseApi/deleteCaseStep";
private final static String selectCaseStepDetails = Constant.API_URL + "/api/tea/CaseApi/selectCaseStepDetails";
private final static String selectCaseStepListBatchByIdListAndSort = Constant.API_URL + "/api/tea/CaseApi/selectCaseStepListBatchByIdListAndSort";
private final static String selectAllStepBySystemOwner = Constant.API_URL + "/api/tea/CaseApi/selectAllStepBySystemOwner";
private final static String selectTrainingByIds = Constant.API_URL + "/api/tea/CaseApi/selectTrainingByIds";
private final static String getGradeReportCase = Constant.API_URL + "/api/tea/CaseApi/getGradeReportCase";
private final static String getMapChapterIdAndCaseIdsByCourseIdAndChapterId = Constant.API_URL + "/api/tea/CaseApi/getMapChapterIdAndCaseIdsByCourseIdAndChapterId";
/**
@ -89,8 +91,8 @@ public class CaseApi {
* local:
* rsapi:
*/
public static TestSysCaseQuestion selectCaseDetails(String caseId) throws IOException {
String requestBody = "caseId=" + caseId;
public static TestSysCaseQuestion selectCaseDetails(String caseId,String systemOwner) throws IOException {
String requestBody = "caseId=" + caseId+"&systemOwner="+systemOwner;
JSONObject object = HttpUtils.sendPost(
selectCaseDetails,
requestBody);
@ -132,7 +134,25 @@ public class CaseApi {
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter())
.create();
Type listType = new TypeToken<List<TestTestSysCaseQuestionStepWithBLOBs>>() {
Type listType = new TypeToken<List<TestSysCaseQuestion>>() {
}.getType();
List<TestSysCaseQuestion> caseQuestionList = gson.fromJson(object.get("respString").toString(), listType);
return caseQuestionList;
}
/**
* local:ID
* rsapi:Id
*/
public static List<TestSysCaseQuestion> selectCaseByCourseId(String courseId, String systemOwner, String schoolId) throws IOException {
String requestBody = "courseId=" + courseId+"&systemOwner="+systemOwner+"&schoolId="+schoolId;
JSONObject object = HttpUtils.sendPost(
selectCaseByCourseId,
requestBody);
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter())
.create();
Type listType = new TypeToken<List<TestSysCaseQuestion>>() {
}.getType();
List<TestSysCaseQuestion> caseQuestionList = gson.fromJson(object.get("respString").toString(), listType);
return caseQuestionList;
@ -318,4 +338,41 @@ public class CaseApi {
return list;
}
/**
*
*/
public static List<TestTestSysCaseQuestionStepWithBLOBs> selectAllStepBySystemOwner(String systemOwner) throws IOException {
String requestBody = "systemOwner=" + systemOwner;
JSONObject object = HttpUtils.sendPost(
selectAllStepBySystemOwner,
requestBody);
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter())
.create();
Type listType = new TypeToken<List<TestTestSysCaseQuestionStepWithBLOBs>>() {
}.getType();
List<TestTestSysCaseQuestionStepWithBLOBs> stepList = gson.fromJson(object.get("respString").toString(), listType);
return stepList;
}
/**
*
*/
public static Map<String, List<String>> getMapChapterIdAndCaseIdsByCourseIdAndChapterId(List<SysThreeCatalog> sysThreeCatalogs, String systemOwner) throws IOException {
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter())
.create();
// 构建带有 schoolId 的 URL
String urlWithParams = getMapChapterIdAndCaseIdsByCourseIdAndChapterId + "?systemOwner=" + URLEncoder.encode(systemOwner, "UTF-8");
// String urlWithParams = getMapChapterIdAndCaseIdsByCourseIdAndChapterId + "?systemOwner=" +systemOwner;
JSONObject object = HttpUtils.sendPost(
urlWithParams,
gson.toJson(sysThreeCatalogs), "application/json", null);
Type listType = new TypeToken<Map<String, List<String>>>() {
}.getType();
Map<String, List<String>> map = gson.fromJson(object.get("respString").toString(), listType);
return map;
}
}

@ -0,0 +1,37 @@
package com.sztzjy.financial_bigdata.resourceCenterAPI;
import cn.hutool.json.JSONObject;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.sztzjy.financial_bigdata.config.Constant;
import com.sztzjy.financial_bigdata.entity.resource_entity.SysTwoCatalog;
import com.sztzjy.financial_bigdata.entity.resource_entity.TestSysKnowledgeSummary;
import com.sztzjy.financial_bigdata.util.HttpUtils;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.Date;
import java.util.List;
public class KnowledgeSummaryApi {
private final static String getSysKnowledgeSummary = Constant.API_URL + "/api/stu/knowledgeNote/getSysKnowledgeSummary";
/**
* local:
*/
public static TestSysKnowledgeSummary getSysKnowledgeSummary(String courseId,String chapterId, String schoolId, String systemOwner) throws IOException {
String requestBody="systemOwner="+systemOwner+"&schoolId="+schoolId+"&chapterId="+chapterId+"&courseId="+courseId;
JSONObject object = HttpUtils.sendPost(
getSysKnowledgeSummary,
requestBody);
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter())
.create();
Type listType = new TypeToken<TestSysKnowledgeSummary>() {}.getType();
TestSysKnowledgeSummary knowledgeSummarie = gson.fromJson(object.get("respString").toString(), listType);
return knowledgeSummarie;
}
}

@ -34,6 +34,7 @@ import java.util.Map;
public class ObjectiveApi {
private final static String insertObjective = Constant.API_URL + "/api/sys/ObjectiveApi/insertObjective";
private final static String updateObjective = Constant.API_URL + "/api/sys/ObjectiveApi/updateObjective";
private final static String batchDeleteObjective = Constant.API_URL + "/api/sys/ObjectiveApi/batchDeleteObjective";
private final static String selectObjectiveList = Constant.API_URL + "/api/sys/ObjectiveApi/selectObjectiveList";
private final static String selectObjectiveDetails = Constant.API_URL + "/api/sys/ObjectiveApi/selectObjectiveDetails";
@ -57,7 +58,7 @@ public class ObjectiveApi {
*/
public static Boolean insertObjective(SysObjectiveQuestionsDto objective, String systemOwner, String schoolId) throws IOException {
objective.setSource(schoolId);
objective.setObjectiveId(systemOwner);
objective.setOneName(systemOwner);
Gson gson = new Gson();
JSONObject object = HttpUtils.sendPost(
insertObjective,
@ -70,6 +71,25 @@ public class ObjectiveApi {
}
}
/**
* local:
* rsapi:
*/
public static Boolean updateObjective(SysObjectiveQuestionsDto objective, String systemOwner, String schoolId) throws IOException {
Gson gson = new Gson();
// 构建带有 schoolId 的 URL
String urlWithParams = updateObjective + "?schoolId=" + URLEncoder.encode(schoolId, "UTF-8")+"&systemOwner="+systemOwner;
JSONObject object = HttpUtils.sendPost(
urlWithParams,
gson.toJson(objective), "application/json", null);
String respString = object.get("respString").toString();
if ("true".equals(respString)) {
return true;
} else {
return false;
}
}
/**
* local:
* rsapi:
@ -93,7 +113,7 @@ public class ObjectiveApi {
* local:
* rsapi:
*/
public static PageInfo<SysObjectiveQuestions> selectObjectiveList(String schoolId, String courseId,String chapterId, String type, String content, Integer index, Integer size,String systemOwner) throws IOException {
public static PageInfo<SysObjectiveQuestionsDto> selectObjectiveList(String schoolId, String courseId,String chapterId, String type, String content, Integer index, Integer size,String systemOwner) throws IOException {
String requestBody = "schoolId=" + schoolId + "&courseId=" + courseId+"&index="+index+"&size="+size+"&systemOwner="+systemOwner;
String contentStr="";
String typeStr="";
@ -116,9 +136,9 @@ public class ObjectiveApi {
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter())
.create();
Type listType = new TypeToken<PageInfo<SysObjectiveQuestions>>() {
Type listType = new TypeToken<PageInfo<SysObjectiveQuestionsDto>>() {
}.getType();
PageInfo<SysObjectiveQuestions> pageInfo = gson.fromJson(object.get("respString").toString(), listType);
PageInfo<SysObjectiveQuestionsDto> pageInfo = gson.fromJson(object.get("respString").toString(), listType);
return pageInfo;
}
@ -126,17 +146,17 @@ public class ObjectiveApi {
* local:
* rsapi:
*/
public static SysObjectiveQuestions selectObjectiveDetails(String objectiveId) throws IOException {
String requestBody = "objectiveId="+objectiveId;
public static SysObjectiveQuestionsDto selectObjectiveDetails(String objectiveId,String schoolId,String systemOwner) throws IOException {
String requestBody = "objectiveId="+objectiveId+"&schoolId="+schoolId+"&systemOwner="+systemOwner;
JSONObject object = HttpUtils.sendPost(
selectObjectiveDetails,
requestBody);
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter())
.create();
Type listType = new TypeToken<SysObjectiveQuestions>() {
Type listType = new TypeToken<SysObjectiveQuestionsDto>() {
}.getType();
SysObjectiveQuestions caseQuestion = gson.fromJson(object.get("respString").toString(), listType);
SysObjectiveQuestionsDto caseQuestion = gson.fromJson(object.get("respString").toString(), listType);
return caseQuestion;
}
@ -235,7 +255,7 @@ public class ObjectiveApi {
*ID
*/
public static List<SysObjectiveQuestions> selectObjectQuestionListByChapterId(String chapterId) throws IOException {
String requestBody = "threeId="+chapterId;
String requestBody = "chapterId="+chapterId;
JSONObject object = HttpUtils.sendPost(
selectObjectQuestionListByChapterId,
requestBody);
@ -252,7 +272,7 @@ public class ObjectiveApi {
* 35
*/
public static List<SysObjectiveQuestions> selectRandomObjectiveSingle(String systemOwner) throws IOException {
String requestBody = "oneId="+systemOwner;
String requestBody = "systemOwner="+systemOwner;
JSONObject object = HttpUtils.sendPost(
selectRandomObjectiveSingle,
requestBody);
@ -269,7 +289,7 @@ public class ObjectiveApi {
* 5
*/
public static List<SysObjectiveQuestions> selectRandomObjectiveMany(String systemOwner) throws IOException {
String requestBody = "oneId="+systemOwner;
String requestBody = "systemOwner="+systemOwner;
JSONObject object = HttpUtils.sendPost(
selectRandomObjectiveMany,
requestBody);
@ -286,7 +306,7 @@ public class ObjectiveApi {
* 10
*/
public static List<SysObjectiveQuestions> selectRandomObjectiveJudge(String systemOwner) throws IOException {
String requestBody = "oneId="+systemOwner;
String requestBody = "systemOwner="+systemOwner;
JSONObject object = HttpUtils.sendPost(
selectRandomObjectiveJudge,
requestBody);
@ -339,7 +359,7 @@ public class ObjectiveApi {
/**
*
*/
public static Map<Integer, BigDecimal> getChooseObjCountAndSorce(List<String> objectIdList) throws IOException {
public static Map<String, BigDecimal> getChooseObjCountAndSorce(List<String> objectIdList) throws IOException {
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter())
.create();
@ -348,16 +368,16 @@ public class ObjectiveApi {
JSONObject object = HttpUtils.sendPost(
urlWithParams,
gson.toJson(objectIdList), "application/json", null);
Type listType = new TypeToken<Map<Integer, BigDecimal>>() {
Type listType = new TypeToken<Map<String, BigDecimal>>() {
}.getType();
Map<Integer, BigDecimal> map = gson.fromJson(object.get("respString").toString(), listType);
Map<String, BigDecimal> map = gson.fromJson(object.get("respString").toString(), listType);
return map;
}
/**
*
*/
public static List<SysObjectiveQuestions> selectObjByType(String type,String schoolId,String systemOwner) throws IOException {
public static List<SysObjectiveQuestionsDto> selectObjByType(String type,String schoolId,String systemOwner) throws IOException {
String requestBody = "type="+type+"&schoolId="+schoolId+"&systemOwner="+systemOwner;
JSONObject object = HttpUtils.sendPost(
selectObjByType,
@ -365,12 +385,14 @@ public class ObjectiveApi {
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter())
.create();
Type listType = new TypeToken<List<SysObjectiveQuestions>>() {
Type listType = new TypeToken<List<SysObjectiveQuestionsDto>>() {
}.getType();
List<SysObjectiveQuestions> caseQuestionList = gson.fromJson(object.get("respString").toString(), listType);
List<SysObjectiveQuestionsDto> caseQuestionList = gson.fromJson(object.get("respString").toString(), listType);
return caseQuestionList;
}
/**
*
*/

@ -7,7 +7,7 @@ import java.io.IOException;
import java.util.List;
public interface IExerciseService {
List<SysObjectiveQuestionDto> selectObjectQuestionListByChapterId(String chapterId, String userId) throws IOException;
List<SysObjectiveQuestionDto> selectObjectQuestionListByChapterId(String chapterId, String userId,String schoolId,String systemOwner) throws IOException;
Boolean commitObjectQuestionList(List<SysObjectiveQuestionDto> objectiveQuestionDtoList, String userId, String chapterId) throws IOException;
Boolean commitObjectQuestionList(List<SysObjectiveQuestionDto> objectiveQuestionDtoList, String userId, String chapterId,String schoolId,String systemOwner) throws IOException;
}

@ -16,13 +16,13 @@ public interface ITheoryTestService {
int endTheoryTest(StuTheoryTestDto theoryTestDto);
List<SysObjectiveQuestions> selectErrors(String userId) throws IOException;
List<SysObjectiveQuestions> selectErrors(String userId,String schoolId,String systemOwner) throws IOException;
Boolean removeError(String userId, String objectiveQuestionId, String type);
PageInfo<StuTheoryExam> getTheoryTestList(String userId, Integer index, Integer size);
List<StuTheoryExamDetailDto> getTheoryTestDetail(String theoryExamId, Integer index, Integer size) throws IOException;
List<StuTheoryExamDetailDto> getTheoryTestDetail(String theoryExamId, Integer index, Integer size,String schoolId,String systemOwner) throws IOException;
Date getStartTime(String userId);
}

@ -29,7 +29,7 @@ public class ExerciseServiceImpl implements IExerciseService {
SysObjectiveQuestionMapper objectiveQuestionMapper;
@Override
public List<SysObjectiveQuestionDto> selectObjectQuestionListByChapterId(String chapterId, String userId) throws IOException {
public List<SysObjectiveQuestionDto> selectObjectQuestionListByChapterId(String chapterId, String userId,String schoolId,String systemOwner) throws IOException {
StuTrainingExample example = new StuTrainingExample();
example.createCriteria().andUserIdEqualTo(userId).andChapterIdEqualTo(chapterId);
List<StuTrainingWithBLOBs> stuTrainingWithBLOBs = trainingMapper.selectByExampleWithBLOBs(example);
@ -88,7 +88,7 @@ public class ExerciseServiceImpl implements IExerciseService {
List<String> learningEvalIdlist = Arrays.asList(bloBs.getLearningEvalIdlist().substring(1, bloBs.getLearningEvalIdlist().length() - 1).split(", "));
for (int i = 0; i < learningEvalIdlist.size(); i++) {
String objectiveId = learningEvalIdlist.get(i);
SysObjectiveQuestions objectiveQuestion = ObjectiveApi.selectObjectiveDetails(objectiveId);
SysObjectiveQuestions objectiveQuestion = ObjectiveApi.selectObjectiveDetails(objectiveId, schoolId, systemOwner);
SysObjectiveQuestionDto sysObjectiveQuestionDto = new SysObjectiveQuestionDto("0","",objectiveQuestion);
dtos.add(sysObjectiveQuestionDto);
}
@ -99,7 +99,7 @@ public class ExerciseServiceImpl implements IExerciseService {
for (int i = 0; i < learningEvalIdlist.size(); i++) {
String objectiveId = learningEvalIdlist.get(i);
String stuAnswer = learningEvalAnswerList.get(i);
SysObjectiveQuestions objectiveQuestion = ObjectiveApi.selectObjectiveDetails(objectiveId);
SysObjectiveQuestions objectiveQuestion = ObjectiveApi.selectObjectiveDetails(objectiveId, schoolId, systemOwner);
SysObjectiveQuestionDto sysObjectiveQuestionDto = new SysObjectiveQuestionDto("1",stuAnswer,objectiveQuestion);
dtos.add(sysObjectiveQuestionDto);
}
@ -112,32 +112,35 @@ public class ExerciseServiceImpl implements IExerciseService {
}
@Override
public Boolean commitObjectQuestionList(List<SysObjectiveQuestionDto> objectiveQuestionDtoList, String userId, String chapterId) throws IOException {
public Boolean commitObjectQuestionList(List<SysObjectiveQuestionDto> objectiveQuestionDtoList, String userId, String chapterId,String schoolId,String systemOwner) throws IOException {
StuTrainingExample example = new StuTrainingExample();
example.createCriteria().andUserIdEqualTo(userId).andChapterIdEqualTo(chapterId);
List<StuTrainingWithBLOBs> stuTrainingWithBLOBs = trainingMapper.selectByExampleWithBLOBs(example);
if (stuTrainingWithBLOBs.get(0).getLearningEvalAnswer()!=null){
return false;
}
// if (stuTrainingWithBLOBs.get(0).getLearningEvalAnswer()!=null){
// return false;
// }
List<String> stuAnswerList = new ArrayList<>();
BigDecimal learning_eval_score= BigDecimal.valueOf(0);
List<String> objectiveIds=new ArrayList<>();
for (int i = 0; i < objectiveQuestionDtoList.size(); i++) {
SysObjectiveQuestionDto sysObjectiveQuestionDto = objectiveQuestionDtoList.get(i);
String stuAnswer = sysObjectiveQuestionDto.getStuAnswer();
String objectiveId = sysObjectiveQuestionDto.getObjectiveId();
SysObjectiveQuestions objectiveQuestion = ObjectiveApi.selectObjectiveDetails(objectiveId);
SysObjectiveQuestions objectiveQuestion = ObjectiveApi.selectObjectiveDetails(objectiveId, schoolId, systemOwner);
String answer = objectiveQuestion.getAnswer();
stuAnswerList.add(stuAnswer);
if(answer.equals(stuAnswer)){
learning_eval_score= learning_eval_score.add(objectiveQuestion.getScore());
}
objectiveIds.add(objectiveId);
}
StuTrainingWithBLOBs bloBs = stuTrainingWithBLOBs.get(0);
bloBs.setLearningEvalAnswer(String.valueOf(stuAnswerList));
bloBs.setLearningEvalScore(learning_eval_score);
bloBs.setLearningEvalCompleteStatus(1);
BigDecimal progress = bloBs.getProgress();
bloBs.setLearningEvalIdlist(String.valueOf(objectiveIds));
if(progress==null){
progress= BigDecimal.valueOf(1);
}else{

@ -244,7 +244,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
}
@Override
public List<SysObjectiveQuestions> selectErrors(String userId) throws IOException {
public List<SysObjectiveQuestions> selectErrors(String userId,String schoolId,String systemOwner) throws IOException {
StuErrorExample example = new StuErrorExample();
example.createCriteria().andUserIdEqualTo(userId);
List<StuErrorWithBLOBs> stuErrors = errorMapper.selectByExampleWithBLOBs(example);
@ -257,7 +257,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
if (!singleIds.isEmpty()) {
List<String> singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(", "));
for (int i = 0; i < singleIdList.size(); i++) {
SysObjectiveQuestions objectiveQuestion = ObjectiveApi.selectObjectiveDetails(singleIdList.get(i));
SysObjectiveQuestions objectiveQuestion = ObjectiveApi.selectObjectiveDetails(singleIdList.get(i), schoolId, systemOwner);
objectiveQuestionList.add(objectiveQuestion);
}
}
@ -265,7 +265,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
if (!multipleIds.isEmpty()) {
List<String> stringList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(", "));
for (int i = 0; i < stringList.size(); i++) {
SysObjectiveQuestions objectiveQuestion = ObjectiveApi.selectObjectiveDetails(stringList.get(i));
SysObjectiveQuestions objectiveQuestion = ObjectiveApi.selectObjectiveDetails(stringList.get(i), schoolId, systemOwner);
objectiveQuestionList.add(objectiveQuestion);
}
}
@ -273,7 +273,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
if (!judgeIds.isEmpty()) {
List<String> stringList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(", "));
for (int i = 0; i < stringList.size(); i++) {
SysObjectiveQuestions objectiveQuestion = ObjectiveApi.selectObjectiveDetails(stringList.get(i));
SysObjectiveQuestions objectiveQuestion = ObjectiveApi.selectObjectiveDetails(stringList.get(i), schoolId, systemOwner);
objectiveQuestionList.add(objectiveQuestion);
}
}
@ -337,7 +337,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
}
@Override
public List<StuTheoryExamDetailDto> getTheoryTestDetail(String theoryExamId, Integer index, Integer size) throws IOException {
public List<StuTheoryExamDetailDto> getTheoryTestDetail(String theoryExamId, Integer index, Integer size,String schoolId,String systemOwner) throws IOException {
StuTheoryExamWithBLOBs theoryExam = theoryExamMapper.selectByPrimaryKey(theoryExamId);
String singleIds = theoryExam.getSingleIds();
ArrayList<String> idsList = new ArrayList<>();
@ -395,7 +395,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
StuTheoryExamDetailDto detailDto = new StuTheoryExamDetailDto();
String objectiveQuestionId = idsList.get(i);
String stuAnswer = answerList.get(i).trim();
SysObjectiveQuestions objectiveQuestion = ObjectiveApi.selectObjectiveDetails(objectiveQuestionId);
SysObjectiveQuestions objectiveQuestion = ObjectiveApi.selectObjectiveDetails(objectiveQuestionId, schoolId, systemOwner);
BigDecimal score = objectiveQuestion.getScore();
String content = objectiveQuestion.getContent();
String answer = objectiveQuestion.getAnswer();

Loading…
Cancel
Save