提交 56c6f4b7 authored 作者: zjm's avatar zjm

fix(培训模块): 添加考卷查询的接口以及保存

添加考卷查询的接口以及保存
上级 208f41c9
...@@ -3,6 +3,7 @@ package com.tykj.dev.device.train.controller; ...@@ -3,6 +3,7 @@ package com.tykj.dev.device.train.controller;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.train.entity.GenerateTestPaper; import com.tykj.dev.device.train.entity.GenerateTestPaper;
import com.tykj.dev.device.train.entity.TrainTheme; import com.tykj.dev.device.train.entity.TrainTheme;
import com.tykj.dev.device.train.service.GenerateTestPaperService;
import com.tykj.dev.device.train.service.TestPaperService; import com.tykj.dev.device.train.service.TestPaperService;
import com.tykj.dev.device.train.service.TrainThemeService; import com.tykj.dev.device.train.service.TrainThemeService;
import com.tykj.dev.device.user.subject.entity.SecurityUser; import com.tykj.dev.device.user.subject.entity.SecurityUser;
...@@ -32,6 +33,9 @@ public class TestPaperController { ...@@ -32,6 +33,9 @@ public class TestPaperController {
@Autowired @Autowired
TrainThemeService trainThemeService; TrainThemeService trainThemeService;
@Autowired
GenerateTestPaperService generateTestPaperService;
/** /**
* 生成试卷 * 生成试卷
*/ */
...@@ -101,4 +105,16 @@ public class TestPaperController { ...@@ -101,4 +105,16 @@ public class TestPaperController {
return ResponseEntity.ok(testPaperService.findByUserIdAndTrainId(userId,trainId)); return ResponseEntity.ok(testPaperService.findByUserIdAndTrainId(userId,trainId));
} }
/**
* 查询试卷的模版
*/
@GetMapping("/generateTestPaper")
@ApiOperation(value = "查询试卷模版", notes = "查询试卷模版")
public ResponseEntity findGenerateTestPaper() {
return ResponseEntity.ok(generateTestPaperService.findGenerateTestPaper(1));
}
} }
...@@ -17,10 +17,7 @@ import com.tykj.dev.device.train.dao.TrainUnitDao; ...@@ -17,10 +17,7 @@ import com.tykj.dev.device.train.dao.TrainUnitDao;
import com.tykj.dev.device.train.dao.TrainUserDao; import com.tykj.dev.device.train.dao.TrainUserDao;
import com.tykj.dev.device.train.entity.*; import com.tykj.dev.device.train.entity.*;
import com.tykj.dev.device.train.entity.vo.*; import com.tykj.dev.device.train.entity.vo.*;
import com.tykj.dev.device.train.service.OnlineTainUserTimeService; import com.tykj.dev.device.train.service.*;
import com.tykj.dev.device.train.service.TestPaperService;
import com.tykj.dev.device.train.service.TrainTaskService;
import com.tykj.dev.device.train.service.TrainThemeService;
import com.tykj.dev.device.user.read.service.MessageService; import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.read.subject.bto.MessageBto; import com.tykj.dev.device.user.read.subject.bto.MessageBto;
import com.tykj.dev.device.user.subject.dao.UnitsDao; import com.tykj.dev.device.user.subject.dao.UnitsDao;
...@@ -122,6 +119,9 @@ public class TrainJobController { ...@@ -122,6 +119,9 @@ public class TrainJobController {
@Autowired @Autowired
TrainUnitDao trainUnitDao; TrainUnitDao trainUnitDao;
@Autowired
GenerateTestPaperService generateTestPaperService;
/** /**
* 新建培训信息 * 新建培训信息
* 首先创建task(发起人task) 在创建状态为新建(id_done为1)以及报名中待job,在给所有的专管员发起一个job(待报名) * 首先创建task(发起人task) 在创建状态为新建(id_done为1)以及报名中待job,在给所有的专管员发起一个job(待报名)
...@@ -184,10 +184,14 @@ public class TrainJobController { ...@@ -184,10 +184,14 @@ public class TrainJobController {
taskService.start(taskBto); taskService.start(taskBto);
} }
); );
if (securityUser.getCurrentUserInfo().getUnits().getLevel()==1 && securityUser.getCurrentUserInfo().getUnits().getType()==1){ if (securityUser.getCurrentUserInfo().getUnits().getLevel()==1 && securityUser.getCurrentUserInfo().getUnits().getType()==1){
List<Integer> userIds=userService.findAllByUnite(securityUser.getCurrentUserInfo().getUnitsId()).stream().map(User::getUserId).collect(Collectors.toList()); List<Integer> userIds=userService.findAllByUnite(securityUser.getCurrentUserInfo().getUnitsId()).stream().map(User::getUserId).collect(Collectors.toList());
userIds.remove(securityUser.getCurrentUserInfo().getUserId()); userIds.remove(securityUser.getCurrentUserInfo().getUserId());
messageService.add(new MessageBto(task.getId(),BusinessEnum.TRAIN.id,"发起"+(trainTheme.getTrainType()==0 ? "线上" : "线下")+ "培训业务:【"+messageToString(trainTheme)+"】",userIds,trainTheme.getTrainId().toString())); messageService.add(new MessageBto(task.getId(),BusinessEnum.TRAIN.id,"发起"+(trainTheme.getTrainType()==0 ? "线上" : "线下")+ "培训业务:【"+messageToString(trainTheme)+"】",userIds,trainTheme.getTrainId().toString()));
if (trainTheme.getTrainType()==0) {
generateTestPaperService.saveGenerateTestPaper(trainThemeAddVo.getGenerateTestPaper());
}
}else { }else {
List<Integer> userIds=userService.findAllByUnite(securityUser.getCurrentUserInfo().getUnitsId()).stream().map(User::getUserId).collect(Collectors.toList()); List<Integer> userIds=userService.findAllByUnite(securityUser.getCurrentUserInfo().getUnitsId()).stream().map(User::getUserId).collect(Collectors.toList());
userIds.remove(securityUser.getCurrentUserInfo().getUserId()); userIds.remove(securityUser.getCurrentUserInfo().getUserId());
......
...@@ -6,4 +6,5 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -6,4 +6,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface GenerateTestPaperDao extends JpaRepository<GenerateTestPaper, Integer>, JpaSpecificationExecutor<GenerateTestPaper> { public interface GenerateTestPaperDao extends JpaRepository<GenerateTestPaper, Integer>, JpaSpecificationExecutor<GenerateTestPaper> {
} }
...@@ -70,5 +70,4 @@ public class GenerateTestPaper extends BaseEntity { ...@@ -70,5 +70,4 @@ public class GenerateTestPaper extends BaseEntity {
@ApiModelProperty(value = "简单题 key为等级 value 数量", example = "bmxx", name = "shortAnswerCount") @ApiModelProperty(value = "简单题 key为等级 value 数量", example = "bmxx", name = "shortAnswerCount")
private Map<Integer,Integer> shortAnswerCount; private Map<Integer,Integer> shortAnswerCount;
} }
package com.tykj.dev.device.train.service;
import com.tykj.dev.device.train.entity.GenerateTestPaper;
public interface GenerateTestPaperService {
/**
* 添加试卷模版
* @param generateTestPaper
* @return
*/
GenerateTestPaper saveGenerateTestPaper(GenerateTestPaper generateTestPaper);
GenerateTestPaper findGenerateTestPaper(Integer id);
}
...@@ -5,6 +5,13 @@ import com.tykj.dev.device.task.subject.bto.TaskBto; ...@@ -5,6 +5,13 @@ import com.tykj.dev.device.task.subject.bto.TaskBto;
import java.util.List; import java.util.List;
public interface TrainTaskService { public interface TrainTaskService {
/**
* 根据业务ID以及业务类型和状态查询任务集合
* @param billId 业务id
* @param billType 业务类型
* @param billStatus 任务状态
* @return
*/
List<TaskBto> selectBillidAndBillType(Integer billId, Integer billType, Integer billStatus); List<TaskBto> selectBillidAndBillType(Integer billId, Integer billType, Integer billStatus);
TaskBto selectFatherIsNullAndBillidAndBillType(Integer billId, Integer billType); TaskBto selectFatherIsNullAndBillidAndBillType(Integer billId, Integer billType);
......
package com.tykj.dev.device.train.service.impl;
import com.tykj.dev.device.train.dao.GenerateTestPaperDao;
import com.tykj.dev.device.train.entity.GenerateTestPaper;
import com.tykj.dev.device.train.service.GenerateTestPaperService;
import com.tykj.dev.misc.exception.ApiException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
/**
* @author zjm
* @version 1.0.0
* @ClassName GenerateTestPaperServiceImpl.java
* @Description TODO
* @createTime 2021年12月29日 12:50:00
*/
@Service
public class GenerateTestPaperServiceImpl implements GenerateTestPaperService {
@Autowired
GenerateTestPaperDao generateTestPaperDao;
@Override
public GenerateTestPaper saveGenerateTestPaper(GenerateTestPaper generateTestPaper) {
return generateTestPaperDao.save(generateTestPaper);
}
@Override
public GenerateTestPaper findGenerateTestPaper(Integer id) {
Optional<GenerateTestPaper> byId = generateTestPaperDao.findById(id);
return byId.orElse(null);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论