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:
@@ -199,18 +199,18 @@ public class MartialMiniController extends BladeController {
|
||||
*/
|
||||
private void updateAthleteTotalScore(Long athleteId, Long projectId, Long venueId) {
|
||||
try {
|
||||
// 1. 查询该场地的普通裁判数量
|
||||
// 1. 查询该场地的裁判员数量
|
||||
int requiredJudgeCount = getRequiredJudgeCount(projectId);
|
||||
|
||||
// 2. 获取裁判长ID列表
|
||||
// 2. 获取主裁判ID列表
|
||||
List<Long> chiefJudgeIds = getChiefJudgeIds(venueId);
|
||||
|
||||
// 3. 查询该选手在该项目的所有评分(排除裁判长的评分)
|
||||
// 3. 查询该选手在该项目的所有评分(排除主裁判的评分)
|
||||
LambdaQueryWrapper<MartialScore> scoreQuery = new LambdaQueryWrapper<>();
|
||||
scoreQuery.eq(MartialScore::getAthleteId, athleteId);
|
||||
scoreQuery.eq(MartialScore::getProjectId, projectId);
|
||||
scoreQuery.eq(MartialScore::getIsDeleted, 0);
|
||||
// 排除裁判长的所有评分(包括普通评分和修改记录)
|
||||
// 排除主裁判的所有评分(包括普通评分和修改记录)
|
||||
if (!chiefJudgeIds.isEmpty()) {
|
||||
scoreQuery.notIn(MartialScore::getJudgeId, chiefJudgeIds);
|
||||
}
|
||||
@@ -250,7 +250,7 @@ public class MartialMiniController extends BladeController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目应评分的裁判数量(普通裁判,不包括裁判长)
|
||||
* 获取项目应评分的裁判数量(裁判员,不包括主裁判)
|
||||
* 按项目过滤:检查 projects JSON 字段是否包含该项目ID
|
||||
*/
|
||||
private int getRequiredJudgeCount(Long projectId) {
|
||||
@@ -259,7 +259,7 @@ public class MartialMiniController extends BladeController {
|
||||
}
|
||||
LambdaQueryWrapper<MartialJudgeInvite> judgeQuery = new LambdaQueryWrapper<>();
|
||||
judgeQuery.eq(MartialJudgeInvite::getIsDeleted, 0);
|
||||
judgeQuery.ne(MartialJudgeInvite::getRole, "chief_judge"); // 排除裁判长
|
||||
judgeQuery.ne(MartialJudgeInvite::getRole, "chief_judge"); // 排除主裁判
|
||||
// 按项目过滤:projects字段包含该项目ID
|
||||
judgeQuery.like(MartialJudgeInvite::getProjects, projectId.toString());
|
||||
List<MartialJudgeInvite> judges = judgeInviteService.list(judgeQuery);
|
||||
@@ -325,8 +325,8 @@ public class MartialMiniController extends BladeController {
|
||||
|
||||
/**
|
||||
* 获取选手列表(支持分页)
|
||||
* - 普通裁判:获取所有选手,标记是否已评分
|
||||
* - 裁判长:获取所有普通裁判都评分完成的选手列表
|
||||
* - 裁判员:获取所有选手,标记是否已评分
|
||||
* - 主裁判:获取所有裁判员都评分完成的选手列表
|
||||
*/
|
||||
@GetMapping("/score/athletes")
|
||||
@Operation(summary = "获取选手列表", description = "根据裁判类型获取选手列表(支持分页)")
|
||||
@@ -356,10 +356,10 @@ public class MartialMiniController extends BladeController {
|
||||
|
||||
List<MartialAthlete> athletes = athleteService.list(athleteQuery);
|
||||
|
||||
// 2. 获取该场地所有裁判长的judge_id列表
|
||||
// 2. 获取该场地所有主裁判的judge_id列表
|
||||
List<Long> chiefJudgeIds = getChiefJudgeIds(venueId);
|
||||
|
||||
// 3. 获取所有评分记录(排除裁判长的评分)
|
||||
// 3. 获取所有评分记录(排除主裁判的评分)
|
||||
LambdaQueryWrapper<MartialScore> scoreQuery = new LambdaQueryWrapper<>();
|
||||
scoreQuery.eq(MartialScore::getIsDeleted, 0);
|
||||
if (projectId != null) {
|
||||
@@ -369,7 +369,7 @@ public class MartialMiniController extends BladeController {
|
||||
if (venueId != null && venueId > 0) {
|
||||
scoreQuery.eq(MartialScore::getVenueId, venueId);
|
||||
}
|
||||
// 排除裁判长的评分
|
||||
// 排除主裁判的评分
|
||||
if (!chiefJudgeIds.isEmpty()) {
|
||||
scoreQuery.notIn(MartialScore::getJudgeId, chiefJudgeIds);
|
||||
}
|
||||
@@ -386,12 +386,12 @@ public class MartialMiniController extends BladeController {
|
||||
List<org.springblade.modules.martial.pojo.vo.MiniAthleteListVO> filteredList;
|
||||
|
||||
if (refereeType == 1) {
|
||||
// 裁判长:返回所有选手,前端根据totalScore判断是否显示修改按钮
|
||||
// 主裁判:返回所有选手,前端根据totalScore判断是否显示修改按钮
|
||||
filteredList = athletes.stream()
|
||||
.map(athlete -> convertToAthleteListVO(athlete, scoresByAthlete.get(athlete.getId()), judgeId, requiredJudgeCount))
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
} else {
|
||||
// 普通裁判:返回所有选手,标记是否已评分
|
||||
// 裁判员:返回所有选手,标记是否已评分
|
||||
filteredList = athletes.stream()
|
||||
.map(athlete -> convertToAthleteListVO(athlete, scoresByAthlete.get(athlete.getId()), judgeId, requiredJudgeCount))
|
||||
.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) {
|
||||
if (venueId == null) {
|
||||
@@ -445,10 +445,10 @@ public class MartialMiniController extends BladeController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改评分(裁判长)
|
||||
* 修改评分(主裁判)
|
||||
*/
|
||||
@PutMapping("/score/modify")
|
||||
@Operation(summary = "修改评分", description = "裁判长修改选手总分")
|
||||
@Operation(summary = "修改评分", description = "主裁判修改选手总分")
|
||||
public R modifyScore(@RequestBody MiniScoreModifyDTO dto) {
|
||||
boolean success = scoreService.modifyScoreByAdmin(dto);
|
||||
return success ? R.success("修改成功") : R.fail("修改失败");
|
||||
|
||||
@@ -20,7 +20,7 @@ public class BatchGenerateInviteDTO {
|
||||
@Schema(description = "评委ID列表", required = true)
|
||||
private List<Long> judgeIds;
|
||||
|
||||
@Schema(description = "角色:judge-普通评委,chief_judge-裁判长")
|
||||
@Schema(description = "角色:judge-普通评委,chief_judge-主裁判")
|
||||
private String role = "judge";
|
||||
|
||||
@Schema(description = "过期天数(默认30天)")
|
||||
|
||||
@@ -19,7 +19,7 @@ public class GenerateInviteDTO {
|
||||
@Schema(description = "评委ID", required = true)
|
||||
private Long judgeId;
|
||||
|
||||
@Schema(description = "角色:judge-普通评委,chief_judge-裁判长", required = true)
|
||||
@Schema(description = "角色:judge-普通评委,chief_judge-主裁判", required = true)
|
||||
private String role;
|
||||
|
||||
@Schema(description = "分配场地ID(普通评委必填)")
|
||||
|
||||
@@ -20,7 +20,7 @@ public class MiniScoreModifyDTO implements Serializable {
|
||||
@Schema(description = "选手ID")
|
||||
private Long athleteId;
|
||||
|
||||
@Schema(description = "修改者ID(裁判长ID)")
|
||||
@Schema(description = "修改者ID(主裁判ID)")
|
||||
private Long modifierId;
|
||||
|
||||
@Schema(description = "修改后的分数")
|
||||
|
||||
@@ -60,7 +60,7 @@ public class MartialJudge extends TenantEntity {
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 裁判类型(1-裁判长,2-普通裁判)
|
||||
* 裁判类型(1-主裁判,2-裁判员)
|
||||
*/
|
||||
@Schema(description = "裁判类型")
|
||||
private Integer refereeType;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class MartialJudgeInvite extends TenantEntity {
|
||||
private String inviteCode;
|
||||
|
||||
/**
|
||||
* 角色(judge-普通裁判,chief_judge-裁判长)
|
||||
* 角色(judge-裁判员,chief_judge-主裁判)
|
||||
*/
|
||||
@Schema(description = "角色")
|
||||
private String role;
|
||||
|
||||
@@ -7,12 +7,12 @@ import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 小程序选手评分VO(裁判长视图)
|
||||
* 小程序选手评分VO(主裁判视图)
|
||||
*
|
||||
* @author BladeX
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "小程序选手评分信息(裁判长)")
|
||||
@Schema(description = "小程序选手评分信息(主裁判)")
|
||||
public class MiniAthleteAdminVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class MiniLoginVO implements Serializable {
|
||||
@Schema(description = "访问令牌")
|
||||
private String token;
|
||||
|
||||
@Schema(description = "用户角色:pub-普通评委, admin-裁判长")
|
||||
@Schema(description = "用户角色:pub-普通评委, admin-主裁判")
|
||||
private String userRole;
|
||||
|
||||
@Schema(description = "比赛ID")
|
||||
|
||||
@@ -25,7 +25,7 @@ public class MiniScoreDetailVO implements Serializable {
|
||||
@Schema(description = "评委评分列表")
|
||||
private List<JudgeScore> judgeScores;
|
||||
|
||||
@Schema(description = "裁判长修改信息")
|
||||
@Schema(description = "主裁判修改信息")
|
||||
private Modification modification;
|
||||
|
||||
/**
|
||||
@@ -82,10 +82,10 @@ public class MiniScoreDetailVO implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* 裁判长修改信息内部类
|
||||
* 主裁判修改信息内部类
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "裁判长修改信息")
|
||||
@Schema(description = "主裁判修改信息")
|
||||
public static class Modification implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -57,7 +57,7 @@ public interface IMartialAthleteService extends IService<MartialAthlete> {
|
||||
List<MiniAthleteScoreVO> getAthletesWithMyScore(Long judgeId, Long venueId, Long projectId);
|
||||
|
||||
/**
|
||||
* 小程序接口:获取选手列表(裁判长)
|
||||
* 小程序接口:获取选手列表(主裁判)
|
||||
*
|
||||
* @param competitionId 比赛ID
|
||||
* @param venueId 场地ID
|
||||
|
||||
@@ -44,7 +44,7 @@ public interface IMartialScoreService extends IService<MartialScore> {
|
||||
MiniScoreDetailVO getScoreDetailForMini(Long athleteId);
|
||||
|
||||
/**
|
||||
* 小程序接口:修改评分(裁判长)
|
||||
* 小程序接口:修改评分(主裁判)
|
||||
*
|
||||
* @param dto 修改信息
|
||||
* @return 修改成功/失败
|
||||
|
||||
@@ -273,7 +273,7 @@ public class MartialAthleteServiceImpl extends ServiceImpl<MartialAthleteMapper,
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序接口:获取选手列表(裁判长)
|
||||
* 小程序接口:获取选手列表(主裁判)
|
||||
*
|
||||
* @param competitionId 比赛ID
|
||||
* @param venueId 场地ID
|
||||
|
||||
@@ -281,7 +281,7 @@ public class MartialScoreServiceImpl extends ServiceImpl<MartialScoreMapper, Mar
|
||||
|
||||
vo.setJudgeScores(judgeScores);
|
||||
|
||||
// 3. 查询裁判长修改记录(检查选手的 originalScore 字段)
|
||||
// 3. 查询主裁判修改记录(检查选手的 originalScore 字段)
|
||||
// 注意:这里假设修改记录存储在选手的 totalScore 和一个额外的字段中
|
||||
// 由于 MartialAthlete 实体没有 originalScore 字段,我们查找修改过的评分记录
|
||||
MartialScore modifiedScore = scores.stream()
|
||||
@@ -318,7 +318,7 @@ public class MartialScoreServiceImpl extends ServiceImpl<MartialScoreMapper, Mar
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序接口:修改评分(裁判长)
|
||||
* 小程序接口:修改评分(主裁判)
|
||||
*
|
||||
* @param dto 修改信息
|
||||
* @return 修改成功/失败
|
||||
@@ -337,10 +337,10 @@ public class MartialScoreServiceImpl extends ServiceImpl<MartialScoreMapper, Mar
|
||||
throw new ServiceException("修改后的分数必须在5.000-10.000之间");
|
||||
}
|
||||
|
||||
// 3. 查找是否已存在裁判长的修改记录
|
||||
// 3. 查找是否已存在主裁判的修改记录
|
||||
LambdaQueryWrapper<MartialScore> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(MartialScore::getAthleteId, dto.getAthleteId())
|
||||
.like(MartialScore::getJudgeName, "裁判长修改");
|
||||
.like(MartialScore::getJudgeName, "主裁判修改");
|
||||
MartialScore existingRecord = this.getOne(queryWrapper);
|
||||
|
||||
// 4. 确定原始计算总分(用于范围验证)
|
||||
@@ -369,17 +369,17 @@ public class MartialScoreServiceImpl extends ServiceImpl<MartialScoreMapper, Mar
|
||||
|
||||
boolean recordSaved;
|
||||
if (existingRecord != null) {
|
||||
// 7a. 更新现有的裁判长修改记录(保持原始计算总分不变)
|
||||
// 7a. 更新现有的主裁判修改记录(保持原始计算总分不变)
|
||||
existingRecord.setScore(dto.getModifiedScore());
|
||||
// originalScore 保持不变,始终是系统计算的原始总分
|
||||
existingRecord.setModifyReason(dto.getNote());
|
||||
existingRecord.setModifyTime(LocalDateTime.now());
|
||||
// 直接使用 baseMapper.updateById 绕过 Service 层的状态检查,裁判长可以无限次修改
|
||||
// 直接使用 baseMapper.updateById 绕过 Service 层的状态检查,主裁判可以无限次修改
|
||||
recordSaved = this.baseMapper.updateById(existingRecord) > 0;
|
||||
log.info("裁判长更新评分记录 - 选手ID:{}, 姓名:{}, 原始计算总分:{}, 修改后总分:{}, 修改原因:{}",
|
||||
log.info("主裁判更新评分记录 - 选手ID:{}, 姓名:{}, 原始计算总分:{}, 修改后总分:{}, 修改原因:{}",
|
||||
athlete.getId(), athlete.getPlayerName(), originalCalculatedScore, dto.getModifiedScore(), dto.getNote());
|
||||
} else {
|
||||
// 7b. 创建新的裁判长修改记录
|
||||
// 7b. 创建新的主裁判修改记录
|
||||
MartialScore modificationRecord = new MartialScore();
|
||||
modificationRecord.setCompetitionId(athlete.getCompetitionId());
|
||||
modificationRecord.setAthleteId(athlete.getId());
|
||||
@@ -395,11 +395,11 @@ public class MartialScoreServiceImpl extends ServiceImpl<MartialScoreMapper, Mar
|
||||
// 查询修改者信息
|
||||
MartialJudge modifier = judgeService.getById(dto.getModifierId());
|
||||
if (modifier != null) {
|
||||
modificationRecord.setJudgeName(modifier.getName() + "(裁判长修改)");
|
||||
modificationRecord.setJudgeName(modifier.getName() + "(主裁判修改)");
|
||||
}
|
||||
|
||||
recordSaved = this.save(modificationRecord);
|
||||
log.info("裁判长新增评分记录 - 选手ID:{}, 姓名:{}, 原始计算总分:{}, 修改后总分:{}, 修改原因:{}",
|
||||
log.info("主裁判新增评分记录 - 选手ID:{}, 姓名:{}, 原始计算总分:{}, 修改后总分:{}, 修改原因:{}",
|
||||
athlete.getId(), athlete.getPlayerName(), originalCalculatedScore, dto.getModifiedScore(), dto.getNote());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user