paper company id

This commit is contained in:
xzb 2022-09-28 15:36:48 +08:00
parent 69014b0c71
commit 29d9d76e7d
23 changed files with 236 additions and 216 deletions

View File

@ -31,4 +31,4 @@ public interface PaperCompositionDAO {
int updateByPrimaryKeySelective(PaperComposition record);
int updateByPrimaryKey(PaperComposition record);
}
}

View File

@ -5,8 +5,8 @@ import java.time.LocalDateTime;
import lombok.Data;
/**
* @author
*
* @author
*
*/
@Data
public class PaperComposition implements Serializable {
@ -26,9 +26,9 @@ public class PaperComposition implements Serializable {
private String profile;
/**
* 项目code
* 组织id
*/
private String projectCode;
private String companyId;
/**
* 启用起始时间
@ -66,9 +66,9 @@ public class PaperComposition implements Serializable {
private LocalDateTime updateTime;
/**
* 试卷蓝图状态1-正在编辑2-封存(不能修改)3-已经被使用(不能修改删除)
* 试卷蓝图状态1-正在编辑2-封存(不能修改)3-已经被使用(不能修改删除)定于见PaperCompositionState
*/
private Integer state;
private static final long serialVersionUID = 1L;
}
}

View File

@ -325,73 +325,73 @@ public class PaperCompositionExample {
return (Criteria) this;
}
public Criteria andProjectCodeIsNull() {
addCriterion("project_code is null");
public Criteria andCompanyIdIsNull() {
addCriterion("company_id is null");
return (Criteria) this;
}
public Criteria andProjectCodeIsNotNull() {
addCriterion("project_code is not null");
public Criteria andCompanyIdIsNotNull() {
addCriterion("company_id is not null");
return (Criteria) this;
}
public Criteria andProjectCodeEqualTo(String value) {
addCriterion("project_code =", value, "projectCode");
public Criteria andCompanyIdEqualTo(String value) {
addCriterion("company_id =", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotEqualTo(String value) {
addCriterion("project_code <>", value, "projectCode");
public Criteria andCompanyIdNotEqualTo(String value) {
addCriterion("company_id <>", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeGreaterThan(String value) {
addCriterion("project_code >", value, "projectCode");
public Criteria andCompanyIdGreaterThan(String value) {
addCriterion("company_id >", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeGreaterThanOrEqualTo(String value) {
addCriterion("project_code >=", value, "projectCode");
public Criteria andCompanyIdGreaterThanOrEqualTo(String value) {
addCriterion("company_id >=", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLessThan(String value) {
addCriterion("project_code <", value, "projectCode");
public Criteria andCompanyIdLessThan(String value) {
addCriterion("company_id <", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLessThanOrEqualTo(String value) {
addCriterion("project_code <=", value, "projectCode");
public Criteria andCompanyIdLessThanOrEqualTo(String value) {
addCriterion("company_id <=", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLike(String value) {
addCriterion("project_code like", value, "projectCode");
public Criteria andCompanyIdLike(String value) {
addCriterion("company_id like", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotLike(String value) {
addCriterion("project_code not like", value, "projectCode");
public Criteria andCompanyIdNotLike(String value) {
addCriterion("company_id not like", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeIn(List<String> values) {
addCriterion("project_code in", values, "projectCode");
public Criteria andCompanyIdIn(List<String> values) {
addCriterion("company_id in", values, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotIn(List<String> values) {
addCriterion("project_code not in", values, "projectCode");
public Criteria andCompanyIdNotIn(List<String> values) {
addCriterion("company_id not in", values, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeBetween(String value1, String value2) {
addCriterion("project_code between", value1, value2, "projectCode");
public Criteria andCompanyIdBetween(String value1, String value2) {
addCriterion("company_id between", value1, value2, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotBetween(String value1, String value2) {
addCriterion("project_code not between", value1, value2, "projectCode");
public Criteria andCompanyIdNotBetween(String value1, String value2) {
addCriterion("company_id not between", value1, value2, "companyId");
return (Criteria) this;
}
@ -970,4 +970,4 @@ public class PaperCompositionExample {
this(condition, value, secondValue, null);
}
}
}
}

View File

@ -30,7 +30,7 @@ public class PaperRule implements Serializable {
private Integer subtype;
/**
* 筛选题目的标签即根据标签来筛选题目
* 筛选题目的标签即根据标签来筛选题目;List<String>的json
*/
private String tags;

View File

@ -26,9 +26,9 @@ public class PaperUser implements Serializable {
private Long pcId;
/**
* 项目code
* 组织id
*/
private String projectCode;
private String companyId;
/**
* 用户最终得分

View File

@ -305,73 +305,73 @@ public class PaperUserExample {
return (Criteria) this;
}
public Criteria andProjectCodeIsNull() {
addCriterion("project_code is null");
public Criteria andCompanyIdIsNull() {
addCriterion("company_id is null");
return (Criteria) this;
}
public Criteria andProjectCodeIsNotNull() {
addCriterion("project_code is not null");
public Criteria andCompanyIdIsNotNull() {
addCriterion("company_id is not null");
return (Criteria) this;
}
public Criteria andProjectCodeEqualTo(String value) {
addCriterion("project_code =", value, "projectCode");
public Criteria andCompanyIdEqualTo(String value) {
addCriterion("company_id =", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotEqualTo(String value) {
addCriterion("project_code <>", value, "projectCode");
public Criteria andCompanyIdNotEqualTo(String value) {
addCriterion("company_id <>", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeGreaterThan(String value) {
addCriterion("project_code >", value, "projectCode");
public Criteria andCompanyIdGreaterThan(String value) {
addCriterion("company_id >", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeGreaterThanOrEqualTo(String value) {
addCriterion("project_code >=", value, "projectCode");
public Criteria andCompanyIdGreaterThanOrEqualTo(String value) {
addCriterion("company_id >=", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLessThan(String value) {
addCriterion("project_code <", value, "projectCode");
public Criteria andCompanyIdLessThan(String value) {
addCriterion("company_id <", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLessThanOrEqualTo(String value) {
addCriterion("project_code <=", value, "projectCode");
public Criteria andCompanyIdLessThanOrEqualTo(String value) {
addCriterion("company_id <=", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLike(String value) {
addCriterion("project_code like", value, "projectCode");
public Criteria andCompanyIdLike(String value) {
addCriterion("company_id like", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotLike(String value) {
addCriterion("project_code not like", value, "projectCode");
public Criteria andCompanyIdNotLike(String value) {
addCriterion("company_id not like", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeIn(List<String> values) {
addCriterion("project_code in", values, "projectCode");
public Criteria andCompanyIdIn(List<String> values) {
addCriterion("company_id in", values, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotIn(List<String> values) {
addCriterion("project_code not in", values, "projectCode");
public Criteria andCompanyIdNotIn(List<String> values) {
addCriterion("company_id not in", values, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeBetween(String value1, String value2) {
addCriterion("project_code between", value1, value2, "projectCode");
public Criteria andCompanyIdBetween(String value1, String value2) {
addCriterion("company_id between", value1, value2, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotBetween(String value1, String value2) {
addCriterion("project_code not between", value1, value2, "projectCode");
public Criteria andCompanyIdNotBetween(String value1, String value2) {
addCriterion("company_id not between", value1, value2, "companyId");
return (Criteria) this;
}

View File

@ -20,9 +20,9 @@ public class PaperUserQuestion implements Serializable {
private Long puId;
/**
* 项目code
* 组织id
*/
private String projectCode;
private String companyId;
/**
* 试题类型1-理论题2-实训题

View File

@ -244,73 +244,73 @@ public class PaperUserQuestionExample {
return (Criteria) this;
}
public Criteria andProjectCodeIsNull() {
addCriterion("project_code is null");
public Criteria andCompanyIdIsNull() {
addCriterion("company_id is null");
return (Criteria) this;
}
public Criteria andProjectCodeIsNotNull() {
addCriterion("project_code is not null");
public Criteria andCompanyIdIsNotNull() {
addCriterion("company_id is not null");
return (Criteria) this;
}
public Criteria andProjectCodeEqualTo(String value) {
addCriterion("project_code =", value, "projectCode");
public Criteria andCompanyIdEqualTo(String value) {
addCriterion("company_id =", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotEqualTo(String value) {
addCriterion("project_code <>", value, "projectCode");
public Criteria andCompanyIdNotEqualTo(String value) {
addCriterion("company_id <>", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeGreaterThan(String value) {
addCriterion("project_code >", value, "projectCode");
public Criteria andCompanyIdGreaterThan(String value) {
addCriterion("company_id >", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeGreaterThanOrEqualTo(String value) {
addCriterion("project_code >=", value, "projectCode");
public Criteria andCompanyIdGreaterThanOrEqualTo(String value) {
addCriterion("company_id >=", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLessThan(String value) {
addCriterion("project_code <", value, "projectCode");
public Criteria andCompanyIdLessThan(String value) {
addCriterion("company_id <", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLessThanOrEqualTo(String value) {
addCriterion("project_code <=", value, "projectCode");
public Criteria andCompanyIdLessThanOrEqualTo(String value) {
addCriterion("company_id <=", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLike(String value) {
addCriterion("project_code like", value, "projectCode");
public Criteria andCompanyIdLike(String value) {
addCriterion("company_id like", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotLike(String value) {
addCriterion("project_code not like", value, "projectCode");
public Criteria andCompanyIdNotLike(String value) {
addCriterion("company_id not like", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeIn(List<String> values) {
addCriterion("project_code in", values, "projectCode");
public Criteria andCompanyIdIn(List<String> values) {
addCriterion("company_id in", values, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotIn(List<String> values) {
addCriterion("project_code not in", values, "projectCode");
public Criteria andCompanyIdNotIn(List<String> values) {
addCriterion("company_id not in", values, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeBetween(String value1, String value2) {
addCriterion("project_code between", value1, value2, "projectCode");
public Criteria andCompanyIdBetween(String value1, String value2) {
addCriterion("company_id between", value1, value2, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotBetween(String value1, String value2) {
addCriterion("project_code not between", value1, value2, "projectCode");
public Criteria andCompanyIdNotBetween(String value1, String value2) {
addCriterion("company_id not between", value1, value2, "companyId");
return (Criteria) this;
}

View File

@ -37,12 +37,12 @@ public class PaperCompositionService {
@Transactional(rollbackFor = Exception.class)
public CreatePaperCompositionRspVo createPaperComposition(CreatePaperCompositionReqVo req, AccountVO user) {
//根据项目和名称来查如果存在则结束
List<PaperComposition> pcList = this.findCompositionByProjectAndName(req.getProjectCode(), req.getName());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(CollectionUtils.isEmpty(pcList), "试卷定义已经存在:projectCode=" + req.getProjectCode() + " name=" + req.getName());
List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getCompanyId(), req.getName());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(CollectionUtils.isEmpty(pcList), "试卷定义已经存在:companyId=" + req.getCompanyId() + " name=" + req.getName());
//
PaperComposition newPc = new PaperComposition();
newPc.setName(req.getName());
newPc.setProjectCode(req.getProjectCode());
newPc.setCompanyId(req.getCompanyId());
newPc.setProfile(req.getProfile());
newPc.setCreateTime(LocalDateTime.now());
newPc.setUpdateTime(LocalDateTime.now());
@ -51,14 +51,14 @@ public class PaperCompositionService {
int newRt = compositionDAO.insertSelective(newPc);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(newRt > 0, "存储试卷定义失败");
//
pcList = this.findCompositionByProjectAndName(req.getProjectCode(), req.getName());
pcList = this.findCompositionByCompanyIdAndName(req.getCompanyId(), req.getName());
newPc = pcList.get(0);
//
CreatePaperCompositionRspVo rsp = new CreatePaperCompositionRspVo();
rsp.setId(newPc.getId());
rsp.setName(newPc.getName());
rsp.setProfile(newPc.getProfile());
rsp.setProjectCode(newPc.getProjectCode());
rsp.setCompanyId(newPc.getCompanyId());
return rsp;
}
@ -70,17 +70,17 @@ public class PaperCompositionService {
PaperComposition curPc = compositionDAO.selectByPrimaryKey(req.getId());
assertPaperCompositionCanModify(curPc);
//
List<PaperComposition> pcList = this.findCompositionByProjectAndName(req.getProjectCode(), req.getName());
List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getCompanyId(), req.getName());
if (!CollectionUtils.isEmpty(pcList)) {
boolean exist = pcList.stream().anyMatch(c -> {
return c.getId().compareTo(curPc.getId()) != 0;
});
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(exist, "试卷定义已经存在:projectCode=" + req.getProjectCode() + " name=" + req.getName());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(exist, "试卷定义已经存在:companyId=" + req.getCompanyId() + " name=" + req.getName());
}
//
curPc.setName(req.getName());
curPc.setProfile(req.getProfile());
curPc.setProjectCode(req.getProjectCode());
curPc.setCompanyId(req.getCompanyId());
curPc.setUpdateTime(LocalDateTime.now());
compositionDAO.updateByPrimaryKeySelective(curPc);
}
@ -193,11 +193,11 @@ public class PaperCompositionService {
pcExCriteria.andNameEqualTo(req.getName());
}
}
if (null != req.getProjectCode()) {
if (null != req.getCompanyId()) {
if (req.getProjectCodeLike()) {
pcExCriteria.andProjectCodeLike(req.getProjectCode());
pcExCriteria.andCompanyIdLike(String.format("%%%s%%",req.getCompanyId()));
} else {
pcExCriteria.andProjectCodeEqualTo(req.getProjectCode());
pcExCriteria.andCompanyIdEqualTo(req.getCompanyId());
}
}
if (null != req.getProfile()) {
@ -272,9 +272,9 @@ public class PaperCompositionService {
* 根据试卷蓝图的项目和名称查找项目
*/
@Transactional(readOnly = true)
public List<PaperComposition> findCompositionByProjectAndName(String projectCode, String name) {
public List<PaperComposition> findCompositionByCompanyIdAndName(String companyId, String name) {
PaperCompositionExample example = new PaperCompositionExample();
example.createCriteria().andProjectCodeEqualTo(projectCode).andNameEqualTo(name);
example.createCriteria().andCompanyIdEqualTo(companyId).andNameEqualTo(name);
List<PaperComposition> list = compositionDAO.selectByExample(example);
return list;
}

View File

@ -11,6 +11,7 @@ import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
import club.joylink.rtss.entity.training2.PublishedTraining2;
import club.joylink.rtss.entity.training2.PublishedTraining2Example;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.paper.CreatePaperRspVo;
import club.joylink.rtss.vo.paper.PaperCompositionState;
@ -67,14 +68,14 @@ public class PaperUserCreateService {
List<PaperRule> ruleList = compositionService.findRuleByPcId(pcId);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertCollectionNotEmpty(ruleList, "试卷定义没有规则定义无法生成用户试卷pcId = " + pcId);
//
String projectCode = composition.getProjectCode();
String companyId = composition.getCompanyId();
// 标记封存的试卷蓝图已使用
compositionService.usePaperComposition(pcId);
// 创建用户试卷
PaperUser paper = new PaperUser();
paper.setUserId(user.getId());
paper.setPcId(pcId);
paper.setProjectCode(projectCode);
paper.setCompanyId(companyId);
paper.setCreateTime(LocalDateTime.now());
paperUserDAO.insertSelective(paper);
paper = paperUserService.findByUserIdAndPcId(user.getId(), pcId);
@ -83,7 +84,7 @@ public class PaperUserCreateService {
//
CreatePaperRspVo rsp = new CreatePaperRspVo();
rsp.setPaperName(composition.getName());
rsp.setProjectCode(projectCode);
rsp.setCompanyId(companyId);
rsp.setId(paper.getId());
return rsp;
}
@ -99,7 +100,7 @@ public class PaperUserCreateService {
this.dispatcherCommonQuestion(pu, pc, rule);
break;
case Training:
this.dispatcherTrainingQuestion(pu,pc,rule);
this.dispatcherTrainingQuestion(pu, pc, rule);
break;
}
});
@ -115,7 +116,7 @@ public class PaperUserCreateService {
//符合条件的题目数目
long count = questionDAO.countByExample(questionExample);
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(count >= qSum, "符合条件的理论题数目过少pcId = " + pc.getId() + " pcName = " + pc.getName() + " projectCode = " + pc.getProjectCode() + " ruleType = " + subType.name() + " ruleSum = " + qSum);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(count >= qSum, "符合条件的理论题数目过少pcId = " + pc.getId() + " pcName = " + pc.getName() + " companyId = " + pc.getCompanyId() + " ruleType = " + subType.name() + " ruleSum = " + qSum);
//引入随机数
//每页记录数
final int pageSize = 5;
@ -154,7 +155,7 @@ public class PaperUserCreateService {
PaperUserQuestion puq = new PaperUserQuestion();
puq.setState(PaperQuestionState.Undo.getValue());
puq.setPuId(pu.getId());
puq.setProjectCode(pc.getProjectCode());
puq.setCompanyId(pc.getCompanyId());
puq.setType(PaperQType.GroupType.getItem(rule.getType()).getValue());
puq.setQuestionId(q.getId());
paperUserQuestionDAO.insertSelective(puq);
@ -171,7 +172,7 @@ public class PaperUserCreateService {
//符合条件的题目数目
long count = trainingDAO.countByExample(questionExample);
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(count >= qSum, "符合条件的实训题数目过少pcId = " + pc.getId() + " pcName = " + pc.getName() + " projectCode = " + pc.getProjectCode() + " ruleType = " + subType.name() + " ruleSum = " + qSum);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(count >= qSum, "符合条件的实训题数目过少pcId = " + pc.getId() + " pcName = " + pc.getName() + " companyId = " + pc.getCompanyId() + " ruleType = " + subType.name() + " ruleSum = " + qSum);
//引入随机数
//每页记录数
final int pageSize = 5;
@ -210,18 +211,19 @@ public class PaperUserCreateService {
PaperUserQuestion puq = new PaperUserQuestion();
puq.setState(PaperQuestionState.Undo.getValue());
puq.setPuId(pu.getId());
puq.setProjectCode(pc.getProjectCode());
puq.setCompanyId(pc.getCompanyId());
puq.setType(PaperQType.GroupType.getItem(rule.getType()).getValue());
puq.setQuestionId(q.getId());
paperUserQuestionDAO.insertSelective(puq);
});
}
/**
* 生成根据tag查询的条件
*/
private PublishedTraining2Example trainingQuestionExample(PaperUser pu, PaperComposition pc, PaperRule rule, Boolean isGreaterThan, Long id) {
String tags = rule.getTags();//规则标签逗号分隔
String[] tagArray = null != tags && tags.length() > 0 ? tags.split(",") : null;
String tags = rule.getTags();//规则标签list json
List<String> tagArray = null != tags && tags.length() > 0 ? JsonUtils.readCollection(tags, ArrayList.class, String.class) : null;
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
//
PublishedTraining2Example questionExample = new PublishedTraining2Example();
@ -248,17 +250,18 @@ public class PaperUserCreateService {
}
return questionExample;
}
/**
* 生成根据tag查询的条件
*/
private PaperQuestionExample commonQuestionExample(PaperUser pu, PaperComposition pc, PaperRule rule, Boolean isGreaterThan, Long id) {
String tags = rule.getTags();//规则标签逗号分隔
String[] tagArray = null != tags && tags.length() > 0 ? tags.split(",") : null;
String tags = rule.getTags();//规则标签list json
List<String> tagArray = null != tags && tags.length() > 0 ? JsonUtils.readCollection(tags, ArrayList.class, String.class) : null;
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
//
PaperQuestionExample questionExample = new PaperQuestionExample();
if (null == tagArray) {
PaperQuestionExample.Criteria c = questionExample.createCriteria().andProjectCodeEqualTo(pc.getProjectCode()).andTypeEqualTo(this.paperUserService.getPaperQuestionType(subType)).andIsDelEqualTo(0);
PaperQuestionExample.Criteria c = questionExample.createCriteria().andProjectCodeEqualTo(pc.getCompanyId()).andTypeEqualTo(this.paperUserService.getPaperQuestionType(subType)).andIsDelEqualTo(0);
if (null != isGreaterThan && null != id) {
if (isGreaterThan) {
c.andIdGreaterThan(id);
@ -268,7 +271,7 @@ public class PaperUserCreateService {
}
} else {
for (String tag : tagArray) {
PaperQuestionExample.Criteria c = questionExample.or().andProjectCodeEqualTo(pc.getProjectCode()).andTypeEqualTo(this.paperUserService.getPaperQuestionType(subType)).andIsDelEqualTo(0).andRaceLableLike(String.format("%%%s%%", tag));
PaperQuestionExample.Criteria c = questionExample.or().andProjectCodeEqualTo(pc.getCompanyId()).andTypeEqualTo(this.paperUserService.getPaperQuestionType(subType)).andIsDelEqualTo(0).andRaceLableLike(String.format("%%%s%%", tag));
if (null != isGreaterThan && null != id) {
if (isGreaterThan) {
c.andIdGreaterThan(id);

View File

@ -128,7 +128,7 @@ public class PaperUserService {
PaperSubmitRspVo rsp = new PaperSubmitRspVo();
rsp.setPuId(puId);
rsp.setName(composition.getName());
rsp.setProjectCode(composition.getProjectCode());
rsp.setCompanyId(composition.getCompanyId());
rsp.setDuration(paperTime);
rsp.setScore(scoreCommon + scoreTraining);
rsp.setCommonScore(scoreCommon);

View File

@ -18,8 +18,8 @@ public class CreatePaperCompositionReqVo {
private String profile;
/**
* 项目code
* 组织id
*/
@NotNull
private String projectCode;
private String companyId;
}

View File

@ -22,7 +22,7 @@ public class CreatePaperCompositionRspVo {
private String profile;
/**
* 项目code
* 组织id
*/
private String projectCode;
private String companyId;
}

View File

@ -18,9 +18,9 @@ public class CreatePaperRspVo {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 项目code
* 组织id
*/
private String projectCode;
private String companyId;
/**
* 试卷名称
*/

View File

@ -5,6 +5,8 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
@Data
public class CreatePaperRuleReqVo {
@ -28,7 +30,7 @@ public class CreatePaperRuleReqVo {
/**
* 筛选题目的标签即根据标签来筛选题目
*/
private String tags;
private List<String> tags;
/**
* 该类型题目数量

View File

@ -32,10 +32,10 @@ public class FindPaperCompositionPageReqVo extends PageQueryVO {
*/
private Boolean nameLike = true;
/**
* 项目code<br>
* 组织id<br>
* 选填<br>
*/
private String projectCode;
private String companyId;
/**
* 项目code--是否模糊查询,默认false<br>
* 选填<br>

View File

@ -25,7 +25,7 @@ public class PaperCompositionBasicVo {
private String profile;
/**
* 项目code
* 组织id
*/
private String projectCode;
private String companyId;
}

View File

@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
public class PaperRuleVo {
@ -35,7 +36,7 @@ public class PaperRuleVo {
/**
* 筛选题目的标签即根据标签来筛选题目
*/
private String tags;
private List<String> tags;
/**
* 该类型题目数量

View File

@ -23,9 +23,9 @@ public class PaperSubmitRspVo {
*/
private String name;
/**
* 项目code
* 组织id
*/
private String projectCode;
private String companyId;
/**
* 及格分
*/

View File

@ -1,40 +1,54 @@
package club.joylink.rtss.vo.paper.convertor;
import club.joylink.rtss.entity.paper.PaperRule;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.paper.CreatePaperRuleReqVo;
import club.joylink.rtss.vo.paper.PaperQType;
import club.joylink.rtss.vo.paper.PaperRuleVo;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
public class PaperRuleConvertor {
public static PaperRuleVo convert(PaperRule from){
public static PaperRuleVo convert(PaperRule from) {
PaperRuleVo to = new PaperRuleVo();
to.setId(from.getId());
to.setPcId(from.getPcId());
to.setType(PaperQType.GroupType.getItem(from.getType()));
to.setSubtype(PaperQType.SubType.getItem(from.getSubtype()));
to.setTags(from.getTags());
to.setTags(JsonUtils.readCollection(from.getTags(),ArrayList.class,String.class));
to.setScore(from.getScore());
to.setSum(from.getSum());
return to;
}
public static PaperRule convert(PaperRuleVo from){
public static PaperRule convert(PaperRuleVo from) {
PaperRule to = new PaperRule();
to.setId(from.getId());
to.setPcId(from.getPcId());
to.setType(from.getType().getValue());
to.setSubtype(from.getSubtype().getValue());
to.setTags(from.getTags());
if (!CollectionUtils.isEmpty(from.getTags())) {
to.setTags(JsonUtils.writeValueAsString(from.getTags()));
} else {
to.setTags(JsonUtils.writeValueAsString(new ArrayList<String>()));
}
to.setScore(from.getScore());
to.setSum(from.getSum());
return to;
}
public static PaperRule convert(CreatePaperRuleReqVo from){
public static PaperRule convert(CreatePaperRuleReqVo from) {
PaperRule to = new PaperRule();
to.setPcId(from.getPcId());
to.setType(from.getType().getValue());
to.setSubtype(from.getSubtype().getValue());
to.setTags(from.getTags());
if (!CollectionUtils.isEmpty(from.getTags())) {
to.setTags(JsonUtils.writeValueAsString(from.getTags()));
} else {
to.setTags(JsonUtils.writeValueAsString(new ArrayList<String>()));
}
to.setScore(from.getScore());
to.setSum(from.getSum());
return to;

View File

@ -5,7 +5,7 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="profile" jdbcType="VARCHAR" property="profile" />
<result column="project_code" jdbcType="VARCHAR" property="projectCode" />
<result column="company_id" jdbcType="VARCHAR" property="companyId" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="valid_duration" jdbcType="INTEGER" property="validDuration" />
@ -74,7 +74,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, profile, project_code, start_time, end_time, valid_duration, pass_score,
id, `name`, profile, company_id, start_time, end_time, valid_duration, pass_score,
creator_id, create_time, update_time, `state`
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperCompositionExample" resultMap="BaseResultMap">
@ -100,7 +100,7 @@
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
select
<include refid="Base_Column_List" />
from paper_composition
where id = #{id,jdbcType=BIGINT}
@ -116,16 +116,16 @@
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.PaperComposition">
insert into paper_composition (id, `name`, profile,
project_code, start_time, end_time,
valid_duration, pass_score, creator_id,
create_time, update_time, `state`
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{profile,jdbcType=VARCHAR},
#{projectCode,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
#{validDuration,jdbcType=INTEGER}, #{passScore,jdbcType=INTEGER}, #{creatorId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{state,jdbcType=INTEGER}
)
insert into paper_composition (id, `name`, profile,
company_id, start_time, end_time,
valid_duration, pass_score, creator_id,
create_time, update_time, `state`
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{profile,jdbcType=VARCHAR},
#{companyId,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
#{validDuration,jdbcType=INTEGER}, #{passScore,jdbcType=INTEGER}, #{creatorId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{state,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.paper.PaperComposition">
insert into paper_composition
@ -139,8 +139,8 @@
<if test="profile != null">
profile,
</if>
<if test="projectCode != null">
project_code,
<if test="companyId != null">
company_id,
</if>
<if test="startTime != null">
start_time,
@ -177,8 +177,8 @@
<if test="profile != null">
#{profile,jdbcType=VARCHAR},
</if>
<if test="projectCode != null">
#{projectCode,jdbcType=VARCHAR},
<if test="companyId != null">
#{companyId,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP},
@ -224,8 +224,8 @@
<if test="record.profile != null">
profile = #{record.profile,jdbcType=VARCHAR},
</if>
<if test="record.projectCode != null">
project_code = #{record.projectCode,jdbcType=VARCHAR},
<if test="record.companyId != null">
company_id = #{record.companyId,jdbcType=VARCHAR},
</if>
<if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=TIMESTAMP},
@ -259,17 +259,17 @@
<update id="updateByExample" parameterType="map">
update paper_composition
set id = #{record.id,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR},
profile = #{record.profile,jdbcType=VARCHAR},
project_code = #{record.projectCode,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
valid_duration = #{record.validDuration,jdbcType=INTEGER},
pass_score = #{record.passScore,jdbcType=INTEGER},
creator_id = #{record.creatorId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
`state` = #{record.state,jdbcType=INTEGER}
`name` = #{record.name,jdbcType=VARCHAR},
profile = #{record.profile,jdbcType=VARCHAR},
company_id = #{record.companyId,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
valid_duration = #{record.validDuration,jdbcType=INTEGER},
pass_score = #{record.passScore,jdbcType=INTEGER},
creator_id = #{record.creatorId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
`state` = #{record.state,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -283,8 +283,8 @@
<if test="profile != null">
profile = #{profile,jdbcType=VARCHAR},
</if>
<if test="projectCode != null">
project_code = #{projectCode,jdbcType=VARCHAR},
<if test="companyId != null">
company_id = #{companyId,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIMESTAMP},
@ -316,16 +316,16 @@
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.paper.PaperComposition">
update paper_composition
set `name` = #{name,jdbcType=VARCHAR},
profile = #{profile,jdbcType=VARCHAR},
project_code = #{projectCode,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
valid_duration = #{validDuration,jdbcType=INTEGER},
pass_score = #{passScore,jdbcType=INTEGER},
creator_id = #{creatorId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
`state` = #{state,jdbcType=INTEGER}
profile = #{profile,jdbcType=VARCHAR},
company_id = #{companyId,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
valid_duration = #{validDuration,jdbcType=INTEGER},
pass_score = #{passScore,jdbcType=INTEGER},
creator_id = #{creatorId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
`state` = #{state,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
</mapper>

View File

@ -5,7 +5,7 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="pc_id" jdbcType="BIGINT" property="pcId" />
<result column="project_code" jdbcType="VARCHAR" property="projectCode" />
<result column="company_id" jdbcType="VARCHAR" property="companyId" />
<result column="score" jdbcType="INTEGER" property="score" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
@ -71,7 +71,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, user_id, pc_id, project_code, score, start_time, end_time, cause, create_time
id, user_id, pc_id, company_id, score, start_time, end_time, cause, create_time
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperUserExample" resultMap="BaseResultMap">
select
@ -113,11 +113,11 @@
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.PaperUser">
insert into paper_user (id, user_id, pc_id,
project_code, score, start_time,
company_id, score, start_time,
end_time, cause, create_time
)
values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{pcId,jdbcType=BIGINT},
#{projectCode,jdbcType=VARCHAR}, #{score,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP},
#{companyId,jdbcType=VARCHAR}, #{score,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP},
#{endTime,jdbcType=TIMESTAMP}, #{cause,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
)
</insert>
@ -133,8 +133,8 @@
<if test="pcId != null">
pc_id,
</if>
<if test="projectCode != null">
project_code,
<if test="companyId != null">
company_id,
</if>
<if test="score != null">
score,
@ -162,8 +162,8 @@
<if test="pcId != null">
#{pcId,jdbcType=BIGINT},
</if>
<if test="projectCode != null">
#{projectCode,jdbcType=VARCHAR},
<if test="companyId != null">
#{companyId,jdbcType=VARCHAR},
</if>
<if test="score != null">
#{score,jdbcType=INTEGER},
@ -200,8 +200,8 @@
<if test="record.pcId != null">
pc_id = #{record.pcId,jdbcType=BIGINT},
</if>
<if test="record.projectCode != null">
project_code = #{record.projectCode,jdbcType=VARCHAR},
<if test="record.companyId != null">
company_id = #{record.companyId,jdbcType=VARCHAR},
</if>
<if test="record.score != null">
score = #{record.score,jdbcType=INTEGER},
@ -228,7 +228,7 @@
set id = #{record.id,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
pc_id = #{record.pcId,jdbcType=BIGINT},
project_code = #{record.projectCode,jdbcType=VARCHAR},
company_id = #{record.companyId,jdbcType=VARCHAR},
score = #{record.score,jdbcType=INTEGER},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
@ -247,8 +247,8 @@
<if test="pcId != null">
pc_id = #{pcId,jdbcType=BIGINT},
</if>
<if test="projectCode != null">
project_code = #{projectCode,jdbcType=VARCHAR},
<if test="companyId != null">
company_id = #{companyId,jdbcType=VARCHAR},
</if>
<if test="score != null">
score = #{score,jdbcType=INTEGER},
@ -272,7 +272,7 @@
update paper_user
set user_id = #{userId,jdbcType=BIGINT},
pc_id = #{pcId,jdbcType=BIGINT},
project_code = #{projectCode,jdbcType=VARCHAR},
company_id = #{companyId,jdbcType=VARCHAR},
score = #{score,jdbcType=INTEGER},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},

View File

@ -4,7 +4,7 @@
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.paper.PaperUserQuestion">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="pu_id" jdbcType="BIGINT" property="puId" />
<result column="project_code" jdbcType="VARCHAR" property="projectCode" />
<result column="company_id" jdbcType="VARCHAR" property="companyId" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="question_id" jdbcType="BIGINT" property="questionId" />
<result column="state" jdbcType="INTEGER" property="state" />
@ -68,7 +68,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, pu_id, project_code, `type`, question_id, `state`
id, pu_id, company_id, `type`, question_id, `state`
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestionExample" resultMap="BaseResultMap">
select
@ -109,10 +109,10 @@
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion">
insert into paper_user_question (id, pu_id, project_code,
insert into paper_user_question (id, pu_id, company_id,
`type`, question_id, `state`
)
values (#{id,jdbcType=BIGINT}, #{puId,jdbcType=BIGINT}, #{projectCode,jdbcType=VARCHAR},
values (#{id,jdbcType=BIGINT}, #{puId,jdbcType=BIGINT}, #{companyId,jdbcType=VARCHAR},
#{type,jdbcType=INTEGER}, #{questionId,jdbcType=BIGINT}, #{state,jdbcType=INTEGER}
)
</insert>
@ -125,8 +125,8 @@
<if test="puId != null">
pu_id,
</if>
<if test="projectCode != null">
project_code,
<if test="companyId != null">
company_id,
</if>
<if test="type != null">
`type`,
@ -145,8 +145,8 @@
<if test="puId != null">
#{puId,jdbcType=BIGINT},
</if>
<if test="projectCode != null">
#{projectCode,jdbcType=VARCHAR},
<if test="companyId != null">
#{companyId,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=INTEGER},
@ -174,8 +174,8 @@
<if test="record.puId != null">
pu_id = #{record.puId,jdbcType=BIGINT},
</if>
<if test="record.projectCode != null">
project_code = #{record.projectCode,jdbcType=VARCHAR},
<if test="record.companyId != null">
company_id = #{record.companyId,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=INTEGER},
@ -195,7 +195,7 @@
update paper_user_question
set id = #{record.id,jdbcType=BIGINT},
pu_id = #{record.puId,jdbcType=BIGINT},
project_code = #{record.projectCode,jdbcType=VARCHAR},
company_id = #{record.companyId,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=INTEGER},
question_id = #{record.questionId,jdbcType=BIGINT},
`state` = #{record.state,jdbcType=INTEGER}
@ -209,8 +209,8 @@
<if test="puId != null">
pu_id = #{puId,jdbcType=BIGINT},
</if>
<if test="projectCode != null">
project_code = #{projectCode,jdbcType=VARCHAR},
<if test="companyId != null">
company_id = #{companyId,jdbcType=VARCHAR},
</if>
<if test="type != null">
`type` = #{type,jdbcType=INTEGER},
@ -227,7 +227,7 @@
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion">
update paper_user_question
set pu_id = #{puId,jdbcType=BIGINT},
project_code = #{projectCode,jdbcType=VARCHAR},
company_id = #{companyId,jdbcType=VARCHAR},
`type` = #{type,jdbcType=INTEGER},
question_id = #{questionId,jdbcType=BIGINT},
`state` = #{state,jdbcType=INTEGER}