Browse Source

bug修复

tangxiangan 10 months ago
parent
commit
15074990d2

+ 2 - 1
pdf-tech-core/src/main/java/cn/kdan/pdf/tech/core/service/impl/SubscriptionServiceImpl.java

@@ -17,6 +17,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.ObjectUtils;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
@@ -59,7 +60,7 @@ public class SubscriptionServiceImpl implements SubscriptionService {
             int total = collect.stream().filter(c -> !c.getValidFlag().equals(LicenseCodeStatusEnum.Refunded.code())).mapToInt(o -> Objects.isNull(o.getTimes()) ? 0 : o.getTimes()).sum();
             int used = collect.stream().filter(c -> !c.getValidFlag().equals(LicenseCodeStatusEnum.Refunded.code())).mapToInt(o -> Objects.isNull(o.getUsedTimes()) ? 0 : o.getUsedTimes()).sum();
             subscriptionVO.setAvailableDeviceAmount(total - used);
-            if(subscriptionVO.getPayment().equals(1)||subscriptionVO.getPayment().equals(2)){
+            if(!ObjectUtils.isEmpty(subscriptionVO.getPayment())&&(subscriptionVO.getPayment().equals(1)||subscriptionVO.getPayment().equals(2))){
                 subscriptionVO.setPrice(subscriptionVO.getCnyPrice());
             }
         }