|
|
@ -2,6 +2,7 @@ package com.ccsens.mt.service; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.lang.Filter; |
|
|
|
import cn.hutool.core.lang.Snowflake; |
|
|
|
import cn.hutool.core.util.IdcardUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
@ -61,6 +62,9 @@ public class ProvinceService implements IProvinceService { |
|
|
|
private CompetePlayerMapper competePlayerMapper; |
|
|
|
@Resource |
|
|
|
private CompeteGroupMapper competeGroupMapper; |
|
|
|
@Resource |
|
|
|
private CompeteProjectGroupMapper projectGroupMapper; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 查找当前用户填写的信息的概览 |
|
|
@ -87,7 +91,22 @@ public class ProvinceService implements IProvinceService { |
|
|
|
if(ObjectUtil.isNotNull(company)){ |
|
|
|
type = company.getType(); |
|
|
|
} |
|
|
|
return competeCompanyDao.queryPlayerByGroupId(type,param.getCompanyId(),param.getGroupId(),param.getProjectId()); |
|
|
|
List<ProvinceCompeteVo.GroupAndPlayer> groupAndPlayerList = competeCompanyDao.queryPlayerByGroupId(type,param.getCompanyId(),param.getGroupId(),param.getProjectId()); |
|
|
|
if(CollectionUtil.isNotEmpty(groupAndPlayerList) && ObjectUtil.isNotNull(param.getProjectId())){ |
|
|
|
//如果查出来的列表不为空,且项目id也不为空,查找哪些组别不可报名该项目
|
|
|
|
CompeteProjectGroupExample projectGroupExample = new CompeteProjectGroupExample(); |
|
|
|
projectGroupExample.createCriteria().andProjectIdEqualTo(param.getProjectId()); |
|
|
|
List<CompeteProjectGroup> projectGroupList = projectGroupMapper.selectByExample(projectGroupExample); |
|
|
|
if(CollectionUtil.isNotEmpty(projectGroupList)){ |
|
|
|
List<ProvinceCompeteVo.GroupAndPlayer> groupAndPlayers = groupAndPlayerList; |
|
|
|
for(CompeteProjectGroup projectGroup : projectGroupList){ |
|
|
|
//将不可报名的组别删掉
|
|
|
|
groupAndPlayers = CollectionUtil.filter(groupAndPlayers, (Filter<ProvinceCompeteVo.GroupAndPlayer>) aa -> !aa.getGroupId().equals(projectGroup.getGroupId())); |
|
|
|
} |
|
|
|
return groupAndPlayers; |
|
|
|
} |
|
|
|
} |
|
|
|
return groupAndPlayerList; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -180,7 +199,7 @@ public class ProvinceService implements IProvinceService { |
|
|
|
if(ObjectUtil.isNull(param.getIdPhone())){ throw new BaseException(CodeEnum.PHOTO_IS_EMPTY.mtMsgPhoto("证件照")); } |
|
|
|
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("保险证明")); } |
|
|
|
// 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()); |
|
|
@ -192,6 +211,7 @@ public class ProvinceService implements IProvinceService { |
|
|
|
player.setStudentRecordFile(param.getStudentRecord()); |
|
|
|
player.setHealthRecordFile(param.getHealthRecord()); |
|
|
|
player.setInsuranceRecordFile(param.getInsuranceRecord()); |
|
|
|
player.setResponsibilityRiskFile(param.getResponsibilityRiskFile()); |
|
|
|
competePlayerDao.insertSelective(player); |
|
|
|
log.info("新加参赛选手:{}",player); |
|
|
|
}else { |
|
|
@ -252,7 +272,8 @@ public class ProvinceService implements IProvinceService { |
|
|
|
if(ObjectUtil.isNotNull(param.getIdPhone())){player.setIdPhotoFile(param.getIdPhone());} |
|
|
|
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.getInsuranceRecord())){player.setInsuranceRecordFile(param.getInsuranceRecord());}
|
|
|
|
if(ObjectUtil.isNotNull(param.getResponsibilityRiskFile())){player.setResponsibilityRiskFile(param.getResponsibilityRiskFile());} |
|
|
|
competePlayerDao.updateByPrimaryKeySelective(player); |
|
|
|
} |
|
|
|
} |
|
|
@ -289,7 +310,12 @@ public class ProvinceService implements IProvinceService { |
|
|
|
Long companyid = param.getCompanyId(); |
|
|
|
CompeteCompany competeCompany = new CompeteCompany(); |
|
|
|
//单位id为空,新增
|
|
|
|
if (ObjectUtil.isNull(companyid)){ |
|
|
|
if (ObjectUtil.isNull(companyid) || companyid == 0L){ |
|
|
|
int type = 0; |
|
|
|
CompeteTime competeTime = competeTimeDao.selectByPrimaryKey(param.getCompeteTimeId()); |
|
|
|
if(ObjectUtil.isNotNull(competeTime)){ |
|
|
|
type = competeTime.getType(); |
|
|
|
} |
|
|
|
//检查当前用户是否已经添加过单位,有的话直接返回
|
|
|
|
CompeteCompanyExample companyExample = new CompeteCompanyExample(); |
|
|
|
companyExample.createCriteria().andUserIdEqualTo(userId).andCompeteTimeIdEqualTo(param.getCompeteTimeId()); |
|
|
@ -315,6 +341,7 @@ public class ProvinceService implements IProvinceService { |
|
|
|
competeCompany.setJoinNum(param.getPlayerNum()); |
|
|
|
competeCompany.setUserId(userId); |
|
|
|
competeCompany.setCompeteTimeId(param.getCompeteTimeId()); |
|
|
|
competeCompany.setType((byte) type); |
|
|
|
if (param.getAuthorization() != 1) { |
|
|
|
throw new BaseException(CodeEnum.AUTHORIZATION_AGREE); |
|
|
|
} |
|
|
@ -475,11 +502,11 @@ public class ProvinceService implements IProvinceService { |
|
|
|
CompeteCoachExample competeCoachExample = new CompeteCoachExample(); |
|
|
|
competeCoachExample.createCriteria().andCompanyIdEqualTo(param.getCompanyId()).andIdentityEqualTo((byte) param.getIdentity()); |
|
|
|
long count = competeCoachMapper.countByExample(competeCoachExample); |
|
|
|
if (param.getIdentity() == 0 && count >= 2){ |
|
|
|
throw new BaseException(CodeEnum.COACH_NUM_FULL); |
|
|
|
if (param.getIdentity() == 0 && count >= 1){ |
|
|
|
throw new BaseException(CodeEnum.LEADER_NUM_FULL); |
|
|
|
} |
|
|
|
if (param.getIdentity() == 1 && count >=3){ |
|
|
|
throw new BaseException(CodeEnum.LEADER_NUM_FULL); |
|
|
|
throw new BaseException(CodeEnum.COACH_NUM_FULL); |
|
|
|
} |
|
|
|
//手机号不能为空,且正确
|
|
|
|
if(StrUtil.isEmpty(param.getPhone()) || !param.getPhone().matches(WebConstant.REGEX_PHONE)){ |
|
|
@ -496,7 +523,7 @@ public class ProvinceService implements IProvinceService { |
|
|
|
} |
|
|
|
|
|
|
|
//证件照判断
|
|
|
|
if (param.getIdentity() == 1 && ObjectUtil.isNull(param.getIdPhoto())){ |
|
|
|
if (ObjectUtil.isNull(param.getIdPhoto())){ |
|
|
|
throw new BaseException(CodeEnum.PHOTO_IS_EMPTY); |
|
|
|
} |
|
|
|
CompeteCoach competeCoach1 = new CompeteCoach(); |
|
|
@ -557,21 +584,21 @@ public class ProvinceService implements IProvinceService { |
|
|
|
if (ObjectUtil.isNull(player)) { |
|
|
|
throw new BaseException(CodeEnum.PARAM_ERROR); |
|
|
|
} |
|
|
|
//通级赛查找用户是否参加“30秒单摇”和“3分钟单摇”
|
|
|
|
if(competeProject.getCertificate() == 1){ |
|
|
|
CompeteProjectPlayerExample projectPlayerExample1 = new CompeteProjectPlayerExample(); |
|
|
|
projectPlayerExample1.createCriteria().andPlayerIdEqualTo(joinPlayer.getPlayerId()) |
|
|
|
.andProjectIdEqualTo(Constant.SINGLE_ROLL_30_S); |
|
|
|
CompeteProjectPlayerExample projectPlayerExample2 = new CompeteProjectPlayerExample(); |
|
|
|
projectPlayerExample2.createCriteria().andPlayerIdEqualTo(joinPlayer.getPlayerId()) |
|
|
|
.andProjectIdEqualTo(Constant.SINGLE_ROLL_3_M); |
|
|
|
if(projectPlayerMapper.countByExample(projectPlayerExample1) == 0 || projectPlayerMapper.countByExample(projectPlayerExample2) == 0){ |
|
|
|
throw new BaseException(CodeEnum.mtCertificate(player.getName())); |
|
|
|
} |
|
|
|
} |
|
|
|
// //TODO 通级赛查找用户是否参加“30秒单摇”和“3分钟单摇”
|
|
|
|
// if(competeProject.getCertificate() == 1){
|
|
|
|
// CompeteProjectPlayerExample projectPlayerExample1 = new CompeteProjectPlayerExample();
|
|
|
|
// projectPlayerExample1.createCriteria().andPlayerIdEqualTo(joinPlayer.getPlayerId())
|
|
|
|
// .andProjectIdEqualTo(Constant.SINGLE_ROLL_30_S);
|
|
|
|
// CompeteProjectPlayerExample projectPlayerExample2 = new CompeteProjectPlayerExample();
|
|
|
|
// projectPlayerExample2.createCriteria().andPlayerIdEqualTo(joinPlayer.getPlayerId())
|
|
|
|
// .andProjectIdEqualTo(Constant.SINGLE_ROLL_3_M);
|
|
|
|
// if(projectPlayerMapper.countByExample(projectPlayerExample1) == 0 || projectPlayerMapper.countByExample(projectPlayerExample2) == 0){
|
|
|
|
// throw new BaseException(CodeEnum.mtCertificate(player.getName()));
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//查找此公司此组别是否参加过这个项目
|
|
|
|
int num = competeCompanyDao.getNumByCompanyAndGroup(competeProject.getId(), player.getCompanyId(), player.getCompeteGroupId(), param.getCompeteTimeId()); |
|
|
|
if (num > 0) { |
|
|
|
if (num >= 2) { |
|
|
|
throw new BaseException(CodeEnum.JOIN_PROJECT_NUM_FULL.mtProjectMsg1("该项目该组别")); |
|
|
|
} |
|
|
|
//查找个人参赛数量是否符合(个人比赛3个)
|
|
|
|