增加部分接口非空判断

master
yz 7 months ago
parent 0f35db6405
commit 72cabf956f

@ -116,6 +116,9 @@ public class ExerciseExperimentalTraining {
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心获取内置二级目录失败");
}
if(sysCourseList.isEmpty()){
return null;
}
List<SysCourseDto> dtoList = new ArrayList<>();
@ -129,6 +132,9 @@ public class ExerciseExperimentalTraining {
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心根据课程IDList查询章节集合失败");
}
if(sysCourseChapters.isEmpty()){
return null;
}
// 批量查询所有案例题步骤
SysCaseQuestionStepExample stepExample = new SysCaseQuestionStepExample();
@ -140,7 +146,6 @@ public class ExerciseExperimentalTraining {
e.printStackTrace();
}
Map<String, List<TestTestSysCaseQuestionStepWithBLOBs>> caseStepsMap = sysCaseQuestionSteps.stream()
.collect(Collectors.groupingBy(TestTestSysCaseQuestionStepWithBLOBs::getCaseId));

@ -5,10 +5,12 @@ 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.SysObjectiveQuestionExample;
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.mapper.SysObjectiveQuestionMapper;
import com.sztzjy.financial_bigdata.resourceCenterAPI.KnowledgeSummaryApi;
import com.sztzjy.financial_bigdata.util.PdfUtil;
import com.sztzjy.financial_bigdata.util.ResultEntity;

@ -345,6 +345,9 @@ public class CaseApi {
JSONObject object = HttpUtils.sendPost(
selectAllStepBySystemOwner,
requestBody);
if(object==null){
return null;
}
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter())
.create();

@ -169,6 +169,9 @@ public class CourseAPI {
JSONObject object = HttpUtils.sendPost(
urlWithParams,
gson.toJson(courseIds), "application/json", null);
if(object==null){
return null;
}
Type listType = new TypeToken<List<SysThreeCatalog>>() {
}.getType();
List<SysThreeCatalog> list = gson.fromJson(object.get("respString").toString(), listType);

@ -327,6 +327,9 @@ public class ObjectiveApi {
JSONObject object = HttpUtils.sendPost(
selectCountSingle,
requestBody);
if(object==null){
return 0;
}
String respString = object.get("respString").toString();
return Integer.valueOf(respString);
@ -339,6 +342,9 @@ public class ObjectiveApi {
JSONObject object = HttpUtils.sendPost(
selectCountMany,
requestBody);
if(object==null){
return 0;
}
String respString = object.get("respString").toString();
return Integer.valueOf(respString);
@ -351,6 +357,9 @@ public class ObjectiveApi {
JSONObject object = HttpUtils.sendPost(
selectCountJudge,
requestBody);
if(object==null){
return 0;
}
String respString = object.get("respString").toString();
return Integer.valueOf(respString);

@ -1,6 +1,7 @@
package com.sztzjy.financial_bigdata.service.tea;
import com.sztzjy.financial_bigdata.entity.SysCaseQuestionStep;
import com.sztzjy.financial_bigdata.entity.resource_entity.TestTestSysCaseQuestionStepWithBLOBs;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuCommitCaseDto;
import java.io.IOException;
@ -15,7 +16,7 @@ public interface ITeaCaseStepService {
Boolean deleteCaseStep(String caseStepId, String schoolId);
SysCaseQuestionStep selectCaseStepDetails(String caseStepId);
TestTestSysCaseQuestionStepWithBLOBs selectCaseStepDetails(String caseStepId) throws IOException;
Boolean commitCase(StuCommitCaseDto commitCaseDto) throws IOException;
}

@ -82,9 +82,9 @@ public class TeaCaseStepServiceImpl implements ITeaCaseStepService {
}
@Override
public SysCaseQuestionStep selectCaseStepDetails(String caseStepId) {
SysCaseQuestionStep sysCaseQuestionStep = caseQuestionStepMapper.selectByPrimaryKey(caseStepId);
return sysCaseQuestionStep;
public TestTestSysCaseQuestionStepWithBLOBs selectCaseStepDetails(String caseStepId) throws IOException {
TestTestSysCaseQuestionStepWithBLOBs testTestSysCaseQuestionStepWithBLOBs = CaseApi.selectCaseStepDetails(caseStepId);
return testTestSysCaseQuestionStepWithBLOBs;
}
@Override
@ -93,8 +93,8 @@ public class TeaCaseStepServiceImpl implements ITeaCaseStepService {
StuTrainingStepRecordExample example = new StuTrainingStepRecordExample();
example.createCriteria().andUserIdEqualTo(commitCaseDto.getUserId()).andCaseStepIdEqualTo(commitCaseDto.getCaseStepId());
List<StuTrainingStepRecord> stuTrainingStepRecords = trainingStepRecordMapper.selectByExample(example);
if(stuTrainingStepRecords==null){ //未答过该步骤题目 新增数据到stepRecord表中
SysCaseQuestionStep dbCaseQuestionStep = selectCaseStepDetails(commitCaseDto.getCaseStepId());
if(stuTrainingStepRecords.isEmpty()){ //未答过该步骤题目 新增数据到stepRecord表中
TestTestSysCaseQuestionStepWithBLOBs dbCaseQuestionStep = selectCaseStepDetails(commitCaseDto.getCaseStepId());
StuTrainingStepRecord stepRecord = new StuTrainingStepRecord();
stepRecord.setRecordId(String.valueOf(UUID.randomUUID()));
stepRecord.setUserId(commitCaseDto.getUserId());
@ -128,7 +128,7 @@ public class TeaCaseStepServiceImpl implements ITeaCaseStepService {
stepRecord.setScore("0");
//再修改学生实训表中的部分参数 先获取学生实训表中的数据
StuTrainingWithBLOBs training = trainingMapper.selectByPrimaryKey(commitCaseDto.getStuTrainingId());
//如果案例题学生的实验实训完成情况=0 则实训进度+1否则 实训进度不加 并累加案例题学生得分 修改实验实训完成状态
//如果案例题学生的实验实训完成情况=0 则实训进度+1否则 实训进度不加 修改实验实训完成状态
if(training.getExpTrainingCompleteStatus()==null){
if(training.getProgress()==null){
training.setProgress(BigDecimal.ONE);
@ -139,8 +139,6 @@ public class TeaCaseStepServiceImpl implements ITeaCaseStepService {
}
if(training.getCaseStuScore()==null){
training.setCaseStuScore(sysCaseQuestionStep.getScore());
}else {
training.setCaseStuScore(training.getCaseStuScore().add(sysCaseQuestionStep.getScore()));
}
trainingMapper.updateByPrimaryKeyWithBLOBs(training);
}

Loading…
Cancel
Save