diff --git a/admin-console/src/main/java/com/ibeetl/admin/console/service/FunctionConsoleService.java b/admin-console/src/main/java/com/ibeetl/admin/console/service/FunctionConsoleService.java index 07f5abcf..7184df1d 100644 --- a/admin-console/src/main/java/com/ibeetl/admin/console/service/FunctionConsoleService.java +++ b/admin-console/src/main/java/com/ibeetl/admin/console/service/FunctionConsoleService.java @@ -124,7 +124,7 @@ public class FunctionConsoleService extends CoreBaseService { * @param userId * @return */ - @Cacheable(value=USER_FUNCTION_TREE_CACHE, key="userId") + @Cacheable(value=USER_FUNCTION_TREE_CACHE, key="#userId", unless = "#result == null || #result.size() == 0", cacheManager = "cacheManager1Day") public String getFunctionIdByUser(Long userId){ return this.roleFunctionConsoleDao.getFunctionIdByUser(userId); } diff --git a/admin-console/src/main/java/com/ibeetl/admin/console/service/MenuConsoleService.java b/admin-console/src/main/java/com/ibeetl/admin/console/service/MenuConsoleService.java index 5d972a7a..dd19113c 100644 --- a/admin-console/src/main/java/com/ibeetl/admin/console/service/MenuConsoleService.java +++ b/admin-console/src/main/java/com/ibeetl/admin/console/service/MenuConsoleService.java @@ -81,14 +81,14 @@ public class MenuConsoleService extends CoreBaseService { } public String getMenuIdsByRoleId(Long roleId){ - String menuIds = ""; + StringBuffer stringBuffer = new StringBuffer(); CoreRoleMenu roleMenu = new CoreRoleMenu(); roleMenu.setRoleId(roleId); List coreRoleMenuList = roleMenuDao.template(roleMenu); for(int i=0;null != coreRoleMenuList && i currentUserRoleIds = ThreadLocal.withInitial(() -> null); + private List buildFunctionTree(FunctionItem node){ List list = node.getChildren(); @@ -196,8 +203,14 @@ public class FunctionController { return Collections.EMPTY_LIST; } - CoreUser currentUser = platformService.getCurrentUser(); - String ids = functionConsoleService.getFunctionIdByUser(currentUser.getId()); + if(currentUserRoleIds.get() == null) { + CoreUser user = getUser(); + // 非管理员,才查询权限ID.避免数据量过大,数据库压力大 + if(!user.isAdmin()) { + currentUserRoleIds.set(functionConsoleService.getFunctionIdByUser(user.getId())); + } + } + String ids = currentUserRoleIds.get(); List views = new ArrayList(list.size()); for(FunctionItem item :list){ diff --git a/admin-core/pom.xml b/admin-core/pom.xml index 4adecb43..5381f98e 100644 --- a/admin-core/pom.xml +++ b/admin-core/pom.xml @@ -201,6 +201,14 @@ com.alibaba fastjson + + org.apache.poi + poi + + + org.apache.poi + poi-ooxml + diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/conf/CacheConfig.java b/admin-core/src/main/java/com/ibeetl/admin/core/conf/CacheConfig.java index ed5e204d..7c908729 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/conf/CacheConfig.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/conf/CacheConfig.java @@ -5,6 +5,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.cache.Cache; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; import org.springframework.data.redis.cache.RedisCache; import org.springframework.data.redis.cache.RedisCacheConfiguration; import org.springframework.data.redis.cache.RedisCacheManager; @@ -20,12 +21,13 @@ import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer import org.springframework.data.redis.serializer.RedisSerializationContext.SerializationPair; import java.io.UnsupportedEncodingException; +import java.time.Duration; import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; /** * 支持一二级缓存,使得性能逆天快.默认不开启 - * + * * @author TLT * */ @@ -37,14 +39,42 @@ public class CacheConfig { // 定义一个redis 的频道,默认叫cache,用于pub/sub @Value("${springext.cache.redis.topic:cache}") String topicName; + @Value("${springext.cache.redis.ttl:60}") + Long ttl; + + @Bean + @Primary + public RedisCacheManager cacheManager(RedisTemplate redisTemplate) { + return create(redisTemplate, ttl); + } + /** + * 过期时间一天 + * + * @Cacheable(value = {"product"},key = "#root.args[0]",cacheManager = "cacheManager1Day") // 一天后过期 + * @param redisTemplate + * @return + */ @Bean - public TowLevelCacheManager cacheManager(RedisTemplate redisTemplate) { + public RedisCacheManager cacheManager1Day(RedisTemplate redisTemplate) { + return create(redisTemplate, 3600 * 24L); + } + + /** + * 过期时间一小时 + * @param redisTemplate + * @return + */ + @Bean + public RedisCacheManager cacheManager1Hour(RedisTemplate redisTemplate) { + return create(redisTemplate, 3600L); + } + private RedisCacheManager create(RedisTemplate redisTemplate, Long ttl) { RedisCacheWriter writer = RedisCacheWriter.lockingRedisCacheWriter(redisTemplate.getConnectionFactory()); SerializationPair pair = SerializationPair .fromSerializer(new JdkSerializationRedisSerializer(this.getClass().getClassLoader())); - RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig().serializeValuesWith(pair); + RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofSeconds(ttl)).serializeValuesWith(pair); TowLevelCacheManager cacheManager = new TowLevelCacheManager(redisTemplate, writer, config); @@ -53,7 +83,7 @@ public class CacheConfig { @Bean RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory, - MessageListenerAdapter listenerAdapter) { + MessageListenerAdapter listenerAdapter) { RedisMessageListenerContainer container = new RedisMessageListenerContainer(); container.setConnectionFactory(connectionFactory); @@ -85,7 +115,7 @@ public class CacheConfig { RedisTemplate redisTemplate; public TowLevelCacheManager(RedisTemplate redisTemplate, RedisCacheWriter cacheWriter, - RedisCacheConfiguration defaultCacheConfiguration) { + RedisCacheConfiguration defaultCacheConfiguration) { super(cacheWriter, defaultCacheConfiguration); this.redisTemplate = redisTemplate; } diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/convert/TimestampConverter.java b/admin-core/src/main/java/com/ibeetl/admin/core/convert/TimestampConverter.java new file mode 100644 index 00000000..8e5c21be --- /dev/null +++ b/admin-core/src/main/java/com/ibeetl/admin/core/convert/TimestampConverter.java @@ -0,0 +1,34 @@ +package com.ibeetl.admin.core.convert; + +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 com.alibaba.excel.util.DateUtils; +import com.alibaba.excel.util.WorkBookUtil; + +import java.sql.Timestamp; + +/** + * Timestamp and date converter + * + * @author mlx + */ +public class TimestampConverter implements Converter { + @Override + public Class supportJavaTypeKey() { + return Timestamp.class; + } + + @Override + public WriteCellData convertToExcelData(Timestamp value, ExcelContentProperty contentProperty, + GlobalConfiguration globalConfiguration) throws Exception { + WriteCellData cellData = new WriteCellData<>(value.toLocalDateTime()); + String format = null; + if (contentProperty != null && contentProperty.getDateTimeFormatProperty() != null) { + format = contentProperty.getDateTimeFormatProperty().getFormat(); + } + WorkBookUtil.fillDataFormat(cellData, format, DateUtils.defaultDateFormat); + return cellData; + } +} diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java b/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java index 03815e96..568894b4 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java @@ -41,7 +41,8 @@ public class CoreUserService { query.setPassword(passwordEncryptService.password(password)); query.setState(ENABLE.getValue()); CoreUser user =userDao.createLambdaQuery().andEq(CoreUser::getCode,userName). - andEq(CoreUser::getPassword, passwordEncryptService.password(password)).single(); + andEq(CoreUser::getPassword, passwordEncryptService.password(password)) + .andEq(CoreUser::getState, ENABLE.getValue()).single(); if(user==null) { throw new PlatformException("用户"+userName+"不存在或者密码错误"); } diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/util/BeanCopyUtil.java b/admin-core/src/main/java/com/ibeetl/admin/core/util/BeanCopyUtil.java new file mode 100644 index 00000000..a8431a57 --- /dev/null +++ b/admin-core/src/main/java/com/ibeetl/admin/core/util/BeanCopyUtil.java @@ -0,0 +1,185 @@ +package com.ibeetl.admin.core.util; + + +import com.ibeetl.admin.core.entity.BaseEntity; +import org.springframework.beans.BeanUtils; +import org.springframework.util.ObjectUtils; +import org.springframework.util.StopWatch; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +import static org.apache.commons.beanutils.MethodUtils.invokeMethod; + +/** + * Bean拷贝工具类 扩展 + * + * @author mlx + * @date 2022/5/29 + * @modified + */ +public class BeanCopyUtil extends BeanUtils { + + public interface ThConsumer { + + void accept(T t, U u, O o); + } + + /** + * 集合数据的拷贝 + * @param sources: 数据源类 + * @param target: 目标类::new(eg: UserVO::new) + * @return + */ + public static List copyListProperties(List sources, Supplier target) { + return copyListProperties(sources, target, ArrayList::new,null); + } + + /** + * 集合数据的拷贝 + * @param sources: 数据源类 + * @param target: 目标类::new(eg: UserVO::new) + * @return + */ + public static List copyListProperties(List sources, Supplier target, BeanCopyUtilCallBack callBack) { + return copyListProperties(sources, target, ArrayList::new,callBack); + } + + + /** + * 带回调函数的集合数据的拷贝(可自定义字段拷贝规则) + * @param sources: 数据源类 + * @param target: 目标类::new(eg: UserVO::new) + * @param callBack: 回调函数 + * @return + */ + public static List copyListProperties(List sources, Supplier target, Supplier> supplier, BeanCopyUtilCallBack callBack) { + List list = supplier.get(); + for (S source : sources) { + T t = target.get(); + copyProperties(source, t); + list.add(t); + if (callBack != null) { + // 回调 + callBack.callBack(source, t); + } + } + return list; + } + + /** + * 单线程处理 BaseEntity对象转Map + * @param target + * @param + * @return + */ + public static List> BaseEntity2Map(List target) { + StopWatch sw = new StopWatch(); + sw.start(); + List> res = new ArrayList<>(); + if (ObjectUtils.isEmpty(target)) { + return res; + } + Field[] fields = target.get(0).getClass().getDeclaredFields(); + for (T baseEntity : target) { + for (Field declaredField : fields) { + baseEntity.set(getFiledName(declaredField), getFieldValue(baseEntity, "get" + getFirstUpperCaseFiledName(declaredField))); + } + res.add(baseEntity.getTails()); + } + + sw.stop(); + System.out.println("BaseEntity2MapWithParallel:" + sw.getTotalTimeSeconds() + "秒, 集合长度:" + res.size()); + return res; + } + + /** + * 并行处理 BaseEntity对象转Map + * @param target + * @param + * @return + */ + public static List> BaseEntity2MapWithParallel(List target) { + return BaseEntity2MapWithParallel(target, (k, v, o) -> {}); + } + + /** + * 并行处理 BaseEntity对象转Map + * @param target + * @param + * @return + */ + public static List> BaseEntity2MapWithParallel(List target, ThConsumer consumer) { + StopWatch sw = new StopWatch(); + sw.start(); + List> res = new ArrayList<>(); + if (ObjectUtils.isEmpty(target)) { + return res; + } + final Field[] fields = target.get(0).getClass().getDeclaredFields(); + + List> collect = target.parallelStream().map(baseEntity -> { + for (Field declaredField : fields) { + String filedName = getFiledName(declaredField); + String fieldValue = getFieldValue(baseEntity, "get" + getFirstUpperCaseFiledName(declaredField)); + baseEntity.set(filedName, fieldValue); + } + baseEntity.getTails().forEach((k,v) -> consumer.accept(k,v, baseEntity)); + return baseEntity.getTails(); + }).collect(Collectors.toCollection(CopyOnWriteArrayList::new)); + + sw.stop(); + System.out.println("BaseEntity2MapWithParallel:" + sw.getTotalTimeSeconds() + "秒, 集合长度:" + collect.size()); + return collect; + } + + /** + + * 获取对象的属性和属性值 + * + * @author ghj + * @return + * @throws Throwable + */ + public static String getFieldValue(Object owner, String fieldName) { + try { + if(invokeMethod(owner, fieldName, null)!=null){ + return invokeMethod(owner, fieldName, null).toString(); + }else{ + return "null"; + } + } catch (NoSuchMethodException e) { + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } catch (InvocationTargetException e) { + throw new RuntimeException(e); + } + + } + + /** + * 获取属性的名称,首字母大写 + * @param f + * @return + */ + public static String getFirstUpperCaseFiledName(Field f) { + String str = f.toString().substring(f.toString().lastIndexOf('.') + 1); + return str.substring(0, 1).toUpperCase() + str.replaceFirst("\\w", ""); + } + + /** + * 获取属性的名称 + * @param f + * @return + */ + public static String getFiledName(Field f) { + return f.toString().substring(f.toString().lastIndexOf('.') + 1); + } +} diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/util/BeanCopyUtilCallBack.java b/admin-core/src/main/java/com/ibeetl/admin/core/util/BeanCopyUtilCallBack.java new file mode 100644 index 00000000..45476a2e --- /dev/null +++ b/admin-core/src/main/java/com/ibeetl/admin/core/util/BeanCopyUtilCallBack.java @@ -0,0 +1,17 @@ +package com.ibeetl.admin.core.util; + +/** + *

+ * Bean回调接口 + *

+ * + * @author mlx + * @date 2022/5/29 + * @modified + */ +@FunctionalInterface +public interface BeanCopyUtilCallBack { + + + void callBack(S source, T t); +} diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/util/ExcelUtil.java b/admin-core/src/main/java/com/ibeetl/admin/core/util/ExcelUtil.java index e096aa78..fa10d602 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/util/ExcelUtil.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/util/ExcelUtil.java @@ -336,6 +336,35 @@ public class ExcelUtil { } sheet.doWrite(data); } + /** + * 将列表以 Excel 响应给前端 + * + * @param response 响应 + * @param filename 文件名 + * @param sheetName Excel sheet 名 + * @param head Excel head 头 + * @param data 数据列表哦 + * @param 泛型,保证 head 和 data 类型的一致性 + * @throws IOException 写入失败的情况 + */ + public static void write(HttpServletResponse response, String filename, String sheetName, + Class head, List data) throws IOException { + response.setCharacterEncoding("utf-8"); + // 设置 header 和 contentType。写在最后的原因是,避免报错时,响应 contentType 已经被修改了 + response.addHeader("Content-Disposition", "attachment;filename*=utf-8''" + URLEncoder.encode(filename, "UTF-8")); +// response.setContentType("application/vnd.ms-excel;charset=UTF-8"); xls + // xlsx + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + // 输出 Excel + ExcelWriterSheetBuilder sheet = EasyExcel.write(response.getOutputStream(), head) + .autoCloseStream(false) // 不要自动关闭,交给 Servlet 自己处理 + .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) // 基于 column 长度,自动适配。最大 255 宽度 + .sheet(sheetName); + + // 冻结首行 + sheet.registerWriteHandler(new FreezeAndFilter()); + sheet.doWrite(data); + } public static List read(MultipartFile file, Class head) throws IOException { return EasyExcel.read(file.getInputStream(), head, null) diff --git a/doc/sql/mysql/tianze-pro-update.sql b/doc/sql/mysql/tianze-pro-update.sql index a3896340..da4b11a9 100644 --- a/doc/sql/mysql/tianze-pro-update.sql +++ b/doc/sql/mysql/tianze-pro-update.sql @@ -321,3 +321,6 @@ create table teacher_open_course_merge_schedule_session COLLATE = utf8_general_ci; alter table teacher_open_course_merge_schedule_session comment '课程开课-关联-排课配置'; + + +ALTER TABLE teacher_open_course_chat_log ADD COLUMN chat_log_send_type varchar(50) COMMENT '发送类型 枚举(ChatLogSendTypeEnum)'; diff --git a/pom.xml b/pom.xml index 338e6b38..d2cf9fd7 100644 --- a/pom.xml +++ b/pom.xml @@ -11,6 +11,7 @@ UTF-8 2.5.2 3.8.0 + 4.1.2 admin-core @@ -94,6 +95,17 @@ java-jwt 4.0.0 + + + org.apache.poi + poi + ${poi.version} + + + org.apache.poi + poi-ooxml + ${poi.version} + diff --git a/web/src/main/java/cn/jlw/Interceptor/InterceptorConfig.java b/web/src/main/java/cn/jlw/Interceptor/InterceptorConfig.java index 4d2ed47d..fcf03a4e 100644 --- a/web/src/main/java/cn/jlw/Interceptor/InterceptorConfig.java +++ b/web/src/main/java/cn/jlw/Interceptor/InterceptorConfig.java @@ -73,15 +73,15 @@ public class InterceptorConfig implements WebMvcConfigurer, InitializingBean { public void addResourceHandlers(ResourceHandlerRegistry registry){ log.info("路径1 "+p); if(p.contains("file:")){ - registry.addResourceHandler(u+"/filesystem/courseInfo/**").addResourceLocations(p+"/filesystem/courseInfo/"); - registry.addResourceHandler(u+"/filesystem/temp/**").addResourceLocations(p+"/filesystem/temp/"); - registry.addResourceHandler(u+"/filesystem/zip/**").addResourceLocations(p+"/filesystem/zip/"); - registry.addResourceHandler(u+"/images/**").addResourceLocations(p+"/filesystem/product/images/"); + registry.addResourceHandler("/filesystem/courseInfo/**").addResourceLocations(p+"/filesystem/courseInfo/"); + registry.addResourceHandler("/filesystem/temp/**").addResourceLocations(p+"/filesystem/temp/"); + registry.addResourceHandler("/filesystem/zip/**").addResourceLocations(p+"/filesystem/zip/"); + registry.addResourceHandler("/images/**").addResourceLocations(p+"/filesystem/product/images/"); }else { - registry.addResourceHandler(u+"/filesystem/courseInfo/**").addResourceLocations("file:/"+p+"/filesystem/courseInfo/"); - registry.addResourceHandler(u+"/filesystem/temp/**").addResourceLocations("file:/"+p+"/filesystem/temp/"); - registry.addResourceHandler(u+"/filesystem/zip/**").addResourceLocations("file:/"+p+"/filesystem/zip/"); - registry.addResourceHandler(u+"/images/**").addResourceLocations("file:/"+p+"/filesystem/product/images/"); + registry.addResourceHandler("/filesystem/courseInfo/**").addResourceLocations("file:/"+p+"/filesystem/courseInfo/"); + registry.addResourceHandler("/filesystem/temp/**").addResourceLocations("file:/"+p+"/filesystem/temp/"); + registry.addResourceHandler("/filesystem/zip/**").addResourceLocations("file:/"+p+"/filesystem/zip/"); + registry.addResourceHandler("/images/**").addResourceLocations("file:/"+p+"/filesystem/product/images/"); } } diff --git a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourse.java b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourse.java index 463df807..9a1d44db 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourse.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourse.java @@ -50,7 +50,7 @@ public class TeacherOpenCourse extends BaseEntity{ private Integer teacherOpenCourseStatus ; - @FetchSql("select t.teacher_id, ta.teacher_name, teacher_open_course_merge_teacher_auth_code from teacher_open_course_merge_teacher t " + + @FetchSql("select t.teacher_id, ta.teacher_name, ta.teacher_sn, teacher_open_course_merge_teacher_auth_code from teacher_open_course_merge_teacher t " + "left join teacher ta on ta.teacher_id = t.teacher_id " + "where t.teacher_open_course_id = #teacherOpenCourseId# and t.teacher_open_course_merge_teacher_status = 1 " + "order by teacher_id limit 1 ") @@ -71,6 +71,7 @@ public class TeacherOpenCourse extends BaseEntity{ public static class MergeTeacherInfo { private Long teacherId; private String teacherName; + private String teacherSn; private String teacherOpenCourseMergeTeacherAuthCode; } @Setter diff --git a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseChatLog.java b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseChatLog.java index b293b438..7d74a369 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseChatLog.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseChatLog.java @@ -3,6 +3,7 @@ package com.ibeetl.jlw.entity; import com.ibeetl.admin.core.annotation.Dict; import com.ibeetl.admin.core.entity.BaseEntity; import com.ibeetl.admin.core.util.ValidateConfig; +import com.ibeetl.jlw.enums.ChatLogSendTypeEnum; import lombok.Data; import lombok.EqualsAndHashCode; import org.beetl.sql.annotation.entity.AssignID; @@ -75,6 +76,10 @@ public class TeacherOpenCourseChatLog extends BaseEntity{ //学生得分 private BigDecimal studentScore ; + + // 提问方式 + + private ChatLogSendTypeEnum chatLogSendType; //附件上传(仅支持图片,多个逗号隔开) diff --git a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseHandsOnSimulationTasks.java b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseHandsOnSimulationTasks.java index 527f6224..52f286ec 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseHandsOnSimulationTasks.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseHandsOnSimulationTasks.java @@ -3,6 +3,7 @@ package com.ibeetl.jlw.entity; import javax.validation.constraints.NotNull; import com.ibeetl.admin.core.entity.BaseEntity; +import com.ibeetl.jlw.entity.vo.HandsOnTaskProblemVo; import org.beetl.sql.annotation.entity.*; import com.ibeetl.admin.core.util.ValidateConfig; @@ -84,7 +85,17 @@ public class TeacherOpenCourseHandsOnSimulationTasks extends BaseEntity{ //添加时间 private Date addTime ; - + + private HandsOnTaskProblemVo handsOnTaskProblemVo; + + public HandsOnTaskProblemVo getHandsOnTaskProblemVo() { + return handsOnTaskProblemVo; + } + + public void setHandsOnTaskProblemVo(HandsOnTaskProblemVo handsOnTaskProblemVo) { + this.handsOnTaskProblemVo = handsOnTaskProblemVo; + } + public TeacherOpenCourseHandsOnSimulationTasks(){ } diff --git a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseMergeResourcesQuestion.java b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseMergeResourcesQuestion.java index 828319b8..e001b897 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseMergeResourcesQuestion.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseMergeResourcesQuestion.java @@ -26,12 +26,12 @@ public class TeacherOpenCourseMergeResourcesQuestion extends BaseEntity{ private Long teacherOpenCourseId ; - //课程ID + //课程章节ID @Dict(type="teacher_open_course_merge_course_info.course_info_name.course_info_status=1") private Long teacherOpenCourseMergeCourseInfoId ; - //题型(1单选 2多选 3判断) + //题型(1单选 2多选 3判断 4填空 5分析) private Integer questionType ; diff --git a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseStudentSigninLog.java b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseStudentSigninLog.java index c51fc8b2..1b455b40 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseStudentSigninLog.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseStudentSigninLog.java @@ -1,5 +1,7 @@ package com.ibeetl.jlw.entity; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; import com.ibeetl.admin.core.annotation.Dict; import com.ibeetl.admin.core.annotation.DictEnum; import com.ibeetl.admin.core.entity.BaseEntity; @@ -10,6 +12,7 @@ import org.beetl.sql.annotation.entity.InsertIgnore; import org.beetl.sql.annotation.entity.UpdateIgnore; import org.beetl.sql.fetch.annotation.Fetch; import org.beetl.sql.fetch.annotation.FetchOne; +import org.beetl.sql.fetch.annotation.FetchSql; import javax.validation.constraints.NotNull; import java.util.Date; @@ -34,26 +37,49 @@ public class TeacherOpenCourseStudentSigninLog extends BaseEntity{ // 签到场次(时间) - private Date teacherOpenCourseStudentSigninSettingSessionTime; + private DateTime teacherOpenCourseStudentSigninSettingSessionTime; //学生ID - @Dict(type="student.student_name.student_status=1") +// @Dict(type="student.student_name.student_status=1") private Long studentId ; + + + @FetchSql("select t.student_name from student t where t.student_id = #studentId# ") + @UpdateIgnore + @InsertIgnore + private String studentIdText; + + @FetchSql("select t.student_sn from student t where t.student_id = #studentId# ") + @UpdateIgnore + @InsertIgnore + private String studentSn; //开课ID - @Dict(type="teacher_open_course.teacher_open_course_title.teacher_open_course_status=1") +// @Dict(type="teacher_open_course.teacher_open_course_title.teacher_open_course_status=1") private Long teacherOpenCourseId ; + + @FetchSql("select t.teacher_open_course_title from teacher_open_course t " + + "where t.teacher_open_course_id = #teacherOpenCourseId# and t.teacher_open_course_status=1 ") + @UpdateIgnore + @InsertIgnore + private String teacherOpenCourseIdText; //班级ID - @Dict(type="school_class.class_name.class_status=1") +// @Dict(type="school_class.class_name.class_status=1") private Long schoolClassId ; - + + @FetchSql("select t.class_name from school_class t " + + "where t.class_id = #schoolClassId# and t.class_status=1 ") + @UpdateIgnore + @InsertIgnore + private String schoolClassIdText; + //签到日期 - private Date teacherOpenCourseStudentSigninLogAddTime ; + private DateTime teacherOpenCourseStudentSigninLogAddTime ; //签到方式 (数据字典 student_signin_type) @Dict(type="student_signin_type") @@ -61,7 +87,6 @@ public class TeacherOpenCourseStudentSigninLog extends BaseEntity{ private String teacherOpenCourseStudentSigninLogType ; //备注(缺勤理由) - private String teacherOpenCourseStudentSigninLogRemark ; //签到的IP @@ -69,7 +94,6 @@ public class TeacherOpenCourseStudentSigninLog extends BaseEntity{ private String teacherOpenCourseStudentSigninLogIp ; // 签到标签 10 签到,20 缺勤 - @DictEnum("desc") private TeacherOpenCourseStudentSigninLogQuery.SignInTypeEnum teacherOpenCourseStudentSigninLogTag; @@ -153,7 +177,7 @@ public class TeacherOpenCourseStudentSigninLog extends BaseEntity{ *@param teacherOpenCourseStudentSigninLogAddTime */ public void setTeacherOpenCourseStudentSigninLogAddTime(Date teacherOpenCourseStudentSigninLogAddTime){ - this.teacherOpenCourseStudentSigninLogAddTime = teacherOpenCourseStudentSigninLogAddTime; + this.teacherOpenCourseStudentSigninLogAddTime = DateUtil.date(teacherOpenCourseStudentSigninLogAddTime); } /**签到方式 (数据字典 student_signin_type) @@ -242,7 +266,7 @@ public class TeacherOpenCourseStudentSigninLog extends BaseEntity{ } public void setTeacherOpenCourseStudentSigninSettingSessionTime(Date teacherOpenCourseStudentSigninSettingSessionTime) { - this.teacherOpenCourseStudentSigninSettingSessionTime = teacherOpenCourseStudentSigninSettingSessionTime; + this.teacherOpenCourseStudentSigninSettingSessionTime = DateUtil.date(teacherOpenCourseStudentSigninSettingSessionTime); } public Student getStudent() { @@ -252,4 +276,36 @@ public class TeacherOpenCourseStudentSigninLog extends BaseEntity{ public void setStudent(Student student) { this.student = student; } + + public String getStudentIdText() { + return studentIdText; + } + + public void setStudentIdText(String studentIdText) { + this.studentIdText = studentIdText; + } + + public String getTeacherOpenCourseIdText() { + return teacherOpenCourseIdText; + } + + public void setTeacherOpenCourseIdText(String teacherOpenCourseIdText) { + this.teacherOpenCourseIdText = teacherOpenCourseIdText; + } + + public String getSchoolClassIdText() { + return schoolClassIdText; + } + + public void setSchoolClassIdText(String schoolClassIdText) { + this.schoolClassIdText = schoolClassIdText; + } + + public String getStudentSn() { + return studentSn; + } + + public void setStudentSn(String studentSn) { + this.studentSn = studentSn; + } } diff --git a/web/src/main/java/com/ibeetl/jlw/entity/vo/HandsOnTaskProblemVo.java b/web/src/main/java/com/ibeetl/jlw/entity/vo/HandsOnTaskProblemVo.java new file mode 100644 index 00000000..47c9dd90 --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/entity/vo/HandsOnTaskProblemVo.java @@ -0,0 +1,67 @@ +package com.ibeetl.jlw.entity.vo; + +import lombok.Data; + +/** + * 类功能说明 + * + * @Version 0.0.1 + * @Author 许良彤 + * @Date 2022/11/1 21:51 + */ +@Data +public class HandsOnTaskProblemVo { + + /** + * 单选题选题量 + */ + private Integer singleNum; + + /** + * 单选题分值 + */ + private Double singleScore; + + /** + * 单选题合计 + */ + private Double singleSumScore; + + /** + * 多选题选题量 + */ + private Integer multipleNum; + + /** + * 多选题分值 + */ + private Double multipleScore; + + /** + * 多选题合计 + */ + private Double multipleSumScore; + + + /** + * 多选题选题量 + */ + private Integer judgeNum; + + /** + * 多选题分值 + */ + private Double judgeScore; + + /** + * 多选题合计 + */ + private Double judgeSumScore; + + /** + * 总分 + */ + private Double totalScore; + + +} \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/enums/ChatLogSendTypeEnum.java b/web/src/main/java/com/ibeetl/jlw/enums/ChatLogSendTypeEnum.java new file mode 100644 index 00000000..9ece0f25 --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/enums/ChatLogSendTypeEnum.java @@ -0,0 +1,17 @@ +package com.ibeetl.jlw.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.beetl.sql.annotation.entity.EnumMapping; + +@Getter +@AllArgsConstructor +@EnumMapping("name") +public enum ChatLogSendTypeEnum { + + normal("普通回复"), + student_ask("学生提问"), + teacher_ask("教师提问"); + + private String text; +} \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionSnapshotService.java b/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionSnapshotService.java index 296e3c3f..ec5b9d21 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionSnapshotService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionSnapshotService.java @@ -188,11 +188,11 @@ public class ResourcesQuestionSnapshotService extends CoreBaseServicequeryByCondition(PageQuery query){ PageQuery ret = teacherOpenCourseHandsOnSimulationTasksDao.queryByCondition(query); queryListAfter(ret.getList()); @@ -150,6 +155,10 @@ public class TeacherOpenCourseHandsOnSimulationTasksService extends CoreBaseServ teacherOpenCourseHandsOnSimulationTasksQuery.setTaskId(taskId); List list = teacherOpenCourseHandsOnSimulationTasksDao.getValuesByQuery(teacherOpenCourseHandsOnSimulationTasksQuery); if(null != list && list.size()>0){ + for (TeacherOpenCourseHandsOnSimulationTasks teacherOpenCourseHandsOnSimulationTasks : list) { + HandsOnTaskProblemVo objectiveProblem = getObjectiveProblem(teacherOpenCourseHandsOnSimulationTasks.getTaskList()); + teacherOpenCourseHandsOnSimulationTasks.setHandsOnTaskProblemVo(objectiveProblem); + } return list.get(0); }else{ return null; @@ -159,6 +168,12 @@ public class TeacherOpenCourseHandsOnSimulationTasksService extends CoreBaseServ public TeacherOpenCourseHandsOnSimulationTasks getInfo (TeacherOpenCourseHandsOnSimulationTasksQuery teacherOpenCourseHandsOnSimulationTasksQuery){ List list = teacherOpenCourseHandsOnSimulationTasksDao.getValuesByQuery(teacherOpenCourseHandsOnSimulationTasksQuery); if(null != list && list.size()>0){ + + for (TeacherOpenCourseHandsOnSimulationTasks teacherOpenCourseHandsOnSimulationTasks : list) { + HandsOnTaskProblemVo objectiveProblem = getObjectiveProblem(teacherOpenCourseHandsOnSimulationTasks.getTaskList()); + teacherOpenCourseHandsOnSimulationTasks.setHandsOnTaskProblemVo(objectiveProblem); + } + return list.get(0); }else{ return null; @@ -169,4 +184,27 @@ public class TeacherOpenCourseHandsOnSimulationTasksService extends CoreBaseServ return null; } + + public HandsOnTaskProblemVo getObjectiveProblem(String problemIds) { + List resourcesQuestions = resourcesQuestionService.getByIds(problemIds); + //单选题 + List collect1 = resourcesQuestions.stream().filter(v -> 1 == v.getQuestionType()).collect(Collectors.toList()); + //多选题 + List collect2 = resourcesQuestions.stream().filter(v -> 2 == v.getQuestionType()).collect(Collectors.toList()); + //判断题 + List collect3 = resourcesQuestions.stream().filter(v -> 3 == v.getQuestionType()).collect(Collectors.toList()); + + HandsOnTaskProblemVo handsOnTaskProblemVo = new HandsOnTaskProblemVo(); + handsOnTaskProblemVo.setSingleNum(collect1.size()); + handsOnTaskProblemVo.setSingleScore(collect1.stream().mapToDouble(v -> v.getQuestionScore().doubleValue()).average().orElse(0)); + handsOnTaskProblemVo.setSingleSumScore(collect1.stream().mapToDouble(v -> v.getQuestionScore().doubleValue()).sum()); + handsOnTaskProblemVo.setMultipleNum(collect2.size()); + handsOnTaskProblemVo.setMultipleScore(collect2.stream().mapToDouble(v -> v.getQuestionScore().doubleValue()).average().orElse(0)); + handsOnTaskProblemVo.setMultipleSumScore(collect2.stream().mapToDouble(v -> v.getQuestionScore().doubleValue()).sum()); + handsOnTaskProblemVo.setJudgeNum(collect3.size()); + handsOnTaskProblemVo.setJudgeScore(collect3.stream().mapToDouble(v -> v.getQuestionScore().doubleValue()).average().orElse(0)); + handsOnTaskProblemVo.setJudgeSumScore(collect3.stream().mapToDouble(v -> v.getQuestionScore().doubleValue()).sum()); + handsOnTaskProblemVo.setTotalScore(resourcesQuestions.stream().mapToDouble(v -> v.getQuestionScore().doubleValue()).sum()); + return handsOnTaskProblemVo; + } } diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseStudentSigninLogService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseStudentSigninLogService.java index ea5cace3..3f5dc1e7 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseStudentSigninLogService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseStudentSigninLogService.java @@ -173,7 +173,9 @@ public class TeacherOpenCourseStudentSigninLogService extends CoreBaseService getValuesByQueryNotWithPermission (TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery){ - return teacherOpenCourseStudentSigninLogDao.getValuesByQueryNotWithPermission(teacherOpenCourseStudentSigninLogQuery); + List values = teacherOpenCourseStudentSigninLogDao.getValuesByQueryNotWithPermission(teacherOpenCourseStudentSigninLogQuery); + queryListAfter(values); + return values; } public TeacherOpenCourseStudentSigninLog getInfo (Long teacherOpenCourseStudentSigninLogId){ diff --git a/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionSnapshotController.java b/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionSnapshotController.java index 960fb5b1..2190d105 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionSnapshotController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionSnapshotController.java @@ -234,11 +234,10 @@ public class ResourcesQuestionSnapshotController{ @Function("teacherOpenCourseQuestionLog.query") @ResponseBody public JsonResult getScoreInfo( - Long questionSettingId, + Long teacherOpenCourseQuestionSettingId, @SCoreUser CoreUser coreUser) { - Assert.isTrue(coreUser.isStudent(), "非学生身份,无法提交!"); - return JsonResult.success(resourcesQuestionSnapshotService.getScoreInfo(questionSettingId)); + return JsonResult.success(resourcesQuestionSnapshotService.getScoreInfo(teacherOpenCourseQuestionSettingId)); } diff --git a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseHandsOnController.java b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseHandsOnController.java index 21829f7c..1f7abd32 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseHandsOnController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseHandsOnController.java @@ -464,6 +464,7 @@ public class TeacherOpenCourseHandsOnController{ /** * 查看内容 + * 根据课程id获取有哪些课程实操任务类型 * @param teacherOpenCourseId 课程开课id * @return */ diff --git a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseHandsOnSimulationTasksController.java b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseHandsOnSimulationTasksController.java index 23be8694..d341cf3c 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseHandsOnSimulationTasksController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseHandsOnSimulationTasksController.java @@ -8,6 +8,7 @@ import com.ibeetl.admin.core.file.FileService; import com.ibeetl.admin.core.web.JsonResult; import com.ibeetl.jlw.entity.TaskTypeParam; import com.ibeetl.jlw.entity.TeacherOpenCourseHandsOnSimulationTasks; +import com.ibeetl.jlw.entity.vo.HandsOnTaskProblemVo; import com.ibeetl.jlw.service.TeacherOpenCourseHandsOnSimulationTasksService; import com.ibeetl.jlw.web.query.TeacherOpenCourseHandsOnSimulationTasksQuery; import org.apache.commons.lang3.StringUtils; @@ -91,6 +92,8 @@ public class TeacherOpenCourseHandsOnSimulationTasksController{ public ModelAndView edit(Long taskId) { ModelAndView view = new ModelAndView("/jlw/teacherOpenCourseHandsOnSimulationTasks/edit.html"); TeacherOpenCourseHandsOnSimulationTasks teacherOpenCourseHandsOnSimulationTasks = teacherOpenCourseHandsOnSimulationTasksService.queryById(taskId); + HandsOnTaskProblemVo objectiveProblem = getObjectiveProblem(teacherOpenCourseHandsOnSimulationTasks.getTaskList()); + teacherOpenCourseHandsOnSimulationTasks.setHandsOnTaskProblemVo(objectiveProblem); view.addObject("teacherOpenCourseHandsOnSimulationTasks", teacherOpenCourseHandsOnSimulationTasks); return view; } @@ -101,6 +104,8 @@ public class TeacherOpenCourseHandsOnSimulationTasksController{ ModelAndView view = new ModelAndView("/jlw/teacherOpenCourseHandsOnSimulationTasks/add.html"); if(null != taskId){ TeacherOpenCourseHandsOnSimulationTasks teacherOpenCourseHandsOnSimulationTasks = teacherOpenCourseHandsOnSimulationTasksService.queryById(taskId); + HandsOnTaskProblemVo objectiveProblem = getObjectiveProblem(teacherOpenCourseHandsOnSimulationTasks.getTaskList()); + teacherOpenCourseHandsOnSimulationTasks.setHandsOnTaskProblemVo(objectiveProblem); view.addObject("teacherOpenCourseHandsOnSimulationTasks", teacherOpenCourseHandsOnSimulationTasks); }else { view.addObject("teacherOpenCourseHandsOnSimulationTasks", new TeacherOpenCourseHandsOnSimulationTasks()); @@ -171,6 +176,8 @@ public class TeacherOpenCourseHandsOnSimulationTasksController{ @Function("teacherOpenCourseHandsOnSimulationTasks.query") public JsonResultqueryInfo(Long taskId) { TeacherOpenCourseHandsOnSimulationTasks teacherOpenCourseHandsOnSimulationTasks = teacherOpenCourseHandsOnSimulationTasksService.queryById( taskId); + HandsOnTaskProblemVo objectiveProblem = getObjectiveProblem(teacherOpenCourseHandsOnSimulationTasks.getTaskList()); + teacherOpenCourseHandsOnSimulationTasks.setHandsOnTaskProblemVo(objectiveProblem); return JsonResult.success(teacherOpenCourseHandsOnSimulationTasks); } @@ -228,6 +235,16 @@ public class TeacherOpenCourseHandsOnSimulationTasksController{ } + /** + * 获取题目的类型及数量 + * @param problemIds + * @return + */ + @GetMapping(MODEL + "/getObjectiveProblem.do") + public HandsOnTaskProblemVo getObjectiveProblem(String problemIds) { + return teacherOpenCourseHandsOnSimulationTasksService.getObjectiveProblem(problemIds); + } + } diff --git a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseStudentSigninLogController.java b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseStudentSigninLogController.java index 657e619b..8dfd5854 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseStudentSigninLogController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseStudentSigninLogController.java @@ -1,5 +1,7 @@ package com.ibeetl.jlw.web; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; import cn.jlw.Interceptor.GetFile; import cn.jlw.Interceptor.RFile; import cn.jlw.Interceptor.SCoreUser; @@ -8,6 +10,7 @@ import cn.jlw.validate.ValidateConfig; import com.ibeetl.admin.core.annotation.Function; import com.ibeetl.admin.core.entity.CoreUser; import com.ibeetl.admin.core.file.FileService; +import com.ibeetl.admin.core.util.PlatformException; import com.ibeetl.admin.core.util.TimeTool; import com.ibeetl.admin.core.web.JsonResult; import com.ibeetl.jlw.entity.FileEntity; @@ -16,6 +19,7 @@ import com.ibeetl.jlw.entity.dto.TeacherOpenCourseStudentSigninLogManualMergeDTO import com.ibeetl.jlw.entity.dto.TeacherOpenCourseStudentSigninLogSigninDTO; import com.ibeetl.jlw.service.TeacherOpenCourseStudentSigninLogService; import com.ibeetl.jlw.web.query.TeacherOpenCourseStudentSigninLogQuery; +import lombok.SneakyThrows; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -37,9 +41,14 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import static com.ibeetl.admin.core.util.BeanCopyUtil.BaseEntity2MapWithParallel; +import static com.ibeetl.admin.core.util.ExcelUtil.convertData; +import static com.ibeetl.admin.core.util.ExcelUtil.write; + /** * 学生签到记录 教师-我的课程-开课-学生签到记录 接口 * 切记不要对非线程安全的静态变量进行写操作 @@ -126,6 +135,45 @@ public class TeacherOpenCourseStudentSigninLogController{ } } + /** + * 教师端-签到日志导出 + * @param condition 日志记录查询条件 + * @param coreUser + * @return + */ + @SneakyThrows + @GetMapping(API + "/export.do") + public void easyExcelExport(HttpServletResponse resp, TeacherOpenCourseStudentSigninLogQuery condition, @SCoreUser CoreUser coreUser) { + + if(null == coreUser){ + throw new PlatformException("请登录后再操作"); + }else{ + Assert.notNull(condition.getTeacherOpenCourseId(), "teacherOpenCourseId 开课ID不能为空!"); + + /** 构建表头 */ + Map header = new LinkedHashMap<>(11); + header.put("studentIdText", "学生姓名"); + header.put("studentSn", "学号"); + header.put("teacherOpenCourseIdText", "开课名称"); + header.put("schoolClassIdText", "班级名称"); + header.put("teacherOpenCourseStudentSigninSettingSessionTime", "签到场次"); + header.put("teacherOpenCourseStudentSigninLogTypeText", "签到类型"); + header.put("teacherOpenCourseStudentSigninLogTagText", "签到标签"); + header.put("teacherOpenCourseStudentSigninLogAddTime", "签到时间"); + header.put("teacherOpenCourseStudentSigninLogRemark", "备注"); + + List datas = + teacherOpenCourseStudentSigninLogService.getValuesByQueryNotWithPermission(condition); + + List> maps = BaseEntity2MapWithParallel(datas); + + String filename = StrUtil.format("签到日志导出-{}.xlsx", DateUtil.formatDate(DateUtil.date())); + write(resp, filename,"Sheet1", header.values(), convertData(header.keySet(), maps)); + } + } + + + /* 后台页面 */ diff --git a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseChatLogQuery.java b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseChatLogQuery.java index d3d0b94c..89434224 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseChatLogQuery.java +++ b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseChatLogQuery.java @@ -4,6 +4,7 @@ import cn.jlw.validate.ValidateConfig; import com.ibeetl.admin.core.annotation.Query; import com.ibeetl.admin.core.web.query.PageParam; import com.ibeetl.jlw.entity.TeacherOpenCourseChatLog; +import com.ibeetl.jlw.enums.ChatLogSendTypeEnum; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; @@ -49,6 +50,9 @@ public class TeacherOpenCourseChatLogQuery extends PageParam { private String keywords; @Query(name = "学生得分", display = false) private BigDecimal studentScore; + @Query(name = "提问方式", display = false) + private ChatLogSendTypeEnum chatLogSendType; + @Query(name = "附件上传(仅支持图片,多个逗号隔开)", display = false) private String chatFiles; @Query(name = "状态 (1正常 2删除)", display = true,type=Query.TYPE_DICT,dict="global_status") @@ -60,6 +64,9 @@ public class TeacherOpenCourseChatLogQuery extends PageParam { @Query(name = "用户ID", display = false) private Long userId; + @Query(name = "回复状态 1 待回复 2已回复", display = false) + private Integer replyStatus; + private String teacherOpenCourseChatLogIdPlural; private String teacherOpenCourseChatLogParentIdPlural; private String teacherOpenCourseIdPlural; @@ -237,4 +244,20 @@ public class TeacherOpenCourseChatLogQuery extends PageParam { public void set_given(String _given) { this._given = _given; } + + public ChatLogSendTypeEnum getChatLogSendType() { + return chatLogSendType; + } + + public void setChatLogSendType(ChatLogSendTypeEnum chatLogSendType) { + this.chatLogSendType = chatLogSendType; + } + + public Integer getReplyStatus() { + return replyStatus; + } + + public void setReplyStatus(Integer replyStatus) { + this.replyStatus = replyStatus; + } } diff --git a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseQuestionSettingQuery.java b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseQuestionSettingQuery.java index 7589d740..e5b6a569 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseQuestionSettingQuery.java +++ b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseQuestionSettingQuery.java @@ -47,6 +47,8 @@ public class TeacherOpenCourseQuestionSettingQuery extends PageParam { @NotNull(message = "题目结束时间不能为空", groups =ValidateConfig.ADD.class) @Query(name = "题目结束时间", display = false) private Date teacherOpenCourseQuestionEndTime; + @Query(name = "作业要求", display = false) + private String teacherOpenCourseQuestionSettingRequire; @Query(name = "类型", display = false) // 枚举(ResourcesQuestionSnapshotFromTypeEnum) private ResourcesQuestionSnapshotFromTypeEnum teacherOpenCourseQuestionSettingType; @@ -98,6 +100,7 @@ public class TeacherOpenCourseQuestionSettingQuery extends PageParam { pojo.setTeacherOpenCourseQuestionSettingPushStatus(this.getTeacherOpenCourseQuestionSettingPushStatus()); pojo.setTeacherOpenCourseQuestionSettingStatus(this.getTeacherOpenCourseQuestionSettingStatus()); pojo.setTeacherOpenCourseQuestionSettingAddTime(this.getTeacherOpenCourseQuestionSettingAddTime()); + pojo.setTeacherOpenCourseQuestionSettingRequire(this.getTeacherOpenCourseQuestionSettingRequire()); pojo.setOrgId(this.getOrgId()); pojo.setUserId(this.getUserId()); return pojo; diff --git a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseStudentSigninLogQuery.java b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseStudentSigninLogQuery.java index 44dbf1b8..7cd37d66 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseStudentSigninLogQuery.java +++ b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseStudentSigninLogQuery.java @@ -1,5 +1,6 @@ package com.ibeetl.jlw.web.query; +import cn.hutool.core.date.DateTime; import cn.jlw.validate.ValidateConfig; import com.ibeetl.admin.core.annotation.Query; import com.ibeetl.admin.core.web.query.PageParam; @@ -119,7 +120,7 @@ public class TeacherOpenCourseStudentSigninLogQuery extends PageParam { public Date getTeacherOpenCourseStudentSigninLogAddTime(){ return teacherOpenCourseStudentSigninLogAddTime; } - public void setTeacherOpenCourseStudentSigninLogAddTime(Date teacherOpenCourseStudentSigninLogAddTime ){ + public void setTeacherOpenCourseStudentSigninLogAddTime(DateTime teacherOpenCourseStudentSigninLogAddTime ){ this.teacherOpenCourseStudentSigninLogAddTime = teacherOpenCourseStudentSigninLogAddTime; } public String getTeacherOpenCourseStudentSigninLogType(){ @@ -235,6 +236,6 @@ public class TeacherOpenCourseStudentSigninLogQuery extends PageParam { } public void setTeacherOpenCourseStudentSigninSettingSessionTime(Date teacherOpenCourseStudentSigninSettingSessionTime) { - this.teacherOpenCourseStudentSigninSettingSessionTime = teacherOpenCourseStudentSigninSettingSessionTime; + this.teacherOpenCourseStudentSigninSettingSessionTime = (teacherOpenCourseStudentSigninSettingSessionTime); } } diff --git a/web/src/main/resources/application-dev.properties b/web/src/main/resources/application-dev.properties index a2ca156f..0b8b7033 100644 --- a/web/src/main/resources/application-dev.properties +++ b/web/src/main/resources/application-dev.properties @@ -2,7 +2,9 @@ admin.isOnline=true # \u9006\u5929\u7F13\u5B58\u5F00\u542F -springext.cache.enabled=false +springext.cache.enabled=true +# +springext.cache.redis.ttl=300 logging.level.root=INFO #logging.level.root=DEBUG diff --git a/web/src/main/resources/application-local.properties b/web/src/main/resources/application-local.properties index bef61e31..7d52fb3b 100644 --- a/web/src/main/resources/application-local.properties +++ b/web/src/main/resources/application-local.properties @@ -3,6 +3,7 @@ admin.isOnline=false # \u9006\u5929\u7F13\u5B58\u5F00\u542F springext.cache.enabled=true +springext.cache.redis.ttl=300 logging.level.root=INFO #logging.level.root=DEBUG diff --git a/web/src/main/resources/application-prod.properties b/web/src/main/resources/application-prod.properties index 621da63e..08b7ced6 100644 --- a/web/src/main/resources/application-prod.properties +++ b/web/src/main/resources/application-prod.properties @@ -3,6 +3,7 @@ admin.isOnline=true # \u9006\u5929\u7F13\u5B58\u5F00\u542F springext.cache.enabled=true +springext.cache.redis.ttl=300 logging.level.root=ERROR #logging.level.root=DEBUG diff --git a/web/src/main/resources/sql/jlw/resourcesApplication.md b/web/src/main/resources/sql/jlw/resourcesApplication.md index 4064834c..05682217 100644 --- a/web/src/main/resources/sql/jlw/resourcesApplication.md +++ b/web/src/main/resources/sql/jlw/resourcesApplication.md @@ -7,7 +7,6 @@ queryByCondition t.* @} from resources_application t - left left join teacher_merge_application ta on ta.resources_application_id = t.resources_application_id where 1=1 @//数据权限,该sql语句功能点,如果不考虑数据权限,可以删除此行 diff --git a/web/src/main/resources/sql/jlw/teacherOpenCourseChatLog.md b/web/src/main/resources/sql/jlw/teacherOpenCourseChatLog.md index 7d9e5e0f..cc1c2f63 100644 --- a/web/src/main/resources/sql/jlw/teacherOpenCourseChatLog.md +++ b/web/src/main/resources/sql/jlw/teacherOpenCourseChatLog.md @@ -53,7 +53,7 @@ queryByCondition and t.chat_content =#chatContent# @} @if(!isEmpty(keywords)){ - and t.keywords =#keywords# + and t.keywords like #"%"+keywords+"%"# @} @if(!isEmpty(studentScore)){ and t.student_score =#studentScore# @@ -61,6 +61,9 @@ queryByCondition @if(!isEmpty(chatFiles)){ and t.chat_files =#chatFiles# @} + @if(!isEmpty(chatLogSendType)){ + and t.chat_log_send_type =#chatLogSendType# + @} @if(isEmpty(teacherOpenCourseChatLogStatus) && isEmpty(teacherOpenCourseChatLogStatusPlural)){ and t.teacher_open_course_chat_log_status != 2 @}else{ @@ -90,6 +93,26 @@ queryByCondition order by teacher_open_course_chat_log_add_time desc @} @} + @if(!isEmpty(replyStatus)){ + and + @// 待回复的消息 + @if(replyStatus == 1) { + NOT + @} + @if(replyStatus == 1) { + @// 这里留空,代表查询已回复的消息 + @} + EXISTS ( + SELECT + 1 + FROM + teacher_open_course_chat_log ta + WHERE + ta.teacher_open_course_chat_log_parent_id = t.teacher_open_course_chat_log_id + AND ta.teacher_open_course_chat_log_status = 1 + ) + @} + queryByConditionQuery @@ -139,7 +162,7 @@ queryByConditionQuery and t.chat_content =#chatContent# @} @if(!isEmpty(keywords)){ - and t.keywords =#keywords# + and t.keywords like #"%"+keywords+"%"# @} @if(!isEmpty(studentScore)){ and t.student_score =#studentScore# @@ -147,6 +170,9 @@ queryByConditionQuery @if(!isEmpty(chatFiles)){ and t.chat_files =#chatFiles# @} + @if(!isEmpty(chatLogSendType)){ + and t.chat_log_send_type =#chatLogSendType# + @} @if(isEmpty(teacherOpenCourseChatLogStatus) && isEmpty(teacherOpenCourseChatLogStatusPlural)){ and t.teacher_open_course_chat_log_status != 2 @}else{ @@ -268,6 +294,13 @@ updateGivenByIds chat_files = #chatFiles# , @} @} + @if(contain("chatLogSendType",_given)){ + @if(isEmpty(chatLogSendType)){ + chat_log_send_type = null , + @}else{ + chat_log_send_type = #chatLogSendType# , + @} + @} @if(contain("teacherOpenCourseChatLogStatus",_given)){ @if(isEmpty(teacherOpenCourseChatLogStatus)){ teacher_open_course_chat_log_status = null , @@ -331,7 +364,7 @@ getTeacherOpenCourseChatLogValues and t.chat_content =#chatContent# @} @if(!isEmpty(keywords)){ - and t.keywords =#keywords# + and t.keywords like #"%"+keywords+"%"# @} @if(!isEmpty(studentScore)){ and t.student_score =#studentScore# @@ -339,6 +372,9 @@ getTeacherOpenCourseChatLogValues @if(!isEmpty(chatFiles)){ and t.chat_files =#chatFiles# @} + @if(!isEmpty(chatLogSendType)){ + and t.chat_log_send_type =#chatLogSendType# + @} @if(!isEmpty(teacherOpenCourseChatLogStatus)){ and t.teacher_open_course_chat_log_status =#teacherOpenCourseChatLogStatus# @}else{ @@ -400,7 +436,7 @@ getValuesByQuery and t.chat_content =#chatContent# @} @if(!isEmpty(keywords)){ - and t.keywords =#keywords# + and t.keywords like #"%"+keywords+"%"# @} @if(!isEmpty(studentScore)){ and t.student_score =#studentScore# @@ -408,6 +444,9 @@ getValuesByQuery @if(!isEmpty(chatFiles)){ and t.chat_files =#chatFiles# @} + @if(!isEmpty(chatLogSendType)){ + and t.chat_log_send_type =#chatLogSendType# + @} @if(isEmpty(teacherOpenCourseChatLogStatus) && isEmpty(teacherOpenCourseChatLogStatusPlural)){ and t.teacher_open_course_chat_log_status != 2 @}else{ @@ -478,7 +517,7 @@ getValuesByQueryNotWithPermission and t.chat_content =#chatContent# @} @if(!isEmpty(keywords)){ - and t.keywords =#keywords# + and t.keywords like #"%"+keywords+"%"# @} @if(!isEmpty(studentScore)){ and t.student_score =#studentScore# @@ -486,6 +525,9 @@ getValuesByQueryNotWithPermission @if(!isEmpty(chatFiles)){ and t.chat_files =#chatFiles# @} + @if(!isEmpty(chatLogSendType)){ + and t.chat_log_send_type =#chatLogSendType# + @} @if(isEmpty(teacherOpenCourseChatLogStatus) && isEmpty(teacherOpenCourseChatLogStatusPlural)){ and t.teacher_open_course_chat_log_status != 2 @}else{ diff --git a/web/src/main/resources/sql/jlw/teacherOpenCourseQuestionSetting.md b/web/src/main/resources/sql/jlw/teacherOpenCourseQuestionSetting.md index c3f94c0a..192d33ed 100644 --- a/web/src/main/resources/sql/jlw/teacherOpenCourseQuestionSetting.md +++ b/web/src/main/resources/sql/jlw/teacherOpenCourseQuestionSetting.md @@ -70,6 +70,9 @@ queryByCondition @if(!isEmpty(teacherOpenCourseQuestionSettingAddTime)){ and t.teacher_open_course_question_setting_add_time =#teacherOpenCourseQuestionSettingAddTime# @} + @if(!isEmpty(teacherOpenCourseQuestionSettingRequire)){ + and t.teacher_open_course_question_setting_require =#teacherOpenCourseQuestionSettingRequire# + @} @if(!isEmpty(orgId)){ and t.org_id =#orgId# @} @@ -154,6 +157,9 @@ queryByConditionQuery @if(!isEmpty(teacherOpenCourseQuestionSettingAddTime)){ and t.teacher_open_course_question_setting_add_time =#teacherOpenCourseQuestionSettingAddTime# @} + @if(!isEmpty(teacherOpenCourseQuestionSettingRequire)){ + and t.teacher_open_course_question_setting_require =#teacherOpenCourseQuestionSettingRequire# + @} @if(!isEmpty(orgId)){ and t.org_id =#orgId# @} @@ -305,6 +311,13 @@ updateGivenByIds teacher_open_course_question_setting_add_time = #teacherOpenCourseQuestionSettingAddTime# , @} @} + @if(contain("teacherOpenCourseQuestionSettingRequire",_given)){ + @if(isEmpty(teacherOpenCourseQuestionSettingRequire)){ + teacher_open_course_question_setting_require = null , + @}else{ + teacher_open_course_question_setting_require = #teacherOpenCourseQuestionSettingRequire# , + @} + @} @if(contain("orgId",_given)){ @if(isEmpty(orgId)){ org_id = null , @@ -382,6 +395,9 @@ getTeacherOpenCourseQuestionSettingValues @if(!isEmpty(teacherOpenCourseQuestionSettingAddTime)){ and t.teacher_open_course_question_setting_add_time =#teacherOpenCourseQuestionSettingAddTime# @} + @if(!isEmpty(teacherOpenCourseQuestionSettingRequire)){ + and t.teacher_open_course_question_setting_require =#teacherOpenCourseQuestionSettingRequire# + @} @if(!isEmpty(orgId)){ and t.org_id =#orgId# @} @@ -458,6 +474,9 @@ getValuesByQuery @if(!isEmpty(teacherOpenCourseQuestionSettingAddTime)){ and t.teacher_open_course_question_setting_add_time =#teacherOpenCourseQuestionSettingAddTime# @} + @if(!isEmpty(teacherOpenCourseQuestionSettingRequire)){ + and t.teacher_open_course_question_setting_require =#teacherOpenCourseQuestionSettingRequire# + @} @if(!isEmpty(orgId)){ and t.org_id =#orgId# @}