whb 5 months ago
commit 7704aaee43

@ -38,6 +38,6 @@ public class Constant {
public static final String THEORY = "理论考试模块";
public static final String RESOURCE = "资源中心模块";
public static final String API_URL = "http://120.79.54.255:8889";
// public static final String API_URL = "http://192.168.2.11:8889";
// public static final String API_URL = "http://192.168.2.29:8889";
}

@ -20,6 +20,7 @@ import java.util.List;
@Component
public class TokenProvider {
private final static String SECRET = "MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAghgsx+OLLThi7c+/HgCaRla8n+/QLHt++uscoK22dMeaVa3WJvRb5C5qtHGzj9V74pI96JpxdWWCN3Zr1QtanQIDAQABAkB2fWRUD1jVMBVS+rPctLnPNPMKTRdzXGv0SC5D3tRfGZqdcfsmZg8hzBVndHxngmwZS73d+hPjofcdefDDnXq1AiEAz/r1AMF7fweN70mbKgBJuTja37puJMsH2Szwrvb5jlcCIQCgIaLZ5d9J7OomL0NwH8ghba/xgBEpKzErfGbFnTfeKwIgc8ptczFFV1DWZb2eJIEqinOr79l0jwl2YiQSD+cyw1sCIHqxCvv1Wx5jPgy/zeYNE+Q5DMP3Ii7u/x+Yk436JiI9AiEAio84hFm44YTUuV7YCYsbyvnCn/vtcAaqZlczbeHlP1I=";
private final static long EXP_TIME = 1000 * 60 * 60 * 4;

@ -44,7 +44,7 @@ public class ExerciseExperimentalTraining {
@ApiOperation("**获取案例题基础信息")
@AnonymousAccess
public ResultEntity<TestSysCaseQuestion> getCaseInfo(@RequestParam String chapterId) {
List<TestSysCaseQuestion> sysCaseQuestions= null;
List<TestSysCaseQuestion> sysCaseQuestions = null;
try {
sysCaseQuestions = CaseApi.selectCaseByChapterId(chapterId);
} catch (IOException e) {
@ -77,10 +77,6 @@ public class ExerciseExperimentalTraining {
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心根据根据案例题IDS批量查询失败");
}
for (int i = 0; i < stepList.size(); i++) {
stepList.get(0).setAnswer("");
stepList.get(0).setAnswerOriginal("");
}
return new ResultEntity<>(HttpStatus.OK, "获取案例题基础信息查询成功", stepList);
}
@ -108,7 +104,7 @@ public class ExerciseExperimentalTraining {
@AnonymousAccess
@ApiOperation("实训演练页面查询")
@PostMapping("getCourseChapter")
public ResultEntity<List<SysCourseDto>> getIndexTheoryTest(@RequestParam String userId,@RequestParam String systemOwner) {
public ResultEntity<List<SysCourseDto>> getIndexTheoryTest(@RequestParam String userId, @RequestParam String systemOwner) {
// List<SysCourse> sysCourseList = sysCourseMapper.getBySchoolId();
List<SysTwoCatalog> sysCourseList = null;
try {
@ -116,9 +112,11 @@ public class ExerciseExperimentalTraining {
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心获取内置二级目录失败");
}
if (sysCourseList.isEmpty()) {
return null;
}
List<SysCourseDto> dtoList = new ArrayList<>();
// 批量查询所有章节
List<String> courseIds = sysCourseList.stream()
.map(SysTwoCatalog::getTwoId)
@ -129,25 +127,36 @@ public class ExerciseExperimentalTraining {
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心根据课程IDList查询章节集合失败");
}
if (sysCourseChapters.isEmpty()) {
//三级为空返回二级的信息
for (SysTwoCatalog sysTwoCatalog : sysCourseList) {
SysCourseDto newDto = new SysCourseDto();
newDto.setCourseId(sysTwoCatalog.getTwoId());
newDto.setSequence(sysTwoCatalog.getSort());
newDto.setCourseName(sysTwoCatalog.getTwoName());
newDto.setSchoolId(sysTwoCatalog.getCreator());
dtoList.add(newDto);
return new ResultEntity<List<SysCourseDto>>(dtoList);
}
}
// 批量查询所有案例题步骤
SysCaseQuestionStepExample stepExample = new SysCaseQuestionStepExample();
stepExample.setOrderByClause("sort");
List<TestTestSysCaseQuestionStepWithBLOBs> sysCaseQuestionSteps= null;
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);
caseIdMap = CaseApi.getMapChapterIdAndCaseIdsByCourseIdAndChapterId(sysCourseChapters, systemOwner);
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心查询失败");
}
@ -156,7 +165,7 @@ public class ExerciseExperimentalTraining {
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));
.collect(Collectors.toMap(StuTraining::getChapterId, stuTraining -> Optional.ofNullable(stuTraining.getProgress()).orElse(BigDecimal.ZERO), (p1, p2) -> p1));
// 构建结果列表
for (SysTwoCatalog sysCourse : sysCourseList) {
@ -182,12 +191,12 @@ public class ExerciseExperimentalTraining {
// 获取案例题步骤信息
List<String> caseIds = caseIdMap.get(chapter.getThreeId());
if (caseIds != null && !caseIds.isEmpty()) {
List<AAA>list =new ArrayList<>();
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 aaa = new AAA();
aaa.setStepID(step.getCaseStepId());
aaa.setTitle(step.getTitle());
aaa.setSort(step.getSort());
@ -240,9 +249,9 @@ public class ExerciseExperimentalTraining {
} catch (IOException e) {
return false;
}
if(resourceDataList.size()>0){
if (resourceDataList.size() > 0) {
return true;
}else {
} else {
return false;
}
}

@ -1,7 +1,6 @@
package com.sztzjy.financial_bigdata.controller.stu;
import com.sztzjy.financial_bigdata.annotation.AnonymousAccess;
import com.sztzjy.financial_bigdata.config.Constant;
import com.sztzjy.financial_bigdata.entity.*;
import com.sztzjy.financial_bigdata.entity.resource_entity.SysTwoCatalog;
import com.sztzjy.financial_bigdata.entity.stu_dto.AllModuleProgressDto;
@ -172,13 +171,16 @@ public class StuIndexController {
@AnonymousAccess
@ApiOperation("设置资源学习人数和学习时长")
@PostMapping("setResourceNum")
public void setResourceNum(@RequestParam String schoolId, @ApiParam("学习时长,单位分钟") @RequestParam Integer time) {
public void setResourceNum(@RequestParam String schoolId,
@ApiParam("学习时长,单位分钟") @RequestParam Integer time,
@RequestParam String systemOwner) {
SysResourceLearning sysResourceLearning = sysResourceLearningMapper.selectByPrimaryKey(schoolId);
if (sysResourceLearning == null) { //第一次 新增一条
SysResourceLearning newData = new SysResourceLearning();
newData.setSchoolId(schoolId);
newData.setLearningTime(time);
newData.setLearningNum(1);
newData.setSystemOwner(systemOwner);
sysResourceLearningMapper.insert(newData);
} else {
if (sysResourceLearning.getLearningNum() == null) {

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

@ -81,7 +81,7 @@ public class TeaGradeManageController {
@ApiParam("系统名称") @RequestParam String systemOwner) {
List<TeaExamManage> teaExamManages = teaExamManageMapper.selectBySchoolIdAndSystemOwner(schoolId, systemOwner);
if (teaExamManages.isEmpty()) {
if (teaExamManages == null || teaExamManages.isEmpty()) {
return null;
}
List<TeaExamManageCountDto> teaExamManageCountDtos = new ArrayList<>();
@ -574,8 +574,8 @@ public class TeaGradeManageController {
for (int i = 0; i < twoCatalogs.size(); i++) {
HashMap<String, String> hashMap = new HashMap<>();
SysTwoCatalog sysTwoCatalog = twoCatalogs.get(i);
hashMap.put("course_id",sysTwoCatalog.getTwoId());
hashMap.put("course_name",sysTwoCatalog.getTwoName());
hashMap.put("course_id", sysTwoCatalog.getTwoId());
hashMap.put("course_name", sysTwoCatalog.getTwoName());
list.add(hashMap);
}
} catch (IOException e) {
@ -610,7 +610,7 @@ public class TeaGradeManageController {
@RequestParam(required = false) String classId,
@ApiParam("学号/姓名搜索框") @RequestParam(required = false) String keyWord,
@RequestParam String systemOwner) {
return new ResultEntity<>(iTeaGradeManageService.getTheoryInfo(index, size, schoolId, classId, keyWord,systemOwner));
return new ResultEntity<>(iTeaGradeManageService.getTheoryInfo(index, size, schoolId, classId, keyWord, systemOwner));
}

@ -363,8 +363,12 @@ public class UserController {
@AnonymousAccess
@PostMapping("/selectAllClassNameBySchoolId")
@ApiOperation("班级下拉框")
public ResultEntity<List<Map<String, String>>> selectAllClassNameBySchoolId(@RequestParam String schoolId) {
return new ResultEntity<>(classMapper.selectAllClassNameBySchoolId(schoolId));
public ResultEntity<List<Map<String, String>>> selectAllClassNameBySchoolId(@RequestParam String schoolId,@RequestParam String systemOwner) {
StuUserExample example =new StuUserExample();
example.createCriteria().andSchoolIdEqualTo(schoolId);
List<StuUser> list = stuUserMapper.selectByExample(example);
String schoolName = list.get(0).getSchoolName();
return new ResultEntity<>(classMapper.selectAllClassNameBySchoolId(schoolName,systemOwner));
}

@ -33,8 +33,9 @@ public interface StuClassMapper {
int updateByPrimaryKey(StuClass record);
@Select("SELECT DISTINCT s.class_name, s.class_id FROM stu_class s, stu_userinfo u WHERE #{schoolId}= u.school_id;")
List<Map<String,String>> selectAllClassNameBySchoolId(@Param("schoolId")String schoolId);
@Select("SELECT class_name, class_id FROM stu_class WHERE school_name = #{schoolName} and system_owner =#{systemOwner}")
List<Map<String,String>> selectAllClassNameBySchoolId(@Param("schoolName")String schoolName,
@Param("systemOwner")String systemOwner);
@Select("SELECT s.class_name FROM stu_class s, stu_userinfo u WHERE s.class_id = u.class_id and s.class_id = #{classId};")
String selectClassNameByClassId(@Param("classId")String classId);

@ -67,4 +67,9 @@ public interface StuUserMapper {
List<StuUser> selectByPrimaryKeys(@Param("userIds") List<String> userIds);
List<StuUser> selectTeaExamAndUserDtos(@Param("schoolId")String schoolId,@Param("keyWord") String keyWord, @Param("classId")String classId);
List<StuUser> getByNameAndStudentID(@Param("schoolId")String schoolId,
@Param("keyWord") String keyWord,
@Param("classId")String classId,
@Param("systemOwner") String systemOwner);
}

@ -323,10 +323,10 @@ public class CaseApi {
*
* --questionOriginalcontentOriginal,Sort
*/
public static List<TestTestSysCaseQuestionStepWithBLOBs> getGradeReportCase(List<String> caseIdList, String schoolId, String systemOwner) throws IOException {
public static List<TestTestSysCaseQuestionStepWithBLOBs> getGradeReportCase(List<String> caseIdList, String schoolId,String systemOwner) throws IOException {
Gson gson = new Gson();
// 构建带有 schoolId 的 URL
String urlWithParams = getGradeReportCase + "?schoolId=" + URLEncoder.encode(schoolId, "UTF-8");
String urlWithParams = getGradeReportCase + "?schoolId=" + URLEncoder.encode(schoolId, "UTF-8")+"&systemOwner="+ systemOwner;
JSONObject object = HttpUtils.sendPost(
urlWithParams,
gson.toJson(caseIdList), "application/json", null);
@ -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);

@ -238,7 +238,7 @@ public class ObjectiveApi {
*ID
*/
public static List<SysObjectiveQuestions> selectRandomObjectiveByChapterId(String chapterId) throws IOException {
String requestBody = "threeId="+chapterId;
String requestBody = "chapterId="+chapterId;
JSONObject object = HttpUtils.sendPost(
selectRandomObjectiveByChapterId,
requestBody);
@ -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);

@ -30,13 +30,13 @@ public class ResourceCenterApi {
* local:
* rsapi:
*/
public static Boolean uploadResource(MultipartFile file, String schoolId, String courseId,String type,String systemOwner,String courseName) throws IOException {
public static Boolean uploadResource(MultipartFile file, String schoolId, String courseId, String type, String systemOwner, String courseName) throws IOException {
String returnStr = HttpUtils.sendPostRequestWithMultipartFile(
uploadResource + "?schoolId=" + schoolId+"&twoId="+courseId+"&resourceType="+type+"&systemOwner="+systemOwner+"&twoName"+courseName,
uploadResource + "?schoolId=" + schoolId + "&twoId=" + courseId + "&resourceType=" + type + "&systemOwner=" + systemOwner + "&twoName" + courseName,
file);
if("true".equals(returnStr)){
if ("true".equals(returnStr)) {
return true;
}else {
} else {
return false;
}
}
@ -45,15 +45,16 @@ public class ResourceCenterApi {
* local:
* rsapi:
*/
public static List<SysResource> selectResource(String schoolId, String courseId,String systemOwner) throws IOException {
String requestBody="schoolId="+schoolId+"&twoId="+courseId+"&oneId="+systemOwner;
public static List<SysResource> selectResource(String schoolId, String courseId, String systemOwner) throws IOException {
String requestBody = "schoolId=" + schoolId + "&twoId=" + courseId + "&oneId=" + systemOwner;
JSONObject object = HttpUtils.sendPost(
selectResource,
requestBody);
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter())
.create();
Type listType = new TypeToken<List<SysResource>>() {}.getType();
Type listType = new TypeToken<List<SysResource>>() {
}.getType();
List<SysResource> resourceList = gson.fromJson(object.get("respString").toString(), listType);
return resourceList;
}
@ -63,15 +64,16 @@ public class ResourceCenterApi {
* rsapi:
*/
public static List<SysResource> selectResourceByChapterId(String chapterId,String systemOwner) throws IOException {
String requestBody="threeId="+chapterId+"&oneId="+systemOwner;
public static List<SysResource> selectResourceByChapterId(String chapterId, String systemOwner) throws IOException {
String requestBody = "threeId=" + chapterId + "&oneId=" + systemOwner;
JSONObject object = HttpUtils.sendPost(
selectResourceByChapterId,
requestBody);
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter())
.create();
Type listType = new TypeToken<List<SysResource>>() {}.getType();
Type listType = new TypeToken<List<SysResource>>() {
}.getType();
List<SysResource> resourceList = gson.fromJson(object.get("respString").toString(), listType);
return resourceList;
}
@ -82,15 +84,15 @@ public class ResourceCenterApi {
* rsapi:
*/
public static void downloadResource(String resourceDataName, String resourceId, HttpServletResponse response) throws Exception {
String downloadResourceUrl = downloadResource+"?resourceId=" + resourceId;
DownLoadUtil.downLoadFile(downloadResourceUrl,resourceDataName,response);
String downloadResourceUrl = downloadResource + "?resourceId=" + resourceId;
DownLoadUtil.downLoadFile(downloadResourceUrl, resourceDataName, response);
}
/**
*
*/
public static Map<String,Integer> getResourceTypeCount(String schoolId ,String systemOwner){
String requestBody="schoolId="+schoolId+"&systemOwner="+systemOwner;
public static Map<String, Integer> getResourceTypeCount(String schoolId, String systemOwner) {
String requestBody = "schoolId=" + schoolId + "&systemOwner=" + systemOwner;
JSONObject object = null;
try {
object = HttpUtils.sendPost(
@ -99,22 +101,23 @@ public class ResourceCenterApi {
} catch (IOException e) {
e.printStackTrace();
}
if(object==null){
if (object == null) {
return new HashMap<>();
}
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateTypeAdapter())
.create();
Type listType = new TypeToken<Map<String,Integer>>() {}.getType();
Map<String,Integer> map = gson.fromJson(object.get("respString").toString(), listType);
Type listType = new TypeToken<Map<String, Integer>>() {
}.getType();
Map<String, Integer> map = gson.fromJson(object.get("respString").toString(), listType);
return map;
}
/**
*
*/
public static Integer getTotalResource(String systemOwner,String schoolId) throws IOException {
String requestBody="schoolId="+schoolId+"&systemOwner="+systemOwner;
public static Integer getTotalResource(String systemOwner, String schoolId) throws IOException {
String requestBody = "schoolId=" + schoolId + "&systemOwner=" + systemOwner;
JSONObject object = HttpUtils.sendPost(
getTotalResource,
requestBody);
@ -125,8 +128,8 @@ public class ResourceCenterApi {
/**
*
*/
public static String getMostPopularName(String systemOwner,String schoolId) throws IOException {
String requestBody="schoolId="+schoolId+"&systemOwner="+systemOwner;
public static String getMostPopularName(String systemOwner, String schoolId) throws IOException {
String requestBody = "schoolId=" + schoolId + "&systemOwner=" + systemOwner;
JSONObject object = HttpUtils.sendPost(
getMostPopularName,
requestBody);

@ -1,6 +1,5 @@
package com.sztzjy.financial_bigdata.service.stu.impl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sztzjy.financial_bigdata.config.Constant;
@ -11,7 +10,6 @@ import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestDto;
import com.sztzjy.financial_bigdata.mapper.*;
import com.sztzjy.financial_bigdata.resourceCenterAPI.ObjectiveApi;
import com.sztzjy.financial_bigdata.service.stu.ITheoryTestService;
import com.sztzjy.financial_bigdata.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -37,25 +35,25 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
// 之前没有进行考试 从客观题库表中查询 35道单选每题2分5道多选每题4分10道判断每题1分 并将id保存至理论考试表中
// 注意 开始考试后 要生成理论记录表基础数据
@Override
public List<SysObjectiveQuestions> startTheoryTest(String userId,String systemOwner) throws IOException {
public List<SysObjectiveQuestions> startTheoryTest(String userId, String systemOwner) throws IOException {
StuTheoryExamExample example = new StuTheoryExamExample();
example.createCriteria().andUserIdEqualTo(userId);
example.setOrderByClause("exam_time DESC");
List<StuTheoryExamWithBLOBs> stuTheoryExams = theoryExamMapper.selectByExampleWithBLOBs(example);
if (stuTheoryExams.isEmpty()) { //之前没有进行考试
List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId,systemOwner);
GenerateTheoryRecordFirst(userId);
List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId, systemOwner);
GenerateTheoryRecordFirst(userId, systemOwner);
return objectiveQuestionList;
} else { //根据考试时间排序 查询最近的一条
StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0);
Date currentTime = new Date();
Date twoHoursAgo = new Date(currentTime.getTime() - (2 * 60 * 60 * 1000)); // 当前时间减去两个小时
if(stuTheoryExam.getAnswered()){
List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId,systemOwner);
if (stuTheoryExam.getAnswered()) {
List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId, systemOwner);
return objectiveQuestionList;
}
if (stuTheoryExam.getExamTime().before(twoHoursAgo)) { //已超出两个小时 从新生成新试卷
List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId,systemOwner);
List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId, systemOwner);
return objectiveQuestionList;
} else { //在两个小时内 返回最近的一条试卷
String singleIds = stuTheoryExam.getSingleIds();
@ -77,9 +75,9 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
}
//第一次生成理论考试记录数据 先判断是否生成过理论考试记录数据
public void GenerateTheoryRecordFirst(String userId){
public void GenerateTheoryRecordFirst(String userId, String systemOwner) {
StuTheoryRecord record = theoryRecordMapper.selectByPrimaryKey(userId);
if(record==null){
if (record == null) {
StuUser stuUser = userMapper.selectByPrimaryKey(userId);
StuTheoryRecord stuTheoryRecord = new StuTheoryRecord();
stuTheoryRecord.setUserId(userId);
@ -88,36 +86,37 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
stuTheoryRecord.setName(stuUser.getName());
stuTheoryRecord.setStudentId(stuUser.getStudentId());
stuTheoryRecord.setExamCount(0);
stuTheoryRecord.setSystemOwner(systemOwner);
theoryRecordMapper.insert(stuTheoryRecord);
}
}
public void UpdateTheoryRecord(String userId,BigDecimal score,Integer examDuration){
public void UpdateTheoryRecord(String userId, BigDecimal score, Integer examDuration) {
StuTheoryRecord record = theoryRecordMapper.selectByPrimaryKey(userId);
if(record!=null){
record.setExamCount(record.getExamCount()+1);
if(record.getHighestScore()==null){
if (record != null) {
record.setExamCount(record.getExamCount() + 1);
if (record.getHighestScore() == null) {
record.setHighestScore(score);
}else {
if(record.getHighestScore().compareTo(score)<0){
} else {
if (record.getHighestScore().compareTo(score) < 0) {
record.setHighestScore(score);
}
}
if(record.getLowestScore()==null){
if (record.getLowestScore() == null) {
record.setLowestScore(score);
}else {
if(record.getLowestScore().compareTo(score)>0){
} else {
if (record.getLowestScore().compareTo(score) > 0) {
record.setLowestScore(score);
}
}
if(record.getTotalDuration()==null){
if (record.getTotalDuration() == null) {
record.setTotalDuration(examDuration);
}else {
record.setTotalDuration(examDuration+record.getTotalDuration());
} else {
record.setTotalDuration(examDuration + record.getTotalDuration());
}
if(record.getAverageScore()==null){
if (record.getAverageScore() == null) {
record.setAverageScore(score);
}else {
} else {
Integer examCount = record.getExamCount();
BigDecimal averageScore = record.getAverageScore();
BigDecimal multiply = averageScore.multiply(BigDecimal.valueOf(examCount));
@ -130,11 +129,11 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
//随机生成100分题目
public List<SysObjectiveQuestions> GenerateTest(String userId,String systemOwner) throws IOException {
public List<SysObjectiveQuestions> GenerateTest(String userId, String systemOwner) throws IOException {
List<SysObjectiveQuestions> objectiveQuestionList1 = ObjectiveApi.selectRandomObjectiveSingle(systemOwner);
List<SysObjectiveQuestions> objectiveQuestionList2 = ObjectiveApi.selectRandomObjectiveMany(systemOwner);
List<SysObjectiveQuestions> objectiveQuestionList3 = ObjectiveApi.selectRandomObjectiveJudge(systemOwner);
List<SysObjectiveQuestions> objectiveQuestionList=new ArrayList<>();
List<SysObjectiveQuestions> objectiveQuestionList = new ArrayList<>();
objectiveQuestionList.addAll(objectiveQuestionList1);
objectiveQuestionList.addAll(objectiveQuestionList2);
objectiveQuestionList.addAll(objectiveQuestionList3);
@ -202,7 +201,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
errorMapper.insert(stuError);
} else {
StuErrorWithBLOBs stuError = stuErrors.get(0);
if (stuError.getSingleIds()!=null) {
if (stuError.getSingleIds() != null) {
List<String> stringList = Arrays.asList(stuError.getSingleIds().substring(1, stuError.getSingleIds().length() - 1).split(", "));
List<String> singleErrorIds = theoryTestDto.getSingleErrorIds();
@ -214,7 +213,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
} else {
stuError.setSingleIds(String.valueOf(theoryTestDto.getSingleErrorIds()));
}
if (stuError.getMultipleIds()!=null) {
if (stuError.getMultipleIds() != null) {
List<String> stringList = Arrays.asList(stuError.getMultipleIds().substring(1, stuError.getMultipleIds().length() - 1).split(", "));
List<String> multipleErrorIds = theoryTestDto.getMultipleErrorIds();
@ -226,7 +225,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
} else {
stuError.setMultipleIds(String.valueOf(theoryTestDto.getMultipleErrorIds()));
}
if (stuError.getJudgeIds()!=null) {
if (stuError.getJudgeIds() != null) {
List<String> stringList = Arrays.asList(stuError.getJudgeIds().substring(1, stuError.getJudgeIds().length() - 1).split(", "));
List<String> judgeErrorIds = theoryTestDto.getJudgeErrorIds();
List<String> combinedList = new ArrayList<>(stringList);
@ -237,14 +236,14 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
} else {
stuError.setJudgeIds(String.valueOf(theoryTestDto.getJudgeErrorIds()));
}
errorMapper.updateByPrimaryKey(stuError);
errorMapper.updateByPrimaryKeySelective(stuError);
}
UpdateTheoryRecord(theoryTestDto.getUserId(),theoryTestDto.getScore(),theoryTestDto.getExamDuration());
UpdateTheoryRecord(theoryTestDto.getUserId(), theoryTestDto.getScore(), theoryTestDto.getExamDuration());
return i;
}
@Override
public List<SysObjectiveQuestions> selectErrors(String userId,String schoolId,String systemOwner) 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);
@ -294,9 +293,9 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
List<String> stringList = Arrays.asList(error.getSingleIds().substring(1, stuErrors.get(0).getSingleIds().length() - 1).split(", "));
Set<String> set = new LinkedHashSet<>(stringList);
set.remove(objectiveQuestionId);
if(set.isEmpty()){
if (set.isEmpty()) {
error.setSingleIds(null);
}else {
} else {
List<String> list = new ArrayList<>(set);
error.setSingleIds(String.valueOf(list));
}
@ -304,25 +303,25 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
if (Constant.OBJECTIVE_TYPE_Many.equals(type)) {
Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getMultipleIds().substring(1, error.getMultipleIds().length() - 1).split(", ")));
set.remove(objectiveQuestionId);
if(set.isEmpty()){
if (set.isEmpty()) {
error.setMultipleIds(null);
}else {
} else {
List<String> list = new ArrayList<>(set);
error.setMultipleIds(String.valueOf(list));
}
}
if(Constant.OBJECTIVE_TYPE_JUDGE.equals(type)){
if (Constant.OBJECTIVE_TYPE_JUDGE.equals(type)) {
Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getJudgeIds().substring(1, error.getJudgeIds().length() - 1).split(", ")));
set.remove(objectiveQuestionId);
if(set.isEmpty()){
if (set.isEmpty()) {
error.setJudgeIds(null);
}else {
} else {
List<String> list = new ArrayList<>(set);
error.setJudgeIds(String.valueOf(list));
}
}
int i = errorMapper.updateByPrimaryKeyWithBLOBs(error);
return i==1;
return i == 1;
}
@Override
@ -337,7 +336,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
}
@Override
public List<StuTheoryExamDetailDto> getTheoryTestDetail(String theoryExamId, Integer index, Integer size,String schoolId,String systemOwner) 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<>();
@ -350,7 +349,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
idsList.addAll(multipleIdList);
idsList.addAll(judgeIdList);
ArrayList<String> answerList = new ArrayList<>();
if(theoryExam.getSingleStuAnswer()!=null){
if (theoryExam.getSingleStuAnswer() != null) {
String[] singleSplit = theoryExam.getSingleStuAnswer().substring(1, theoryExam.getSingleStuAnswer().length() - 1).split(",");
for (String str : singleSplit) {
if (str.equals("") || str.equals(" ")) {
@ -360,7 +359,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
}
}
}
if(theoryExam.getMultipleStuAnswer()!=null){
if (theoryExam.getMultipleStuAnswer() != null) {
String[] multipleSplit = theoryExam.getMultipleStuAnswer().substring(1, theoryExam.getMultipleStuAnswer().length() - 1).split(",");
for (String str : multipleSplit) {
if (str.equals("") || str.equals(" ")) {
@ -371,7 +370,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
}
}
}
if(theoryExam.getJudgeStuAnswer()!=null){
if (theoryExam.getJudgeStuAnswer() != null) {
String[] judgeSplit = theoryExam.getJudgeStuAnswer().substring(1, theoryExam.getJudgeStuAnswer().length() - 1).split(",");
for (String str : judgeSplit) {
if (str.equals("") || str.equals(" ")) {
@ -381,17 +380,17 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
}
}
}
List<StuTheoryExamDetailDto> detailDtos=new ArrayList<>();
if(answerList.size()==0){
List<StuTheoryExamDetailDto> detailDtos = new ArrayList<>();
if (answerList.size() == 0) {
return null;
}
for (int i = 0; i < answerList.size(); i++) {
if(answerList.get(i)==null){
answerList.set(i,"空");
if (answerList.get(i) == null) {
answerList.set(i, "空");
}
}
for (Integer i = (index-1)*size; i < (index-1)*size+size; i++) {
for (Integer i = (index - 1) * size; i < (index - 1) * size + size; i++) {
StuTheoryExamDetailDto detailDto = new StuTheoryExamDetailDto();
String objectiveQuestionId = idsList.get(i);
String stuAnswer = answerList.get(i).trim();
@ -399,22 +398,22 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
BigDecimal score = objectiveQuestion.getScore();
String content = objectiveQuestion.getContent();
String answer = objectiveQuestion.getAnswer();
if(stuAnswer.equals("true")){
stuAnswer="对";
if (stuAnswer.equals("true")) {
stuAnswer = "对";
}
if(stuAnswer.equals("false")){
stuAnswer="错";
if (stuAnswer.equals("false")) {
stuAnswer = "错";
}
if(answer.replaceAll(",","").equals(stuAnswer)){
if (answer.replaceAll(",", "").equals(stuAnswer)) {
detailDto.setScore(String.valueOf(score));
detailDto.setStatus("正确");
}else {
} else {
detailDto.setScore("0");
detailDto.setStatus("错误");
}
detailDto.setContent(content);
detailDto.setMychoice(stuAnswer);
detailDto.setAnswer(answer.replaceAll(",",""));
detailDto.setAnswer(answer.replaceAll(",", ""));
detailDtos.add(detailDto);
}
return detailDtos;
@ -430,7 +429,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
return null;
} else { //根据考试时间排序 查询最近的一条
StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0);
if(stuTheoryExam.getAnswered()){
if (stuTheoryExam.getAnswered()) {
return null;
}
Date currentTime = new Date();

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

@ -180,7 +180,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
TeaTrainingDto newData = new TeaTrainingDto();
BeanUtils.copyProperties(stuTrainingWithBLOB, newData);
if (sysCourseChapter != null) {
newData.setTaskModule(sysCourseChapter.getThreeId());
newData.setTaskModule(sysCourseChapter.getThreeName());
}
if (StringUtils.isNotBlank(stuTrainingWithBLOB.getReportId())) {
String reportId = stuTrainingWithBLOB.getReportId();
@ -289,20 +289,9 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
private List<TeaTrainingInfoDTO> getTeaTrainingInfoDTOS(String schoolId, String keyWord, String classId, String systemOwner) {
StuUserExample userExample = new StuUserExample();
StuUserExample.Criteria criteria = userExample.createCriteria();
criteria.andSchoolIdEqualTo(schoolId).andRoleIdEqualTo(4);
if (StringUtils.isNotBlank(classId)) {
criteria.andClassIdEqualTo(classId);
}
if (StringUtils.isNotBlank(keyWord)) {
userExample.or().andSchoolIdEqualTo(schoolId).andStudentIdEqualTo(keyWord);
userExample.or().andSchoolIdEqualTo(schoolId).andNameEqualTo(keyWord);
}
List<StuUser> stuUsers =userMapper.getByNameAndStudentID(schoolId,keyWord,classId,systemOwner);
// 查询学生用户列表
List<StuUser> stuUsers = userMapper.selectByExample(userExample);
if (stuUsers.isEmpty()) {
return Collections.emptyList();
}

@ -409,7 +409,8 @@
role_id,create_time,school_id,school_name,status) VALUES
<foreach collection="list" item="student" separator=",">
(#{student.userid}, #{student.name}, #{student.studentId}, #{student.classId}, #{student.username},
#{student.password}, #{student.phone}, #{student.email},#{student.major},#{student.zyUserid},#{student.systemOnwer},#{student.roleId},
#{student.password}, #{student.phone},
#{student.email},#{student.major},#{student.zyUserid},#{student.systemOnwer},#{student.roleId},
#{student.createTime},#{student.schoolId},#{student.schoolName},#{student.status})
</foreach>
</insert>
@ -454,7 +455,7 @@
u.role_id = 4
AND u.school_id = #{schoolId}
<if test="keyWord != null and keyWord!=''">
AND (u.name = #{keyWord} OR u.student_id = #{keyWord})
AND student_id like CONCAT ('%',#{keyWord},'%') or name like CONCAT ('%',#{keyWord},'%')
</if>
<if test="classId != null and classId !=''">
AND u.class_id = #{classId}
@ -476,5 +477,22 @@
)GROUP BY class_id ) AS subquery;
</select>
<select id="getByNameAndStudentID" resultMap="BaseResultMap">
SELECT *
FROM stu_userinfo
<where>
system_onwer =#{systemOwner}
and role_id = 4
<if test="classId != null and classId != ''">
class_id = #{classId}
</if>
<if test="schoolId != null and schoolId != ''">
AND school_id = #{schoolId}
</if>
<if test="keyWord != null and keyWord != ''">
AND student_id like CONCAT ('%',#{keyWord},'%') or name like CONCAT ('%',#{keyWord},'%')
</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save