mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-09 02:46:50 +08:00
Compare commits
1 Commits
250324-bug
...
zcwy0913-y
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0dcd78ea6e |
@@ -4,21 +4,23 @@ 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.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.util.Collection;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
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;
|
||||||
@@ -63,6 +65,10 @@ public class ThirdApi {
|
|||||||
|
|
||||||
@Value("${manageApi.editExam}")
|
@Value("${manageApi.editExam}")
|
||||||
private String editExam;
|
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
|
||||||
@@ -231,5 +237,21 @@ public class ThirdApi {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
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 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,12 +9,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
|
|
||||||
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.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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.xboe.common.PageList;
|
import com.xboe.common.PageList;
|
||||||
import com.xboe.common.Pagination;
|
import com.xboe.common.Pagination;
|
||||||
@@ -1164,5 +1159,11 @@ public class CourseManageApi extends ApiBaseController{
|
|||||||
return success(courses);
|
return success(courses);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getCourseCoverUrl")
|
||||||
|
public JsonResponse<Map<String, String>> getCourseCoverUrl(@RequestParam String courseIds){
|
||||||
|
Map<String, String> courseUrlMap = courseService.getCourseCoverUrl(courseIds);
|
||||||
|
return success(courseUrlMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -340,9 +340,8 @@ public interface ICourseService {
|
|||||||
* */
|
* */
|
||||||
List<Course> mobiledelList(Integer num,CourseQueryDto courseQueryDto);
|
List<Course> mobiledelList(Integer num,CourseQueryDto courseQueryDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取课程封面
|
||||||
|
* */
|
||||||
|
Map<String, String> getCourseCoverUrl(String courseIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1979,5 +1979,16 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
return courseDao.findListByHql("Select new Course(id,studys,score) from Course where id in(?1)", ids);
|
return courseDao.findListByHql("Select new Course(id,studys,score) from Course where id in(?1)", ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getCourseCoverUrl(String courseIds) {
|
||||||
|
List<String> courseIdList = Arrays.asList(courseIds.split(","));
|
||||||
|
List<Course> courseList = courseDao.findList(FieldFilters.in("id", courseIdList));
|
||||||
|
Map<String, String> coverUrlMap = courseList.stream()
|
||||||
|
.filter(course -> StringUtils.isNotBlank(course.getCoverImg()))
|
||||||
|
.collect(Collectors.toMap(Course::getId, Course::getCoverImg));
|
||||||
|
|
||||||
|
return coverUrlMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,15 +14,11 @@ 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.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.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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;
|
||||||
@@ -41,9 +37,6 @@ 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;
|
||||||
@@ -553,6 +546,7 @@ 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);
|
||||||
|
|||||||
@@ -3,14 +3,12 @@ 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.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;
|
||||||
@@ -23,6 +21,8 @@ import com.xboe.module.exam.service.IExamTestService;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考试
|
* 考试
|
||||||
* */
|
* */
|
||||||
@@ -33,8 +33,10 @@ public class ExamTestApi extends ApiBaseController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IExamTestService examTestService;
|
private IExamTestService examTestService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
ThirdApi thirdApi;
|
private ThirdApi thirdApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*查询考试,分页,搜索,资源归属,状态
|
*查询考试,分页,搜索,资源归属,状态
|
||||||
**/
|
**/
|
||||||
@@ -183,4 +185,21 @@ 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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ 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;
|
||||||
|
|
||||||
|
|||||||
@@ -178,4 +178,14 @@ public class ExamTest extends BaseEntity {
|
|||||||
|
|
||||||
@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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ 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字段
|
||||||
@@ -92,9 +93,17 @@ 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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新答案
|
* 更新答案
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ 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 {
|
||||||
/**
|
/**
|
||||||
* 分页查,状态,搜索,资源归属
|
* 分页查,状态,搜索,资源归属
|
||||||
@@ -51,4 +53,5 @@ public interface IExamTestService {
|
|||||||
* */
|
* */
|
||||||
void enabled(String id,Boolean enabled);
|
void enabled(String id,Boolean enabled);
|
||||||
|
|
||||||
|
void removeRel(List<String> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,6 @@
|
|||||||
package com.xboe.module.exam.service.impl;
|
package com.xboe.module.exam.service.impl;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import com.xboe.api.ThirdApi;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import com.xboe.common.OrderCondition;
|
import com.xboe.common.OrderCondition;
|
||||||
import com.xboe.common.PageList;
|
import com.xboe.common.PageList;
|
||||||
import com.xboe.common.utils.StringUtil;
|
import com.xboe.common.utils.StringUtil;
|
||||||
@@ -20,6 +9,7 @@ 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.dao.ExamTestDao;
|
||||||
import com.xboe.module.exam.dto.TestUserAnswerDto;
|
import com.xboe.module.exam.dto.TestUserAnswerDto;
|
||||||
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;
|
||||||
@@ -28,23 +18,47 @@ 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.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@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 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))
|
||||||
@@ -53,8 +67,8 @@ public class AloneExamServiceImpl implements IAloneExamService{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
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();
|
||||||
@@ -102,6 +116,27 @@ 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
|
||||||
|
|||||||
@@ -122,4 +122,10 @@ 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,5 +73,6 @@ infrasApi.dict=${boe.domain}/infrasApi/dict/list
|
|||||||
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
|
manageApi.editExam=${boe.domain}/manageApi/admin/project/editExam
|
||||||
#获取离职教师id
|
#获取离职教师id
|
||||||
userBasic.getTeacherIds=${boe.domain}/userbasic/user/getTeacherInfo
|
userBasic.getTeacherIds=${boe.domain}/userbasic/user/getTeacherInfocoursesuilt.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