mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-16 22:36:50 +08:00
Merge branch 'refs/heads/zcwy0622-yang' into dev0525
# Conflicts: # servers/boe-server-all/src/main/java/com/xboe/module/exam/api/ExamTestApi.java
This commit is contained in:
@@ -3,14 +3,11 @@ 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.hibernate.exception.ConstraintViolationException;
|
import org.hibernate.exception.ConstraintViolationException;
|
||||||
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.RestController;
|
|
||||||
|
|
||||||
import com.xboe.common.PageList;
|
import com.xboe.common.PageList;
|
||||||
import com.xboe.common.Pagination;
|
import com.xboe.common.Pagination;
|
||||||
@@ -23,6 +20,8 @@ import com.xboe.module.exam.service.IExamTestService;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考试
|
* 考试
|
||||||
* */
|
* */
|
||||||
@@ -195,4 +194,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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,4 +182,10 @@ public class ExamTest extends BaseEntity {
|
|||||||
/** 关联类型,1、项目 2、学习路径图 3、面授课 14、成长路径图 */
|
/** 关联类型,1、项目 2、学习路径图 3、面授课 14、成长路径图 */
|
||||||
@Column(name = "ref_type")
|
@Column(name = "ref_type")
|
||||||
private Integer refType;
|
private Integer refType;
|
||||||
|
|
||||||
|
@Column(name = "ref_id")
|
||||||
|
private String refId;
|
||||||
|
|
||||||
|
@Column(name = "ref_status")
|
||||||
|
private Integer refStatus;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -483,7 +483,6 @@ public class AloneExamServiceImpl implements IAloneExamService{
|
|||||||
}
|
}
|
||||||
HashMap<String, String> userIdAndWorkNumMap = thirdApi.getUserIdByWorkNum(token, workNumList);
|
HashMap<String, String> userIdAndWorkNumMap = thirdApi.getUserIdByWorkNum(token, workNumList);
|
||||||
|
|
||||||
String finalToken = token;
|
|
||||||
saveExamScoreDtoList.forEach(examScoreDto -> {
|
saveExamScoreDtoList.forEach(examScoreDto -> {
|
||||||
TransactionStatus status = null; // 事务状态
|
TransactionStatus status = null; // 事务状态
|
||||||
|
|
||||||
@@ -504,6 +503,7 @@ public class AloneExamServiceImpl implements IAloneExamService{
|
|||||||
aloneExamAnswer.setAid(userId);
|
aloneExamAnswer.setAid(userId);
|
||||||
aloneExamAnswer.setName(examScoreDto.getUserName());
|
aloneExamAnswer.setName(examScoreDto.getUserName());
|
||||||
aloneExamAnswer.setUcode(examScoreDto.getWorkNum());
|
aloneExamAnswer.setUcode(examScoreDto.getWorkNum());
|
||||||
|
aloneExamAnswer.setStatus(AloneExamAnswer.STATUS_FINISH);
|
||||||
// aloneExamAnswer.setUseSecond(examScoreDto.getUseMinute()*60);
|
// aloneExamAnswer.setUseSecond(examScoreDto.getUseMinute()*60);
|
||||||
|
|
||||||
ExamTest examTest = examTestDao.get(examScoreDto.getTestId());
|
ExamTest examTest = examTestDao.get(examScoreDto.getTestId());
|
||||||
@@ -522,7 +522,7 @@ public class AloneExamServiceImpl implements IAloneExamService{
|
|||||||
if(examTest.getScoringType()!=null && examTest.getScoringType()==2) {
|
if(examTest.getScoringType()!=null && examTest.getScoringType()==2) {
|
||||||
//最后一次的分数为准
|
//最后一次的分数为准
|
||||||
aeDao.update(UpdateBuilder.from(AloneExam.class)
|
aeDao.update(UpdateBuilder.from(AloneExam.class)
|
||||||
.addUpdateField("status", AloneExamAnswer.STATUS_FINISH)
|
.addUpdateField("status", AloneExam.STATUS_FINISH)
|
||||||
.addUpdateField("score", examScoreDto.getScore())
|
.addUpdateField("score", examScoreDto.getScore())
|
||||||
.addUpdateField("times", currentTimes+1)
|
.addUpdateField("times", currentTimes+1)
|
||||||
.addFilter(FieldFilters.eq("aid", userId))
|
.addFilter(FieldFilters.eq("aid", userId))
|
||||||
@@ -534,7 +534,7 @@ public class AloneExamServiceImpl implements IAloneExamService{
|
|||||||
aeDao.updateMultiFieldById(aloneExam.getId(), UpdateBuilder.create("score", examScoreDto.getScore()), UpdateBuilder.create("times", currentTimes+1));
|
aeDao.updateMultiFieldById(aloneExam.getId(), UpdateBuilder.create("score", examScoreDto.getScore()), UpdateBuilder.create("times", currentTimes+1));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
aeDao.updateMultiFieldById(aloneExam.getId(), UpdateBuilder.create("status", AloneExamAnswer.STATUS_FINISH), UpdateBuilder.create("score", examScoreDto.getScore()), UpdateBuilder.create("times", currentTimes+1));
|
aeDao.updateMultiFieldById(aloneExam.getId(), UpdateBuilder.create("status", AloneExam.STATUS_FINISH), UpdateBuilder.create("score", examScoreDto.getScore()), UpdateBuilder.create("times", currentTimes+1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user