无关风月
2025-04-10 b74277583bf9b2b89247061bf08c17a03b71c76e
cloud-server-competition/src/main/java/com/dsh/competition/service/impl/ParticipantServiceImpl.java
@@ -23,6 +23,7 @@
import com.dsh.competition.util.JuHeUtil;
import com.dsh.competition.util.ResultUtil;
import com.dsh.competition.util.ToolUtil;
import io.undertow.util.DateUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -88,6 +89,26 @@
        participant.setState(1);
        participant.setInsertTime(new Date());
        this.save(participant);
        TStudent tStudent = new TStudent();
        tStudent.setAppUserId(uid);
        tStudent.setName(addParticipant.getName());
        tStudent.setPhone(addParticipant.getPhone());
        if (ToolUtil.isNotEmpty(addParticipant.getBirthday())){
            Date date = DateUtils.parseDate(addParticipant.getBirthday());
            tStudent.setBirthday(date);
        }else{
                String birthDateStr = addParticipant.getIdcard().substring(6, 14);
                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
            Date parse = dateFormat.parse(birthDateStr);
            tStudent.setBirthday(parse);
        }
        tStudent.setSex(addParticipant.getGender());
        tStudent.setIdCard(addParticipant.getIdcard());
        tStudent.setState(1);
        tStudent.setInsertTime(new Date());
        tStudent.setHeadImg(addParticipant.getHeadImg());
        tStudent.setIsDefault(2);
        studentClient.addStudent(tStudent);
        return ResultUtil.success();
    }