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;
import java.util.Map;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import org.beetl.sql.core.TailBean;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import java.util.Map;
/**
* :beetlsql TailBean
* @author : TLT
*/
@ExcelIgnoreUnannotated
public class BaseEntity extends TailBean implements java.io.Serializable {
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.TeacherOpenCourseChatLogAnalysis;
import com.ibeetl.jlw.entity.vo.TeacherOpenCourseChatLogGroupInfoVO;
import com.ibeetl.jlw.web.query.TeacherOpenCourseChatLogQuery;
import org.beetl.sql.core.engine.PageQuery;
import org.beetl.sql.mapper.BaseMapper;
@ -36,4 +37,11 @@ public interface TeacherOpenCourseChatLogDao extends BaseMapper<TeacherOpenCours
* @return
*/
TeacherOpenCourseChatLogAnalysis analysis(Long teacherOpenCourseId);
/**
*
* @param teacherOpenCourseId
* @return
*/
List<TeacherOpenCourseChatLogGroupInfoVO> groupInfo(Long teacherOpenCourseId);
}

@ -1,6 +1,5 @@
package com.ibeetl.jlw.entity;
import cn.hutool.core.date.DateTime;
import com.ibeetl.admin.core.annotation.Dict;
import com.ibeetl.admin.core.annotation.DictEnum;
import com.ibeetl.admin.core.entity.BaseEntity;
@ -16,6 +15,7 @@ import org.beetl.sql.fetch.annotation.FetchSql;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/*
@ -97,7 +97,7 @@ public class TeacherOpenCourseChatLog extends BaseEntity{
//创建时间
private DateTime teacherOpenCourseChatLogAddTime ;
private Date teacherOpenCourseChatLogAddTime ;
//组织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("随机抽取");
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.entity.TeacherOpenCourseChatLog;
import com.ibeetl.jlw.entity.TeacherOpenCourseChatLogAnalysis;
import com.ibeetl.jlw.entity.vo.TeacherOpenCourseChatLogGroupInfoVO;
import com.ibeetl.jlw.web.query.TeacherOpenCourseChatLogQuery;
import lombok.extern.slf4j.Slf4j;
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) {
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 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.write;
import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser;
@ -131,9 +129,6 @@ public class QuestionLogSummaryController extends BaseController {
@PostMapping(API + "/exportAnalysis.do")
public void exportAnalysisDo(Long teacherOpenCourseId, ResourcesQuestionSnapshotFromTypeEnum questionSettingType, @SCoreUser CoreUser coreUser) throws IOException {
/** 构建表头 */
Map<String, String> header = processExcelAnnotationToMap(QuestionLogSummaryAnalysisVO.class);
PageQuery<Object> objectPageQuery = new PageQuery<>();
objectPageQuery.setPageNumber(1L);
objectPageQuery.setPageSize(Integer.MAX_VALUE);
@ -141,10 +136,9 @@ public class QuestionLogSummaryController extends BaseController {
objectPageQuery.setPara("teacherOpenCourseId", teacherOpenCourseId);
PageQuery<QuestionLogSummaryAnalysisVO> page = questionLogSummaryService.analysisPageQuery(objectPageQuery);
List<Map<String, Object>> maps = baseEntity2MapWithParallel(page.getList());
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")
public void exportAnalysis(Long teacherOpenCourseId, ResourcesQuestionSnapshotFromTypeEnum questionSettingType, @SCoreUser CoreUser coreUser) throws IOException {
/** 构建表头 */
Map<String, String> header = processExcelAnnotationToMap(QuestionLogSummaryAnalysisVO.class);
// 不需要分页,直接查询出来所有的
PageQuery<Object> objectPageQuery = new PageQuery<>();
objectPageQuery.setPageNumber(1);
@ -551,10 +542,9 @@ public class QuestionLogSummaryController extends BaseController {
objectPageQuery.setPara("teacherOpenCourseId", teacherOpenCourseId);
PageQuery<QuestionLogSummaryAnalysisVO> page = questionLogSummaryService.analysisPageQuery(objectPageQuery);
List<Map<String, Object>> maps = baseEntity2MapWithParallel(page.getList());
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());
}
}

@ -20,6 +20,7 @@ import com.ibeetl.jlw.entity.Teacher;
import com.ibeetl.jlw.entity.TeacherOpenCourseChatLog;
import com.ibeetl.jlw.entity.dto.TeacherOpenCourseChatLogStudentDTO;
import com.ibeetl.jlw.entity.dto.TeacherOpenCourseChatLogTeacherDTO;
import com.ibeetl.jlw.entity.vo.TeacherOpenCourseChatLogGroupInfoVO;
import com.ibeetl.jlw.service.TeacherOpenCourseChatLogService;
import com.ibeetl.jlw.web.query.TeacherOpenCourseChatLogQuery;
import lombok.SneakyThrows;
@ -60,7 +61,8 @@ public class TeacherOpenCourseChatLogController extends BaseController {
@Autowired
private TeacherOpenCourseChatLogService teacherOpenCourseChatLogService;
@Autowired FileService fileService;
@Autowired
FileService fileService;
@Autowired
private CoreUserService coreUserService;
@ -146,6 +148,7 @@ public class TeacherOpenCourseChatLogController extends BaseController {
/**
*
*
* @param studentDTO
* @param result
* @param coreUser
@ -177,6 +180,7 @@ public class TeacherOpenCourseChatLogController extends BaseController {
/**
*
*
* @param teacherDTO
* @param result
* @param coreUser
@ -208,6 +212,7 @@ public class TeacherOpenCourseChatLogController extends BaseController {
/**
* -
*
* @param teacherOpenCourseChatLogId
* @param studentScore
* @param result
@ -289,6 +294,7 @@ public class TeacherOpenCourseChatLogController extends BaseController {
/**
* -
*
* @param condition
* @param coreUser
* @return
@ -342,6 +348,7 @@ public class TeacherOpenCourseChatLogController extends BaseController {
/**
* --
*
* @param teacherOpenCourseChatLogQuery
* @param type 1:
* @param result
@ -425,6 +432,7 @@ public class TeacherOpenCourseChatLogController extends BaseController {
/**
* --
*
* @param teacherOpenCourseId
* @return
*/
@ -436,7 +444,9 @@ public class TeacherOpenCourseChatLogController extends BaseController {
/**
* --
* @param teacherOpenCourseId
*
* @param condition
* @param coreUser
* @return
*/
@SneakyThrows
@ -460,7 +470,37 @@ public class TeacherOpenCourseChatLogController extends BaseController {
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));
}
/**
* --
*
* @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;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.jlw.validate.ValidateConfig;
import com.ibeetl.admin.core.annotation.Query;
@ -55,7 +54,6 @@ public class TeacherOpenCourseChatLogQuery extends PageParam {
@Query(name = "学生得分", display = false)
private BigDecimal studentScore;
@Query(name = "提问方式", display = false)
// 多个逗号隔开
private ChatLogSendTypeEnum chatLogSendType;
@Query(name = "附件上传(仅支持图片,多个逗号隔开)", display = false)
@ -183,7 +181,7 @@ public class TeacherOpenCourseChatLogQuery extends PageParam {
pojo.setStudentScore(this.getStudentScore());
pojo.setChatFiles(this.getChatFiles());
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.setOrgId(this.getOrgId());
pojo.setUserId(this.getUserId());

@ -557,6 +557,7 @@ getValuesByQueryNotWithPermission
analysis
===
* 互动类型分析
SELECT
t.chat_log_send_type,
count( 1 ) AS type_count,
@ -572,3 +573,17 @@ analysis
GROUP BY
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