refactor: 裁判角色名称修改 - 裁判长→主裁判, 普通裁判→裁判员

- 修改所有Java文件中的注释和Schema描述
- 更新MartialScoreServiceImpl中的评分修改记录名称

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-27 11:37:11 +08:00
parent 559e97b672
commit 4a2071ddda
45 changed files with 40 additions and 40 deletions

View File

@@ -199,18 +199,18 @@ public class MartialMiniController extends BladeController {
*/ */
private void updateAthleteTotalScore(Long athleteId, Long projectId, Long venueId) { private void updateAthleteTotalScore(Long athleteId, Long projectId, Long venueId) {
try { try {
// 1. 查询该场地的普通裁判数量 // 1. 查询该场地的裁判数量
int requiredJudgeCount = getRequiredJudgeCount(projectId); int requiredJudgeCount = getRequiredJudgeCount(projectId);
// 2. 获取裁判ID列表 // 2. 获取裁判ID列表
List<Long> chiefJudgeIds = getChiefJudgeIds(venueId); List<Long> chiefJudgeIds = getChiefJudgeIds(venueId);
// 3. 查询该选手在该项目的所有评分(排除裁判的评分) // 3. 查询该选手在该项目的所有评分(排除裁判的评分)
LambdaQueryWrapper<MartialScore> scoreQuery = new LambdaQueryWrapper<>(); LambdaQueryWrapper<MartialScore> scoreQuery = new LambdaQueryWrapper<>();
scoreQuery.eq(MartialScore::getAthleteId, athleteId); scoreQuery.eq(MartialScore::getAthleteId, athleteId);
scoreQuery.eq(MartialScore::getProjectId, projectId); scoreQuery.eq(MartialScore::getProjectId, projectId);
scoreQuery.eq(MartialScore::getIsDeleted, 0); scoreQuery.eq(MartialScore::getIsDeleted, 0);
// 排除裁判的所有评分(包括普通评分和修改记录) // 排除裁判的所有评分(包括普通评分和修改记录)
if (!chiefJudgeIds.isEmpty()) { if (!chiefJudgeIds.isEmpty()) {
scoreQuery.notIn(MartialScore::getJudgeId, chiefJudgeIds); scoreQuery.notIn(MartialScore::getJudgeId, chiefJudgeIds);
} }
@@ -250,7 +250,7 @@ public class MartialMiniController extends BladeController {
} }
/** /**
* 获取项目应评分的裁判数量(普通裁判,不包括裁判 * 获取项目应评分的裁判数量(裁判,不包括裁判)
* 按项目过滤:检查 projects JSON 字段是否包含该项目ID * 按项目过滤:检查 projects JSON 字段是否包含该项目ID
*/ */
private int getRequiredJudgeCount(Long projectId) { private int getRequiredJudgeCount(Long projectId) {
@@ -259,7 +259,7 @@ public class MartialMiniController extends BladeController {
} }
LambdaQueryWrapper<MartialJudgeInvite> judgeQuery = new LambdaQueryWrapper<>(); LambdaQueryWrapper<MartialJudgeInvite> judgeQuery = new LambdaQueryWrapper<>();
judgeQuery.eq(MartialJudgeInvite::getIsDeleted, 0); judgeQuery.eq(MartialJudgeInvite::getIsDeleted, 0);
judgeQuery.ne(MartialJudgeInvite::getRole, "chief_judge"); // 排除裁判 judgeQuery.ne(MartialJudgeInvite::getRole, "chief_judge"); // 排除裁判
// 按项目过滤projects字段包含该项目ID // 按项目过滤projects字段包含该项目ID
judgeQuery.like(MartialJudgeInvite::getProjects, projectId.toString()); judgeQuery.like(MartialJudgeInvite::getProjects, projectId.toString());
List<MartialJudgeInvite> judges = judgeInviteService.list(judgeQuery); List<MartialJudgeInvite> judges = judgeInviteService.list(judgeQuery);
@@ -325,8 +325,8 @@ public class MartialMiniController extends BladeController {
/** /**
* 获取选手列表(支持分页) * 获取选手列表(支持分页)
* - 普通裁判:获取所有选手,标记是否已评分 * - 裁判:获取所有选手,标记是否已评分
* - 裁判:获取所有普通裁判都评分完成的选手列表 * - 裁判:获取所有裁判都评分完成的选手列表
*/ */
@GetMapping("/score/athletes") @GetMapping("/score/athletes")
@Operation(summary = "获取选手列表", description = "根据裁判类型获取选手列表(支持分页)") @Operation(summary = "获取选手列表", description = "根据裁判类型获取选手列表(支持分页)")
@@ -356,10 +356,10 @@ public class MartialMiniController extends BladeController {
List<MartialAthlete> athletes = athleteService.list(athleteQuery); List<MartialAthlete> athletes = athleteService.list(athleteQuery);
// 2. 获取该场地所有裁判的judge_id列表 // 2. 获取该场地所有裁判的judge_id列表
List<Long> chiefJudgeIds = getChiefJudgeIds(venueId); List<Long> chiefJudgeIds = getChiefJudgeIds(venueId);
// 3. 获取所有评分记录(排除裁判的评分) // 3. 获取所有评分记录(排除裁判的评分)
LambdaQueryWrapper<MartialScore> scoreQuery = new LambdaQueryWrapper<>(); LambdaQueryWrapper<MartialScore> scoreQuery = new LambdaQueryWrapper<>();
scoreQuery.eq(MartialScore::getIsDeleted, 0); scoreQuery.eq(MartialScore::getIsDeleted, 0);
if (projectId != null) { if (projectId != null) {
@@ -369,7 +369,7 @@ public class MartialMiniController extends BladeController {
if (venueId != null && venueId > 0) { if (venueId != null && venueId > 0) {
scoreQuery.eq(MartialScore::getVenueId, venueId); scoreQuery.eq(MartialScore::getVenueId, venueId);
} }
// 排除裁判的评分 // 排除裁判的评分
if (!chiefJudgeIds.isEmpty()) { if (!chiefJudgeIds.isEmpty()) {
scoreQuery.notIn(MartialScore::getJudgeId, chiefJudgeIds); scoreQuery.notIn(MartialScore::getJudgeId, chiefJudgeIds);
} }
@@ -386,12 +386,12 @@ public class MartialMiniController extends BladeController {
List<org.springblade.modules.martial.pojo.vo.MiniAthleteListVO> filteredList; List<org.springblade.modules.martial.pojo.vo.MiniAthleteListVO> filteredList;
if (refereeType == 1) { if (refereeType == 1) {
// 裁判返回所有选手前端根据totalScore判断是否显示修改按钮 // 裁判返回所有选手前端根据totalScore判断是否显示修改按钮
filteredList = athletes.stream() filteredList = athletes.stream()
.map(athlete -> convertToAthleteListVO(athlete, scoresByAthlete.get(athlete.getId()), judgeId, requiredJudgeCount)) .map(athlete -> convertToAthleteListVO(athlete, scoresByAthlete.get(athlete.getId()), judgeId, requiredJudgeCount))
.collect(java.util.stream.Collectors.toList()); .collect(java.util.stream.Collectors.toList());
} else { } else {
// 普通裁判:返回所有选手,标记是否已评分 // 裁判:返回所有选手,标记是否已评分
filteredList = athletes.stream() filteredList = athletes.stream()
.map(athlete -> convertToAthleteListVO(athlete, scoresByAthlete.get(athlete.getId()), judgeId, requiredJudgeCount)) .map(athlete -> convertToAthleteListVO(athlete, scoresByAthlete.get(athlete.getId()), judgeId, requiredJudgeCount))
.collect(java.util.stream.Collectors.toList()); .collect(java.util.stream.Collectors.toList());
@@ -417,7 +417,7 @@ public class MartialMiniController extends BladeController {
} }
/** /**
* 获取场地所有裁判的judge_id列表 * 获取场地所有裁判的judge_id列表
*/ */
private List<Long> getChiefJudgeIds(Long venueId) { private List<Long> getChiefJudgeIds(Long venueId) {
if (venueId == null) { if (venueId == null) {
@@ -445,10 +445,10 @@ public class MartialMiniController extends BladeController {
} }
/** /**
* 修改评分(裁判 * 修改评分(裁判)
*/ */
@PutMapping("/score/modify") @PutMapping("/score/modify")
@Operation(summary = "修改评分", description = "裁判修改选手总分") @Operation(summary = "修改评分", description = "裁判修改选手总分")
public R modifyScore(@RequestBody MiniScoreModifyDTO dto) { public R modifyScore(@RequestBody MiniScoreModifyDTO dto) {
boolean success = scoreService.modifyScoreByAdmin(dto); boolean success = scoreService.modifyScoreByAdmin(dto);
return success ? R.success("修改成功") : R.fail("修改失败"); return success ? R.success("修改成功") : R.fail("修改失败");

View File

@@ -20,7 +20,7 @@ public class BatchGenerateInviteDTO {
@Schema(description = "评委ID列表", required = true) @Schema(description = "评委ID列表", required = true)
private List<Long> judgeIds; private List<Long> judgeIds;
@Schema(description = "角色judge-普通评委chief_judge-裁判") @Schema(description = "角色judge-普通评委chief_judge-裁判")
private String role = "judge"; private String role = "judge";
@Schema(description = "过期天数默认30天") @Schema(description = "过期天数默认30天")

View File

@@ -19,7 +19,7 @@ public class GenerateInviteDTO {
@Schema(description = "评委ID", required = true) @Schema(description = "评委ID", required = true)
private Long judgeId; private Long judgeId;
@Schema(description = "角色judge-普通评委chief_judge-裁判", required = true) @Schema(description = "角色judge-普通评委chief_judge-裁判", required = true)
private String role; private String role;
@Schema(description = "分配场地ID普通评委必填") @Schema(description = "分配场地ID普通评委必填")

View File

@@ -20,7 +20,7 @@ public class MiniScoreModifyDTO implements Serializable {
@Schema(description = "选手ID") @Schema(description = "选手ID")
private Long athleteId; private Long athleteId;
@Schema(description = "修改者ID裁判ID") @Schema(description = "修改者ID裁判ID")
private Long modifierId; private Long modifierId;
@Schema(description = "修改后的分数") @Schema(description = "修改后的分数")

View File

@@ -60,7 +60,7 @@ public class MartialJudge extends TenantEntity {
private String idCard; private String idCard;
/** /**
* 裁判类型(1-裁判,2-普通裁判) * 裁判类型(1-裁判,2-裁判)
*/ */
@Schema(description = "裁判类型") @Schema(description = "裁判类型")
private Integer refereeType; private Integer refereeType;

View File

@@ -56,7 +56,7 @@ public class MartialJudgeInvite extends TenantEntity {
private String inviteCode; private String inviteCode;
/** /**
* 角色(judge-普通裁判,chief_judge-裁判) * 角色(judge-裁判,chief_judge-裁判)
*/ */
@Schema(description = "角色") @Schema(description = "角色")
private String role; private String role;

View File

@@ -7,12 +7,12 @@ import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* 小程序选手评分VO裁判视图) * 小程序选手评分VO裁判视图)
* *
* @author BladeX * @author BladeX
*/ */
@Data @Data
@Schema(description = "小程序选手评分信息(裁判") @Schema(description = "小程序选手评分信息(裁判)")
public class MiniAthleteAdminVO implements Serializable { public class MiniAthleteAdminVO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -20,7 +20,7 @@ public class MiniLoginVO implements Serializable {
@Schema(description = "访问令牌") @Schema(description = "访问令牌")
private String token; private String token;
@Schema(description = "用户角色pub-普通评委, admin-裁判") @Schema(description = "用户角色pub-普通评委, admin-裁判")
private String userRole; private String userRole;
@Schema(description = "比赛ID") @Schema(description = "比赛ID")

View File

@@ -25,7 +25,7 @@ public class MiniScoreDetailVO implements Serializable {
@Schema(description = "评委评分列表") @Schema(description = "评委评分列表")
private List<JudgeScore> judgeScores; private List<JudgeScore> judgeScores;
@Schema(description = "裁判修改信息") @Schema(description = "裁判修改信息")
private Modification modification; private Modification modification;
/** /**
@@ -82,10 +82,10 @@ public class MiniScoreDetailVO implements Serializable {
} }
/** /**
* 裁判修改信息内部类 * 裁判修改信息内部类
*/ */
@Data @Data
@Schema(description = "裁判修改信息") @Schema(description = "裁判修改信息")
public static class Modification implements Serializable { public static class Modification implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -57,7 +57,7 @@ public interface IMartialAthleteService extends IService<MartialAthlete> {
List<MiniAthleteScoreVO> getAthletesWithMyScore(Long judgeId, Long venueId, Long projectId); List<MiniAthleteScoreVO> getAthletesWithMyScore(Long judgeId, Long venueId, Long projectId);
/** /**
* 小程序接口:获取选手列表(裁判 * 小程序接口:获取选手列表(裁判)
* *
* @param competitionId 比赛ID * @param competitionId 比赛ID
* @param venueId 场地ID * @param venueId 场地ID

View File

@@ -44,7 +44,7 @@ public interface IMartialScoreService extends IService<MartialScore> {
MiniScoreDetailVO getScoreDetailForMini(Long athleteId); MiniScoreDetailVO getScoreDetailForMini(Long athleteId);
/** /**
* 小程序接口:修改评分(裁判 * 小程序接口:修改评分(裁判)
* *
* @param dto 修改信息 * @param dto 修改信息
* @return 修改成功/失败 * @return 修改成功/失败

View File

@@ -273,7 +273,7 @@ public class MartialAthleteServiceImpl extends ServiceImpl<MartialAthleteMapper,
} }
/** /**
* 小程序接口:获取选手列表(裁判 * 小程序接口:获取选手列表(裁判)
* *
* @param competitionId 比赛ID * @param competitionId 比赛ID
* @param venueId 场地ID * @param venueId 场地ID

View File

@@ -281,7 +281,7 @@ public class MartialScoreServiceImpl extends ServiceImpl<MartialScoreMapper, Mar
vo.setJudgeScores(judgeScores); vo.setJudgeScores(judgeScores);
// 3. 查询裁判修改记录(检查选手的 originalScore 字段) // 3. 查询裁判修改记录(检查选手的 originalScore 字段)
// 注意:这里假设修改记录存储在选手的 totalScore 和一个额外的字段中 // 注意:这里假设修改记录存储在选手的 totalScore 和一个额外的字段中
// 由于 MartialAthlete 实体没有 originalScore 字段,我们查找修改过的评分记录 // 由于 MartialAthlete 实体没有 originalScore 字段,我们查找修改过的评分记录
MartialScore modifiedScore = scores.stream() MartialScore modifiedScore = scores.stream()
@@ -318,7 +318,7 @@ public class MartialScoreServiceImpl extends ServiceImpl<MartialScoreMapper, Mar
} }
/** /**
* 小程序接口:修改评分(裁判 * 小程序接口:修改评分(裁判)
* *
* @param dto 修改信息 * @param dto 修改信息
* @return 修改成功/失败 * @return 修改成功/失败
@@ -337,10 +337,10 @@ public class MartialScoreServiceImpl extends ServiceImpl<MartialScoreMapper, Mar
throw new ServiceException("修改后的分数必须在5.000-10.000之间"); throw new ServiceException("修改后的分数必须在5.000-10.000之间");
} }
// 3. 查找是否已存在裁判的修改记录 // 3. 查找是否已存在裁判的修改记录
LambdaQueryWrapper<MartialScore> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<MartialScore> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(MartialScore::getAthleteId, dto.getAthleteId()) queryWrapper.eq(MartialScore::getAthleteId, dto.getAthleteId())
.like(MartialScore::getJudgeName, "裁判修改"); .like(MartialScore::getJudgeName, "裁判修改");
MartialScore existingRecord = this.getOne(queryWrapper); MartialScore existingRecord = this.getOne(queryWrapper);
// 4. 确定原始计算总分(用于范围验证) // 4. 确定原始计算总分(用于范围验证)
@@ -369,17 +369,17 @@ public class MartialScoreServiceImpl extends ServiceImpl<MartialScoreMapper, Mar
boolean recordSaved; boolean recordSaved;
if (existingRecord != null) { if (existingRecord != null) {
// 7a. 更新现有的裁判修改记录(保持原始计算总分不变) // 7a. 更新现有的裁判修改记录(保持原始计算总分不变)
existingRecord.setScore(dto.getModifiedScore()); existingRecord.setScore(dto.getModifiedScore());
// originalScore 保持不变,始终是系统计算的原始总分 // originalScore 保持不变,始终是系统计算的原始总分
existingRecord.setModifyReason(dto.getNote()); existingRecord.setModifyReason(dto.getNote());
existingRecord.setModifyTime(LocalDateTime.now()); existingRecord.setModifyTime(LocalDateTime.now());
// 直接使用 baseMapper.updateById 绕过 Service 层的状态检查,裁判可以无限次修改 // 直接使用 baseMapper.updateById 绕过 Service 层的状态检查,裁判可以无限次修改
recordSaved = this.baseMapper.updateById(existingRecord) > 0; recordSaved = this.baseMapper.updateById(existingRecord) > 0;
log.info("裁判更新评分记录 - 选手ID:{}, 姓名:{}, 原始计算总分:{}, 修改后总分:{}, 修改原因:{}", log.info("裁判更新评分记录 - 选手ID:{}, 姓名:{}, 原始计算总分:{}, 修改后总分:{}, 修改原因:{}",
athlete.getId(), athlete.getPlayerName(), originalCalculatedScore, dto.getModifiedScore(), dto.getNote()); athlete.getId(), athlete.getPlayerName(), originalCalculatedScore, dto.getModifiedScore(), dto.getNote());
} else { } else {
// 7b. 创建新的裁判修改记录 // 7b. 创建新的裁判修改记录
MartialScore modificationRecord = new MartialScore(); MartialScore modificationRecord = new MartialScore();
modificationRecord.setCompetitionId(athlete.getCompetitionId()); modificationRecord.setCompetitionId(athlete.getCompetitionId());
modificationRecord.setAthleteId(athlete.getId()); modificationRecord.setAthleteId(athlete.getId());
@@ -395,11 +395,11 @@ public class MartialScoreServiceImpl extends ServiceImpl<MartialScoreMapper, Mar
// 查询修改者信息 // 查询修改者信息
MartialJudge modifier = judgeService.getById(dto.getModifierId()); MartialJudge modifier = judgeService.getById(dto.getModifierId());
if (modifier != null) { if (modifier != null) {
modificationRecord.setJudgeName(modifier.getName() + "(裁判修改)"); modificationRecord.setJudgeName(modifier.getName() + "(裁判修改)");
} }
recordSaved = this.save(modificationRecord); recordSaved = this.save(modificationRecord);
log.info("裁判新增评分记录 - 选手ID:{}, 姓名:{}, 原始计算总分:{}, 修改后总分:{}, 修改原因:{}", log.info("裁判新增评分记录 - 选手ID:{}, 姓名:{}, 原始计算总分:{}, 修改后总分:{}, 修改原因:{}",
athlete.getId(), athlete.getPlayerName(), originalCalculatedScore, dto.getModifiedScore(), dto.getNote()); athlete.getId(), athlete.getPlayerName(), originalCalculatedScore, dto.getModifiedScore(), dto.getNote());
} }