Merge remote-tracking branch 'origin/beetlsql3-dev' into beetlsql3-dev

beetlsql3-dev
Mlxa0324 2 years ago
commit 9dcb6ff66d

@ -43,19 +43,19 @@ public class StudentHandsOnTaskTheory extends BaseEntity{
//题型
private BigDecimal questionType ;
private Integer questionType ;
//我的选项
private BigDecimal myOptions ;
private String myOptions ;
//正确答案
private BigDecimal rightKey ;
private String rightKey ;
//状态
private BigDecimal theoryStatus ;
private Integer theoryStatus ;
//得分
@ -152,52 +152,52 @@ public class StudentHandsOnTaskTheory extends BaseEntity{
/**
*@return
*/
public BigDecimal getQuestionType(){
public Integer getQuestionType(){
return questionType;
}
/**
*@param questionType
*/
public void setQuestionType(BigDecimal questionType){
public void setQuestionType(Integer questionType){
this.questionType = questionType;
}
/**
*@return
*/
public BigDecimal getMyOptions(){
public String getMyOptions(){
return myOptions;
}
/**
*@param myOptions
*/
public void setMyOptions(BigDecimal myOptions){
public void setMyOptions(String myOptions){
this.myOptions = myOptions;
}
/**
*@return
*/
public BigDecimal getRightKey(){
public String getRightKey(){
return rightKey;
}
/**
*@param rightKey
*/
public void setRightKey(BigDecimal rightKey){
public void setRightKey(String rightKey){
this.rightKey = rightKey;
}
/**
*@return
*/
public BigDecimal getTheoryStatus(){
public Integer getTheoryStatus(){
return theoryStatus;
}
/**
*@param theoryStatus
*/
public void setTheoryStatus(BigDecimal theoryStatus){
public void setTheoryStatus(Integer theoryStatus){
this.theoryStatus = theoryStatus;
}

@ -10,9 +10,13 @@ import com.ibeetl.admin.core.util.TimeTool;
import com.ibeetl.admin.core.web.JsonResult;
import com.ibeetl.admin.core.web.JsonReturnCode;
import com.ibeetl.jlw.dao.StudentHandsOnTaskTheoryDao;
import com.ibeetl.jlw.entity.FileEntity;
import com.ibeetl.jlw.entity.StudentHandsOnTaskTheory;
import com.ibeetl.jlw.dao.TeacherOpenCourseHandsOnSimulationTasksDao;
import com.ibeetl.jlw.dao.TeacherOpenCourseMergeResourcesQuestionDao;
import com.ibeetl.jlw.entity.*;
import com.ibeetl.jlw.web.query.StudentHandsOnTaskTheoryQuery;
import com.ibeetl.jlw.web.query.TeacherOpenCourseHandsOnSimulationTasksQuery;
import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeResourcesQuestionQuery;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
@ -43,6 +47,9 @@ import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue;
public class StudentHandsOnTaskTheoryService extends CoreBaseService<StudentHandsOnTaskTheory>{
@Autowired private StudentHandsOnTaskTheoryDao studentHandsOnTaskTheoryDao;
@Autowired private StudentService studentService;
@Autowired private TeacherOpenCourseHandsOnSimulationTasksDao tasksService;
@Autowired private TeacherOpenCourseMergeResourcesQuestionService questionService;
public PageQuery<StudentHandsOnTaskTheory>queryByCondition(PageQuery query){
PageQuery ret = studentHandsOnTaskTheoryDao.queryByCondition(query);
@ -320,10 +327,10 @@ public class StudentHandsOnTaskTheoryService extends CoreBaseService<StudentHand
studentHandsOnTaskTheory.setHandsOnId(Long.parseLong(handsOnId));
studentHandsOnTaskTheory.setHandsOnTaskId(Long.parseLong(handsOnTaskId));
studentHandsOnTaskTheory.setStem(stem);
studentHandsOnTaskTheory.setQuestionType(new BigDecimal(questionType));
studentHandsOnTaskTheory.setMyOptions(new BigDecimal(myOptions));
studentHandsOnTaskTheory.setRightKey(new BigDecimal(rightKey));
studentHandsOnTaskTheory.setTheoryStatus(new BigDecimal(theoryStatus));
// studentHandsOnTaskTheory.setQuestionType(questionType);
studentHandsOnTaskTheory.setMyOptions(myOptions);
studentHandsOnTaskTheory.setRightKey(rightKey);
// studentHandsOnTaskTheory.setTheoryStatus(theoryStatus);
studentHandsOnTaskTheory.setTheoryScore(new BigDecimal(theoryScore));
studentHandsOnTaskTheory.setCreateTime(TimeTool.getTime(createTime));
studentHandsOnTaskTheory.setOrgId(coreUser.getOrgId());
@ -350,4 +357,99 @@ public class StudentHandsOnTaskTheoryService extends CoreBaseService<StudentHand
}
public JsonResult<List<TeacherOpenCourseMergeResourcesQuestion>> getHandsOnTaskkTheoryByTaskId(Long taskId, CoreUser coreUser) {
//查询登录用的学生id
if (!coreUser.isStudent()) {
return null;
}
Student student = studentService.getByUserId(coreUser.getId());
List<StudentHandsOnTaskTheory> theoryList = this.sqlManager.lambdaQuery(StudentHandsOnTaskTheory.class).andEq(StudentHandsOnTaskTheory::getHandsOnTaskId, taskId)
.andEq(StudentHandsOnTaskTheory::getStudentId, student.getStudentId()).select();
TeacherOpenCourseHandsOnSimulationTasksQuery tasksQuery = new TeacherOpenCourseHandsOnSimulationTasksQuery();
tasksQuery.setTaskId(taskId);
List<TeacherOpenCourseHandsOnSimulationTasks> tasksList = tasksService.getValuesByQueryNotWithPermission(tasksQuery);
if (CollectionUtils.isEmpty(tasksList)) {
return JsonResult.fail();
}
TeacherOpenCourseHandsOnSimulationTasks tasks = tasksList.get(0);
String taskList = tasks.getTaskList();
TeacherOpenCourseMergeResourcesQuestionQuery questionQuery = new TeacherOpenCourseMergeResourcesQuestionQuery();
questionQuery.setTeacherOpenCourseMergeResourcesQuestionIdPlural(taskList);
List<TeacherOpenCourseMergeResourcesQuestion> resourcesQuestions = questionService.getValuesByQueryNotWithPermission(questionQuery);
if (CollectionUtils.isEmpty(resourcesQuestions)) {
return JsonResult.success(resourcesQuestions);
}
for (TeacherOpenCourseMergeResourcesQuestion resourcesQuestion : resourcesQuestions) {
StudentHandsOnTaskTheory taskTheory = theoryList.stream().filter(v -> v.getOrgId().equals(resourcesQuestion.getTeacherOpenCourseMergeResourcesQuestionId()))
.filter(v -> v.getStudentId().equals(student.getStudentId())).filter(v -> v.getHandsOnTaskId().equals(taskId)).findFirst().orElse(null);
if (taskTheory == null) {
resourcesQuestion.set("myOptions", "");
resourcesQuestion.set("taskId", taskId);
}else {
resourcesQuestion.set("myOptions", taskTheory.getMyOptions());
resourcesQuestion.set("taskId", taskId);
}
}
return JsonResult.success(resourcesQuestions);
}
public JsonResult<String> editDo(List<TeacherOpenCourseMergeResourcesQuestion> teacherOpenCourseMergeResourcesQuestionQueries, CoreUser coreUser) {
//查询登录用的学生id
if (!coreUser.isStudent()) {
return null;
}
if (CollectionUtils.isEmpty(teacherOpenCourseMergeResourcesQuestionQueries)) {
return JsonResult.fail();
}
Long taskId = Long.parseLong(teacherOpenCourseMergeResourcesQuestionQueries.get(0).get("taskId")+"");
Student student = studentService.getByUserId(coreUser.getId());
List<StudentHandsOnTaskTheory> theoryList = this.sqlManager.lambdaQuery(StudentHandsOnTaskTheory.class).andEq(StudentHandsOnTaskTheory::getHandsOnTaskId, taskId)
.andEq(StudentHandsOnTaskTheory::getStudentId, student.getStudentId()).select();
if (CollectionUtils.isNotEmpty(theoryList)) {
return JsonResult.fail("已提交,重复提交");
}
TeacherOpenCourseHandsOnSimulationTasksQuery tasksQuery = new TeacherOpenCourseHandsOnSimulationTasksQuery();
tasksQuery.setTaskId(taskId);
List<TeacherOpenCourseHandsOnSimulationTasks> tasksList = tasksService.getValuesByQueryNotWithPermission(tasksQuery);
if (CollectionUtils.isEmpty(tasksList)) {
return JsonResult.fail();
}
TeacherOpenCourseHandsOnSimulationTasks tasks = tasksList.get(0);
List<StudentHandsOnTaskTheory> taskTheoryList = new ArrayList<>();
for (TeacherOpenCourseMergeResourcesQuestion resourcesQuestion : teacherOpenCourseMergeResourcesQuestionQueries) {
StudentHandsOnTaskTheory taskTheory = new StudentHandsOnTaskTheory();
taskTheory.setTeacherOpenCourseId(tasks.getTeacherOpenCourseId());
taskTheory.setHandsOnId(tasks.getHandsOnId());
taskTheory.setHandsOnTaskId(tasks.getTaskId());
taskTheory.setStem(resourcesQuestion.getQuestionStem());
Integer questionType = resourcesQuestion.getQuestionType();
taskTheory.setQuestionType(questionType);
taskTheory.setMyOptions(resourcesQuestion.get("myOptions")+"");
taskTheory.setRightKey(resourcesQuestion.getQuestionAnswer());
if (resourcesQuestion.getQuestionAnswer().equals(resourcesQuestion.get("myOptions")+"")) {
if (questionType.equals(1)) {
taskTheory.setTheoryScore(tasks.getSingleScore());
}else if (questionType.equals(2)){
taskTheory.setTheoryScore(tasks.getMultipleScore());
}else if (questionType.equals(3)){
taskTheory.setTheoryScore(tasks.getJudgeScore());
}else if (questionType.equals(4)){
taskTheory.setTheoryScore(tasks.getFillScore());
}else if (questionType.equals(5)){
taskTheory.setTheoryScore(tasks.getAnalysisScore());
}
}else {
taskTheory.setTheoryScore(BigDecimal.ZERO);
}
taskTheory.setCreateTime(new Date());
taskTheory.setStudentId(student.getStudentId());
taskTheory.setUserId(coreUser.getId());
taskTheory.setOrgId(resourcesQuestion.getTeacherOpenCourseMergeResourcesQuestionId());
taskTheoryList.add(taskTheory);
}
this.insertBatch(taskTheoryList);
return JsonResult.success("提交成功");
}
}

@ -574,5 +574,20 @@ public class StudentHandsOnTaskTheoryController{
}
/**
*
* @param taskId id
* @param coreUser
* @return myOptions
*/
@GetMapping(API+"/getHandsOnTaskkTheoryByTaskId")
public JsonResult<List<TeacherOpenCourseMergeResourcesQuestion>> getHandsOnTaskkTheoryByTaskId(Long taskId, @SCoreUser CoreUser coreUser) {
return studentHandsOnTaskTheoryService.getHandsOnTaskkTheoryByTaskId(taskId, coreUser);
}
@PostMapping(API + "/edit.do")
public JsonResult<String> editDo(@Validated(ValidateConfig.UPDATE.class) List<TeacherOpenCourseMergeResourcesQuestion> teacherOpenCourseMergeResourcesQuestionQuery, @SCoreUser CoreUser coreUser) {
return studentHandsOnTaskTheoryService.editDo(teacherOpenCourseMergeResourcesQuestionQuery, coreUser);
}
}

@ -28,13 +28,13 @@ public class StudentHandsOnTaskTheoryQuery extends PageParam {
@Query(name = "题干", display = false)
private String stem;
@Query(name = "题型", display = false)
private BigDecimal questionType;
private Integer questionType;
@Query(name = "我的选项", display = false)
private BigDecimal myOptions;
private String myOptions;
@Query(name = "正确答案", display = false)
private BigDecimal rightKey;
private String rightKey;
@Query(name = "状态", display = false)
private BigDecimal theoryStatus;
private Integer theoryStatus;
@Query(name = "得分", display = false)
private BigDecimal theoryScore;
@Query(name = "创建时间", display = false)
@ -91,28 +91,28 @@ public class StudentHandsOnTaskTheoryQuery extends PageParam {
public void setStem(String stem ){
this.stem = stem;
}
public BigDecimal getQuestionType(){
public Integer getQuestionType(){
return questionType;
}
public void setQuestionType(BigDecimal questionType ){
public void setQuestionType(Integer questionType ){
this.questionType = questionType;
}
public BigDecimal getMyOptions(){
public String getMyOptions(){
return myOptions;
}
public void setMyOptions(BigDecimal myOptions ){
public void setMyOptions(String myOptions ){
this.myOptions = myOptions;
}
public BigDecimal getRightKey(){
public String getRightKey(){
return rightKey;
}
public void setRightKey(BigDecimal rightKey ){
public void setRightKey(String rightKey ){
this.rightKey = rightKey;
}
public BigDecimal getTheoryStatus(){
public Integer getTheoryStatus(){
return theoryStatus;
}
public void setTheoryStatus(BigDecimal theoryStatus ){
public void setTheoryStatus(Integer theoryStatus ){
this.theoryStatus = theoryStatus;
}
public BigDecimal getTheoryScore(){

Loading…
Cancel
Save