Compare commits

...

130 Commits

Author SHA1 Message Date
yang
fcb9b83896 ZIP条目覆盖,补充 2024-08-26 19:27:07 +08:00
yang
e16b890a8d XML外部实体注入 2024-08-26 19:26:34 +08:00
yang
376c47befc 密码管理 2024-08-26 19:26:03 +08:00
yang
674b7165eb 文件上传,白名单待定 2024-08-26 17:15:59 +08:00
yang
bea6d680e9 路径遍历 2024-08-26 17:00:10 +08:00
yang
776e1e6cbc 不安全的随机数,剩余一个缺陷 2024-08-26 16:58:53 +08:00
yang
19c3221153 资源注入、服务器端请求伪造 2024-08-26 16:57:39 +08:00
yang
1482809b0f HTTP响应截断 2024-08-26 16:56:32 +08:00
nisen
83e71dc5d6 Merge branch 'zcwy0716-llf' into yxmaster 2024-07-29 19:47:41 +08:00
zhaolongfei
687cd24de3 在线管理资源完成情况修改 2024-07-29 09:34:40 +08:00
nisen
f5f53557b6 Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 22:21:06 +08:00
zhaolongfei
4687b353eb 在线管理资源完成情况修改 2024-07-26 22:19:59 +08:00
nisen
4b4f30b412 Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 22:16:40 +08:00
zhaolongfei
072ee25037 在线管理资源完成情况修改 2024-07-26 22:15:44 +08:00
nisen
6f19ff7b0f Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 22:11:30 +08:00
zhaolongfei
2f8163b0a3 在线管理资源完成情况修改 2024-07-26 22:10:47 +08:00
nisen
f8566d2321 Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 22:06:19 +08:00
zhaolongfei
5890f1b800 在线管理资源完成情况修改 2024-07-26 22:04:37 +08:00
nisen
d6102d1ce1 Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 21:52:10 +08:00
zhaolongfei
50942a9435 在线管理资源完成情况修改 2024-07-26 21:50:40 +08:00
nisen
6521464676 Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 21:38:42 +08:00
zhaolongfei
3ec7f587b3 在线管理资源完成情况修改 2024-07-26 21:36:23 +08:00
nisen
b6378b6565 Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 21:20:05 +08:00
zhaolongfei
885b203dd6 在线管理资源完成情况修改 2024-07-26 21:17:35 +08:00
nisen
66d7f2a3cf Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 20:53:21 +08:00
zhaolongfei
e6f4affa21 在线管理资源完成情况修改 2024-07-26 20:51:55 +08:00
nisen
faea4f8b2a Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 20:37:09 +08:00
zhaolongfei
e4f845fdde 在线管理资源完成情况修改 2024-07-26 20:36:28 +08:00
nisen
c203956bc6 Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 20:25:00 +08:00
zhaolongfei
c97cd3daab 在线管理资源完成情况修改 2024-07-26 20:24:17 +08:00
nisen
cf4004f073 Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 19:00:39 +08:00
zhaolongfei
74f37b008d 在线管理资源完成情况修改 2024-07-26 19:00:14 +08:00
nisen
6bf5ccbcec Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 18:59:20 +08:00
zhaolongfei
d0b1894c14 在线管理资源完成情况修改 2024-07-26 18:58:35 +08:00
nisen
63867db58e Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 18:45:50 +08:00
zhaolongfei
7e1e32a70e 在线管理资源完成情况修改 2024-07-26 18:45:12 +08:00
zhaolongfei
30f8d363fa 在线管理资源完成情况修改 2024-07-26 18:42:32 +08:00
nisen
7ef0f976fc Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 18:38:12 +08:00
zhaolongfei
338a709ebc 在线管理资源完成情况修改 2024-07-26 18:36:47 +08:00
nisen
5a05ff74b7 Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 18:18:17 +08:00
zhaolongfei
650107aea1 在线管理资源完成情况修改 2024-07-26 18:17:39 +08:00
nisen
a93580c387 Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 18:04:08 +08:00
zhaolongfei
4c6480b428 在线管理资源完成情况修改 2024-07-26 17:56:59 +08:00
nisen
78184d3a11 Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 17:31:26 +08:00
zhaolongfei
901aded0c3 在线管理资源完成情况修改 2024-07-26 17:30:03 +08:00
nisen
bcb8b59e8a Merge branch 'zcwy0716-llf' into master-0705 2024-07-26 16:50:18 +08:00
zhaolongfei
e77ee34225 在线管理资源完成情况修改 2024-07-24 16:42:10 +08:00
zhaolongfei
9373a95631 在线管理资源完成情况修改 2024-07-24 11:32:38 +08:00
zhaolongfei
d81d4c474e 在线管理资源完成情况修改 2024-07-24 11:28:06 +08:00
zhaolongfei
2b3f59522c 在线管理资源完成情况修改 2024-07-24 11:09:21 +08:00
zhaolongfei
2f150449fe 在线管理资源完成情况修改 2024-07-24 10:50:08 +08:00
zhaolongfei
4f6fbff5e1 在线管理资源完成情况修改 2024-07-23 18:00:18 +08:00
zhaolongfei
abef4c963e 在线管理资源完成情况修改 2024-07-23 17:51:55 +08:00
zhaolongfei
5e355986a0 在线管理资源完成情况修改 2024-07-23 16:54:42 +08:00
zhaolongfei
13914ede08 在线管理资源完成情况修改 2024-07-23 16:00:43 +08:00
zhaolongfei
7eb1dcd7c4 在线管理资源完成情况修改 2024-07-23 15:54:56 +08:00
zhaolongfei
ea7ff473d0 在线管理资源完成情况修改 2024-07-23 15:32:18 +08:00
zhaolongfei
9aaab480bf 在线管理资源完成情况修改 2024-07-23 15:05:24 +08:00
zhaolongfei
b0ac4951ad 在线管理资源完成情况修改 2024-07-23 14:47:25 +08:00
zhaolongfei
3e9eaf30cb 在线管理资源完成情况修改 2024-07-23 14:36:33 +08:00
zhaolongfei
9fbeea85c6 在线管理资源完成情况修改 2024-07-23 14:30:40 +08:00
zhaolongfei
b2981cff8a 在线管理资源完成情况修改 2024-07-23 08:46:54 +08:00
zhaolongfei
dc2d144682 在线管理资源完成情况修改 2024-07-22 17:38:57 +08:00
nisen
1025f8f716 Merge branch 'zcwy0716-llf' into master-0705 2024-07-18 17:27:52 +08:00
zhaolongfei
46b63c36eb 在线管理资源完成情况修改,添加日志,先暂时注释 2024-07-17 19:33:50 +08:00
zhaolongfei
312108e6c0 在线管理资源完成情况修改,添加日志,先暂时注释 2024-07-17 19:28:08 +08:00
zhaolongfei
fee3f263bc 在线管理资源完成情况修改,添加日志,先暂时注释 2024-07-17 19:14:58 +08:00
zhaolongfei
16c755d14d 在线管理资源完成情况修改,添加日志,先暂时注释 2024-07-17 18:40:04 +08:00
zhaolongfei
69b6a50011 在线管理资源完成情况修改,添加日志,先暂时注释 2024-07-17 18:30:47 +08:00
zhaolongfei
bed3bd7fae 在线管理资源完成情况修改,添加日志,先暂时注释 2024-07-17 16:56:15 +08:00
zhaolongfei
d60a1521f9 在线管理资源完成情况修改,添加日志,先暂时注释 2024-07-17 16:48:38 +08:00
zhaolongfei
34db08d1a8 在线管理资源完成情况修改,添加日志 2024-07-17 16:24:22 +08:00
zhaolongfei
2822021f30 在线管理资源完成情况修改,添加日志 2024-07-17 16:01:05 +08:00
zhaolongfei
63d3844b76 在线管理资源完成情况修改,添加日志 2024-07-17 15:40:13 +08:00
zhaolongfei
e9645d631d 在线管理资源完成情况修改,添加日志 2024-07-17 14:49:55 +08:00
zhaolongfei
588f527293 在线管理资源完成情况修改,添加日志 2024-07-17 14:40:10 +08:00
zhaolongfei
99df06481f 在线管理资源完成情况修改,添加日志 2024-07-17 14:30:44 +08:00
zhaolongfei
921aa5909e 在线管理资源完成情况修改 2024-07-17 13:56:34 +08:00
zhaolongfei
d514450f23 在线管理资源完成情况修改 2024-07-17 13:49:24 +08:00
zhaolongfei
00c1fe8c49 在线管理资源完成情况修改 2024-07-17 13:36:34 +08:00
zhaolongfei
92aa649fa1 在线管理资源完成情况修改 2024-07-17 13:22:12 +08:00
zhaolongfei
019d534956 在线管理资源完成情况修改 2024-07-17 10:29:27 +08:00
zhaolongfei
b67d931741 在线管理资源完成情况修改 2024-07-17 10:20:34 +08:00
zhaolongfei
1bd09c0f02 在线管理资源完成情况修改 2024-07-17 09:45:50 +08:00
zhaolongfei
1794344829 在线管理资源完成情况修改 2024-07-17 09:37:19 +08:00
zhaolongfei
952f47fdc6 在线管理资源完成情况修改 2024-07-17 09:06:31 +08:00
zhaolongfei
f19b928bc9 在线课固定时长问题修改 2024-07-17 09:05:38 +08:00
zhaolongfei
df91242e1b 在线管理资源完成情况问题修改 2024-07-16 19:57:36 +08:00
joshen
4c6f15a707 Merge branch 'zcwy-0613-wjw' into 'master-0705'
新在线课逻辑删除库名

See merge request !115
2024-07-05 19:21:27 +08:00
xiaozhequ
488e6c2872 新在线课逻辑删除库名 2024-07-05 19:20:11 +08:00
joshen
e86afad4ef Merge branch 'zcwy-0613-wjw' into 'master-0705'
新在线课逻辑打印日志

See merge request !114
2024-07-05 19:00:59 +08:00
xiaozhequ
3285c639b9 新在线课逻辑打印日志 2024-07-05 18:59:29 +08:00
joshen
db3695019a Merge branch 'zcwy-0613-wjw' into 'master-0705'
Zcwy 0613 wjw

See merge request !113
2024-07-05 17:52:48 +08:00
joshen
7b2217c017 Merge branch 'zcwy0618-llf' into 'master'
Zcwy0618 llf

See merge request !112
2024-07-05 17:48:02 +08:00
xiaozhequ
84dd5cb192 在线课逻辑更改库名 2024-07-05 15:22:55 +08:00
zhaolongfei
333f29f008 在线课考试分数状态问题修改 2024-07-05 15:17:38 +08:00
xiaozhequ
407c7693bb 区分新建课 2024-07-04 16:21:48 +08:00
xiaozhequ
564bf42464 hrbp只读权限 2024-07-04 15:06:42 +08:00
xiaozhequ
55717e4dde 删除筛选 2024-07-04 12:33:35 +08:00
xiaozhequ
2698061eae 更改实体类字段 2024-07-04 12:32:44 +08:00
xiaozhequ
eb401d8fdf 新在线课逻辑 2024-07-04 10:55:17 +08:00
xiaozhequ
20374e274a 新在线课逻辑修复bug 2024-07-04 10:31:28 +08:00
xiaozhequ
c7a39a1f22 新在线课修复bug 2024-07-04 09:49:49 +08:00
zhaolongfei
ba6cca93b3 在线课考试成绩状态文提修改 2024-07-03 17:43:14 +08:00
xiaozhequ
7eb578127d 新在线课逻辑优化2 2024-07-03 16:30:19 +08:00
xiaozhequ
f2be349301 新在线课逻辑优化 2024-07-03 12:46:55 +08:00
xiaozhequ
e0037b8814 课程权限优化 2024-07-03 09:57:59 +08:00
xiaozhequ
0b0bd748d9 新在线课逻辑 2024-07-02 09:42:47 +08:00
xiaozhequ
9fd4171107 新在线课逻辑 2024-07-02 08:56:28 +08:00
joshen
d23bfbe159 Merge branch 'zcwy0618-llf' into 'master'
Zcwy0618 llf

See merge request !111
2024-06-28 18:38:12 +08:00
joshen
17ab1add64 Merge branch 'zcwy0529-l' into 'master'
课程审核时更新发布状态及发布时间

See merge request !110
2024-06-24 17:52:57 +08:00
xiaozhequ
625c41f466 在线可权限bug 2024-06-24 16:00:23 +08:00
xiaozhequ
f950788e08 课程权限学习路径图保持一致 2024-06-24 14:58:13 +08:00
670788339
7c9c1987a3 课程审核时更新发布状态及发布时间 2024-06-24 14:05:34 +08:00
xiaozhequ
a26ceb86d1 学习路径图保持一致 2024-06-24 14:04:53 +08:00
xiaozhequ
a2317d0b59 在线可权限更改逻辑 2024-06-24 13:47:34 +08:00
joshen
0be67ca01c Merge branch 'zcwy0529-l' into 'master'
审核并发布

See merge request !108
2024-06-21 17:25:04 +08:00
xiaozhequ
53c38baf22 修复查询失败bug 2024-06-21 15:46:43 +08:00
zhaolongfei
da6ed5eed4 考试时间修改同步 2024-06-21 14:58:36 +08:00
670788339
8cd0624b01 审核并发布 2024-06-21 13:13:50 +08:00
zhaolongfei
b108bc3e76 考试时间修改同步 2024-06-21 11:14:41 +08:00
joshen
cf0667b476 Merge branch 'zcwy0529-l' into 'master'
714课程审核问题

See merge request !106
2024-06-20 17:18:23 +08:00
670788339
10f630c0b7 714课程审核问题 2024-06-20 14:12:34 +08:00
zhaolongfei
1abd059820 修改bug 2024-06-19 18:07:48 +08:00
zhaolongfei
33fee46433 在线课考试成绩为空问题修改 2024-06-19 15:49:35 +08:00
xiaozhequ
de69ba1c11 在线课权限查询 2024-06-19 15:34:53 +08:00
xiaozhequ
2fcdb6b4b6 代码还原 2024-06-18 15:49:10 +08:00
zhaolongfei
7d08954525 修改项目下考试结束时间并未生效修复 2024-06-18 15:05:42 +08:00
xiaozhequ
62884bcc15 所有后台人过滤在线课 2024-06-18 14:56:28 +08:00
xiaozhequ
dd0af3cbef 选择在线可时增加数据权限逻辑 2024-06-13 18:11:41 +08:00
40 changed files with 2277 additions and 1497 deletions

View File

@@ -3,6 +3,7 @@ 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;
@@ -50,8 +51,10 @@ public class IdGeneratorAutoConfig {
dataCenterId=ipm.getDcNum();
}else {
log.warn("无IP【"+ip+"】的配置的workNum和DataCenterNum,系统自动生成随机数");
workServerId=RandomUtils.nextInt(0,31);
dataCenterId=RandomUtils.nextInt(0,31);
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
workServerId = random.nextInt(31);
dataCenterId = random.nextInt(31);
ipm=new IPMapping();
ipm.setId(md5);
ipm.setIp(ip);

View File

@@ -1,6 +1,8 @@
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;
@@ -85,6 +87,9 @@ 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 {
@@ -119,6 +124,10 @@ 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;
@@ -140,7 +149,16 @@ public class ContentPackageGenerator {
Document manifestXml;
try {
SAXReader reader = new SAXReader();
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,6 +44,10 @@ 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,6 +119,11 @@ 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,6 +60,10 @@ 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

@@ -9,6 +9,7 @@ import com.xboe.module.course.vo.StudyCourseVo;
import com.xboe.module.course.vo.TeacherInfoVo;
import com.xboe.module.course.vo.TeacherVo;
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;
@@ -62,6 +63,9 @@ public class ThirdApi {
@Value("${coursesuilt.getStudyStatus}")
private String getStudyStatus;
@Value("${manageApi.editExam}")
private String editExam;
//获取例外人员的id
public List<String> getUserId(){
String responseBody = Optional.ofNullable(HttpRequest.get(infarasApiUrl+"?pid=316&type=1").execute() //prod 316
@@ -206,6 +210,14 @@ public class ThirdApi {
return studyCourseResult.getResult();
}
public void sqlUpdate(ExamTest examTest, String token) {
examTest.setSysUpdateTime(null);
examTest.setSysCreateTime(null);
examTest.setPublishTime(null);
String resp = Optional.ofNullable(HttpRequest.post(editExam).body(JSONUtil.toJsonStr(examTest)).header("token", token).execute().body()).orElseThrow(() -> new RuntimeException("token校验失败"));
Opt.ofBlankAble(resp).map(t -> JSONUtil.toBean(t, DynamicBean.class).success());
}
public static void main(String[] args) {
String token = "eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJjb21wYW55Q29kZSI6IkMwMDEiLCJ1SWQiOiI5NjUzNDIwMjc0OTc2MDcxNjgiLCJjb21wYW55SWQiOiIxMDQxNjczOTc3Mzc5OTQ2NDk2IiwibG9naW5JZCI6IjE2ODg0NDg5MjIwNzY0OTE3NzgiLCJpc3MiOiJodHRwOi8vdS5ib2UuY29tIiwiR2l2ZW5OYW1lIjoiYm9ldSIsImV4cCI6MTY5MTM5OTc2NzU1OCwidXNlck5hbWUiOiLmnY7njonlhrAiLCJ1c2VySWQiOiI2QjA0OUZBRi1DMzE0LTdDQ0YtMEQyOC0wRDIzRjRDNDI1MzEifQ==.8b52dcf4d48a790ed258b9ca2b279bb269f5301722095382fbd352705b51c893";
String resp = Optional.ofNullable(HttpRequest.post("https://u-pre.boe.com/statApi/xboe/m/stat/userdynamic/list").body(JSONUtil.toJsonStr(UserdynamicParam.builder().
@@ -221,4 +233,6 @@ public class ThirdApi {
}
}

View File

@@ -66,6 +66,10 @@ 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,6 +65,10 @@ 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,6 +69,10 @@ 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

@@ -17,5 +17,7 @@ public class UserOrgIds {
private Map<String,Boolean> permissions=new HashMap<String,Boolean>();
private List<String> ids;
//hrbp只读权限
private List<String> readIds;
}

View File

@@ -229,8 +229,10 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
public UserOrgIds getOrgIds() {
UserOrgIds uids=new UserOrgIds();
List<String> orgIds = new ArrayList<>();
List<String> readIds = new ArrayList<>();
uids.setIds(orgIds);
uids.setReadIds(readIds);
String token = TokenProxy.getToken(request);
String type="application/json";
String[] headers=new String[] {"token",token,"Content-Type",type};
@@ -281,7 +283,8 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
while (elements.hasNext()){
String oid=elements.next().asText();
if(!orgSetIds.contains(oid)) {
orgIds.add(oid);
// orgIds.add(oid);
readIds.add(oid);
}
}
}

View File

@@ -26,6 +26,7 @@ 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;
@@ -117,6 +118,7 @@ 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,6 +227,10 @@ public class CourseFileApi extends ApiBaseController {
return badRequest("请先选择资源归属");
}
if (file.getFilePath().contains("..")) {
throw new SecurityException("输入路径包含不安全的字符");
}
// 重设文件类型为小写
file.setFileType(file.getFileType().toLowerCase());
@@ -395,8 +399,15 @@ public class CourseFileApi extends ApiBaseController {
//return badRequest("参数错误");
return;
}
String cfPath=null;
if (cf.contains("..")) {
log.error("参数错误");
// throw new SecurityException("输入路径包含不安全的字符");
return;
}
String cfPath=null;
String fileName ="";
if(StringUtils.isNotBlank(cf)) {
cfPath=cf;
@@ -436,6 +447,11 @@ 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

@@ -1,11 +1,7 @@
package com.xboe.module.course.api;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -134,7 +130,6 @@ public class CourseManageApi extends ApiBaseController{
}else {
dto.setIsSystemAdmin(false);
}
String ids="";
if(userOrgIds.getIds()!=null && !userOrgIds.getIds().isEmpty())
{
@@ -142,12 +137,14 @@ public class CourseManageApi extends ApiBaseController{
}
//log.info("获取到的用户的组织机构权限ids",ids);
String aid=getCurrent().getAccountId();
// String aid="1706272694871445506";
//如果前端查询当前人的,这里去掉
if(StringUtils.isNotBlank(dto.getAid())) {
dto.setAid(null);
}
dto.setOrgAid(aid);
dto.setOrgIds(ids);
dto.setReadIds(userOrgIds.getReadIds());
PageList<Course> coursePageList = courseService.findPage(pager.getPageIndex(), pager.getPageSize(),dto);
return success(coursePageList);
}catch(Exception e) {

View File

@@ -1,10 +1,13 @@
package com.xboe.module.course.dao;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.xboe.core.orm.BaseDao;
import com.xboe.module.course.entity.CourseContent;
import java.util.List;
@Repository
public class CourseContentDao extends BaseDao<CourseContent> {
@@ -20,4 +23,5 @@ public class CourseContentDao extends BaseDao<CourseContent> {
int count=count(hql, courseId);
return count;
}
}

View File

@@ -2,6 +2,8 @@ package com.xboe.module.course.dto;
import lombok.Data;
import java.util.List;
/**
* 课程查询的条件对象
*/
@@ -102,6 +104,9 @@ public class CourseQueryDto {
* */
private String orgIds;
//hrpb只读
private List<String> readIds;
/**用户权限的查询*/
private String orgAid;
@@ -110,6 +115,11 @@ public class CourseQueryDto {
*/
private Boolean isSystemAdmin;
/**
* 是否是新建在线可
*/
private Boolean isCreateCourse;
private Boolean visible;
private String refId;
@@ -129,4 +139,5 @@ public class CourseQueryDto {
* 登录人id
*/
private String userId;
}

View File

@@ -370,6 +370,9 @@ public class Course extends BaseEntity {
@Column(name = "ref_type",length=32,columnDefinition="varchar(32) comment '反向关联的类型'")
private String refType;
@Transient
private Boolean isPermission=true;
@Transient
private String orgName;

View File

@@ -100,6 +100,21 @@ public class CourseContent extends BaseEntity {
this.contentType=contentType;
this.contentRefId=contentRefId;
}
@Override
public String toString() {
return "CourseContent{" +
"rid='" + rid + '\'' +
", typeId='" + typeId + '\'' +
", courseId='" + courseId + '\'' +
", csectionId='" + csectionId + '\'' +
", sortIndex=" + sortIndex +
", contentType=" + contentType +
", contentName='" + contentName + '\'' +
", contentRefId='" + contentRefId + '\'' +
", content='" + content + '\'' +
", duration=" + duration +
", status=" + status +
'}';
}
}

View File

@@ -159,7 +159,10 @@ public class CourseAuditServiceImpl implements ICourseAuditService{
if(!pass) {
status=Course.STATUS_AUDIT_NOPASS;
}
/**20240620 714 管理员审核应为最终审核 添加下行代码*/
courseDao.updateMultiFieldById(courseId,UpdateBuilder.create("status", status),UpdateBuilder.create("auditAid", null),UpdateBuilder.create("auditInfo", null));
//更新审核记录状态
courseHRBPAuditDao.updateMultiFieldById(auditId,
UpdateBuilder.create("status", pass? CourseHRBPAudit.STATUS_PASS:CourseHRBPAudit.STATUS_NOPASS),
@@ -170,7 +173,8 @@ public class CourseAuditServiceImpl implements ICourseAuditService{
);
//更新课程的转审状态,并把转审的信息置为空,这会的状态还未审核通过
if(!openCourse) { //非公开课,这已表示处理完成,直接更新课程状态
courseDao.updateMultiFieldById(courseId,UpdateBuilder.create("status", status),UpdateBuilder.create("auditAid", null),UpdateBuilder.create("auditInfo", null));
// 20240620 注释,改为上方一同修改
// courseDao.updateMultiFieldById(courseId,UpdateBuilder.create("status", status),UpdateBuilder.create("auditAid", null),UpdateBuilder.create("auditInfo", null));
//审核通过并发布,直接发布课程
if(pass) {
//设置课程状态已审核完成,这里是管理员的审核
@@ -203,11 +207,40 @@ public class CourseAuditServiceImpl implements ICourseAuditService{
}else {
//对于公开课
if(pass) {
/**20240620 714 管理员审核应为最终审核 lastState状态由1改为9*/
//公开课hrpb审核通过下一步是公开课的审核hrbp审核流程已经完成
courseHRBPAuditDao.updateMultiFieldById(auditId,
courseHRBPAuditDao.updateMultiFieldById(auditId,
UpdateBuilder.create("forward", CourseHRBPAudit.FORWARD_LAST),
UpdateBuilder.create("lastState", CourseHRBPAudit.STATUS_NONE)
UpdateBuilder.create("lastState", CourseHRBPAudit.STATUS_PASS)
);
//设置课程状态已审核完成,这里是管理员的审核
courseDao.updateMultiFieldById(courseId,
UpdateBuilder.create("published", pass),
UpdateBuilder.create("erasable", false), //设置以后不能物理删除了
UpdateBuilder.create("publishTime", LocalDateTime.now()));
//发布到全文检索中
Course c=courseDao.get(courseId);
publishUtil.fullTextPublish(c);
//同时添加发布事件,这里的创建人需要修改为教师
if(eventSender!=null) {
List<CourseTeacher> teachers = courseTeacherDao.findList(FieldFilters.eq("courseId", courseId));
if(teachers.size()>0) {
String authorIds="";
for(CourseTeacher cteacher:teachers) {
if(authorIds.equals("")) {
authorIds+=cteacher.getTeacherId();
}else {
authorIds+="|"+cteacher.getTeacherId();
}
}
eventSender.send("发布课程","PublishCourse", "发布课程【"+c.getName()+"", c.getId(), "1", c.getName(), aid,name,"authors:"+authorIds);
}
}else {
log.error("未配置事件消息发送的实现");
}
}else {
//如果未通过,直接修改课程状态
courseDao.updateMultiFieldById(courseId,UpdateBuilder.create("status", status),UpdateBuilder.create("auditAid", null),UpdateBuilder.create("auditInfo", null));

View File

@@ -8,6 +8,7 @@ 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;
@@ -148,6 +149,7 @@ public class ExamQuestionApi extends ApiBaseController {
/**
* 导入
* */
@FileFormatVerification(whites = {"xls","xlsx"})
@PostMapping("/import")
public JsonResponse<QuestionDto> importQuestion(@RequestParam MultipartFile file){
//获取输入流

View File

@@ -1,7 +1,11 @@
package com.xboe.module.exam.api;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.xboe.api.ThirdApi;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.exception.ConstraintViolationException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -29,7 +33,8 @@ public class ExamTestApi extends ApiBaseController {
@Resource
private IExamTestService examTestService;
@Resource
ThirdApi thirdApi;
/**
*查询考试,分页,搜索,资源归属,状态
**/
@@ -77,16 +82,33 @@ public class ExamTestApi extends ApiBaseController {
* */
@PostMapping("update")
@AutoLog(module = "考试",action = "修改考试",info = "修改考试")
public JsonResponse<ExamTest> update(@RequestBody ExamTest examTest){
public JsonResponse<ExamTest> update(@RequestBody ExamTest examTest, HttpServletRequest request){
if(StringUtil.isBlank(examTest.getTestName())){
return badRequest("标题为空");
}
// 确保examTest有一个有效的主键ID如果适用
// 这取决于您的业务逻辑是否允许更新主键
// 通常,更新操作不会改变主键
if (examTest.getId() == null) {
return badRequest("更新操作需要有效的主键ID");
}
String token = request.getHeader("Xboe-Access-Token");
if (StringUtils.isEmpty(token)) {
token = request.getHeader("token");
}
try {
examTestService.update(examTest);
thirdApi.sqlUpdate(examTest,token);
return success(examTest);
} catch (ConstraintViolationException e) {
// 捕获约束违反异常,并返回一个更具体的错误消息
log.error("修改失败,违反了约束条件", e);
return error("修改失败,违反了约束条件(可能是主键已存在)");
} catch (Exception e) {
log.error("修改失败",e);
return error("修改失败",e.getMessage());
// 捕获其他所有异常
log.error("修改失败", e);
return error("修改失败", e.getMessage());
}
}
/**、

View File

@@ -101,7 +101,7 @@ public class ExamTest extends BaseEntity {
/**
* 试卷的ID
*/
@Column(name = "paper_id",nullable = false,length=20)
@Column(name = "paper_id",length=20)
private String paperId;
/**
@@ -173,7 +173,7 @@ public class ExamTest extends BaseEntity {
/**启用的,上架*/
@Column(name = "enabled", nullable = false, length = 1)
@Column(name = "enabled", length = 1)
private Boolean enabled;
@Transient

View File

@@ -70,7 +70,18 @@ public class ExamTestServiceImpl implements IExamTestService {
@Override
public void update(ExamTest examTest) {
examTestDao.update(examTest);
if (examTest.getId() == null) {
throw new IllegalArgumentException("ID must not be null");
}
String sql = "update boe_exam_test set arrange = "+ examTest.getArrange() +", deadline_time = '"+examTest.getDeadlineTime() +"' , " +
"entrance_time = '"+examTest.getEntranceTime() +"' , paper_id = "+examTest.getPaperId() +",pass_line = "+examTest.getPassLine() +
", percent_score = "+examTest.getPercentScore() +" ,publish_time = '"+examTest.getPublishTime()+"' , published = "+examTest.getPublished()+
",random_count = "+examTest.getRandomCount()+" ,random_mode = "+examTest.getRandomMode()+",range_type = "+examTest.getRangeType() +
",scoring_type = "+examTest.getScoringType() +",show_analysis="+examTest.getShowAnalysis() +",show_answer = "+examTest.getShowAnswer() +
",test_duration = "+examTest.getTestDuration() +",test_name = '"+examTest.getTestName() +"',test_remark= '"+examTest.getTestRemark() +
"',test_type= "+examTest.getTestType() +" ,test_up = '"+examTest.getTestUp() +"' ,test_front= '"+examTest.getTestFront() +
"',times = '"+examTest.getTimes() +"' where id = "+examTest.getId()+"";
examTestDao.sqlUpdate(sql);
}
@Override

View File

@@ -8,6 +8,7 @@ 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;
@@ -280,7 +281,8 @@ 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,6 +11,7 @@ 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;
@@ -198,6 +199,7 @@ public class UserGroupApi extends ApiBaseController {
* 不直接导入到数据库,而是解析文件并查询相应数据返回
* @return
*/
@FileFormatVerification(whites = {"xlsx","xls"})
@PostMapping("/import")
public JsonResponse<Iterable<UserImportDto>> importUserGroup(@RequestParam MultipartFile file) {

View File

@@ -94,5 +94,5 @@ public interface IStudyService {
* @param status
* @return
*/
PageList<StudyCourseItem> findItemPage(int pageIndex,int pageSize,String contentId,String courseId,String name,Integer status);
PageList<StudyCourseItem> findItemPage(int pageIndex, int pageSize, String contentId, String courseId, String name, Integer status);
}

View File

@@ -6,6 +6,7 @@ import com.xboe.common.OrderCondition;
import com.xboe.common.PageList;
import com.xboe.common.beans.KeyValue;
import com.xboe.school.study.entity.StudyCourse;
import com.xboe.school.study.entity.StudyCourseItem;
import com.xboe.school.study.entity.StudySignup;
/**
@@ -48,6 +49,13 @@ public interface IStudySignupService {
* @param signup
*/
StudyCourse addSignup(StudySignup signup);
/**
* 管理员添加报名课件
* @param signup
*/
StudyCourseItem addStudyCourseItem(StudySignup signup);
/**
* 删除报名,只有未审核过的才可以删除

View File

@@ -112,29 +112,34 @@ public class StudyExamServiceImpl implements IStudyExamService{
if(cexam.getScoringType()==CourseExam.SCORINGTYPE_LAST){
scItemDao.updateFieldById(exam.getStudyItemId(), "score",exam.getScore());
scItemDao.updateFieldById(exam.getStudyItemId(), "progress",prog);
}
if(prog==100){
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",100.0f);
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);
}
}
}
//1最高一次,用于最高一次的计算
if(cexam.getScoringType()==CourseExam.SCORINGTYPE_MAX) {
Float f=(Float)dao.findField("max(score)", FieldFilters.eq("contentId", exam.getContentId()));
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",100.0f);
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());
//执行完毕 清除redis记录
// redisTemplate.delete(key);
return "";

View File

@@ -1,6 +1,9 @@
package com.xboe.school.study.service.impl;
import java.math.BigInteger;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -8,7 +11,8 @@ import java.util.Map;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import com.xboe.api.ThirdApi;
import com.xboe.module.article.entity.Article;
import com.xboe.module.interaction.entity.Shares;
import com.xboe.school.study.entity.StudyCourse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -163,12 +167,10 @@ public class StudyServiceImpl implements IStudyService{
@Override
public PageList<StudyCourseItem> findItemPage(int pageIndex, int pageSize, String contentId, String courseId,String name,Integer status) {
QueryBuilder query=QueryBuilder.from(StudyCourseItem.class);
QueryBuilder query = QueryBuilder.from(StudyCourseItem.class);
query.setPageIndex(pageIndex);
query.setPageSize(pageSize);
OrderCondition oc=OrderCondition.desc("id");
query.addOrder(oc);
if(StringUtils.isNotBlank(contentId)) {
@@ -177,19 +179,116 @@ public class StudyServiceImpl implements IStudyService{
if(StringUtils.isNotBlank(courseId)) {
query.addFilter(FieldFilters.eq("courseId",courseId));
}
if(status!=null) {
if(status==1) {
query.addFilter(FieldFilters.eq("progress", 0));
}else {
query.addFilter(FieldFilters.eq("progress",100));
}
}
if(StringUtils.isNotBlank(name)) {
query.addFilter(FieldFilters.eq("aname", name));
}
return scItemDao.findPage(query.builder());
int pageIndex2 = pageIndex-1;
if(status!=null) {
if(status==3) {
query.addFilter(FieldFilters.eq("status", 2));
return scItemDao.findPage(query.builder());
}else if(status==2){
query.addFilter(FieldFilters.eq("status",9));
return scItemDao.findPage(query.builder());
}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(" +
" 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" +
" ) 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(" +
" 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" +
" ) group by bsc.id) as total";
log.info("资源完成情况未开始sql"+sql);
List<Object[]> list = scDao.sqlFindList(sql);
log.info("资源完成情况人数"+list);
int totalCount = scDao.sqlCount(sql2);
List<StudyCourseItem> item = new ArrayList<>();
for (Object[] objs : list) {
StudyCourseItem sc = new StudyCourseItem();
sc.setProgress(Integer.valueOf(objs[5].toString()));
sc.setStatus(Integer.valueOf(objs[6].toString()));
sc.setAname(objs[3].toString());
item.add(sc);
}
log.info("资源完成情况人员"+item);
PageList<StudyCourseItem> pageList = new PageList<>(item);
pageList.setCount(totalCount);
pageList.setPageSize(pageSize);
pageList.setList(item);
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 " +
"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 " +
"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 " +
"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 " +
"on a.course_id = b.course_id and a.id = b.id " +
"group by a.id) as total";
log.info("资源完成情况全部sql"+sql);
List<Object[]> list = scDao.sqlFindList(sql);
log.info("资源完成情况人数"+list);
int totalCount = scDao.sqlCount(sql2);
List<StudyCourseItem> item = new ArrayList<>();
for (Object[] objs : list) {
StudyCourseItem sc = new StudyCourseItem();
if (!"0".equals(objs[4].toString())) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime finishTime = LocalDateTime.parse(objs[4].toString(), formatter);
sc.setFinishTime(finishTime);
}
sc.setProgress(Integer.valueOf(objs[5].toString()));
sc.setStatus(Integer.valueOf(objs[6].toString()));
sc.setAname(objs[3].toString());
item.add(sc);
}
log.info("资源完成情况人员"+item);
PageList<StudyCourseItem> pageList = new PageList<>(item);
pageList.setCount(totalCount);
pageList.setPageSize(pageSize);
pageList.setList(item);
return pageList;
}

View File

@@ -4,9 +4,15 @@ import java.io.IOException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.List;
import java.util.Optional;
import javax.transaction.Transactional;
import com.xboe.module.course.dao.CourseContentDao;
import com.xboe.module.course.dto.CourseContentDto;
import com.xboe.module.course.entity.CourseContent;
import com.xboe.school.study.dao.StudyCourseItemDao;
import com.xboe.school.study.entity.StudyCourseItem;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -39,7 +45,13 @@ public class StudySignupServiceImpl implements IStudySignupService{
@Autowired
StudyCourseDao studyCourseDao;
@Autowired
StudyCourseItemDao scItemDao;
@Autowired
CourseContentDao contentDao;
@Autowired(required = false)
ICourseStudySearch esSearch;
@@ -69,7 +81,6 @@ public class StudySignupServiceImpl implements IStudySignupService{
signupDao.save(signup);
//添加到课程学习
LocalDateTime now=LocalDateTime.now();
StudyCourse sc=new StudyCourse();
sc.setAddTime(now);
sc.setAid(signup.getAid());
@@ -124,11 +135,40 @@ public class StudySignupServiceImpl implements IStudySignupService{
//courseDao.updateMultiFieldById(signup.getCourseId(),UpdateBuilder.create("studys", "studys+1",FieldUpdateType.EXPRESSION));
}
@Override
public StudyCourseItem addStudyCourseItem(StudySignup signup) {
String sql = "select id,course_id,content_name from boe_course_content where course_id = '"+signup.getCourseId()+"'";
List<Object[]> courseContents = contentDao.sqlFindList(sql);
if (!courseContents.isEmpty()) {
log.info("查看在线课集合内容数据(共 {} 条记录)", courseContents.size());
for (Object[] objs : courseContents){
log.info("查看在线课内容数据: {}", objs[0].toString());
// 使用toString()或自定义格式化字符串
StudyCourseItem scitem = new StudyCourseItem();
// 设置scitem的属性
scitem.setAname(signup.getName());
scitem.setAid(signup.getAid());
scitem.setCourseId(signup.getCourseId());
scitem.setProgress(0);
scitem.setScore(0f);
scitem.setStatus(1);
scitem.setContentId(objs[0].toString());
scitem.setStudyId(signup.getStudyId());
// 如果需要可以取消注释以下行来设置contentName
// scitem.setContentName(c.getContentName());
scItemDao.save(scitem);
}
} else {
log.info("没有找到在线课内容数据。");
}
return null;
}
@Override
public void addList(List<StudySignup> list) {
//用于管理员添加报名
for(StudySignup ss : list) {
addSignup(ss);
// addStudyCourseItem(ss);
}
}
@@ -136,7 +176,6 @@ public class StudySignupServiceImpl implements IStudySignupService{
public void audit(String id, String aid, String user, boolean pass, String remark) {
if(pass) {
StudySignup signup =signupDao.get(id);
//是否需要检查是否已报名
StudyCourse sc=new StudyCourse();
sc.setAddTime(LocalDateTime.now());

View File

@@ -14,8 +14,10 @@ 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;
@@ -43,6 +45,9 @@ public class SysUploaderApi extends ApiBaseController{
@Autowired
XFileUploader uploader;
@Value(value = "${boe.domain}")
String domain;
private static Set<String> fileTypeSet=new HashSet<>();
static {
@@ -61,7 +66,8 @@ public class SysUploaderApi extends ApiBaseController{
fileTypeSet.add("pdf");
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 {
//以下三项用于回调
@@ -149,7 +155,8 @@ public class SysUploaderApi extends ApiBaseController{
@RequestMapping(value = "/url/download", method = RequestMethod.GET)
public void urlDownload(HttpServletResponse res,String urlStr,String fileName) throws IOException {
URL url = new URL(urlStr);
URL url = new URL(urlStr);
downloadLimitation(url);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
//设置超时间为3秒
conn.setConnectTimeout(3*1000);
@@ -193,4 +200,19 @@ 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

@@ -0,0 +1,91 @@
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

@@ -0,0 +1,15 @@
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=qwert!W577
spring.redis.password=ENC(5oXfdmgE2DDHUFhrGkS/UzUCxr7s8stV)
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=boeRds01
spring.datasource.password=ENC(GrOwKqgCAlYEZYjiDYWEjVcKho+5TLgc)
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=qwert!W577
spring.redis.password=ENC(5oXfdmgE2DDHUFhrGkS/UzUCxr7s8stV)
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=boeRds01
spring.datasource.password=ENC(GrOwKqgCAlYEZYjiDYWEjVcKho+5TLgc)
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=qwert!W588
spring.redis.password=ENC(e1k00MMRGU0DUHvLX8JSOuDkCX0CWNif)
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=boeRds01
spring.datasource.password=ENC(GrOwKqgCAlYEZYjiDYWEjVcKho+5TLgc)
## 使用 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=qwert!W577
spring.redis.password=ENC(oXmZ5HIrhizHQ/DWPNv/S/1hUNJbbRjv)
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=boeRds01
spring.datasource.password=ENC(GrOwKqgCAlYEZYjiDYWEjVcKho+5TLgc)
## 使用 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=Boe@es123
xboe.elasticsearch.server.password=ENC(903xqMcg31J+OhmZ0AoinYqvzLoAt8UZ)
## 邮件的配置
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=qwert!W577
spring.redis.password=ENC(5oXfdmgE2DDHUFhrGkS/UzUCxr7s8stV)
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=boeRds01
spring.datasource.password=ENC(GrOwKqgCAlYEZYjiDYWEjVcKho+5TLgc)
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=Boe@es123
xboe.elasticsearch.server.password=ENC(903xqMcg31J+OhmZ0AoinYqvzLoAt8UZ)
## 邮件的配置
xboe.email.url=https://10.251.160.135/api/b1/email/send

View File

@@ -71,6 +71,7 @@ audience.getOrgUsers=${boe.domain}/userbasic/user/getOrgUsers
infrasApi.dict=${boe.domain}/infrasApi/dict/list
#获取非报名课id
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