Merge branch 'test'

This commit is contained in:
thesai 2024-03-08 11:32:51 +08:00
commit 727ddd48ac
28 changed files with 3971 additions and 915 deletions

@ -1 +1 @@
Subproject commit e86eac94a2db155b79d09bbe4fb145a8ebc69014
Subproject commit 2aedc24640de82379bc4ebb48e428fd57cfc5e77

View File

@ -2,15 +2,18 @@ package club.joylink.rtss.controller.racetr;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.paper.PagerQuestionService;
import club.joylink.rtss.services.race.RacePaperService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperCreateVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperDetailVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperMenuVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperModuleVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperVO;
import club.joylink.rtss.vo.race.RacePaperQueryVO;
import club.joylink.rtss.vo.race.RaceTask.RacePaperSingleModuleGroupTask;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
@ -32,6 +35,15 @@ public class RacePaperController {
@Autowired
private RacePaperService racePaperService;
@Autowired
private PagerQuestionService questionService;
@GetMapping("/questions")
public List<Long> queryQuestionFromPBank() {
return this.questionService.queryAllDefaultOrgPaperIds();
}
/**
* 创建试卷
*/
@ -61,6 +73,17 @@ public class RacePaperController {
return racePaperService.pageQuery(queryVO);
}
/**
* 获取赛季试卷菜单
*
* @param queryVO
* @return
*/
@GetMapping("/menu")
public RacePaperMenuVO pageMenu(RacePaperQueryVO queryVO) {
return this.racePaperService.pageMenuQuery(queryVO);
}
/**
* 试卷配置
*

View File

@ -7,7 +7,10 @@ import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeasonCreateVO;
import club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeasonVO;
import club.joylink.rtss.vo.race.RaceSeasonQueryVO;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@ -50,6 +53,30 @@ public class RaceSeasonController {
this.raceSeasonService.update(id, dto, user);
}
/**
* 编辑html内容
*
* @param id
* @param user
*/
@PostMapping("/{id}/html")
public void updateHtmlContent(@PathVariable("id") Long id, @RequestBody Map<String, String> contentMap, @RequestAttribute AccountVO user) {
String content = contentMap.get("htmlContent");
this.raceSeasonService.updateHtmlContent(id, content, user);
}
/**
* 查找对应的html content
*
* @param id
* @return
*/
@GetMapping("/{id}/html")
public Map<String, String> queryHtmlContent(@PathVariable("id") Long id) {
String html = this.raceSeasonService.queryHtmlContent(id);
return Map.of("html", StringUtils.hasText(html) ? html : "");
}
/**
* 查找

View File

@ -14,8 +14,9 @@ import java.util.List;
@Mapper
@Repository
public interface PaperQuestionDAO {
@Select("<script>" +
"select * from rts_paper_question where 1 = 1 " +
@Select("<script>" +
"select * from rts_paper_question where 1 = 1 " +
// "<choose>" +
// "<when test=\"projectCode == '"+ Project.DEFAULT_PROJECT_CODE +"'\">"+
// " and project_code is null" +
@ -24,48 +25,54 @@ public interface PaperQuestionDAO {
// " and project_code = #{projectCode} "+
// " </otherwise>" +
// "</choose>" +
" and org_id = #{companyId,jdbcType=BIGINT} " +
" and org_id = #{companyId,jdbcType=BIGINT} " +
// "<if test=\"companyIdList != null and companyIdList.size > 0\">"+
// "<foreach collection=\"companyIdList\" open=\" and company_id in (\" close=\")\" item=\"d\" separator=\",\">"+
// " #{d} "+
// "</foreach></if>"+
" and is_del= #{isDelete,jdbcType=INTEGER} " +
"<if test=\"types != null and types.size > 0\">"+
"<foreach collection=\"types\" open=\" and type in (\" close=\")\" item=\"d\" separator=\",\">"+
" #{d} "+
"</foreach></if>"+
"<if test=\"lable != null and lable.size > 0\"> " +
" <foreach collection=\"lable\" open=\" and (\" close=\")\" item=\"d\" separator=\" or \"> "+
" find_in_set(#{d},race_lable) > 0 "+
" </foreach>" +
"</if>" +
"</script>")
List<PaperQuestionWithBLOBs> findFromAndRaceLable(Long companyId,int isDelete, List<String> lable, List<String> types);
long countByExample(PaperQuestionExample example);
" and is_del= #{isDelete,jdbcType=INTEGER} " +
"<if test=\"types != null and types.size > 0\">" +
"<foreach collection=\"types\" open=\" and type in (\" close=\")\" item=\"d\" separator=\",\">" +
" #{d} " +
"</foreach></if>" +
"<if test=\"lable != null and lable.size > 0\"> " +
" <foreach collection=\"lable\" open=\" and (\" close=\")\" item=\"d\" separator=\" or \"> " +
" find_in_set(#{d},race_lable) > 0 " +
" </foreach>" +
"</if>" +
"</script>")
List<PaperQuestionWithBLOBs> findFromAndRaceLable(Long companyId, int isDelete, List<String> lable, List<String> types);
int deleteByExample(PaperQuestionExample example);
@Select("<script>" +
"select id from rts_paper_question where org_id = #{orgId} "
+ "</script>")
List<Long> findAllId(@Param("orgId") Long id);
int deleteByPrimaryKey(Long id);
long countByExample(PaperQuestionExample example);
int insert(PaperQuestionWithBLOBs record);
int deleteByExample(PaperQuestionExample example);
int insertSelective(PaperQuestionWithBLOBs record);
int deleteByPrimaryKey(Long id);
List<PaperQuestionWithBLOBs> selectByExampleWithBLOBs(PaperQuestionExample example);
int insert(PaperQuestionWithBLOBs record);
List<PaperQuestion> selectByExample(PaperQuestionExample example);
int insertSelective(PaperQuestionWithBLOBs record);
PaperQuestionWithBLOBs selectByPrimaryKey(Long id);
List<PaperQuestionWithBLOBs> selectByExampleWithBLOBs(PaperQuestionExample example);
int updateByExampleSelective(@Param("record") PaperQuestionWithBLOBs record, @Param("example") PaperQuestionExample example);
List<PaperQuestion> selectByExample(PaperQuestionExample example);
int updateByExampleWithBLOBs(@Param("record") PaperQuestionWithBLOBs record, @Param("example") PaperQuestionExample example);
PaperQuestionWithBLOBs selectByPrimaryKey(Long id);
int updateByExample(@Param("record") PaperQuestion record, @Param("example") PaperQuestionExample example);
int updateByExampleSelective(@Param("record") PaperQuestionWithBLOBs record, @Param("example") PaperQuestionExample example);
int updateByPrimaryKeySelective(PaperQuestionWithBLOBs record);
int updateByExampleWithBLOBs(@Param("record") PaperQuestionWithBLOBs record, @Param("example") PaperQuestionExample example);
int updateByPrimaryKeyWithBLOBs(PaperQuestionWithBLOBs record);
int updateByExample(@Param("record") PaperQuestion record, @Param("example") PaperQuestionExample example);
int updateByPrimaryKey(PaperQuestion record);
int updateByPrimaryKeySelective(PaperQuestionWithBLOBs record);
int updateByPrimaryKeyWithBLOBs(PaperQuestionWithBLOBs record);
int updateByPrimaryKey(PaperQuestion record);
}

View File

@ -19,7 +19,7 @@ import org.springframework.stereotype.Repository;
public interface RacetrPaperDAO extends MyBatisBaseDao<RacetrPaper, Long, RacetrPaperExample> {
@Select("<script>"
+ " select A.id,A.name,A.`desc`,A.season_id as seasonId ,B.code as seasonName,B.group"
+ " select A.id,A.name,A.`desc`,A.season_id as seasonId ,B.code as seasonName,B.group,B.term as seasonTerm"
+ " ,A.creator_id,A.create_time,A.updater_id,A.update_time,C.nickname as creatorName,D.nickname as updaterName "
+ " from racetr_paper A left join racetr_season B on A.season_id = B.id "
+ " left join sys_account C on A.creator_id = C.id "

View File

@ -3,6 +3,8 @@ package club.joylink.rtss.dao.racetr;
import club.joylink.rtss.dao.MyBatisBaseDao;
import club.joylink.rtss.entity.racetr.RacetrSeason;
import club.joylink.rtss.entity.racetr.RacetrSeasonExample;
import java.util.List;
import org.springframework.stereotype.Repository;
/**
@ -12,4 +14,5 @@ import org.springframework.stereotype.Repository;
@Repository
public interface RacetrSeasonDAO extends MyBatisBaseDao<RacetrSeason, Long, RacetrSeasonExample> {
List<RacetrSeason> selectByExampleWithBLOBs(RacetrSeasonExample example);
}

View File

@ -48,5 +48,10 @@ public class RacetrSeason implements Serializable {
*/
private LocalDateTime udpateTime;
/**
* html文本信息
*/
private String detailHtmlContent;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,19 @@
package club.joylink.rtss.exception;
import lombok.Getter;
@Getter
public enum RacetrExceptionAssert implements BusinessExceptionAssert {
publishSceneNotForce(12000, "发布重复的场景,是否强制替换"),
;
int code;
String message;
private RacetrExceptionAssert(int code, String message) {
this.code = code;
this.message = message;
}
}

View File

@ -15,91 +15,98 @@ import java.util.Collection;
import java.util.List;
public interface IOrgService {
OrgVO createTopOrg(TopOrgCreateVO topOrgCreateVO, AccountVO user);
List<OrgVO> queryAllTopOrg();
/**
* 查找默认组织
*
* @return
*/
Org findDefaultOrg();
PageVO<OrgVO> pagedQueryAllTopOrg(OrgQueryVO queryVO);
OrgVO createTopOrg(TopOrgCreateVO topOrgCreateVO, AccountVO user);
void confirmExist(Long orgId);
List<OrgVO> queryAllTopOrg();
OrgVO createCls(NonTopOrgCreateVO createVO, LoginUserInfoVO loginInfo);
PageVO<OrgVO> pagedQueryAllTopOrg(OrgQueryVO queryVO);
Org getEntity(long orgId);
void confirmExist(Long orgId);
Org findEntity(long orgId);
OrgVO createCls(NonTopOrgCreateVO createVO, LoginUserInfoVO loginInfo);
// TODO 20220922 将Project 修改为 String
Collection<Org> getEntities(String project, String status);
Org getEntity(long orgId);
// TODO 20220922 将Project 修改为 String
Collection<Org> findEntities(String project, String status);
Org findEntity(long orgId);
OrgVO updateOrg(Long id, OrgVO orgVO, AccountVO user);
// TODO 20220922 将Project 修改为 String
Collection<Org> getEntities(String project, String status);
/**
* 删除非顶级组织
*
* @param nonTopOrgId
*/
void deleteNonTopOrg(Long nonTopOrgId);
// TODO 20220922 将Project 修改为 String
Collection<Org> findEntities(String project, String status);
List<Org> findEntitiesByParentId(Long parentId, String orderBy, String status);
OrgVO updateOrg(Long id, OrgVO orgVO, AccountVO user);
/**
* 分页查询自己创建的班级
*/
PageVO<OrgVO> pagedQueryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo);
/**
* 删除非顶级组织
*
* @param nonTopOrgId
*/
void deleteNonTopOrg(Long nonTopOrgId);
/**
* 查询自己创建的班级
*/
List<OrgVO> queryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo);
List<Org> findEntitiesByParentId(Long parentId, String orderBy, String status);
/**
* 获取该组织所属的顶级组织
*/
Org getTopOrgEntity(Long orgId);
/**
* 分页查询自己创建的班级
*/
PageVO<OrgVO> pagedQueryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo);
List<Org> findEntities(List<Long> orgIds, String status);
/**
* 查询自己创建的班级
*/
List<OrgVO> queryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo);
/**
* 管理员分页查询组织
*/
Node<Object> adminQueryOrgTree(Long orgId);
/**
* 获取该组织所属的顶级组织
*/
Org getTopOrgEntity(Long orgId);
OrgVO get(Long id);
List<Org> findEntities(List<Long> orgIds, String status);
/**
* 查询这些考试关联的班级
*/
List<ExamDefinitionVO> queryByExamIds(List<Long> examIds, String status);
/**
* 管理员分页查询组织
*/
Node<Object> adminQueryOrgTree(Long orgId);
void confirmIsTopOrg(long id);
OrgVO get(Long id);
void confirmIsNonTopOrg(Long id);
/**
* 查询这些考试关联的班级
*/
List<ExamDefinitionVO> queryByExamIds(List<Long> examIds, String status);
List<Org> queryAllSubOrgs(Long orgId);
void confirmIsTopOrg(long id);
String getBindQrCode(long orgId, String project);
void confirmIsNonTopOrg(Long id);
/**
* 获取该用户所属的顶级组织
*/
Org getTopOrgOfUser(long userId);
List<Org> queryAllSubOrgs(Long orgId);
Org findTopOrgOfUser(long userId);
String getBindQrCode(long orgId, String project);
/**
* 查询该组织下的所有班级
* 目前组织结构仅有两级非顶级的就是班级
*/
List<OrgVO> listQueryCls(long topOrgId);
/**
* 获取该用户所属的顶级组织
*/
Org getTopOrgOfUser(long userId);
/**
* 查询组织信息可能返回null
*/
OrgVO query(Long id);
Org findTopOrgOfUser(long userId);
OrgVO getTopOrg(long topOrgId);
/**
* 查询该组织下的所有班级 目前组织结构仅有两级非顶级的就是班级
*/
List<OrgVO> listQueryCls(long topOrgId);
/**
* 查询组织信息可能返回null
*/
OrgVO query(Long id);
OrgVO getTopOrg(long topOrgId);
}

View File

@ -1,11 +1,13 @@
package club.joylink.rtss.services.org;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.dao.OrgDAO;
import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.ISysUserService;
import club.joylink.rtss.services.QRCodeManager;
import club.joylink.rtss.services.cache.ICacheService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.ExamDefinitionVO;
@ -14,6 +16,8 @@ import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.org.*;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -28,444 +32,470 @@ import java.util.stream.Collectors;
@Service
public class OrgService implements IOrgService {
@Autowired
private OrgDAO orgDAO;
@Autowired
private IOrgUserService iOrgUserService;
@Autowired
private OrgDAO orgDAO;
@Autowired
private ISysUserService iSysUserService;
@Autowired
private IOrgUserService iOrgUserService;
@Autowired
private QRCodeManager qrCodeManager;
@Autowired
private ISysUserService iSysUserService;
@Autowired
private IOrgProjectService orgProjectService;
@Autowired
private QRCodeManager qrCodeManager;
@Transactional
@Override
public OrgVO createTopOrg(TopOrgCreateVO topOrgCreateVO, AccountVO user) {
confirmNameUnique(null, topOrgCreateVO.getName());
/* 处理 */
Org entity = topOrgCreateVO.toDB();
entity.setId(null);
entity.setCreatorId(user.getId());
entity.setCreateTime(LocalDateTime.now());
entity.setStatus(BusinessConsts.Org.Status.VALID);
this.orgDAO.insert(entity);
entity.setRootId(entity.getId());
orgDAO.updateByPrimaryKey(entity);
// 20220929 增加
orgProjectService.save(entity.getId(), topOrgCreateVO.getProjectCodes(), user);
return new OrgVO(entity, topOrgCreateVO.getProjectCodes());
@Autowired
private IOrgProjectService orgProjectService;
@Autowired
private ICacheService cacheService;
@Override
public Org findDefaultOrg() {
String defName = String.format("%s-org-default", Project.DEFAULT.name());
Object obj = this.cacheService.get(defName);
if (Objects.nonNull(obj)) {
return (Org) obj;
}
/**
* 确认名称唯一
*/
private void confirmNameUnique(Long orgId, String name) {
//名称检查
OrgExample example = new OrgExample();
OrgExample.Criteria criteria = example.createCriteria().andNameEqualTo(name);
if (orgId != null) {
criteria.andIdNotEqualTo(orgId);
}
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(orgDAO.countByExample(example) == 0,
"名称重复");
OrgExample orgExample = new OrgExample();
orgExample.createCriteria().andProjectCodeEqualTo(Project.DEFAULT.name());
List<Org> orgs = this.orgDAO.selectByExample(orgExample);
if (!CollectionUtils.isEmpty(orgs)) {
Org org = orgs.get(0);
this.cacheService.putExpired(defName, org, 600, TimeUnit.SECONDS);
return org;
}
return null;
}
@Override
public List<OrgVO> queryAllTopOrg() {
OrgExample example = new OrgExample();
example.createCriteria().andParentIdIsNull();
List<Org> orgs = this.orgDAO.selectByExample(example);
List<Long> orgIds = orgs.stream().map(Org::getId).collect(Collectors.toList());
List<OrgProject> orgProjects = orgProjectService.queryOrgProjectListByOrgIds(orgIds);
return OrgVO.convert2VOList(orgs, orgProjects);
@Transactional
@Override
public OrgVO createTopOrg(TopOrgCreateVO topOrgCreateVO, AccountVO user) {
confirmNameUnique(null, topOrgCreateVO.getName());
/* 处理 */
Org entity = topOrgCreateVO.toDB();
entity.setId(null);
entity.setCreatorId(user.getId());
entity.setCreateTime(LocalDateTime.now());
entity.setStatus(BusinessConsts.Org.Status.VALID);
this.orgDAO.insert(entity);
entity.setRootId(entity.getId());
orgDAO.updateByPrimaryKey(entity);
// 20220929 增加
orgProjectService.save(entity.getId(), topOrgCreateVO.getProjectCodes(), user);
return new OrgVO(entity, topOrgCreateVO.getProjectCodes());
}
/**
* 确认名称唯一
*/
private void confirmNameUnique(Long orgId, String name) {
//名称检查
OrgExample example = new OrgExample();
OrgExample.Criteria criteria = example.createCriteria().andNameEqualTo(name);
if (orgId != null) {
criteria.andIdNotEqualTo(orgId);
}
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(orgDAO.countByExample(example) == 0,
"名称重复");
}
@Override
public PageVO<OrgVO> pagedQueryAllTopOrg(OrgQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
OrgExample example = new OrgExample();
OrgExample.Criteria criteria = example.createCriteria();
criteria.andParentIdIsNull().andStatusEqualTo(BusinessConsts.Org.Status.VALID);
if (StringUtils.hasText(queryVO.getName())) {
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
}
Page<Org> page = (Page<Org>) orgDAO.selectByExample(example);
List<Long> orgIds = page.getResult().stream().map(Org::getId).collect(Collectors.toList());
List<OrgProject> orgProjects = orgProjectService.queryOrgProjectListByOrgIds(orgIds);
List<OrgVO> voList = OrgVO.convert2VOList(page.getResult(), orgProjects);
return PageVO.convert(page, voList);
@Override
public List<OrgVO> queryAllTopOrg() {
OrgExample example = new OrgExample();
example.createCriteria().andParentIdIsNull();
List<Org> orgs = this.orgDAO.selectByExample(example);
List<Long> orgIds = orgs.stream().map(Org::getId).collect(Collectors.toList());
List<OrgProject> orgProjects = orgProjectService.queryOrgProjectListByOrgIds(orgIds);
return OrgVO.convert2VOList(orgs, orgProjects);
}
@Override
public PageVO<OrgVO> pagedQueryAllTopOrg(OrgQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
OrgExample example = new OrgExample();
OrgExample.Criteria criteria = example.createCriteria();
criteria.andParentIdIsNull().andStatusEqualTo(BusinessConsts.Org.Status.VALID);
if (StringUtils.hasText(queryVO.getName())) {
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
}
Page<Org> page = (Page<Org>) orgDAO.selectByExample(example);
List<Long> orgIds = page.getResult().stream().map(Org::getId).collect(Collectors.toList());
List<OrgProject> orgProjects = orgProjectService.queryOrgProjectListByOrgIds(orgIds);
List<OrgVO> voList = OrgVO.convert2VOList(page.getResult(), orgProjects);
return PageVO.convert(page, voList);
}
@Override
public void confirmExist(Long orgId) {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(orgDAO.selectByPrimaryKey(orgId),
String.format("id为[%s]的组织不存在", orgId));
@Override
public void confirmExist(Long orgId) {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(orgDAO.selectByPrimaryKey(orgId),
String.format("id为[%s]的组织不存在", orgId));
}
@Transactional
@Override
public OrgVO createCls(NonTopOrgCreateVO createVO, LoginUserInfoVO loginInfo) {
//检查
Long topOrgId = loginInfo.getTopOrgId();
Long userId = loginInfo.getAccountVO().getId();
iOrgUserService.confirmUserIsTheRoleInThisOrg(userId, topOrgId, BusinessConsts.OrgRole.Admin);
Org cls = createNonTopOrg(createVO.getName(), topOrgId, topOrgId, userId);
iOrgUserService.create(cls.getId(), userId, BusinessConsts.OrgRole.Teacher);
return new OrgVO(cls);
}
@Override
public Org getEntity(long orgId) {
Org org = orgDAO.selectByPrimaryKey(orgId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(org, String.format("id为[%s]的组织不存在", orgId));
return org;
}
@Override
public Org findEntity(long orgId) {
return orgDAO.selectByPrimaryKey(orgId);
}
@Override
public Collection<Org> getEntities(String project, String status) {
Collection<Org> orgs = findEntities(project, status);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(orgs, String.format("关联项目[%s]的组织不存在", project));
return orgs;
}
@Override
public Collection<Org> findEntities(@NonNull String project, String status) {
OrgExample example = new OrgExample();
OrgExample.Criteria criteria = example.createCriteria().andProjectCodeLike(String.format("%%%s%%", project));
if (StringUtils.hasText(status)) {
criteria.andStatusEqualTo(status);
}
return orgDAO.selectByExample(example);
}
@Transactional
@Override
public OrgVO createCls(NonTopOrgCreateVO createVO, LoginUserInfoVO loginInfo) {
//检查
Long topOrgId = loginInfo.getTopOrgId();
Long userId = loginInfo.getAccountVO().getId();
iOrgUserService.confirmUserIsTheRoleInThisOrg(userId, topOrgId, BusinessConsts.OrgRole.Admin);
Org cls = createNonTopOrg(createVO.getName(), topOrgId, topOrgId, userId);
iOrgUserService.create(cls.getId(), userId, BusinessConsts.OrgRole.Teacher);
return new OrgVO(cls);
}
@Override
public Org getEntity(long orgId) {
Org org = orgDAO.selectByPrimaryKey(orgId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(org, String.format("id为[%s]的组织不存在", orgId));
return org;
}
@Override
public Org findEntity(long orgId) {
return orgDAO.selectByPrimaryKey(orgId);
}
@Override
public Collection<Org> getEntities(String project, String status) {
Collection<Org> orgs = findEntities(project, status);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(orgs, String.format("关联项目[%s]的组织不存在", project));
return orgs;
}
@Override
public Collection<Org> findEntities(@NonNull String project, String status) {
OrgExample example = new OrgExample();
OrgExample.Criteria criteria = example.createCriteria().andProjectCodeLike(String.format("%%%s%%", project));
if (StringUtils.hasText(status)) {
criteria.andStatusEqualTo(status);
}
return orgDAO.selectByExample(example);
}
@Override
public OrgVO updateOrg(Long id, OrgVO orgVO, AccountVO user) {
//校验
Org org = getEntity(id);
if (!CollectionUtils.isEmpty(orgVO.getProjectCodes())) {
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(isTopOrg(org), "非顶级组织不能修改关联项目");
@Override
public OrgVO updateOrg(Long id, OrgVO orgVO, AccountVO user) {
//校验
Org org = getEntity(id);
if (!CollectionUtils.isEmpty(orgVO.getProjectCodes())) {
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(isTopOrg(org), "非顶级组织不能修改关联项目");
// confirmProjectCodesNotRepeat(org.getId(), orgVO.getProjectCodes());
// 20220929 增加
orgProjectService.update(id, orgVO.getProjectCodes(), user);
}
confirmNameUnique(id, orgVO.getName());
//更新
org.setName(orgVO.getName());
// 20220929 增加
orgProjectService.update(id, orgVO.getProjectCodes(), user);
}
confirmNameUnique(id, orgVO.getName());
//更新
org.setName(orgVO.getName());
// org.setProjectCode(orgVO.getDBProjectCode());
org.setUpdateId(user.getId());
org.setUpdateTime(LocalDateTime.now());
this.orgDAO.updateByPrimaryKeySelective(org);
List<String> projects = orgProjectService.queryOrgProjectListByOrgId(org.getId()).stream()
.map(OrgProject::getProjectCode).collect(Collectors.toList());
return new OrgVO(org, projects);
}
org.setUpdateId(user.getId());
org.setUpdateTime(LocalDateTime.now());
this.orgDAO.updateByPrimaryKeySelective(org);
List<String> projects = orgProjectService.queryOrgProjectListByOrgId(org.getId()).stream()
.map(OrgProject::getProjectCode).collect(Collectors.toList());
return new OrgVO(org, projects);
}
@Override
public void deleteNonTopOrg(Long nonTopOrgId) {
confirmIsNonTopOrg(nonTopOrgId);
Org org = new Org();
org.setId(nonTopOrgId);
org.setStatus(BusinessConsts.Org.Status.DELETE);
orgDAO.updateByPrimaryKeySelective(org);
}
@Override
public void deleteNonTopOrg(Long nonTopOrgId) {
confirmIsNonTopOrg(nonTopOrgId);
Org org = new Org();
org.setId(nonTopOrgId);
org.setStatus(BusinessConsts.Org.Status.DELETE);
orgDAO.updateByPrimaryKeySelective(org);
}
@Override
public List<Org> findEntitiesByParentId(@NonNull Long parentId, String orderBy, String status) {
OrgExample example = new OrgExample();
if (StringUtils.hasText(orderBy)) {
example.setOrderByClause(orderBy);
}
OrgExample.Criteria criteria = example.createCriteria().andParentIdEqualTo(parentId);
if (StringUtils.hasText(status)) {
criteria.andStatusEqualTo(status);
}
return orgDAO.selectByExample(example);
@Override
public List<Org> findEntitiesByParentId(@NonNull Long parentId, String orderBy, String status) {
OrgExample example = new OrgExample();
if (StringUtils.hasText(orderBy)) {
example.setOrderByClause(orderBy);
}
OrgExample.Criteria criteria = example.createCriteria().andParentIdEqualTo(parentId);
if (StringUtils.hasText(status)) {
criteria.andStatusEqualTo(status);
}
return orgDAO.selectByExample(example);
}
@Override
public PageVO<OrgVO> pagedQueryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo) {
OrgExample example = new OrgExample();
OrgExample.Criteria criteria = example.createCriteria().andParentIdEqualTo(loginInfo.getTopOrgId())
.andStatusEqualTo(BusinessConsts.Org.Status.VALID);
if (StringUtils.hasText(queryVO.getName())) {
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
@Override
public PageVO<OrgVO> pagedQueryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo) {
OrgExample example = new OrgExample();
OrgExample.Criteria criteria = example.createCriteria().andParentIdEqualTo(loginInfo.getTopOrgId())
.andStatusEqualTo(BusinessConsts.Org.Status.VALID);
if (StringUtils.hasText(queryVO.getName())) {
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
}
if (StringUtils.hasText(queryVO.getCreatorName())) {
List<Long> creatorIds = iSysUserService.findUserByName(queryVO.getCreatorName()).stream().map(AccountVO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(creatorIds)) {
return new PageVO<>(queryVO.getPageNum(), queryVO.getPageSize(), 0, new ArrayList<>());
} else {
criteria.andCreatorIdIn(creatorIds);
}
}
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
Page<Org> page = (Page<Org>) orgDAO.selectByExample(example);
List<Long> creatorIds = page.stream().map(Org::getCreatorId).collect(Collectors.toList());
Map<Long, SysAccount> creatorMap = iSysUserService.findEntities(creatorIds, null).stream()
.collect(Collectors.toMap(SysAccount::getId, Function.identity()));
List<OrgVO> list = page.getResult().stream().map(entity -> {
int numberOfPeople = iOrgUserService.getQuantities(entity.getId(), BusinessConsts.OrgRole.Student);
return new OrgVO(entity, null, numberOfPeople, creatorMap.get(entity.getCreatorId()));
}).collect(Collectors.toList());
return PageVO.convert(page, list);
}
@Override
public List<OrgVO> queryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo) {
OrgExample example = new OrgExample();
OrgExample.Criteria criteria = example.createCriteria()
.andParentIdEqualTo(loginInfo.getTopOrgId())
.andStatusEqualTo(BusinessConsts.Org.Status.VALID);
if (queryVO != null) {
if (StringUtils.hasText(queryVO.getName())) {
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
}
}
List<Org> clsList = orgDAO.selectByExample(example);
return clsList.stream().map(OrgVO::new).collect(Collectors.toList());
}
@Override
public Org getTopOrgEntity(Long orgId) {
Org entity = getEntity(orgId);
if (isTopOrg(entity)) {
return entity;
}
return getEntity(entity.getRootId());
}
@Override
public List<Org> findEntities(List<Long> orgIds, String status) {
if (CollectionUtils.isEmpty(orgIds)) {
return new ArrayList<>();
} else {
OrgExample example = new OrgExample();
OrgExample.Criteria criteria = example.createCriteria().andIdIn(orgIds);
if (StringUtils.hasText(status)) {
criteria.andStatusEqualTo(status);
}
return orgDAO.selectByExample(example);
}
}
@Override
public Node<Object> adminQueryOrgTree(Long orgId) {
/* 先筛选组织 */
OrgVO orgVO = get(orgId);
Map<Long, List<Org>> groupByParentIdOrg = findEntitiesByRootId(orgVO.getRootId(), null, BusinessConsts.Org.Status.VALID)
.stream().filter(o -> !isTopOrg(o)).collect(Collectors.groupingBy(Org::getParentId));
Node<Object> root = new Node<>(orgVO, Node.Type.ORG);
Map<Long, Node<Object>> all_orgId_node_map = new HashMap<>(); //所有的组织和对应的节点
Map<Long, Node<Object>> orgId_node_map = new HashMap<>();
orgId_node_map.put(orgVO.getId(), root);
while (!orgId_node_map.isEmpty()) {
all_orgId_node_map.putAll(orgId_node_map);
Map<Long, Node<Object>> newMap = new HashMap<>();
orgId_node_map.forEach((k, v) -> {
List<Org> childOrgList = groupByParentIdOrg.get(k);
if (!CollectionUtils.isEmpty(childOrgList)) {
List<Node<Object>> children = childOrgList.stream().map(o -> {
Node<Object> node = new Node<>(new OrgVO(o), Node.Type.ORG);
newMap.put(o.getId(), node);
return node;
}).collect(Collectors.toList());
v.setChildren(children);
}
if (StringUtils.hasText(queryVO.getCreatorName())) {
List<Long> creatorIds = iSysUserService.findUserByName(queryVO.getCreatorName()).stream().map(AccountVO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(creatorIds)) {
return new PageVO<>(queryVO.getPageNum(), queryVO.getPageSize(), 0, new ArrayList<>());
} else {
criteria.andCreatorIdIn(creatorIds);
}
}
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
Page<Org> page = (Page<Org>) orgDAO.selectByExample(example);
List<Long> creatorIds = page.stream().map(Org::getCreatorId).collect(Collectors.toList());
Map<Long, SysAccount> creatorMap = iSysUserService.findEntities(creatorIds, null).stream()
.collect(Collectors.toMap(SysAccount::getId, Function.identity()));
List<OrgVO> list = page.getResult().stream().map(entity -> {
int numberOfPeople = iOrgUserService.getQuantities(entity.getId(), BusinessConsts.OrgRole.Student);
return new OrgVO(entity, null, numberOfPeople, creatorMap.get(entity.getCreatorId()));
});
orgId_node_map = newMap;
}
/* 再查询用户 */
List<OrgUser> orgUsers = iOrgUserService.findEntitiesByOrgIds(new ArrayList<>(all_orgId_node_map.keySet()), null);
Map<Long, List<OrgUser>> groupByOrgIdOrgUsers = orgUsers.stream().collect(Collectors.groupingBy(OrgUser::getOrgId));
List<Long> userIds = orgUsers.stream().map(OrgUser::getUserId).collect(Collectors.toList());
Map<Long, SysAccount> userMap = iSysUserService.findEntities(userIds, null)
.stream().collect(Collectors.toMap(SysAccount::getId, Function.identity()));
all_orgId_node_map.forEach((k, v) -> {
List<OrgUser> ous = groupByOrgIdOrgUsers.get(k);
if (!CollectionUtils.isEmpty(ous)) {
List<Node<Object>> children = ous.stream().map(ou -> {
OrgUserVO vo = new OrgUserVO(ou, userMap.get(ou.getUserId()));
return new Node<Object>(vo, Node.Type.USER);
}).collect(Collectors.toList());
return PageVO.convert(page, list);
}
@Override
public List<OrgVO> queryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo) {
OrgExample example = new OrgExample();
OrgExample.Criteria criteria = example.createCriteria()
.andParentIdEqualTo(loginInfo.getTopOrgId())
.andStatusEqualTo(BusinessConsts.Org.Status.VALID);
if (queryVO != null) {
if (StringUtils.hasText(queryVO.getName())) {
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
}
if (!CollectionUtils.isEmpty(v.getChildren())) {
children.addAll(v.getChildren());
}
List<Org> clsList = orgDAO.selectByExample(example);
return clsList.stream().map(OrgVO::new).collect(Collectors.toList());
}
v.setChildren(children);
}
});
return root;
}
@Override
public Org getTopOrgEntity(Long orgId) {
Org entity = getEntity(orgId);
if (isTopOrg(entity))
return entity;
return getEntity(entity.getRootId());
}
@Override
public OrgVO get(Long id) {
OrgVO vo = query(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(vo, String.format("[id:%s]的组织不存在", id));
return vo;
}
@Override
public List<Org> findEntities(List<Long> orgIds, String status) {
if (CollectionUtils.isEmpty(orgIds)) {
return new ArrayList<>();
} else {
OrgExample example = new OrgExample();
OrgExample.Criteria criteria = example.createCriteria().andIdIn(orgIds);
if (StringUtils.hasText(status)) {
criteria.andStatusEqualTo(status);
}
return orgDAO.selectByExample(example);
}
@Override
public List<ExamDefinitionVO> queryByExamIds(List<Long> examIds, String status) {
if (CollectionUtils.isEmpty(examIds)) {
return new ArrayList<>();
}
return orgDAO.queryByExamIds(examIds, status);
}
@Override
public Node<Object> adminQueryOrgTree(Long orgId) {
/* 先筛选组织 */
OrgVO orgVO = get(orgId);
Map<Long, List<Org>> groupByParentIdOrg = findEntitiesByRootId(orgVO.getRootId(), null, BusinessConsts.Org.Status.VALID)
.stream().filter(o -> !isTopOrg(o)).collect(Collectors.groupingBy(Org::getParentId));
Node<Object> root = new Node<>(orgVO, Node.Type.ORG);
Map<Long, Node<Object>> all_orgId_node_map = new HashMap<>(); //所有的组织和对应的节点
Map<Long, Node<Object>> orgId_node_map = new HashMap<>();
orgId_node_map.put(orgVO.getId(), root);
while (!orgId_node_map.isEmpty()) {
all_orgId_node_map.putAll(orgId_node_map);
Map<Long, Node<Object>> newMap = new HashMap<>();
orgId_node_map.forEach((k, v) -> {
List<Org> childOrgList = groupByParentIdOrg.get(k);
if (!CollectionUtils.isEmpty(childOrgList)) {
List<Node<Object>> children = childOrgList.stream().map(o -> {
Node<Object> node = new Node<>(new OrgVO(o), Node.Type.ORG);
newMap.put(o.getId(), node);
return node;
}).collect(Collectors.toList());
v.setChildren(children);
}
});
orgId_node_map = newMap;
}
/* 再查询用户 */
List<OrgUser> orgUsers = iOrgUserService.findEntitiesByOrgIds(new ArrayList<>(all_orgId_node_map.keySet()), null);
Map<Long, List<OrgUser>> groupByOrgIdOrgUsers = orgUsers.stream().collect(Collectors.groupingBy(OrgUser::getOrgId));
List<Long> userIds = orgUsers.stream().map(OrgUser::getUserId).collect(Collectors.toList());
Map<Long, SysAccount> userMap = iSysUserService.findEntities(userIds, null)
.stream().collect(Collectors.toMap(SysAccount::getId, Function.identity()));
all_orgId_node_map.forEach((k, v) -> {
List<OrgUser> ous = groupByOrgIdOrgUsers.get(k);
if (!CollectionUtils.isEmpty(ous)) {
List<Node<Object>> children = ous.stream().map(ou -> {
OrgUserVO vo = new OrgUserVO(ou, userMap.get(ou.getUserId()));
return new Node<Object>(vo, Node.Type.USER);
}).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(v.getChildren())) {
children.addAll(v.getChildren());
}
v.setChildren(children);
}
});
return root;
/**
* 确认是顶级组织
*
* @param id
*/
@Override
public void confirmIsTopOrg(long id) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(isTopOrg(id),
String.format("组织[%s]不是顶级组织", id));
}
/**
* 确认是非顶级组织
*/
@Override
public void confirmIsNonTopOrg(Long id) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!isTopOrg(id),
String.format("组织[%s]是顶级组织", id));
}
@Override
public List<Org> queryAllSubOrgs(Long orgId) {
OrgExample example = new OrgExample();
example.createCriteria()
.andParentIdEqualTo(orgId)
.andStatusEqualTo(BusinessConsts.Org.Status.VALID);
List<Org> orgs = this.orgDAO.selectByExample(example);
return orgs;
}
@Override
public String getBindQrCode(long orgId, String project) {
return qrCodeManager.getOrgBindCode(orgId, project);
}
@Override
public Org getTopOrgOfUser(long userId) {
Org org = findTopOrgOfUser(userId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(org, String.format("用户[%s]无所属顶级组织", userId));
return org;
}
@Override
public Org findTopOrgOfUser(long userId) {
List<OrgUser> orgUsers = iOrgUserService.findEntitiesByUserId(userId, null);
if (CollectionUtils.isEmpty(orgUsers)) {
return null;
}
@Override
public OrgVO get(Long id) {
OrgVO vo = query(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(vo, String.format("[id:%s]的组织不存在", id));
return vo;
Long orgId = orgUsers.stream()
.filter(orgUser -> BusinessConsts.OrgRole.Admin.name().equals(orgUser.getRole())) //目前有管理员的一定是顶级组织
.findAny().orElse(orgUsers.get(0)).getOrgId();
Org org = getTopOrgEntity(orgId);
if (BusinessConsts.Org.Status.VALID.equals(org.getStatus())) {
return org;
} else {
return null;
}
}
@Override
public List<ExamDefinitionVO> queryByExamIds(List<Long> examIds, String status) {
if (CollectionUtils.isEmpty(examIds)) {
return new ArrayList<>();
}
return orgDAO.queryByExamIds(examIds, status);
@Override
public List<OrgVO> listQueryCls(long topOrgId) {
List<Org> clsList = findClsByTopOrgId(topOrgId);
return OrgVO.convert2VOList(clsList);
}
@Override
public OrgVO query(Long id) {
Org entity = findEntity(id);
if (entity == null) {
return null;
}
/**
* 确认是顶级组织
*
* @param id
*/
@Override
public void confirmIsTopOrg(long id) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(isTopOrg(id),
String.format("组织[%s]不是顶级组织", id));
List<String> projects;
if (isTopOrg(entity)) {
projects = orgProjectService.queryOrgProjectListByOrgId(entity.getId()).stream()
.map(OrgProject::getProjectCode).collect(Collectors.toList());
} else {
projects = null;
}
return new OrgVO(entity, projects);
}
/**
* 确认是非顶级组织
*/
@Override
public void confirmIsNonTopOrg(Long id) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!isTopOrg(id),
String.format("组织[%s]是顶级组织", id));
@Override
public OrgVO getTopOrg(long topOrgId) {
Org org = getEntity(topOrgId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(isTopOrg(org),
String.format("[id:%s]的组织不是顶级组织", topOrgId));
List<String> projects = orgProjectService.queryOrgProjectListByOrgId(topOrgId)
.stream().map(OrgProject::getProjectCode).collect(Collectors.toList());
return new OrgVO(org, projects);
}
/**
* 查询该顶级组织下的班级
*/
private List<Org> findClsByTopOrgId(long topOrgId) {
OrgExample orgExample = new OrgExample();
orgExample.createCriteria().andRootIdEqualTo(topOrgId).andParentIdIsNull();
return orgDAO.selectByExample(orgExample);
}
/**
* 创建非顶级组织
*/
private Org createNonTopOrg(@NonNull String name, @NonNull Long parentId, @NonNull Long rootId, @NonNull Long creatorId) {
//检查顶级组织
confirmIsTopOrg(rootId);
//检查同级同名组织
List<Org> entities = findEntitiesByParentId(parentId, null, BusinessConsts.Org.Status.VALID);
if (!CollectionUtils.isEmpty(entities)) {
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(entities.stream().noneMatch(org -> org.getName().equals(name)),
String.format("上级为[%s]的同名组织已存在", parentId));
}
//创建新组织
Org org = new Org();
org.setName(name);
org.setParentId(parentId);
org.setRootId(rootId);
org.setCreatorId(creatorId);
org.setCreateTime(LocalDateTime.now());
org.setStatus(BusinessConsts.Org.Status.VALID);
orgDAO.insert(org);
return org;
}
@Override
public List<Org> queryAllSubOrgs(Long orgId) {
OrgExample example = new OrgExample();
example.createCriteria()
.andParentIdEqualTo(orgId)
.andStatusEqualTo(BusinessConsts.Org.Status.VALID);
List<Org> orgs = this.orgDAO.selectByExample(example);
return orgs;
private boolean isTopOrg(long orgId) {
return isTopOrg(getEntity(orgId));
}
private boolean isTopOrg(Org org) {
return org.getParentId() == null;
}
private List<Org> findEntitiesByRootId(Long rootId, String orderBy, String status) {
OrgExample example = new OrgExample();
if (StringUtils.hasText(orderBy)) {
example.setOrderByClause(orderBy);
}
@Override
public String getBindQrCode(long orgId, String project) {
return qrCodeManager.getOrgBindCode(orgId, project);
OrgExample.Criteria criteria = example.createCriteria().andRootIdEqualTo(rootId);
if (StringUtils.hasText(status)) {
criteria.andStatusEqualTo(status);
}
@Override
public Org getTopOrgOfUser(long userId) {
Org org = findTopOrgOfUser(userId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(org, String.format("用户[%s]无所属顶级组织", userId));
return org;
}
@Override
public Org findTopOrgOfUser(long userId) {
List<OrgUser> orgUsers = iOrgUserService.findEntitiesByUserId(userId, null);
if (CollectionUtils.isEmpty(orgUsers))
return null;
Long orgId = orgUsers.stream()
.filter(orgUser -> BusinessConsts.OrgRole.Admin.name().equals(orgUser.getRole())) //目前有管理员的一定是顶级组织
.findAny().orElse(orgUsers.get(0)).getOrgId();
Org org = getTopOrgEntity(orgId);
if (BusinessConsts.Org.Status.VALID.equals(org.getStatus())) {
return org;
} else {
return null;
}
}
@Override
public List<OrgVO> listQueryCls(long topOrgId) {
List<Org> clsList = findClsByTopOrgId(topOrgId);
return OrgVO.convert2VOList(clsList);
}
@Override
public OrgVO query(Long id) {
Org entity = findEntity(id);
if (entity == null) {
return null;
}
List<String> projects;
if (isTopOrg(entity)) {
projects = orgProjectService.queryOrgProjectListByOrgId(entity.getId()).stream()
.map(OrgProject::getProjectCode).collect(Collectors.toList());
} else {
projects = null;
}
return new OrgVO(entity, projects);
}
@Override
public OrgVO getTopOrg(long topOrgId) {
Org org = getEntity(topOrgId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(isTopOrg(org),
String.format("[id:%s]的组织不是顶级组织", topOrgId));
List<String> projects = orgProjectService.queryOrgProjectListByOrgId(topOrgId)
.stream().map(OrgProject::getProjectCode).collect(Collectors.toList());
return new OrgVO(org, projects);
}
/**
* 查询该顶级组织下的班级
*/
private List<Org> findClsByTopOrgId(long topOrgId) {
OrgExample orgExample = new OrgExample();
orgExample.createCriteria().andRootIdEqualTo(topOrgId).andParentIdIsNull();
return orgDAO.selectByExample(orgExample);
}
/**
* 创建非顶级组织
*/
private Org createNonTopOrg(@NonNull String name, @NonNull Long parentId, @NonNull Long rootId, @NonNull Long creatorId) {
//检查顶级组织
confirmIsTopOrg(rootId);
//检查同级同名组织
List<Org> entities = findEntitiesByParentId(parentId, null, BusinessConsts.Org.Status.VALID);
if (!CollectionUtils.isEmpty(entities)) {
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(entities.stream().noneMatch(org -> org.getName().equals(name)),
String.format("上级为[%s]的同名组织已存在", parentId));
}
//创建新组织
Org org = new Org();
org.setName(name);
org.setParentId(parentId);
org.setRootId(rootId);
org.setCreatorId(creatorId);
org.setCreateTime(LocalDateTime.now());
org.setStatus(BusinessConsts.Org.Status.VALID);
orgDAO.insert(org);
return org;
}
private boolean isTopOrg(long orgId) {
return isTopOrg(getEntity(orgId));
}
private boolean isTopOrg(Org org) {
return org.getParentId() == null;
}
private List<Org> findEntitiesByRootId(Long rootId, String orderBy, String status) {
OrgExample example = new OrgExample();
if (StringUtils.hasText(orderBy)) {
example.setOrderByClause(orderBy);
}
OrgExample.Criteria criteria = example.createCriteria().andRootIdEqualTo(rootId);
if (StringUtils.hasText(status)) {
criteria.andStatusEqualTo(status);
}
List<Org> orgs = orgDAO.selectByExample(example);
List<Org> orgs = orgDAO.selectByExample(example);
// BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(orgs,
// String.format("没有顶级组织id为[%s]的组织", rootId));
return orgs;
}
return orgs;
}
// /**
// * 确认这些项目没有被关联到其它的组织

View File

@ -2,10 +2,12 @@ package club.joylink.rtss.services.paper;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.paper.PaperQuestionDAO;
import club.joylink.rtss.entity.Org;
import club.joylink.rtss.entity.paper.question.PaperQuestion;
import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
import club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.org.OrgService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO;
@ -37,56 +39,69 @@ import java.util.stream.Collectors;
@Service
@Slf4j
public class PagerQuestionService {
@Resource
private PaperQuestionDAO questionDAO;
/**
* 创建对应的查询example
* @param queryVO 查询对象
* @param orgIdCanNull orgId是否可以为空
* @param queryLabelIsNull 当查询对象labels属性为空时 是否查询 tags is null
* @return
*/
public void createQueryExample(PaperQuestionExample.Criteria criteria,QuestionQueryVO queryVO, boolean orgIdCanNull,boolean queryLabelIsNull){
if(Objects.equals(false,orgIdCanNull)){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(queryVO.getOrgId()),"用户组织信息不能为空");
}
if (StringUtils.hasText(queryVO.getTopic())) {
criteria.andQuestionLike(String.format("%%%s%%", queryVO.getTopic()));
}
if (StringUtils.hasText(queryVO.getType())) {
criteria.andTypeEqualTo(queryVO.getType());
}
@Resource
private PaperQuestionDAO questionDAO;
if(Objects.nonNull(queryVO.getOrgId())){
criteria.andOrgIdEqualTo(queryVO.getOrgId());
@Resource
private OrgService orgService;
public List<Long> queryAllDefaultOrgPaperIds() {
Org org = this.orgService.findDefaultOrg();
if (Objects.isNull(org)) {
return Collections.emptyList();
}
return this.questionDAO.findAllId(org.getId());
}
/**
* 创建对应的查询example
*
* @param queryVO 查询对象
* @param orgIdCanNull orgId是否可以为空
* @param queryLabelIsNull 当查询对象labels属性为空时 是否查询 tags is null
* @return
*/
public void createQueryExample(PaperQuestionExample.Criteria criteria, QuestionQueryVO queryVO, boolean orgIdCanNull, boolean queryLabelIsNull) {
if (Objects.equals(false, orgIdCanNull)) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(queryVO.getOrgId()), "用户组织信息不能为空");
}
if (StringUtils.hasText(queryVO.getTopic())) {
criteria.andQuestionLike(String.format("%%%s%%", queryVO.getTopic()));
}
if (StringUtils.hasText(queryVO.getType())) {
criteria.andTypeEqualTo(queryVO.getType());
}
if (Objects.nonNull(queryVO.getOrgId())) {
criteria.andOrgIdEqualTo(queryVO.getOrgId());
}
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
if (Objects.equals(false, queryLabelIsNull) && StringUtils.hasText(queryVO.getLabels())) {
List<String> tmpLableList = Splitter.on(",").omitEmptyStrings().splitToList(queryVO.getLabels());
if (Objects.equals(false, CollectionUtils.isEmpty(tmpLableList))) {
StringBuilder sqlBuilder = new StringBuilder("(");
for (var i = 0; i < tmpLableList.size(); i++) {
String data = tmpLableList.get(i);
if (i != 0) {
sqlBuilder.append(" and ");
}
sqlBuilder.append(String.format(" find_in_set('%s',tags) > 0 ", data));
}
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
if(Objects.equals(false,queryLabelIsNull) && StringUtils.hasText(queryVO.getLabels())){
List<String> tmpLableList = Splitter.on(",").omitEmptyStrings().splitToList(queryVO.getLabels());
if(Objects.equals(false,CollectionUtils.isEmpty(tmpLableList))){
StringBuilder sqlBuilder = new StringBuilder("(");
for(var i = 0 ; i < tmpLableList.size();i++){
String data = tmpLableList.get(i);
if(i != 0){
sqlBuilder.append(" and ");
}
sqlBuilder.append(String.format(" find_in_set('%s',tags) > 0 ",data));
}
sqlBuilder.append(")");
Class<?> criteriaCls = criteria.getClass();
Class<?> generatedCriteriaCls = criteriaCls.getSuperclass();
try{
Method addCriterion = generatedCriteriaCls.getDeclaredMethod("addCriterion", String.class);
addCriterion.setAccessible(true);
addCriterion.invoke(criteria, sqlBuilder.toString());
}catch (Exception e){
log.error("拼写查询标签错误 msg:" + e.getMessage(),e);
}
}
}else {
criteria.andTagsIsNull();
sqlBuilder.append(")");
Class<?> criteriaCls = criteria.getClass();
Class<?> generatedCriteriaCls = criteriaCls.getSuperclass();
try {
Method addCriterion = generatedCriteriaCls.getDeclaredMethod("addCriterion", String.class);
addCriterion.setAccessible(true);
addCriterion.invoke(criteria, sqlBuilder.toString());
} catch (Exception e) {
log.error("拼写查询标签错误 msg:" + e.getMessage(), e);
}
}
} else {
criteria.andTagsIsNull();
}
/* if(!StringUtils.hasText(queryVO.getLabels())){
if(queryLabelIsNull) {
criteria.andTagsIsNull();
@ -115,258 +130,265 @@ public class PagerQuestionService {
}
}*/
}
/**
* 查询对应的类型标签对应的数量
*
* @param orgId 用户组织id
* @param type 类型
* @param labels 逗号隔开的标签
* @return
*/
public long queryCount(Long orgId, BusinessConsts.TheoryType type, String labels) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId), "组织信息不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(type == BusinessConsts.TheoryType.select
|| type == BusinessConsts.TheoryType.multi
|| type == BusinessConsts.TheoryType.judge, "查询类型只支持单选,多选,选择");
QuestionQueryVO queryVO = new QuestionQueryVO();
queryVO.setOrgId(orgId);
queryVO.setType(type.name());
queryVO.setLabels(labels);
PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
this.createQueryExample(criteria, queryVO, false, false);
return this.questionDAO.countByExample(example);
}
/**
* 获取题库分页列表
*
* @param queryVO
* @param companyIdCanNull
* @return
*/
public PageVO<PaperQuestionVO> pagingQueryQuestions(QuestionQueryVO queryVO, boolean companyIdCanNull) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
this.createQueryExample(criteria, queryVO, companyIdCanNull, false);
Page<PaperQuestionWithBLOBs> page = (Page<PaperQuestionWithBLOBs>) this.questionDAO.selectByExampleWithBLOBs(example);
List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(page.getResult());
return PageVO.convert(page, questionVOS);
}
/**
* 获取题型列表
*
* @param queryVO
* @param companyIdCanNull
* @return
*/
public List<PaperQuestionVO> queryQuestions(QuestionQueryVO queryVO, boolean companyIdCanNull) {
PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
this.createQueryExample(criteria, queryVO, companyIdCanNull, false);
List<PaperQuestionWithBLOBs> list = this.questionDAO.selectByExampleWithBLOBs(example);
List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(list);
return questionVOS;
}
/**
* 获取题型所有数据
*
* @param questionId
* @param doNotCheckDel 是否检测数据状态是否删除 true = 不检测false=检测
* @return
*/
public PaperQuestionVO getQuestion(Long questionId, boolean doNotCheckDel, boolean random) {
PaperQuestionWithBLOBs question = questionDAO.selectByPrimaryKey(questionId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(question), "没有找到对应的数据");
boolean isDel = question.getIsDel() == BusinessConsts.DBLogicDelete.NORMAL.ordinal();
if (doNotCheckDel) {
isDel = true;
}
/**
* 查询对应的类型标签对应的数量
* @param orgId 用户组织id
* @param type 类型
* @param labels 逗号隔开的标签
* @return
*/
public long queryCount(Long orgId,BusinessConsts.TheoryType type,String labels){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织信息不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(type == BusinessConsts.TheoryType.select
|| type == BusinessConsts.TheoryType.multi
|| type == BusinessConsts.TheoryType.judge ,"查询类型只支持单选,多选,选择");
QuestionQueryVO queryVO = new QuestionQueryVO();
queryVO.setOrgId(orgId);
queryVO.setType(type.name());
queryVO.setLabels(labels);
PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
this.createQueryExample(criteria,queryVO,false,false);
return this.questionDAO.countByExample(example);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(isDel);
PaperQuestionVO questionVO = new PaperQuestionVO(question);
if (random) {
Collections.shuffle(questionVO.getOptionList());
}
return questionVO;
}
/**
* 获取题库分页列表
* @param queryVO  
* @param companyIdCanNull  
* @return
*/
public PageVO<PaperQuestionVO> pagingQueryQuestions(QuestionQueryVO queryVO,boolean companyIdCanNull) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
this.createQueryExample(criteria,queryVO,companyIdCanNull,false);
Page<PaperQuestionWithBLOBs> page = (Page<PaperQuestionWithBLOBs>)this.questionDAO.selectByExampleWithBLOBs(example);
List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(page.getResult());
return PageVO.convert(page, questionVOS);
}
/**
* 获取题型列表
* @param queryVO  
* @param companyIdCanNull  
* @return
*/
public List<PaperQuestionVO> queryQuestions(QuestionQueryVO queryVO,boolean companyIdCanNull) {
PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
this.createQueryExample(criteria,queryVO,companyIdCanNull,false);
List<PaperQuestionWithBLOBs> list = this.questionDAO.selectByExampleWithBLOBs(example);
List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(list);
return questionVOS;
}
/**
* 获取题型所有数据
* @param questionId  
* @param doNotCheckDel 是否检测数据状态是否删除 true = 不检测false=检测
* @return
*/
public PaperQuestionVO getQuestion(Long questionId,boolean doNotCheckDel,boolean random) {
PaperQuestionWithBLOBs question = questionDAO.selectByPrimaryKey(questionId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(question),"没有找到对应的数据");
boolean isDel = question.getIsDel() == BusinessConsts.DBLogicDelete.NORMAL.ordinal();
if(doNotCheckDel){
isDel = true;
}
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(isDel);
PaperQuestionVO questionVO = new PaperQuestionVO(question);
if(random){
Collections.shuffle(questionVO.getOptionList());
}
return questionVO;
}
/**
* 检测题目是否正确
* @param questionId 题目id
* @param answerIds 检测的答案Id
* @return
*/
public boolean answer(Long questionId,List<Integer> answerIds){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!CollectionUtils.isEmpty(answerIds),"题目答案不能为空");
PaperQuestionVO vo = this.getQuestion(questionId,true,false);
List<Integer> newAnswerList = answerIds.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
/**
* 检测题目是否正确
*
* @param questionId 题目id
* @param answerIds 检测的答案Id
* @return
*/
public boolean answer(Long questionId, List<Integer> answerIds) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!CollectionUtils.isEmpty(answerIds), "题目答案不能为空");
PaperQuestionVO vo = this.getQuestion(questionId, true, false);
List<Integer> newAnswerList = answerIds.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
/* if(Objects.equals(BusinessConsts.TheoryType.select.name(),vo.getType())
|| Objects.equals(BusinessConsts.TheoryType.judge.name(),vo.getType())){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(newAnswerList.size() == 1 ,"单选,判断题答案只能有一个!");
}else if(Objects.equals(BusinessConsts.TheoryType.multi.name(),vo.getType())){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(newAnswerList.size() >= 2 ,"多选题答案最少需要2个");
}*/
Collections.sort(newAnswerList);
String answerStr = Joiner.on(",").skipNulls().join(newAnswerList);
if(Objects.equals(answerStr,vo.getAnswer())){
return true;
}
log.info("检查题目[{}]答案,获取原答案[{}],正确答案[{}] ",questionId, answerStr,vo.getQuestionAnswer());
return false;
Collections.sort(newAnswerList);
String answerStr = Joiner.on(",").skipNulls().join(newAnswerList);
if (Objects.equals(answerStr, vo.getAnswer())) {
return true;
}
log.info("检查题目[{}]答案,获取原答案[{}],正确答案[{}] ", questionId, answerStr, vo.getQuestionAnswer());
return false;
}
/**
* 获取所有公司组织下的标签
*
*/
public Collection<String> findAllLable(Long orgId,String type){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织id不能为空");
PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
if(Objects.nonNull(type)){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.equals(type,BusinessConsts.TheoryType.select.name())
||Objects.equals(type,BusinessConsts.TheoryType.multi.name())
||Objects.equals(type,BusinessConsts.TheoryType.judge.name()),"查询类型只支持单选,多选,选择");
criteria.andTypeEqualTo(type);
}
criteria.andOrgIdEqualTo(orgId);
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
List<PaperQuestion> lableList = this.questionDAO.selectByExample(example);
if(CollectionUtils.isEmpty(lableList)){
return Collections.emptyList();
}
return lableList.stream().map(PaperQuestion::getTags).filter(StringUtils::hasText).flatMap(d-> Splitter.on(",").omitEmptyStrings()
.trimResults().splitToStream(d)).collect(Collectors.toSet());
/**
* 获取所有公司组织下的标签
*/
public Collection<String> findAllLable(Long orgId, String type) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId), "组织id不能为空");
PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
if (Objects.nonNull(type)) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.equals(type, BusinessConsts.TheoryType.select.name())
|| Objects.equals(type, BusinessConsts.TheoryType.multi.name())
|| Objects.equals(type, BusinessConsts.TheoryType.judge.name()), "查询类型只支持单选,多选,选择");
criteria.andTypeEqualTo(type);
}
criteria.andOrgIdEqualTo(orgId);
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
List<PaperQuestion> lableList = this.questionDAO.selectByExample(example);
if (CollectionUtils.isEmpty(lableList)) {
return Collections.emptyList();
}
return lableList.stream().map(PaperQuestion::getTags).filter(StringUtils::hasText).flatMap(d -> Splitter.on(",").omitEmptyStrings()
.trimResults().splitToStream(d)).collect(Collectors.toSet());
}
/**
* 根据公司id和标签或类型查询
* @param companyId  
* @param queryVO  
* @return
*/
public List<PaperQuestionVO> queryQuestionsForRaceLable(Long companyId, PagerLableQueryVO queryVO) {
/**
* 根据公司id和标签或类型查询
*
* @param companyId
* @param queryVO
* @return
*/
public List<PaperQuestionVO> queryQuestionsForRaceLable(Long companyId, PagerLableQueryVO queryVO) {
/*boolean isDefault = Project.isDefault(projectCode);
List<Long> idList = null;
if(Objects.equals(false,isDefault)){
idList = this.queryFromProjectCode(projectCode);
}*/
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(companyId),"组织id不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(queryVO.allNotNullOrEmpty(),"查询内容不能为空");
int isDel = BusinessConsts.DBLogicDelete.NORMAL.ordinal();
List<PaperQuestionWithBLOBs> list = this.questionDAO.findFromAndRaceLable(companyId,isDel,queryVO.getLables(),queryVO.getTypes());
List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(list);
return questionVOS;
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(companyId), "组织id不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(queryVO.allNotNullOrEmpty(), "查询内容不能为空");
int isDel = BusinessConsts.DBLogicDelete.NORMAL.ordinal();
List<PaperQuestionWithBLOBs> list = this.questionDAO.findFromAndRaceLable(companyId, isDel, queryVO.getLables(), queryVO.getTypes());
List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(list);
return questionVOS;
}
/**
* 添加修改
*
* @param questionVO
* @param accountVO
*/
public void saveOrUpdate(PaperQuestionVO questionVO, AccountVO accountVO) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(questionVO.getOrgId()), "组织id不能为空");
this.checkQuestionType(questionVO, "题库目前只支持单选,多选和判断");
if (questionVO.isSelect() || questionVO.isJudge()) {
this.checkQuestionTypeForSelectAndJudge(questionVO, "单选或判断题正确答案有且只有一个!");
} else if (questionVO.isMulti()) {
this.checkQuestionTypeForMulti(questionVO, "多选题正确答案必须是2个以上");
}
if (StringUtils.hasText(questionVO.getTags())) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Splitter.on(",").splitToList(questionVO.getTags()).size() <= 1, "分类最多只能有1个");
}
PaperQuestionWithBLOBs question = questionVO.convert2DB();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(question.getQuestion().length() < 512, "问题字符长度不用超过512");
int wordCounts = questionVO.getOptionList().stream().map(d -> d.getContent().length()).reduce(0, Integer::sum);
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(wordCounts < 512, "问题选项长度不用超过512");
question.setCreateUserId(accountVO.getId());
question.setCreateTime(LocalDateTime.now());
if (Objects.nonNull(questionVO.getId())) {
PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
criteria.andIdEqualTo(questionVO.getId());
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
Long exist = this.questionDAO.countByExample(example);
if (exist <= 0) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(true,
"未找到要修改的数据!");
}
questionDAO.updateByPrimaryKeyWithBLOBs(question);
} else {
questionDAO.insert(question);
}
}
/**
* 添加修改
* @param questionVO  
* @param accountVO  
*/
public void saveOrUpdate(PaperQuestionVO questionVO, AccountVO accountVO) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(questionVO.getOrgId()),"组织id不能为空");
this.checkQuestionType(questionVO,"题库目前只支持单选,多选和判断");
if (questionVO.isSelect() || questionVO.isJudge()) {
this.checkQuestionTypeForSelectAndJudge(questionVO,"单选或判断题正确答案有且只有一个!");
}else if(questionVO.isMulti()){
this.checkQuestionTypeForMulti(questionVO,"多选题正确答案必须是2个以上");
}
if(StringUtils.hasText(questionVO.getTags())){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Splitter.on(",").splitToList(questionVO.getTags()).size() <= 1,"分类最多只能有1个");
}
PaperQuestionWithBLOBs question = questionVO.convert2DB();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(question.getQuestion().length() <512,"问题字符长度不用超过512");
int wordCounts = questionVO.getOptionList().stream().map(d->d.getContent().length()).reduce(0,Integer::sum);
private void checkQuestionType(PaperQuestionVO vo, String errStr) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue((Objects.equals(BusinessConsts.TheoryType.select.name(), vo.getType())
|| Objects.equals(BusinessConsts.TheoryType.judge.name(), vo.getType())
|| Objects.equals(BusinessConsts.TheoryType.multi.name(), vo.getType())), errStr);
}
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(wordCounts <512,"问题选项长度不用超过512");
question.setCreateUserId(accountVO.getId());
question.setCreateTime(LocalDateTime.now());
if(Objects.nonNull(questionVO.getId())){
PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
criteria.andIdEqualTo(questionVO.getId());
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
Long exist = this.questionDAO.countByExample(example);
if(exist <= 0){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(true,
"未找到要修改的数据!");
}
questionDAO.updateByPrimaryKeyWithBLOBs(question);
}else{
questionDAO.insert(question);
}
private void checkQuestionTypeForSelectAndJudge(PaperQuestionVO vo, String errStr) {
long answerCount = vo.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount == 1, errStr);
}
}
private void checkQuestionTypeForMulti(PaperQuestionVO vo, String errStr) {
long answerCount = vo.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount >= 2, errStr);
}
private void checkQuestionType(PaperQuestionVO vo ,String errStr){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue((Objects.equals(BusinessConsts.TheoryType.select.name(),vo.getType())
|| Objects.equals(BusinessConsts.TheoryType.judge.name(),vo.getType())
|| Objects.equals(BusinessConsts.TheoryType.multi.name(),vo.getType())),errStr);
}
public void clearAllForOrgId(LoginUserInfoVO userInfoVO) {
PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
criteria.andOrgIdEqualTo(userInfoVO.getTopOrgId());
PaperQuestionWithBLOBs pq = new PaperQuestionWithBLOBs();
pq.setIsDel(BusinessConsts.DBLogicDelete.DELETE.ordinal());
questionDAO.updateByExampleSelective(pq, example);
}
private void checkQuestionTypeForSelectAndJudge(PaperQuestionVO vo,String errStr){
long answerCount = vo.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount == 1,errStr);
}
@Transactional
public void importProjectQuestion(List<PaperQuestionVO> questions, Long companyId, AccountVO accountVO) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(companyId), "组织id不能为空");
questions.forEach(questionVO -> {
String topic = questionVO.getTopic();
this.checkQuestionType(questionVO, String.format("题库目前只支持单选,多选和判断,题序[%s]", questionVO.getId()));
if (questionVO.isSelect() || questionVO.isJudge()) {
this.checkQuestionTypeForSelectAndJudge(questionVO, String.format("题序[%s]:单选或判断题[%s]正确答案应当有且只有一个!", questionVO.getId(), topic));
} else if (questionVO.isMulti()) {
this.checkQuestionTypeForMulti(questionVO, String.format("题序[%s]:多选题[%s]正确答案应当至少有两个以上!", questionVO.getId(), topic));
}
if (StringUtils.hasText(questionVO.getTags())) {
List<String> tagList = Splitter.on(",").splitToList(questionVO.getTags());
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(tagList.size() <= 1, "分类最多只能为1个");
}
});
private void checkQuestionTypeForMulti(PaperQuestionVO vo,String errStr){
long answerCount = vo.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount >= 2,errStr);
}
public void clearAllForOrgId(LoginUserInfoVO userInfoVO){
PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria();
criteria.andOrgIdEqualTo(userInfoVO.getTopOrgId());
PaperQuestionWithBLOBs pq = new PaperQuestionWithBLOBs();
pq.setIsDel(BusinessConsts.DBLogicDelete.DELETE.ordinal());
questionDAO.updateByExampleSelective(pq,example);
}
@Transactional
public void importProjectQuestion(List<PaperQuestionVO> questions, Long companyId, AccountVO accountVO) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(companyId),"组织id不能为空");
questions.forEach(questionVO -> {
String topic = questionVO.getTopic();
this.checkQuestionType(questionVO,String.format("题库目前只支持单选,多选和判断,题序[%s]",questionVO.getId()));
if (questionVO.isSelect() || questionVO.isJudge()) {
this.checkQuestionTypeForSelectAndJudge(questionVO,String.format("题序[%s]:单选或判断题[%s]正确答案应当有且只有一个!", questionVO.getId(),topic));
}else if(questionVO.isMulti()){
this.checkQuestionTypeForMulti(questionVO,String.format("题序[%s]:多选题[%s]正确答案应当至少有两个以上!", questionVO.getId(),topic));
}
if(StringUtils.hasText(questionVO.getTags())){
List<String> tagList = Splitter.on(",").splitToList(questionVO.getTags());
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(tagList.size() <= 1 ,"分类最多只能为1个");
}
});
questions.forEach(questionVO -> {
PaperQuestionWithBLOBs question = questionVO.convert2DB();
question.setOrgId(companyId);
question.setCreateUserId(accountVO.getId());
question.setCreateTime(LocalDateTime.now());
questionDAO.insert(question);
});
questions.forEach(questionVO -> {
PaperQuestionWithBLOBs question = questionVO.convert2DB();
question.setOrgId(companyId);
question.setCreateUserId(accountVO.getId());
question.setCreateTime(LocalDateTime.now());
questionDAO.insert(question);
});
}
}
/**
* 删除 逻辑删除
* @param questionId 文本id
*/
public void deleteQuestion(List<Long> questionId) {
PaperQuestionExample example = new PaperQuestionExample();
example.createCriteria().andIdIn(questionId);
PaperQuestionWithBLOBs pq = new PaperQuestionWithBLOBs();
pq.setIsDel(BusinessConsts.DBLogicDelete.DELETE.ordinal());
questionDAO.updateByExampleSelective(pq,example);
}
/**
* 删除 逻辑删除
*
* @param questionId 文本id
*/
public void deleteQuestion(List<Long> questionId) {
PaperQuestionExample example = new PaperQuestionExample();
example.createCriteria().andIdIn(questionId);
PaperQuestionWithBLOBs pq = new PaperQuestionWithBLOBs();
pq.setIsDel(BusinessConsts.DBLogicDelete.DELETE.ordinal());
questionDAO.updateByExampleSelective(pq, example);
}
}

View File

@ -1,13 +1,21 @@
package club.joylink.rtss.services.race;
import club.joylink.rtss.dao.racetr.RacetrPaperDAO;
import club.joylink.rtss.dao.racetr.RacetrSeasonDAO;
import club.joylink.rtss.entity.racetr.RacetrPaper;
import club.joylink.rtss.entity.racetr.RacetrPaperExample;
import club.joylink.rtss.entity.racetr.RacetrSeason;
import club.joylink.rtss.entity.racetr.RacetrSeasonExample;
import club.joylink.rtss.entity.racetr.RacetrSeasonExample.Criteria;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.common.ModifyInfo.ModifyInfoVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperCreateVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperDetailVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperMenuVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperMenuVO.PaperMenu;
import club.joylink.rtss.vo.race.RacePaper.RacePaperMenuVO.SeasonMenu;
import club.joylink.rtss.vo.race.RacePaper.RacePaperModuleVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperModuleVO.PaperModule;
import club.joylink.rtss.vo.race.RacePaper.RacePaperVO;
@ -43,6 +51,8 @@ public class RacePaperService {
private RacetrPaperDAO paperDAO;
@Autowired
private RaceTaskService taskService;
@Autowired
private RacetrSeasonDAO seasonDAO;
private RacetrPaper findId(Long id) {
RacetrPaper rp = this.paperDAO.selectByPrimaryKey(id);
@ -74,6 +84,58 @@ public class RacePaperService {
}
private List<RacetrSeason> findSeasonMenu(Group group) {
RacetrSeasonExample example = new RacetrSeasonExample();
Criteria c = example.createCriteria();
if (Objects.nonNull(group) && group != Group.Unknown) {
c.andGroupEqualTo(group.name());
}
List<RacetrSeason> seasons = this.seasonDAO.selectByExampleWithBLOBs(example);
return seasons;
}
public RacePaperMenuVO pageMenuQuery(RacePaperQueryVO query) {
Group group = Group.Unknown;
if (StringUtils.isNotEmpty(query.getGroup())) {
group = Group.valueOf(query.getGroup());
}
List<RacetrSeason> seasons = this.findSeasonMenu(group);
RacePaperMenuVO.Builder menuBuilder = RacePaperMenuVO.newBuilder();
if (CollectionUtils.isEmpty(seasons)) {
return menuBuilder.build();
}
List<Long> seasonIdList = seasons.stream().map(RacetrSeason::getId).collect(Collectors.toList());
RacetrPaperExample paperExample = new RacetrPaperExample();
paperExample.createCriteria().andSeasonIdIn(seasonIdList);
List<RacetrPaper> papers = this.paperDAO.selectByExample(paperExample);
Map<Long, List<RacetrPaper>> paperMapList = papers.stream().collect(Collectors.groupingBy(RacetrPaper::getSeasonId));
for (RacetrSeason season : seasons) {
SeasonMenu.Builder sm = SeasonMenu.newBuilder();
sm.setSeasonId(season.getId());
sm.setSeasonName(season.getTerm());
sm.setSeasonCode(season.getCode());
if (StringUtils.isNotEmpty(season.getDetailHtmlContent())) {
sm.setDetailHtmlContent(season.getDetailHtmlContent());
}
this.convertPaperMenu(sm, paperMapList);
menuBuilder.addMenu(sm);
}
return menuBuilder.build();
}
private void convertPaperMenu(SeasonMenu.Builder seasonBuild, Map<Long, List<RacetrPaper>> paperMapList) {
List<RacetrPaper> paperList = paperMapList.get(seasonBuild.getSeasonId());
if (!CollectionUtils.isEmpty(paperList)) {
for (RacetrPaper paper : paperList) {
PaperMenu.Builder pm = PaperMenu.newBuilder();
pm.setId(paper.getId());
pm.setName(paper.getName());
seasonBuild.addPapers(pm);
}
}
}
public PageVO<RacePaperVO> pageQuery(RacePaperQueryVO query) {
if (!StringUtils.equalsAny(query.getGroup(), Group.GZ.name(), Group.ZZ.name())) {

View File

@ -7,7 +7,9 @@ import club.joylink.rtss.entity.racetr.RacetrScene;
import club.joylink.rtss.entity.racetr.RacetrSceneExample;
import club.joylink.rtss.entity.racetr.RacetrTaskExample;
import club.joylink.rtss.entity.training2.DraftTraining2WithBLOBs;
import club.joylink.rtss.exception.BusinessExceptionAssert;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.exception.RacetrExceptionAssert;
import club.joylink.rtss.simulation.cbtc.training2.Training2;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.AccountVO;
@ -34,6 +36,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
@Service
@Slf4j
@ -72,6 +75,7 @@ public class RaceSceneService {
return vo.build();
}
public List<RaceSceneListVO> convertDto(List<RaceScenePageVO> list) {
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
@ -93,10 +97,16 @@ public class RaceSceneService {
}
public void publishHere(RaceScenePublishVO vo, AccountVO user) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(StringUtils.hasText(vo.getName()), "请输入发布场景的名称");
String publishName = vo.getName().trim();
PublishHereVO phvo = this.createSceneProto(vo.getDafitid());
RacetrSceneExample sceneExample = new RacetrSceneExample();
sceneExample.createCriteria().andDraftTrainingIdEqualTo(vo.getDafitid());
sceneExample.createCriteria().andNameEqualTo(publishName);
// sceneExample.createCriteria().andDraftTrainingIdEqualTo(vo.getDafitid());
List<RacetrScene> rsList = this.sceneDAO.selectByExample(sceneExample);
if (!CollectionUtils.isEmpty(rsList) && Objects.equals(vo.getForcePublish(), false)) {
RacetrExceptionAssert.publishSceneNotForce.fail();
}
LocalDateTime now = LocalDateTime.now();
RacetrScene rs;
boolean sceneExist = false;
@ -113,7 +123,7 @@ public class RaceSceneService {
rs.setUpdaterId(user.getId());
rs.setUpdateTime(now);
rs.setMapId(phvo.mapId);
rs.setName(vo.getName());
rs.setName(publishName);
Scene.Builder sceneBu = Scene.newBuilder();
sceneBu.setStorageSimulation(phvo.getStorageSimulation());
rs.setProto(sceneBu.build().toByteArray());

View File

@ -49,6 +49,21 @@ public class RaceSeasonService {
return rs;
}
public void updateHtmlContent(Long id, String htmlContent, AccountVO user) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(StringUtils.isNotEmpty(htmlContent), "请填写需要展示的内容");
LocalDateTime now = LocalDateTime.now();
RacetrSeason rr = this.find(id);
rr.setUpdaterId(user.getId());
rr.setUdpateTime(now);
rr.setDetailHtmlContent(htmlContent);
this.seasonDAO.updateByPrimaryKeySelective(rr);
}
public String queryHtmlContent(Long id) {
RacetrSeason rr = this.find(id);
return rr.getDetailHtmlContent();
}
public void save(RaceSeasonCreateVO dto, AccountVO user) {
LocalDateTime now = LocalDateTime.now();
RacetrSeason rs = new RacetrSeason();

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: common/modify_info.proto
// source: modify_info.proto
package club.joylink.rtss.vo.common;
@ -1146,12 +1146,12 @@ public final class ModifyInfo {
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\030common/modify_info.proto\022\006common\"\214\001\n\014M" +
"odifyInfoVO\022\022\n\ncreator_id\030\001 \001(\003\022\023\n\013creat" +
"e_time\030\002 \001(\t\022\022\n\nupdater_id\030\003 \001(\003\022\023\n\013upda" +
"te_time\030\004 \001(\t\022\024\n\014creator_name\030\005 \001(\t\022\024\n\014u" +
"pdater_name\030\006 \001(\tB\035\n\033club.joylink.rtss.v" +
"o.commonb\006proto3"
"\n\021modify_info.proto\022\006common\"\214\001\n\014ModifyIn" +
"foVO\022\022\n\ncreator_id\030\001 \001(\003\022\023\n\013create_time\030" +
"\002 \001(\t\022\022\n\nupdater_id\030\003 \001(\003\022\023\n\013update_time" +
"\030\004 \001(\t\022\024\n\014creator_name\030\005 \001(\t\022\024\n\014updater_" +
"name\030\006 \001(\tB\035\n\033club.joylink.rtss.vo.commo" +
"nb\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: common/page_query.proto
// source: page_query.proto
package club.joylink.rtss.vo.common;
@ -552,9 +552,9 @@ public final class PageQuery {
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\027common/page_query.proto\022\006common\")\n\013Pag" +
"eQueryVO\022\014\n\004page\030\001 \001(\005\022\014\n\004size\030\002 \001(\005B\035\n\033" +
"club.joylink.rtss.vo.commonb\006proto3"
"\n\020page_query.proto\022\006common\")\n\013PageQueryV" +
"O\022\014\n\004page\030\001 \001(\005\022\014\n\004size\030\002 \001(\005B\035\n\033club.jo" +
"ylink.rtss.vo.commonb\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: race/race_application.proto
// source: race_application.proto
package club.joylink.rtss.vo.race;
@ -2107,15 +2107,15 @@ public final class RaceApplication {
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\033race/race_application.proto\022\004race\032\024rac" +
"e/race_task.proto\"N\n\022RacePracticeResult\022" +
"\030\n\020custom_module_id\030\001 \001(\005\022\036\n\004node\030\002 \003(\0132" +
"\020.race.ResultNode\"\241\001\n\nResultNode\022\014\n\004name" +
"\030\001 \001(\t\022\021\n\tfullScore\030\002 \001(\002\022\r\n\005score\030\003 \001(\002" +
"\0221\n\004type\030\004 \001(\0162#.race.RaceTaskChildVO.Ch" +
"ildNodeType\022\037\n\005child\030\005 \003(\0132\020.race.Result" +
"Node\022\017\n\007sceneId\030\006 \001(\003B\033\n\031club.joylink.rt" +
"ss.vo.raceb\006proto3"
"\n\026race_application.proto\022\004race\032\024race/rac" +
"e_task.proto\"N\n\022RacePracticeResult\022\030\n\020cu" +
"stom_module_id\030\001 \001(\005\022\036\n\004node\030\002 \003(\0132\020.rac" +
"e.ResultNode\"\241\001\n\nResultNode\022\014\n\004name\030\001 \001(" +
"\t\022\021\n\tfullScore\030\002 \001(\002\022\r\n\005score\030\003 \001(\002\0221\n\004t" +
"ype\030\004 \001(\0162#.race.RaceTaskChildVO.ChildNo" +
"deType\022\037\n\005child\030\005 \003(\0132\020.race.ResultNode\022" +
"\017\n\007sceneId\030\006 \001(\003B\033\n\031club.joylink.rtss.vo" +
".raceb\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: race/race_module.proto
// source: race_module.proto
package club.joylink.rtss.vo.race;
@ -5593,23 +5593,23 @@ public final class RaceModule {
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\026race/race_module.proto\022\004race\032\030common/m" +
"odify_info.proto\"\256\001\n\014RaceModuleVO\022\n\n\002id\030" +
"\001 \001(\003\022\014\n\004code\030\003 \001(\t\022\014\n\004desc\030\004 \001(\t\022\020\n\010pap" +
"er_id\030\005 \001(\003\022\'\n\014task_setting\030\006 \001(\0132\021.race" +
".TaskSetting\022\020\n\010duration\030\007 \001(\005\022)\n\013modify" +
"_info\030\010 \001(\0132\024.common.ModifyInfoVO\"\235\001\n\020Ra" +
"ceModuleListVO\022\n\n\002id\030\001 \001(\003\022\014\n\004code\030\003 \001(\t" +
"\022\014\n\004desc\030\004 \001(\t\022\020\n\010paper_id\030\005 \001(\003\022\022\n\npape" +
"r_name\030\006 \001(\t\022\020\n\010duration\030\007 \001(\005\022)\n\013modify" +
"_info\030\010 \001(\0132\024.common.ModifyInfoVO\"T\n\022Rac" +
"eModuleCreateVO\022\014\n\004code\030\001 \001(\t\022\014\n\004desc\030\002 " +
"\001(\t\022\020\n\010paper_id\030\003 \001(\003\022\020\n\010duration\030\004 \001(\005\"" +
"\206\001\n\013TaskSetting\022&\n\005group\030\002 \003(\0132\027.race.Ta" +
"skSetting.Group\032O\n\005Group\022\020\n\010task_ids\030\001 \003" +
"(\003\022&\n\005group\030\002 \003(\0132\027.race.TaskSetting.Gro" +
"up\022\014\n\004name\030\003 \001(\tB\033\n\031club.joylink.rtss.vo" +
".raceb\006proto3"
"\n\021race_module.proto\022\004race\032\030common/modify" +
"_info.proto\"\256\001\n\014RaceModuleVO\022\n\n\002id\030\001 \001(\003" +
"\022\014\n\004code\030\003 \001(\t\022\014\n\004desc\030\004 \001(\t\022\020\n\010paper_id" +
"\030\005 \001(\003\022\'\n\014task_setting\030\006 \001(\0132\021.race.Task" +
"Setting\022\020\n\010duration\030\007 \001(\005\022)\n\013modify_info" +
"\030\010 \001(\0132\024.common.ModifyInfoVO\"\235\001\n\020RaceMod" +
"uleListVO\022\n\n\002id\030\001 \001(\003\022\014\n\004code\030\003 \001(\t\022\014\n\004d" +
"esc\030\004 \001(\t\022\020\n\010paper_id\030\005 \001(\003\022\022\n\npaper_nam" +
"e\030\006 \001(\t\022\020\n\010duration\030\007 \001(\005\022)\n\013modify_info" +
"\030\010 \001(\0132\024.common.ModifyInfoVO\"T\n\022RaceModu" +
"leCreateVO\022\014\n\004code\030\001 \001(\t\022\014\n\004desc\030\002 \001(\t\022\020" +
"\n\010paper_id\030\003 \001(\003\022\020\n\010duration\030\004 \001(\005\"\206\001\n\013T" +
"askSetting\022&\n\005group\030\002 \003(\0132\027.race.TaskSet" +
"ting.Group\032O\n\005Group\022\020\n\010task_ids\030\001 \003(\003\022&\n" +
"\005group\030\002 \003(\0132\027.race.TaskSetting.Group\022\014\n" +
"\004name\030\003 \001(\tB\033\n\031club.joylink.rtss.vo.race" +
"b\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,7 @@ public class RacePaperPageVO {
private Boolean supportCopy;
private Long seasonId;
private String seasonName;
private String seasonTerm;
private Long creatorId;
private LocalDateTime createTime;
private Long updaterId;

View File

@ -16,4 +16,5 @@ public class RacePaperQueryVO extends PageQueryVO {
private Long seasonId;
private String seasonName;
private boolean querySeasonHtml;
}

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: race/race_scene.proto
// source: race_scene.proto
package club.joylink.rtss.vo.race;
@ -2554,6 +2554,16 @@ public final class RaceSceneOuterClass {
*/
com.google.protobuf.ByteString
getNameBytes();
/**
* <pre>
*是否强制更新
* </pre>
*
* <code>bool force_publish = 4;</code>
* @return The forcePublish.
*/
boolean getForcePublish();
}
/**
* Protobuf type {@code race.RaceScenePublishVO}
@ -2653,6 +2663,21 @@ public final class RaceSceneOuterClass {
}
}
public static final int FORCE_PUBLISH_FIELD_NUMBER = 4;
private boolean forcePublish_ = false;
/**
* <pre>
*是否强制更新
* </pre>
*
* <code>bool force_publish = 4;</code>
* @return The forcePublish.
*/
@java.lang.Override
public boolean getForcePublish() {
return forcePublish_;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
@ -2673,6 +2698,9 @@ public final class RaceSceneOuterClass {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 3, name_);
}
if (forcePublish_ != false) {
output.writeBool(4, forcePublish_);
}
getUnknownFields().writeTo(output);
}
@ -2689,6 +2717,10 @@ public final class RaceSceneOuterClass {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, name_);
}
if (forcePublish_ != false) {
size += com.google.protobuf.CodedOutputStream
.computeBoolSize(4, forcePublish_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
@ -2708,6 +2740,8 @@ public final class RaceSceneOuterClass {
!= other.getDafitid()) return false;
if (!getName()
.equals(other.getName())) return false;
if (getForcePublish()
!= other.getForcePublish()) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@ -2724,6 +2758,9 @@ public final class RaceSceneOuterClass {
getDafitid());
hash = (37 * hash) + NAME_FIELD_NUMBER;
hash = (53 * hash) + getName().hashCode();
hash = (37 * hash) + FORCE_PUBLISH_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getForcePublish());
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
@ -2857,6 +2894,7 @@ public final class RaceSceneOuterClass {
bitField0_ = 0;
dafitid_ = 0L;
name_ = "";
forcePublish_ = false;
return this;
}
@ -2896,6 +2934,9 @@ public final class RaceSceneOuterClass {
if (((from_bitField0_ & 0x00000002) != 0)) {
result.name_ = name_;
}
if (((from_bitField0_ & 0x00000004) != 0)) {
result.forcePublish_ = forcePublish_;
}
}
@java.lang.Override
@ -2918,6 +2959,9 @@ public final class RaceSceneOuterClass {
bitField0_ |= 0x00000002;
onChanged();
}
if (other.getForcePublish() != false) {
setForcePublish(other.getForcePublish());
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
@ -2954,6 +2998,11 @@ public final class RaceSceneOuterClass {
bitField0_ |= 0x00000002;
break;
} // case 26
case 32: {
forcePublish_ = input.readBool();
bitField0_ |= 0x00000004;
break;
} // case 32
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
@ -3106,6 +3155,50 @@ public final class RaceSceneOuterClass {
onChanged();
return this;
}
private boolean forcePublish_ ;
/**
* <pre>
*是否强制更新
* </pre>
*
* <code>bool force_publish = 4;</code>
* @return The forcePublish.
*/
@java.lang.Override
public boolean getForcePublish() {
return forcePublish_;
}
/**
* <pre>
*是否强制更新
* </pre>
*
* <code>bool force_publish = 4;</code>
* @param value The forcePublish to set.
* @return This builder for chaining.
*/
public Builder setForcePublish(boolean value) {
forcePublish_ = value;
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
* <pre>
*是否强制更新
* </pre>
*
* <code>bool force_publish = 4;</code>
* @return This builder for chaining.
*/
public Builder clearForcePublish() {
bitField0_ = (bitField0_ & ~0x00000004);
forcePublish_ = false;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
@ -5593,26 +5686,26 @@ public final class RaceSceneOuterClass {
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\025race/race_scene.proto\022\004race\032\030common/mo" +
"dify_info.proto\"\305\001\n\013RaceSceneVO\022\n\n\002id\030\001 " +
"\001(\003\022\014\n\004name\030\002 \001(\t\022\"\n\004type\030\003 \001(\0162\024.race.R" +
"aceScene.Type\022\022\n\nfunctionId\030\004 \001(\003\022\032\n\005sce" +
"ne\030\005 \001(\0132\013.race.Scene\022(\n\nmodifyInfo\030\006 \001(" +
"\0132\024.common.ModifyInfoVO\022\r\n\005mapId\030\007 \001(\003\022\017" +
"\n\007mapName\030\010 \001(\t\"\234\001\n\017RaceSceneListVO\022\n\n\002i" +
"d\030\001 \001(\003\022\014\n\004name\030\002 \001(\t\022\"\n\004type\030\003 \001(\0162\024.ra" +
"ce.RaceScene.Type\022\016\n\006map_id\030\004 \001(\003\022\020\n\010map" +
"_name\030\005 \001(\t\022)\n\013modify_info\030\006 \001(\0132\024.commo" +
"n.ModifyInfoVO\"3\n\022RaceScenePublishVO\022\017\n\007" +
"dafitid\030\001 \001(\003\022\014\n\004name\030\003 \001(\t\"I\n\005Scene\022\013\n\003" +
"url\030\001 \001(\t\0223\n\022storage_simulation\030\002 \001(\0132\027." +
"race.StorageSimulation\"\201\001\n\021StorageSimula" +
"tion\022\025\n\rbg_scene_json\030\001 \001(\t\022\021\n\tstep_json" +
"\030\002 \001(\t\022\023\n\013member_json\030\003 \001(\t\022\022\n\nplayer_id" +
"s\030\004 \003(\t\022\031\n\021scoring_rule_json\030\005 \001(\t\"5\n\tRa" +
"ceScene\"(\n\004Type\022\013\n\007Unknown\020\000\022\t\n\005Local\020\001\022" +
"\010\n\004Link\020\002B\033\n\031club.joylink.rtss.vo.raceb\006" +
"proto3"
"\n\020race_scene.proto\022\004race\032\030common/modify_" +
"info.proto\"\305\001\n\013RaceSceneVO\022\n\n\002id\030\001 \001(\003\022\014" +
"\n\004name\030\002 \001(\t\022\"\n\004type\030\003 \001(\0162\024.race.RaceSc" +
"ene.Type\022\022\n\nfunctionId\030\004 \001(\003\022\032\n\005scene\030\005 " +
"\001(\0132\013.race.Scene\022(\n\nmodifyInfo\030\006 \001(\0132\024.c" +
"ommon.ModifyInfoVO\022\r\n\005mapId\030\007 \001(\003\022\017\n\007map" +
"Name\030\010 \001(\t\"\234\001\n\017RaceSceneListVO\022\n\n\002id\030\001 \001" +
"(\003\022\014\n\004name\030\002 \001(\t\022\"\n\004type\030\003 \001(\0162\024.race.Ra" +
"ceScene.Type\022\016\n\006map_id\030\004 \001(\003\022\020\n\010map_name" +
"\030\005 \001(\t\022)\n\013modify_info\030\006 \001(\0132\024.common.Mod" +
"ifyInfoVO\"J\n\022RaceScenePublishVO\022\017\n\007dafit" +
"id\030\001 \001(\003\022\014\n\004name\030\003 \001(\t\022\025\n\rforce_publish\030" +
"\004 \001(\010\"I\n\005Scene\022\013\n\003url\030\001 \001(\t\0223\n\022storage_s" +
"imulation\030\002 \001(\0132\027.race.StorageSimulation" +
"\"\201\001\n\021StorageSimulation\022\025\n\rbg_scene_json\030" +
"\001 \001(\t\022\021\n\tstep_json\030\002 \001(\t\022\023\n\013member_json\030" +
"\003 \001(\t\022\022\n\nplayer_ids\030\004 \003(\t\022\031\n\021scoring_rul" +
"e_json\030\005 \001(\t\"5\n\tRaceScene\"(\n\004Type\022\013\n\007Unk" +
"nown\020\000\022\t\n\005Local\020\001\022\010\n\004Link\020\002B\033\n\031club.joyl" +
"ink.rtss.vo.raceb\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
@ -5636,7 +5729,7 @@ public final class RaceSceneOuterClass {
internal_static_race_RaceScenePublishVO_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_race_RaceScenePublishVO_descriptor,
new java.lang.String[] { "Dafitid", "Name", });
new java.lang.String[] { "Dafitid", "Name", "ForcePublish", });
internal_static_race_Scene_descriptor =
getDescriptor().getMessageTypes().get(3);
internal_static_race_Scene_fieldAccessorTable = new

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: race/race_scoring_rule.proto
// source: race_scoring_rule.proto
package club.joylink.rtss.vo.race;
@ -4081,18 +4081,18 @@ public final class RaceScoringRule {
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\034race/race_scoring_rule.proto\022\004race\032\030co" +
"mmon/modify_info.proto\"r\n\021RaceScoringRul" +
"eVO\022\n\n\002id\030\001 \001(\003\022\014\n\004name\030\002 \001(\t\022\030\n\004rule\030\003 " +
"\001(\0132\n.race.Rule\022)\n\013modify_info\030\004 \001(\0132\024.c" +
"ommon.ModifyInfoVO\"\\\n\025RaceScoringRuleLis" +
"tVO\022\n\n\002id\030\001 \001(\003\022\014\n\004name\030\002 \001(\t\022)\n\013modify_" +
"info\030\003 \001(\0132\024.common.ModifyInfoVO\"\214\001\n\004Rul" +
"e\022\036\n\005units\030\001 \003(\0132\017.race.Rule.Unit\032d\n\004Uni" +
"t\022\014\n\004name\030\001 \001(\t\022\r\n\005score\030\002 \001(\r\022\020\n\010criter" +
"ia\030\004 \001(\t\022!\n\010children\030\005 \003(\0132\017.race.Rule.U" +
"nit\022\n\n\002id\030\006 \001(\tB\033\n\031club.joylink.rtss.vo." +
"raceb\006proto3"
"\n\027race_scoring_rule.proto\022\004race\032\030common/" +
"modify_info.proto\"r\n\021RaceScoringRuleVO\022\n" +
"\n\002id\030\001 \001(\003\022\014\n\004name\030\002 \001(\t\022\030\n\004rule\030\003 \001(\0132\n" +
".race.Rule\022)\n\013modify_info\030\004 \001(\0132\024.common" +
".ModifyInfoVO\"\\\n\025RaceScoringRuleListVO\022\n" +
"\n\002id\030\001 \001(\003\022\014\n\004name\030\002 \001(\t\022)\n\013modify_info\030" +
"\003 \001(\0132\024.common.ModifyInfoVO\"\214\001\n\004Rule\022\036\n\005" +
"units\030\001 \003(\0132\017.race.Rule.Unit\032d\n\004Unit\022\014\n\004" +
"name\030\001 \001(\t\022\r\n\005score\030\002 \001(\r\022\020\n\010criteria\030\004 " +
"\001(\t\022!\n\010children\030\005 \003(\0132\017.race.Rule.Unit\022\n" +
"\n\002id\030\006 \001(\tB\033\n\031club.joylink.rtss.vo.raceb" +
"\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: race/race_season.proto
// source: race_season.proto
package club.joylink.rtss.vo.race;
@ -2495,16 +2495,16 @@ public final class RaceSeasonOuterClass {
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\026race/race_season.proto\022\004race\032\030common/m" +
"odify_info.proto\"\210\001\n\014RaceSeasonVO\022\n\n\002id\030" +
"\001 \001(\003\022\014\n\004code\030\002 \001(\t\022%\n\005group\030\003 \001(\0162\026.rac" +
"e.RaceSeason.Group\022\014\n\004term\030\004 \001(\t\022)\n\013modi" +
"fy_info\030\005 \001(\0132\024.common.ModifyInfoVO\"W\n\022R" +
"aceSeasonCreateVO\022\014\n\004code\030\001 \001(\t\022%\n\005group" +
"\030\002 \001(\0162\026.race.RaceSeason.Group\022\014\n\004term\030\003" +
" \001(\t\"2\n\nRaceSeason\"$\n\005Group\022\013\n\007Unknown\020\000" +
"\022\006\n\002ZZ\020\001\022\006\n\002GZ\020\002B\033\n\031club.joylink.rtss.vo" +
".raceb\006proto3"
"\n\021race_season.proto\022\004race\032\030common/modify" +
"_info.proto\"\210\001\n\014RaceSeasonVO\022\n\n\002id\030\001 \001(\003" +
"\022\014\n\004code\030\002 \001(\t\022%\n\005group\030\003 \001(\0162\026.race.Rac" +
"eSeason.Group\022\014\n\004term\030\004 \001(\t\022)\n\013modify_in" +
"fo\030\005 \001(\0132\024.common.ModifyInfoVO\"W\n\022RaceSe" +
"asonCreateVO\022\014\n\004code\030\001 \001(\t\022%\n\005group\030\002 \001(" +
"\0162\026.race.RaceSeason.Group\022\014\n\004term\030\003 \001(\t\"" +
"2\n\nRaceSeason\"$\n\005Group\022\013\n\007Unknown\020\000\022\006\n\002Z" +
"Z\020\001\022\006\n\002GZ\020\002B\033\n\031club.joylink.rtss.vo.race" +
"b\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: race/race_task.proto
// source: race_task.proto
package club.joylink.rtss.vo.race;
@ -10729,44 +10729,43 @@ public final class RaceTask {
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\024race/race_task.proto\022\004race\032\030common/mod" +
"ify_info.proto\032\025race/race_scene.proto\"\266\001" +
"\n\nRaceTaskVO\022\n\n\002id\030\001 \001(\003\022\014\n\004name\030\002 \001(\t\022\014" +
"\n\004desc\030\003 \001(\t\022\017\n\007content\030\004 \001(\t\022\021\n\tstandar" +
"ds\030\005 \001(\t\022 \n\005scene\030\006 \001(\0132\021.race.RaceScene" +
"VO\022\020\n\010parentId\030\007 \001(\003\022(\n\nmodifyInfo\030\010 \001(\013" +
"2\024.common.ModifyInfoVO\"\344\001\n\020RaceTaskDetai" +
"lVO\022\n\n\002id\030\001 \001(\003\022\014\n\004name\030\002 \001(\t\022\014\n\004desc\030\003 " +
"\001(\t\022\017\n\007content\030\004 \001(\t\022\021\n\tstandards\030\005 \001(\t\022" +
"\020\n\010scene_id\030\006 \001(\003\022\021\n\tsceneName\030\007 \001(\t\022\017\n\007" +
"rule_id\030\010 \001(\003\022\020\n\010ruleName\030\t \001(\t\022\021\n\tparen" +
"t_id\030\n \001(\003\022)\n\013modify_info\030\013 \001(\0132\024.common" +
".ModifyInfoVO\"w\n\020RaceTaskCreateVO\022\014\n\004nam" +
"e\030\001 \001(\t\022\014\n\004desc\030\002 \001(\t\022\017\n\007content\030\003 \001(\t\022\021" +
"\n\tstandards\030\004 \001(\t\022\020\n\010scene_id\030\005 \001(\003\022\021\n\tp" +
"arent_id\030\006 \001(\003\"\210\001\n\014RaceTaskBind\022\017\n\007bind_" +
"id\030\002 \001(\003\0222\n\tbind_type\030\003 \001(\0162\037.race.RaceT" +
"askBind.TaskBindType\022\016\n\006status\030\004 \001(\005\"#\n\014" +
"TaskBindType\022\010\n\004rule\020\000\022\t\n\005scene\020\001\"\205\002\n\023Ra" +
"cePaperModuleTask\022\030\n\020custom_module_id\030\001 " +
"\001(\005\022@\n\014module_group\030\002 \003(\0132*.race.RacePap" +
"erModuleTask.PaperModuleGroup\032\221\001\n\020PaperM" +
"oduleGroup\022\022\n\ngroup_name\030\001 \001(\t\022\'\n\010treeDa" +
"ta\030\002 \003(\0132\025.race.RaceTaskChildVO\022@\n\014modul" +
"e_group\030\003 \003(\0132*.race.RacePaperModuleTask" +
".PaperModuleGroup\"\312\002\n\017RaceTaskChildVO\022\n\n" +
"\002id\030\001 \001(\003\022\014\n\004name\030\002 \001(\t\022\014\n\004desc\030\003 \001(\t\022\017\n" +
"\007content\030\004 \001(\t\022\021\n\tstandards\030\005 \001(\t\022\020\n\010sce" +
"ne_id\030\006 \001(\003\022\017\n\007rule_id\030\007 \001(\003\022\021\n\tparent_i" +
"d\030\010 \001(\003\022\'\n\010children\030\t \003(\0132\025.race.RaceTas" +
"kChildVO\0226\n\tnode_type\030\n \001(\0162#.race.RaceT" +
"askChildVO.ChildNodeType\022\'\n\tsceneType\030\013 " +
"\001(\0162\024.race.RaceScene.Type\"+\n\rChildNodeTy" +
"pe\022\020\n\014MODULE_GROUP\020\000\022\010\n\004TASK\020\001\"`\n\036RacePa" +
"perSingleModuleGroupTask\022\030\n\020custom_modul" +
"e_id\030\001 \001(\005\022$\n\005child\030\002 \003(\0132\025.race.RaceTas" +
"kChildVOB\033\n\031club.joylink.rtss.vo.raceb\006p" +
"roto3"
"\n\017race_task.proto\022\004race\032\030common/modify_i" +
"nfo.proto\032\025race/race_scene.proto\"\266\001\n\nRac" +
"eTaskVO\022\n\n\002id\030\001 \001(\003\022\014\n\004name\030\002 \001(\t\022\014\n\004des" +
"c\030\003 \001(\t\022\017\n\007content\030\004 \001(\t\022\021\n\tstandards\030\005 " +
"\001(\t\022 \n\005scene\030\006 \001(\0132\021.race.RaceSceneVO\022\020\n" +
"\010parentId\030\007 \001(\003\022(\n\nmodifyInfo\030\010 \001(\0132\024.co" +
"mmon.ModifyInfoVO\"\344\001\n\020RaceTaskDetailVO\022\n" +
"\n\002id\030\001 \001(\003\022\014\n\004name\030\002 \001(\t\022\014\n\004desc\030\003 \001(\t\022\017" +
"\n\007content\030\004 \001(\t\022\021\n\tstandards\030\005 \001(\t\022\020\n\010sc" +
"ene_id\030\006 \001(\003\022\021\n\tsceneName\030\007 \001(\t\022\017\n\007rule_" +
"id\030\010 \001(\003\022\020\n\010ruleName\030\t \001(\t\022\021\n\tparent_id\030" +
"\n \001(\003\022)\n\013modify_info\030\013 \001(\0132\024.common.Modi" +
"fyInfoVO\"w\n\020RaceTaskCreateVO\022\014\n\004name\030\001 \001" +
"(\t\022\014\n\004desc\030\002 \001(\t\022\017\n\007content\030\003 \001(\t\022\021\n\tsta" +
"ndards\030\004 \001(\t\022\020\n\010scene_id\030\005 \001(\003\022\021\n\tparent" +
"_id\030\006 \001(\003\"\210\001\n\014RaceTaskBind\022\017\n\007bind_id\030\002 " +
"\001(\003\0222\n\tbind_type\030\003 \001(\0162\037.race.RaceTaskBi" +
"nd.TaskBindType\022\016\n\006status\030\004 \001(\005\"#\n\014TaskB" +
"indType\022\010\n\004rule\020\000\022\t\n\005scene\020\001\"\205\002\n\023RacePap" +
"erModuleTask\022\030\n\020custom_module_id\030\001 \001(\005\022@" +
"\n\014module_group\030\002 \003(\0132*.race.RacePaperMod" +
"uleTask.PaperModuleGroup\032\221\001\n\020PaperModule" +
"Group\022\022\n\ngroup_name\030\001 \001(\t\022\'\n\010treeData\030\002 " +
"\003(\0132\025.race.RaceTaskChildVO\022@\n\014module_gro" +
"up\030\003 \003(\0132*.race.RacePaperModuleTask.Pape" +
"rModuleGroup\"\312\002\n\017RaceTaskChildVO\022\n\n\002id\030\001" +
" \001(\003\022\014\n\004name\030\002 \001(\t\022\014\n\004desc\030\003 \001(\t\022\017\n\007cont" +
"ent\030\004 \001(\t\022\021\n\tstandards\030\005 \001(\t\022\020\n\010scene_id" +
"\030\006 \001(\003\022\017\n\007rule_id\030\007 \001(\003\022\021\n\tparent_id\030\010 \001" +
"(\003\022\'\n\010children\030\t \003(\0132\025.race.RaceTaskChil" +
"dVO\0226\n\tnode_type\030\n \001(\0162#.race.RaceTaskCh" +
"ildVO.ChildNodeType\022\'\n\tsceneType\030\013 \001(\0162\024" +
".race.RaceScene.Type\"+\n\rChildNodeType\022\020\n" +
"\014MODULE_GROUP\020\000\022\010\n\004TASK\020\001\"`\n\036RacePaperSi" +
"ngleModuleGroupTask\022\030\n\020custom_module_id\030" +
"\001 \001(\005\022$\n\005child\030\002 \003(\0132\025.race.RaceTaskChil" +
"dVOB\033\n\031club.joylink.rtss.vo.raceb\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,

View File

@ -11,6 +11,9 @@
<result column="updater_id" jdbcType="BIGINT" property="updaterId" />
<result column="udpate_time" jdbcType="TIMESTAMP" property="udpateTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.racetr.RacetrSeason">
<result column="detail_html_content" jdbcType="LONGVARCHAR" property="detailHtmlContent" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
@ -72,6 +75,33 @@
<sql id="Base_Column_List">
id, code, `group`, term, creator_id, create_time, updater_id, udpate_time
</sql>
<sql id="Blob_Column_List">
detail_html_content
</sql>
<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.racetr.RacetrSeasonExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from racetr_season
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.racetr.RacetrSeasonExample" resultMap="BaseResultMap">
select
<if test="distinct">
@ -94,9 +124,11 @@
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from racetr_season
where id = #{id,jdbcType=BIGINT}
</select>
@ -113,10 +145,10 @@
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.racetr.RacetrSeason" useGeneratedKeys="true">
insert into racetr_season (code, `group`, term,
creator_id, create_time, updater_id,
udpate_time)
udpate_time, detail_html_content)
values (#{code,jdbcType=VARCHAR}, #{group,jdbcType=VARCHAR}, #{term,jdbcType=VARCHAR},
#{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updaterId,jdbcType=BIGINT},
#{udpateTime,jdbcType=TIMESTAMP})
#{udpateTime,jdbcType=TIMESTAMP}, #{detailHtmlContent,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.racetr.RacetrSeason" useGeneratedKeys="true">
insert into racetr_season
@ -142,6 +174,9 @@
<if test="udpateTime != null">
udpate_time,
</if>
<if test="detailHtmlContent != null">
detail_html_content,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">
@ -165,6 +200,9 @@
<if test="udpateTime != null">
#{udpateTime,jdbcType=TIMESTAMP},
</if>
<if test="detailHtmlContent != null">
#{detailHtmlContent,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.racetr.RacetrSeasonExample" resultType="java.lang.Long">
@ -200,11 +238,29 @@
<if test="record.udpateTime != null">
udpate_time = #{record.udpateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.detailHtmlContent != null">
detail_html_content = #{record.detailHtmlContent,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update racetr_season
set id = #{record.id,jdbcType=BIGINT},
code = #{record.code,jdbcType=VARCHAR},
`group` = #{record.group,jdbcType=VARCHAR},
term = #{record.term,jdbcType=VARCHAR},
creator_id = #{record.creatorId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
updater_id = #{record.updaterId,jdbcType=BIGINT},
udpate_time = #{record.udpateTime,jdbcType=TIMESTAMP},
detail_html_content = #{record.detailHtmlContent,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update racetr_season
set id = #{record.id,jdbcType=BIGINT},
@ -243,9 +299,24 @@
<if test="udpateTime != null">
udpate_time = #{udpateTime,jdbcType=TIMESTAMP},
</if>
<if test="detailHtmlContent != null">
detail_html_content = #{detailHtmlContent,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.racetr.RacetrSeason">
update racetr_season
set code = #{code,jdbcType=VARCHAR},
`group` = #{group,jdbcType=VARCHAR},
term = #{term,jdbcType=VARCHAR},
creator_id = #{creatorId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
updater_id = #{updaterId,jdbcType=BIGINT},
udpate_time = #{udpateTime,jdbcType=TIMESTAMP},
detail_html_content = #{detailHtmlContent,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.racetr.RacetrSeason">
update racetr_season
set code = #{code,jdbcType=VARCHAR},

View File

@ -3,6 +3,7 @@ package club.joylink.rtss.services.race;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperCreateVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperMenuVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperVO;
import club.joylink.rtss.vo.race.RacePaperQueryVO;
import club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group;
@ -48,4 +49,12 @@ public class PaperServiceTest {
RacePaperSingleModuleGroupTask moduleTask = this.paperService.singlePaperModuleTask(13L, 2);
System.out.println(JsonUtils.writeValueAsString(moduleTask));
}
@Test
public void pageMenuQueryTest() {
RacePaperQueryVO queryVO = new RacePaperQueryVO();
RacePaperMenuVO menuVO = this.paperService.pageMenuQuery(queryVO);
System.out.println(JsonUtils.writeValueAsString(menuVO));
}
}

View File

@ -1,5 +1,7 @@
package club.joylink.rtss.services.race;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.race.RaceScoringRule.RaceScoringRuleVO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@ -12,7 +14,8 @@ public class ScoreRuleServiceTest {
@Test
public void detail() {
this.ruleService.detail(2L);
RaceScoringRuleVO ruleVO = this.ruleService.detail(7L);
System.out.println(JsonUtils.writeValueAsString(ruleVO));
}
}