Browse Source

续费检查

lyhzzz 1 year ago
parent
commit
92a2eafb92

+ 2 - 0
src/main/java/com/fdkankan/ucenter/service/IIncrementAutoOrderService.java

@@ -17,6 +17,8 @@ public interface IIncrementAutoOrderService extends IService<IncrementAutoOrder>
 
 
     void addOrder(Long userId, Integer incrementTypeId, Long incrementId, String orderSn);
     void addOrder(Long userId, Integer incrementTypeId, Long incrementId, String orderSn);
 
 
+    IncrementAutoOrder getByIncrementId(Long incrementId);
+
     void subOrder(String orderSn,String subscriptionId);
     void subOrder(String orderSn,String subscriptionId);
 
 
     IncrementAutoOrder getBySubId(String subscriptionId);
     IncrementAutoOrder getBySubId(String subscriptionId);

+ 2 - 7
src/main/java/com/fdkankan/ucenter/service/impl/IncrementAutoOrderServiceImpl.java

@@ -44,12 +44,6 @@ public class IncrementAutoOrderServiceImpl extends ServiceImpl<IIncrementAutoOrd
 
 
     @Override
     @Override
     public void addOrder(Long userId, Integer incrementTypeId, Long incrementId, String orderSn) {
     public void addOrder(Long userId, Integer incrementTypeId, Long incrementId, String orderSn) {
-        if(incrementId != null){
-            IncrementAutoOrder autoOrder2 =  this.getByIncrementId(incrementId);
-            if(autoOrder2 != null){
-                throw new BusinessException(ResultCode.FAILURE_CODE_400007,ResultCode.FAILURE_MSG_400007);
-            }
-        }
         IncrementAutoOrder autoOrder = new IncrementAutoOrder();
         IncrementAutoOrder autoOrder = new IncrementAutoOrder();
         autoOrder.setUserId(userId);
         autoOrder.setUserId(userId);
         autoOrder.setIncrementTypeId(incrementTypeId);
         autoOrder.setIncrementTypeId(incrementTypeId);
@@ -58,7 +52,8 @@ public class IncrementAutoOrderServiceImpl extends ServiceImpl<IIncrementAutoOrd
         this.save(autoOrder);
         this.save(autoOrder);
     }
     }
 
 
-    private IncrementAutoOrder getByIncrementId(Long incrementId) {
+    @Override
+    public IncrementAutoOrder getByIncrementId(Long incrementId) {
         LambdaQueryWrapper<IncrementAutoOrder> wrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<IncrementAutoOrder> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(IncrementAutoOrder::getUserIncrementId,incrementId);
         wrapper.eq(IncrementAutoOrder::getUserIncrementId,incrementId);
         return this.getOne(wrapper);
         return this.getOne(wrapper);

+ 7 - 0
src/main/java/com/fdkankan/ucenter/service/impl/IncrementOrderServiceImpl.java

@@ -12,6 +12,7 @@ import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.ucenter.common.PageInfo;
 import com.fdkankan.ucenter.common.PageInfo;
 import com.fdkankan.common.util.NumberUtils;
 import com.fdkankan.common.util.NumberUtils;
 import com.fdkankan.ucenter.common.SkuEnum;
 import com.fdkankan.ucenter.common.SkuEnum;
+import com.fdkankan.ucenter.common.constants.ResultCode;
 import com.fdkankan.ucenter.constant.LoginConstant;
 import com.fdkankan.ucenter.constant.LoginConstant;
 import com.fdkankan.ucenter.constant.OrderConstant;
 import com.fdkankan.ucenter.constant.OrderConstant;
 import com.fdkankan.ucenter.entity.*;
 import com.fdkankan.ucenter.entity.*;
@@ -174,6 +175,12 @@ public class IncrementOrderServiceImpl extends ServiceImpl<IIncrementOrderMapper
         if(param.getMonthQy() != null){
         if(param.getMonthQy() != null){
             total = total.multiply(new BigDecimal(param.getMonthQy()));  //高级会员月份
             total = total.multiply(new BigDecimal(param.getMonthQy()));  //高级会员月份
         }
         }
+        if(param.getIncrementId() != null){
+            IncrementAutoOrder autoOrder2 =  incrementAutoOrderService.getByIncrementId(param.getIncrementId());
+            if(autoOrder2 != null){
+                throw new BusinessException(ResultCode.FAILURE_CODE_400007,ResultCode.FAILURE_MSG_400007);
+            }
+        }
 
 
         IncrementOrder incrementOrderEntity = new IncrementOrder();
         IncrementOrder incrementOrderEntity = new IncrementOrder();
         PayAutoPayVo autoPayVo = null;
         PayAutoPayVo autoPayVo = null;