Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2-xzb1
This commit is contained in:
commit
a1c9d21e02
@ -105,35 +105,46 @@ public class PaperUserController {
|
||||
/**
|
||||
* 分页查询某个试卷蓝图的所有用户试卷基本信息
|
||||
*/
|
||||
@PostMapping("/user/page/composition")
|
||||
/* @PostMapping("/user/page/composition")
|
||||
public PageVO<PaperUserInfoVo> findPaperUserByPage(@RequestBody FindPaperUserForCompositionReqVo req, @RequestAttribute AccountVO user) {
|
||||
return this.paperUserFindPageService.findPaperUserByPage(req);
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 查看某个班级的某个试卷蓝图的所有学生试卷
|
||||
*/
|
||||
@PostMapping("/user/page/class")
|
||||
public PageVO<PaperUserInfoVo> findPaperUserByPageForClass(@RequestBody FindPaperUserForClassReqVo req, @RequestAttribute AccountVO user) {
|
||||
@GetMapping("/user/page")
|
||||
public PageVO<PageUserDetailVO> findPaperUserByPageForClass(@ModelAttribute PageUserDetailQuery req) {
|
||||
return this.paperUserFindPageService.findPaperUserByPageForClass(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看某个班级的某个试卷蓝图的所有学生试卷 (柱状图)
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/user/curve")
|
||||
public CurveForClassVO curveForClass(@ModelAttribute PageUserDetailQuery req) {
|
||||
return this.paperUserFindPageService.curveForClass(req);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看某个账户的某个试卷蓝图的用户试卷
|
||||
*/
|
||||
@PostMapping("/user/list/account")
|
||||
/* @PostMapping("/user/list/account")
|
||||
public List<PaperUserInfoVo> findPaperUserForAccount(@RequestBody FindPaperUserForAccountReqVo req, @RequestAttribute AccountVO user) {
|
||||
return this.paperUserFindPageService.findPaperUserForAccount(req);
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 查看组织的某个账户的某个试卷蓝图的用户试卷
|
||||
*/
|
||||
@PostMapping("/{orgId}/user/list/account")
|
||||
/* @PostMapping("/{orgId}/user/list/account")
|
||||
public List<PaperUserInfoVo> findOrgPaperUserForAccount(@PathVariable("orgId") Long orgId, @RequestBody FindPaperUserForAccountReqVo req, @RequestAttribute AccountVO user) {
|
||||
req.setOrgId(orgId);
|
||||
return this.paperUserFindPageService.findPaperUserForAccount(req);
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 查看组织下某个类型题的数量
|
||||
|
@ -3,13 +3,30 @@ package club.joylink.rtss.dao.paper;
|
||||
import club.joylink.rtss.entity.paper.PaperUser;
|
||||
import club.joylink.rtss.entity.paper.PaperUserExample;
|
||||
import java.util.List;
|
||||
|
||||
import club.joylink.rtss.vo.paper.CurveForClassVO;
|
||||
import club.joylink.rtss.vo.paper.PageUserDetailQuery;
|
||||
import club.joylink.rtss.vo.paper.PageUserDetailVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface PaperUserDAO {
|
||||
|
||||
|
||||
@Select("<script>select " +
|
||||
" C.nickname,C.id as user_id,C.account,B.score,B.start_time,B.end_time" +
|
||||
" from (" +
|
||||
"select * from org_user where 1 = 1 and org_id = #{query.orgId} and role = #{query.orgRole} ) A " +
|
||||
" left join ( select B.user_id ,B.score,B.start_time,B.end_time from " +
|
||||
" (select max(id) as id from rts_paper_user where pc_id = #{query.pcId} GROUP BY user_id ) A" +
|
||||
" INNER JOIN rts_paper_user B on A.id = B.id ) B on A.user_id = B.user_id " +
|
||||
" left join sys_account C on A.user_id = C.id </script>")
|
||||
List<PageUserDetailVO> selectDetail(@Param("query") PageUserDetailQuery query);
|
||||
|
||||
long countByExample(PaperUserExample example);
|
||||
|
||||
int deleteByExample(PaperUserExample example);
|
||||
@ -31,4 +48,4 @@ public interface PaperUserDAO {
|
||||
int updateByPrimaryKeySelective(PaperUser record);
|
||||
|
||||
int updateByPrimaryKey(PaperUser record);
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import org.springframework.stereotype.Repository;
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface AcPermissionDAO {
|
||||
@Insert("<script> insert into rts_permission (id,project_code, map_id, permission_type, \n" +
|
||||
@Insert("<script> insert into rts_permission (id,project_code, map_id, permission_type, " +
|
||||
" `name`, des, creator_id, create_time, update_time,is_sync)" +
|
||||
" values (#{record.id,jdbcType=BIGINT},#{record.projectCode,jdbcType=VARCHAR}, #{record.mapId,jdbcType=BIGINT}" +
|
||||
", #{record.permissionType,jdbcType=INTEGER}," +
|
||||
|
@ -21,6 +21,11 @@ public class PaperUser implements Serializable {
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 组织id
|
||||
*/
|
||||
private Long orgId;
|
||||
|
||||
/**
|
||||
* 生成用户试卷的paper_compostion的id
|
||||
*/
|
||||
|
@ -245,6 +245,66 @@ public class PaperUserExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdIsNull() {
|
||||
addCriterion("org_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdIsNotNull() {
|
||||
addCriterion("org_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdEqualTo(Long value) {
|
||||
addCriterion("org_id =", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdNotEqualTo(Long value) {
|
||||
addCriterion("org_id <>", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdGreaterThan(Long value) {
|
||||
addCriterion("org_id >", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("org_id >=", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdLessThan(Long value) {
|
||||
addCriterion("org_id <", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("org_id <=", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdIn(List<Long> values) {
|
||||
addCriterion("org_id in", values, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdNotIn(List<Long> values) {
|
||||
addCriterion("org_id not in", values, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdBetween(Long value1, Long value2) {
|
||||
addCriterion("org_id between", value1, value2, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("org_id not between", value1, value2, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPcIdIsNull() {
|
||||
addCriterion("pc_id is null");
|
||||
return (Criteria) this;
|
||||
@ -710,4 +770,4 @@ public class PaperUserExample {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package club.joylink.rtss.services.paper;
|
||||
|
||||
import club.joylink.rtss.dao.PublishedTraining2DAO;
|
||||
import club.joylink.rtss.dao.paper.*;
|
||||
import club.joylink.rtss.entity.paper.PaperComposition;
|
||||
import club.joylink.rtss.entity.paper.PaperRule;
|
||||
import club.joylink.rtss.entity.paper.PaperUser;
|
||||
import club.joylink.rtss.entity.paper.PaperUserQuestion;
|
||||
import club.joylink.rtss.entity.paper.*;
|
||||
import club.joylink.rtss.entity.paper.question.PaperQuestion;
|
||||
import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2;
|
||||
@ -39,8 +36,8 @@ public class PaperUserCreateService {
|
||||
private PaperUserService paperUserService;
|
||||
@Autowired
|
||||
private PaperCompositionDAO compositionDAO;
|
||||
@Autowired
|
||||
private PaperRuleDAO ruleDAO;
|
||||
// @Autowired
|
||||
// private PaperRuleDAO ruleDAO;
|
||||
@Autowired
|
||||
private PaperUserDAO paperUserDAO;
|
||||
@Autowired
|
||||
@ -52,6 +49,27 @@ public class PaperUserCreateService {
|
||||
@Autowired
|
||||
private PublishedTraining2DAO trainingDAO;
|
||||
|
||||
|
||||
private void resetPaperRecord(Long pcId, Long userId){
|
||||
PaperUserExample example = new PaperUserExample();
|
||||
example.createCriteria().andPcIdEqualTo(pcId).andUserIdEqualTo(userId);
|
||||
List<PaperUser> puList = this.paperUserDAO.selectByExample(example);
|
||||
if(!CollectionUtils.isEmpty(puList)){
|
||||
List<Long> idList = puList.stream().map(d->d.getId()).collect(Collectors.toList());
|
||||
|
||||
/* PaperUser pu = new PaperUser();
|
||||
pu.setStatus(false);
|
||||
example.createCriteria().andIdIn(idList);
|
||||
this.paperUserDAO.updateByExampleSelective(pu,example);*/
|
||||
this.deletePaperUserQuestion(idList);
|
||||
}
|
||||
}
|
||||
|
||||
private void deletePaperUserQuestion(List<Long> paperUserIds){
|
||||
PaperUserQuestionExample questionExample = new PaperUserQuestionExample();
|
||||
questionExample.createCriteria().andPuIdIn(paperUserIds);
|
||||
paperUserQuestionDAO.deleteByExample(questionExample);
|
||||
}
|
||||
/**
|
||||
* 根据试卷蓝图生成用户的试卷
|
||||
*
|
||||
@ -60,8 +78,9 @@ public class PaperUserCreateService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CreatePaperRspVo createPaper(Long pcId, AccountVO user) {
|
||||
// 检测是否创建过试卷
|
||||
PaperUser oldPu = paperUserService.findByUserIdAndPcId(user.getId(), pcId);
|
||||
PaperExceptionAssert.PcNotExisted.assertTrue(null == oldPu, "该用户的试卷已经存在,pcId = " + pcId);
|
||||
// PaperUser oldPu = paperUserService.findByUserIdAndPcId(user.getId(), pcId);
|
||||
// PaperExceptionAssert.PcNotExisted.assertTrue(null == oldPu, "该用户的试卷已经存在,pcId = " + pcId);
|
||||
this.resetPaperRecord(pcId,user.getId());
|
||||
// 校验试卷蓝图
|
||||
PaperComposition composition = compositionDAO.selectByPrimaryKey(pcId);
|
||||
PaperExceptionAssert.PcExisted.assertNotNull(composition, "创建试卷的试卷定义不存在,pcId = " + pcId);
|
||||
@ -84,6 +103,7 @@ public class PaperUserCreateService {
|
||||
// paper.setOrgId(orgId);
|
||||
paper.setCreateTime(LocalDateTime.now());
|
||||
paper.setStartTime(LocalDateTime.now());
|
||||
// paper.setStatus(true);
|
||||
paperUserDAO.insertSelective(paper);
|
||||
paper = paperUserService.findByUserIdAndPcId(user.getId(), pcId);
|
||||
//
|
||||
|
@ -12,28 +12,30 @@ import club.joylink.rtss.entity.SysAccountExample;
|
||||
import club.joylink.rtss.entity.paper.PaperComposition;
|
||||
import club.joylink.rtss.entity.paper.PaperUser;
|
||||
import club.joylink.rtss.entity.paper.PaperUserExample;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.exception.PaperExceptionAssert;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.paper.FindPaperUserForAccountReqVo;
|
||||
import club.joylink.rtss.vo.paper.FindPaperUserForClassReqVo;
|
||||
import club.joylink.rtss.vo.paper.FindPaperUserForCompositionReqVo;
|
||||
import club.joylink.rtss.vo.paper.PaperUserInfoVo;
|
||||
import club.joylink.rtss.vo.paper.*;
|
||||
import club.joylink.rtss.vo.paper.convertor.PaperUserConvertor;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户试卷分页查询业务实现
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PaperUserFindPageService {
|
||||
@Autowired
|
||||
private PaperCompositionDAO paperCompositionDAO;
|
||||
@ -46,7 +48,7 @@ public class PaperUserFindPageService {
|
||||
/**
|
||||
* 教师查看某个学生的某个试卷蓝图的用户试卷
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
/* @Transactional(readOnly = true)
|
||||
public List<PaperUserInfoVo> findPaperUserForAccount(FindPaperUserForAccountReqVo req){
|
||||
PaperComposition pc = paperCompositionDAO.selectByPrimaryKey(req.getPcId());
|
||||
PaperExceptionAssert.PcExisted.assertNotNull(pc,"试卷定义不存在");
|
||||
@ -62,46 +64,46 @@ public class PaperUserFindPageService {
|
||||
}
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
* 教师根据班级查询某个试卷蓝图的所有用户试卷基本信息
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public PageVO<PaperUserInfoVo> findPaperUserByPageForClass(FindPaperUserForClassReqVo req){
|
||||
public PageVO<PageUserDetailVO> findPaperUserByPageForClass(PageUserDetailQuery req){
|
||||
log.info(req.toString());
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(Objects.isNull(req.getPcId()) || Objects.isNull(req.getOrgId()) ,"缺少必要的参数");
|
||||
|
||||
PaperComposition pc = paperCompositionDAO.selectByPrimaryKey(req.getPcId());
|
||||
PaperExceptionAssert.PcExisted.assertNotNull(pc,"试卷定义不存在");
|
||||
//
|
||||
PaperUserExample example = new PaperUserExample();
|
||||
PaperUserExample.Criteria c = example.createCriteria();
|
||||
c.andPcIdEqualTo(req.getPcId());
|
||||
List<Long> students= findAllClassStudents(req.getClassId());
|
||||
PaperExceptionAssert.PdValid.assertTrue(!CollectionUtils.isEmpty(students),String.format("班级[%s]内没有学生",req.getClassId()));
|
||||
c.andUserIdIn(students);
|
||||
switch (req.getFindType()){
|
||||
case Pass:c.andScoreIsNotNull().andScoreGreaterThanOrEqualTo(pc.getPassScore());break;
|
||||
case NotPass:c.andScoreIsNotNull().andScoreLessThan(pc.getPassScore());break;
|
||||
case NotComplete:c.andScoreIsNull();break;
|
||||
case Complete:c.andScoreIsNotNull();break;
|
||||
case All:break;
|
||||
}
|
||||
//
|
||||
String orderBy = req.getOrderBy().with()+(req.getDesc()?" desc":"");
|
||||
|
||||
req.setOrgRole(BusinessConsts.OrgRole.Student.name());
|
||||
PageHelper.clearPage();
|
||||
PageHelper.startPage(req.getPageNum(),req.getPageSize(),orderBy);
|
||||
Page<PaperUser> sqlPage = (Page<PaperUser>) this.paperUserDAO.selectByExample(example);
|
||||
//
|
||||
List<PaperUserInfoVo> rtContent= new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(sqlPage.getResult())){
|
||||
sqlPage.getResult().forEach(t -> {
|
||||
rtContent.add(PaperUserConvertor.convert(pc,t));
|
||||
});
|
||||
}
|
||||
return PageVO.convert(sqlPage,rtContent);
|
||||
PageHelper.startPage(req.getPageNum(),req.getPageSize());
|
||||
Page<PageUserDetailVO> sqlPage = (Page<PageUserDetailVO>) this.paperUserDAO.selectDetail(req);
|
||||
sqlPage.getResult().stream().forEach(d->d.result(pc));
|
||||
return PageVO.convert(sqlPage);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public CurveForClassVO curveForClass(PageUserDetailQuery req){
|
||||
log.info(req.toString());
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(Objects.isNull(req.getPcId()) || Objects.isNull(req.getOrgId()) ,"缺少必要的参数");
|
||||
|
||||
PaperComposition pc = paperCompositionDAO.selectByPrimaryKey(req.getPcId());
|
||||
PaperExceptionAssert.PcExisted.assertNotNull(pc,"试卷定义不存在");
|
||||
|
||||
req.setOrgRole(BusinessConsts.OrgRole.Student.name());
|
||||
|
||||
List<PageUserDetailVO> sqlPage = this.paperUserDAO.selectDetail(req);
|
||||
CurveForClassVO ccvo = CurveForClassVO.convertTo(pc,sqlPage);
|
||||
return ccvo;
|
||||
}
|
||||
/**
|
||||
* 分页查询某个试卷蓝图的所有用户试卷基本信息
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
/* @Transactional(readOnly = true)
|
||||
public PageVO<PaperUserInfoVo> findPaperUserByPage(FindPaperUserForCompositionReqVo req) {
|
||||
//
|
||||
PaperComposition pc = paperCompositionDAO.selectByPrimaryKey(req.getPcId());
|
||||
@ -128,22 +130,24 @@ public class PaperUserFindPageService {
|
||||
});
|
||||
}
|
||||
return PageVO.convert(sqlPage,rtContent);
|
||||
}
|
||||
/**
|
||||
* 查询某个班级的所有学生的userId
|
||||
*/
|
||||
private List<Long> findAllClassStudents(Long classId){
|
||||
}*/
|
||||
|
||||
private List<OrgUser> findAllClassStudents(Long classId){
|
||||
OrgUserExample example = new OrgUserExample();
|
||||
//根据班级id和身份角色来查
|
||||
example.createCriteria().andOrgIdEqualTo(classId).andRoleEqualTo(BusinessConsts.OrgRole.Student.name());
|
||||
List<OrgUser> sts = orgUserDAO.selectByExample(example);
|
||||
List<Long> rt = new ArrayList<>(CollectionUtils.isEmpty(sts)?0:sts.size());
|
||||
if(!CollectionUtils.isEmpty(sts)){
|
||||
sts.forEach(st ->{
|
||||
rt.add(st.getUserId());
|
||||
});
|
||||
return sts;
|
||||
}
|
||||
/**
|
||||
* 查询某个班级的所有学生的userId
|
||||
*/
|
||||
private List<Long> findAllClassStudentIds(Long classId){
|
||||
List<OrgUser> sts = this.findAllClassStudents(classId);
|
||||
if(CollectionUtils.isEmpty(sts)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return rt;
|
||||
return sts.stream().map(d->d.getUserId()).collect(Collectors.toList());
|
||||
}
|
||||
/**
|
||||
* 根据组织id和账户信息查询
|
||||
|
@ -56,12 +56,12 @@ public class PaperUserService {
|
||||
* 获取组织某个类型题的数量
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public Long findCountForQuestion(Long orgId,PaperQType.GroupType groupType,PaperQType.SubType subType,List<String>tags){
|
||||
public Long findCountForQuestion(Long orgId,PaperQType.GroupType groupType,PaperQType.SubType subType,String tags){
|
||||
if(PaperQType.GroupType.Common.equals(groupType)){
|
||||
String tagStr=null;
|
||||
if(!CollectionUtils.isEmpty(tags)){
|
||||
String tagStr=tags;
|
||||
/*if(!CollectionUtils.isEmpty(tags)){
|
||||
tagStr = Joiner.on(",").skipNulls().join(tags);
|
||||
}
|
||||
}*/
|
||||
BusinessConsts.TheoryType theoryType = this.getPaperQuestionType(subType);
|
||||
return paperQuestionService.queryCount(orgId,theoryType,tagStr);
|
||||
}else if(PaperQType.GroupType.Training.equals(groupType)){
|
||||
@ -99,12 +99,16 @@ public class PaperUserService {
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePaperUser(Long puId) {
|
||||
this.deletePaperQuestion(puId);
|
||||
//删除试卷
|
||||
paperUserDAO.deleteByPrimaryKey(puId);
|
||||
}
|
||||
|
||||
private void deletePaperQuestion(Long puId){
|
||||
//删除试卷试题关联表
|
||||
PaperUserQuestionExample puqExample = new PaperUserQuestionExample();
|
||||
puqExample.createCriteria().andPuIdEqualTo(puId);
|
||||
paperUserQuestionDAO.deleteByExample(puqExample);
|
||||
//删除试卷
|
||||
paperUserDAO.deleteByPrimaryKey(puId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -135,11 +139,7 @@ public class PaperUserService {
|
||||
PaperExceptionAssert.PuStart.assertNotNull(paper.getStartTime(), "用户未开始答题");
|
||||
PaperExceptionAssert.PuNotSubmit.assertNull(paper.getEndTime(), "用户已经交卷");
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
//记录交卷时间
|
||||
PaperUser endPaper = new PaperUser();
|
||||
endPaper.setId(puId);
|
||||
endPaper.setEndTime(now);
|
||||
paperUserDAO.updateByPrimaryKeySelective(endPaper);
|
||||
|
||||
//统计最终结果
|
||||
PaperComposition composition = compositionDAO.selectByPrimaryKey(paper.getPcId());
|
||||
List<PaperRule> ruleList = compositionService.findRuleByPcId(paper.getPcId());
|
||||
@ -159,6 +159,14 @@ public class PaperUserService {
|
||||
scoreTraining += calculateTrainingScore(uq, ruleMap);break;
|
||||
}
|
||||
}
|
||||
|
||||
//记录交卷时间
|
||||
PaperUser endPaper = new PaperUser();
|
||||
endPaper.setId(puId);
|
||||
endPaper.setEndTime(now);
|
||||
endPaper.setScore(scoreCommon + scoreTraining);
|
||||
paperUserDAO.updateByPrimaryKeySelective(endPaper);
|
||||
this.deletePaperQuestion(puId);
|
||||
//
|
||||
PaperSubmitRspVo rsp = new PaperSubmitRspVo();
|
||||
rsp.setPuId(puId);
|
||||
|
@ -191,9 +191,9 @@ public class OldPermissionDataSyncService {
|
||||
Set<Long> existPermissSet = Sets.newHashSet();
|
||||
List<PermissionSystemAbility> allSaList = Lists.newArrayList();
|
||||
for (SyncVO syncVO : syncVOList) {
|
||||
syncVO.permission.setIsSync(true);
|
||||
syncVO.getSystemAbility().forEach(d->d.setIsSync(true));
|
||||
if(existPermissSet.add(syncVO.getPermission().getId())){
|
||||
syncVO.permission.setIsSync(true);
|
||||
syncVO.getSystemAbility().forEach(d->d.setIsSync(true));
|
||||
this.acPermissionDAO.customerSyncInsert(syncVO.permission);
|
||||
allSaList.addAll(syncVO.getSystemAbility());
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
package club.joylink.rtss.vo.paper;
|
||||
|
||||
import club.joylink.rtss.entity.paper.PaperComposition;
|
||||
import club.joylink.rtss.vo.doc.DocumentVO;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class CurveForClassVO {
|
||||
private Integer fullScore;
|
||||
private Integer passScore;
|
||||
private List<ScoreDetail> detail;
|
||||
|
||||
public CurveForClassVO(Integer fullScore, Integer passScore, List<ScoreDetail> detail) {
|
||||
this.fullScore = fullScore;
|
||||
this.passScore = passScore;
|
||||
this.detail = detail;
|
||||
}
|
||||
|
||||
public static CurveForClassVO convertTo(PaperComposition pc , List<PageUserDetailVO> detailVOs){
|
||||
if(CollectionUtils.isEmpty(detailVOs)){
|
||||
return new CurveForClassVO();
|
||||
}
|
||||
PageUserDetailVO dvo = detailVOs.get(0);
|
||||
List<ScoreDetail> sdList = Lists.newArrayList();
|
||||
for (PageUserDetailVO vo : detailVOs) {
|
||||
sdList.add(new ScoreDetail(vo.getUserId(),vo.getNickname(), Objects.isNull(vo.getScore()) ? 0 : vo.getScore()));
|
||||
}
|
||||
return new CurveForClassVO(pc.getFullScore(), pc.getPassScore(), sdList);
|
||||
}
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class ScoreDetail{
|
||||
|
||||
public ScoreDetail(Long userId, String nickName, Integer score) {
|
||||
this.userId = userId;
|
||||
this.nickName = nickName;
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
private Long userId;
|
||||
private String nickName;
|
||||
private Integer score;
|
||||
}
|
||||
}
|
@ -28,5 +28,6 @@ public class FindCountForQuestionReqVo {
|
||||
/**
|
||||
* 筛选试题的标签列表
|
||||
*/
|
||||
private List<String> tags = new ArrayList<>();
|
||||
// private List<String> tags = new ArrayList<>();
|
||||
private String tags;
|
||||
}
|
||||
|
@ -1,59 +0,0 @@
|
||||
package club.joylink.rtss.vo.paper;
|
||||
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 根据班级分页查询相关用户试卷
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class FindPaperUserForClassReqVo extends PageQueryVO {
|
||||
|
||||
/**
|
||||
* 试卷蓝图id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@NotNull
|
||||
private Long pcId;
|
||||
/**
|
||||
* 班级id即orgId
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@NotNull
|
||||
private Long classId;
|
||||
/**
|
||||
* 查询类型,默认所有,序列化后为数值<br>
|
||||
* All(1),//所有<br>
|
||||
* Pass(2),//所有及格的<br>
|
||||
* NotPass(3),//所有不及格的<br>
|
||||
* NotComplete(4),//未完成考试<br>
|
||||
* Complete(5),//完成考试,即及格和不及格的<br>
|
||||
*/
|
||||
private FindPuType findType = FindPuType.All;
|
||||
/**
|
||||
* 以什么来排序,默认以用户试卷创建时间,序列化后为数值<br>
|
||||
* CreateTime(1, "create_time"),//用户试卷创建时间<br>
|
||||
* StartTime(2, "start_time"),//用户开始答题时间<br>
|
||||
* Score(3, "score"),//用户最终得分<br>
|
||||
*/
|
||||
private FindPuOrderByType orderBy = FindPuOrderByType.CreateTime;
|
||||
/**
|
||||
* 是否降序,true-降序,false-升序,默认值为true;
|
||||
*/
|
||||
private Boolean desc = true;
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package club.joylink.rtss.vo.paper;
|
||||
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class PageUserDetailQuery extends PageQueryVO {
|
||||
private Long orgId;
|
||||
private Long pcId;
|
||||
|
||||
private String orgRole;
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package club.joylink.rtss.vo.paper;
|
||||
|
||||
import club.joylink.rtss.entity.paper.PaperComposition;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
public class PageUserDetailVO {
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String nickname;
|
||||
private Long userId;
|
||||
/**
|
||||
* 学号
|
||||
*/
|
||||
private String account;
|
||||
/**
|
||||
* 分数
|
||||
*/
|
||||
private Integer score;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
/**
|
||||
* 0 = 未知情况
|
||||
* 1 = 考试通过
|
||||
* 2 = 开始不通过
|
||||
* 3 = 未参加
|
||||
* 4 = 未提交
|
||||
*
|
||||
*/
|
||||
private Integer result;
|
||||
|
||||
public void result(PaperComposition pc) {
|
||||
this.result = 0;
|
||||
if(Objects.nonNull(this.startTime) && Objects.nonNull(this.endTime)){
|
||||
this.result = 2;
|
||||
if(this.score >= pc.getPassScore()){
|
||||
this.result = 1;
|
||||
}
|
||||
}else if(Objects.isNull(this.startTime)){
|
||||
this.result = 3;
|
||||
}else if(Objects.nonNull(this.startTime)){
|
||||
this.result = 4;
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.paper.PaperUser">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="user_id" jdbcType="BIGINT" property="userId" />
|
||||
<result column="org_id" jdbcType="BIGINT" property="orgId" />
|
||||
<result column="pc_id" jdbcType="BIGINT" property="pcId" />
|
||||
<result column="score" jdbcType="INTEGER" property="score" />
|
||||
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
|
||||
@ -70,7 +71,7 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, user_id, pc_id, score, start_time, end_time, cause, create_time
|
||||
id, user_id, org_id, pc_id, score, start_time, end_time, cause, create_time
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperUserExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@ -111,12 +112,12 @@
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.paper.PaperUser" useGeneratedKeys="true">
|
||||
insert into rts_paper_user (user_id, pc_id, score,
|
||||
start_time, end_time, cause,
|
||||
create_time)
|
||||
values (#{userId,jdbcType=BIGINT}, #{pcId,jdbcType=BIGINT}, #{score,jdbcType=INTEGER},
|
||||
#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{cause,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP})
|
||||
insert into rts_paper_user (user_id, org_id, pc_id,
|
||||
score, start_time, end_time,
|
||||
cause, create_time)
|
||||
values (#{userId,jdbcType=BIGINT}, #{orgId,jdbcType=BIGINT}, #{pcId,jdbcType=BIGINT},
|
||||
#{score,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
|
||||
#{cause,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.paper.PaperUser" useGeneratedKeys="true">
|
||||
insert into rts_paper_user
|
||||
@ -124,6 +125,9 @@
|
||||
<if test="userId != null">
|
||||
user_id,
|
||||
</if>
|
||||
<if test="orgId != null">
|
||||
org_id,
|
||||
</if>
|
||||
<if test="pcId != null">
|
||||
pc_id,
|
||||
</if>
|
||||
@ -147,6 +151,9 @@
|
||||
<if test="userId != null">
|
||||
#{userId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="orgId != null">
|
||||
#{orgId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="pcId != null">
|
||||
#{pcId,jdbcType=BIGINT},
|
||||
</if>
|
||||
@ -182,6 +189,9 @@
|
||||
<if test="record.userId != null">
|
||||
user_id = #{record.userId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.orgId != null">
|
||||
org_id = #{record.orgId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.pcId != null">
|
||||
pc_id = #{record.pcId,jdbcType=BIGINT},
|
||||
</if>
|
||||
@ -209,6 +219,7 @@
|
||||
update rts_paper_user
|
||||
set id = #{record.id,jdbcType=BIGINT},
|
||||
user_id = #{record.userId,jdbcType=BIGINT},
|
||||
org_id = #{record.orgId,jdbcType=BIGINT},
|
||||
pc_id = #{record.pcId,jdbcType=BIGINT},
|
||||
score = #{record.score,jdbcType=INTEGER},
|
||||
start_time = #{record.startTime,jdbcType=TIMESTAMP},
|
||||
@ -225,6 +236,9 @@
|
||||
<if test="userId != null">
|
||||
user_id = #{userId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="orgId != null">
|
||||
org_id = #{orgId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="pcId != null">
|
||||
pc_id = #{pcId,jdbcType=BIGINT},
|
||||
</if>
|
||||
@ -249,6 +263,7 @@
|
||||
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.paper.PaperUser">
|
||||
update rts_paper_user
|
||||
set user_id = #{userId,jdbcType=BIGINT},
|
||||
org_id = #{orgId,jdbcType=BIGINT},
|
||||
pc_id = #{pcId,jdbcType=BIGINT},
|
||||
score = #{score,jdbcType=INTEGER},
|
||||
start_time = #{startTime,jdbcType=TIMESTAMP},
|
||||
|
@ -103,12 +103,12 @@ public class PaperApiTestController {
|
||||
rt.setAccount("18710717058");
|
||||
System.out.println(JsonUtils.writeValueAsString(rt));
|
||||
}
|
||||
public static void findPaperUserForClassReqVo(){
|
||||
/* public static void findPaperUserForClassReqVo(){
|
||||
FindPaperUserForClassReqVo rt = new FindPaperUserForClassReqVo();
|
||||
rt.setClassId(56L);
|
||||
rt.setPcId(1L);
|
||||
System.out.println(JsonUtils.writeValueAsString(rt));
|
||||
}
|
||||
}*/
|
||||
public static void findPaperUserForAccountReqVo(){
|
||||
FindPaperUserForAccountReqVo rt = new FindPaperUserForAccountReqVo();
|
||||
rt.setPcId(1L);
|
||||
@ -126,7 +126,7 @@ public class PaperApiTestController {
|
||||
paperSubmitAnswerReqVo();
|
||||
findPaperUserForCompositionReqVo();
|
||||
findPaperCompositionByAccountReqVo();
|
||||
findPaperUserForClassReqVo();
|
||||
// findPaperUserForClassReqVo();
|
||||
findPaperUserForAccountReqVo();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user