|
|
@ -119,8 +119,9 @@ public class ProvinceService implements IProvinceService { |
|
|
|
CompetePlayer player = new CompetePlayer(); |
|
|
|
player.setId(snowflake.nextId()); |
|
|
|
player.setName(param.getPlayerName()); |
|
|
|
player.setGender((byte) param.getGender()); |
|
|
|
|
|
|
|
|
|
|
|
if(ObjectUtil.isNull(param.getCompeteId())){ throw new BaseException(CodeEnum.NOT_COMPANY); } |
|
|
|
//身份证不能为空,且正确
|
|
|
|
if(StrUtil.isEmpty(param.getIdCard()) || !IdcardUtil.isValidCard(param.getIdCard())){throw new BaseException(CodeEnum.ID_CARD_ERROR);} |
|
|
|
//是否已注册
|
|
|
@ -129,14 +130,26 @@ public class ProvinceService implements IProvinceService { |
|
|
|
if(competePlayerDao.countByExample(competePlayerExample) != 0){ |
|
|
|
throw new BaseException(CodeEnum.ID_CARD_ALREADY); |
|
|
|
} |
|
|
|
|
|
|
|
if(ObjectUtil.isNull(param.getCompeteId())){ throw new BaseException(CodeEnum.NOT_COMPANY); } |
|
|
|
if(ObjectUtil.isNull(param.getGroupId())){ throw new BaseException(CodeEnum.MT_NOT_GROUP); } |
|
|
|
//检查性别与组别是否匹配
|
|
|
|
CompeteGroup competeGroup = competeGroupMapper.selectByPrimaryKey(param.getGroupId()); |
|
|
|
if(ObjectUtil.isNull(competeGroup) || param.getGender() != competeGroup.getSex()){ |
|
|
|
throw new BaseException(CodeEnum.MT_NOT_GROUP); |
|
|
|
//验证性别是否正确
|
|
|
|
int gender = IdcardUtil.getGenderByIdCard(param.getIdCard()); |
|
|
|
if(gender != param.getGender()){ |
|
|
|
throw new BaseException(CodeEnum.GENDER_ERROR); |
|
|
|
} |
|
|
|
//通过groupRemark和性别查找选手组别信息
|
|
|
|
CompeteGroup competeGroup = new CompeteGroup(); |
|
|
|
CompeteGroupExample competeGroupExample = new CompeteGroupExample(); |
|
|
|
competeGroupExample.createCriteria().andSexEqualTo((byte) param.getGender()).andGroupRemarkEqualTo((byte) param.getGroupRemark()); |
|
|
|
List<CompeteGroup> groupList = competeGroupMapper.selectByExample(competeGroupExample); |
|
|
|
if(CollectionUtil.isNotEmpty(groupList)){ |
|
|
|
competeGroup = groupList.get(0); |
|
|
|
} |
|
|
|
// if(ObjectUtil.isNull(param.getGroupId())){ throw new BaseException(CodeEnum.MT_NOT_GROUP); }
|
|
|
|
|
|
|
|
// //检查性别与组别是否匹配
|
|
|
|
// CompeteGroup competeGroup = competeGroupMapper.selectByPrimaryKey(param.getGroupId());
|
|
|
|
// if(ObjectUtil.isNull(competeGroup) || param.getGender() != competeGroup.getSex()){
|
|
|
|
// throw new BaseException(CodeEnum.MT_NOT_GROUP);
|
|
|
|
// }
|
|
|
|
//获取选手年龄
|
|
|
|
int ageByIdCard = IdcardUtil.getAgeByIdCard(param.getIdCard()); |
|
|
|
//判断年龄和分组是否匹配
|
|
|
@ -153,28 +166,17 @@ public class ProvinceService implements IProvinceService { |
|
|
|
if(ObjectUtil.isNull(param.getStudentRecord())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY.mtMsgPhoto("学籍证明")); } |
|
|
|
if(ObjectUtil.isNull(param.getHealthRecord())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY.mtMsgPhoto("健康证明")); } |
|
|
|
if(ObjectUtil.isNull(param.getInsuranceRecord())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY.mtMsgPhoto("保险证明")); } |
|
|
|
player.setGender((byte) param.getGender()); |
|
|
|
player.setIdCard(param.getIdCard()); |
|
|
|
player.setCompanyId(param.getCompeteId()); |
|
|
|
player.setCompeteGroupId(param.getGroupId()); |
|
|
|
player.setGroupRemark((byte) param.getGroupRemark()); |
|
|
|
player.setIdCardFrontFile(param.getIdCardFront()); |
|
|
|
player.setIdCardBackFile(param.getIdCardBack()); |
|
|
|
player.setIdPhotoFile(param.getIdPhone()); |
|
|
|
player.setStudentRecordFile(param.getStudentRecord()); |
|
|
|
player.setHealthRecordFile(param.getHealthRecord()); |
|
|
|
player.setInsuranceRecordFile(param.getInsuranceRecord()); |
|
|
|
|
|
|
|
// //添加身份证正面照片
|
|
|
|
// player.setIdCardFrontFile(uploadPhotoFile(param.getIdCardFront(),userId));
|
|
|
|
// //身份证反面
|
|
|
|
// player.setIdCardBackFile(uploadPhotoFile(param.getIdCardFront(),userId));
|
|
|
|
// //一寸证件照
|
|
|
|
// player.setIdPhotoFile(uploadPhotoFile(param.getIdCardFront(),userId));
|
|
|
|
// //学籍证明
|
|
|
|
// player.setStudentRecordFile(uploadPhotoFile(param.getIdCardFront(),userId));
|
|
|
|
// //健康证明
|
|
|
|
// player.setHealthRecordFile(uploadPhotoFile(param.getIdCardFront(),userId));
|
|
|
|
// //保险证明
|
|
|
|
// player.setInsuranceRecordFile(uploadPhotoFile(param.getIdCardFront(),userId));
|
|
|
|
competePlayerDao.insertSelective(player); |
|
|
|
log.info("新加参赛选手:{}",player); |
|
|
|
}else { |
|
|
@ -182,6 +184,31 @@ public class ProvinceService implements IProvinceService { |
|
|
|
CompetePlayer player = competePlayerDao.selectByPrimaryKey(param.getPlayerId()); |
|
|
|
log.info("查找需要修改的选手信息:{}",player); |
|
|
|
if(ObjectUtil.isNull(player)){ throw new BaseException(CodeEnum.PARAM_ERROR); } |
|
|
|
//身份证不能为空,且正确
|
|
|
|
if(!IdcardUtil.isValidCard(param.getIdCard())){throw new BaseException(CodeEnum.ID_CARD_ERROR);} |
|
|
|
//是否已注册
|
|
|
|
CompetePlayerExample competePlayerExample = new CompetePlayerExample(); |
|
|
|
competePlayerExample.createCriteria().andIdCardEqualTo(param.getIdCard()).andIdNotEqualTo(param.getPlayerId()); |
|
|
|
if(competePlayerDao.countByExample(competePlayerExample) != 0){throw new BaseException(CodeEnum.ID_CARD_ALREADY);} |
|
|
|
//验证性别是否正确
|
|
|
|
int gender = IdcardUtil.getGenderByIdCard(param.getIdCard()); |
|
|
|
if(gender != param.getGender()){ |
|
|
|
throw new BaseException(CodeEnum.GENDER_ERROR); |
|
|
|
} |
|
|
|
//通过groupRemark和性别查找选手组别信息
|
|
|
|
CompeteGroup competeGroup = new CompeteGroup(); |
|
|
|
CompeteGroupExample competeGroupExample = new CompeteGroupExample(); |
|
|
|
competeGroupExample.createCriteria().andSexEqualTo((byte) param.getGender()).andGroupRemarkEqualTo((byte) param.getGroupRemark()); |
|
|
|
List<CompeteGroup> groupList = competeGroupMapper.selectByExample(competeGroupExample); |
|
|
|
if(CollectionUtil.isNotEmpty(groupList)){ |
|
|
|
competeGroup = groupList.get(0); |
|
|
|
} |
|
|
|
//获取选手年龄
|
|
|
|
int ageByIdCard = IdcardUtil.getAgeByIdCard(param.getIdCard()); |
|
|
|
//判断年龄和分组是否匹配
|
|
|
|
if(ageByIdCard < competeGroup.getMinAge() || ageByIdCard > competeGroup.getMaxAge()){ |
|
|
|
throw new BaseException(CodeEnum.MT_NOT_GROUP); |
|
|
|
} |
|
|
|
//字段不为空则修改
|
|
|
|
if(StrUtil.isNotEmpty(param.getPlayerName())){player.setName(param.getPlayerName());} |
|
|
|
if(StrUtil.isNotEmpty(param.getIdCard())){player.setIdCard(param.getIdCard());} |
|
|
@ -195,13 +222,6 @@ public class ProvinceService implements IProvinceService { |
|
|
|
if(ObjectUtil.isNotNull(param.getStudentRecord())){player.setStudentRecordFile(param.getStudentRecord());} |
|
|
|
if(ObjectUtil.isNotNull(param.getHealthRecord())){player.setHealthRecordFile(param.getHealthRecord());} |
|
|
|
if(ObjectUtil.isNotNull(param.getInsuranceRecord())){player.setInsuranceRecordFile(param.getInsuranceRecord());} |
|
|
|
|
|
|
|
// if(ObjectUtil.isNotNull(param.getIdCardFront())){player.setIdCardFrontFile(uploadPhotoFile(param.getIdCardFront(),userId));}
|
|
|
|
// if(ObjectUtil.isNotNull(param.getIdCardBack())){player.setIdCardBackFile(uploadPhotoFile(param.getIdCardFront(),userId));}
|
|
|
|
// if(ObjectUtil.isNotNull(param.getIdPhone())){player.setIdPhotoFile(uploadPhotoFile(param.getIdCardFront(),userId));}
|
|
|
|
// if(ObjectUtil.isNotNull(param.getStudentRecord())){ player.setStudentRecordFile(uploadPhotoFile(param.getIdCardFront(),userId));}
|
|
|
|
// if(ObjectUtil.isNotNull(param.getHealthRecord())){ player.setHealthRecordFile(uploadPhotoFile(param.getIdCardFront(),userId));}
|
|
|
|
// if(ObjectUtil.isNotNull(param.getInsuranceRecord())){ player.setInsuranceRecordFile(uploadPhotoFile(param.getIdCardFront(),userId));}
|
|
|
|
competePlayerDao.updateByPrimaryKeySelective(player); |
|
|
|
} |
|
|
|
} |
|
|
@ -606,5 +626,18 @@ public class ProvinceService implements IProvinceService { |
|
|
|
public ProvinceCompeteVo.GetCoach getCoachInfo(CompeteDto.LeaderId param) { |
|
|
|
return competeCompanyDao.getCoachInfo(param.getCoachId()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查找团体项目下的参赛选手信息 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<ProvinceCompeteVo.GroupAndPlayer> getPlayerByTeamProject(ProvinceCompeteDto.GetPlayerByTeamProject param) { |
|
|
|
//查找项目
|
|
|
|
CompeteProject competeProject = competeProjectMapper.selectByPrimaryKey(param.getProjectId()); |
|
|
|
if(ObjectUtil.isNotNull(competeProject)){ |
|
|
|
List<ProvinceCompeteVo.GroupAndPlayer> groupAndPlayerList = competeCompanyDao.getPlayerByTeamProject(param.getProjectId(),competeProject.getType()); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|