大赛管理功能

This commit is contained in:
tiger_zhou 2024-02-27 15:08:00 +08:00
parent eecef5ba96
commit 161e8ec469
6 changed files with 1725 additions and 282 deletions

@ -1 +1 @@
Subproject commit bab005c36a386b8986678715c0adeea67edd0f18
Subproject commit 79c926c676db362c034112a1a94c4507028c51fe

View File

@ -3,12 +3,14 @@ package club.joylink.rtss.services.race;
import club.joylink.rtss.dao.racetr.RacetrPaperDAO;
import club.joylink.rtss.entity.racetr.RacetrPaper;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.util.JsonUtils;
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.RacePaperModuleVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperModuleVO.PaperModule;
import club.joylink.rtss.vo.race.RacePaper.RacePaperVO;
import club.joylink.rtss.vo.race.RacePaperPageVO;
import club.joylink.rtss.vo.race.RacePaperQueryVO;
@ -17,6 +19,7 @@ import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
@ -78,6 +81,7 @@ public class RacePaperService {
private RacePaperVO convertVO(RacePaperPageVO rp) {
RacePaperVO.Builder builder = RacePaperVO.newBuilder();
ModifyInfoVO modifyInfoVO = RaceServiceUtil.createModifyInfo(rp.getCreatorId(), rp.getCreatorName(), rp.getUpdaterId(), rp.getUpdaterName(), rp.getCreateTime(), rp.getUpdateTime());
builder.setId(rp.getId());
@ -140,10 +144,22 @@ public class RacePaperService {
RacetrPaper paper = this.findId(id);
paper.setUpdateTime(LocalDateTime.now());
paper.setUpdaterId(user.getId());
paper.setConfigs(moduleVO.toByteArray());
int customId = 1;
RacePaperModuleVO.Builder voBuild = moduleVO.toBuilder();
List<PaperModule> pmList = Lists.newArrayListWithExpectedSize(voBuild.getModulesList().size());
for (PaperModule pm : voBuild.getModulesList()) {
PaperModule.Builder pmBuild = pm.toBuilder();
pmBuild.setCustomModuleId(++customId);
pmList.add(pmBuild.build());
}
voBuild.clearModules();
voBuild.addAllModules(pmList);
paper.setConfigs(voBuild.build().toByteArray());
this.paperDAO.updateByPrimaryKeySelective(paper);
}
public void copy(Long id, AccountVO user) {
RacetrPaper paper = this.findId(id);
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(paper.getSupportCopy(), "此试卷不支持拷贝");

View File

@ -3786,6 +3786,12 @@ public final class RacePaper {
* @return The moduleScoreRuleId.
*/
long getModuleScoreRuleId();
/**
* <code>int32 custom_module_id = 5;</code>
* @return The customModuleId.
*/
int getCustomModuleId();
}
/**
* Protobuf type {@code race.RacePaperModuleVO.PaperModule}
@ -3946,6 +3952,17 @@ public final class RacePaper {
return moduleScoreRuleId_;
}
public static final int CUSTOM_MODULE_ID_FIELD_NUMBER = 5;
private int customModuleId_ = 0;
/**
* <code>int32 custom_module_id = 5;</code>
* @return The customModuleId.
*/
@java.lang.Override
public int getCustomModuleId() {
return customModuleId_;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
@ -3972,6 +3989,9 @@ public final class RacePaper {
if (moduleScoreRuleId_ != 0L) {
output.writeInt64(4, moduleScoreRuleId_);
}
if (customModuleId_ != 0) {
output.writeInt32(5, customModuleId_);
}
getUnknownFields().writeTo(output);
}
@ -3996,6 +4016,10 @@ public final class RacePaper {
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(4, moduleScoreRuleId_);
}
if (customModuleId_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(5, customModuleId_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
@ -4019,6 +4043,8 @@ public final class RacePaper {
.equals(other.getGroupList())) return false;
if (getModuleScoreRuleId()
!= other.getModuleScoreRuleId()) return false;
if (getCustomModuleId()
!= other.getCustomModuleId()) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@ -4041,6 +4067,8 @@ public final class RacePaper {
hash = (37 * hash) + MODULE_SCORE_RULE_ID_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getModuleScoreRuleId());
hash = (37 * hash) + CUSTOM_MODULE_ID_FIELD_NUMBER;
hash = (53 * hash) + getCustomModuleId();
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
@ -4182,6 +4210,7 @@ public final class RacePaper {
}
bitField0_ = (bitField0_ & ~0x00000004);
moduleScoreRuleId_ = 0L;
customModuleId_ = 0;
return this;
}
@ -4237,6 +4266,9 @@ public final class RacePaper {
if (((from_bitField0_ & 0x00000008) != 0)) {
result.moduleScoreRuleId_ = moduleScoreRuleId_;
}
if (((from_bitField0_ & 0x00000010) != 0)) {
result.customModuleId_ = customModuleId_;
}
}
@java.lang.Override
@ -4288,6 +4320,9 @@ public final class RacePaper {
if (other.getModuleScoreRuleId() != 0L) {
setModuleScoreRuleId(other.getModuleScoreRuleId());
}
if (other.getCustomModuleId() != 0) {
setCustomModuleId(other.getCustomModuleId());
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
@ -4342,6 +4377,11 @@ public final class RacePaper {
bitField0_ |= 0x00000008;
break;
} // case 32
case 40: {
customModuleId_ = input.readInt32();
bitField0_ |= 0x00000010;
break;
} // case 40
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
@ -4806,6 +4846,38 @@ public final class RacePaper {
onChanged();
return this;
}
private int customModuleId_ ;
/**
* <code>int32 custom_module_id = 5;</code>
* @return The customModuleId.
*/
@java.lang.Override
public int getCustomModuleId() {
return customModuleId_;
}
/**
* <code>int32 custom_module_id = 5;</code>
* @param value The customModuleId to set.
* @return This builder for chaining.
*/
public Builder setCustomModuleId(int value) {
customModuleId_ = value;
bitField0_ |= 0x00000010;
onChanged();
return this;
}
/**
* <code>int32 custom_module_id = 5;</code>
* @return This builder for chaining.
*/
public Builder clearCustomModuleId() {
bitField0_ = (bitField0_ & ~0x00000010);
customModuleId_ = 0;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
@ -6907,15 +6979,16 @@ public final class RacePaper {
"(\010\022)\n\013modify_info\030\010 \001(\0132\024.common.ModifyI" +
"nfoVO\"X\n\021RacePaperCreateVO\022\014\n\004name\030\001 \001(\t" +
"\022\014\n\004desc\030\002 \001(\t\022\021\n\tseason_id\030\003 \001(\003\022\024\n\014sup" +
"port_copy\030\004 \001(\010\"\243\002\n\021RacePaperModuleVO\0224\n" +
"port_copy\030\004 \001(\010\"\275\002\n\021RacePaperModuleVO\0224\n" +
"\007modules\030\001 \003(\0132#.race.RacePaperModuleVO." +
"PaperModule\032\200\001\n\013PaperModule\022\023\n\013module_na" +
"PaperModule\032\232\001\n\013PaperModule\022\023\n\013module_na" +
"me\030\001 \001(\t\022\020\n\010duration\030\002 \001(\005\022,\n\005group\030\003 \003(" +
"\0132\035.race.RacePaperModuleVO.Group\022\034\n\024modu" +
"le_score_rule_id\030\004 \001(\003\032U\n\005Group\022\020\n\010task_" +
"ids\030\001 \003(\003\022,\n\005group\030\002 \003(\0132\035.race.RacePape" +
"rModuleVO.Group\022\014\n\004name\030\003 \001(\tB\033\n\031club.jo" +
"ylink.rtss.vo.raceb\006proto3"
"le_score_rule_id\030\004 \001(\003\022\030\n\020custom_module_" +
"id\030\005 \001(\005\032U\n\005Group\022\020\n\010task_ids\030\001 \003(\003\022,\n\005g" +
"roup\030\002 \003(\0132\035.race.RacePaperModuleVO.Grou" +
"p\022\014\n\004name\030\003 \001(\tB\033\n\031club.joylink.rtss.vo." +
"raceb\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
@ -6952,7 +7025,7 @@ public final class RacePaper {
internal_static_race_RacePaperModuleVO_PaperModule_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_race_RacePaperModuleVO_PaperModule_descriptor,
new java.lang.String[] { "ModuleName", "Duration", "Group", "ModuleScoreRuleId", });
new java.lang.String[] { "ModuleName", "Duration", "Group", "ModuleScoreRuleId", "CustomModuleId", });
internal_static_race_RacePaperModuleVO_Group_descriptor =
internal_static_race_RacePaperModuleVO_descriptor.getNestedTypes().get(1);
internal_static_race_RacePaperModuleVO_Group_fieldAccessorTable = new

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +0,0 @@
package club.joylink.rtss.vo.race;
import club.joylink.rtss.vo.client.PageQueryVO;
import lombok.Data;
@Data
public class RaceTaskQueryVO {
}

View File

@ -1,5 +1,7 @@
package club.joylink.rtss.services.race;
import static com.github.pagehelper.util.ExecutorUtil.pageQuery;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperCreateVO;
@ -30,6 +32,7 @@ public class PaperServiceTest {
queryVO.setPageNum(1);
queryVO.setPageSize(10);
queryVO.setGroup(Group.GZ.name());
PageVO<RacePaperVO> page = this.paperService.pageQuery(queryVO);
System.out.println(JsonUtils.writeValueAsString(page));
}