mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-10 11:26:50 +08:00
Compare commits
194 Commits
zcwy0622-y
...
zcwy0912-l
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a8ce10c575 | ||
|
|
70a87ac812 | ||
|
|
5285506f0f | ||
|
|
33df8b0831 | ||
|
|
effb45c6d0 | ||
|
|
3af3c2eedf | ||
|
|
57e04f46c0 | ||
|
|
2e2edbbf57 | ||
|
|
beba553faa | ||
|
|
120a4f45fc | ||
|
|
18bb8a434a | ||
|
|
2ae3d99f21 | ||
|
|
89573debef | ||
|
|
457597eabc | ||
|
|
24ae3c0ec6 | ||
|
|
fffa12344a | ||
|
|
52a58a6c6f | ||
|
|
a4b034752d | ||
|
|
23e63062e9 | ||
|
|
06415d58ac | ||
|
|
3fc8ce614d | ||
|
|
bebe36d39e | ||
|
|
d4af5ba8d5 | ||
|
|
d42d1b2e83 | ||
|
|
cf64f0406f | ||
|
|
df3b0b95c1 | ||
|
|
f5ff666c07 | ||
|
|
731e62c89f | ||
|
|
7fe53c026e | ||
|
|
6492e3b0dd | ||
|
|
30aab6eab4 | ||
|
|
61754d3852 | ||
|
|
a26ee1c707 | ||
|
|
1f0060c4dc | ||
|
|
6b0050286c | ||
|
|
2b07029aca | ||
|
|
d2d7fab96c | ||
|
|
be3bae969c | ||
|
|
8e1b7519ef | ||
|
|
bddb11caf8 | ||
|
|
f0fe015561 | ||
|
|
91bcec00ef | ||
|
|
7a210ec701 | ||
|
|
6c616a1163 | ||
|
|
939325d5bd | ||
|
|
4eddbc8e8f | ||
|
|
50bdd59a26 | ||
|
|
b85eb97bc1 | ||
|
|
28b58a73cf | ||
|
|
b9adf4c45f | ||
|
|
49aab74463 | ||
|
|
9f30910d04 | ||
|
|
6658b8c04b | ||
|
|
19df4224a9 | ||
|
|
95ddc9f5d5 | ||
|
|
f3b6bb6fee | ||
|
|
64965f5ec6 | ||
|
|
a407ca2dad | ||
|
|
16f1c2337b | ||
|
|
bf476a23a0 | ||
|
|
92a4e509ef | ||
|
|
0f0edaf2cd | ||
|
|
68d00e8c51 | ||
|
|
41a542ea23 | ||
|
|
83e71dc5d6 | ||
|
|
fc98025a3a | ||
|
|
687cd24de3 | ||
|
|
f5f53557b6 | ||
|
|
4687b353eb | ||
|
|
4b4f30b412 | ||
|
|
072ee25037 | ||
|
|
6f19ff7b0f | ||
|
|
2f8163b0a3 | ||
|
|
f8566d2321 | ||
|
|
5890f1b800 | ||
|
|
d6102d1ce1 | ||
|
|
50942a9435 | ||
|
|
6521464676 | ||
|
|
3ec7f587b3 | ||
|
|
b6378b6565 | ||
|
|
885b203dd6 | ||
|
|
66d7f2a3cf | ||
|
|
e6f4affa21 | ||
|
|
faea4f8b2a | ||
|
|
e4f845fdde | ||
|
|
c203956bc6 | ||
|
|
c97cd3daab | ||
|
|
cf4004f073 | ||
|
|
74f37b008d | ||
|
|
6bf5ccbcec | ||
|
|
d0b1894c14 | ||
|
|
63867db58e | ||
|
|
7e1e32a70e | ||
|
|
30f8d363fa | ||
|
|
7ef0f976fc | ||
|
|
338a709ebc | ||
|
|
5a05ff74b7 | ||
|
|
650107aea1 | ||
|
|
a93580c387 | ||
|
|
4c6480b428 | ||
|
|
78184d3a11 | ||
|
|
901aded0c3 | ||
|
|
bcb8b59e8a | ||
|
|
e77ee34225 | ||
|
|
9373a95631 | ||
|
|
d81d4c474e | ||
|
|
2b3f59522c | ||
|
|
2f150449fe | ||
|
|
4f6fbff5e1 | ||
|
|
abef4c963e | ||
|
|
5e355986a0 | ||
|
|
13914ede08 | ||
|
|
7eb1dcd7c4 | ||
|
|
ea7ff473d0 | ||
|
|
9aaab480bf | ||
|
|
b0ac4951ad | ||
|
|
3e9eaf30cb | ||
|
|
9fbeea85c6 | ||
|
|
b2981cff8a | ||
|
|
dc2d144682 | ||
|
|
1025f8f716 | ||
|
|
46b63c36eb | ||
|
|
312108e6c0 | ||
|
|
fee3f263bc | ||
|
|
16c755d14d | ||
|
|
69b6a50011 | ||
|
|
bed3bd7fae | ||
|
|
d60a1521f9 | ||
|
|
34db08d1a8 | ||
|
|
2822021f30 | ||
|
|
63d3844b76 | ||
|
|
e9645d631d | ||
|
|
588f527293 | ||
|
|
99df06481f | ||
|
|
921aa5909e | ||
|
|
d514450f23 | ||
|
|
00c1fe8c49 | ||
|
|
92aa649fa1 | ||
|
|
019d534956 | ||
|
|
b67d931741 | ||
|
|
1bd09c0f02 | ||
|
|
1794344829 | ||
|
|
952f47fdc6 | ||
|
|
f19b928bc9 | ||
|
|
df91242e1b | ||
|
|
4c6f15a707 | ||
|
|
488e6c2872 | ||
|
|
e86afad4ef | ||
|
|
3285c639b9 | ||
|
|
db3695019a | ||
|
|
7b2217c017 | ||
|
|
84dd5cb192 | ||
|
|
333f29f008 | ||
|
|
407c7693bb | ||
|
|
564bf42464 | ||
|
|
55717e4dde | ||
|
|
2698061eae | ||
|
|
eb401d8fdf | ||
|
|
20374e274a | ||
|
|
c7a39a1f22 | ||
|
|
ba6cca93b3 | ||
|
|
7eb578127d | ||
|
|
f2be349301 | ||
|
|
e0037b8814 | ||
|
|
0b0bd748d9 | ||
|
|
9fd4171107 | ||
|
|
d23bfbe159 | ||
|
|
17ab1add64 | ||
|
|
625c41f466 | ||
|
|
f950788e08 | ||
|
|
7c9c1987a3 | ||
|
|
a26ceb86d1 | ||
|
|
a2317d0b59 | ||
|
|
53c38baf22 | ||
|
|
da6ed5eed4 | ||
|
|
b108bc3e76 | ||
|
|
1abd059820 | ||
|
|
e2c697f860 | ||
|
|
33fee46433 | ||
|
|
de69ba1c11 | ||
|
|
c6a785bb4f | ||
|
|
2fcdb6b4b6 | ||
|
|
7d08954525 | ||
|
|
62884bcc15 | ||
|
|
8567fa9ecc | ||
|
|
359b66e48a | ||
|
|
8125a6bd77 | ||
|
|
9b37e8a73d | ||
|
|
2fa3378e94 | ||
|
|
dd0af3cbef | ||
|
|
0b7784779f | ||
|
|
e03118275d | ||
|
|
1b1cb17861 | ||
|
|
a35c1faa49 |
@@ -4,22 +4,21 @@ import cn.hutool.core.collection.ListUtil;
|
|||||||
import cn.hutool.core.lang.Opt;
|
import cn.hutool.core.lang.Opt;
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.*;
|
|
||||||
import com.xboe.api.vo.*;
|
import com.xboe.api.vo.*;
|
||||||
import com.xboe.module.course.vo.StudyCourseVo;
|
import com.xboe.module.course.vo.StudyCourseVo;
|
||||||
import com.xboe.module.course.vo.TeacherInfoVo;
|
import com.xboe.module.course.vo.TeacherInfoVo;
|
||||||
import com.xboe.module.course.vo.TeacherVo;
|
import com.xboe.module.course.vo.TeacherVo;
|
||||||
import com.xboe.module.dict.entity.DictDto;
|
import com.xboe.module.dict.entity.DictDto;
|
||||||
import com.xboe.module.exam.entity.AloneExam;
|
import com.xboe.module.exam.entity.ExamTest;
|
||||||
import com.xboe.school.study.entity.StudyCourse;
|
import com.xboe.school.study.entity.StudyCourse;
|
||||||
import com.xboe.system.user.dao.UserDao;
|
import com.xboe.system.user.dao.UserDao;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import java.time.LocalDateTime;
|
import java.util.Collection;
|
||||||
import java.util.*;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.concurrent.ForkJoinPool;
|
import java.util.concurrent.ForkJoinPool;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
@@ -62,12 +61,8 @@ public class ThirdApi {
|
|||||||
@Value("${coursesuilt.getStudyStatus}")
|
@Value("${coursesuilt.getStudyStatus}")
|
||||||
private String getStudyStatus;
|
private String getStudyStatus;
|
||||||
|
|
||||||
@Value("${userBasic.getUserIdByWorkNum}")
|
@Value("${manageApi.editExam}")
|
||||||
private String getUserIdByWorkNum;
|
private String editExam;
|
||||||
|
|
||||||
@Value("${coursesuilt.syncExamScoreToCourseSuite}")
|
|
||||||
private String syncExamScoreToCourseSuite;
|
|
||||||
|
|
||||||
//获取例外人员的id
|
//获取例外人员的id
|
||||||
public List<String> getUserId(){
|
public List<String> getUserId(){
|
||||||
String responseBody = Optional.ofNullable(HttpRequest.get(infarasApiUrl+"?pid=316&type=1").execute() //prod 316
|
String responseBody = Optional.ofNullable(HttpRequest.get(infarasApiUrl+"?pid=316&type=1").execute() //prod 316
|
||||||
@@ -212,6 +207,14 @@ public class ThirdApi {
|
|||||||
return studyCourseResult.getResult();
|
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) {
|
public static void main(String[] args) {
|
||||||
String token = "eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJjb21wYW55Q29kZSI6IkMwMDEiLCJ1SWQiOiI5NjUzNDIwMjc0OTc2MDcxNjgiLCJjb21wYW55SWQiOiIxMDQxNjczOTc3Mzc5OTQ2NDk2IiwibG9naW5JZCI6IjE2ODg0NDg5MjIwNzY0OTE3NzgiLCJpc3MiOiJodHRwOi8vdS5ib2UuY29tIiwiR2l2ZW5OYW1lIjoiYm9ldSIsImV4cCI6MTY5MTM5OTc2NzU1OCwidXNlck5hbWUiOiLmnY7njonlhrAiLCJ1c2VySWQiOiI2QjA0OUZBRi1DMzE0LTdDQ0YtMEQyOC0wRDIzRjRDNDI1MzEifQ==.8b52dcf4d48a790ed258b9ca2b279bb269f5301722095382fbd352705b51c893";
|
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().
|
String resp = Optional.ofNullable(HttpRequest.post("https://u-pre.boe.com/statApi/xboe/m/stat/userdynamic/list").body(JSONUtil.toJsonStr(UserdynamicParam.builder().
|
||||||
@@ -223,41 +226,10 @@ public class ThirdApi {
|
|||||||
List<UserDynamic> list = a.getResult().getList();
|
List<UserDynamic> list = a.getResult().getList();
|
||||||
System.out.println(" list = " +list.size());
|
System.out.println(" list = " +list.size());
|
||||||
System.out.println(" list = " +list);
|
System.out.println(" list = " +list);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public HashMap<String, String> getUserIdByWorkNum(String token, List<String> workNumList) {
|
|
||||||
// 将workNum列表转换为逗号分隔的字符串
|
|
||||||
String workNums = workNumList.stream()
|
|
||||||
.collect(Collectors.joining(","));
|
|
||||||
// 构建请求URL
|
|
||||||
String url = getUserIdByWorkNum+"?workNums=" + workNums;
|
|
||||||
String respStr = Optional.ofNullable(
|
|
||||||
HttpRequest.get(url)
|
|
||||||
.header("token", token)
|
|
||||||
.execute().body()
|
|
||||||
).orElseThrow(() -> new RuntimeException("Token校验失败"));
|
|
||||||
// 解析JSON字符串为HashMap
|
|
||||||
GetUserIdByWorkNumResult getUserIdByWorkNumResult = JSONUtil.parseObj(respStr).toBean(GetUserIdByWorkNumResult.class);
|
|
||||||
HashMap<String, String> result = getUserIdByWorkNumResult.getResult();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void syncExamScoreToCourseSuite(AloneExam aloneExam,String token) {
|
|
||||||
Gson gson = new GsonBuilder()
|
|
||||||
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer())
|
|
||||||
.create();
|
|
||||||
|
|
||||||
String json = gson.toJson(aloneExam);
|
|
||||||
String resp = HttpRequest.post(syncExamScoreToCourseSuite)
|
|
||||||
.body(json)
|
|
||||||
.header("token", token)
|
|
||||||
.execute()
|
|
||||||
.body();
|
|
||||||
|
|
||||||
if (StringUtils.isBlank(resp)){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
JSONUtil.toBean(resp, SyncExamScoreBean.class).success();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
package com.xboe.api.vo;
|
|
||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.xboe.school.study.entity.StudyCourse;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Slf4j
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class CheckExamBandingBean {
|
|
||||||
|
|
||||||
private boolean show;
|
|
||||||
private String version;
|
|
||||||
private int code;
|
|
||||||
private String msg;
|
|
||||||
private Object data;
|
|
||||||
private boolean success;
|
|
||||||
|
|
||||||
public CheckExamBandingBean success() {
|
|
||||||
if (this.code!=200) {
|
|
||||||
log.error("获取绑定关系失败----{}", JSONUtil.toJsonPrettyStr(this));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
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.HashMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto-generated: 2022-12-10 14:3:18
|
|
||||||
*
|
|
||||||
* @author bejson.com (i@bejson.com)
|
|
||||||
* @website http://www.bejson.com/java2pojo/
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Slf4j
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class GetUserIdByWorkNumResult {
|
|
||||||
|
|
||||||
private String error;
|
|
||||||
private String message;
|
|
||||||
private String permissions;
|
|
||||||
private HashMap<String,String> result;
|
|
||||||
private int status;
|
|
||||||
private Date timestamp;
|
|
||||||
|
|
||||||
public GetUserIdByWorkNumResult success() {
|
|
||||||
if (this.status != 200) {
|
|
||||||
log.error("获取用户ID列表失败----{}", JSONUtil.toJsonPrettyStr(this));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.xboe.api.vo;
|
|
||||||
|
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.JsonElement;
|
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.JsonPrimitive;
|
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.JsonSerializationContext;
|
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.JsonSerializer;
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
|
|
||||||
public class LocalDateTimeSerializer implements JsonSerializer<LocalDateTime> {
|
|
||||||
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonElement serialize(LocalDateTime src, Type typeOfSrc, JsonSerializationContext context) {
|
|
||||||
return new JsonPrimitive(formatter.format(src));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Slf4j
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class SyncExamScoreBean {
|
|
||||||
|
|
||||||
private boolean show;
|
|
||||||
private String version;
|
|
||||||
private int code;
|
|
||||||
private String msg;
|
|
||||||
private Object data;
|
|
||||||
private boolean success;
|
|
||||||
|
|
||||||
public SyncExamScoreBean success() {
|
|
||||||
if (this.code!=200) {
|
|
||||||
log.error("同步考试到boe库失败----{}", JSONUtil.toJsonPrettyStr(this));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,5 +17,7 @@ public class UserOrgIds {
|
|||||||
private Map<String,Boolean> permissions=new HashMap<String,Boolean>();
|
private Map<String,Boolean> permissions=new HashMap<String,Boolean>();
|
||||||
|
|
||||||
private List<String> ids;
|
private List<String> ids;
|
||||||
|
//hrbp只读权限
|
||||||
|
private List<String> readIds;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,8 +229,10 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
|||||||
public UserOrgIds getOrgIds() {
|
public UserOrgIds getOrgIds() {
|
||||||
UserOrgIds uids=new UserOrgIds();
|
UserOrgIds uids=new UserOrgIds();
|
||||||
List<String> orgIds = new ArrayList<>();
|
List<String> orgIds = new ArrayList<>();
|
||||||
|
List<String> readIds = new ArrayList<>();
|
||||||
|
|
||||||
uids.setIds(orgIds);
|
uids.setIds(orgIds);
|
||||||
|
uids.setReadIds(readIds);
|
||||||
String token = TokenProxy.getToken(request);
|
String token = TokenProxy.getToken(request);
|
||||||
String type="application/json";
|
String type="application/json";
|
||||||
String[] headers=new String[] {"token",token,"Content-Type",type};
|
String[] headers=new String[] {"token",token,"Content-Type",type};
|
||||||
@@ -281,7 +283,8 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
|||||||
while (elements.hasNext()){
|
while (elements.hasNext()){
|
||||||
String oid=elements.next().asText();
|
String oid=elements.next().asText();
|
||||||
if(!orgSetIds.contains(oid)) {
|
if(!orgSetIds.contains(oid)) {
|
||||||
orgIds.add(oid);
|
// orgIds.add(oid);
|
||||||
|
readIds.add(oid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
package com.xboe.module.course.api;
|
package com.xboe.module.course.api;
|
||||||
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -134,7 +130,6 @@ public class CourseManageApi extends ApiBaseController{
|
|||||||
}else {
|
}else {
|
||||||
dto.setIsSystemAdmin(false);
|
dto.setIsSystemAdmin(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
String ids="";
|
String ids="";
|
||||||
if(userOrgIds.getIds()!=null && !userOrgIds.getIds().isEmpty())
|
if(userOrgIds.getIds()!=null && !userOrgIds.getIds().isEmpty())
|
||||||
{
|
{
|
||||||
@@ -142,12 +137,14 @@ public class CourseManageApi extends ApiBaseController{
|
|||||||
}
|
}
|
||||||
//log.info("获取到的用户的组织机构权限ids",ids);
|
//log.info("获取到的用户的组织机构权限ids",ids);
|
||||||
String aid=getCurrent().getAccountId();
|
String aid=getCurrent().getAccountId();
|
||||||
|
// String aid="1706272694871445506";
|
||||||
//如果前端查询当前人的,这里去掉
|
//如果前端查询当前人的,这里去掉
|
||||||
if(StringUtils.isNotBlank(dto.getAid())) {
|
if(StringUtils.isNotBlank(dto.getAid())) {
|
||||||
dto.setAid(null);
|
dto.setAid(null);
|
||||||
}
|
}
|
||||||
dto.setOrgAid(aid);
|
dto.setOrgAid(aid);
|
||||||
dto.setOrgIds(ids);
|
dto.setOrgIds(ids);
|
||||||
|
dto.setReadIds(userOrgIds.getReadIds());
|
||||||
PageList<Course> coursePageList = courseService.findPage(pager.getPageIndex(), pager.getPageSize(),dto);
|
PageList<Course> coursePageList = courseService.findPage(pager.getPageIndex(), pager.getPageSize(),dto);
|
||||||
return success(coursePageList);
|
return success(coursePageList);
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import javax.servlet.http.Cookie;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -28,6 +29,7 @@ import com.xboe.module.course.service.ICourseFileService;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/xboe/m/course/cware")
|
@RequestMapping(value = "/xboe/m/course/cware")
|
||||||
|
@Slf4j
|
||||||
public class CourseWareApi extends ApiBaseController {
|
public class CourseWareApi extends ApiBaseController {
|
||||||
|
|
||||||
private String cookieName = "PLAYSIGN_TIME";
|
private String cookieName = "PLAYSIGN_TIME";
|
||||||
@@ -131,6 +133,8 @@ public class CourseWareApi extends ApiBaseController {
|
|||||||
// 第一个/前端是时间
|
// 第一个/前端是时间
|
||||||
int index = signStr.indexOf("/");
|
int index = signStr.indexOf("/");
|
||||||
if (index <= 0) {
|
if (index <= 0) {
|
||||||
|
log.info("解密后的字符串:"+signStr);
|
||||||
|
log.info("解密后的字符串的时间拼接:"+index);
|
||||||
return badRequest("验证错误");
|
return badRequest("验证错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,9 +142,13 @@ public class CourseWareApi extends ApiBaseController {
|
|||||||
String cfid = signStr.substring(index+1);// 文件路径
|
String cfid = signStr.substring(index+1);// 文件路径
|
||||||
|
|
||||||
if (!time.equals(cookieTime)) {
|
if (!time.equals(cookieTime)) {
|
||||||
|
log.info("请求头时间和解析后的时间对比:"+"解析时间:"+time+" 请求头时间:"+cookieTime);
|
||||||
|
log.info("解密后的字符串的时间拼接:"+signStr);
|
||||||
return badRequest("验证错误");
|
return badRequest("验证错误");
|
||||||
}
|
}
|
||||||
if(StringUtils.isBlank(cfid) || cfid.length()<10) {
|
if(StringUtils.isBlank(cfid) || cfid.length()<10) {
|
||||||
|
log.info("查看时间文件路径:"+cfid);
|
||||||
|
log.info("解密后的字符串的时间拼接:"+signStr);
|
||||||
return badRequest("验证错误");
|
return badRequest("验证错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package com.xboe.module.course.dao;
|
package com.xboe.module.course.dao;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import com.xboe.core.orm.BaseDao;
|
import com.xboe.core.orm.BaseDao;
|
||||||
import com.xboe.module.course.entity.CourseContent;
|
import com.xboe.module.course.entity.CourseContent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class CourseContentDao extends BaseDao<CourseContent> {
|
public class CourseContentDao extends BaseDao<CourseContent> {
|
||||||
|
|
||||||
@@ -20,4 +23,5 @@ public class CourseContentDao extends BaseDao<CourseContent> {
|
|||||||
int count=count(hql, courseId);
|
int count=count(hql, courseId);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.xboe.module.course.dto;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程查询的条件对象
|
* 课程查询的条件对象
|
||||||
*/
|
*/
|
||||||
@@ -102,6 +104,9 @@ public class CourseQueryDto {
|
|||||||
* */
|
* */
|
||||||
private String orgIds;
|
private String orgIds;
|
||||||
|
|
||||||
|
//hrpb只读
|
||||||
|
private List<String> readIds;
|
||||||
|
|
||||||
/**用户权限的查询*/
|
/**用户权限的查询*/
|
||||||
private String orgAid;
|
private String orgAid;
|
||||||
|
|
||||||
@@ -110,6 +115,11 @@ public class CourseQueryDto {
|
|||||||
*/
|
*/
|
||||||
private Boolean isSystemAdmin;
|
private Boolean isSystemAdmin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是新建在线可
|
||||||
|
*/
|
||||||
|
private Boolean isCreateCourse;
|
||||||
|
|
||||||
private Boolean visible;
|
private Boolean visible;
|
||||||
|
|
||||||
private String refId;
|
private String refId;
|
||||||
@@ -129,4 +139,5 @@ public class CourseQueryDto {
|
|||||||
* 登录人id
|
* 登录人id
|
||||||
*/
|
*/
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -370,6 +370,9 @@ public class Course extends BaseEntity {
|
|||||||
|
|
||||||
@Column(name = "ref_type",length=32,columnDefinition="varchar(32) comment '反向关联的类型'")
|
@Column(name = "ref_type",length=32,columnDefinition="varchar(32) comment '反向关联的类型'")
|
||||||
private String refType;
|
private String refType;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private Boolean isPermission=true;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private String orgName;
|
private String orgName;
|
||||||
|
|||||||
@@ -83,8 +83,13 @@ public class CourseContent extends BaseEntity {
|
|||||||
* */
|
* */
|
||||||
@Column(name = "duration")
|
@Column(name = "duration")
|
||||||
private Integer duration;
|
private Integer duration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频播放进度
|
||||||
|
* */
|
||||||
|
@Column(name = "progress_video")
|
||||||
|
private Float progressVideo;
|
||||||
|
|
||||||
/**用于学习时的状态显示,非存储字段*/
|
/**用于学习时的状态显示,非存储字段*/
|
||||||
@Transient
|
@Transient
|
||||||
private Integer status;
|
private Integer status;
|
||||||
@@ -100,6 +105,21 @@ public class CourseContent extends BaseEntity {
|
|||||||
this.contentType=contentType;
|
this.contentType=contentType;
|
||||||
this.contentRefId=contentRefId;
|
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 +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,4 +82,7 @@ public interface ICourseContentService{
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
CourseAssess getAssess(String ccid);
|
CourseAssess getAssess(String ccid);
|
||||||
|
|
||||||
|
void updateProcessVideo(String contentId, String courseId, Float processVideo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,6 +214,12 @@ public class CourseAuditServiceImpl implements ICourseAuditService{
|
|||||||
UpdateBuilder.create("lastState", CourseHRBPAudit.STATUS_PASS)
|
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);
|
Course c=courseDao.get(courseId);
|
||||||
publishUtil.fullTextPublish(c);
|
publishUtil.fullTextPublish(c);
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.xboe.module.course.service.impl;
|
package com.xboe.module.course.service.impl;
|
||||||
|
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -141,6 +143,17 @@ public class CourseContentServiceImpl implements ICourseContentService {
|
|||||||
return assess;
|
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
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateName(String id, String name) {
|
public void updateName(String id, String name) {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,5 @@
|
|||||||
package com.xboe.module.exam.api;
|
package com.xboe.module.exam.api;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -15,12 +14,15 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.xboe.module.exam.dto.SaveExamScoreDto;
|
|
||||||
import com.xboe.module.exam.entity.*;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.dao.DuplicateKeyException;
|
import org.springframework.dao.DuplicateKeyException;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
@@ -39,6 +41,9 @@ import com.xboe.core.cache.IXaskCache;
|
|||||||
import com.xboe.core.cache.XaskCacheProvider;
|
import com.xboe.core.cache.XaskCacheProvider;
|
||||||
import com.xboe.core.exception.XaskException;
|
import com.xboe.core.exception.XaskException;
|
||||||
import com.xboe.module.exam.dto.AloneExamExportDto;
|
import com.xboe.module.exam.dto.AloneExamExportDto;
|
||||||
|
import com.xboe.module.exam.entity.AloneExam;
|
||||||
|
import com.xboe.module.exam.entity.AloneExamAnswer;
|
||||||
|
import com.xboe.module.exam.entity.ExamTest;
|
||||||
import com.xboe.module.exam.service.IAloneExamService;
|
import com.xboe.module.exam.service.IAloneExamService;
|
||||||
import com.xboe.module.exam.service.IExamPaperService;
|
import com.xboe.module.exam.service.IExamPaperService;
|
||||||
import com.xboe.module.exam.service.IExamTestService;
|
import com.xboe.module.exam.service.IExamTestService;
|
||||||
@@ -350,17 +355,17 @@ public class AloneExamApi extends ApiBaseController {
|
|||||||
return badRequest("此考试无试卷内容,考试已经过期或试卷已被删除");
|
return badRequest("此考试无试卷内容,考试已经过期或试卷已被删除");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
List<TestQuestionVo> qlist=this.randomQuestion(examTest, paperJson);
|
List<TestQuestionVo> qlist=this.randomQuestion(examTest, paperJson);
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
paperJson=objectMapper.writeValueAsString(qlist);
|
paperJson=objectMapper.writeValueAsString(qlist);
|
||||||
} catch (XaskException e) {
|
} catch (XaskException e) {
|
||||||
log.error("生成试卷错误",e);
|
log.error("生成试卷错误",e);
|
||||||
return error("生成考试试卷错误",e.getMessage(),map);
|
return error("生成考试试卷错误",e.getMessage(),map);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
log.error("生成试卷,解析生成json错误",e);
|
log.error("生成试卷,解析生成json错误",e);
|
||||||
return error("生成考试试卷解析错误",e.getMessage(),map);
|
return error("生成考试试卷解析错误",e.getMessage(),map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
map.put("paper", paperJson);
|
map.put("paper", paperJson);
|
||||||
long end=System.currentTimeMillis();
|
long end=System.currentTimeMillis();
|
||||||
log.info("开始考试用时="+(end-start)+" ms");
|
log.info("开始考试用时="+(end-start)+" ms");
|
||||||
@@ -548,7 +553,6 @@ public class AloneExamApi extends ApiBaseController {
|
|||||||
//转化成百分数
|
//转化成百分数
|
||||||
//answer.setScore(this.calculateScore(detail));
|
//answer.setScore(this.calculateScore(detail));
|
||||||
service.submit(answer,scoreType);
|
service.submit(answer,scoreType);
|
||||||
service.syncExamScoreToCourseSuite(answer, request);
|
|
||||||
return success(map);
|
return success(map);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("提交答卷错误", e);
|
log.error("提交答卷错误", e);
|
||||||
@@ -703,19 +707,4 @@ public class AloneExamApi extends ApiBaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param saveExamScoreDtoList
|
|
||||||
* @return
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
@PostMapping("/examScoreBatchAdd")
|
|
||||||
public JsonResponse examScoreBatchAdd(HttpServletRequest request, @RequestBody List<SaveExamScoreDto> saveExamScoreDtoList){
|
|
||||||
service.examScoreBatchAdd(request, saveExamScoreDtoList);
|
|
||||||
return success("导入成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,118 +166,258 @@ public class ExamQuestionApi extends ApiBaseController {
|
|||||||
return badRequest("请上传正确的试题文件");
|
return badRequest("请上传正确的试题文件");
|
||||||
}
|
}
|
||||||
//获取表头
|
//获取表头
|
||||||
Row row = sheetAt.getRow(1);
|
Row row ;
|
||||||
//从第二行开始获取数据
|
//从第二行开始获取数据
|
||||||
List<ExamQuestion> examQuestions1 = new ArrayList<>();
|
List<ExamQuestion> examQuestions1 = new ArrayList<>();
|
||||||
QuestionDto questionDto = new QuestionDto();
|
QuestionDto questionDto = new QuestionDto();
|
||||||
|
if(sheetAt.getRow(1).getCell(0).getStringCellValue().equals("标题(*)") && !sheetAt.getRow(1).getCell(0).getStringCellValue().equals("")){
|
||||||
|
row = sheetAt.getRow(1);
|
||||||
|
for (int i = 2;i<sheetAt.getPhysicalNumberOfRows();i++) {
|
||||||
|
//获取每一行
|
||||||
|
|
||||||
for (int i=2;i<sheetAt.getPhysicalNumberOfRows();i++) {
|
Row row1 = sheetAt.getRow(i);
|
||||||
//获取每一行
|
if(row1==null || row1.getCell(0)==null){
|
||||||
|
break;
|
||||||
Row row1 = sheetAt.getRow(i);
|
}
|
||||||
if(row1==null || row1.getCell(0)==null){
|
if(StringUtil.isBlank(row1.getCell(0).getStringCellValue())){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(StringUtil.isBlank(row1.getCell(0).getStringCellValue())){
|
ExamQuestion examQuestion = new ExamQuestion();
|
||||||
break;
|
examQuestion.setTitle(row1.getCell(0).getStringCellValue());
|
||||||
}
|
if(row1.getCell(1).getStringCellValue().equals("单选题")){
|
||||||
ExamQuestion examQuestion = new ExamQuestion();
|
examQuestion.setType(1);
|
||||||
examQuestion.setTitle(row1.getCell(0).getStringCellValue());
|
}
|
||||||
if(row1.getCell(1).getStringCellValue().equals("单选题")){
|
if(row1.getCell(1).getStringCellValue().equals("多选题")){
|
||||||
examQuestion.setType(1);
|
examQuestion.setType(2);
|
||||||
}
|
}
|
||||||
if(row1.getCell(1).getStringCellValue().equals("多选题")){
|
if(row1.getCell(2).getStringCellValue().equals("中")){
|
||||||
examQuestion.setType(2);
|
examQuestion.setDifficulty(2f);
|
||||||
}
|
}else if(row1.getCell(2).getStringCellValue().equals("难")){
|
||||||
examQuestion.setKnowledge(row1.getCell(2).getStringCellValue());
|
examQuestion.setDifficulty(3f);
|
||||||
if(row1.getCell(3).getStringCellValue().equals("中")){
|
} else if(row1.getCell(2).getStringCellValue().equals("易")){
|
||||||
examQuestion.setDifficulty(2f);
|
examQuestion.setDifficulty(1f);
|
||||||
}
|
}else if(row1.getCell(2).getStringCellValue().equals("")){
|
||||||
if(row1.getCell(3).getStringCellValue().equals("难")){
|
examQuestion.setDifficulty(null);
|
||||||
examQuestion.setDifficulty(3f);
|
}
|
||||||
}
|
Cell cell = row1.getCell(3);
|
||||||
if(row1.getCell(3).getStringCellValue().equals("低")){
|
cell.setCellType(CellType.STRING);
|
||||||
examQuestion.setDifficulty(1f);
|
|
||||||
}
|
|
||||||
Cell cell = row1.getCell(4);
|
|
||||||
cell.setCellType(CellType.STRING);
|
|
||||||
|
|
||||||
// examQuestion.setDefaultScore(Float.valueOf(cell.getStringCellValue()));
|
// examQuestion.setDefaultScore(Float.valueOf(cell.getStringCellValue()));
|
||||||
|
|
||||||
//单选
|
//单选
|
||||||
if (!cell.getStringCellValue().contains(",")){
|
if (!cell.getStringCellValue().contains(",")){
|
||||||
examQuestion.setAnswer(row1.getCell(6).getStringCellValue());
|
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||||
examQuestion.setDefaultScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||||
Cell cell1 = row1.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
examQuestion.setDefaultScore(null);
|
||||||
cell1.setCellType(CellType.STRING);
|
}else {
|
||||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
examQuestion.setDefaultScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||||
|
}
|
||||||
|
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell1.setCellType(CellType.STRING);
|
||||||
|
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||||
|
|
||||||
List<ExamOption> examOptions = new ArrayList<>();
|
List<ExamOption> examOptions = new ArrayList<>();
|
||||||
for (int j=7;j<=13;j++) {
|
for (int j=6;j<=12;j++) {
|
||||||
|
|
||||||
if(row1.getCell(j)!=null) {
|
if(row1.getCell(j)!=null) {
|
||||||
ExamOption examOption = new ExamOption();
|
ExamOption examOption = new ExamOption();
|
||||||
// 截取表头
|
// 截取表头
|
||||||
String substring = row.getCell(j).getStringCellValue().substring(3, 4);
|
String substring = row.getCell(j).getStringCellValue().substring(3, 4);
|
||||||
if (row1.getCell(6).getStringCellValue().contains(substring)) {
|
if (row1.getCell(5).getStringCellValue().contains(substring)) {
|
||||||
|
|
||||||
examOption.setIsAnswer(true);
|
examOption.setIsAnswer(true);
|
||||||
examOption.setScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||||
} else {
|
examOption.setScore(null);
|
||||||
examOption.setIsAnswer(false);
|
}else {
|
||||||
}
|
examOption.setScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||||
if (examOption.getIsAnswer()) {
|
}
|
||||||
examOption.setScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
} else {
|
||||||
}
|
examOption.setIsAnswer(false);
|
||||||
|
}
|
||||||
|
if (examOption.getIsAnswer()) {
|
||||||
|
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||||
|
examOption.setScore(null);
|
||||||
|
}else {
|
||||||
|
examOption.setScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
examOption.setOptions(row.getCell(j).getStringCellValue());
|
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||||
|
|
||||||
Cell cell2 = row1.getCell(j);
|
Cell cell2 = row1.getCell(j);
|
||||||
cell2.setCellType(CellType.STRING);
|
cell2.setCellType(CellType.STRING);
|
||||||
examOption.setContent(cell2.getStringCellValue());
|
examOption.setContent(cell2.getStringCellValue());
|
||||||
|
|
||||||
if (examOption != null && StringUtil.isNotBlank(examOption.getContent())) {
|
if (examOption != null && StringUtil.isNotBlank(examOption.getContent())) {
|
||||||
examOptions.add(examOption);
|
examOptions.add(examOption);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
examQuestion.setOptionList(examOptions);
|
examQuestion.setOptionList(examOptions);
|
||||||
examQuestions1.add(examQuestion);
|
examQuestions1.add(examQuestion);
|
||||||
}
|
}
|
||||||
//多选 多选的默认分存的是最大分
|
//多选 多选的默认分存的是最大分
|
||||||
else{
|
else{
|
||||||
String stringCellValue = row1.getCell(4).getStringCellValue();
|
String stringCellValue = row1.getCell(4).getStringCellValue();
|
||||||
String[] strings = stringCellValue.split(",");
|
String[] strings = stringCellValue.split(",");
|
||||||
// String[] strings = new String[stringCellValue.length()];
|
// String[] strings = new String[stringCellValue.length()];
|
||||||
String max=strings[0];
|
String max=strings[0];
|
||||||
for (int j=0;j<strings.length;j++) {
|
for (int j=0;j<strings.length;j++) {
|
||||||
if(Float.valueOf(max)<Float.valueOf(strings[j])){
|
if(Float.valueOf(max)<Float.valueOf(strings[j])){
|
||||||
max=strings[j];
|
max=strings[j];
|
||||||
}
|
|
||||||
}
|
|
||||||
examQuestion.setDefaultScore(Float.valueOf(max));
|
|
||||||
Cell cell1 = row1.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
|
||||||
cell1.setCellType(CellType.STRING);
|
|
||||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
|
||||||
examQuestion.setAnswer(row1.getCell(6).getStringCellValue());
|
|
||||||
List<ExamOption> examOptions = new ArrayList<>();
|
|
||||||
//A
|
|
||||||
for (int j=7;j<=13;j++){
|
|
||||||
if(row1.getCell(j)!=null && StringUtil.isNotBlank(row1.getCell(j).getStringCellValue())){
|
|
||||||
ExamOption examOption=new ExamOption();
|
|
||||||
examOption.setOptions(row.getCell(j).getStringCellValue());
|
|
||||||
examOption.setContent(row1.getCell(j).getStringCellValue());
|
|
||||||
examOption.setIsAnswer(true);
|
|
||||||
examOption.setScore(Float.valueOf(strings[j-7]));
|
|
||||||
if(examOption!=null && StringUtil.isNotBlank(examOption.getContent())){
|
|
||||||
examOptions.add(examOption);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
examQuestion.setDefaultScore(Float.valueOf(max));
|
||||||
|
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell1.setCellType(CellType.STRING);
|
||||||
|
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||||
|
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||||
|
List<ExamOption> examOptions = new ArrayList<>();
|
||||||
|
//A
|
||||||
|
for (int j=6;j<=12;j++){
|
||||||
|
if(row1.getCell(j)!=null && StringUtil.isNotBlank(row1.getCell(j).getStringCellValue())){
|
||||||
|
ExamOption examOption=new ExamOption();
|
||||||
|
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||||
|
examOption.setContent(row1.getCell(j).getStringCellValue());
|
||||||
|
examOption.setIsAnswer(true);
|
||||||
|
examOption.setScore(Float.valueOf(strings[j-6]));
|
||||||
|
if(examOption!=null && StringUtil.isNotBlank(examOption.getContent())){
|
||||||
|
examOptions.add(examOption);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
examQuestion.setOptionList(examOptions);
|
||||||
|
examQuestions1.add(examQuestion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
row = sheetAt.getRow(2);
|
||||||
|
for (int i = 3;i<sheetAt.getPhysicalNumberOfRows();i++) {
|
||||||
|
//获取每一行
|
||||||
|
|
||||||
|
Row row1 = sheetAt.getRow(i);
|
||||||
|
if(row1==null || row1.getCell(0)==null){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(StringUtil.isBlank(row1.getCell(0).getStringCellValue())){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ExamQuestion examQuestion = new ExamQuestion();
|
||||||
|
examQuestion.setTitle(row1.getCell(0).getStringCellValue());
|
||||||
|
if(row1.getCell(1).getStringCellValue().equals("单选题")){
|
||||||
|
examQuestion.setType(1);
|
||||||
|
}
|
||||||
|
if(row1.getCell(1).getStringCellValue().equals("多选题")){
|
||||||
|
examQuestion.setType(2);
|
||||||
|
}
|
||||||
|
log.debug("row1.getCell(2) = " + row1.getCell(2));
|
||||||
|
if (row1.getCell(2)==null ||row1.getCell(2).getStringCellValue() == null || row1.getCell(2).getStringCellValue().equals("")){
|
||||||
|
examQuestion.setDifficulty(null);
|
||||||
|
}else{
|
||||||
|
if( row1.getCell(2).getStringCellValue().equals("中")){
|
||||||
|
examQuestion.setDifficulty(2f);
|
||||||
|
}else if(row1.getCell(2).getStringCellValue().equals("难")){
|
||||||
|
examQuestion.setDifficulty(3f);
|
||||||
|
} else if(row1.getCell(2).getStringCellValue().equals("易")){
|
||||||
|
examQuestion.setDifficulty(1f);
|
||||||
|
}else if(row1.getCell(2).getStringCellValue().equals("")){
|
||||||
|
examQuestion.setDifficulty(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
examQuestion.setOptionList(examOptions);
|
Cell cell = row1.getCell(3);
|
||||||
examQuestions1.add(examQuestion);
|
cell.setCellType(CellType.STRING);
|
||||||
|
|
||||||
|
// examQuestion.setDefaultScore(Float.valueOf(cell.getStringCellValue()));
|
||||||
|
|
||||||
|
//单选
|
||||||
|
if (!cell.getStringCellValue().contains(",")){
|
||||||
|
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||||
|
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||||
|
examQuestion.setDefaultScore(null);
|
||||||
|
}else {
|
||||||
|
examQuestion.setDefaultScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||||
|
}
|
||||||
|
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell1.setCellType(CellType.STRING);
|
||||||
|
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||||
|
|
||||||
|
List<ExamOption> examOptions = new ArrayList<>();
|
||||||
|
for (int j=6;j<=12;j++) {
|
||||||
|
|
||||||
|
if(row1.getCell(j)!=null) {
|
||||||
|
ExamOption examOption = new ExamOption();
|
||||||
|
// 截取表头
|
||||||
|
String substring = row.getCell(j).getStringCellValue().substring(3, 4);
|
||||||
|
if (row1.getCell(5).getStringCellValue().contains(substring)) {
|
||||||
|
|
||||||
|
examOption.setIsAnswer(true);
|
||||||
|
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||||
|
examOption.setScore(null);
|
||||||
|
}else {
|
||||||
|
examOption.setScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
examOption.setIsAnswer(false);
|
||||||
|
}
|
||||||
|
if (examOption.getIsAnswer()) {
|
||||||
|
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||||
|
examOption.setScore(null);
|
||||||
|
}else {
|
||||||
|
examOption.setScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||||
|
|
||||||
|
Cell cell2 = row1.getCell(j);
|
||||||
|
cell2.setCellType(CellType.STRING);
|
||||||
|
examOption.setContent(cell2.getStringCellValue());
|
||||||
|
|
||||||
|
if (examOption != null && StringUtil.isNotBlank(examOption.getContent())) {
|
||||||
|
examOptions.add(examOption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
examQuestion.setOptionList(examOptions);
|
||||||
|
examQuestions1.add(examQuestion);
|
||||||
|
}
|
||||||
|
//多选 多选的默认分存的是最大分
|
||||||
|
else{
|
||||||
|
String stringCellValue = row1.getCell(4).getStringCellValue();
|
||||||
|
String[] strings = stringCellValue.split(",");
|
||||||
|
// String[] strings = new String[stringCellValue.length()];
|
||||||
|
String max=strings[0];
|
||||||
|
for (int j=0;j<strings.length;j++) {
|
||||||
|
if(Float.valueOf(max)<Float.valueOf(strings[j])){
|
||||||
|
max=strings[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
examQuestion.setDefaultScore(Float.valueOf(max));
|
||||||
|
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell1.setCellType(CellType.STRING);
|
||||||
|
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||||
|
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||||
|
List<ExamOption> examOptions = new ArrayList<>();
|
||||||
|
//A
|
||||||
|
for (int j=6;j<=13;j++){
|
||||||
|
if(row1.getCell(j)!=null && StringUtil.isNotBlank(row1.getCell(j).getStringCellValue())){
|
||||||
|
ExamOption examOption=new ExamOption();
|
||||||
|
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||||
|
examOption.setContent(row1.getCell(j).getStringCellValue());
|
||||||
|
examOption.setIsAnswer(true);
|
||||||
|
examOption.setScore(Float.valueOf(strings[j-6]));
|
||||||
|
if(examOption!=null && StringUtil.isNotBlank(examOption.getContent())){
|
||||||
|
examOptions.add(examOption);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
examQuestion.setOptionList(examOptions);
|
||||||
|
examQuestions1.add(examQuestion);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//判断题 只存在试题表中
|
//判断题 只存在试题表中
|
||||||
@@ -300,27 +440,30 @@ public class ExamQuestionApi extends ApiBaseController {
|
|||||||
ExamQuestion examQuestion1 = new ExamQuestion();
|
ExamQuestion examQuestion1 = new ExamQuestion();
|
||||||
examQuestion1.setTitle(row2.getCell(0).getStringCellValue());
|
examQuestion1.setTitle(row2.getCell(0).getStringCellValue());
|
||||||
examQuestion1.setType(3);
|
examQuestion1.setType(3);
|
||||||
examQuestion1.setKnowledge(row2.getCell(1).getStringCellValue());
|
System.out.println("1+++++++"+row2.getCell(1));
|
||||||
if(row2.getCell(2).getStringCellValue().equals("中")){
|
if(row2.getCell(1).getStringCellValue().equals("中")){
|
||||||
examQuestion1.setDifficulty(2f);
|
examQuestion1.setDifficulty(2f);
|
||||||
}
|
}else if(row2.getCell(1).getStringCellValue().equals("难")){
|
||||||
if(row2.getCell(2).getStringCellValue().equals("难")){
|
|
||||||
examQuestion1.setDifficulty(3f);
|
examQuestion1.setDifficulty(3f);
|
||||||
}
|
} else if(row2.getCell(1).getStringCellValue().equals("易")){
|
||||||
if(row2.getCell(2).getStringCellValue().equals("易")){
|
|
||||||
examQuestion1.setDifficulty(1f);
|
examQuestion1.setDifficulty(1f);
|
||||||
|
}else if(row2.getCell(1).getStringCellValue().equals("")){
|
||||||
|
examQuestion1.setDifficulty(null);
|
||||||
}
|
}
|
||||||
Cell cell1 = row2.getCell(3);
|
Cell cell1 = row2.getCell(2);
|
||||||
cell1.setCellType(CellType.STRING);
|
cell1.setCellType(CellType.STRING);
|
||||||
examQuestion1.setDefaultScore(Float.valueOf(cell1.getStringCellValue()));
|
if (row2.getCell(2).getStringCellValue().isEmpty()){
|
||||||
|
examQuestion1.setDefaultScore(null);
|
||||||
if(row2.getCell(4)!=null) {
|
}else {
|
||||||
examQuestion1.setAnalysis(row2.getCell(4).getStringCellValue());
|
examQuestion1.setDefaultScore(Float.valueOf(row2.getCell(2).getStringCellValue()));
|
||||||
|
}
|
||||||
|
if(row2.getCell(3)!=null) {
|
||||||
|
examQuestion1.setAnalysis(row2.getCell(3).getStringCellValue());
|
||||||
}else {
|
}else {
|
||||||
examQuestion1.setAnalysis("");
|
examQuestion1.setAnalysis("");
|
||||||
}
|
}
|
||||||
|
|
||||||
String cvalue=row2.getCell(5).getStringCellValue();
|
String cvalue=row2.getCell(4).getStringCellValue();
|
||||||
examQuestion1.setAnswer(cvalue.equals("正确")? "true":"false");
|
examQuestion1.setAnswer(cvalue.equals("正确")? "true":"false");
|
||||||
if(examQuestion1!=null){
|
if(examQuestion1!=null){
|
||||||
examQuestions2.add(examQuestion1);
|
examQuestions2.add(examQuestion1);
|
||||||
|
|||||||
@@ -3,10 +3,14 @@ package com.xboe.module.exam.api;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import com.xboe.api.ThirdApi;
|
import com.xboe.api.ThirdApi;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
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;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.xboe.common.PageList;
|
import com.xboe.common.PageList;
|
||||||
import com.xboe.common.Pagination;
|
import com.xboe.common.Pagination;
|
||||||
@@ -19,8 +23,6 @@ import com.xboe.module.exam.service.IExamTestService;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考试
|
* 考试
|
||||||
* */
|
* */
|
||||||
@@ -31,10 +33,8 @@ public class ExamTestApi extends ApiBaseController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IExamTestService examTestService;
|
private IExamTestService examTestService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ThirdApi thirdApi;
|
ThirdApi thirdApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*查询考试,分页,搜索,资源归属,状态
|
*查询考试,分页,搜索,资源归属,状态
|
||||||
**/
|
**/
|
||||||
@@ -82,16 +82,33 @@ public class ExamTestApi extends ApiBaseController {
|
|||||||
* */
|
* */
|
||||||
@PostMapping("update")
|
@PostMapping("update")
|
||||||
@AutoLog(module = "考试",action = "修改考试",info = "修改考试")
|
@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())){
|
if(StringUtil.isBlank(examTest.getTestName())){
|
||||||
return badRequest("标题为空");
|
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 {
|
try {
|
||||||
examTestService.update(examTest);
|
examTestService.update(examTest);
|
||||||
|
thirdApi.sqlUpdate(examTest,token);
|
||||||
return success(examTest);
|
return success(examTest);
|
||||||
|
} catch (ConstraintViolationException e) {
|
||||||
|
// 捕获约束违反异常,并返回一个更具体的错误消息
|
||||||
|
log.error("修改失败,违反了约束条件", e);
|
||||||
|
return error("修改失败,违反了约束条件(可能是主键已存在)");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("修改失败",e);
|
// 捕获其他所有异常
|
||||||
return error("修改失败",e.getMessage());
|
log.error("修改失败", e);
|
||||||
|
return error("修改失败", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**、
|
/**、
|
||||||
@@ -116,16 +133,10 @@ public class ExamTestApi extends ApiBaseController {
|
|||||||
* */
|
* */
|
||||||
@GetMapping("/delete")
|
@GetMapping("/delete")
|
||||||
@AutoLog(module = "考试",action = "删除考试",info = "删除考试")
|
@AutoLog(module = "考试",action = "删除考试",info = "删除考试")
|
||||||
public JsonResponse<Boolean> delete(String id, HttpServletRequest request){
|
public JsonResponse<Boolean> delete(String id){
|
||||||
if(StringUtil.isBlank(id)){
|
if(StringUtil.isBlank(id)){
|
||||||
return badRequest("缺少必要参数");
|
return badRequest("缺少必要参数");
|
||||||
}
|
}
|
||||||
|
|
||||||
String token = request.getHeader("Xboe-Access-Token");
|
|
||||||
if (StringUtil.isEmpty(token)) {
|
|
||||||
token = request.getHeader("token");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
examTestService.delete(id);
|
examTestService.delete(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -172,21 +183,4 @@ public class ExamTestApi extends ApiBaseController {
|
|||||||
return error("上下级失败",e.getMessage());
|
return error("上下级失败",e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 引用关系移除
|
|
||||||
* */
|
|
||||||
@PostMapping("/removeRel")
|
|
||||||
public JsonResponse<Boolean> removeRel(@RequestParam List<String> ids){
|
|
||||||
if(CollectionUtil.isEmpty(ids)){
|
|
||||||
return badRequest("参数异常");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
examTestService.removeRel(ids);
|
|
||||||
return success(true);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("引用关系移除异常",e);
|
|
||||||
return error("引用关系移除异常",e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,122 +0,0 @@
|
|||||||
package com.xboe.module.exam.dto;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单独的考虑答卷信息
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class SaveExamScoreDto {
|
|
||||||
/**
|
|
||||||
* 用户姓名
|
|
||||||
*/
|
|
||||||
private String userId;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户姓名
|
|
||||||
*/
|
|
||||||
private String userName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 考试id
|
|
||||||
*/
|
|
||||||
private String testId;
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 考试名称
|
|
||||||
// */
|
|
||||||
// private String testName;
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 考试时长 分钟
|
|
||||||
// */
|
|
||||||
// private Integer testDuration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 试题排列 1试题乱序,2选项乱序,3全部乱序
|
|
||||||
*/
|
|
||||||
private Integer arrange;
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 及格线
|
|
||||||
// */
|
|
||||||
// private Integer passLine;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 账户的代码,用于区别于同姓名的用户
|
|
||||||
*/
|
|
||||||
private String workNum;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 独立考试任务的id
|
|
||||||
*/
|
|
||||||
private String aloneId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 试卷总分
|
|
||||||
*/
|
|
||||||
@Column(name = "total_score")
|
|
||||||
private Float totalScore;
|
|
||||||
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 答卷内容
|
|
||||||
// */
|
|
||||||
// @Column(name = "answer_json", columnDefinition = "mediumtext")
|
|
||||||
// private String answerJson;
|
|
||||||
|
|
||||||
// todo by yyk 2024-05-17 14:10:32 确定分数
|
|
||||||
/**
|
|
||||||
* 用户的实际得分
|
|
||||||
*/
|
|
||||||
private Float realScore;
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 用时秒
|
|
||||||
// */
|
|
||||||
// private Integer useMinute;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最终成绩,如果是百分制,用户的实际得分会换算为百分制
|
|
||||||
*/
|
|
||||||
private Float score;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 开始时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
|
||||||
private LocalDateTime startTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 结束时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
|
||||||
private LocalDateTime endTime;
|
|
||||||
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 完成状态
|
|
||||||
// */
|
|
||||||
// private Integer status;
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 考试次数
|
|
||||||
// */
|
|
||||||
// private Integer times;
|
|
||||||
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 记录最后的操作时间
|
|
||||||
// */
|
|
||||||
// @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
|
||||||
// private LocalDateTime lastTime;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -65,7 +65,6 @@ public class AloneExam extends IdBaseEntity {
|
|||||||
private String ucode;
|
private String ucode;
|
||||||
|
|
||||||
/**关联类型*/
|
/**关联类型*/
|
||||||
/**关联类型 新增关联类型14,代表成长路径图*/
|
|
||||||
@Column(name = "ref_type", length = 30)
|
@Column(name = "ref_type", length = 30)
|
||||||
private String refType;
|
private String refType;
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
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;
|
private Integer testDuration;
|
||||||
/**
|
/**
|
||||||
* 显示解析
|
* 显示解析
|
||||||
@@ -101,19 +101,19 @@ public class ExamTest extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 试卷的ID
|
* 试卷的ID
|
||||||
*/
|
*/
|
||||||
@Column(name = "paper_id",nullable = false,length=20)
|
@Column(name = "paper_id",length=20)
|
||||||
private String paperId;
|
private String paperId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考试的类型
|
* 考试的类型
|
||||||
* */
|
* */
|
||||||
@Column(name = "test_type",nullable = false)
|
@Column(name = "test_type")
|
||||||
private Integer testType;
|
private Integer testType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发布状态 ,是否已发布
|
* 发布状态 ,是否已发布
|
||||||
*/
|
*/
|
||||||
@Column(name = "published",length = 1,nullable = false)
|
@Column(name = "published",length = 1)
|
||||||
private Boolean published;
|
private Boolean published;
|
||||||
/**
|
/**
|
||||||
* 发布时间
|
* 发布时间
|
||||||
@@ -154,7 +154,7 @@ public class ExamTest extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 范围,1表独立使用,2表课程内部
|
* 范围,1表独立使用,2表课程内部
|
||||||
* */
|
* */
|
||||||
@Column(name = "range_type",nullable = false)
|
@Column(name = "range_type")
|
||||||
private Integer rangeType;
|
private Integer rangeType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -173,19 +173,9 @@ public class ExamTest extends BaseEntity {
|
|||||||
|
|
||||||
|
|
||||||
/**启用的,上架*/
|
/**启用的,上架*/
|
||||||
@Column(name = "enabled", nullable = false, length = 1)
|
@Column(name = "enabled", length = 1)
|
||||||
private Boolean enabled;
|
private Boolean enabled;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private String paperName;
|
private String paperName;
|
||||||
|
|
||||||
/** 关联类型,1、项目 2、学习路径图 3、面授课 14、成长路径图 */
|
|
||||||
@Column(name = "ref_type")
|
|
||||||
private Integer refType;
|
|
||||||
|
|
||||||
@Column(name = "ref_id")
|
|
||||||
private String refId;
|
|
||||||
|
|
||||||
@Column(name = "ref_status")
|
|
||||||
private Integer refStatus;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,11 @@ import java.util.Map;
|
|||||||
|
|
||||||
import com.xboe.common.OrderCondition;
|
import com.xboe.common.OrderCondition;
|
||||||
import com.xboe.common.PageList;
|
import com.xboe.common.PageList;
|
||||||
import com.xboe.module.exam.dto.SaveExamScoreDto;
|
|
||||||
import com.xboe.module.exam.dto.TestUserDto;
|
import com.xboe.module.exam.dto.TestUserDto;
|
||||||
import com.xboe.module.exam.dto.TestUserQuery;
|
import com.xboe.module.exam.dto.TestUserQuery;
|
||||||
import com.xboe.module.exam.entity.AloneExam;
|
import com.xboe.module.exam.entity.AloneExam;
|
||||||
import com.xboe.module.exam.entity.AloneExamAnswer;
|
import com.xboe.module.exam.entity.AloneExamAnswer;
|
||||||
import com.xboe.module.exam.vo.AloneExamQuery;
|
import com.xboe.module.exam.vo.AloneExamQuery;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 独立考试的处理。此信息无删除操作,更新也只是更新answerJson字段
|
* 独立考试的处理。此信息无删除操作,更新也只是更新answerJson字段
|
||||||
@@ -94,18 +92,10 @@ public interface IAloneExamService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 提交考试
|
* 提交考试
|
||||||
*
|
|
||||||
* @param aea
|
* @param aea
|
||||||
*/
|
*/
|
||||||
void submit(AloneExamAnswer aea, Integer scoreType);
|
void submit(AloneExamAnswer aea,Integer scoreType);
|
||||||
|
|
||||||
/**
|
|
||||||
* 同步考试成绩
|
|
||||||
* @param aea
|
|
||||||
* @param request
|
|
||||||
*/
|
|
||||||
void syncExamScoreToCourseSuite(AloneExamAnswer aea, HttpServletRequest request);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新答案
|
* 更新答案
|
||||||
* @param id
|
* @param id
|
||||||
@@ -166,7 +156,5 @@ public interface IAloneExamService {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
PageList<TestUserDto> findTestUserAnswers(TestUserQuery params) throws Exception;
|
PageList<TestUserDto> findTestUserAnswers(TestUserQuery params) throws Exception;
|
||||||
|
|
||||||
void examScoreBatchAdd(HttpServletRequest request, List<SaveExamScoreDto> saveExamScoreDtoList);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package com.xboe.module.exam.service;
|
|||||||
import com.xboe.common.PageList;
|
import com.xboe.common.PageList;
|
||||||
import com.xboe.module.exam.entity.ExamTest;
|
import com.xboe.module.exam.entity.ExamTest;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface IExamTestService {
|
public interface IExamTestService {
|
||||||
/**
|
/**
|
||||||
* 分页查,状态,搜索,资源归属
|
* 分页查,状态,搜索,资源归属
|
||||||
@@ -53,5 +51,4 @@ public interface IExamTestService {
|
|||||||
* */
|
* */
|
||||||
void enabled(String id,Boolean enabled);
|
void enabled(String id,Boolean enabled);
|
||||||
|
|
||||||
void removeRel(List<String> ids);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,15 @@
|
|||||||
package com.xboe.module.exam.service.impl;
|
package com.xboe.module.exam.service.impl;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.HashMap;
|
||||||
import java.util.stream.Collectors;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import com.xboe.api.ThirdApi;
|
|
||||||
import com.xboe.module.exam.dao.ExamTestDao;
|
|
||||||
import com.xboe.module.exam.dto.*;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
|
||||||
import org.springframework.transaction.TransactionStatus;
|
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import com.xboe.common.OrderCondition;
|
import com.xboe.common.OrderCondition;
|
||||||
@@ -30,40 +20,31 @@ import com.xboe.core.orm.QueryBuilder;
|
|||||||
import com.xboe.core.orm.UpdateBuilder;
|
import com.xboe.core.orm.UpdateBuilder;
|
||||||
import com.xboe.module.exam.dao.AloneExamAnswerDao;
|
import com.xboe.module.exam.dao.AloneExamAnswerDao;
|
||||||
import com.xboe.module.exam.dao.AloneExamDao;
|
import com.xboe.module.exam.dao.AloneExamDao;
|
||||||
|
import com.xboe.module.exam.dto.TestUserAnswerDto;
|
||||||
|
import com.xboe.module.exam.dto.TestUserDto;
|
||||||
|
import com.xboe.module.exam.dto.TestUserQuery;
|
||||||
import com.xboe.module.exam.entity.AloneExam;
|
import com.xboe.module.exam.entity.AloneExam;
|
||||||
import com.xboe.module.exam.entity.AloneExamAnswer;
|
import com.xboe.module.exam.entity.AloneExamAnswer;
|
||||||
import com.xboe.module.exam.entity.ExamTest;
|
import com.xboe.module.exam.entity.ExamTest;
|
||||||
import com.xboe.module.exam.service.IAloneExamService;
|
import com.xboe.module.exam.service.IAloneExamService;
|
||||||
import com.xboe.module.exam.vo.AloneExamQuery;
|
import com.xboe.module.exam.vo.AloneExamQuery;
|
||||||
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class AloneExamServiceImpl implements IAloneExamService{
|
public class AloneExamServiceImpl implements IAloneExamService{
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(AloneExamServiceImpl.class);
|
|
||||||
@Resource
|
@Resource
|
||||||
AloneExamAnswerDao dao;
|
AloneExamAnswerDao dao;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
AloneExamDao aeDao;
|
AloneExamDao aeDao;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ExamTestDao examTestDao;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ThirdApi thirdApi;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void save(AloneExamAnswer aea){
|
public void save(AloneExamAnswer aea){
|
||||||
dao.save(aea);
|
dao.save(aea);
|
||||||
AloneExam ae=aeDao.findOne(FieldFilters.eq("aid", aea.getAid()),FieldFilters.eq("testId", aea.getTestId()));
|
|
||||||
int currentTimes = ae.getTimes() != null ? ae.getTimes() : 0;
|
|
||||||
//更新状态
|
//更新状态
|
||||||
aeDao.update(UpdateBuilder.from(AloneExam.class)
|
aeDao.update(UpdateBuilder.from(AloneExam.class)
|
||||||
.addUpdateField("status", AloneExam.STATUS_NORMAL)
|
.addUpdateField("status", AloneExam.STATUS_NORMAL)
|
||||||
.addUpdateField("times", currentTimes+1)
|
|
||||||
.addFilter(FieldFilters.eq("aid", aea.getAid()))
|
.addFilter(FieldFilters.eq("aid", aea.getAid()))
|
||||||
.addFilter(FieldFilters.eq("testId", aea.getTestId()))
|
.addFilter(FieldFilters.eq("testId", aea.getTestId()))
|
||||||
.addFilter(FieldFilters.eq("status",AloneExam.STATUS_NONE))
|
.addFilter(FieldFilters.eq("status",AloneExam.STATUS_NONE))
|
||||||
@@ -72,8 +53,8 @@ public class AloneExamServiceImpl implements IAloneExamService{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
@Transactional
|
||||||
public void submit(AloneExamAnswer aea, Integer scoreType){
|
public void submit(AloneExamAnswer aea,Integer scoreType){
|
||||||
//dao.update(aea);
|
//dao.update(aea);
|
||||||
aea.setStatus(AloneExamAnswer.STATUS_FINISH);
|
aea.setStatus(AloneExamAnswer.STATUS_FINISH);
|
||||||
LocalDateTime now=LocalDateTime.now();
|
LocalDateTime now=LocalDateTime.now();
|
||||||
@@ -121,27 +102,6 @@ public class AloneExamServiceImpl implements IAloneExamService{
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public void syncExamScoreToCourseSuite(AloneExamAnswer aea, HttpServletRequest request) {
|
|
||||||
String token = request.getHeader("Xboe-Access-Token");
|
|
||||||
if (StringUtils.isEmpty(token)) {
|
|
||||||
token = request.getHeader("token");
|
|
||||||
}
|
|
||||||
|
|
||||||
String finalToken = token;
|
|
||||||
CompletableFuture.supplyAsync(() -> {
|
|
||||||
AloneExam aloneExam = aeDao.findOne(FieldFilters.eq("aid", aea.getAid()), FieldFilters.eq("testId", aea.getTestId()));
|
|
||||||
if (aloneExam.getRefType().equals("14")){
|
|
||||||
thirdApi.syncExamScoreToCourseSuite(aloneExam, finalToken);
|
|
||||||
}
|
|
||||||
return "完成结果";
|
|
||||||
}).exceptionally(ex -> {
|
|
||||||
log.error("异步操作中发生错误: " + ex.getMessage(), ex);
|
|
||||||
return "发生错误";
|
|
||||||
}).thenAccept(result -> {
|
|
||||||
log.info("同步考试成绩到课程项目完成:" + result);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -467,86 +427,4 @@ public class AloneExamServiceImpl implements IAloneExamService{
|
|||||||
rs.setPageSize(params.getPageSize());
|
rs.setPageSize(params.getPageSize());
|
||||||
return rs;
|
return rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PlatformTransactionManager transactionManager;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void examScoreBatchAdd(HttpServletRequest request, List<SaveExamScoreDto> saveExamScoreDtoList) {
|
|
||||||
List<String> workNumList = saveExamScoreDtoList.stream().map(SaveExamScoreDto::getWorkNum).collect(Collectors.toList());
|
|
||||||
|
|
||||||
String token = request.getHeader("Xboe-Access-Token");
|
|
||||||
if (StringUtils.isEmpty(token)) {
|
|
||||||
token = request.getHeader("token");
|
|
||||||
}
|
|
||||||
HashMap<String, String> userIdAndWorkNumMap = thirdApi.getUserIdByWorkNum(token, workNumList);
|
|
||||||
|
|
||||||
saveExamScoreDtoList.forEach(examScoreDto -> {
|
|
||||||
TransactionStatus status = null; // 事务状态
|
|
||||||
|
|
||||||
try {
|
|
||||||
// 获取事务定义
|
|
||||||
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
|
||||||
// 设置事务隔离级别
|
|
||||||
def.setIsolationLevel(DefaultTransactionDefinition.ISOLATION_READ_COMMITTED);
|
|
||||||
// 设置事务传播行为
|
|
||||||
def.setPropagationBehavior(DefaultTransactionDefinition.PROPAGATION_REQUIRED);
|
|
||||||
// 获取事务状态
|
|
||||||
status = transactionManager.getTransaction(def);
|
|
||||||
|
|
||||||
AloneExamAnswer aloneExamAnswer = new AloneExamAnswer();
|
|
||||||
BeanUtils.copyProperties(examScoreDto, aloneExamAnswer);
|
|
||||||
|
|
||||||
String userId = userIdAndWorkNumMap.get(examScoreDto.getWorkNum());
|
|
||||||
aloneExamAnswer.setAid(userId);
|
|
||||||
aloneExamAnswer.setName(examScoreDto.getUserName());
|
|
||||||
aloneExamAnswer.setUcode(examScoreDto.getWorkNum());
|
|
||||||
aloneExamAnswer.setStatus(AloneExamAnswer.STATUS_FINISH);
|
|
||||||
// aloneExamAnswer.setUseSecond(examScoreDto.getUseMinute()*60);
|
|
||||||
|
|
||||||
ExamTest examTest = examTestDao.get(examScoreDto.getTestId());
|
|
||||||
aloneExamAnswer.setPassLine(examTest.getPassLine());
|
|
||||||
aloneExamAnswer.setArrange(examTest.getArrange());
|
|
||||||
aloneExamAnswer.setTestDuration(examTest.getTestDuration());
|
|
||||||
|
|
||||||
// 获取考试任务ID
|
|
||||||
AloneExam aloneExam=aeDao.findOne(FieldFilters.eq("aid", userId),FieldFilters.eq("testId", examScoreDto.getTestId()));
|
|
||||||
aloneExamAnswer.setAloneId(aloneExam.getId());
|
|
||||||
// 添加答卷
|
|
||||||
dao.save(aloneExamAnswer);
|
|
||||||
|
|
||||||
// 更新状态,状态是未完成的,这里会有问题
|
|
||||||
int currentTimes = aloneExam.getTimes() != null ? aloneExam.getTimes() : 0;
|
|
||||||
if(examTest.getScoringType()!=null && examTest.getScoringType()==2) {
|
|
||||||
//最后一次的分数为准
|
|
||||||
aeDao.update(UpdateBuilder.from(AloneExam.class)
|
|
||||||
.addUpdateField("status", AloneExam.STATUS_FINISH)
|
|
||||||
.addUpdateField("score", examScoreDto.getScore())
|
|
||||||
.addUpdateField("times", currentTimes+1)
|
|
||||||
.addFilter(FieldFilters.eq("aid", userId))
|
|
||||||
.addFilter(FieldFilters.eq("testId", examScoreDto.getTestId()))
|
|
||||||
.builder());
|
|
||||||
} else {
|
|
||||||
if (aloneExam.getStatus() == AloneExam.STATUS_FINISH) {
|
|
||||||
if (aloneExam.getScore() < examScoreDto.getScore()) {
|
|
||||||
aeDao.updateMultiFieldById(aloneExam.getId(), UpdateBuilder.create("score", examScoreDto.getScore()), UpdateBuilder.create("times", currentTimes+1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
aeDao.updateMultiFieldById(aloneExam.getId(), UpdateBuilder.create("status", AloneExam.STATUS_FINISH), UpdateBuilder.create("score", examScoreDto.getScore()), UpdateBuilder.create("times", currentTimes+1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 提交事务
|
|
||||||
transactionManager.commit(status);
|
|
||||||
} catch (Exception e) {
|
|
||||||
// 如果发生异常,回滚事务
|
|
||||||
if (status != null && !status.isCompleted()) {
|
|
||||||
transactionManager.rollback(status);
|
|
||||||
}
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,18 @@ public class ExamTestServiceImpl implements IExamTestService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(ExamTest examTest) {
|
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
|
@Override
|
||||||
@@ -84,7 +95,7 @@ public class ExamTestServiceImpl implements IExamTestService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean has(String paperId) {
|
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));
|
//String etId= (String)examTestDao.findField("id", FieldFilters.eq("paperId", paperId));
|
||||||
if(et==null){
|
if(et==null){
|
||||||
return true;
|
return true;
|
||||||
@@ -111,10 +122,4 @@ public class ExamTestServiceImpl implements IExamTestService {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeRel(List<String> ids) {
|
|
||||||
String idsStr = String.join(",", ids);
|
|
||||||
examTestDao.sqlUpdate("update boe_exam_test set ref_status=0 where id in (?1)",idsStr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.xboe.api.vo.*;
|
|||||||
import com.xboe.module.course.vo.TeacherVo;
|
import com.xboe.module.course.vo.TeacherVo;
|
||||||
import com.xboe.module.usergroup.entity.UserGroupItem;
|
import com.xboe.module.usergroup.entity.UserGroupItem;
|
||||||
import com.xboe.module.usergroup.service.IUserGroupService;
|
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.ArrayUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -65,7 +66,9 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value="/xboe/school/study/course")
|
@RequestMapping(value="/xboe/school/study/course")
|
||||||
public class StudyCourseApi extends ApiBaseController{
|
public class StudyCourseApi extends ApiBaseController{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
IStudyCourseService service;
|
IStudyCourseService service;
|
||||||
|
|
||||||
@@ -321,8 +324,19 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
if (StringUtils.isEmpty(token)) {
|
if (StringUtils.isEmpty(token)) {
|
||||||
token = request.getHeader("token");
|
token = request.getHeader("token");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//检查是否已存在
|
//检查是否已存在
|
||||||
StudyCourseItem item = studyService.checkHas(sci.getStudyId(),sci.getContentId());
|
StudyCourseItem item = studyService.checkHas(sci.getStudyId(),sci.getContentId());
|
||||||
|
|
||||||
|
// 20240815 特训营结营考试 临时代码
|
||||||
|
// if(item != null && redisTemplate.opsForValue().get(item.getId())==null){
|
||||||
|
// redisTemplate.opsForValue().set(item.getId(),item.getId());
|
||||||
|
// //设置过期时间为1天
|
||||||
|
// redisTemplate.expire(item.getId(), 60, TimeUnit.SECONDS);
|
||||||
|
// }else{
|
||||||
|
// return success("");
|
||||||
|
// }
|
||||||
if(item!=null) {
|
if(item!=null) {
|
||||||
//如果记录存在,但是进度不100无成情况,就更新进度,一期不会有这种情况
|
//如果记录存在,但是进度不100无成情况,就更新进度,一期不会有这种情况
|
||||||
if(item.getProgress()<100 && sci.getProgress()>item.getProgress()) {
|
if(item.getProgress()<100 && sci.getProgress()>item.getProgress()) {
|
||||||
@@ -407,6 +421,14 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
StudyCourseItem item = studyService.checkHas(sci.getStudyId(),sci.getContentId());
|
StudyCourseItem item = studyService.checkHas(sci.getStudyId(),sci.getContentId());
|
||||||
if(item!=null) {
|
if(item!=null) {
|
||||||
//如果记录存在,但是进度不到100,未完成情况,就更新进度,一期不会有这种情况
|
//如果记录存在,但是进度不到100,未完成情况,就更新进度,一期不会有这种情况
|
||||||
|
// 20240815 特训营结营考试 临时代码
|
||||||
|
// if(item != null && redisTemplate.opsForValue().get(item.getId())==null){
|
||||||
|
// redisTemplate.opsForValue().set(item.getId(),item.getId());
|
||||||
|
// //设置过期时间为1天
|
||||||
|
// redisTemplate.expire(item.getId(), 60, TimeUnit.SECONDS);
|
||||||
|
// }else{
|
||||||
|
// return success("");
|
||||||
|
// }
|
||||||
if(item.getProgress()<100) {
|
if(item.getProgress()<100) {
|
||||||
studyService.updateProcess(item.getId(),sci.getStudyId(),sci.getCourseId(), sci.getContentTotal(),100,token);
|
studyService.updateProcess(item.getId(),sci.getStudyId(),sci.getCourseId(), sci.getContentTotal(),100,token);
|
||||||
}
|
}
|
||||||
@@ -512,6 +534,14 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
token = request.getHeader("token");
|
token = request.getHeader("token");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
// 20240815 特训营结营考试 临时代码
|
||||||
|
// if(itemId != null && redisTemplate.opsForValue().get(itemId)==null){
|
||||||
|
// redisTemplate.opsForValue().set(itemId,itemId);
|
||||||
|
// //设置过期时间为1天
|
||||||
|
// redisTemplate.expire(itemId, 60, TimeUnit.SECONDS);
|
||||||
|
// }else{
|
||||||
|
// return success(true);
|
||||||
|
// }
|
||||||
studyService.finishVideoStudyItem(itemId, studyId,courseId,cnum,token);
|
studyService.finishVideoStudyItem(itemId, studyId,courseId,cnum,token);
|
||||||
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(studyId ,courseId, token);
|
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(studyId ,courseId, token);
|
||||||
log.info("在线课学习记录"+allUserList);
|
log.info("在线课学习记录"+allUserList);
|
||||||
@@ -529,7 +559,7 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/study-video-time")
|
@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)){
|
if(StringUtils.isBlank(itemId)){
|
||||||
return error("参数错误");
|
return error("参数错误");
|
||||||
@@ -539,7 +569,10 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
}
|
}
|
||||||
//检查是否已存在
|
//检查是否已存在
|
||||||
try {
|
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);
|
return success(true);
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
log.error("记录最后学习时间错误",e);
|
log.error("记录最后学习时间错误",e);
|
||||||
@@ -690,9 +723,10 @@ public class StudyCourseApi extends ApiBaseController{
|
|||||||
return error("查询失败",e.getMessage());
|
return error("查询失败",e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value="/study-course-content",method = {RequestMethod.GET,RequestMethod.POST})
|
@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)){
|
if(StringUtils.isBlank(studyId)){
|
||||||
return error("无学习信息");
|
return error("无学习信息");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import com.xboe.api.ThirdApi;
|
import com.xboe.api.ThirdApi;
|
||||||
|
import com.xboe.school.study.dao.StudyCourseDao;
|
||||||
import com.xboe.school.study.entity.StudyCourse;
|
import com.xboe.school.study.entity.StudyCourse;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -32,6 +33,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value="/xboe/school/study/exam")
|
@RequestMapping(value="/xboe/school/study/exam")
|
||||||
public class StudyExamApi extends ApiBaseController{
|
public class StudyExamApi extends ApiBaseController{
|
||||||
|
@Autowired
|
||||||
|
StudyCourseDao scDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
IStudyExamService sexamService;
|
IStudyExamService sexamService;
|
||||||
|
|||||||
@@ -94,5 +94,5 @@ public interface IStudyService {
|
|||||||
* @param status
|
* @param status
|
||||||
* @return
|
* @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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.xboe.common.OrderCondition;
|
|||||||
import com.xboe.common.PageList;
|
import com.xboe.common.PageList;
|
||||||
import com.xboe.common.beans.KeyValue;
|
import com.xboe.common.beans.KeyValue;
|
||||||
import com.xboe.school.study.entity.StudyCourse;
|
import com.xboe.school.study.entity.StudyCourse;
|
||||||
|
import com.xboe.school.study.entity.StudyCourseItem;
|
||||||
import com.xboe.school.study.entity.StudySignup;
|
import com.xboe.school.study.entity.StudySignup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,6 +49,13 @@ public interface IStudySignupService {
|
|||||||
* @param signup
|
* @param signup
|
||||||
*/
|
*/
|
||||||
StudyCourse addSignup(StudySignup signup);
|
StudyCourse addSignup(StudySignup signup);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员添加报名课件
|
||||||
|
* @param signup
|
||||||
|
*/
|
||||||
|
StudyCourseItem addStudyCourseItem(StudySignup signup);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除报名,只有未审核过的才可以删除
|
* 删除报名,只有未审核过的才可以删除
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class StudyAssessServiceImpl implements IStudyAssessService{
|
|||||||
LocalDateTime ldt=LocalDateTime.now();
|
LocalDateTime ldt=LocalDateTime.now();
|
||||||
sci.setStudyId(assess.getStudyId());
|
sci.setStudyId(assess.getStudyId());
|
||||||
sci.setContentId(assess.getContentId());
|
sci.setContentId(assess.getContentId());
|
||||||
//sci.setContentName(homework.getContentName());
|
sci.setContentName("评估");
|
||||||
sci.setCourseId(assess.getCourseId());
|
sci.setCourseId(assess.getCourseId());
|
||||||
//sci.setCsectionId(homework.getCsectionId());
|
//sci.setCsectionId(homework.getCsectionId());
|
||||||
sci.setProgress(100);//直接设置为学习完成
|
sci.setProgress(100);//直接设置为学习完成
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class StudyExamServiceImpl implements IStudyExamService{
|
|||||||
LocalDateTime ldt=LocalDateTime.now();
|
LocalDateTime ldt=LocalDateTime.now();
|
||||||
sci.setStudyId(exam.getStudyId());
|
sci.setStudyId(exam.getStudyId());
|
||||||
sci.setContentId(exam.getContentId());
|
sci.setContentId(exam.getContentId());
|
||||||
//sci.setContentName(homework.getContentName());
|
sci.setContentName("考试");
|
||||||
sci.setCourseId(exam.getCourseId());
|
sci.setCourseId(exam.getCourseId());
|
||||||
//sci.setCsectionId(homework.getCsectionId());
|
//sci.setCsectionId(homework.getCsectionId());
|
||||||
sci.setProgress(prog);//直接设置为学习完成
|
sci.setProgress(prog);//直接设置为学习完成
|
||||||
@@ -112,29 +112,34 @@ public class StudyExamServiceImpl implements IStudyExamService{
|
|||||||
if(cexam.getScoringType()==CourseExam.SCORINGTYPE_LAST){
|
if(cexam.getScoringType()==CourseExam.SCORINGTYPE_LAST){
|
||||||
scItemDao.updateFieldById(exam.getStudyItemId(), "score",exam.getScore());
|
scItemDao.updateFieldById(exam.getStudyItemId(), "score",exam.getScore());
|
||||||
scItemDao.updateFieldById(exam.getStudyItemId(), "progress",prog);
|
scItemDao.updateFieldById(exam.getStudyItemId(), "progress",prog);
|
||||||
}
|
if(exam.getScore()>=exam.getPassLine()){
|
||||||
if(prog==100){
|
scItemDao.updateFieldById(exam.getStudyId(), "progress",100);
|
||||||
scItemDao.updateFieldById(exam.getStudyId(), "progress",100);
|
scItemDao.updateFieldById(exam.getStudyId(), "finish_time",LocalDateTime.now());
|
||||||
scItemDao.updateFieldById(exam.getStudyId(), "finish_time",LocalDateTime.now());
|
scItemDao.updateFieldById(exam.getStudyId(), "status",StudyCourseItem.STATUS_FINISH);
|
||||||
scItemDao.updateFieldById(exam.getStudyId(), "status",StudyCourseItem.STATUS_FINISH);
|
scItemDao.updateFieldById(exam.getStudyId(), "score",exam.getScore());
|
||||||
scItemDao.updateFieldById(exam.getStudyId(), "score",100.0f);
|
//scDao.updateFieldById(exam.getStudyId(), "last_score",100.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//1最高一次,用于最高一次的计算
|
//1最高一次,用于最高一次的计算
|
||||||
if(cexam.getScoringType()==CourseExam.SCORINGTYPE_MAX) {
|
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(), "score", f);
|
||||||
scItemDao.updateFieldById(exam.getStudyItemId(), "status", f>=exam.getPassLine()?StudyCourseItem.STATUS_FINISH:StudyCourseItem.STATUS_STUDYING);
|
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());
|
scItemDao.updateFieldById(exam.getStudyItemId(), "progress",f>=exam.getPassLine()?100:f.intValue());
|
||||||
|
|
||||||
if(f>=exam.getPassLine()){
|
if(f>=exam.getPassLine()){
|
||||||
scItemDao.updateFieldById(exam.getStudyId(), "progress",100);
|
scItemDao.updateFieldById(exam.getStudyId(), "progress",100);
|
||||||
scItemDao.updateFieldById(exam.getStudyId(), "finish_time",LocalDateTime.now());
|
scItemDao.updateFieldById(exam.getStudyId(), "finish_time",LocalDateTime.now());
|
||||||
scItemDao.updateFieldById(exam.getStudyId(), "status",StudyCourseItem.STATUS_FINISH);
|
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记录
|
//执行完毕 清除redis记录
|
||||||
// redisTemplate.delete(key);
|
// redisTemplate.delete(key);
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
|
|||||||
LocalDateTime ldt=LocalDateTime.now();
|
LocalDateTime ldt=LocalDateTime.now();
|
||||||
sci.setStudyId(homework.getStudyId());
|
sci.setStudyId(homework.getStudyId());
|
||||||
sci.setContentId(homework.getContentId());
|
sci.setContentId(homework.getContentId());
|
||||||
//sci.setContentName(homework.getContentName());
|
sci.setContentName(homework.getHwName());
|
||||||
sci.setCourseId(homework.getCourseId());
|
sci.setCourseId(homework.getCourseId());
|
||||||
//sci.setCsectionId(homework.getCsectionId());
|
//sci.setCsectionId(homework.getCsectionId());
|
||||||
sci.setProgress(100);//直接设置为学习完成
|
sci.setProgress(100);//直接设置为学习完成
|
||||||
@@ -67,7 +67,7 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
|
|||||||
//只是保留一条作业记录,不再保存多条记录了
|
//只是保留一条作业记录,不再保存多条记录了
|
||||||
//dao.save(homework);
|
//dao.save(homework);
|
||||||
//设置id。然后进行悠
|
//设置id。然后进行悠
|
||||||
homework.setId(obj.toString());
|
homework.setId(homework.getStudyItemId());
|
||||||
dao.update(homework);
|
dao.update(homework);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.xboe.school.study.service.impl;
|
package com.xboe.school.study.service.impl;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -8,7 +11,8 @@ import java.util.Map;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.transaction.Transactional;
|
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 com.xboe.school.study.entity.StudyCourse;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -94,8 +98,12 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
//sci.setProgress(100);//直接设置为学习完成
|
//sci.setProgress(100);//直接设置为学习完成
|
||||||
sci.setLastTime(ldt);
|
sci.setLastTime(ldt);
|
||||||
scItemDao.saveOrUpdate(sci);
|
scItemDao.saveOrUpdate(sci);
|
||||||
|
if (sci.getId() != null){
|
||||||
dto.setStudyItemId(sci.getId());
|
dto.setStudyItemId(sci.getId());
|
||||||
|
}else {
|
||||||
|
log.info("学习记录插入失败"+sci.getId());
|
||||||
|
throw new IllegalArgumentException("学习记录插入失败");
|
||||||
|
}
|
||||||
//检查是否全部学习完成
|
//检查是否全部学习完成
|
||||||
scDao.finishCheck(dto.getStudyId(),dto.getCourseId(),dto.getContentTotal(),token);
|
scDao.finishCheck(dto.getStudyId(),dto.getCourseId(),dto.getContentTotal(),token);
|
||||||
|
|
||||||
@@ -163,12 +171,10 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageList<StudyCourseItem> findItemPage(int pageIndex, int pageSize, String contentId, String courseId,String name,Integer status) {
|
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.setPageIndex(pageIndex);
|
||||||
query.setPageSize(pageSize);
|
query.setPageSize(pageSize);
|
||||||
|
|
||||||
OrderCondition oc=OrderCondition.desc("id");
|
OrderCondition oc=OrderCondition.desc("id");
|
||||||
query.addOrder(oc);
|
query.addOrder(oc);
|
||||||
if(StringUtils.isNotBlank(contentId)) {
|
if(StringUtils.isNotBlank(contentId)) {
|
||||||
@@ -177,19 +183,92 @@ public class StudyServiceImpl implements IStudyService{
|
|||||||
if(StringUtils.isNotBlank(courseId)) {
|
if(StringUtils.isNotBlank(courseId)) {
|
||||||
query.addFilter(FieldFilters.eq("courseId",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)) {
|
if(StringUtils.isNotBlank(name)) {
|
||||||
query.addFilter(FieldFilters.eq("aname", name));
|
query.addFilter(FieldFilters.eq("aname", name));
|
||||||
}
|
}
|
||||||
return scItemDao.findPage(query.builder());
|
int pageIndex2 = (pageIndex-1)*10;
|
||||||
|
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.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+"' 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.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+"' 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);
|
||||||
|
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 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 + "' 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 + "' 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 + "' 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 + "' 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);
|
||||||
|
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,15 @@ import java.io.IOException;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import javax.transaction.Transactional;
|
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.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -39,7 +45,13 @@ public class StudySignupServiceImpl implements IStudySignupService{
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
StudyCourseDao studyCourseDao;
|
StudyCourseDao studyCourseDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
StudyCourseItemDao scItemDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CourseContentDao contentDao;
|
||||||
|
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
ICourseStudySearch esSearch;
|
ICourseStudySearch esSearch;
|
||||||
|
|
||||||
@@ -69,7 +81,6 @@ public class StudySignupServiceImpl implements IStudySignupService{
|
|||||||
signupDao.save(signup);
|
signupDao.save(signup);
|
||||||
//添加到课程学习
|
//添加到课程学习
|
||||||
LocalDateTime now=LocalDateTime.now();
|
LocalDateTime now=LocalDateTime.now();
|
||||||
|
|
||||||
StudyCourse sc=new StudyCourse();
|
StudyCourse sc=new StudyCourse();
|
||||||
sc.setAddTime(now);
|
sc.setAddTime(now);
|
||||||
sc.setAid(signup.getAid());
|
sc.setAid(signup.getAid());
|
||||||
@@ -124,11 +135,40 @@ public class StudySignupServiceImpl implements IStudySignupService{
|
|||||||
//courseDao.updateMultiFieldById(signup.getCourseId(),UpdateBuilder.create("studys", "studys+1",FieldUpdateType.EXPRESSION));
|
//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
|
@Override
|
||||||
public void addList(List<StudySignup> list) {
|
public void addList(List<StudySignup> list) {
|
||||||
//用于管理员添加报名
|
//用于管理员添加报名
|
||||||
for(StudySignup ss : list) {
|
for(StudySignup ss : list) {
|
||||||
addSignup(ss);
|
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) {
|
public void audit(String id, String aid, String user, boolean pass, String remark) {
|
||||||
if(pass) {
|
if(pass) {
|
||||||
StudySignup signup =signupDao.get(id);
|
StudySignup signup =signupDao.get(id);
|
||||||
|
|
||||||
//是否需要检查是否已报名
|
//是否需要检查是否已报名
|
||||||
StudyCourse sc=new StudyCourse();
|
StudyCourse sc=new StudyCourse();
|
||||||
sc.setAddTime(LocalDateTime.now());
|
sc.setAddTime(LocalDateTime.now());
|
||||||
|
|||||||
@@ -71,9 +71,7 @@ audience.getOrgUsers=${boe.domain}/userbasic/user/getOrgUsers
|
|||||||
infrasApi.dict=${boe.domain}/infrasApi/dict/list
|
infrasApi.dict=${boe.domain}/infrasApi/dict/list
|
||||||
#获取非报名课id
|
#获取非报名课id
|
||||||
manageApi.stu.offcourse=${boe.domain}/manageApi/stu/offcourse/getOffCourseId
|
manageApi.stu.offcourse=${boe.domain}/manageApi/stu/offcourse/getOffCourseId
|
||||||
|
manageApi.editExam=${boe.domain}/manageApi/admin/project/editExam
|
||||||
#获取离职教师id
|
#获取离职教师id
|
||||||
userBasic.getTeacherIds=${boe.domain}/userbasic/user/getTeacherInfo
|
userBasic.getTeacherIds=${boe.domain}/userbasic/user/getTeacherInfo
|
||||||
userBasic.getUserIdByWorkNum=${boe.domain}/userbasic/user/getUserIdByWorkNum
|
coursesuilt.getStudyStatus=${boe.domain}/manageApi/stu/project/completeStatus
|
||||||
coursesuilt.getStudyStatus=${boe.domain}/manageApi/stu/project/completeStatus
|
|
||||||
coursesuilt.checkBanding=${boe.domain}/manageApi/stu/task/exam/checkBanding
|
|
||||||
coursesuilt.syncExamScoreToCourseSuite=${boe.domain}/manageApi/stu/task/exam/syncExamScoreToCourseSuite
|
|
||||||
Reference in New Issue
Block a user