..
This commit is contained in:
@@ -49,6 +49,7 @@ RoleConstant {
|
||||
TEACHER_CONGRESS_DELEGATE_ATTENDANCE("教代会列席代表"),
|
||||
TEACHER_CONGRESS_DELEGATE_SPECIALLY_INVITE("教代会特邀代表"),
|
||||
TEACHER_CONGRESS_DELEGATION_HEAD("教代会代表团团长"),
|
||||
TEACHER_CONGRESS_VICE_DELEGATION_HEAD("教代会代表团副团长"),
|
||||
|
||||
PROPOSAL_COMMITTEE_DIRECTOR("提案委员会主任"),
|
||||
PROPOSAL_COMMITTEE_DEPUTY_DIRECTOR("提案委员会副主任"),
|
||||
|
||||
@@ -81,4 +81,26 @@ public class SysHomeActivityController {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.homeActivity")
|
||||
@ApiOperation("推送大图")
|
||||
public Result push(@Valid String id){
|
||||
Sys_home_activity sysHomeActivity = new Sys_home_activity();
|
||||
sysHomeActivity.setId(id);
|
||||
sysHomeActivity.setPush(true);
|
||||
sysHomeActivityService.updateIgnoreNull(sysHomeActivity);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.homeActivity")
|
||||
@ApiOperation("取消推送大图")
|
||||
public Result cancelPush(@Valid String id){
|
||||
Sys_home_activity sysHomeActivity = new Sys_home_activity();
|
||||
sysHomeActivity.setId(id);
|
||||
sysHomeActivity.setPush(false);
|
||||
sysHomeActivityService.updateIgnoreNull(sysHomeActivity);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.useragent.UserAgent;
|
||||
import cn.hutool.http.useragent.UserAgentUtil;
|
||||
import com.budwk.app.base.constant.RedisConstant;
|
||||
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_home_activity;
|
||||
import com.budwk.app.sys.models.Sys_menu;
|
||||
@@ -29,7 +27,6 @@ import org.nutz.dao.util.Daos;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
@@ -37,17 +34,16 @@ import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
|
||||
import org.nutz.plugins.wkcache.annotation.CacheResult;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@IocBean
|
||||
@@ -148,7 +144,7 @@ public class SysHomeController {
|
||||
@SaCheckLogin
|
||||
@ApiOperation("电脑端推荐应用")
|
||||
@Ok("json")
|
||||
public Result listRecommendApp(String platform) {
|
||||
public Result listRecommendApp(@Param(value = "platform", df = "PC") String platform) {
|
||||
List<Sys_menu> list = sysMenuService.query(Cnd.where(Sys_menu::getIsRecommendApp, "=", 1)
|
||||
.and(Sys_menu::getDisabled, "=", 0)
|
||||
.and(Sys_menu::getShowit, "=", 1)
|
||||
@@ -160,6 +156,23 @@ public class SysHomeController {
|
||||
return Result.success(sysMenus);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("电脑端推荐服务")
|
||||
@Ok("json")
|
||||
public Result listRecommendService(@Param(value = "platform", df = "PC") String platform) {
|
||||
List<Sys_menu> list = sysMenuService.query(Cnd.where(Sys_menu::getIsRecommendService, "=", 1)
|
||||
.and(Sys_menu::getDisabled, "=", 0)
|
||||
.and(Sys_menu::getShowit, "=", 1)
|
||||
.and(Sys_menu::getPlatform, "=", platform)
|
||||
);
|
||||
List<Sys_menu> menus = sysUserService.getMenus(SecurityUtil.getUserId());
|
||||
List<String> allMenuIds = menus.stream().map(Sys_menu::getId).toList();
|
||||
List<Sys_menu> sysMenus = list.stream().filter(m -> allMenuIds.contains(m.getId())).sorted(Comparator.comparingInt(Sys_menu::getLocation)).toList();
|
||||
return Result.success(sysMenus);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("首页推送活动")
|
||||
|
||||
@@ -28,6 +28,11 @@ public class Sys_home_activity extends BaseModel {
|
||||
@Comment("活动封面")
|
||||
private String cover;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
@Comment("活动内容")
|
||||
private String content;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1000)
|
||||
@Comment("活动链接")
|
||||
@@ -65,6 +70,12 @@ public class Sys_home_activity extends BaseModel {
|
||||
@Default("0")
|
||||
private Boolean top;
|
||||
|
||||
@Column
|
||||
@Comment("是否推送大图")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean push;
|
||||
|
||||
@Column
|
||||
@Comment("排序号")
|
||||
@Default("0")
|
||||
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
package com.budwk.app.zhgh.dayofficework.edu.controller;
|
||||
|
||||
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;
|
||||
import com.budwk.app.zhgh.dayofficework.edu.models.EduCourses;
|
||||
import com.budwk.app.zhgh.dayofficework.edu.service.EduCoursesService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
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 java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@At("/platform/edu/personRank")
|
||||
@Ok("json:full")
|
||||
@Api(tags = "个人排行榜")
|
||||
public class EduPersonRankController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private EduCoursesService eduCoursesService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/dayofficework/edu/personRank/index.html")
|
||||
@SaCheckPermission("edu.person.rank")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/courses")
|
||||
@ApiOperation("获取课程列表")
|
||||
@SaCheckPermission("edu.person.rank")
|
||||
public Result getCourses() {
|
||||
List<EduCourses> courses = dao.query(EduCourses.class, Cnd.where(EduCourses::getDisabled, "=", 0).desc(EduCourses::getCreatedAt));
|
||||
return Result.success(courses);
|
||||
}
|
||||
|
||||
@At("/ranking")
|
||||
@ApiOperation("获取排行榜数据")
|
||||
@SaCheckPermission("edu.person.rank")
|
||||
public Result getRanking(@Param("courseId") String courseId,
|
||||
@Param(value = "rankType", df = "watchTime") String rankType,
|
||||
@Param("startDate") String startDate,
|
||||
@Param("endDate") String endDate,
|
||||
PageForm pageForm) {
|
||||
// 学习总时长排序
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
r.userId,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.unitId,
|
||||
u.unionId,
|
||||
u.unitName,
|
||||
u.unionName,
|
||||
SUM(r.watchedDuration) AS totalWatchTime
|
||||
FROM
|
||||
edu_study_records r
|
||||
INNER JOIN vw_user u ON r.userId = u.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("r.courseId", "=", courseId);
|
||||
cnd.andEX("r.lastWatchedTime", ">=", startDate);
|
||||
cnd.andEX("r.lastWatchedTime", "<=", endDate);
|
||||
cnd.groupBy("r.userId");
|
||||
cnd.having(Cnd.where("totalWatchTime", ">", 0));
|
||||
cnd.orderBy("totalWatchTime", "desc");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = eduCoursesService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package com.budwk.app.zhgh.dayofficework.edu.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.edu.models.EduCourses;
|
||||
import com.budwk.app.zhgh.dayofficework.edu.service.EduCoursesService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
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 java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@At("/platform/edu/unionRank")
|
||||
@Ok("json:full")
|
||||
@Api(tags = "工会排行榜")
|
||||
public class EduUnionRankController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private EduCoursesService eduCoursesService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/dayofficework/edu/unionRank/index.html")
|
||||
@SaCheckPermission("edu.union.rank")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/courses")
|
||||
@ApiOperation("获取课程列表")
|
||||
@SaCheckPermission("edu.union.rank")
|
||||
public Result getCourses() {
|
||||
List<EduCourses> courses = dao.query(EduCourses.class, Cnd.where(EduCourses::getDisabled, "=", 0).desc(EduCourses::getCreatedAt));
|
||||
return Result.success(courses);
|
||||
}
|
||||
|
||||
@At("/ranking")
|
||||
@ApiOperation("获取排行榜数据")
|
||||
@SaCheckPermission("edu.union.rank")
|
||||
public Result getRanking(@Param("courseId") String courseId,
|
||||
@Param(value = "rankType", df = "watchTime") String rankType,
|
||||
@Param("startDate") String startDate,
|
||||
@Param("endDate") String endDate,
|
||||
PageForm pageForm) {
|
||||
// 学习总时长排序
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
su.id AS unionId,
|
||||
su.name AS unionName,
|
||||
su.unionCode,
|
||||
COALESCE(participant_count.participantCount, 0) AS participantCount
|
||||
FROM
|
||||
sys_union su
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
u.unionId,
|
||||
COUNT(DISTINCT esr.userId) AS participantCount
|
||||
FROM
|
||||
edu_study_records esr
|
||||
INNER JOIN vw_user u ON esr.userId = u.id
|
||||
WHERE
|
||||
esr.watchedDuration > 0
|
||||
AND u.unionId IS NOT NULL
|
||||
$courseId
|
||||
GROUP BY
|
||||
u.unionId) participant_count ON su.id = participant_count.unionId
|
||||
ORDER BY
|
||||
participantCount DESC,
|
||||
su.NAME
|
||||
""");
|
||||
if(StrUtil.isNotBlank(courseId)){
|
||||
sql.setVar("courseId", "and esr.courseId='" + courseId + "'");
|
||||
}
|
||||
Pagination pagination = eduCoursesService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -172,7 +172,7 @@ public class H5EduController {
|
||||
}
|
||||
|
||||
@At("/study/history")
|
||||
@Ok("beetl:/platform/zhghh5/dayofficework/edu/study/history.html")
|
||||
@Ok("beetl:/platform/zhghh5/dayofficework/edu/history/index.html")
|
||||
@SaCheckLogin
|
||||
@ApiOperation("学习历史页面")
|
||||
public void studyHistory() {
|
||||
|
||||
+224
@@ -0,0 +1,224 @@
|
||||
package com.budwk.app.zhgh.dayofficework.edu.h5controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
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.EduStudyRecords;
|
||||
import com.budwk.app.zhgh.dayofficework.edu.models.EduVideos;
|
||||
import com.budwk.app.zhgh.dayofficework.edu.service.EduCoursesService;
|
||||
import com.budwk.app.zhgh.dayofficework.edu.service.EduStudyRecordsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@At("/platform/h5/edu/studyhis")
|
||||
@Ok("json:full")
|
||||
@Api(tags = "移动端学习历史统计")
|
||||
public class H5EduStudyHisController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private EduCoursesService eduCoursesService;
|
||||
@Inject
|
||||
private EduStudyRecordsService eduStudyRecordsService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhghh5/dayofficework/edu/studyhis/index.html")
|
||||
@SaCheckLogin
|
||||
@ApiOperation("学习历史统计页面")
|
||||
public void studyHistoryPage() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取学习统计数据
|
||||
*/
|
||||
@At("/stats")
|
||||
@SaCheckLogin
|
||||
@ApiOperation("获取学习统计数据")
|
||||
public Result getStudyStats() {
|
||||
try {
|
||||
// 获取用户学习的课程总数
|
||||
Sql courseCountSql = Sqls.create("SELECT COUNT(DISTINCT courseId) as total_courses FROM edu_study_records WHERE userId = @userId");
|
||||
courseCountSql.params().set("userId", SecurityUtil.getUserId());
|
||||
courseCountSql.setCallback(Sqls.callback.maps());
|
||||
dao.execute(courseCountSql);
|
||||
|
||||
int totalCourses = 0;
|
||||
if (!courseCountSql.getList(NutMap.class).isEmpty()) {
|
||||
Object count = courseCountSql.getList(NutMap.class).get(0).get("total_courses");
|
||||
totalCourses = count != null ? ((Number) count).intValue() : 0;
|
||||
}
|
||||
|
||||
// 获取用户完成的视频总数
|
||||
int completedVideos = dao.count(EduStudyRecords.class,
|
||||
Cnd.where("userId", "=", SecurityUtil.getUserId()).and("isCompleted", "=", true));
|
||||
|
||||
// 获取用户总学习时长(秒)
|
||||
Sql watchTimeSql = Sqls.create("SELECT COALESCE(SUM(watchedDuration), 0) as total_watch_time FROM edu_study_records WHERE userId = @userId");
|
||||
watchTimeSql.params().set("userId", SecurityUtil.getUserId());
|
||||
watchTimeSql.setCallback(Sqls.callback.maps());
|
||||
dao.execute(watchTimeSql);
|
||||
|
||||
int totalWatchTime = 0;
|
||||
if (!watchTimeSql.getList(NutMap.class).isEmpty()) {
|
||||
Object time = watchTimeSql.getList(NutMap.class).get(0).get("total_watch_time");
|
||||
totalWatchTime = time != null ? ((Number) time).intValue() : 0;
|
||||
}
|
||||
|
||||
Map<String, Object> stats = new HashMap<>();
|
||||
stats.put("totalCourses", totalCourses);
|
||||
stats.put("completedVideos", completedVideos);
|
||||
stats.put("totalWatchTime", totalWatchTime);
|
||||
|
||||
return Result.success("获取成功", stats);
|
||||
} catch (Exception e) {
|
||||
log.error("获取学习统计数据失败", e);
|
||||
return Result.error("获取失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取学习历史列表
|
||||
*/
|
||||
@At("/history")
|
||||
@SaCheckLogin
|
||||
@ApiOperation("获取学习历史列表")
|
||||
public Result getStudyHistory(@Param("filter") String filter) {
|
||||
try {
|
||||
String userId = SecurityUtil.getUserId();
|
||||
if (StrUtil.isBlank(userId)) {
|
||||
return Result.error("用户未登录");
|
||||
}
|
||||
|
||||
List<EduStudyRecords> historyList;
|
||||
if ("completed".equals(filter)) {
|
||||
// 获取已完成的学习记录
|
||||
historyList = dao.query(EduStudyRecords.class,
|
||||
Cnd.where("userId", "=", userId)
|
||||
.and("isCompleted", "=", true)
|
||||
.orderBy("completedAt", "desc"));
|
||||
} else if ("inProgress".equals(filter)) {
|
||||
// 获取进行中的学习记录
|
||||
historyList = dao.query(EduStudyRecords.class,
|
||||
Cnd.where("userId", "=", userId)
|
||||
.and("isCompleted", "=", false)
|
||||
.and("watchedDuration", ">", 0)
|
||||
.orderBy("updatedAt", "desc"));
|
||||
} else {
|
||||
// 获取所有学习记录
|
||||
historyList = dao.query(EduStudyRecords.class,
|
||||
Cnd.where("userId", "=", userId)
|
||||
.orderBy("updatedAt", "desc"));
|
||||
}
|
||||
|
||||
return Result.success("获取成功", historyList);
|
||||
} catch (Exception e) {
|
||||
log.error("获取学习历史失败", e);
|
||||
return Result.error("获取失败");
|
||||
}
|
||||
}
|
||||
|
||||
@At("/progress/detail")
|
||||
@SaCheckLogin
|
||||
@ApiOperation("获取课程详细进度")
|
||||
public Result getCourseProgressDetail(@Param("courseId") String courseId) {
|
||||
try {
|
||||
if (StrUtil.isBlank(courseId)) {
|
||||
return Result.error("课程ID不能为空");
|
||||
}
|
||||
|
||||
String userId = SecurityUtil.getUserId();
|
||||
if (userId == null) {
|
||||
return Result.error("用户未登录");
|
||||
}
|
||||
|
||||
// 获取课程信息
|
||||
EduCourses course = dao.fetch(EduCourses.class, courseId);
|
||||
if (course == null) {
|
||||
return Result.error("课程不存在");
|
||||
}
|
||||
|
||||
// 获取课程章节和视频
|
||||
List<EduChapters> chapters = dao.query(EduChapters.class,
|
||||
Cnd.where("courseId", "=", courseId).orderBy("sortCode", "asc"));
|
||||
|
||||
List<Map<String, Object>> chapterList = new ArrayList<>();
|
||||
int totalVideos = 0;
|
||||
int completedVideos = 0;
|
||||
int totalWatchTime = 0;
|
||||
|
||||
for (EduChapters chapter : chapters) {
|
||||
List<EduVideos> videos = dao.query(EduVideos.class,
|
||||
Cnd.where("chapterId", "=", chapter.getId()).orderBy("sortCode", "asc"));
|
||||
|
||||
List<Map<String, Object>> videoList = new ArrayList<>();
|
||||
|
||||
for (EduVideos video : videos) {
|
||||
totalVideos++;
|
||||
|
||||
// 获取学习记录
|
||||
EduStudyRecords record = dao.fetch(EduStudyRecords.class,
|
||||
Cnd.where("userId", "=", userId)
|
||||
.and("videoId", "=", video.getId())
|
||||
.and("courseId", "=", courseId));
|
||||
|
||||
boolean isCompleted = record != null && record.getIsCompleted();
|
||||
if (isCompleted) completedVideos++;
|
||||
|
||||
int watchDuration = record != null ? (record.getWatchedDuration() != null ? record.getWatchedDuration() : 0) : 0;
|
||||
totalWatchTime += watchDuration;
|
||||
|
||||
Map<String, Object> videoInfo = new HashMap<>();
|
||||
videoInfo.put("videoId", video.getId());
|
||||
videoInfo.put("title", video.getTitle());
|
||||
videoInfo.put("duration", video.getDuration());
|
||||
videoInfo.put("isCompleted", isCompleted);
|
||||
videoInfo.put("watchDuration", watchDuration);
|
||||
videoInfo.put("lastWatchTime", record != null ? record.getLastWatchedTime() : null);
|
||||
|
||||
videoList.add(videoInfo);
|
||||
}
|
||||
|
||||
Map<String, Object> chapterInfo = new HashMap<>();
|
||||
chapterInfo.put("chapterId", chapter.getId());
|
||||
chapterInfo.put("title", chapter.getTitle());
|
||||
chapterInfo.put("videos", videoList);
|
||||
|
||||
chapterList.add(chapterInfo);
|
||||
}
|
||||
|
||||
Map<String, Object> progressDetail = new HashMap<>();
|
||||
progressDetail.put("course", course);
|
||||
progressDetail.put("chapters", chapterList);
|
||||
progressDetail.put("totalVideos", totalVideos);
|
||||
progressDetail.put("completedVideos", completedVideos);
|
||||
progressDetail.put("totalWatchTime", totalWatchTime);
|
||||
progressDetail.put("completionRate", totalVideos > 0 ? (double) completedVideos / totalVideos * 100 : 0);
|
||||
|
||||
return Result.success(progressDetail);
|
||||
} catch (Exception e) {
|
||||
log.error("获取课程详细进度失败", e);
|
||||
return Result.error("获取课程详细进度失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -25,6 +25,26 @@ public class EduStudyRecords extends BaseModel {
|
||||
@Column
|
||||
private String userId;
|
||||
|
||||
@Comment("单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Column
|
||||
private String unitId;
|
||||
|
||||
@Comment("单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Column
|
||||
private String unitName;
|
||||
|
||||
@Comment("工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Column
|
||||
private String unionId;
|
||||
|
||||
@Comment("工会名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@Column
|
||||
private String unionName;
|
||||
|
||||
@Comment("视频ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Column
|
||||
|
||||
@@ -16,6 +16,9 @@ import java.util.List;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@TableIndexes(value = {
|
||||
@Index(name = "INDEX_GLOBAL_MESSAGE_STATUS", fields = "status", unique = false)
|
||||
})
|
||||
@Comment("全局消息")
|
||||
public class GlobalMessage extends BaseModel {
|
||||
|
||||
|
||||
+7
@@ -14,6 +14,13 @@ import java.util.Date;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@TableIndexes(value =
|
||||
{
|
||||
@Index(name = "INDEX_GLOBAL_MESSAGE_RECEIVER_MESSAGEID", fields = "messageId", unique = false),
|
||||
@Index(name = "INDEX_GLOBAL_MESSAGE_RECEIVER_RECEIVERID", fields = "receiverId", unique = false),
|
||||
@Index(name = "INDEX_GLOBAL_MESSAGE_RECEIVER_ISREAD", fields = "isRead", unique = false)
|
||||
}
|
||||
)
|
||||
@Comment("全局消息接收用户")
|
||||
public class GlobalMessageReceiver extends BaseModel {
|
||||
|
||||
|
||||
+174
@@ -0,0 +1,174 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.dashboard;
|
||||
|
||||
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.flow.engine.model.ProcessModel;
|
||||
import com.budwk.app.flow.engine.model.TaskModel;
|
||||
import com.budwk.app.flow.entity.ProcessDefine;
|
||||
import com.budwk.app.flow.service.ProcessDefineService;
|
||||
import com.budwk.app.sys.models.Sys_dict;
|
||||
import com.budwk.app.sys.services.SysDictService;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/proposal/dashboard")
|
||||
@Api("提案数据看板")
|
||||
@Ok("json:full")
|
||||
public class ProposalDashboardController {
|
||||
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
@Inject
|
||||
private ProcessDefineService processDefineService;
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/dashboard/index.html")
|
||||
@SaCheckPermission("proposal.dashboard")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.dashboard")
|
||||
public Result listNode(@Param("sessionId") String sessionId) {
|
||||
List<NutMap> nodes = new ArrayList<>();
|
||||
|
||||
// 提案总数
|
||||
nodes.add(NutMap.NEW().addv("name", "提案总数").addv("id", "total").addv("type", "total").addv("count", 0));
|
||||
|
||||
// 节点
|
||||
ProcessDefine define = processDefineService.getLastByName("JDHTA");
|
||||
ProcessModel processModel = processDefineService.processDefineToModel(define);
|
||||
List<TaskModel> taskModels = processModel.getTasks();
|
||||
|
||||
List<String> excludeNodes = new ArrayList<>(3);
|
||||
excludeNodes.add("撰写提案");
|
||||
excludeNodes.add("邀请附议人");
|
||||
excludeNodes.add("提案附议");
|
||||
|
||||
List<NutMap> taskNodes = taskModels.stream().filter(taskModel -> !excludeNodes.contains(taskModel.getDisplayName()))
|
||||
.map(taskModel -> NutMap.NEW()
|
||||
.addv("name", taskModel.getDisplayName())
|
||||
.addv("id", taskModel.getName())
|
||||
.addv("type", "task")
|
||||
.addv("count", 0)).toList();
|
||||
nodes.addAll(taskNodes);
|
||||
|
||||
// 立案结果
|
||||
List<Sys_dict> caseFilingResult = sysDictService.getSubListByCode("PROPOSAL_CASE_FILING_RESULT");
|
||||
for (Sys_dict dict : caseFilingResult) {
|
||||
nodes.add(NutMap.NEW()
|
||||
.addv("name", dict.getName())
|
||||
.addv("id", dict.getCode())
|
||||
.addv("type", "caseFilingResult")
|
||||
.addv("count", 0));
|
||||
}
|
||||
|
||||
// 查询待办任务
|
||||
Sql todoSql = Sqls.create("""
|
||||
SELECT
|
||||
t.taskName
|
||||
FROM
|
||||
wf_process_task t
|
||||
INNER JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
INNER JOIN proposal_info info ON info.id = ins.businessNo
|
||||
WHERE
|
||||
t.taskState = 10
|
||||
AND info.sessionId = @sessionId
|
||||
""");
|
||||
todoSql.setParam("sessionId", sessionId);
|
||||
List<NutMap> todoTasks = processDefineService.listMap(todoSql);
|
||||
|
||||
for (NutMap node : nodes) {
|
||||
if (node.getString("type").equals("task")) {
|
||||
long count = todoTasks.stream().filter(task -> task.getString("taskName").equals(node.getString("id"))).count();
|
||||
node.put("count", count);
|
||||
} else if (node.getString("type").equals("total")) {
|
||||
int count = dao.count(ProposalInfo.class, Cnd.where(ProposalInfo::getSessionId, "=", sessionId));
|
||||
node.put("count", count);
|
||||
} else if (node.getString("type").equals("caseFilingResult")) {
|
||||
int count = dao.count(ProposalInfo.class, Cnd.where(ProposalInfo::getSessionId, "=", sessionId).and(ProposalInfo::getCaseFilingResult, "=", node.getString("id")));
|
||||
node.put("count", count);
|
||||
}
|
||||
}
|
||||
|
||||
return Result.success(nodes);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.dashboard")
|
||||
public Result pageData(PageForm pageForm, String sessionId, String selectNodeId, String selectNodeType) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
COUNT(p.consolidationIds) > 0 AS isConsolidation,
|
||||
type.name AS typeName,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.displayName curTaskName,
|
||||
JSON_UNQUOTE(JSON_EXTRACT(caseTasks.variable, '$.tf_hostUnitName')) AS masterUnitName,
|
||||
caseTasks.variable->>'$.tf_helpUnitNameStr' AS slaveUnitNames
|
||||
FROM
|
||||
proposal_info info
|
||||
LEFT JOIN proposal_consolidation p ON JSON_CONTAINS(p.consolidationIds, JSON_QUOTE(info.id))
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
LEFT JOIN teacher_congress_session tcs on tcs.id = info.sessionId
|
||||
LEFT JOIN teacher_congress_delegation tcd on tcd.id = info.delegationId
|
||||
LEFT JOIN teacher_congress_delegate tcde on tcde.loginName = info.createUserLoginName
|
||||
LEFT JOIN wf_process_instance ins ON ins.businessNo = info.id
|
||||
LEFT JOIN (SELECT processInstanceId, MAX(finishTime) AS finishTime FROM wf_process_task WHERE taskName = '9846ab38-40c5-4093-bafc-a9b3b443338b' AND taskState = 20 GROUP BY processInstanceId) latestTasks ON latestTasks.processInstanceId = ins.id
|
||||
LEFT JOIN wf_process_task caseTasks ON caseTasks.processInstanceId = ins.id AND caseTasks.taskName = '9846ab38-40c5-4093-bafc-a9b3b443338b' AND caseTasks.taskState = 20 AND caseTasks.finishTime = latestTasks.finishTime
|
||||
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id AND t.taskState = 10
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("info.sessionId", "=", sessionId);
|
||||
cnd.groupBy("info.id");
|
||||
|
||||
if(StrUtil.isNotBlank(selectNodeType) && StrUtil.isNotBlank(selectNodeId)){
|
||||
switch (selectNodeType){
|
||||
case "task":
|
||||
cnd.and("t.taskName", "=", selectNodeId);
|
||||
break;
|
||||
case "total":
|
||||
break;
|
||||
case "caseFilingResult":
|
||||
cnd.and("info.caseFilingResult", "=", selectNodeId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+45
@@ -120,6 +120,51 @@ public class ProposalMineController {
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.mine")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result selectOne(@Valid String id){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.name AS typeName,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IF((SELECT taskName FROM wf_process_task tt WHERE tt.id = t.taskParentId) = 'startTask', 1, 0) canRevoke,
|
||||
(select MAX(id) from wf_process_task where processInstanceId = ins.id and taskName = 'startTask' AND taskState in (10,20)) AS startTaskId
|
||||
FROM
|
||||
proposal_info info
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
LEFT JOIN teacher_congress_session tcs on tcs.id = info.sessionId
|
||||
LEFT JOIN teacher_congress_delegation tcd on tcd.id = info.delegationId
|
||||
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
|
||||
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id AND t.taskState = 10
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("info.id", "=", id);
|
||||
cnd.groupBy("info.id");
|
||||
sql.setCondition(cnd);
|
||||
NutMap data = proposalCommonService.fetchMap(sql);
|
||||
return Result.success(data);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.mine")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.transact;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
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 javax.validation.Valid;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/proposal/vice/delegation")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
@Api(tags = "提案-办理-副团长查阅")
|
||||
public class ProposalViceDelegationController {
|
||||
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/viceDelegation/index.html")
|
||||
@SaCheckPermission("proposal.vice.delegation")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/h5")
|
||||
@Ok("beetl:/platform/zhghh5/democratic/proposal/transact/viceDelegation/index.html")
|
||||
@SaCheckPermission("proposal.vice.delegation")
|
||||
public void h5Index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.vice.delegation")
|
||||
@ApiOperation("分页列表")
|
||||
public Result pageData(@Valid ProposalSearchParam pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.NAME AS typeName,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
ins.processDefineId instanceProcessDefineId,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId
|
||||
FROM
|
||||
proposal_info info
|
||||
LEFT JOIN proposal_type type ON type.id = info.typeId
|
||||
LEFT JOIN teacher_congress_session tcs ON tcs.id = info.sessionId
|
||||
LEFT JOIN teacher_congress_delegation tcd ON tcd.id = info.delegationId
|
||||
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
|
||||
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id\s
|
||||
AND t.taskState = 10
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) {
|
||||
cnd.and("info.delegationId", "in", proposalCommonService.getSelfManageDelegationIds());
|
||||
}
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.groupBy("info.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -129,8 +129,8 @@ public class ProposalInfo extends BaseModel {
|
||||
|
||||
@Column
|
||||
@Comment("建议落实部门")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String implementUnitName;
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> suggestUnits;
|
||||
|
||||
@Column
|
||||
@Comment("提案状态")
|
||||
|
||||
+2
-1
@@ -457,7 +457,8 @@ public class ProposalCommonServiceImpl extends BaseServiceImpl<ProposalInfo> imp
|
||||
@Override
|
||||
public List<String> getSelfManageDelegationIds() {
|
||||
Sys_role role = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_DELEGATION_HEAD.name());
|
||||
List<Sys_user_role> sysUserRoles = dao().query(Sys_user_role.class, Cnd.where(Sys_user_role::getRoleId, "=", role.getId())
|
||||
Sys_role viceRole = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_VICE_DELEGATION_HEAD.name());
|
||||
List<Sys_user_role> sysUserRoles = dao().query(Sys_user_role.class, Cnd.where(Sys_user_role::getRoleId, "in", List.of(role.getId(), viceRole.getId()))
|
||||
.and(Sys_user_role::getUserId, "=", SecurityUtil.getUserId()));
|
||||
List<String> delegationIds = sysUserRoles.stream()
|
||||
.map(Sys_user_role::getTcDelegationId)
|
||||
|
||||
+31
-17
@@ -18,7 +18,9 @@ import com.budwk.app.sys.services.SysRoleService;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegation.models.Teacher_congress_delegation;
|
||||
import com.budwk.app.zhgh.democratic.teachercongress.delegation.models.Teacher_congress_delegation_unit;
|
||||
import io.swagger.annotations.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -69,25 +71,25 @@ public class TeacherCongressDelegationController {
|
||||
@POST
|
||||
@SaCheckPermission("tc.delegation")
|
||||
@ApiOperation(value = "届次信息列表", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "sessionId", value = "届次ID", dataType = "String", paramType = "query"),
|
||||
@ApiImplicitParam(name = "delegationId", value = "代表团ID", dataType = "String", paramType = "query")
|
||||
})
|
||||
public Result pageData(@Valid @ApiParam(value = "分页表单") PageForm pageForm, @Valid @ApiParam(value = "届次ID") String sessionId) {
|
||||
Sys_role role = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_DELEGATION_HEAD);
|
||||
Sys_role role2 = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_VICE_DELEGATION_HEAD);
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tcd.*,
|
||||
tcs.fullName as sessionName,
|
||||
GROUP_CONCAT(u.username,u.loginname) as delegationHead
|
||||
GROUP_CONCAT(u.username,u.loginname) as delegationHead,
|
||||
GROUP_CONCAT(u2.username,u2.loginname) as viceDelegationHead
|
||||
FROM
|
||||
teacher_congress_delegation tcd
|
||||
LEFT JOIN teacher_congress_session tcs ON tcs.id = tcd.sessionId
|
||||
LEFT JOIN sys_user_role sur ON sur.tcDelegationId = tcd.id
|
||||
AND sur.roleId = @roleId
|
||||
LEFT JOIN sys_user_role sur ON sur.tcDelegationId = tcd.id AND sur.roleId = @roleId
|
||||
LEFT JOIN sys_user u ON u.id = sur.userId
|
||||
LEFT JOIN sys_user_role sur2 ON sur2.tcDelegationId = tcd.id AND sur2.roleId = @roleId2
|
||||
LEFT JOIN sys_user u2 ON u2.id = sur2.userId
|
||||
$condition""");
|
||||
sql.setParam("roleId", role.getId());
|
||||
sql.setParam("roleId2", role2.getId());
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("tcd.sessionId", "=", sessionId);
|
||||
cnd.asc("tcd.code");
|
||||
@@ -241,8 +243,8 @@ public class TeacherCongressDelegationController {
|
||||
public Result notHeadUser(@Valid String sessionId, @Valid String delegationId, String keyWord) {
|
||||
Sql sql = Sqls.create("select userId,loginName,userName,unitName from teacher_congress_delegate $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("delegationId","=",delegationId);
|
||||
cnd.and("sessionId","=",sessionId);
|
||||
cnd.and("delegationId", "=", delegationId);
|
||||
cnd.and("sessionId", "=", sessionId);
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("loginName", keyWord);
|
||||
seg.orLike("userName", keyWord);
|
||||
@@ -261,8 +263,14 @@ public class TeacherCongressDelegationController {
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("tc.delegation")
|
||||
public Result headUser(@Valid String sessionId, @Valid String delegationId) {
|
||||
Sys_role role = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_DELEGATION_HEAD);
|
||||
public Result headUser(@Valid String sessionId, @Valid String delegationId, @Param(value = "type", df = "TEACHER_CONGRESS_DELEGATION_HEAD") String type) {
|
||||
Sys_role role = null;
|
||||
if (type.equals(RoleConstant.TEACHER_CONGRESS_DELEGATION_HEAD.name())) {
|
||||
role = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_DELEGATION_HEAD);
|
||||
} else {
|
||||
role = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_VICE_DELEGATION_HEAD);
|
||||
}
|
||||
|
||||
Record record = dao.fetch("sys_user_role", Cnd.where("tcSessionId", "=", sessionId).and("tcDelegationId", "=", delegationId).and("roleId", "=", role.getId()));
|
||||
String userId = Optional.ofNullable(record).map(r -> r.getString("userId")).orElse(null);
|
||||
|
||||
@@ -297,17 +305,23 @@ public class TeacherCongressDelegationController {
|
||||
@At
|
||||
@SaCheckPermission("tc.delegation")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result insertHead(@Valid String delegationId, @Valid String sessionId, @Valid String userId) {
|
||||
public Result insertHead(@Valid String delegationId, @Valid String sessionId, @Valid String userId, String viceUserId) {
|
||||
// 团长
|
||||
Sys_role role = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_DELEGATION_HEAD);
|
||||
|
||||
//删除权限 只能有一个团长
|
||||
dao.clear(Sys_user_role.class, Cnd.where(Sys_user_role::getTcDelegationId, "=", delegationId)
|
||||
.and(Sys_user_role::getTcSessionId, "=", sessionId)
|
||||
.and(Sys_user_role::getRoleId, "=", role.getId())
|
||||
);
|
||||
|
||||
//再加
|
||||
dao.insert("sys_user_role", Chain.make("userId", userId).add("roleId", role.getId()).add("tcDelegationId", delegationId).add("tcSessionId", sessionId));
|
||||
|
||||
// 副团长
|
||||
Sys_role role2 = sysRoleService.getByCode(RoleConstant.TEACHER_CONGRESS_VICE_DELEGATION_HEAD);
|
||||
dao.clear(Sys_user_role.class, Cnd.where(Sys_user_role::getTcDelegationId, "=", delegationId)
|
||||
.and(Sys_user_role::getTcSessionId, "=", sessionId)
|
||||
.and(Sys_user_role::getRoleId, "=", role2.getId())
|
||||
);
|
||||
dao.insert("sys_user_role", Chain.make("userId", viceUserId).add("roleId", role2.getId()).add("tcDelegationId", delegationId).add("tcSessionId", sessionId));
|
||||
|
||||
sysUserService.clearCache();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user