beetlsql3-dev
Mlxa0324 2 years ago
parent 1c6fe06648
commit 8ffe9d542a

@ -0,0 +1,30 @@
package com.ibeetl.admin.core.convert;
import cn.hutool.core.util.ReflectUtil;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import static cn.hutool.core.util.ObjectUtil.defaultIfNull;
/**
* Enum and date converter
* desc
*
* @author mlx
*/
public class EnumDescConverter implements Converter<Enum> {
@Override
public Class<Enum> supportJavaTypeKey() {
return Enum.class;
}
@Override
public WriteCellData<?> convertToExcelData(Enum value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) throws Exception {
String text = defaultIfNull(ReflectUtil.getFieldValue(value, "desc"), "").toString();
WriteCellData<?> cellData = new WriteCellData<>(text);
return cellData;
}
}

@ -0,0 +1,30 @@
package com.ibeetl.admin.core.convert;
import cn.hutool.core.util.ReflectUtil;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import static cn.hutool.core.util.ObjectUtil.defaultIfNull;
/**
* Enum and date converter
* text
*
* @author mlx
*/
public class EnumTextConverter implements Converter<Enum> {
@Override
public Class<Enum> supportJavaTypeKey() {
return Enum.class;
}
@Override
public WriteCellData<?> convertToExcelData(Enum value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) throws Exception {
String text = defaultIfNull(ReflectUtil.getFieldValue(value, "text"), "").toString();
WriteCellData<?> cellData = new WriteCellData<>(text);
return cellData;
}
}

@ -1,17 +1,17 @@
package com.ibeetl.admin.core.entity; package com.ibeetl.admin.core.entity;
import java.util.Map; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import org.beetl.sql.core.TailBean; import org.beetl.sql.core.TailBean;
import com.fasterxml.jackson.annotation.JsonAnyGetter; import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnySetter;
/** /**
* :beetlsql TailBean * :beetlsql TailBean
* @author : TLT * @author : TLT
*/ */
@ExcelIgnoreUnannotated
public class BaseEntity extends TailBean implements java.io.Serializable { public class BaseEntity extends TailBean implements java.io.Serializable {
protected final static String ORACLE_CORE_SEQ_NAME="core_seq"; protected final static String ORACLE_CORE_SEQ_NAME="core_seq";

@ -2,6 +2,7 @@ package com.ibeetl.jlw.dao;
import com.ibeetl.jlw.entity.TeacherOpenCourseChatLog; import com.ibeetl.jlw.entity.TeacherOpenCourseChatLog;
import com.ibeetl.jlw.entity.TeacherOpenCourseChatLogAnalysis; import com.ibeetl.jlw.entity.TeacherOpenCourseChatLogAnalysis;
import com.ibeetl.jlw.entity.vo.TeacherOpenCourseChatLogGroupInfoVO;
import com.ibeetl.jlw.web.query.TeacherOpenCourseChatLogQuery; import com.ibeetl.jlw.web.query.TeacherOpenCourseChatLogQuery;
import org.beetl.sql.core.engine.PageQuery; import org.beetl.sql.core.engine.PageQuery;
import org.beetl.sql.mapper.BaseMapper; import org.beetl.sql.mapper.BaseMapper;
@ -36,4 +37,11 @@ public interface TeacherOpenCourseChatLogDao extends BaseMapper<TeacherOpenCours
* @return * @return
*/ */
TeacherOpenCourseChatLogAnalysis analysis(Long teacherOpenCourseId); TeacherOpenCourseChatLogAnalysis analysis(Long teacherOpenCourseId);
/**
*
* @param teacherOpenCourseId
* @return
*/
List<TeacherOpenCourseChatLogGroupInfoVO> groupInfo(Long teacherOpenCourseId);
} }

@ -1,6 +1,5 @@
package com.ibeetl.jlw.entity; package com.ibeetl.jlw.entity;
import cn.hutool.core.date.DateTime;
import com.ibeetl.admin.core.annotation.Dict; import com.ibeetl.admin.core.annotation.Dict;
import com.ibeetl.admin.core.annotation.DictEnum; import com.ibeetl.admin.core.annotation.DictEnum;
import com.ibeetl.admin.core.entity.BaseEntity; import com.ibeetl.admin.core.entity.BaseEntity;
@ -16,6 +15,7 @@ import org.beetl.sql.fetch.annotation.FetchSql;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
/* /*
@ -97,7 +97,7 @@ public class TeacherOpenCourseChatLog extends BaseEntity{
//创建时间 //创建时间
private DateTime teacherOpenCourseChatLogAddTime ; private Date teacherOpenCourseChatLogAddTime ;
//组织ID //组织ID

@ -0,0 +1,44 @@
package com.ibeetl.jlw.entity.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.ibeetl.admin.core.convert.EnumTextConverter;
import com.ibeetl.admin.core.entity.BaseEntity;
import com.ibeetl.jlw.enums.ChatLogSendTypeEnum;
import lombok.Data;
import java.math.BigDecimal;
/**
* : <br>
*
* @author: mlx
* @description:
* @date: 2022/12/12 23:10
* @version: 1.0
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class TeacherOpenCourseChatLogGroupInfoVO extends BaseEntity {
/**
*
*/
@ExcelProperty(value = "提问方式", converter = EnumTextConverter.class)
private ChatLogSendTypeEnum chatLogSendType;
/**
*
*/
@ExcelProperty(value = "次数")
private Integer chatCount;
/**
*
*/
@ExcelProperty(value = "参与人数")
private Integer joinCount;
/**
*
*/
@ExcelProperty(value = "平均得分")
private BigDecimal avgScore;
}

@ -15,4 +15,13 @@ public enum ChatLogSendTypeEnum {
random_ask("随机抽取"); random_ask("随机抽取");
private String text; private String text;
/**
* easyExcel
* @return
*/
@Override
public String toString() {
return this.getText();
}
} }

@ -14,6 +14,7 @@ import com.ibeetl.admin.core.web.JsonReturnCode;
import com.ibeetl.jlw.dao.TeacherOpenCourseChatLogDao; import com.ibeetl.jlw.dao.TeacherOpenCourseChatLogDao;
import com.ibeetl.jlw.entity.TeacherOpenCourseChatLog; import com.ibeetl.jlw.entity.TeacherOpenCourseChatLog;
import com.ibeetl.jlw.entity.TeacherOpenCourseChatLogAnalysis; import com.ibeetl.jlw.entity.TeacherOpenCourseChatLogAnalysis;
import com.ibeetl.jlw.entity.vo.TeacherOpenCourseChatLogGroupInfoVO;
import com.ibeetl.jlw.web.query.TeacherOpenCourseChatLogQuery; import com.ibeetl.jlw.web.query.TeacherOpenCourseChatLogQuery;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -191,11 +192,28 @@ public class TeacherOpenCourseChatLogService extends CoreBaseService<TeacherOpen
} }
/** /**
* : <br>
* - * -
* @param teacherOpenCourseId *
* @return * @param teacherOpenCourseId ID
* @return {@link TeacherOpenCourseChatLogAnalysis}
* @Author: lx
* @Date: 2022/12/12 23:14
*/ */
public TeacherOpenCourseChatLogAnalysis analysis(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId) { public TeacherOpenCourseChatLogAnalysis analysis(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId) {
return teacherOpenCourseChatLogDao.analysis(teacherOpenCourseId); return teacherOpenCourseChatLogDao.analysis(teacherOpenCourseId);
} }
/**
* : <br>
*
*
* @param teacherOpenCourseId ID
* @return {@link List< TeacherOpenCourseChatLogGroupInfoVO>}
* @Author: lx
* @Date: 2022/12/12 23:14
*/
public List<TeacherOpenCourseChatLogGroupInfoVO> groupInfo(@NotNull(message = "开课ID不能为空") Long teacherOpenCourseId) {
return teacherOpenCourseChatLogDao.groupInfo(teacherOpenCourseId);
}
} }

@ -48,8 +48,6 @@ import java.io.InputStream;
import java.util.*; import java.util.*;
import static cn.jlw.util.PageUtil.ofDefault; import static cn.jlw.util.PageUtil.ofDefault;
import static com.ibeetl.admin.core.util.BeanCopyUtil.baseEntity2MapWithParallel;
import static com.ibeetl.admin.core.util.BeanUtil.processExcelAnnotationToMap;
import static com.ibeetl.admin.core.util.ExcelUtil.convertData; import static com.ibeetl.admin.core.util.ExcelUtil.convertData;
import static com.ibeetl.admin.core.util.ExcelUtil.write; import static com.ibeetl.admin.core.util.ExcelUtil.write;
import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser; import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser;
@ -131,9 +129,6 @@ public class QuestionLogSummaryController extends BaseController {
@PostMapping(API + "/exportAnalysis.do") @PostMapping(API + "/exportAnalysis.do")
public void exportAnalysisDo(Long teacherOpenCourseId, ResourcesQuestionSnapshotFromTypeEnum questionSettingType, @SCoreUser CoreUser coreUser) throws IOException { public void exportAnalysisDo(Long teacherOpenCourseId, ResourcesQuestionSnapshotFromTypeEnum questionSettingType, @SCoreUser CoreUser coreUser) throws IOException {
/** 构建表头 */
Map<String, String> header = processExcelAnnotationToMap(QuestionLogSummaryAnalysisVO.class);
PageQuery<Object> objectPageQuery = new PageQuery<>(); PageQuery<Object> objectPageQuery = new PageQuery<>();
objectPageQuery.setPageNumber(1L); objectPageQuery.setPageNumber(1L);
objectPageQuery.setPageSize(Integer.MAX_VALUE); objectPageQuery.setPageSize(Integer.MAX_VALUE);
@ -141,10 +136,9 @@ public class QuestionLogSummaryController extends BaseController {
objectPageQuery.setPara("teacherOpenCourseId", teacherOpenCourseId); objectPageQuery.setPara("teacherOpenCourseId", teacherOpenCourseId);
PageQuery<QuestionLogSummaryAnalysisVO> page = questionLogSummaryService.analysisPageQuery(objectPageQuery); PageQuery<QuestionLogSummaryAnalysisVO> page = questionLogSummaryService.analysisPageQuery(objectPageQuery);
List<Map<String, Object>> maps = baseEntity2MapWithParallel(page.getList());
String filename = StrUtil.format("题目统计分析导出 {}.xlsx", DateUtil.now()); String filename = StrUtil.format("题目统计分析导出{}.xlsx", DateUtil.now());
write(response, filename,"Sheet1", header.values(), convertData(header.keySet(), maps)); write(response, filename,"Sheet1", QuestionLogSummaryAnalysisVO.class, page.getList());
} }
/** /**
@ -540,9 +534,6 @@ public class QuestionLogSummaryController extends BaseController {
@PostMapping(MODEL + "/exportAnalysis.json") @PostMapping(MODEL + "/exportAnalysis.json")
public void exportAnalysis(Long teacherOpenCourseId, ResourcesQuestionSnapshotFromTypeEnum questionSettingType, @SCoreUser CoreUser coreUser) throws IOException { public void exportAnalysis(Long teacherOpenCourseId, ResourcesQuestionSnapshotFromTypeEnum questionSettingType, @SCoreUser CoreUser coreUser) throws IOException {
/** 构建表头 */
Map<String, String> header = processExcelAnnotationToMap(QuestionLogSummaryAnalysisVO.class);
// 不需要分页,直接查询出来所有的 // 不需要分页,直接查询出来所有的
PageQuery<Object> objectPageQuery = new PageQuery<>(); PageQuery<Object> objectPageQuery = new PageQuery<>();
objectPageQuery.setPageNumber(1); objectPageQuery.setPageNumber(1);
@ -551,10 +542,9 @@ public class QuestionLogSummaryController extends BaseController {
objectPageQuery.setPara("teacherOpenCourseId", teacherOpenCourseId); objectPageQuery.setPara("teacherOpenCourseId", teacherOpenCourseId);
PageQuery<QuestionLogSummaryAnalysisVO> page = questionLogSummaryService.analysisPageQuery(objectPageQuery); PageQuery<QuestionLogSummaryAnalysisVO> page = questionLogSummaryService.analysisPageQuery(objectPageQuery);
List<Map<String, Object>> maps = baseEntity2MapWithParallel(page.getList());
String filename = StrUtil.format("题目统计分析导出 {}.xlsx", DateUtil.now()); String filename = StrUtil.format("题目统计分析导出{}.xlsx", DateUtil.now());
write(response, filename,"Sheet1", header.values(), convertData(header.keySet(), maps)); write(response, filename,"Sheet1", QuestionLogSummaryAnalysisVO.class, page.getList());
} }
} }

@ -179,7 +179,7 @@ public class ResourcesQuestionSnapshotController extends BaseController {
List<Map<String, Object>> maps = baseEntity2MapWithParallel(data.getList()); List<Map<String, Object>> maps = baseEntity2MapWithParallel(data.getList());
String filename = StrUtil.format("考试成绩导出 {}.xlsx", DateUtil.now()); String filename = StrUtil.format("考试成绩导出{}.xlsx", DateUtil.now());
write(response, filename,"Sheet1", header.values(), convertData(header.keySet(), maps)); write(response, filename,"Sheet1", header.values(), convertData(header.keySet(), maps));
} }

@ -20,6 +20,7 @@ import com.ibeetl.jlw.entity.Teacher;
import com.ibeetl.jlw.entity.TeacherOpenCourseChatLog; import com.ibeetl.jlw.entity.TeacherOpenCourseChatLog;
import com.ibeetl.jlw.entity.dto.TeacherOpenCourseChatLogStudentDTO; import com.ibeetl.jlw.entity.dto.TeacherOpenCourseChatLogStudentDTO;
import com.ibeetl.jlw.entity.dto.TeacherOpenCourseChatLogTeacherDTO; import com.ibeetl.jlw.entity.dto.TeacherOpenCourseChatLogTeacherDTO;
import com.ibeetl.jlw.entity.vo.TeacherOpenCourseChatLogGroupInfoVO;
import com.ibeetl.jlw.service.TeacherOpenCourseChatLogService; import com.ibeetl.jlw.service.TeacherOpenCourseChatLogService;
import com.ibeetl.jlw.web.query.TeacherOpenCourseChatLogQuery; import com.ibeetl.jlw.web.query.TeacherOpenCourseChatLogQuery;
import lombok.SneakyThrows; import lombok.SneakyThrows;
@ -60,17 +61,18 @@ public class TeacherOpenCourseChatLogController extends BaseController {
@Autowired @Autowired
private TeacherOpenCourseChatLogService teacherOpenCourseChatLogService; private TeacherOpenCourseChatLogService teacherOpenCourseChatLogService;
@Autowired FileService fileService; @Autowired
FileService fileService;
@Autowired @Autowired
private CoreUserService coreUserService; private CoreUserService coreUserService;
/* 前端接口 */ /* 前端接口 */
@PostMapping(API + "/getPageList.do") @PostMapping(API + "/getPageList.do")
public JsonResult<PageQuery> getPageList(TeacherOpenCourseChatLogQuery condition,@SCoreUser CoreUser coreUser){ public JsonResult<PageQuery> getPageList(TeacherOpenCourseChatLogQuery condition, @SCoreUser CoreUser coreUser) {
if(null == coreUser){ if (null == coreUser) {
return JsonResult.failMessage("请登录后再操作"); return JsonResult.failMessage("请登录后再操作");
}else{ } else {
PageQuery page = condition.getPageQuery(); PageQuery page = condition.getPageQuery();
teacherOpenCourseChatLogService.queryByConditionQuery(page); teacherOpenCourseChatLogService.queryByConditionQuery(page);
return JsonResult.success(page); return JsonResult.success(page);
@ -85,14 +87,14 @@ public class TeacherOpenCourseChatLogController extends BaseController {
* @return * @return
*/ */
@PostMapping(API + "/getKeywordsList.do") @PostMapping(API + "/getKeywordsList.do")
public JsonResult<PageQuery> getKeywordsList(TeacherOpenCourseChatLogQuery condition,@SCoreUser CoreUser coreUser){ public JsonResult<PageQuery> getKeywordsList(TeacherOpenCourseChatLogQuery condition, @SCoreUser CoreUser coreUser) {
if(null == coreUser){ if (null == coreUser) {
return JsonResult.failMessage("请登录后再操作"); return JsonResult.failMessage("请登录后再操作");
}else{ } else {
PageQuery page = condition.getPageQuery(); PageQuery page = condition.getPageQuery();
teacherOpenCourseChatLogService.queryByConditionQuery(page); teacherOpenCourseChatLogService.queryByConditionQuery(page);
// 只获取关键字列表 // 只获取关键字列表
if(ObjectUtil.isNotEmpty(page.getList())) { if (ObjectUtil.isNotEmpty(page.getList())) {
List<String> resList = ((List<TeacherOpenCourseChatLog>) page.getList()).stream() List<String> resList = ((List<TeacherOpenCourseChatLog>) page.getList()).stream()
.map(TeacherOpenCourseChatLog::getKeywords).distinct().collect(Collectors.toList()); .map(TeacherOpenCourseChatLog::getKeywords).distinct().collect(Collectors.toList());
page.setList(resList); page.setList(resList);
@ -103,23 +105,23 @@ public class TeacherOpenCourseChatLogController extends BaseController {
@GetMapping(API + "/getInfo.do") @GetMapping(API + "/getInfo.do")
public JsonResult<TeacherOpenCourseChatLog>getInfo(TeacherOpenCourseChatLogQuery param,@SCoreUser CoreUser coreUser) { public JsonResult<TeacherOpenCourseChatLog> getInfo(TeacherOpenCourseChatLogQuery param, @SCoreUser CoreUser coreUser) {
if(null == coreUser){ if (null == coreUser) {
return JsonResult.failMessage("请登录后再操作"); return JsonResult.failMessage("请登录后再操作");
}else{ } else {
TeacherOpenCourseChatLog teacherOpenCourseChatLog = teacherOpenCourseChatLogService.getInfo(param); TeacherOpenCourseChatLog teacherOpenCourseChatLog = teacherOpenCourseChatLogService.getInfo(param);
return JsonResult.success(teacherOpenCourseChatLog); return JsonResult.success(teacherOpenCourseChatLog);
} }
} }
@GetMapping(API + "/getList.do") @GetMapping(API + "/getList.do")
public JsonResult<List<TeacherOpenCourseChatLog>>getList(TeacherOpenCourseChatLogQuery param,@SCoreUser CoreUser coreUser) { public JsonResult<List<TeacherOpenCourseChatLog>> getList(TeacherOpenCourseChatLogQuery param, @SCoreUser CoreUser coreUser) {
if(null == coreUser){ if (null == coreUser) {
return JsonResult.failMessage("请登录后再操作"); return JsonResult.failMessage("请登录后再操作");
}else{ } else {
List<TeacherOpenCourseChatLog>list = teacherOpenCourseChatLogService.getValuesByQuery(param); List<TeacherOpenCourseChatLog> list = teacherOpenCourseChatLogService.getValuesByQuery(param);
return JsonResult.success(list); return JsonResult.success(list);
} }
} }
@ -127,11 +129,11 @@ public class TeacherOpenCourseChatLogController extends BaseController {
public JsonResult addDo( public JsonResult addDo(
@Validated(ValidateConfig.ADD.class) @Validated(ValidateConfig.ADD.class)
@RequestBody TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery, @RequestBody TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery,
BindingResult result, @SCoreUser CoreUser coreUser, @TTeacher Teacher teacher, @TStudent Student student){ BindingResult result, @SCoreUser CoreUser coreUser, @TTeacher Teacher teacher, @TStudent Student student) {
if(result.hasErrors()){ if (result.hasErrors()) {
return JsonResult.failMessage(result); return JsonResult.failMessage(result);
}else{ } else {
teacherOpenCourseChatLogQuery.setUserId(coreUser.getId()); teacherOpenCourseChatLogQuery.setUserId(coreUser.getId());
teacherOpenCourseChatLogQuery.setOrgId(coreUser.getOrgId()); teacherOpenCourseChatLogQuery.setOrgId(coreUser.getOrgId());
if (ObjectUtil.isNotEmpty(teacher)) { if (ObjectUtil.isNotEmpty(teacher)) {
@ -146,6 +148,7 @@ public class TeacherOpenCourseChatLogController extends BaseController {
/** /**
* *
*
* @param studentDTO * @param studentDTO
* @param result * @param result
* @param coreUser * @param coreUser
@ -156,11 +159,11 @@ public class TeacherOpenCourseChatLogController extends BaseController {
public JsonResult studentSend( public JsonResult studentSend(
@Validated @Validated
@RequestBody TeacherOpenCourseChatLogStudentDTO studentDTO, @RequestBody TeacherOpenCourseChatLogStudentDTO studentDTO,
BindingResult result, @SCoreUser CoreUser coreUser, @TStudent Student student){ BindingResult result, @SCoreUser CoreUser coreUser, @TStudent Student student) {
if(result.hasErrors()){ if (result.hasErrors()) {
return JsonResult.failMessage(result); return JsonResult.failMessage(result);
}else{ } else {
Assert.notNull(student, "该接口仅限学生使用"); Assert.notNull(student, "该接口仅限学生使用");
TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery = new TeacherOpenCourseChatLogQuery(); TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery = new TeacherOpenCourseChatLogQuery();
@ -177,6 +180,7 @@ public class TeacherOpenCourseChatLogController extends BaseController {
/** /**
* *
*
* @param teacherDTO * @param teacherDTO
* @param result * @param result
* @param coreUser * @param coreUser
@ -187,11 +191,11 @@ public class TeacherOpenCourseChatLogController extends BaseController {
public JsonResult teacherSend( public JsonResult teacherSend(
@Validated @Validated
@RequestBody TeacherOpenCourseChatLogTeacherDTO teacherDTO, @RequestBody TeacherOpenCourseChatLogTeacherDTO teacherDTO,
BindingResult result, @SCoreUser CoreUser coreUser, @TTeacher Teacher teacher){ BindingResult result, @SCoreUser CoreUser coreUser, @TTeacher Teacher teacher) {
if(result.hasErrors()){ if (result.hasErrors()) {
return JsonResult.failMessage(result); return JsonResult.failMessage(result);
}else{ } else {
Assert.notNull(teacher, "该接口仅限教师使用"); Assert.notNull(teacher, "该接口仅限教师使用");
TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery = new TeacherOpenCourseChatLogQuery(); TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery = new TeacherOpenCourseChatLogQuery();
@ -208,6 +212,7 @@ public class TeacherOpenCourseChatLogController extends BaseController {
/** /**
* - * -
*
* @param teacherOpenCourseChatLogId * @param teacherOpenCourseChatLogId
* @param studentScore * @param studentScore
* @param result * @param result
@ -218,11 +223,11 @@ public class TeacherOpenCourseChatLogController extends BaseController {
@NotNull(message = "互动ID不能为空") @NotNull(message = "互动ID不能为空")
Long teacherOpenCourseChatLogId, Long teacherOpenCourseChatLogId,
@NotNull(message = "学生分数不能为空!") @NotNull(message = "学生分数不能为空!")
BigDecimal studentScore, BindingResult result){ BigDecimal studentScore, BindingResult result) {
if(result.hasErrors()){ if (result.hasErrors()) {
return JsonResult.failMessage(result); return JsonResult.failMessage(result);
}else{ } else {
TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery = new TeacherOpenCourseChatLogQuery(); TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery = new TeacherOpenCourseChatLogQuery();
teacherOpenCourseChatLogQuery.setTeacherOpenCourseChatLogId(teacherOpenCourseChatLogId); teacherOpenCourseChatLogQuery.setTeacherOpenCourseChatLogId(teacherOpenCourseChatLogId);
teacherOpenCourseChatLogQuery.setStudentScore(studentScore); teacherOpenCourseChatLogQuery.setStudentScore(studentScore);
@ -230,7 +235,7 @@ public class TeacherOpenCourseChatLogController extends BaseController {
if (StringUtils.isBlank(msg)) { if (StringUtils.isBlank(msg)) {
return JsonResult.success(); return JsonResult.success();
} else { } else {
return JsonResult.failMessage("更新失败,"+msg); return JsonResult.failMessage("更新失败," + msg);
} }
} }
} }
@ -250,7 +255,7 @@ public class TeacherOpenCourseChatLogController extends BaseController {
@GetMapping(MODEL + "/index.do") @GetMapping(MODEL + "/index.do")
@Function("teacherOpenCourseChatLog.query") @Function("teacherOpenCourseChatLog.query")
public ModelAndView index() { public ModelAndView index() {
ModelAndView view = new ModelAndView("/jlw/teacherOpenCourseChatLog/index.html") ; ModelAndView view = new ModelAndView("/jlw/teacherOpenCourseChatLog/index.html");
view.addObject("search", TeacherOpenCourseChatLogQuery.class.getName()); view.addObject("search", TeacherOpenCourseChatLogQuery.class.getName());
return view; return view;
} }
@ -268,10 +273,10 @@ public class TeacherOpenCourseChatLogController extends BaseController {
@Function("teacherOpenCourseChatLog.add") @Function("teacherOpenCourseChatLog.add")
public ModelAndView add(Long teacherOpenCourseChatLogId) { public ModelAndView add(Long teacherOpenCourseChatLogId) {
ModelAndView view = new ModelAndView("/jlw/teacherOpenCourseChatLog/add.html"); ModelAndView view = new ModelAndView("/jlw/teacherOpenCourseChatLog/add.html");
if(null != teacherOpenCourseChatLogId){ if (null != teacherOpenCourseChatLogId) {
TeacherOpenCourseChatLog teacherOpenCourseChatLog = teacherOpenCourseChatLogService.queryById(teacherOpenCourseChatLogId); TeacherOpenCourseChatLog teacherOpenCourseChatLog = teacherOpenCourseChatLogService.queryById(teacherOpenCourseChatLogId);
view.addObject("teacherOpenCourseChatLog", teacherOpenCourseChatLog); view.addObject("teacherOpenCourseChatLog", teacherOpenCourseChatLog);
}else { } else {
view.addObject("teacherOpenCourseChatLog", new TeacherOpenCourseChatLog()); view.addObject("teacherOpenCourseChatLog", new TeacherOpenCourseChatLog());
} }
return view; return view;
@ -289,6 +294,7 @@ public class TeacherOpenCourseChatLogController extends BaseController {
/** /**
* - * -
*
* @param condition * @param condition
* @param coreUser * @param coreUser
* @return * @return
@ -304,17 +310,17 @@ public class TeacherOpenCourseChatLogController extends BaseController {
@PostMapping(MODEL + "/addAll.json") @PostMapping(MODEL + "/addAll.json")
@Function("teacherOpenCourseChatLog.add") @Function("teacherOpenCourseChatLog.add")
public JsonResult addAll(TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery,@SCoreUser CoreUser coreUser){ public JsonResult addAll(TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery, @SCoreUser CoreUser coreUser) {
if(null == coreUser){ if (null == coreUser) {
return JsonResult.failMessage("请登录后再操作"); return JsonResult.failMessage("请登录后再操作");
}else{ } else {
teacherOpenCourseChatLogQuery.setUserId(coreUser.getId()); teacherOpenCourseChatLogQuery.setUserId(coreUser.getId());
teacherOpenCourseChatLogQuery.setOrgId(coreUser.getOrgId()); teacherOpenCourseChatLogQuery.setOrgId(coreUser.getOrgId());
String msg = teacherOpenCourseChatLogService.addAll(teacherOpenCourseChatLogQuery); String msg = teacherOpenCourseChatLogService.addAll(teacherOpenCourseChatLogQuery);
if (StringUtils.isBlank(msg)) { if (StringUtils.isBlank(msg)) {
return JsonResult.success(); return JsonResult.success();
} else { } else {
return JsonResult.failMessage("新增失败,"+msg); return JsonResult.failMessage("新增失败," + msg);
} }
} }
} }
@ -323,11 +329,11 @@ public class TeacherOpenCourseChatLogController extends BaseController {
@Function("teacherOpenCourseChatLog.add") @Function("teacherOpenCourseChatLog.add")
public JsonResult add( public JsonResult add(
@Validated(ValidateConfig.ADD.class) @RequestBody TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery, @Validated(ValidateConfig.ADD.class) @RequestBody TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery,
BindingResult result,@SCoreUser CoreUser coreUser, @TTeacher Teacher teacher, @TStudent Student student){ BindingResult result, @SCoreUser CoreUser coreUser, @TTeacher Teacher teacher, @TStudent Student student) {
if(result.hasErrors()){ if (result.hasErrors()) {
return JsonResult.failMessage(result); return JsonResult.failMessage(result);
}else{ } else {
teacherOpenCourseChatLogQuery.setUserId(coreUser.getId()); teacherOpenCourseChatLogQuery.setUserId(coreUser.getId());
teacherOpenCourseChatLogQuery.setOrgId(coreUser.getOrgId()); teacherOpenCourseChatLogQuery.setOrgId(coreUser.getOrgId());
if (ObjectUtil.isNotEmpty(teacher)) { if (ObjectUtil.isNotEmpty(teacher)) {
@ -342,8 +348,9 @@ public class TeacherOpenCourseChatLogController extends BaseController {
/** /**
* -- * --
*
* @param teacherOpenCourseChatLogQuery * @param teacherOpenCourseChatLogQuery
* @param type 1: * @param type 1:
* @param result * @param result
* @param coreUser * @param coreUser
* @return * @return
@ -352,14 +359,14 @@ public class TeacherOpenCourseChatLogController extends BaseController {
public JsonResult addByType( public JsonResult addByType(
@RequestBody TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery, @RequestBody TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery,
Integer type, Integer type,
BindingResult result, @SCoreUser CoreUser coreUser, @TTeacher Teacher teacher, @TStudent Student student){ BindingResult result, @SCoreUser CoreUser coreUser, @TTeacher Teacher teacher, @TStudent Student student) {
if(result.hasErrors()){ if (result.hasErrors()) {
return JsonResult.failMessage(result); return JsonResult.failMessage(result);
}else{ } else {
teacherOpenCourseChatLogQuery.setUserId(coreUser.getId()); teacherOpenCourseChatLogQuery.setUserId(coreUser.getId());
teacherOpenCourseChatLogQuery.setOrgId(coreUser.getOrgId()); teacherOpenCourseChatLogQuery.setOrgId(coreUser.getOrgId());
if(null == teacherOpenCourseChatLogQuery.getTeacherOpenCourseChatLogStatus()){ if (null == teacherOpenCourseChatLogQuery.getTeacherOpenCourseChatLogStatus()) {
teacherOpenCourseChatLogQuery.setTeacherOpenCourseChatLogStatus(1); teacherOpenCourseChatLogQuery.setTeacherOpenCourseChatLogStatus(1);
} }
if (ObjectUtil.isNotEmpty(teacher)) { if (ObjectUtil.isNotEmpty(teacher)) {
@ -375,16 +382,16 @@ public class TeacherOpenCourseChatLogController extends BaseController {
@PostMapping(MODEL + "/edit.json") @PostMapping(MODEL + "/edit.json")
@Function("teacherOpenCourseChatLog.edit") @Function("teacherOpenCourseChatLog.edit")
public JsonResult<String> update(@Validated(ValidateConfig.UPDATE.class) @RequestBody TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery, BindingResult result) { public JsonResult<String> update(@Validated(ValidateConfig.UPDATE.class) @RequestBody TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery, BindingResult result) {
if(result.hasErrors()){ if (result.hasErrors()) {
return JsonResult.failMessage(result); return JsonResult.failMessage(result);
}else { } else {
teacherOpenCourseChatLogQuery.setUserId(null); teacherOpenCourseChatLogQuery.setUserId(null);
teacherOpenCourseChatLogQuery.setOrgId(null); teacherOpenCourseChatLogQuery.setOrgId(null);
String msg = teacherOpenCourseChatLogService.edit(teacherOpenCourseChatLogQuery); String msg = teacherOpenCourseChatLogService.edit(teacherOpenCourseChatLogQuery);
if (StringUtils.isBlank(msg)) { if (StringUtils.isBlank(msg)) {
return JsonResult.success(); return JsonResult.success();
} else { } else {
return JsonResult.failMessage("更新失败,"+msg); return JsonResult.failMessage("更新失败," + msg);
} }
} }
} }
@ -392,16 +399,16 @@ public class TeacherOpenCourseChatLogController extends BaseController {
@GetMapping(MODEL + "/view.json") @GetMapping(MODEL + "/view.json")
@Function("teacherOpenCourseChatLog.query") @Function("teacherOpenCourseChatLog.query")
public JsonResult<TeacherOpenCourseChatLog>queryInfo(Long teacherOpenCourseChatLogId) { public JsonResult<TeacherOpenCourseChatLog> queryInfo(Long teacherOpenCourseChatLogId) {
TeacherOpenCourseChatLog teacherOpenCourseChatLog = teacherOpenCourseChatLogService.queryById( teacherOpenCourseChatLogId); TeacherOpenCourseChatLog teacherOpenCourseChatLog = teacherOpenCourseChatLogService.queryById(teacherOpenCourseChatLogId);
return JsonResult.success(teacherOpenCourseChatLog); return JsonResult.success(teacherOpenCourseChatLog);
} }
@GetMapping(MODEL + "/getValues.json") @GetMapping(MODEL + "/getValues.json")
@Function("teacherOpenCourseChatLog.query") @Function("teacherOpenCourseChatLog.query")
public JsonResult<List<TeacherOpenCourseChatLog>>getValues(TeacherOpenCourseChatLogQuery param) { public JsonResult<List<TeacherOpenCourseChatLog>> getValues(TeacherOpenCourseChatLogQuery param) {
List<TeacherOpenCourseChatLog>list = teacherOpenCourseChatLogService.getValuesByQuery(param); List<TeacherOpenCourseChatLog> list = teacherOpenCourseChatLogService.getValuesByQuery(param);
return JsonResult.success(list); return JsonResult.success(list);
} }
@ -425,6 +432,7 @@ public class TeacherOpenCourseChatLogController extends BaseController {
/** /**
* -- * --
*
* @param teacherOpenCourseId * @param teacherOpenCourseId
* @return * @return
*/ */
@ -436,13 +444,15 @@ public class TeacherOpenCourseChatLogController extends BaseController {
/** /**
* -- * --
* @param teacherOpenCourseId *
* @param condition
* @param coreUser
* @return * @return
*/ */
@SneakyThrows @SneakyThrows
@PostMapping(MODEL + "/export.json") @PostMapping(MODEL + "/export.json")
public void export(TeacherOpenCourseChatLogQuery condition,@SCoreUser CoreUser coreUser) { public void export(TeacherOpenCourseChatLogQuery condition, @SCoreUser CoreUser coreUser) {
/** 构建表头 */ /** 构建表头 */
Map<String, String> header = new LinkedHashMap<>(11); Map<String, String> header = new LinkedHashMap<>(11);
header.put("teacherOpenCourseChatLogAddTime", "提问时间"); header.put("teacherOpenCourseChatLogAddTime", "提问时间");
@ -460,7 +470,37 @@ public class TeacherOpenCourseChatLogController extends BaseController {
List<Map<String, Object>> maps = BeanCopyUtil.baseEntity2MapWithParallel(data.getList()); List<Map<String, Object>> maps = BeanCopyUtil.baseEntity2MapWithParallel(data.getList());
String filename = StrUtil.format("讨论列表导出-{}.xlsx", DateUtil.now()); String filename = StrUtil.format("讨论列表导出{}.xlsx", DateUtil.now());
write(response, filename,"Sheet1", header.values(), convertData(header.keySet(), maps)); write(response, filename, "Sheet1", header.values(), convertData(header.keySet(), maps));
}
/**
* --
*
* @param teacherOpenCourseId
* @param coreUser
* @return
*/
@SneakyThrows
@PostMapping(MODEL + "/groupInfo.json")
public JsonResult groupInfo(Long teacherOpenCourseId, @SCoreUser CoreUser coreUser) {
return JsonResult.success(teacherOpenCourseChatLogService.groupInfo(teacherOpenCourseId));
}
/**
* --
*
* @param teacherOpenCourseId
* @param coreUser
* @return
*/
@SneakyThrows
@PostMapping(MODEL + "/groupInfoExport.json")
public void groupInfoExport(Long teacherOpenCourseId, @SCoreUser CoreUser coreUser) {
List<TeacherOpenCourseChatLogGroupInfoVO> list = teacherOpenCourseChatLogService.groupInfo(teacherOpenCourseId);
String filename = StrUtil.format("讨论分组-汇总数据导出{}.xlsx", DateUtil.now());
write(response, filename,"Sheet1", TeacherOpenCourseChatLogGroupInfoVO.class, list);
} }
} }

@ -1,6 +1,5 @@
package com.ibeetl.jlw.web.query; package com.ibeetl.jlw.web.query;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.jlw.validate.ValidateConfig; import cn.jlw.validate.ValidateConfig;
import com.ibeetl.admin.core.annotation.Query; import com.ibeetl.admin.core.annotation.Query;
@ -55,7 +54,6 @@ public class TeacherOpenCourseChatLogQuery extends PageParam {
@Query(name = "学生得分", display = false) @Query(name = "学生得分", display = false)
private BigDecimal studentScore; private BigDecimal studentScore;
@Query(name = "提问方式", display = false) @Query(name = "提问方式", display = false)
// 多个逗号隔开
private ChatLogSendTypeEnum chatLogSendType; private ChatLogSendTypeEnum chatLogSendType;
@Query(name = "附件上传(仅支持图片,多个逗号隔开)", display = false) @Query(name = "附件上传(仅支持图片,多个逗号隔开)", display = false)
@ -183,7 +181,7 @@ public class TeacherOpenCourseChatLogQuery extends PageParam {
pojo.setStudentScore(this.getStudentScore()); pojo.setStudentScore(this.getStudentScore());
pojo.setChatFiles(this.getChatFiles()); pojo.setChatFiles(this.getChatFiles());
pojo.setTeacherOpenCourseChatLogStatus(ObjectUtil.defaultIfNull(this.getTeacherOpenCourseChatLogStatus(), 1)); pojo.setTeacherOpenCourseChatLogStatus(ObjectUtil.defaultIfNull(this.getTeacherOpenCourseChatLogStatus(), 1));
pojo.setTeacherOpenCourseChatLogAddTime(DateUtil.date(ObjectUtil.defaultIfNull(this.getTeacherOpenCourseChatLogAddTime(), new Date()))); pojo.setTeacherOpenCourseChatLogAddTime(ObjectUtil.defaultIfNull(this.getTeacherOpenCourseChatLogAddTime(), new Date()));
pojo.setChatLogSendType(ObjectUtil.defaultIfNull(this.getChatLogSendType(), normal)); pojo.setChatLogSendType(ObjectUtil.defaultIfNull(this.getChatLogSendType(), normal));
pojo.setOrgId(this.getOrgId()); pojo.setOrgId(this.getOrgId());
pojo.setUserId(this.getUserId()); pojo.setUserId(this.getUserId());

@ -557,6 +557,7 @@ getValuesByQueryNotWithPermission
analysis analysis
=== ===
* 互动类型分析 * 互动类型分析
SELECT SELECT
t.chat_log_send_type, t.chat_log_send_type,
count( 1 ) AS type_count, count( 1 ) AS type_count,
@ -571,4 +572,18 @@ analysis
and t.teacher_open_course_id = #teacherOpenCourseId# and t.teacher_open_course_id = #teacherOpenCourseId#
GROUP BY GROUP BY
t.chat_log_send_type t.chat_log_send_type
groupInfo
===
* 评论添加的类型,分组汇总
select
t.chat_log_send_type,
count(t.student_id is not null) as chat_count,
count(distinct(t.student_id)) as join_count,
round(avg(IFNULL(t.student_score, 0)), 1) as avg_score
from
teacher_open_course_chat_log t
where 1 = 1
and t.chat_log_send_type is not null
and t.teacher_open_course_id = #teacherOpenCourseId#
group by t.chat_log_send_type

Loading…
Cancel
Save