Compare commits

..

43 Commits

Author SHA1 Message Date
zhaolongfei
a15537ef20 删除考试根据名称条件筛选 2024-08-27 16:59:40 +08:00
zhaolongfei
89573debef 在线课考试添加任务计算,redis放开 2024-08-23 19:43:18 +08:00
zhaolongfei
24ae3c0ec6 在线课考试添加任务计算,暂时注释redis 2024-08-23 19:27:31 +08:00
zhaolongfei
fffa12344a 在线课考试添加任务计算,回退 2024-08-23 18:54:38 +08:00
zhaolongfei
a4b034752d 在线课考试添加任务计算 2024-08-23 18:45:10 +08:00
zhaolongfei
06415d58ac 在线课考试添加任务计算 2024-08-23 18:30:05 +08:00
zhaolongfei
bebe36d39e 在线课考试添加任务计算 2024-08-23 18:00:26 +08:00
zhaolongfei
d42d1b2e83 处理study接口,添加接口访问限制次数 2024-08-23 17:55:53 +08:00
nisen
f0fe015561 Merge branch 'zcwy0731-llf' into master-0705 2024-08-06 17:52:08 +08:00
zhaolongfei
91bcec00ef 修复同步到item表没有名称问题 2024-08-06 14:42:05 +08:00
nisen
7a210ec701 Merge branch 'zcwy0731-llf' into master-0705 2024-08-05 19:03:09 +08:00
zhaolongfei
6c616a1163 在线课作业重复提交报错修复 2024-08-05 15:12:54 +08:00
zhaolongfei
939325d5bd 在线课作业重复提交报错修复 2024-08-05 15:05:28 +08:00
zhaolongfei
4eddbc8e8f 在线管理资源完成情况名称搜索修复 2024-08-05 11:21:14 +08:00
zhaolongfei
50bdd59a26 在线管理资源完成情况名称搜索修复 2024-08-05 11:11:12 +08:00
zhaolongfei
b85eb97bc1 在线管理资源完成情况名称搜索修复 2024-08-05 10:57:14 +08:00
zhaolongfei
28b58a73cf 在线管理资源完成情况名称搜索修复 2024-08-05 10:29:36 +08:00
zhaolongfei
b9adf4c45f 作业多次点击提交报错修复 2024-08-02 17:08:00 +08:00
zhaolongfei
49aab74463 作业多次点击提交报错修复 2024-08-02 13:19:08 +08:00
zhaolongfei
9f30910d04 作业多次点击提交报错修复 2024-08-02 11:32:14 +08:00
zhaolongfei
6658b8c04b 作业多次点击提交报错修复 2024-08-02 11:03:13 +08:00
zhaolongfei
19df4224a9 作业多次点击提交报错修复 2024-08-02 10:16:05 +08:00
zhaolongfei
95ddc9f5d5 作业多次点击提交报错修复 2024-08-02 09:36:36 +08:00
nisen
f3b6bb6fee Merge branch 'zcwy0731-llf' into master-0705
# Conflicts:
#	servers/boe-server-all/src/main/java/com/xboe/module/exam/entity/ExamTest.java
2024-08-01 17:43:07 +08:00
zhaolongfei
64965f5ec6 考试管理删除不同步 2024-07-31 19:01:53 +08:00
zhaolongfei
a407ca2dad 考试管理删除不同步 2024-07-31 18:35:49 +08:00
nisen
16f1c2337b Merge branch 'zcwy0716-llf' into master-0705 2024-07-30 15:46:41 +08:00
zhaolongfei
bf476a23a0 在线管理状态完成情况 2024-07-30 14:05:06 +08:00
nisen
0f0edaf2cd Merge branch 'zcwy0729-llf' into master-0705 2024-07-30 11:56:45 +08:00
nisen
68d00e8c51 Merge branch 'zcwy0716-llf' into master-0705 2024-07-29 19:56:17 +08:00
zhaolongfei
41a542ea23 Merge remote-tracking branch 'java-servse-yx/zcwy0606-llf' into zcwy0729-llf
# Conflicts:
#	servers/boe-server-all/src/main/java/com/xboe/module/exam/api/ExamTestApi.java
#	servers/boe-server-all/src/main/java/com/xboe/module/exam/service/impl/ExamTestServiceImpl.java
2024-07-29 19:52:50 +08:00
zhaolongfei
fc98025a3a 视频暂存为空判断 2024-07-29 19:21:26 +08:00
zhaolongfei
e2c697f860 修改bug 2024-06-19 16:43:08 +08:00
zhaolongfei
c6a785bb4f 添加视频暂存点 2024-06-19 13:55:54 +08:00
zhaolongfei
8567fa9ecc content表添加processVideo字段,添加判断 2024-06-18 13:47:46 +08:00
zhaolongfei
359b66e48a content表添加processVideo字段,添加判断 2024-06-18 13:31:39 +08:00
zhaolongfei
8125a6bd77 content表添加processVideo字段,添加判断 2024-06-18 11:12:08 +08:00
zhaolongfei
9b37e8a73d content表添加processVideo字段,添加判断 2024-06-18 09:09:52 +08:00
zhaolongfei
2fa3378e94 content表添加processVideo字段 2024-06-17 16:16:29 +08:00
zhaolongfei
0b7784779f item添加processVideo字段 2024-06-13 15:28:13 +08:00
zhaolongfei
e03118275d 修改项目下考试结束时间并未生效修复 2024-06-06 18:10:28 +08:00
zhaolongfei
1b1cb17861 Merge branch 'zcwy0525-llf' into zcwy0606-llf 2024-06-06 16:35:40 +08:00
zhaolongfei
a35c1faa49 学员在线删除失败的bug修复 2024-06-06 16:32:33 +08:00
34 changed files with 76 additions and 273 deletions

View File

@@ -3,7 +3,6 @@ package com.xboe.module.idconfig;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.security.SecureRandom;
import java.util.Enumeration;
import javax.annotation.Resource;
@@ -51,10 +50,8 @@ public class IdGeneratorAutoConfig {
dataCenterId=ipm.getDcNum();
}else {
log.warn("无IP【"+ip+"】的配置的workNum和DataCenterNum,系统自动生成随机数");
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
workServerId = random.nextInt(31);
dataCenterId = random.nextInt(31);
workServerId=RandomUtils.nextInt(0,31);
dataCenterId=RandomUtils.nextInt(0,31);
ipm=new IPMapping();
ipm.setId(md5);
ipm.setIp(ip);

View File

@@ -1,8 +1,6 @@
package com.xboe.module.scorm.cam.load;
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -87,9 +85,6 @@ import com.xboe.module.scorm.cam.model.datatype.NonNegativeInteger;
import com.xboe.module.scorm.cam.model.datatype.Token;
import com.xboe.module.scorm.cam.model.datatype.VCard;
import com.xboe.module.scorm.common.CommonUtils;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@Slf4j
public class ContentPackageGenerator {
@@ -124,10 +119,6 @@ public class ContentPackageGenerator {
private String scormPkgDir;
public ContentPackage generateContentPackageFromFile(String scormPkgDir) {
if (scormPkgDir.contains("..")) {
throw new SecurityException("输入路径包含不安全的字符");
}
if (scormPkgDir == null) {
log.error("scorm package directory is null");
return contentPackage;
@@ -150,15 +141,6 @@ public class ContentPackageGenerator {
Document manifestXml;
try {
SAXReader reader = new SAXReader();
reader.setEntityResolver(new EntityResolver() {
@Override
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
// 总是返回空的InputSource来忽略外部实体
return new InputSource(new StringReader(""));
}
});
manifestXml = reader.read(manifestXmlFile);
} catch (DocumentException e) {

View File

@@ -44,10 +44,6 @@ public class FileUtils {
}
public static File createFile(String dstPath, String fileName) throws IOException {
if (dstPath.contains("..") || fileName.contains("..")) {
throw new SecurityException("输入路径包含不安全的字符");
}
String[] dirs = fileName.split("/");
File file = new File(dstPath);

View File

@@ -119,11 +119,6 @@ public class SCORMPackageManager {
return null;
}
if (packagePath.contains("..")) {
// throw new SecurityException("输入路径包含不安全的字符");
return null;
}
// step 1: uncompress
File f=new File(packagePath);
if(!f.exists()) {

View File

@@ -60,10 +60,6 @@ public class ZipUtils {
}
public static boolean decompressZip(String zipFilePath, String saveFileDir) {
if (zipFilePath.contains("..") || saveFileDir.contains("..")) {
throw new SecurityException("输入路径包含不安全的字符");
}
if (!isEndWithZip(zipFilePath)) {
return false;
}

View File

@@ -12,13 +12,10 @@ import com.xboe.module.dict.entity.DictDto;
import com.xboe.module.exam.entity.ExamTest;
import com.xboe.school.study.entity.StudyCourse;
import com.xboe.system.user.dao.UserDao;
import com.xboe.system.user.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Optional;

View File

@@ -66,10 +66,6 @@ public class ExcelToPdfConverter implements ICourseFileConverter {
@Override
public String convert(String fileType, String filePath) throws Exception{
if (filePath.contains("..")) {
throw new SecurityException("输入路径包含不安全的字符");
}
if (this.getLicense()) {
FileOutputStream fileOS=null;
String previewPath = null;

View File

@@ -65,10 +65,6 @@ public class PPTToPdfConverter implements ICourseFileConverter {
@Override
public String convert(String fileType, String filePath) throws Exception{
if (filePath.contains("..")) {
throw new SecurityException("输入路径包含不安全的字符");
}
if (this.getLicense()) {
InputStream slides=null;
Presentation pres=null;

View File

@@ -69,10 +69,6 @@ public class WordToPdfConverter implements ICourseFileConverter {
@Override
public String convert(String fileType, String filePath) throws Exception{
if (filePath.contains("..")) {
throw new SecurityException("输入路径包含不安全的字符");
}
if (this.getLicense()) {
File pdfFile=null;
FileOutputStream fileOS=null;

View File

@@ -26,7 +26,6 @@ import com.xboe.module.boecase.vo.BrowseDurationVo;
import com.xboe.module.boecase.vo.CasesRecommendLaunchVo;
import com.xboe.module.boecase.vo.CasesRecommendPushVo;
import com.xboe.module.boecase.vo.CasesRecommendVo;
import com.xboe.system.aspectj.anno.FileFormatVerification;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.streaming.SXSSFSheet;
@@ -118,7 +117,6 @@ public class CasesRecommendApi extends ApiBaseController {
* @return
* @throws Exception
*/
@FileFormatVerification(whites = {"xlsx", "xls"})
@PostMapping("/import")
public JsonResponse<ImportData> excelImport(@RequestParam("file") MultipartFile file) throws Exception {
ExcelReader reader = ExcelUtil.getReader(file.getInputStream());

View File

@@ -227,10 +227,6 @@ public class CourseFileApi extends ApiBaseController {
return badRequest("请先选择资源归属");
}
if (file.getFilePath().contains("..")) {
throw new SecurityException("输入路径包含不安全的字符");
}
// 重设文件类型为小写
file.setFileType(file.getFileType().toLowerCase());
@@ -400,14 +396,7 @@ public class CourseFileApi extends ApiBaseController {
return;
}
if (cf.contains("..")) {
log.error("参数错误");
// throw new SecurityException("输入路径包含不安全的字符");
return;
}
String cfPath=null;
String cfPath=null;
String fileName ="";
if(StringUtils.isNotBlank(cf)) {
cfPath=cf;
@@ -447,11 +436,6 @@ public class CourseFileApi extends ApiBaseController {
response.reset();
//由于火狐和其他浏览器显示名称的方式不相同,需要进行不同的编码处理
if (agent.indexOf("FIREFOX") != -1) {//火狐浏览器
// 检查文件名中是否包含不允许的字符
if (fileName.matches(".*[\n\r;%].*")) {
throw new IllegalArgumentException("Filename contains illegal characters");
}
response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes("GB2312"), "ISO-8859-1"));
} else {//其他浏览器
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));

View File

@@ -84,6 +84,11 @@ public class CourseContent extends BaseEntity {
@Column(name = "duration")
private Integer duration;
/**
* 视频播放进度
* */
@Column(name = "progress_video")
private Float progressVideo;
/**用于学习时的状态显示,非存储字段*/
@Transient

View File

@@ -82,4 +82,7 @@ public interface ICourseContentService{
* @return
*/
CourseAssess getAssess(String ccid);
void updateProcessVideo(String contentId, String courseId, Float processVideo);
}

View File

@@ -1,5 +1,7 @@
package com.xboe.module.course.service.impl;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
import javax.annotation.Resource;
@@ -141,6 +143,17 @@ public class CourseContentServiceImpl implements ICourseContentService {
return assess;
}
@Override
@Transactional
public void updateProcessVideo(String id, String courseId, Float progressVideo) {
// 处理 processVideo 为 null 的情况
if (progressVideo == null) {
progressVideo = 0.00f;
}
String sql = "UPDATE boe_course_content SET progress_video = "+ progressVideo+" WHERE id = "+ id+" AND course_id = "+ courseId+" ";
ccDao.sqlUpdate(sql);
}
@Override
@Transactional
public void updateName(String id, String name) {

View File

@@ -8,7 +8,6 @@ import java.util.List;
import javax.annotation.Resource;
import com.xboe.system.aspectj.anno.FileFormatVerification;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
@@ -149,7 +148,6 @@ public class ExamQuestionApi extends ApiBaseController {
/**
* 导入
* */
@FileFormatVerification(whites = {"xls","xlsx"})
@PostMapping("/import")
public JsonResponse<QuestionDto> importQuestion(@RequestParam MultipartFile file){
//获取输入流

View File

@@ -28,7 +28,7 @@ public class ExamTest extends BaseEntity {
/**
* 考试名称
* */
@Column(name = "test_name",nullable = false,length = 50)
@Column(name = "test_name",length = 50)
private String testName;
/**
@@ -46,7 +46,7 @@ public class ExamTest extends BaseEntity {
/**
* 考试时长 分钟
* */
@Column(name = "test_duration",nullable = false)
@Column(name = "test_duration")
private Integer testDuration;
/**
* 显示解析
@@ -107,13 +107,13 @@ public class ExamTest extends BaseEntity {
/**
* 考试的类型
* */
@Column(name = "test_type",nullable = false)
@Column(name = "test_type")
private Integer testType;
/**
* 发布状态 ,是否已发布
*/
@Column(name = "published",length = 1,nullable = false)
@Column(name = "published",length = 1)
private Boolean published;
/**
* 发布时间
@@ -154,7 +154,7 @@ public class ExamTest extends BaseEntity {
/**
* 范围1表独立使用2表课程内部
* */
@Column(name = "range_type",nullable = false)
@Column(name = "range_type")
private Integer rangeType;
/**

View File

@@ -142,9 +142,6 @@ public class AloneExamServiceImpl implements IAloneExamService{
if(StringUtils.isNotBlank(aea.getTestId())) {
query.addFilter(FieldFilters.eq("testId",aea.getTestId()));
}
if(StringUtils.isNotBlank(aea.getTestName())) {
query.addFilter(FieldFilters.eq("testName",aea.getTestName()));
}
if(StringUtils.isNotBlank(aea.getAid())) {
query.addFilter(FieldFilters.eq("aid",aea.getAid()));
}

View File

@@ -95,7 +95,7 @@ public class ExamTestServiceImpl implements IExamTestService {
@Override
public Boolean has(String paperId) {
ExamTest et=examTestDao.findOne(FieldFilters.eq("paperId", paperId));
ExamTest et=examTestDao.findOne(FieldFilters.eq("paperId", paperId),FieldFilters.eq("deleted", false));
//String etId= (String)examTestDao.findField("id", FieldFilters.eq("paperId", paperId));
if(et==null){
return true;

View File

@@ -8,7 +8,6 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.xboe.system.aspectj.anno.FileFormatVerification;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -282,7 +281,6 @@ public class XFileBaseApi extends ApiBaseController{
return wrap(list);
}
@FileFormatVerification(whites = {"zip","png","jpg","jpeg","gif","svg","bmp"})
@ApiAccess(path="xfile.file.upload")
@RequestMapping(value="/file/upload", method={RequestMethod.POST})
public JsonResponse<ListViewItem> fileUpload(HttpServletRequest request,String folderId) {

View File

@@ -11,7 +11,6 @@ import java.util.Set;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import com.xboe.system.aspectj.anno.FileFormatVerification;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
@@ -199,7 +198,6 @@ public class UserGroupApi extends ApiBaseController {
* 不直接导入到数据库,而是解析文件并查询相应数据返回
* @return
*/
@FileFormatVerification(whites = {"xlsx","xls"})
@PostMapping("/import")
public JsonResponse<Iterable<UserImportDto>> importUserGroup(@RequestParam MultipartFile file) {

View File

@@ -11,6 +11,7 @@ import com.xboe.api.vo.*;
import com.xboe.module.course.vo.TeacherVo;
import com.xboe.module.usergroup.entity.UserGroupItem;
import com.xboe.module.usergroup.service.IUserGroupService;
import com.xboe.school.study.dao.StudyCourseDao;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -66,6 +67,8 @@ import javax.servlet.http.HttpServletRequest;
@RequestMapping(value="/xboe/school/study/course")
public class StudyCourseApi extends ApiBaseController{
@Autowired
IStudyCourseService service;
@@ -529,7 +532,7 @@ public class StudyCourseApi extends ApiBaseController{
* @return
*/
@PostMapping("/study-video-time")
public JsonResponse<Boolean> study(String studyId,String itemId,Integer videoTime){
public JsonResponse<Boolean> study(String itemId,Integer videoTime,String contentId , String courseId,Float progressVideo){
if(StringUtils.isBlank(itemId)){
return error("参数错误");
@@ -539,7 +542,10 @@ public class StudyCourseApi extends ApiBaseController{
}
//检查是否已存在
try {
studyService.updateLastTime(itemId,videoTime,getCurrent().getAccountId());
studyService.updateLastTime(itemId,videoTime, getCurrent().getAccountId());
if (contentId != null && courseId != null && progressVideo != null){
contentService.updateProcessVideo(contentId, courseId, progressVideo);
}
return success(true);
}catch(Exception e) {
log.error("记录最后学习时间错误",e);
@@ -691,8 +697,9 @@ public class StudyCourseApi extends ApiBaseController{
}
}
@RequestMapping(value="/study-course-content",method = {RequestMethod.GET,RequestMethod.POST})
public JsonResponse<StudyCourseItem> findStudyCourseItem(String studyId,String contentId){
public JsonResponse<StudyCourseItem> findStudyCourseItem(String studyId,String contentId, HttpServletRequest request){
if(StringUtils.isBlank(studyId)){
return error("无学习信息");
}

View File

@@ -7,6 +7,7 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;
import com.xboe.api.ThirdApi;
import com.xboe.school.study.dao.StudyCourseDao;
import com.xboe.school.study.entity.StudyCourse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +33,8 @@ import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping(value="/xboe/school/study/exam")
public class StudyExamApi extends ApiBaseController{
@Autowired
StudyCourseDao scDao;
@Autowired
IStudyExamService sexamService;

View File

@@ -44,7 +44,7 @@ public class StudyAssessServiceImpl implements IStudyAssessService{
LocalDateTime ldt=LocalDateTime.now();
sci.setStudyId(assess.getStudyId());
sci.setContentId(assess.getContentId());
//sci.setContentName(homework.getContentName());
sci.setContentName("评估");
sci.setCourseId(assess.getCourseId());
//sci.setCsectionId(homework.getCsectionId());
sci.setProgress(100);//直接设置为学习完成

View File

@@ -82,7 +82,7 @@ public class StudyExamServiceImpl implements IStudyExamService{
LocalDateTime ldt=LocalDateTime.now();
sci.setStudyId(exam.getStudyId());
sci.setContentId(exam.getContentId());
//sci.setContentName(homework.getContentName());
sci.setContentName("考试");
sci.setCourseId(exam.getCourseId());
//sci.setCsectionId(homework.getCsectionId());
sci.setProgress(prog);//直接设置为学习完成

View File

@@ -46,7 +46,7 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
LocalDateTime ldt=LocalDateTime.now();
sci.setStudyId(homework.getStudyId());
sci.setContentId(homework.getContentId());
//sci.setContentName(homework.getContentName());
sci.setContentName(homework.getHwName());
sci.setCourseId(homework.getCourseId());
//sci.setCsectionId(homework.getCsectionId());
sci.setProgress(100);//直接设置为学习完成
@@ -67,7 +67,7 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
//只是保留一条作业记录,不再保存多条记录了
//dao.save(homework);
//设置id。然后进行悠
homework.setId(obj.toString());
homework.setId(homework.getStudyItemId());
dao.update(homework);
}
}

View File

@@ -182,7 +182,7 @@ public class StudyServiceImpl implements IStudyService{
if(StringUtils.isNotBlank(name)) {
query.addFilter(FieldFilters.eq("aname", name));
}
int pageIndex2 = pageIndex-1;
int pageIndex2 = (pageIndex-1)*10;
if(status!=null) {
if(status==3) {
query.addFilter(FieldFilters.eq("status", 2));
@@ -193,16 +193,16 @@ public class StudyServiceImpl implements IStudyService{
}else if (status == 1) {
String sql = "select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.content_id,0 as progress,1 as status from boe_study_course bsc " +
" left join boe_study_course_item item on bsc.course_id = item.course_id and bsc.id = item.study_id" +
" where bsc.course_id = '"+courseId+"' and bsc.id not in(" +
" where bsc.course_id = '"+courseId+"' and bsc.aname like '%"+name+"%' and bsc.id not in(" +
" select item.study_id from boe_study_course_item item " +
" where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' group by item.study_id" +
" where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' and item.aname like '%"+name+"%' group by item.study_id" +
" ) group by bsc.id limit "+ pageIndex2+","+ pageSize+";";
String sql2 = "select count(*) as total from (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.content_id,0 as progress,1 as status from boe_study_course bsc " +
" left join boe_study_course_item item on bsc.course_id = item.course_id and bsc.id = item.study_id" +
" where bsc.course_id = '"+courseId+"' and bsc.id not in(" +
" where bsc.course_id = '"+courseId+"' and bsc.aname like '%"+name+"%' and bsc.id not in(" +
" select item.study_id from boe_study_course_item item " +
" where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' group by item.study_id" +
" where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' and item.aname like '%"+name+"%' group by item.study_id" +
" ) group by bsc.id) as total";
log.info("资源完成情况未开始sql"+sql);
List<Object[]> list = scDao.sqlFindList(sql);
@@ -224,46 +224,22 @@ public class StudyServiceImpl implements IStudyService{
return pageList;
}
}
// String sql = "select * from (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.progress,item.status from boe_study_course bsc left join " +
// "boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
// "where bsc.`status` in (2,9) and bsc.course_id = '"+ courseId+"' group by bsc.id " +
// " UNION ALL " +
// " select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,0 as progress,1 as status from boe_study_course bsc " +
// " LEFT JOIN boe_study_course_item item on item.course_id = bsc.course_id " +
// " where bsc.course_id = '"+courseId+"' and bsc.id not in (" +
// " select bsc.id from boe_study_course bsc " +
// " left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
// " where bsc.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' group by bsc.id" +
// " )group by bsc.id) a group by a.id limit "+ pageIndex+","+ pageSize+";";
// String sql2 = "select count(*) from (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.progress,item.status from boe_study_course bsc left join " +
// "boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
// "where bsc.`status` in (2,9) and bsc.course_id = '"+ courseId+"' group by bsc.id " +
// " UNION ALL " +
// " select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,0 as progress,1 as status from boe_study_course bsc " +
// " LEFT JOIN boe_study_course_item item on item.course_id = bsc.course_id " +
// " where bsc.course_id = '"+courseId+"' and bsc.id not in (" +
// " select bsc.id from boe_study_course bsc " +
// " left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
// " where bsc.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' group by bsc.id" +
// " )group by bsc.id) a group by a.id";
String sql = "select a.id, a.course_id, a.course_name, a.aname, " +
"IFNULL(b.finish_time, '0') as finish_time, IFNULL(b.progress, 0) as progress, IFNULL(b.status, 1) as status " +
"from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "') a " +
"from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "' and aname like '%"+name+"%') a " +
"left join " +
"(select bsc.id, bsc.course_id, bsc.course_name, bsc.aname, item.finish_time, item.progress, item.status " +
"from boe_study_course bsc left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
"where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' group by bsc.id) b " +
"where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' and item.aname like '%"+name+"%' group by bsc.id) b " +
"on a.course_id = b.course_id and a.id = b.id " +
"group by a.id limit "+ pageIndex2+","+ pageSize+";";
String sql2 = "select count(*) as total from (select a.id, a.course_id, a.course_name, a.aname, " +
"IFNULL(b.finish_time, 0) as finish_time, IFNULL(b.progress, 0) as progress, IFNULL(b.status, 1) as status " +
"from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "') a " +
"from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "' and aname like '%"+name+"%') a " +
"left join " +
"(select bsc.id, bsc.course_id, bsc.course_name, bsc.aname, item.finish_time, item.progress, item.status " +
"from boe_study_course bsc left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
"where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' group by bsc.id) b " +
"where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' and item.aname like '%"+name+"%' group by bsc.id) b " +
"on a.course_id = b.course_id and a.id = b.id " +
"group by a.id) as total";
log.info("资源完成情况全部sql"+sql);

View File

@@ -14,10 +14,8 @@ import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.xboe.system.aspectj.anno.FileFormatVerification;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@@ -46,9 +44,6 @@ public class SysUploaderApi extends ApiBaseController{
@Autowired
XFileUploader uploader;
@Value(value = "${boe.domain}")
String domain;
private static Set<String> fileTypeSet=new HashSet<>();
static {
fileTypeSet.add("mp3");
@@ -67,7 +62,6 @@ public class SysUploaderApi extends ApiBaseController{
fileTypeSet.add("zip");
}
@FileFormatVerification(whites = {"mp3","wmv","mp4","jpg","png","gif","doc","docx","xls","xlsx","ppt","pptx","pdf","zip"})
@RequestMapping(value = "/file/upload", method = RequestMethod.POST)
public JsonResponse<XUploadResult> save(HttpServletRequest request, String name,String dir) throws IOException {
//以下三项用于回调
@@ -156,7 +150,6 @@ public class SysUploaderApi extends ApiBaseController{
public void urlDownload(HttpServletResponse res,String urlStr,String fileName) throws IOException {
URL url = new URL(urlStr);
downloadLimitation(url);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
//设置超时间为3秒
conn.setConnectTimeout(3*1000);
@@ -200,19 +193,4 @@ public class SysUploaderApi extends ApiBaseController{
//System.out.println("success");
}
private void downloadLimitation(URL url) {
String allowedDomain = domain;
String allowedPathPrefix = "/upload/xfile/";
// 检查域名是否正确
if (!url.getHost().equals(allowedDomain)) {
throw new SecurityException("Download from this domain is not allowed.");
}
// 检查路径是否以允许的路径前缀开始
if (!url.getPath().startsWith(allowedPathPrefix)) {
throw new SecurityException("Download from this path is not allowed.");
}
}
}

View File

@@ -1,91 +0,0 @@
package com.xboe.system.aspectj;
import com.xboe.system.aspectj.anno.FileFormatVerification;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.List;
/**
* @author admin
*/
@Aspect
@Slf4j
@Component
public class UploadAspect {
@Pointcut("@annotation(com.xboe.system.aspectj.anno.FileFormatVerification)")
private void fileUpload() {
}
@Before("fileUpload()")
public void fileFormatVerifies(JoinPoint joinPoint) {
List<String> whiteList = getWhiteList(joinPoint);
String[] FILE_UPLOAD_BLACKLIST = {"exe", "sh", "py", "html", "xhtml", "php", "php5", "dat", "dbf", "dev", "asp", "aspx", "asa", "aspx", "ashx", "asmx", "asax", "ascx", "jsp", "jspx", "jspf", "cgi", "war", "ini", "js"};
List<String> blackList = Arrays.asList(FILE_UPLOAD_BLACKLIST);
// 在目标方法执行前执行的代码
Object[] args = joinPoint.getArgs(); // 获取被调用方法的参数
// 处理MultipartFile
Arrays.stream(args)
.filter(arg -> arg instanceof MultipartFile)
.map(arg -> (MultipartFile) arg)
.forEach(file -> {
String name = file.getOriginalFilename();
String fileSuffix = name.substring(name.lastIndexOf(".") + 1);
if (blackList.contains(fileSuffix) || !whiteList.contains(fileSuffix)) {
throw new RuntimeException("文件格式不支持");
}
});
// 处理HttpServletRequest中的文件名
Arrays.stream(args)
.filter(arg -> arg instanceof HttpServletRequest)
.map(arg -> (HttpServletRequest) arg)
.filter(req -> req instanceof MultipartHttpServletRequest)
.map(req -> (MultipartHttpServletRequest) req)
.forEach(req -> {
req.getFileMap().forEach((k, v) -> {
String fileSuffix = v.getOriginalFilename().substring(v.getOriginalFilename().lastIndexOf(".") + 1);
if (blackList.contains(fileSuffix) || !whiteList.contains(fileSuffix)) {
throw new RuntimeException("文件格式不支持");
}
});
});
int i = 1 / 0;
}
private static List<String> getWhiteList(JoinPoint joinPoint) {
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
Method method = methodSignature.getMethod();
// 获取FileFormatVerification注解
FileFormatVerification annotation = method.getAnnotation(FileFormatVerification.class);
// 获取whiteList属性
String[] whites = annotation.whites();
List<String> whiteList = Arrays.asList(whites);
return whiteList;
}
}

View File

@@ -1,15 +0,0 @@
package com.xboe.system.aspectj.anno;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.METHOD) // 注解目标为方法
@Retention(RetentionPolicy.RUNTIME) // 注解在运行时有效
public @interface FileFormatVerification {
String[] whites() default {};
}

View File

@@ -4,7 +4,7 @@ spring.redis.database=1
#spring.redis.password=ENC(zA5LNV8xw3yEx6LMwdGGBGgNsOaD3Cg+)
#spring.redis.port=6379
spring.redis.host=124.70.92.162
spring.redis.password=ENC(5oXfdmgE2DDHUFhrGkS/UzUCxr7s8stV)
spring.redis.password=qwert!W577
spring.redis.port=6379
# cloud nacos config
@@ -20,7 +20,7 @@ spring.datasource.driverClassName=com.mysql.jdbc.Driver
#spring.datasource.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
spring.datasource.url=jdbc:mysql://10.251.160.40:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
spring.datasource.username=admin
spring.datasource.password=ENC(GrOwKqgCAlYEZYjiDYWEjVcKho+5TLgc)
spring.datasource.password=boeRds01
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE

View File

@@ -1,7 +1,7 @@
## redis
spring.redis.database=1
spring.redis.host=10.251.160.38
spring.redis.password=ENC(5oXfdmgE2DDHUFhrGkS/UzUCxr7s8stV)
spring.redis.password=qwert!W577
spring.redis.port=6379
#spring.redis.database=3
#spring.redis.host=10.251.129.122
@@ -17,7 +17,7 @@ spring.datasource.driverClassName=com.mysql.jdbc.Driver
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://10.251.129.126:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
spring.datasource.username=admin
spring.datasource.password=ENC(GrOwKqgCAlYEZYjiDYWEjVcKho+5TLgc)
spring.datasource.password=boeRds01
logging.level.org.hibernate.SQL=ERROR
#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE

View File

@@ -4,7 +4,7 @@ spring.cloud.nacos.discovery.server-addr=10.251.129.51:8848
## redis
spring.redis.database=1
spring.redis.host=10.251.129.122
spring.redis.password=ENC(e1k00MMRGU0DUHvLX8JSOuDkCX0CWNif)
spring.redis.password=qwert!W588
spring.redis.port=6379
@@ -18,7 +18,7 @@ spring.datasource.driverClassName=com.mysql.jdbc.Driver
#spring.datasource.password=ocYMC>!{8G
spring.datasource.url=jdbc:mysql://10.251.129.126:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
spring.datasource.username=admin
spring.datasource.password=ENC(GrOwKqgCAlYEZYjiDYWEjVcKho+5TLgc)
spring.datasource.password=boeRds01
## 使用 hikari 连接池
spring.datasource.type=com.zaxxer.hikari.HikariDataSource

View File

@@ -1,7 +1,7 @@
## redis
spring.redis.database=1
spring.redis.host=10.251.160.38
spring.redis.password=ENC(oXmZ5HIrhizHQ/DWPNv/S/1hUNJbbRjv)
spring.redis.password=qwert!W577
spring.redis.port=6379
# cloud nacos config
@@ -13,7 +13,7 @@ spring.datasource.driverClassName=com.mysql.jdbc.Driver
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://10.251.160.40:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
spring.datasource.username=admin
spring.datasource.password=ENC(GrOwKqgCAlYEZYjiDYWEjVcKho+5TLgc)
spring.datasource.password=boeRds01
## 使用 hikari 连接池
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
@@ -72,7 +72,7 @@ jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
xboe.elasticsearch.server.ip=10.251.129.25
xboe.elasticsearch.server.port=9200
xboe.elasticsearch.server.user=elastic
xboe.elasticsearch.server.password=ENC(903xqMcg31J+OhmZ0AoinYqvzLoAt8UZ)
xboe.elasticsearch.server.password=Boe@es123
## 邮件的配置
xboe.email.url=https://u-pre.boe.com/api/b1/email/send

View File

@@ -1,7 +1,7 @@
## redis
spring.redis.database=2
spring.redis.host=10.251.160.38
spring.redis.password=ENC(5oXfdmgE2DDHUFhrGkS/UzUCxr7s8stV)
spring.redis.password=qwert!W577
spring.redis.port=6379
## datasource config
@@ -10,7 +10,7 @@ spring.datasource.driverClassName=com.mysql.jdbc.Driver
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://10.251.160.40:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
spring.datasource.username=admin
spring.datasource.password=ENC(GrOwKqgCAlYEZYjiDYWEjVcKho+5TLgc)
spring.datasource.password=boeRds01
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
@@ -60,7 +60,7 @@ jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
xboe.elasticsearch.server.ip=10.251.129.25
xboe.elasticsearch.server.port=9200
xboe.elasticsearch.server.user=elastic
xboe.elasticsearch.server.password=ENC(903xqMcg31J+OhmZ0AoinYqvzLoAt8UZ)
xboe.elasticsearch.server.password=Boe@es123
## 邮件的配置
xboe.email.url=https://10.251.160.135/api/b1/email/send