..
This commit is contained in:
+11
@@ -5,6 +5,8 @@ import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_file;
|
||||
import com.budwk.app.sys.utils.SysFileMinIoUtil;
|
||||
import com.budwk.app.zhgh.dayofficework.edu.models.EduChapters;
|
||||
import com.budwk.app.zhgh.dayofficework.edu.models.EduCourses;
|
||||
import com.budwk.app.zhgh.dayofficework.edu.models.EduVideos;
|
||||
@@ -132,6 +134,15 @@ public class EduCoursesController {
|
||||
@SLog(tag = "理论学习课程", msg = "添加课程视频")
|
||||
public Result insert(EduVideos eduVideos) {
|
||||
dao.insert(eduVideos);
|
||||
String url = eduVideos.getUrl();
|
||||
String id = url.split("id=")[1];
|
||||
Sys_file file = dao.fetch(Sys_file.class, id);
|
||||
byte[] bytes = SysFileMinIoUtil.getFileBytes(file.getBucket(), file.getStoragePath());
|
||||
|
||||
// 获取视频时长
|
||||
|
||||
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
+9
-15
@@ -115,20 +115,19 @@ public class H5EduController {
|
||||
}
|
||||
|
||||
// 获取课程总视频数
|
||||
// int totalVideos = dao.count("edu_videos v",
|
||||
// "LEFT JOIN edu_chapters c ON v.chapterId = c.id",
|
||||
// Cnd.where("c.courseId", "=", courseId));
|
||||
int totalVideos = 10;
|
||||
List<EduChapters> chapters = dao.query(EduChapters.class, Cnd.where(EduChapters::getCourseId, "=", courseId));
|
||||
List<String> chapterIds = chapters.stream().map(EduChapters::getId).toList();
|
||||
int totalVideos = dao.count(EduVideos.class, Cnd.where(EduVideos::getChapterId, "in", chapterIds));
|
||||
|
||||
// 获取已完成的视频ID列表
|
||||
List<EduStudyRecords> completedRecords = dao.query(EduStudyRecords.class,
|
||||
Cnd.where("userId", "=", userId)
|
||||
.and("courseId", "=", courseId)
|
||||
.and("completed", "=", true));
|
||||
Cnd.where(EduStudyRecords::getUserId, "=", userId)
|
||||
.and(EduStudyRecords::getCourseId, "=", courseId)
|
||||
.and(EduStudyRecords::getIsCompleted, "=", 1));
|
||||
|
||||
List<String> completedVideoIds = completedRecords.stream()
|
||||
.map(EduStudyRecords::getVideoId)
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
.map(EduStudyRecords::getVideoId)
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
|
||||
int completedVideos = completedVideoIds.size();
|
||||
|
||||
@@ -196,13 +195,8 @@ public class H5EduController {
|
||||
return Result.error("观看时长不能为空或小于0");
|
||||
}
|
||||
|
||||
String userId = SecurityUtil.getUserId();
|
||||
if (userId == null) {
|
||||
return Result.error("用户未登录");
|
||||
}
|
||||
|
||||
EduStudyRecords record = eduStudyRecordsService.saveOrUpdateWatchProgress(
|
||||
userId, videoId, courseId, watchedDuration);
|
||||
SecurityUtil.getUserId(), videoId, courseId, watchedDuration);
|
||||
|
||||
return Result.success(record);
|
||||
} catch (Exception e) {
|
||||
|
||||
+5
-7
@@ -8,8 +8,6 @@ import java.util.List;
|
||||
/**
|
||||
* @ClassName EduStudyRecordsService
|
||||
* @Description 学习记录服务接口
|
||||
* @Author AI Assistant
|
||||
* @Date 2024/01/01
|
||||
*/
|
||||
public interface EduStudyRecordsService extends BaseService<EduStudyRecords> {
|
||||
|
||||
@@ -79,17 +77,17 @@ public interface EduStudyRecordsService extends BaseService<EduStudyRecords> {
|
||||
// Getters and Setters
|
||||
public int getTotalVideos() { return totalVideos; }
|
||||
public void setTotalVideos(int totalVideos) { this.totalVideos = totalVideos; }
|
||||
|
||||
|
||||
public int getCompletedVideos() { return completedVideos; }
|
||||
public void setCompletedVideos(int completedVideos) { this.completedVideos = completedVideos; }
|
||||
|
||||
|
||||
public int getTotalDuration() { return totalDuration; }
|
||||
public void setTotalDuration(int totalDuration) { this.totalDuration = totalDuration; }
|
||||
|
||||
|
||||
public int getWatchedDuration() { return watchedDuration; }
|
||||
public void setWatchedDuration(int watchedDuration) { this.watchedDuration = watchedDuration; }
|
||||
|
||||
|
||||
public double getCompletionRate() { return completionRate; }
|
||||
public void setCompletionRate(double completionRate) { this.completionRate = completionRate; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -1,5 +1,6 @@
|
||||
package com.budwk.app.zhgh.dayofficework.edu.service.impl;
|
||||
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.dayofficework.edu.models.EduStudyRecords;
|
||||
import com.budwk.app.zhgh.dayofficework.edu.models.EduVideos;
|
||||
@@ -17,8 +18,6 @@ import java.util.List;
|
||||
/**
|
||||
* @ClassName EduStudyRecordsServiceImpl
|
||||
* @Description 学习记录服务实现类
|
||||
* @Author AI Assistant
|
||||
* @Date 2024/01/01
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@@ -74,7 +73,7 @@ public class EduStudyRecordsServiceImpl extends BaseServiceImpl<EduStudyRecords>
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("保存观看进度失败", e);
|
||||
throw new RuntimeException("保存观看进度失败", e);
|
||||
throw new BaseException("保存观看进度失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Table("global_message")
|
||||
@@ -74,6 +75,11 @@ public class GlobalMessage extends BaseModel {
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer status;
|
||||
|
||||
@Column
|
||||
@Comment("发送时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date sendTime;
|
||||
|
||||
@Column
|
||||
@Comment("发送成功")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
|
||||
+2
-1
@@ -54,6 +54,7 @@ public class GlobalMessageReceiver extends BaseModel {
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date readTime;
|
||||
|
||||
|
||||
@One(target = GlobalMessage.class, field = "messageId")
|
||||
private GlobalMessage globalMessage;
|
||||
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.budwk.app.zhgh.dayofficework.message.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.dayofficework.message.models.GlobalMessage;
|
||||
|
||||
public interface GlobalMessageService extends BaseService<GlobalMessage> {
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.budwk.app.zhgh.dayofficework.message.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.dayofficework.message.models.GlobalMessage;
|
||||
import com.budwk.app.zhgh.dayofficework.message.service.GlobalMessageService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class GlobalMessageServiceImpl extends BaseServiceImpl<GlobalMessage> implements GlobalMessageService {
|
||||
public GlobalMessageServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+15
-6
@@ -6,6 +6,7 @@ import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.dayofficework.qsv.models.QsvActivity;
|
||||
import com.budwk.app.zhgh.dayofficework.qsv.models.QsvBank;
|
||||
import com.budwk.app.zhgh.dayofficework.qsv.models.QsvOption;
|
||||
import com.budwk.app.zhgh.dayofficework.qsv.models.QsvSubject;
|
||||
import com.budwk.app.zhgh.dayofficework.qsv.service.QsvActivityService;
|
||||
@@ -49,7 +50,7 @@ public class QsvActivityController {
|
||||
public Result pageData(@Valid PageForm pageForm, Integer year, String title) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("YEAR(startTime)", "=", year);
|
||||
cnd.and(Cnd.likeEX("title",title));
|
||||
cnd.and(Cnd.likeEX("title", title));
|
||||
Pagination pagination = qsvActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
@@ -79,7 +80,7 @@ public class QsvActivityController {
|
||||
return Result.success(activity);
|
||||
}
|
||||
|
||||
// 删除问卷
|
||||
// 删除问卷
|
||||
@At
|
||||
@SaCheckPermission("qsv.activity")
|
||||
@ApiOperation("删除问卷")
|
||||
@@ -90,7 +91,7 @@ public class QsvActivityController {
|
||||
}
|
||||
|
||||
|
||||
// 保存问卷题目
|
||||
// 保存问卷题目
|
||||
@At
|
||||
@SaCheckPermission("qsv.activity")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@@ -143,15 +144,23 @@ public class QsvActivityController {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
// 查询问卷题目
|
||||
// 查询问卷题目
|
||||
@At
|
||||
@SaCheckPermission("qsv.activity")
|
||||
@ApiOperation("查询问卷题目")
|
||||
@SLog(type = "qsv.activity", tag = "查询问卷题目", msg = "查询问卷题目")
|
||||
public Result listSubjects(@Valid String activityId) {
|
||||
List<QsvSubject> subjects = dao.query(QsvSubject.class, Cnd.where("activityId", "=", activityId).asc("sortNum"));
|
||||
dao.fetchLinks(subjects, "options",Cnd.NEW().asc("sortNum"));
|
||||
dao.fetchLinks(subjects, "options", Cnd.NEW().asc("sortNum"));
|
||||
return Result.success(subjects);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.activity")
|
||||
@ApiOperation("查询问卷题库")
|
||||
public Result listBank(@Valid String category) {
|
||||
List<QsvBank> list = dao.query(QsvBank.class, Cnd.where(QsvBank::getCategory, "=", category));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.budwk.app.zhgh.dayofficework.qsv.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.dayofficework.qsv.models.QsvBank;
|
||||
import com.budwk.app.zhgh.dayofficework.qsv.models.QsvSubject;
|
||||
import com.budwk.app.zhgh.dayofficework.qsv.service.QsvBankService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Arrays;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/qsv/bank")
|
||||
@Ok("json:full")
|
||||
@ApiOperation("问卷调查题库管理")
|
||||
public class QsvBankController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private QsvBankService qsvBankService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/dayofficework/qsv/bank/index.html")
|
||||
@SaCheckPermission("qsv.bank")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.bank")
|
||||
public Result pageData(PageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.where().andLike(QsvBank::getTitle, pageForm.getSearchKeyword());
|
||||
}
|
||||
Pagination pagination = qsvBankService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.bank")
|
||||
@ApiOperation("保存题库")
|
||||
public Result save(@Param("qsvBank") QsvBank qsvBank) {
|
||||
dao.insert(qsvBank);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.bank")
|
||||
@ApiOperation("修改题库")
|
||||
public Result update(@Param("qsvBank") QsvBank qsvBank) {
|
||||
dao.updateIgnoreNull(qsvBank);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.bank")
|
||||
public Result findOne(@Valid String id) {
|
||||
QsvBank qsvBank = dao.fetch(QsvBank.class, id);
|
||||
return Result.success(qsvBank);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.bank")
|
||||
@ApiOperation("删除题库")
|
||||
public Result delete(@Valid String id) {
|
||||
dao.delete(QsvBank.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("qsv.bank")
|
||||
@ApiOperation("保存题库题目")
|
||||
public Result saveSubjects(@Valid String id, @Param("subjects") QsvSubject[] subjects) {
|
||||
QsvBank qsvBank = dao.fetch(QsvBank.class, id);
|
||||
qsvBank.setSubjects(Arrays.asList(subjects));
|
||||
dao.updateIgnoreNull(qsvBank);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
package com.budwk.app.zhgh.dayofficework.qsv.h5controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
@@ -25,13 +26,13 @@ public class H5QsvController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhghh5/dayofficework/qsv/index.html")
|
||||
@SaCheckLogin
|
||||
@SaCheckPermission("h5.qsv")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@SaCheckPermission("h5.qsv")
|
||||
public Result pageData(@Valid PageForm pageForm, @Valid String category) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("category", "=", category);
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.budwk.app.zhgh.dayofficework.qsv.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Table("qsv_bank")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("问卷调查题库")
|
||||
public class QsvBank extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("题库名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String title;
|
||||
|
||||
@Column
|
||||
@Comment("说明描述")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String description;
|
||||
|
||||
@Column
|
||||
@Comment("所属模块(quiz, survey, vote)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String category;
|
||||
|
||||
@Column
|
||||
@Comment("题目")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<QsvSubject> subjects;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.budwk.app.zhgh.dayofficework.qsv.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.dayofficework.qsv.models.QsvBank;
|
||||
|
||||
public interface QsvBankService extends BaseService<QsvBank> {
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.budwk.app.zhgh.dayofficework.qsv.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.dayofficework.qsv.models.QsvBank;
|
||||
import com.budwk.app.zhgh.dayofficework.qsv.service.QsvBankService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class QsvBankServiceImpl extends BaseServiceImpl<QsvBank> implements QsvBankService {
|
||||
public QsvBankServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -46,8 +46,8 @@ public class SuggestionBoxMineController {
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/zhghh5/democratic/suggestionBox/mine/index.html")
|
||||
@SaCheckLogin
|
||||
public void h5Index() {
|
||||
@SaCheckPermission("h5.suggestionBox.mine")
|
||||
public void h5() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -24,6 +24,7 @@ import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@@ -48,8 +49,8 @@ public class SuggestionBoxWriteController {
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/zhghh5/democratic/suggestionBox/write/index.html")
|
||||
@SaCheckLogin
|
||||
public void h5Index(){
|
||||
@SaCheckPermission("h5.suggestionBox.write")
|
||||
public void h5(){
|
||||
|
||||
}
|
||||
|
||||
@@ -58,6 +59,7 @@ public class SuggestionBoxWriteController {
|
||||
@ApiOperation("保存申请")
|
||||
@SLog(tag = "建言献策-填写申请", msg = "保存申请")
|
||||
public Result save(@Param("data") SuggestionBox suggestionBox) {
|
||||
suggestionBox.setSubmitTime(new Date());
|
||||
dao.insertOrUpdate(suggestionBox);
|
||||
return Result.success();
|
||||
}
|
||||
@@ -69,6 +71,7 @@ public class SuggestionBoxWriteController {
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(tag = "建言献策-填写申请", msg = "提交申请")
|
||||
public Result submit(@Param("data") SuggestionBox suggestionBox) {
|
||||
suggestionBox.setSubmitTime(new Date());
|
||||
dao.insertOrUpdate(suggestionBox);
|
||||
// 开启流程实例
|
||||
Dict args = Dict.create();
|
||||
|
||||
+2
-3
@@ -1,6 +1,5 @@
|
||||
package com.budwk.app.zhgh.democratic.suggestionBox.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
@@ -43,8 +42,8 @@ public class SuggestionXghController {
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/zhghh5/democratic/suggestionBox/xgh/index.html")
|
||||
@SaCheckPermission("suggestionBox.xgh")
|
||||
public void h5Index() {
|
||||
@SaCheckPermission("h5.suggestionBox.xgh")
|
||||
public void h5() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user