互动打分

beetlsql3-dev
Mlxa0324 2 years ago
parent 1e2d2ab7f7
commit 78abddae11

@ -31,7 +31,7 @@ public class TeacherOpenCourseChatLog extends BaseEntity{
//上级ID, 默认0L 顶级0L
private Long teacherOpenCourseChatLogParentId = 0L;
private Long teacherOpenCourseChatLogParentId;
@FetchSql("select * from teacher_open_course_chat_log t " +
"where t.teacher_open_course_id = #teacherOpenCourseId# " +

@ -1,6 +1,9 @@
package com.ibeetl.jlw.web;
import cn.hutool.core.lang.Assert;
import cn.hutool.extra.validation.BeanValidationResult;
import cn.hutool.extra.validation.ValidationUtil;
import cn.hutool.json.JSONUtil;
import cn.jlw.Interceptor.SCoreUser;
import cn.jlw.validate.ValidateConfig;
import com.ibeetl.admin.core.annotation.Function;
@ -21,14 +24,20 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
import static com.ibeetl.jlw.web.query.TeacherOpenCourseChatLogQuery.STUDENT_ADD;
import static com.ibeetl.jlw.web.query.TeacherOpenCourseChatLogQuery.TEACHER_ADD;
/**
* --
* 线
*/
@RestController
@Validated
public class TeacherOpenCourseChatLogController{
private final Log log = LogFactory.getLog(this.getClass());
@ -177,6 +186,74 @@ public class TeacherOpenCourseChatLogController{
}
}
/**
* --
* @param teacherOpenCourseChatLogQuery
* @param type 1:
* @param result
* @param coreUser
* @return
*/
@PostMapping(MODEL + "/addByType.json")
@Function("teacherOpenCourseChatLog.add")
public JsonResult addByType(
@RequestBody TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery,
Integer type,
BindingResult result, @SCoreUser CoreUser coreUser){
Boolean isTeacherAdding = type.equals(1);
// 验证
BeanValidationResult validationResult = ValidationUtil
.warpValidate(teacherOpenCourseChatLogQuery, isTeacherAdding ? TEACHER_ADD.class : STUDENT_ADD.class);
Assert.isTrue(validationResult.isSuccess(), JSONUtil.toJsonStr(validationResult.getErrorMessages()));
// 教师身份添加上级ID为0
if(isTeacherAdding) {
teacherOpenCourseChatLogQuery.setTeacherOpenCourseChatLogParentId(0L);
}
if(result.hasErrors()){
return JsonResult.failMessage(result);
}else{
teacherOpenCourseChatLogQuery.setUserId(coreUser.getId());
teacherOpenCourseChatLogQuery.setOrgId(coreUser.getOrgId());
if(null == teacherOpenCourseChatLogQuery.getTeacherOpenCourseChatLogStatus()){
teacherOpenCourseChatLogQuery.setTeacherOpenCourseChatLogStatus(1);
}
return teacherOpenCourseChatLogService.add(teacherOpenCourseChatLogQuery);
}
}
/**
* -
* @param teacherOpenCourseChatLogId
* @param studentScore
* @param result
* @return
*/
@PostMapping(MODEL + "/setScore.json")
@Function("teacherOpenCourseChatLog.add")
public JsonResult setScore(
@NotNull(message = "互动ID不能为空")
Long teacherOpenCourseChatLogId,
@NotNull(message = "学生分数不能为空!")
BigDecimal studentScore, BindingResult result){
if(result.hasErrors()){
return JsonResult.failMessage(result);
}else{
TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery = new TeacherOpenCourseChatLogQuery();
teacherOpenCourseChatLogQuery.setTeacherOpenCourseChatLogId(teacherOpenCourseChatLogId);
teacherOpenCourseChatLogQuery.setStudentScore(studentScore);
String msg = teacherOpenCourseChatLogService.edit(teacherOpenCourseChatLogQuery);
if (StringUtils.isBlank(msg)) {
return JsonResult.success();
} else {
return JsonResult.failMessage("更新失败,"+msg);
}
}
}
@PostMapping(MODEL + "/edit.json")
@Function("teacherOpenCourseChatLog.edit")
public JsonResult<String> update(@Validated(ValidateConfig.UPDATE.class) @RequestBody TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery, BindingResult result) {

@ -5,6 +5,7 @@ import com.ibeetl.admin.core.annotation.Query;
import com.ibeetl.admin.core.web.query.PageParam;
import com.ibeetl.jlw.entity.TeacherOpenCourseChatLog;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
@ -14,22 +15,34 @@ import java.util.Date;
*/
public class TeacherOpenCourseChatLogQuery extends PageParam {
@NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
/**
*
*/
public static interface TEACHER_ADD {}
/**
*
*/
public static interface STUDENT_ADD {}
@NotNull(message = "ID不能为空", groups ={ValidateConfig.UPDATE.class})
@Query(name = "课程开课--讨论-日志ID", display = false)
private Long teacherOpenCourseChatLogId;
@NotNull(message = "上级ID不能为空", groups ={ STUDENT_ADD.class })
@Min(value = 1L, message = "学生互动上级ID最小支持1L", groups = { STUDENT_ADD.class })
@Query(name = "上级ID", display = false)
private Long teacherOpenCourseChatLogParentId;
@NotNull(message = "课程开课ID不能为空", groups =ValidateConfig.ADD.class)
@NotNull(message = "课程开课ID不能为空", groups ={ ValidateConfig.ADD.class, TEACHER_ADD.class, STUDENT_ADD.class })
@Query(name = "课程开课ID", display = true,type=Query.TYPE_DICT,dict="teacher_open_course.teacher_open_course_title.teacher_open_course_status=1")
private Long teacherOpenCourseId;
@Query(name = "班级ID集合", display = false)
private String schoolClassIds;
@NotNull(message = "教师ID不能为空", groups =ValidateConfig.ADD.class)
@NotNull(message = "教师ID不能为空", groups ={ ValidateConfig.ADD.class, TEACHER_ADD.class })
@Query(name = "教师ID", display = true,type=Query.TYPE_DICT,dict="teacher.teacher_name.teacher_status=1")
private Long teacherId;
@NotNull(message = "学生ID不能为空", groups ={ ValidateConfig.ADD.class, STUDENT_ADD.class })
@Query(name = "学生ID", display = true,type=Query.TYPE_DICT,dict="student.student_name.student_status=1")
private Long studentId;
@NotNull(message = "讨论内容不能为空", groups =ValidateConfig.ADD.class)
@NotNull(message = "讨论内容不能为空", groups ={ ValidateConfig.ADD.class, TEACHER_ADD.class, STUDENT_ADD.class })
@Query(name = "讨论内容", display = false)
private String chatContent;
@Query(name = "关键字(多个逗号隔开)", display = false)

Loading…
Cancel
Save