|
@@ -10,6 +10,7 @@ import com.izouma.nineth.repo.MetaGameCopyRepo;
|
|
|
import com.izouma.nineth.repo.MetaGameProcessRepo;
|
|
import com.izouma.nineth.repo.MetaGameProcessRepo;
|
|
|
import com.izouma.nineth.repo.MetaZombieRepo;
|
|
import com.izouma.nineth.repo.MetaZombieRepo;
|
|
|
import com.izouma.nineth.utils.JpaUtils;
|
|
import com.izouma.nineth.utils.JpaUtils;
|
|
|
|
|
+import com.izouma.nineth.utils.LotteryUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
@@ -57,6 +58,13 @@ public class MetaGameCopyService {
|
|
|
if (Objects.isNull(metaGameProcess.getMetaGameCopyId())) {
|
|
if (Objects.isNull(metaGameProcess.getMetaGameCopyId())) {
|
|
|
return MetaRestResult.returnError("Illegal parameter : metaGameCopyId can not be null");
|
|
return MetaRestResult.returnError("Illegal parameter : metaGameCopyId can not be null");
|
|
|
}
|
|
}
|
|
|
|
|
+ MetaGameCopy metaGameCopy = metaGameCopyRepo.findByIdAndDelAndPublish(metaGameProcess.getMetaGameCopyId(), false, true);
|
|
|
|
|
+ if (Objects.isNull(metaGameCopy)) {
|
|
|
|
|
+ return MetaRestResult.returnError("Illegal parameter : metaGameCopy can not be null");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (CollectionUtils.isEmpty(metaGameCopy.getMetaGameAwards())) {
|
|
|
|
|
+ return MetaRestResult.returnError("Illegal parameter : metaGameAwards can not be null");
|
|
|
|
|
+ }
|
|
|
if (Objects.isNull(metaGameProcess.getPlayerPos())) {
|
|
if (Objects.isNull(metaGameProcess.getPlayerPos())) {
|
|
|
return MetaRestResult.returnError("Illegal parameter : playerPos can not be null");
|
|
return MetaRestResult.returnError("Illegal parameter : playerPos can not be null");
|
|
|
}
|
|
}
|
|
@@ -90,6 +98,9 @@ public class MetaGameCopyService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
metaGameProcess.setPoint(point);
|
|
metaGameProcess.setPoint(point);
|
|
|
|
|
+ if (metaGameProcess.isCompleted()) {
|
|
|
|
|
+ metaGameProcess.setMetaGameAward(LotteryUtils.lottery(metaGameCopy.getMetaGameAwards()));
|
|
|
|
|
+ }
|
|
|
return MetaRestResult.returnSuccess(metaGameProcessRepo.save(metaGameProcess));
|
|
return MetaRestResult.returnSuccess(metaGameProcessRepo.save(metaGameProcess));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|