|
|
@ -136,13 +136,13 @@ public class ProvinceService implements IProvinceService { |
|
|
|
throw new BaseException(CodeEnum.WBS_REPEAT_MEMBER_PHONE); |
|
|
|
} |
|
|
|
//判断各种证件是否为空
|
|
|
|
if(ObjectUtil.isNull(param.getCompeteId())){ throw new BaseException(CodeEnum.PARAM_ERROR); } |
|
|
|
if(ObjectUtil.isNull(param.getGroupId())){ throw new BaseException(CodeEnum.PARAM_ERROR); } |
|
|
|
if(ObjectUtil.isNull(param.getIdCardFront())){ throw new BaseException(CodeEnum.PARAM_ERROR); } |
|
|
|
if(ObjectUtil.isNull(param.getIdPhone())){ throw new BaseException(CodeEnum.PARAM_ERROR); } |
|
|
|
if(ObjectUtil.isNull(param.getStudentRecord())){ throw new BaseException(CodeEnum.PARAM_ERROR); } |
|
|
|
if(ObjectUtil.isNull(param.getHealthRecord())){ throw new BaseException(CodeEnum.PARAM_ERROR); } |
|
|
|
if(ObjectUtil.isNull(param.getInsuranceRecord())){ throw new BaseException(CodeEnum.PARAM_ERROR); } |
|
|
|
if(ObjectUtil.isNull(param.getCompeteId())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY); } |
|
|
|
if(ObjectUtil.isNull(param.getGroupId())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY); } |
|
|
|
if(ObjectUtil.isNull(param.getIdCardFront())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY); } |
|
|
|
if(ObjectUtil.isNull(param.getIdPhone())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY); } |
|
|
|
if(ObjectUtil.isNull(param.getStudentRecord())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY); } |
|
|
|
if(ObjectUtil.isNull(param.getHealthRecord())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY); } |
|
|
|
if(ObjectUtil.isNull(param.getInsuranceRecord())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY); } |
|
|
|
player.setIdCard(param.getIdCard()); |
|
|
|
player.setCompanyId(param.getCompeteId()); |
|
|
|
player.setCompeteGroupId(param.getGroupId()); |
|
|
@ -248,49 +248,53 @@ public class ProvinceService implements IProvinceService { |
|
|
|
if (ObjectUtil.isNull(companyid)){ |
|
|
|
Long id = snowflake.nextId(); |
|
|
|
competeCompany.setId(id); |
|
|
|
competeCompany.setCoachNum(param.getCoachNum()); |
|
|
|
if (ObjectUtil.isNull(param.getCompanyName())){ |
|
|
|
throw new BaseException(CodeEnum.PARAM_ERROR); |
|
|
|
// competeCompany.setCoachNum(param.getCoachNum());
|
|
|
|
if (StrUtil.isEmpty(param.getCompanyName())){ |
|
|
|
throw new BaseException(CodeEnum.NAME_EMPTY); |
|
|
|
} |
|
|
|
competeCompany.setName(param.getCompanyName()); |
|
|
|
if (ObjectUtil.isNull(param.getContactsName())){ |
|
|
|
throw new BaseException(CodeEnum.PARAM_ERROR); |
|
|
|
if (StrUtil.isEmpty(param.getContactsName())){ |
|
|
|
throw new BaseException(CodeEnum.NAME_EMPTY); |
|
|
|
} |
|
|
|
competeCompany.setContactsName(param.getContactsName()); |
|
|
|
if (ObjectUtil.isNull(param.getContactsPhone())){ |
|
|
|
throw new BaseException(CodeEnum.PARAM_ERROR); |
|
|
|
|
|
|
|
if(StrUtil.isEmpty(param.getContactsPhone()) || !param.getContactsPhone().matches(WebConstant.REGEX_PHONE)){ |
|
|
|
throw new BaseException(CodeEnum.PHONE_ERR); |
|
|
|
} |
|
|
|
competeCompany.setContactsPhone(param.getContactsPhone()); |
|
|
|
competeCompany.setLeaderNum(param.getGuideNum()); |
|
|
|
competeCompany.setJoinNum(param.getPlayerNum()); |
|
|
|
competeCompany.setUserId(userId); |
|
|
|
competeCompany.setCompeteTimeId(param.getCompeteTimeId()); |
|
|
|
// if (ObjectUtil.isNull(authorization)){
|
|
|
|
// throw new BaseException(CodeEnum.PARAM_ERROR);
|
|
|
|
// }
|
|
|
|
if(param.getAuthorization() != 1){ |
|
|
|
throw new BaseException(CodeEnum.AUTHORIZATION_AGREE); |
|
|
|
} |
|
|
|
competeCompany.setAuthorization(param.getAuthorization()); |
|
|
|
competeCompanyDao.insertSelective(competeCompany); |
|
|
|
}else { |
|
|
|
//不为空,根据单位id查出来修改 判断传进来的参数是否为空 为空则跳过 不为空则修改
|
|
|
|
competeCompany = competeCompanyDao.selectByPrimaryKey(companyid); |
|
|
|
if (ObjectUtil.isNotNull(param.getCoachNum())){ |
|
|
|
competeCompany.setCoachNum(param.getCoachNum()); |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotNull(param.getCompanyName())) { |
|
|
|
// if (ObjectUtil.isNotNull(param.getCoachNum())){
|
|
|
|
// competeCompany.setCoachNum(param.getCoachNum());
|
|
|
|
// }
|
|
|
|
if (StrUtil.isNotEmpty(param.getCompanyName())) { |
|
|
|
competeCompany.setName(param.getCompanyName()); |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotNull(param.getContactsName())) { |
|
|
|
if (StrUtil.isNotEmpty(param.getContactsName())) { |
|
|
|
competeCompany.setContactsName(param.getContactsName()); |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotNull(param.getContactsPhone())) { |
|
|
|
if (StrUtil.isNotEmpty(param.getContactsPhone())) { |
|
|
|
if(!param.getContactsPhone().matches(WebConstant.REGEX_PHONE)){ |
|
|
|
throw new BaseException(CodeEnum.PHONE_ERR); |
|
|
|
} |
|
|
|
competeCompany.setContactsPhone(param.getContactsPhone()); |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotNull(param.getGuideNum())) { |
|
|
|
competeCompany.setLeaderNum(param.getGuideNum()); |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotNull(param.getPlayerNum())) { |
|
|
|
competeCompany.setJoinNum(param.getPlayerNum()); |
|
|
|
} |
|
|
|
// if (ObjectUtil.isNotNull(param.getGuideNum())) {
|
|
|
|
// competeCompany.setLeaderNum(param.getGuideNum());
|
|
|
|
// }
|
|
|
|
// if (ObjectUtil.isNotNull(param.getPlayerNum())) {
|
|
|
|
// competeCompany.setJoinNum(param.getPlayerNum());
|
|
|
|
// }
|
|
|
|
competeCompanyDao.updateByPrimaryKeySelective(competeCompany); |
|
|
|
// competeCompany1.setCompanyId(competeCompany.getId());
|
|
|
|
// competeCompany1.setCoachNum(competeCompany.getCoachNum());
|
|
|
@ -308,9 +312,9 @@ public class ProvinceService implements IProvinceService { |
|
|
|
@Override |
|
|
|
public ProvinceCompeteVo.CompeteCompanyHeadList queryCoach(ProvinceCompeteDto.CompanyIdVo param) { |
|
|
|
Long company = param.getCompanyId(); |
|
|
|
if (ObjectUtil.isNull(company)){ |
|
|
|
throw new BaseException(CodeEnum.PARAM_ERROR); |
|
|
|
} |
|
|
|
// if (ObjectUtil.isNull(company)){
|
|
|
|
// throw new BaseException(CodeEnum.PARAM_ERROR);
|
|
|
|
// }
|
|
|
|
CompeteCoachExample competeCoachExample = new CompeteCoachExample(); |
|
|
|
competeCoachExample.createCriteria().andCompanyIdEqualTo(company); |
|
|
|
List<CompeteCoach> competeCoachList = competeCoachMapper.selectByExample(competeCoachExample); |
|
|
@ -386,9 +390,10 @@ public class ProvinceService implements IProvinceService { |
|
|
|
CompeteCoachExample competeCoachExample = new CompeteCoachExample(); |
|
|
|
competeCoachExample.createCriteria().andIdEqualTo(id); |
|
|
|
competeCoachMapper.updateByExample(competeCoach,competeCoachExample); |
|
|
|
}else { |
|
|
|
throw new BaseException(CodeEnum.PARAM_ERROR); |
|
|
|
} |
|
|
|
// else {
|
|
|
|
// throw new BaseException(CodeEnum.PARAM_ERROR);
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
@ -423,38 +428,15 @@ public class ProvinceService implements IProvinceService { |
|
|
|
// CompetePlayerExample competePlayerExample = new CompetePlayerExample();
|
|
|
|
// competePlayerExample.createCriteria().andIdEqualTo(playerId);
|
|
|
|
// competePlayerMapper.updateByExampleSelective(competePlayer,competePlayerExample);
|
|
|
|
}else { |
|
|
|
throw new BaseException(CodeEnum.PARAM_ERROR); |
|
|
|
} |
|
|
|
// else {
|
|
|
|
// throw new BaseException(CodeEnum.PARAM_ERROR);
|
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ProvinceCompeteVo.PlayerInfo getPlayerInfo(CompeteDto.DelPlayer param) { |
|
|
|
//<<<<<<< HEAD
|
|
|
|
return competePlayerDao.getPlayerByPlayerId(param.getPlayerId()); |
|
|
|
//=======
|
|
|
|
////
|
|
|
|
// Long playerId = param.getPlayerId();
|
|
|
|
// CompetePlayer competePlayer = competePlayerMapper.selectByPrimaryKey(playerId);
|
|
|
|
// if (ObjectUtil.isNull(competePlayer)){
|
|
|
|
// throw new BaseException(CodeEnum.PARAM_ERROR);
|
|
|
|
// }
|
|
|
|
//// ProvinceCompeteVo.PlayerInfo playerInfo = new ProvinceCompeteVo.PlayerInfo();
|
|
|
|
//// playerInfo.setPlayerId(competePlayer.getId());
|
|
|
|
//// playerInfo.setCompeteId(competePlayer.getCompeteTimeId());
|
|
|
|
//// playerInfo.setGroupId(competePlayer.getCompeteGroupId());
|
|
|
|
//// playerInfo.setPlayerName(competePlayer.getName());
|
|
|
|
//// playerInfo.setGender(competePlayer.getGender());
|
|
|
|
//// playerInfo.setIdCard(competePlayer.getIdCard());
|
|
|
|
//// playerInfo.setIdCardFront(competePlayer.getIdCardFront());
|
|
|
|
//// playerInfo.setIdCardBack(competePlayer.getIdCardBack());
|
|
|
|
//// playerInfo.setIdPhone(competePlayer.getIdPhotoFile());
|
|
|
|
//// playerInfo.setStudentRecord(competePlayer.getStudentRecordFile());
|
|
|
|
//// playerInfo.setHealthRecord(competePlayer.getHealthRecordFile());
|
|
|
|
//// playerInfo.setInsuranceRecord(competePlayer.getInsuranceRecordFile());
|
|
|
|
//// return playerInfo;
|
|
|
|
// return competePlayerDao.getPlayerByPlayerId(playerId);
|
|
|
|
//>>>>>>> f1a5f1b5d162548202a10e15eaec41aacda91a21
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -471,24 +453,24 @@ public class ProvinceService implements IProvinceService { |
|
|
|
} |
|
|
|
//手机号不能为空,且正确
|
|
|
|
if(StrUtil.isEmpty(param.getPhone()) || !param.getPhone().matches(WebConstant.REGEX_PHONE)){ |
|
|
|
throw new BaseException(CodeEnum.PARAM_ERROR); |
|
|
|
throw new BaseException(CodeEnum.PHONE_ERR); |
|
|
|
} |
|
|
|
//身份证不能为空,且正确
|
|
|
|
if(StrUtil.isEmpty(param.getIdCard()) || !IdcardUtil.isValidCard(param.getIdCard())){ |
|
|
|
throw new BaseException(CodeEnum.PARAM_ERROR); |
|
|
|
throw new BaseException(CodeEnum.ID_CARD_ERROR); |
|
|
|
} |
|
|
|
//证件照判断
|
|
|
|
if (ObjectUtil.isNull(param.getIdPhoto())){ |
|
|
|
throw new BaseException(CodeEnum.PARAM_ERROR); |
|
|
|
if (param.getIdentity() == 1 && ObjectUtil.isNull(param.getIdPhoto())){ |
|
|
|
throw new BaseException(CodeEnum.PHOTO_IS_EMPTY); |
|
|
|
} |
|
|
|
CompeteCoach competeCoach1 = new CompeteCoach(); |
|
|
|
competeCoach1.setId(snowflake.nextId()); |
|
|
|
BeanUtil.copyProperties(param, competeCoach1); |
|
|
|
competeCoachMapper.insertSelective(competeCoach1); |
|
|
|
}else { |
|
|
|
CompeteCoach competeCoach2 = new CompeteCoach(); |
|
|
|
BeanUtil.copyProperties(param, competeCoach2); |
|
|
|
competeCoachMapper.updateByPrimaryKeySelective(competeCoach2); |
|
|
|
CompeteCoach competeCoach = competeCoachMapper.selectByPrimaryKey(param.getCoachId()); |
|
|
|
BeanUtil.copyProperties(param, competeCoach); |
|
|
|
competeCoachMapper.updateByPrimaryKeySelective(competeCoach); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -501,20 +483,20 @@ public class ProvinceService implements IProvinceService { |
|
|
|
CompeteProject competeProject = competeProjectMapper.selectByPrimaryKey(param.getProjectId()); |
|
|
|
if(ObjectUtil.isNull(competeProject)){ throw new BaseException(CodeEnum.PARAM_ERROR); } |
|
|
|
|
|
|
|
//检查参赛人数是否符合
|
|
|
|
// if(CollectionUtil.isEmpty(param.getPlayers())){ throw new BaseException(CodeEnum.PARAM_ERROR); }
|
|
|
|
int joinCount = 0; |
|
|
|
for(ProvinceCompeteDto.JoinProjectPlayer joinProject : param.getPlayers()){ |
|
|
|
if(joinProject.getJoinProject() == 1){ |
|
|
|
joinCount++; |
|
|
|
} |
|
|
|
} |
|
|
|
if(joinCount > competeProject.getMemberMax() ){ |
|
|
|
throw new BaseException(CodeEnum.TEAM_MEMBER_ERROR); |
|
|
|
} |
|
|
|
// //检查参赛人数是否符合
|
|
|
|
// int joinCount = 0;
|
|
|
|
// for(ProvinceCompeteDto.JoinProjectPlayer joinProject : param.getPlayers()){
|
|
|
|
// if(joinProject.getJoinProject() == 1){
|
|
|
|
// joinCount++;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//// if(joinCount > competeProject.getMemberMax() ){
|
|
|
|
//// throw new BaseException(CodeEnum.TEAM_MEMBER_ERROR);
|
|
|
|
//// }
|
|
|
|
//判断项目是个人还是团队,参加
|
|
|
|
if(competeProject.getTeam() == 0){ |
|
|
|
param.getPlayers().forEach(joinPlayer -> { |
|
|
|
// param.getPlayers().forEach(joinPlayer -> {
|
|
|
|
for(ProvinceCompeteDto.JoinProjectPlayer joinPlayer : param.getPlayers()){ |
|
|
|
//检查此用户之前是否参加此项目
|
|
|
|
CompeteProjectPlayerExample example = new CompeteProjectPlayerExample(); |
|
|
|
example.createCriteria().andProjectIdEqualTo(competeProject.getId()).andPlayerIdEqualTo(joinPlayer.getPlayerId()) |
|
|
@ -554,7 +536,8 @@ public class ProvinceService implements IProvinceService { |
|
|
|
projectPlayer.setGenderGroup(player.getGender()); |
|
|
|
projectPlayerMapper.insertSelective(projectPlayer); |
|
|
|
} |
|
|
|
}); |
|
|
|
// });
|
|
|
|
} |
|
|
|
}else { |
|
|
|
//查找当前公司是否已经报名此项目
|
|
|
|
CompeteTeam competeTeam; |
|
|
@ -573,6 +556,23 @@ public class ProvinceService implements IProvinceService { |
|
|
|
competeTeamDao.insertSelective(competeTeam); |
|
|
|
} |
|
|
|
|
|
|
|
//检查参赛人数是否符合
|
|
|
|
int joinCount = 0; |
|
|
|
for(ProvinceCompeteDto.JoinProjectPlayer joinProject : param.getPlayers()){ |
|
|
|
if(joinProject.getJoinProject() == 1){ |
|
|
|
joinCount++; |
|
|
|
}else { |
|
|
|
joinCount--; |
|
|
|
} |
|
|
|
} |
|
|
|
CompeteTeamMemberExample example = new CompeteTeamMemberExample(); |
|
|
|
example.createCriteria().andCompeteTeamIdEqualTo(competeTeam.getId()); |
|
|
|
long memberNum = teamMemberMapper.countByExample(example); |
|
|
|
|
|
|
|
if(joinCount + memberNum > competeProject.getMemberMax() ){ |
|
|
|
throw new BaseException(CodeEnum.TEAM_MEMBER_ERROR); |
|
|
|
} |
|
|
|
|
|
|
|
for (int i = 0; i < param.getPlayers().size(); i++) { |
|
|
|
ProvinceCompeteDto.JoinProjectPlayer joinProjectPlayer = param.getPlayers().get(i); |
|
|
|
CompetePlayer player = competePlayerDao.selectByPrimaryKey(joinProjectPlayer.getPlayerId()); |
|
|
|