|
@@ -67,7 +67,7 @@ public class TempLittleArtistTrainingCampUserRelationServiceImpl extends Service
|
|
|
TempLittleArtistTrainingCampUserRelation one = this.getOne(Wrappers.<TempLittleArtistTrainingCampUserRelation>lambdaQuery()
|
|
|
.eq(TempLittleArtistTrainingCampUserRelation::getUserId, user.getId())
|
|
|
.isNotNull(TempLittleArtistTrainingCampUserRelation::getActivityId));
|
|
|
- if (Objects.nonNull(one)) {
|
|
|
+ if (Objects.nonNull(one) && one.getActivityId() != null) {
|
|
|
throw new BizException("您已登记训练营!");
|
|
|
}
|
|
|
int count = this.count(Wrappers.<TempLittleArtistTrainingCampUserRelation>lambdaUpdate()
|
|
@@ -81,11 +81,22 @@ public class TempLittleArtistTrainingCampUserRelationServiceImpl extends Service
|
|
|
if (updateFlag == 0) {
|
|
|
throw new BizException("人数已报满!");
|
|
|
}
|
|
|
- this.update(Wrappers.<TempLittleArtistTrainingCampUserRelation>lambdaUpdate()
|
|
|
- .set(TempLittleArtistTrainingCampUserRelation::getActivityId, campId)
|
|
|
- .set(TempLittleArtistTrainingCampUserRelation::getState, TempLittleArtistTrainingCampUserRelation.APPLY)
|
|
|
- .set(TempLittleArtistTrainingCampUserRelation::getApplyTime, new Date())
|
|
|
- .eq(TempLittleArtistTrainingCampUserRelation::getUserId, user.getId()));
|
|
|
+ Date now = new Date();
|
|
|
+ if(Objects.isNull(one)){
|
|
|
+ one = new TempLittleArtistTrainingCampUserRelation();
|
|
|
+ one.setCreateTime(new Date());
|
|
|
+ one.setUserId(user.getId());
|
|
|
+ one.setActivityId(campId);
|
|
|
+ one.setApplyTime(now);
|
|
|
+ one.setState(TempLittleArtistTrainingCampUserRelation.APPLY);
|
|
|
+ this.save(one);
|
|
|
+ }else {
|
|
|
+ this.update(Wrappers.<TempLittleArtistTrainingCampUserRelation>lambdaUpdate()
|
|
|
+ .set(TempLittleArtistTrainingCampUserRelation::getActivityId, campId)
|
|
|
+ .set(TempLittleArtistTrainingCampUserRelation::getState, TempLittleArtistTrainingCampUserRelation.APPLY)
|
|
|
+ .set(TempLittleArtistTrainingCampUserRelation::getApplyTime,now)
|
|
|
+ .eq(TempLittleArtistTrainingCampUserRelation::getUserId, user.getId()));
|
|
|
+ }
|
|
|
addCamp.delete();
|
|
|
}
|
|
|
|