mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-06-07 01:34:05 +08:00
权限优化 && 学员的线上课学习记录重置的进度更新
This commit is contained in:
parent
23ff7068f7
commit
8f27bb9fda
@ -42,7 +42,7 @@ public class ExceptionController {
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public JsonResponse exceptionHandler(Exception e) {
|
||||
log.error("{}-{}", e, e.getMessage());
|
||||
log.error("出现异常", e);
|
||||
return JsonResponse.error("系统错误", 500);
|
||||
}
|
||||
|
||||
@ -101,6 +101,6 @@ public class ExceptionController {
|
||||
@ExceptionHandler(AmazonS3Exception.class)
|
||||
public JsonResponse serviceExceptionHandler(AmazonS3Exception e) {
|
||||
log.error("s3错误={}", e.getMessage());
|
||||
return JsonResponse.error(e.getMessage(), 500);
|
||||
return JsonResponse.error("存储配置有问题或存储无法无法正常访问", 500);
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,6 @@ public class UserCourseHourRecordDestroyListener {
|
||||
|
||||
@EventListener
|
||||
public void updateUserCourseRecord(UserCourseHourRecordDestroyEvent e) {
|
||||
userCourseRecordService.decrease(e.getUserId(), e.getCourseId(), 1);
|
||||
userCourseRecordService.updateUserCourseLearnProgress(e.getUserId(), e.getCourseId(), 1);
|
||||
}
|
||||
}
|
||||
|
@ -51,5 +51,5 @@ public interface UserCourseRecordService extends IService<UserCourseRecord> {
|
||||
|
||||
List<UserCourseRecord> chunks(List<Integer> ids, List<String> fields);
|
||||
|
||||
void decrease(Integer userId, Integer courseId, int count);
|
||||
void updateUserCourseLearnProgress(Integer userId, Integer courseId, int count);
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ public class UserCourseRecordServiceImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decrease(Integer userId, Integer courseId, int count) {
|
||||
public void updateUserCourseLearnProgress(Integer userId, Integer courseId, int count) {
|
||||
UserCourseRecord record = find(userId, courseId);
|
||||
if (record == null) {
|
||||
return;
|
||||
@ -152,12 +152,17 @@ public class UserCourseRecordServiceImpl
|
||||
|
||||
int finishedCount = record.getFinishedCount() - count;
|
||||
|
||||
if (0 == finishedCount) {
|
||||
remove(query().getWrapper().eq("id", record.getId()));
|
||||
return;
|
||||
}
|
||||
|
||||
UserCourseRecord newRecord = new UserCourseRecord();
|
||||
newRecord.setId(record.getId());
|
||||
newRecord.setFinishedCount(finishedCount);
|
||||
newRecord.setIsFinished(0);
|
||||
newRecord.setFinishedAt(null);
|
||||
newRecord.setProgress(finishedCount * 10000 / record.getHourCount());
|
||||
newRecord.setIsFinished(0);
|
||||
newRecord.setFinishedCount(finishedCount);
|
||||
|
||||
updateById(newRecord);
|
||||
}
|
||||
|
@ -66,11 +66,18 @@ public class AdminPermissionCheck implements CommandLineRunner {
|
||||
new AdminPermission[] {
|
||||
new AdminPermission() {
|
||||
{
|
||||
setSort(30);
|
||||
setSort(0);
|
||||
setName("列表");
|
||||
setSlug(BPermissionConstant.RESOURCE_MENU);
|
||||
}
|
||||
},
|
||||
new AdminPermission() {
|
||||
{
|
||||
setSort(10);
|
||||
setName("资源上传");
|
||||
setSlug(BPermissionConstant.UPLOAD);
|
||||
}
|
||||
},
|
||||
});
|
||||
// 学员
|
||||
put(
|
||||
@ -227,13 +234,6 @@ public class AdminPermissionCheck implements CommandLineRunner {
|
||||
.PASSWORD_CHANGE);
|
||||
}
|
||||
},
|
||||
new AdminPermission() {
|
||||
{
|
||||
setSort(35);
|
||||
setName("文件上传");
|
||||
setSlug(BPermissionConstant.UPLOAD);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user