refactor: implement ScheduleStatusServiceImpl
Phase 2, Step 2.9: Extract status logic from MartialScheduleServiceImpl - Implement updateParticipantCheckInStatus method (17 lines) - Complete status management logic extraction Related to Phase 2 refactoring plan
This commit is contained in:
+37
@@ -0,0 +1,37 @@
|
|||||||
|
package org.springblade.modules.martial.service.impl;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springblade.modules.martial.mapper.MartialScheduleParticipantMapper;
|
||||||
|
import org.springblade.modules.martial.pojo.entity.MartialScheduleParticipant;
|
||||||
|
import org.springblade.modules.martial.service.IScheduleStatusService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ScheduleStatusServiceImpl implements IScheduleStatusService {
|
||||||
|
|
||||||
|
private final MartialScheduleParticipantMapper scheduleParticipantMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean updateParticipantCheckInStatus(Long participantId, String status) {
|
||||||
|
if (participantId == null || status == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
MartialScheduleParticipant participant = scheduleParticipantMapper.selectById(participantId);
|
||||||
|
if (participant == null) {
|
||||||
|
log.warn("参赛者不存在, participantId: {}", participantId);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
participant.setCheckInStatus(status);
|
||||||
|
int result = scheduleParticipantMapper.updateById(participant);
|
||||||
|
|
||||||
|
log.info("更新参赛者签到状态: participantId={}, status={}, result={}", participantId, status, result);
|
||||||
|
return result > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user