|
|
@@ -17,7 +17,6 @@ import com.huifu.adapay.Adapay;
|
|
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
|
|
import com.huifu.adapay.model.AdapayCommon;
|
|
|
import com.huifu.adapay.model.Payment;
|
|
|
-import com.huifu.adapay.model.Refund;
|
|
|
import com.izouma.nineth.config.*;
|
|
|
import com.izouma.nineth.domain.Collection;
|
|
|
import com.izouma.nineth.domain.*;
|
|
|
@@ -34,7 +33,6 @@ import com.izouma.nineth.repo.*;
|
|
|
import com.izouma.nineth.security.Authority;
|
|
|
import com.izouma.nineth.service.sms.SmsService;
|
|
|
import com.izouma.nineth.utils.*;
|
|
|
-import com.izouma.nineth.utils.excel.ExcelUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.codec.EncoderException;
|
|
|
@@ -57,7 +55,6 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.ui.Model;
|
|
|
|
|
|
-import java.io.File;
|
|
|
import java.io.OutputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.BigInteger;
|
|
|
@@ -104,8 +101,8 @@ public class OrderService {
|
|
|
private ShowroomService showroomService;
|
|
|
private CollectionPrivilegeRepo collectionPrivilegeRepo;
|
|
|
private UserBankCardRepo userBankCardRepo;
|
|
|
- private IdentityAuthRepo identityAuthRepo;
|
|
|
private CacheService cacheService;
|
|
|
+ private UserPropertyRepo userPropertyRepo;
|
|
|
|
|
|
public Page<Order> all(PageQuery pageQuery) {
|
|
|
return orderRepo.findAll(JpaUtils.toSpecification(pageQuery, Order.class), JpaUtils.toPageRequest(pageQuery));
|
|
|
@@ -221,7 +218,10 @@ public class OrderService {
|
|
|
throw new BusinessException("该藏品当前不可购买");
|
|
|
}
|
|
|
|
|
|
- if (collection.getMaxCount() > 0) {
|
|
|
+ AtomicInteger userMax = new AtomicInteger();
|
|
|
+ userPropertyRepo.findById(userId).ifPresent(userProperty -> userMax.set(userProperty.getMaxCount()));
|
|
|
+
|
|
|
+ if (userMax.addAndGet(collection.getMaxCount()) > 0) {
|
|
|
int count;
|
|
|
if (StringUtils.isNotBlank(collection.getCountId())) {
|
|
|
count = orderRepo.countByUserIdAndCountIdAndStatusIn(userId, collection.getCountId(), Arrays
|
|
|
@@ -367,7 +367,11 @@ public class OrderService {
|
|
|
Collection collection = collectionRepo.findById(collectionId).orElseThrow(new BusinessException("藏品不存在"));
|
|
|
int limit = collection.getMaxCount();
|
|
|
int count = 0;
|
|
|
- if (collection.getMaxCount() > 0) {
|
|
|
+
|
|
|
+ AtomicInteger userMax = new AtomicInteger();
|
|
|
+ userPropertyRepo.findById(userId).ifPresent(userProperty -> userMax.set(userProperty.getMaxCount()));
|
|
|
+
|
|
|
+ if (userMax.addAndGet(collection.getMaxCount()) > 0) {
|
|
|
if (StringUtils.isNotBlank(collection.getCountId())) {
|
|
|
count = orderRepo.countByUserIdAndCountIdAndStatusIn(userId, collection.getCountId(),
|
|
|
Arrays.asList(OrderStatus.FINISH, OrderStatus.NOT_PAID, OrderStatus.PROCESSING));
|