mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-07 01:46:47 +08:00
Compare commits
13 Commits
fceb6ac805
...
zcwy0923-w
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
002542accc | ||
|
|
df770d22d5 | ||
|
|
638aa9ee93 | ||
|
|
f9b8761951 | ||
|
|
ea2c6edc9f | ||
|
|
7db1a03379 | ||
|
|
fd3afef917 | ||
|
|
b1ef78aae2 | ||
|
|
f5ac7519e4 | ||
|
|
6f2236f3be | ||
|
|
66e4e73dd2 | ||
|
|
2c967cef0a | ||
|
|
45fce7927d |
@@ -13,12 +13,12 @@ import com.xboe.module.exam.entity.ExamTest;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.system.user.dao.UserDao;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -66,6 +66,10 @@ public class ThirdApi {
|
||||
|
||||
@Value("${manageApi.editExam}")
|
||||
private String editExam;
|
||||
|
||||
@Value("${userBasic.getUserBasicInfo}")
|
||||
private String getUserBasicInfo;
|
||||
|
||||
//获取例外人员的id
|
||||
public List<String> getUserId(){
|
||||
String responseBody = Optional.ofNullable(HttpRequest.get(infarasApiUrl+"?pid=316&type=1").execute() //prod 316
|
||||
@@ -268,4 +272,32 @@ public class ThirdApi {
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 虽然当前已存在接口查询用户基本信息,目前仅仅包括用户名、工号、用户ID
|
||||
*/
|
||||
public List<UserBasicInfo> getUserBasicInfoByUserId(List<String> userIds, HttpServletRequest request) {
|
||||
String token = request.getHeader("Xboe-Access-Token");
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
token = request.getHeader("token");
|
||||
}
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
token = request.getHeader("x-access-token");
|
||||
}
|
||||
|
||||
// 将userIds列表转换为逗号分隔的字符串
|
||||
String userIdsStr = userIds.stream()
|
||||
.collect(Collectors.joining(","));
|
||||
String url = getUserBasicInfo +"?userIds=" + userIdsStr;
|
||||
|
||||
String respStr = Optional.ofNullable(HttpRequest
|
||||
.get(url)
|
||||
.header("token", token)
|
||||
.execute().body()).orElseThrow(() -> new RuntimeException("用户中心用户数据获取失败"));
|
||||
|
||||
UserBasicInfoResult userBasicInfoResult = JSONUtil.parseObj(respStr).toBean(UserBasicInfoResult.class);
|
||||
List<UserBasicInfo> basicInfos = userBasicInfoResult.getResult();
|
||||
return basicInfos;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserBasicInfo {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 用户名。
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 工号。
|
||||
*/
|
||||
private String workNum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@Slf4j
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserBasicInfoResult {
|
||||
|
||||
private String error;
|
||||
private String message;
|
||||
private String permissions;
|
||||
private List<UserBasicInfo> result;
|
||||
private int status;
|
||||
private Date timestamp;
|
||||
|
||||
public UserBasicInfoResult success() {
|
||||
if (this.status != 200) {
|
||||
log.error("获取用户基本信息失败----{}", JSONUtil.toJsonPrettyStr(this));
|
||||
return null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,6 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -17,9 +12,9 @@ import java.util.zip.ZipOutputStream;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.api.vo.UserBasicInfo;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.module.course.entity.*;
|
||||
import com.xboe.module.course.vo.TeacherVo;
|
||||
@@ -43,22 +38,44 @@ import com.xboe.common.Pagination;
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.module.course.dto.CourseQueryDto;
|
||||
import com.xboe.module.course.dto.CourseTeacherDto;
|
||||
import com.xboe.module.course.dto.RankingDto;
|
||||
import com.xboe.module.course.entity.*;
|
||||
import com.xboe.module.course.service.ICourseContentService;
|
||||
import com.xboe.module.course.service.ICourseSectionService;
|
||||
import com.xboe.module.course.service.ICourseService;
|
||||
import com.xboe.module.course.service.ICourseTeacherService;
|
||||
import com.xboe.module.course.vo.CourseStudyVo;
|
||||
import com.xboe.module.course.vo.TeacherVo;
|
||||
import com.xboe.module.teacher.entity.Teacher;
|
||||
import com.xboe.module.teacher.service.ITeacherService;
|
||||
import com.xboe.module.usergroup.service.IUserGroupService;
|
||||
import com.xboe.school.study.dao.StudyCourseDao;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.school.study.entity.StudyCourseItem;
|
||||
import com.xboe.school.study.entity.StudyHomeWork;
|
||||
import com.xboe.school.study.service.IStudyCourseService;
|
||||
|
||||
import com.xboe.school.study.service.IStudyHomeWorkService;
|
||||
import com.xboe.school.study.service.IStudyService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
|
||||
/**
|
||||
@@ -365,13 +382,15 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
}
|
||||
//作业导出
|
||||
@GetMapping("/export")
|
||||
public JsonResponse<String> export(String courseName,String courseId,String contentId,String name,Integer status) throws IOException {
|
||||
public JsonResponse<String> export(String courseId,String courseName,String contentId,String name,Integer status,HttpServletRequest request) throws IOException {
|
||||
Map<String, String>map=new HashMap<>();
|
||||
List<String> userIds = studyCourseDao.findList(FieldFilters.eq("courseId", courseId)).stream().filter(Objects::nonNull).map(StudyCourse::getAid).collect(Collectors.toList());
|
||||
if (userIds.isEmpty()){
|
||||
return error("查询不到用户");
|
||||
}
|
||||
List<User>user=studyService.getUserNo(userIds);
|
||||
|
||||
List <UserBasicInfo> userBasicInfoList =thirdApi.getUserBasicInfoByUserId(userIds,request);
|
||||
|
||||
try {//筛选出的人员
|
||||
List<StudyCourseItem> list = studyService.getList(courseId, contentId, name, status);
|
||||
if(list.isEmpty()){
|
||||
@@ -383,12 +402,12 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
return success("暂无数据");
|
||||
}
|
||||
studyHomeWorks.forEach(e->{
|
||||
user.forEach(u->{
|
||||
if(u.getId().equals(s.getAid())){
|
||||
userBasicInfoList.forEach(u->{
|
||||
if(u.getUserId().equals(s.getAid())){
|
||||
//取后缀
|
||||
int dotIndex = e.getFilePath().lastIndexOf('.'); // 查找最后一个'.'的位置
|
||||
String extension = e.getFilePath().substring(dotIndex);
|
||||
map.put(u.getName()+"-"+u.getUserNo()+extension,"/home/www/elearning/upload"+e.getFilePath());
|
||||
map.put(u.getUserName()+"-"+u.getWorkNum()+extension,"/home/www/elearning/upload"+e.getFilePath());
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -404,60 +423,79 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
if (totalFileSize > 2L * 1024 * 1024 * 1024) {
|
||||
return success("您要下载的作业过大,请分批下载或联系管理员!");
|
||||
}
|
||||
|
||||
// String encodedFilename = URLEncoder.encode(courseName+"【作业】.zip")
|
||||
// .replace("+", "%20") // 空格替换为"%20"
|
||||
// .replace("%2F", "/"); // 解决斜杠问题
|
||||
// StringBuilder contentDispositionValue = new StringBuilder();
|
||||
// contentDispositionValue.append("attachment; filename=\"")
|
||||
// .append(encodedFilename)
|
||||
// .append("\"")
|
||||
// .append("; filename*=utf-8''")
|
||||
// .append(encodedFilename);
|
||||
//
|
||||
// // 设置响应类型和Content-Disposition头
|
||||
// response.setContentType("application/zip");
|
||||
|
||||
// 创建压缩文件
|
||||
String zipFilePath = "/home/www/elearning/upload/saveZip/" + courseName+"【作业】" + ".zip";
|
||||
createZipFile(map, zipFilePath);
|
||||
return success(zipFilePath);
|
||||
// 创建一个临时文件用于存储ZIP文件
|
||||
File tempZipFile = new File("/home/www/elearning/upload/temp.zip");
|
||||
// File tempZipFile = new File("/home/www/elearning/upload/temp.zip");
|
||||
//
|
||||
// try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(tempZipFile))) {
|
||||
// for (Map.Entry<String, String> e : map.entrySet()) {
|
||||
// File fileToZip = new File(e.getValue());
|
||||
// // 添加 ZIP 条目
|
||||
// ZipEntry entry = new ZipEntry(e.getKey());
|
||||
// entry.setSize(fileToZip.length());
|
||||
//
|
||||
// zos.putNextEntry(entry);
|
||||
//
|
||||
// try (FileInputStream fis = new FileInputStream(fileToZip)) {
|
||||
// byte[] buffer = new byte[4096];
|
||||
// int len;
|
||||
// while ((len = fis.read(buffer)) > 0) {
|
||||
// zos.write(buffer, 0, len);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// zos.closeEntry();
|
||||
// }
|
||||
// }
|
||||
// // 将临时文件移动到指定位置
|
||||
// Path source = tempZipFile.toPath();
|
||||
// //生成uuid
|
||||
//// String uuid = UUID.randomUUID().toString();
|
||||
// Path destination = Paths.get("/home/www/elearning/upload/saveZip/" + courseName+"【作业】" + ".zip");
|
||||
//
|
||||
// // 确保目标目录存在
|
||||
// Files.createDirectories(destination.getParent());
|
||||
//
|
||||
// // 删除目标文件如果已存在
|
||||
// if (Files.exists(destination)) {
|
||||
// Files.delete(destination);
|
||||
// }
|
||||
//
|
||||
// // 移动文件
|
||||
// Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING);
|
||||
//
|
||||
// // 返回文件路径给前端
|
||||
// String filePath = destination.toAbsolutePath().toString();
|
||||
// return success(filePath);
|
||||
}
|
||||
private static void createZipFile(Map<String, String> map, String zipFilePath) throws IOException {
|
||||
try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFilePath))) {
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = entry.getValue();
|
||||
|
||||
try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(tempZipFile))) {
|
||||
for (Map.Entry<String, String> e : map.entrySet()) {
|
||||
File fileToZip = new File(e.getValue());
|
||||
// 添加 ZIP 条目
|
||||
ZipEntry entry = new ZipEntry(e.getKey());
|
||||
entry.setSize(fileToZip.length());
|
||||
File file = new File(value);
|
||||
if (!file.exists()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
zos.putNextEntry(entry);
|
||||
byte[] buffer = new byte[1024];
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
ZipEntry zipEntry = new ZipEntry(key);
|
||||
zos.putNextEntry(zipEntry);
|
||||
|
||||
try (FileInputStream fis = new FileInputStream(fileToZip)) {
|
||||
byte[] buffer = new byte[4096];
|
||||
int len;
|
||||
while ((len = fis.read(buffer)) > 0) {
|
||||
zos.write(buffer, 0, len);
|
||||
}
|
||||
int length;
|
||||
while ((length = fis.read(buffer)) > 0) {
|
||||
zos.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
zos.closeEntry();
|
||||
fis.close();
|
||||
}
|
||||
}
|
||||
// 将临时文件移动到指定位置
|
||||
Path source = tempZipFile.toPath();
|
||||
//生成uuid
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
Path destination = Paths.get("/home/www/elearning/upload/saveZip/" + uuid + ".zip");
|
||||
|
||||
// 删除目标文件如果已存在
|
||||
if (Files.exists(destination)) {
|
||||
Files.delete(destination);
|
||||
}
|
||||
|
||||
// 移动文件
|
||||
Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING);
|
||||
|
||||
// 返回文件路径给前端
|
||||
String filePath = destination.toAbsolutePath().toString();
|
||||
return success(filePath);
|
||||
}
|
||||
@GetMapping("/detail-study")
|
||||
public JsonResponse<List<CourseStudyVo>> detailStudy(String courseId, String aid){
|
||||
|
||||
@@ -117,7 +117,7 @@ public class StudyExam extends IdEntity {
|
||||
/*
|
||||
* 开始时间
|
||||
* */
|
||||
@JsonFormat(pattern = "yyyy--MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Column(name = "start_time")
|
||||
private LocalDateTime startTime;
|
||||
/*
|
||||
|
||||
@@ -99,5 +99,4 @@ public interface IStudyService {
|
||||
|
||||
List<StudyCourseItem> getList(String courseId, String contentId, String name, Integer status);
|
||||
|
||||
List<User> getUserNo(List<String> userIds);
|
||||
}
|
||||
|
||||
@@ -1,24 +1,9 @@
|
||||
package com.xboe.school.study.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.core.orm.QueryBuilder;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.system.user.entity.Message;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.core.orm.QueryBuilder;
|
||||
import com.xboe.core.orm.UpdateBuilder;
|
||||
import com.xboe.module.course.dao.CourseContentDao;
|
||||
import com.xboe.module.course.dao.CourseExamDao;
|
||||
import com.xboe.module.course.entity.CourseExam;
|
||||
@@ -28,6 +13,17 @@ import com.xboe.school.study.dao.StudyExamDao;
|
||||
import com.xboe.school.study.entity.StudyCourseItem;
|
||||
import com.xboe.school.study.entity.StudyExam;
|
||||
import com.xboe.school.study.service.IStudyExamService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -73,29 +69,31 @@ public class StudyExamServiceImpl implements IStudyExamService{
|
||||
exam.setPassLine(0);
|
||||
}
|
||||
|
||||
int prog=exam.getScore().intValue()>=exam.getPassLine()?100:exam.getScore().intValue();
|
||||
//完成处理,判断是否已存在
|
||||
Object obj=scItemDao.findField("id", FieldFilters.eq("studyId", exam.getStudyId()), FieldFilters.eq("contentId", exam.getContentId()));
|
||||
//获取本次考试提交,学习状态与学习进度
|
||||
int status=exam.getScore()>=exam.getPassLine()?StudyCourseItem.STATUS_FINISH:StudyCourseItem.STATUS_STUDYING;
|
||||
int progress = exam.getScore().intValue() >= exam.getPassLine() ? 100 : 0;
|
||||
//计算时长
|
||||
LocalDateTime ldt=LocalDateTime.now();
|
||||
|
||||
if(obj==null) {
|
||||
StudyCourseItem sci=new StudyCourseItem();
|
||||
LocalDateTime ldt=LocalDateTime.now();
|
||||
sci.setStudyId(exam.getStudyId());
|
||||
sci.setContentId(exam.getContentId());
|
||||
sci.setContentName("考试");
|
||||
sci.setCourseId(exam.getCourseId());
|
||||
//sci.setCsectionId(homework.getCsectionId());
|
||||
sci.setProgress(prog);//直接设置为学习完成
|
||||
sci.setProgress(progress);//直接设置为学习完成
|
||||
sci.setStatus(status);//状态直接更新为已完成
|
||||
sci.setStartTime(ldt);
|
||||
sci.setStartTime(exam.getStartTime());
|
||||
sci.setAid(exam.getStudentId());
|
||||
sci.setAname(exam.getStudentName());
|
||||
sci.setFinishTime(LocalDateTime.now());
|
||||
sci.setFinishTime(ldt);
|
||||
sci.setLastStudyTime(0);//此项用户记录视频内容当前学习的时间点
|
||||
sci.setLastTime(ldt);
|
||||
if(cexam.getScoringType()==CourseExam.SCORINGTYPE_LAST) {
|
||||
sci.setScore(exam.getScore());
|
||||
}
|
||||
sci.setScore(exam.getScore());
|
||||
sci.setStudyDuration(exam.getTestDuration());
|
||||
scItemDao.save(sci);
|
||||
exam.setStudyItemId(sci.getId());
|
||||
dao.save(exam);
|
||||
@@ -108,35 +106,34 @@ public class StudyExamServiceImpl implements IStudyExamService{
|
||||
|
||||
}else {
|
||||
exam.setStudyItemId(obj.toString());//此项就是学习条目的id
|
||||
Float maxScore = (Float) dao.findField("max(score)", FieldFilters.eq("contentId", exam.getContentId()), FieldFilters.eq("courseId", exam.getCourseId()), FieldFilters.eq("studyId", exam.getStudyId()));
|
||||
dao.save(exam);
|
||||
if(cexam.getScoringType()==CourseExam.SCORINGTYPE_LAST){
|
||||
scItemDao.updateFieldById(exam.getStudyItemId(), "score",exam.getScore());
|
||||
scItemDao.updateFieldById(exam.getStudyItemId(), "progress",prog);
|
||||
if(exam.getScore()>=exam.getPassLine()){
|
||||
scItemDao.updateFieldById(exam.getStudyId(), "progress",100);
|
||||
scItemDao.updateFieldById(exam.getStudyId(), "finish_time",LocalDateTime.now());
|
||||
scItemDao.updateFieldById(exam.getStudyId(), "status",StudyCourseItem.STATUS_FINISH);
|
||||
scItemDao.updateFieldById(exam.getStudyId(), "score",exam.getScore());
|
||||
//scDao.updateFieldById(exam.getStudyId(), "last_score",100.0f);
|
||||
//最新考试分值
|
||||
if (cexam.getScoringType() == CourseExam.SCORINGTYPE_LAST) {
|
||||
scItemDao.updateMultiFieldById(exam.getStudyItemId(),
|
||||
UpdateBuilder.create("startTime", exam.getStartTime()),
|
||||
UpdateBuilder.create("finishTime", ldt),
|
||||
UpdateBuilder.create("score", exam.getScore()),
|
||||
UpdateBuilder.create("progress", progress),
|
||||
UpdateBuilder.create("status", status),
|
||||
UpdateBuilder.create("studyDuration", exam.getTestDuration())
|
||||
);
|
||||
}
|
||||
|
||||
//最高分
|
||||
if (cexam.getScoringType() == CourseExam.SCORINGTYPE_MAX) {
|
||||
if (exam.getScore() > maxScore) {
|
||||
scItemDao.updateMultiFieldById(exam.getStudyItemId(),
|
||||
UpdateBuilder.create("startTime", exam.getStartTime()),
|
||||
UpdateBuilder.create("finishTime", LocalDateTime.now()),
|
||||
UpdateBuilder.create("score", exam.getScore()),
|
||||
UpdateBuilder.create("progress", progress),
|
||||
UpdateBuilder.create("status", status)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
//1最高一次,用于最高一次的计算
|
||||
if(cexam.getScoringType()==CourseExam.SCORINGTYPE_MAX) {
|
||||
Float f=(Float)dao.findField("max(score)", FieldFilters.eq("contentId", exam.getContentId()), FieldFilters.eq("courseId", exam.getCourseId()), FieldFilters.eq("studyId", exam.getStudyId()));
|
||||
scItemDao.updateFieldById(exam.getStudyItemId(), "score", f);
|
||||
scItemDao.updateFieldById(exam.getStudyItemId(), "status", f>=exam.getPassLine()?StudyCourseItem.STATUS_FINISH:StudyCourseItem.STATUS_STUDYING);
|
||||
scItemDao.updateFieldById(exam.getStudyItemId(), "progress",f>=exam.getPassLine()?100:f.intValue());
|
||||
|
||||
if(f>=exam.getPassLine()){
|
||||
scItemDao.updateFieldById(exam.getStudyId(), "progress",100);
|
||||
scItemDao.updateFieldById(exam.getStudyId(), "finish_time",LocalDateTime.now());
|
||||
scItemDao.updateFieldById(exam.getStudyId(), "status",StudyCourseItem.STATUS_FINISH);
|
||||
scItemDao.updateFieldById(exam.getStudyId(), "score",exam.getScore());
|
||||
//scDao.updateFieldById(exam.getStudyId(), "last_score",100.0f);
|
||||
}
|
||||
|
||||
}
|
||||
int totalContent = courseContentDao.getCount(exam.getCourseId());
|
||||
scDao.finishCheck(exam.getStudyId(),exam.getCourseId(),totalContent,token);
|
||||
scDao.updateFieldById(exam.getStudyId(), "last_score",exam.getScore());
|
||||
|
||||
@@ -64,6 +64,7 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
|
||||
int totalContent=courseContentDao.count(FieldFilters.eq("courseId", homework.getCourseId()),FieldFilters.eq("deleted",false));
|
||||
scDao.finishCheck(homework.getStudyId(),homework.getCourseId(),totalContent,token);
|
||||
}else {
|
||||
scItemDao.updateFieldById(obj.toString(), "finishTime", LocalDateTime.now());
|
||||
//只是保留一条作业记录,不再保存多条记录了
|
||||
//dao.save(homework);
|
||||
//设置id。然后进行悠
|
||||
|
||||
@@ -294,16 +294,11 @@ public class StudyServiceImpl implements IStudyService{
|
||||
|
||||
}
|
||||
if(StringUtils.isNotBlank(name)) {
|
||||
query.addFilter(FieldFilters.eq("aname", name));
|
||||
query.addFilter(FieldFilters.like("aname", name));
|
||||
}
|
||||
return scItemDao.findList(query.builder());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> getUserNo(List<String> userIds) {
|
||||
return userDao.findList(FieldFilters.in("id", userIds));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateProcess(String studyContentId,String studyId, String courseId,Integer total, Integer progress,String token) {
|
||||
|
||||
@@ -74,4 +74,5 @@ manageApi.stu.offcourse=${boe.domain}/manageApi/stu/offcourse/getOffCourseId
|
||||
manageApi.editExam=${boe.domain}/manageApi/admin/project/editExam
|
||||
#获取离职教师id
|
||||
userBasic.getTeacherIds=${boe.domain}/userbasic/user/getTeacherInfo
|
||||
coursesuilt.getStudyStatus=${boe.domain}/manageApi/stu/project/completeStatus
|
||||
coursesuilt.getStudyStatus=${boe.domain}/manageApi/stu/project/completeStatus
|
||||
userBasic.getUserBasicInfo=${boe.domain}/userbasic/user/getUserBasicInfo
|
||||
|
||||
Reference in New Issue
Block a user