bug整改
This commit is contained in:
+6
-1
@@ -12,6 +12,7 @@ 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 org.nutz.dao.Cnd;
|
||||
@@ -35,6 +36,8 @@ public class EduCoursesController {
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private EduCoursesService eduCoursesService;
|
||||
@Inject
|
||||
private EduStudyRecordsService eduStudyRecordsService;
|
||||
|
||||
@At("/courses")
|
||||
@Ok("beetl:/platform/zhgh/dayofficework/edu/courses/index.html")
|
||||
@@ -81,7 +84,7 @@ public class EduCoursesController {
|
||||
dao.execute(Sqls.create("delete from edu_study_records where courseId=\'" + id + "\'"));
|
||||
//理论学习视频表
|
||||
dao.execute(Sqls.create("delete from edu_videos " +
|
||||
"where courseId in (select id from from edu_chapters where courseId=\'" + id + "\')"));
|
||||
"where chapterId in (select id from edu_chapters where courseId=\'" + id + "\')"));
|
||||
//理论学习视频章节表
|
||||
dao.execute(Sqls.create("delete from edu_chapters where courseId=\'" + id + "\'"));
|
||||
//理论学习课程表
|
||||
@@ -171,6 +174,8 @@ public class EduCoursesController {
|
||||
@ApiOperation("删除")
|
||||
@SLog(tag = "理论学习课程", msg = "删除课程视频,id:${args[0]}")
|
||||
public Result deleteVideo(@Param("id") String id) {
|
||||
// 删除视频时同步清理学习记录,避免已删除视频继续影响学习进度。
|
||||
eduStudyRecordsService.deleteStudyRecordsByVideoId(id);
|
||||
dao.delete(EduVideos.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
+2
-23
@@ -114,29 +114,8 @@ public class H5EduController {
|
||||
return Result.error("用户未登录");
|
||||
}
|
||||
|
||||
// 获取课程总视频数
|
||||
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(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());
|
||||
|
||||
int completedVideos = completedVideoIds.size();
|
||||
|
||||
java.util.Map<String, Object> progressData = new java.util.HashMap<>();
|
||||
progressData.put("totalVideos", totalVideos);
|
||||
progressData.put("completedVideos", completedVideos);
|
||||
progressData.put("completedVideoIds", completedVideoIds);
|
||||
|
||||
return Result.success(progressData);
|
||||
// 进度只按课程当前仍存在的视频统计,删除旧视频后要立即反映到进度条上。
|
||||
return Result.success(eduStudyRecordsService.getCurrentCourseProgress(userId, courseId));
|
||||
} catch (Exception e) {
|
||||
log.error("获取课程进度失败", e);
|
||||
return Result.error("获取课程进度失败");
|
||||
|
||||
+15
@@ -4,6 +4,7 @@ import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.dayofficework.edu.models.EduStudyRecords;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName EduStudyRecordsService
|
||||
@@ -54,6 +55,20 @@ public interface EduStudyRecordsService extends BaseService<EduStudyRecords> {
|
||||
*/
|
||||
StudyProgressStats getCourseProgressStats(String userId, String courseId);
|
||||
|
||||
/**
|
||||
* 按课程当前仍存在的视频重新计算学习进度,避免已删除视频的历史记录继续参与统计。
|
||||
* @param userId 用户ID
|
||||
* @param courseId 课程ID
|
||||
* @return 当前课程学习进度数据
|
||||
*/
|
||||
Map<String, Object> getCurrentCourseProgress(String userId, String courseId);
|
||||
|
||||
/**
|
||||
* 删除视频时同步清理该视频的学习记录,避免历史脏数据影响后续进度统计。
|
||||
* @param videoId 视频ID
|
||||
*/
|
||||
void deleteStudyRecordsByVideoId(String videoId);
|
||||
|
||||
/**
|
||||
* 学习进度统计信息
|
||||
*/
|
||||
|
||||
+65
@@ -2,6 +2,7 @@ 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.EduChapters;
|
||||
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.EduStudyRecordsService;
|
||||
@@ -12,8 +13,12 @@ import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName EduStudyRecordsServiceImpl
|
||||
@@ -195,4 +200,64 @@ public class EduStudyRecordsServiceImpl extends BaseServiceImpl<EduStudyRecords>
|
||||
return new StudyProgressStats(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCurrentCourseProgress(String userId, String courseId) {
|
||||
try {
|
||||
List<EduChapters> chapters = dao().query(EduChapters.class,
|
||||
Cnd.where(EduChapters::getCourseId, "=", courseId));
|
||||
List<String> chapterIds = chapters.stream().map(EduChapters::getId).collect(Collectors.toList());
|
||||
Map<String, Object> progressData = new HashMap<>();
|
||||
|
||||
if (chapterIds.isEmpty()) {
|
||||
progressData.put("totalVideos", 0);
|
||||
progressData.put("completedVideos", 0);
|
||||
progressData.put("completedVideoIds", Collections.emptyList());
|
||||
return progressData;
|
||||
}
|
||||
|
||||
List<EduVideos> currentVideos = dao().query(EduVideos.class,
|
||||
Cnd.where(EduVideos::getChapterId, "in", chapterIds));
|
||||
List<String> currentVideoIds = currentVideos.stream().map(EduVideos::getId).collect(Collectors.toList());
|
||||
if (currentVideoIds.isEmpty()) {
|
||||
progressData.put("totalVideos", 0);
|
||||
progressData.put("completedVideos", 0);
|
||||
progressData.put("completedVideoIds", Collections.emptyList());
|
||||
return progressData;
|
||||
}
|
||||
|
||||
// 只统计当前课程仍存在的视频,避免已删除视频的学习记录继续影响进度条。
|
||||
List<EduStudyRecords> completedRecords = dao().query(EduStudyRecords.class,
|
||||
Cnd.where(EduStudyRecords::getUserId, "=", userId)
|
||||
.and(EduStudyRecords::getCourseId, "=", courseId)
|
||||
.and(EduStudyRecords::getIsCompleted, "=", 1)
|
||||
.and(EduStudyRecords::getVideoId, "in", currentVideoIds));
|
||||
List<String> completedVideoIds = completedRecords.stream()
|
||||
.map(EduStudyRecords::getVideoId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
progressData.put("totalVideos", currentVideoIds.size());
|
||||
progressData.put("completedVideos", completedVideoIds.size());
|
||||
progressData.put("completedVideoIds", completedVideoIds);
|
||||
return progressData;
|
||||
} catch (Exception e) {
|
||||
log.error("按当前课程视频计算学习进度失败", e);
|
||||
Map<String, Object> progressData = new HashMap<>();
|
||||
progressData.put("totalVideos", 0);
|
||||
progressData.put("completedVideos", 0);
|
||||
progressData.put("completedVideoIds", Collections.emptyList());
|
||||
return progressData;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteStudyRecordsByVideoId(String videoId) {
|
||||
try {
|
||||
dao().clear(EduStudyRecords.class, Cnd.where(EduStudyRecords::getVideoId, "=", videoId));
|
||||
} catch (Exception e) {
|
||||
log.error("删除视频学习记录失败, videoId={}", videoId, e);
|
||||
throw new BaseException("删除视频学习记录失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+23
-12
@@ -1,6 +1,7 @@
|
||||
package com.budwk.app.zhgh.dayofficework.qsv.h5controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -102,7 +103,7 @@ public class H5QsvQuizController {
|
||||
List<String> subjectIds = lastRecordOptional.get().getSubjectIds();
|
||||
Cnd cnd = Cnd.where("id", "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
cnd.orderBy("sortNum","asc");
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
answerRecordId = lastRecordOptional.get().getId();
|
||||
} else {
|
||||
@@ -114,7 +115,7 @@ public class H5QsvQuizController {
|
||||
List<String> subjectIds = answerRecord.getSubjectIds();
|
||||
Cnd cnd = Cnd.where("id", "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
cnd.orderBy("sortNum","asc");
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
}
|
||||
} else {
|
||||
@@ -143,7 +144,7 @@ public class H5QsvQuizController {
|
||||
List<String> subjectIds = answerRecord.getSubjectIds();
|
||||
Cnd cnd = Cnd.where("id", "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
cnd.orderBy("sortNum","asc");
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
}
|
||||
} else {
|
||||
@@ -169,7 +170,7 @@ public class H5QsvQuizController {
|
||||
}
|
||||
Cnd cnd = Cnd.where("id", "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
cnd.orderBy("sortNum","asc");
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
repeatTips = true;
|
||||
} else {
|
||||
@@ -179,7 +180,7 @@ public class H5QsvQuizController {
|
||||
List<String> subjectIds = maxAnswerRecordOptional.get().getSubjectIds();
|
||||
Cnd cnd = Cnd.where("id", "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
cnd.orderBy("sortNum","asc");
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
answerRecordId = maxAnswerRecordOptional.get().getId();
|
||||
} else {
|
||||
@@ -192,7 +193,7 @@ public class H5QsvQuizController {
|
||||
List<String> subjectIds = maxAnswerRecordOptional.get().getSubjectIds();
|
||||
Cnd cnd = Cnd.where("id", "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
cnd.orderBy("sortNum","asc");
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
answerRecordId = maxAnswerRecordOptional.get().getId();
|
||||
} else {
|
||||
@@ -206,7 +207,7 @@ public class H5QsvQuizController {
|
||||
List<String> subjectIds = notFinishRecordOptional.get().getSubjectIds();
|
||||
Cnd cnd = Cnd.where("id", "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
cnd.orderBy("sortNum","asc");
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
answerRecordId = notFinishRecordOptional.get().getId();
|
||||
} else {
|
||||
@@ -244,7 +245,7 @@ public class H5QsvQuizController {
|
||||
List<String> subjectIds = maxAnswerRecordOptional.get().getSubjectIds();
|
||||
Cnd cnd = Cnd.where("id", "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
cnd.orderBy("sortNum","asc");
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
answerRecordId = maxAnswerRecordOptional.get().getId();
|
||||
} else {
|
||||
@@ -280,7 +281,7 @@ public class H5QsvQuizController {
|
||||
List<String> subjectIds = answerRecord.getSubjectIds();
|
||||
Cnd cnd = Cnd.where("id", "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
cnd.orderBy("sortNum","asc");
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
} else {
|
||||
//今天最大那次的记录
|
||||
@@ -291,7 +292,7 @@ public class H5QsvQuizController {
|
||||
List<String> subjectIds = maxTodayRecord.get().getSubjectIds();
|
||||
Cnd cnd = Cnd.where("id", "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
cnd.orderBy("sortNum","asc");
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
} else {
|
||||
throw new RuntimeException("业务异常");
|
||||
@@ -305,9 +306,12 @@ public class H5QsvQuizController {
|
||||
answerRecordId = answerRecord.getId();
|
||||
|
||||
List<String> subjectIds = answerRecord.getSubjectIds();
|
||||
if(CollectionUtil.isEmpty(subjectIds)){
|
||||
throw new RuntimeException("题目列表为空!请检查答题显示日期");
|
||||
}
|
||||
Cnd cnd = Cnd.where("id", "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
cnd.orderBy("sortNum","asc");
|
||||
resultSubjects = dao.query(QsvSubject.class, cnd);
|
||||
}
|
||||
}
|
||||
@@ -340,6 +344,13 @@ public class H5QsvQuizController {
|
||||
float totalScore = 0;
|
||||
|
||||
for (QsvAnswerParam.Subject subject : qsvAnswerParam.getSubjects()) {
|
||||
QsvSubject dbSubject = dao.fetch(QsvSubject.class, subject.getId());
|
||||
if (ObjectUtil.isNotEmpty(dbSubject) && "checkbox".equals(dbSubject.getType())
|
||||
&& ObjectUtil.isNotEmpty(dbSubject.getMaxMulti()) && dbSubject.getMaxMulti() > 0
|
||||
&& CollectionUtil.size(subject.getUserSelectOptionIds()) > dbSubject.getMaxMulti()) {
|
||||
// 后端兜底校验最大可选数,避免绕过前端直接提交超限答案。
|
||||
return Result.error("题目【" + dbSubject.getTitle() + "】最多只能选择" + dbSubject.getMaxMulti() + "项");
|
||||
}
|
||||
JSONObject entries = extJson.get(subject.getId(), JSONObject.class);
|
||||
if (ObjectUtil.isNotEmpty(entries)) {
|
||||
entries.set("optionIds", subject.getUserSelectOptionIds());
|
||||
@@ -384,7 +395,7 @@ public class H5QsvQuizController {
|
||||
|
||||
Cnd cnd = Cnd.where("id", "in", subjectIds);
|
||||
String dynamic = subjectIds.stream().map(id -> "'" + id + "'").collect(Collectors.joining(","));
|
||||
cnd.and(new Static("1=1 ORDER BY FIELD (id," + dynamic + ")"));
|
||||
cnd.orderBy("sortNum","asc");
|
||||
|
||||
List<QsvSubject> subjects = dao.query(QsvSubject.class, cnd);
|
||||
dao.fetchLinks(subjects, "options", Cnd.NEW().asc("sortNum"));
|
||||
|
||||
+30
-27
@@ -1,20 +1,15 @@
|
||||
package com.budwk.app.zhgh.staffmanage.member.controller.info;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
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.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.sys.models.Sys_role;
|
||||
import com.budwk.app.sys.models.Sys_union;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.sys.models.Sys_user_role;
|
||||
import com.budwk.app.zhgh.staffmanage.member.models.MemberChangeRecord;
|
||||
import com.budwk.app.zhgh.staffmanage.member.param.pageform.MemberInfoPageForm;
|
||||
import com.budwk.app.zhgh.staffmanage.member.service.MemberInfoService;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
@@ -22,27 +17,13 @@ import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
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 org.nutz.mvc.annotation.POST;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author hqw
|
||||
* @name:MemberInfoInputController
|
||||
* @Date 2026/4/8 19:31
|
||||
* @注释 人员补录
|
||||
* 人员补录
|
||||
*/
|
||||
@At("/platform/member/info/input")
|
||||
@Ok("json:full")
|
||||
@@ -58,7 +39,6 @@ public class MemberInfoInputController {
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("member.info.input")
|
||||
public Result pageData(MemberInfoPageForm pageForm) {
|
||||
@@ -74,30 +54,53 @@ public class MemberInfoInputController {
|
||||
@SLog(tag = "会员信息录入", type = "add", msg = "新增会员")
|
||||
public Result add(Sys_user user, String unionId, String unitId) {
|
||||
try {
|
||||
memberInfoService.addMember(user,unionId,unitId);
|
||||
memberInfoService.addMember(user, unionId, unitId);
|
||||
return Result.success("新增成功");
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("member.info.input")
|
||||
public Result findOne(@Param("recordId") String recordId, @Param("userId") String userId) {
|
||||
try {
|
||||
return Result.success(memberInfoService.getMemberInputDetail(recordId, userId));
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@POST
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("member.info.input")
|
||||
@SLog(tag = "人员补录", msg = "删除会员")
|
||||
@SLog(tag = "人员补录", type = "update", msg = "编辑补录人员")
|
||||
public Result update(Sys_user user, String unionId, String unitId, String recordId) {
|
||||
try {
|
||||
memberInfoService.updateMemberInput(user, unionId, unitId, recordId);
|
||||
return Result.success("编辑成功");
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@POST
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("member.info.input")
|
||||
@SLog(tag = "人员补录", msg = "删除会员")
|
||||
public Result doDelete(String id, String userId) {
|
||||
try {
|
||||
memberInfoService.dao().delete(MemberChangeRecord.class, id);
|
||||
Sys_role memberRole = memberInfoService.dao().fetch(Sys_role.class, Cnd.where("code", "=", RoleConstant.MEMBER.name()));
|
||||
Sys_role publicRole = memberInfoService.dao().fetch(Sys_role.class, Cnd.where("code", "=", RoleConstant.PUBLIC.name()));
|
||||
memberInfoService.dao().execute(Sqls.create("delete from sys_user_role where userId = \'"+userId+"\' and roleId = \'"+publicRole.getId()+"\'"));
|
||||
memberInfoService.dao().execute(Sqls.create("delete from sys_user_role where userId = \'"+userId+"\' and roleId = \'"+memberRole.getId()+"\'"));
|
||||
memberInfoService.dao().execute(Sqls.create("delete from sys_user_role where userId = '" + userId + "' and roleId = '" + publicRole.getId() + "'"));
|
||||
memberInfoService.dao().execute(Sqls.create("delete from sys_user_role where userId = '" + userId + "' and roleId = '" + memberRole.getId() + "'"));
|
||||
memberInfoService.dao().delete(Sys_user.class, userId);
|
||||
return Result.success("删除成功");
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -237,5 +237,10 @@ public class MemberChangeRecord extends BaseModel {
|
||||
@ColDefine(type = ColType.VARCHAR,width = 10)
|
||||
private String aidFundMemberUserType;
|
||||
|
||||
@Column
|
||||
@Comment("入校时间")
|
||||
@ColDefine(type = ColType.DATE)
|
||||
private String arrivalAtSchoolDate;
|
||||
|
||||
private Boolean edit;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,23 @@ public interface MemberInfoService extends BaseService<Sys_user> {
|
||||
*/
|
||||
void addMember(Sys_user user, String unionId, String unitId);
|
||||
|
||||
/**
|
||||
* 获取人员补录编辑详情
|
||||
* @param recordId 补录记录ID
|
||||
* @param userId 用户ID
|
||||
* @return 编辑详情
|
||||
*/
|
||||
NutMap getMemberInputDetail(String recordId, String userId);
|
||||
|
||||
/**
|
||||
* 更新人员补录信息
|
||||
* @param user 用户信息
|
||||
* @param unionId 工会ID
|
||||
* @param unitId 单位ID
|
||||
* @param recordId 补录记录ID
|
||||
*/
|
||||
void updateMemberInput(Sys_user user, String unionId, String unitId, String recordId);
|
||||
|
||||
/**
|
||||
* 获取会员历史
|
||||
* @param pageForm
|
||||
|
||||
+92
@@ -268,6 +268,98 @@ public class MemberInfoServiceImpl extends BaseServiceImpl<Sys_user> implements
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public NutMap getMemberInputDetail(String recordId, String userId) {
|
||||
MemberChangeRecord record = dao().fetch(MemberChangeRecord.class, recordId);
|
||||
if (ObjectUtil.isEmpty(record)) {
|
||||
throw new BaseException("补录记录不存在");
|
||||
}
|
||||
Sys_user user = dao().fetch(Sys_user.class, userId);
|
||||
if (ObjectUtil.isEmpty(user)) {
|
||||
throw new BaseException("人员信息不存在");
|
||||
}
|
||||
NutMap detail = NutMap.NEW();
|
||||
detail.putAll(BeanUtil.beanToMap(user));
|
||||
// 编辑页复用新增表单,需要把补录记录中的单位/工会及记录ID一起回填。
|
||||
detail.put("recordId", record.getId());
|
||||
detail.put("unitId", record.getUnitId());
|
||||
detail.put("unitName", record.getUnitName());
|
||||
detail.put("unionId", record.getUnionId());
|
||||
detail.put("unionName", record.getUnionName());
|
||||
return detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public void updateMemberInput(Sys_user user, String unionId, String unitId, String recordId) {
|
||||
if (StrUtil.isBlank(user.getId())) {
|
||||
throw new BaseException("用户ID不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(recordId)) {
|
||||
throw new BaseException("补录记录ID不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(user.getLoginname())) {
|
||||
throw new BaseException("工号不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(user.getUsername())) {
|
||||
throw new BaseException("姓名不能为空");
|
||||
}
|
||||
Sys_user existUser = dao().fetch(Sys_user.class, Cnd.where("loginname", "=", user.getLoginname()).and("id", "!=", user.getId()));
|
||||
if (ObjectUtil.isNotEmpty(existUser)) {
|
||||
throw new BaseException("该工号已存在");
|
||||
}
|
||||
Sys_user oldUser = dao().fetch(Sys_user.class, user.getId());
|
||||
if (ObjectUtil.isEmpty(oldUser)) {
|
||||
throw new BaseException("人员信息不存在");
|
||||
}
|
||||
user.setCreateAt(oldUser.getCreateAt());
|
||||
user.setLoginCount(oldUser.getLoginCount());
|
||||
user.setDisabled(false);
|
||||
if (user.getMember() == null) {
|
||||
user.setMember(oldUser.getMember());
|
||||
}
|
||||
if (user.getWelfareMember() == null) {
|
||||
user.setWelfareMember(oldUser.getWelfareMember());
|
||||
}
|
||||
dao().updateIgnoreNull(user);
|
||||
|
||||
MemberChangeRecord record = dao().fetch(MemberChangeRecord.class, recordId);
|
||||
if (ObjectUtil.isEmpty(record)) {
|
||||
throw new BaseException("补录记录不存在");
|
||||
}
|
||||
Sys_unit unit = dao().fetch(Sys_unit.class, Cnd.where("id", "=", unitId));
|
||||
Sys_union union = dao().fetch(Sys_union.class, Cnd.where("id", "=", unionId));
|
||||
// 补录列表展示来源于变更记录,编辑时同步更新记录内容,保证列表和详情一致。
|
||||
record.setLoginname(user.getLoginname());
|
||||
record.setUsername(user.getUsername());
|
||||
record.setUnitId(unitId);
|
||||
record.setUnitName(ObjectUtil.isNotEmpty(unit) ? unit.getName() : "");
|
||||
record.setUnionId(unionId);
|
||||
record.setUnionName(ObjectUtil.isNotEmpty(union) ? union.getName() : "");
|
||||
record.setSex(user.getSex());
|
||||
record.setBirthday(user.getBirthday());
|
||||
record.setIdCard(user.getIdCard());
|
||||
record.setNation(user.getNation());
|
||||
record.setPolitical(user.getPolitical());
|
||||
record.setEducation(user.getEducation());
|
||||
record.setAcademicDegree(user.getAcademicDegree());
|
||||
record.setPosition(user.getProfessionalTitle());
|
||||
record.setUserState(user.getUserState());
|
||||
record.setPreparedBy(user.getPreparedBy());
|
||||
record.setPersonType(user.getPersonType());
|
||||
record.setMobile(user.getMobile());
|
||||
record.setEmail(user.getEmail());
|
||||
record.setMember(user.getMember());
|
||||
record.setWelfareMember(user.getWelfareMember());
|
||||
record.setRetireDate(user.getRetireDate());
|
||||
record.setFamilies(user.getFamilies());
|
||||
record.setPersonalData(user.getPersonalData());
|
||||
record.setUserAttribute(user.getUserAttribute());
|
||||
record.setCampus(user.getCampus());
|
||||
record.setProfessionalTitle(user.getProfessionalTitle());
|
||||
record.setAidFundMemberUserType(user.getAidFundMemberUserType());
|
||||
dao().updateIgnoreNull(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sql getMemberHistorySql(MemberInfoPageForm pageForm) {
|
||||
|
||||
+3
-1
@@ -95,7 +95,7 @@ public class MemberManageServiceImpl extends BaseServiceImpl<Sys_user> implement
|
||||
u.isModelWorker,
|
||||
u.userAttribute,
|
||||
u.aidFundMemberUserType,
|
||||
u.arrivalAtSchooDate,
|
||||
u.arrivalAtSchoolDate,
|
||||
his.id hisId,
|
||||
his.changeTypes,
|
||||
his.changeTime
|
||||
@@ -221,10 +221,12 @@ public class MemberManageServiceImpl extends BaseServiceImpl<Sys_user> implement
|
||||
allowChangeFieldNames.add("member");
|
||||
allowChangeFieldNames.add("aidFundMemberUserType");
|
||||
allowChangeFieldNames.add("userAttribute");
|
||||
allowChangeFieldNames.add("arrivalAtSchoolDate");
|
||||
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(Sys_dict::getCode, Sys_dict::getName));
|
||||
dictMap.put("member", "会员状态");
|
||||
dictMap.put("aidFundMemberUserType", "人员分类");
|
||||
dictMap.put("userAttribute", "人员属性");
|
||||
dictMap.put("arrivalAtSchoolDate", "入校时间");
|
||||
return NutMap.NEW().addv("allowChangeFieldNames", allowChangeFieldNames).addv("dictMap", dictMap);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user