Browse Source

10-30

tiaosheng
Lihong@123456 5 years ago
parent
commit
6643712957
  1. 35
      mt/src/main/java/com/ccsens/mt/service/ProvinceService.java
  2. 4
      util/src/main/java/com/ccsens/util/CodeEnum.java

35
mt/src/main/java/com/ccsens/mt/service/ProvinceService.java

@ -438,22 +438,25 @@ public class ProvinceService implements IProvinceService {
@Override
public void updateLeader(ProvinceCompeteDto.ModifyLeader param) {
Long coachId = param.getCoachId();
// Long companyId = param.getCompanyId();
// CompeteCoachExample competeCoachExample = new CompeteCoachExample();
// competeCoachExample.createCriteria().andCompanyIdEqualTo(companyId);
// List<CompeteCoach> competeCoachList = competeCoachMapper.selectByExample(competeCoachExample);
if(ObjectUtil.isNull(coachId)){
CompeteCoach competeCoach=new CompeteCoach();
competeCoach.setId(snowflake.nextId());
BeanUtil.copyProperties(param,competeCoach);
competeCoachMapper.insertSelective(competeCoach);
}else{
CompeteCoach competeCoach=competeCoachMapper.selectByPrimaryKey(coachId);
if(ObjectUtil.isNotNull(competeCoach)){
BeanUtil.copyProperties(param,competeCoach);
competeCoachMapper.updateByPrimaryKeySelective(competeCoach);
}
if(ObjectUtil.isNull(param.getCoachId())){
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() == 1 && count >=3){
throw new BaseException(CodeEnum.COACH_NUM_FULL);
}
CompeteCoach competeCoach1 = new CompeteCoach();
competeCoach1.setId(snowflake.nextId());
BeanUtil.copyProperties(param, competeCoach1);
competeCoachMapper.insertSelective(competeCoach1);
}else {
CompeteCoach competeCoach2 = new CompeteCoach();
competeCoach2.setId(snowflake.nextId());
BeanUtil.copyProperties(param, competeCoach2);
competeCoachMapper.insertSelective(competeCoach2);
}
}

4
util/src/main/java/com/ccsens/util/CodeEnum.java

@ -162,7 +162,9 @@ public enum CodeEnum {
DINGDING_EXCEPTION(132,"钉钉接口调用异常。",true),
URL_ERROR(133, "请求路径转换异常", true),
JOIN_PROJECT_NUM_FULL(134, "可参赛次数已满", true),
PHOTO_FILE_EXCEED_2M(134, "图片大小不能超过2M", true),
PHOTO_FILE_EXCEED_2M(135, "图片大小不能超过2M", true),
COACH_NUM_FULL(136,"该单位领队或教练人数已达上限",true)
;

Loading…
Cancel
Save