|
|
@@ -10,6 +10,7 @@ import com.izouma.nineth.repo.*;
|
|
|
import com.izouma.nineth.utils.JpaUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -22,16 +23,17 @@ import java.util.List;
|
|
|
@Slf4j
|
|
|
public class AirDropService {
|
|
|
|
|
|
- private AirDropRepo airDropRepo;
|
|
|
- private CouponRepo couponRepo;
|
|
|
- private UserCouponRepo userCouponRepo;
|
|
|
- private CollectionRepo collectionRepo;
|
|
|
- private UserRepo userRepo;
|
|
|
- private AssetService assetService;
|
|
|
- private CollectionService collectionService;
|
|
|
- private ShowroomService showroomService;
|
|
|
- private TokenHistoryRepo tokenHistoryRepo;
|
|
|
- private AssetRepo assetRepo;
|
|
|
+ private AirDropRepo airDropRepo;
|
|
|
+ private CouponRepo couponRepo;
|
|
|
+ private UserCouponRepo userCouponRepo;
|
|
|
+ private CollectionRepo collectionRepo;
|
|
|
+ private UserRepo userRepo;
|
|
|
+ private AssetService assetService;
|
|
|
+ private CollectionService collectionService;
|
|
|
+ private ShowroomService showroomService;
|
|
|
+ private TokenHistoryRepo tokenHistoryRepo;
|
|
|
+ private AssetRepo assetRepo;
|
|
|
+ private CollectionPrivilegeRepo collectionPrivilegeRepo;
|
|
|
|
|
|
public Page<AirDrop> all(PageQuery pageQuery) {
|
|
|
return airDropRepo.findAll(JpaUtils.toSpecification(pageQuery, AirDrop.class), JpaUtils.toPageRequest(pageQuery));
|
|
|
@@ -67,6 +69,14 @@ public class AirDropService {
|
|
|
winItem.getTotal() > 1 ? collectionService.getNextNumber(winItem.getCollectionId()) : null,
|
|
|
collection.getHoldDays());
|
|
|
} else {
|
|
|
+ //查看有无vip权限
|
|
|
+ CollectionPrivilege collectionPrivilege = collectionPrivilegeRepo.findByCollectionId(record.getCollectionId());
|
|
|
+ if (ObjectUtils.isNotEmpty(collectionPrivilege)) {
|
|
|
+ if (collectionPrivilege.isVip()) {
|
|
|
+ //更新vip信息
|
|
|
+ userRepo.updateVipPurchase(user.getId(), 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
assetService.createAsset(winItem, user, null, null, "空投",
|
|
|
collectionService.getNextNumber(winItem.getCollectionId()), collection.getHoldDays());
|
|
|
}
|
|
|
@@ -75,12 +85,22 @@ public class AirDropService {
|
|
|
assetService.createAsset(collection, user, 0L, collection.getPrice(), "出售",
|
|
|
collection.getTotal() > 1 ? collectionService.getNextNumber(collection.getId()) : null);
|
|
|
} else {
|
|
|
- assetService.createAsset(collection, user, null, null, "空投", collectionService.getNextNumber(collection.getId()));
|
|
|
- }
|
|
|
- Asset asset = assetService.createAsset(collection, user, null, null, "空投", collectionService.getNextNumber(collection.getId()));
|
|
|
- if (collection.getType() == CollectionType.SHOWROOM) {
|
|
|
- showroomService.save(asset);
|
|
|
+ //查看有无vip权限
|
|
|
+ CollectionPrivilege collectionPrivilege = collectionPrivilegeRepo.findByCollectionId(record.getCollectionId());
|
|
|
+ if (ObjectUtils.isNotEmpty(collectionPrivilege)) {
|
|
|
+ if (collectionPrivilege.isVip()) {
|
|
|
+ //更新vip信息
|
|
|
+ userRepo.updateVipPurchase(user.getId(), 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Asset asset = assetService.createAsset(collection, user, null, null, "空投", collectionService.getNextNumber(collection.getId()));
|
|
|
+ //创建展厅
|
|
|
+ if (collection.getType() == CollectionType.SHOWROOM) {
|
|
|
+ showroomService.save(asset);
|
|
|
+ }
|
|
|
}
|
|
|
+// Asset asset = assetService.createAsset(collection, user, null, null, "空投", collectionService.getNextNumber(collection.getId()));
|
|
|
+
|
|
|
}
|
|
|
collectionService.decreaseStock(collection.getId(), 1);
|
|
|
collectionService.increaseSale(collection.getId(), 1);
|