|
@@ -4,6 +4,9 @@ import java.util.List;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.fdkankan.common.constant.ErrorCode;
|
|
|
+import com.fdkankan.common.exception.BusinessException;
|
|
|
+import com.fdkankan.ucenter.common.constants.ResultCode;
|
|
|
import com.fdkankan.ucenter.entity.IncrementAutoOrder;
|
|
|
import com.fdkankan.ucenter.entity.User;
|
|
|
import com.fdkankan.ucenter.entity.UserIncrement;
|
|
@@ -40,6 +43,12 @@ public class IncrementAutoOrderServiceImpl extends ServiceImpl<IIncrementAutoOrd
|
|
|
|
|
|
@Override
|
|
|
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();
|
|
|
autoOrder.setUserId(userId);
|
|
|
autoOrder.setIncrementTypeId(incrementTypeId);
|
|
@@ -48,6 +57,12 @@ public class IncrementAutoOrderServiceImpl extends ServiceImpl<IIncrementAutoOrd
|
|
|
this.save(autoOrder);
|
|
|
}
|
|
|
|
|
|
+ private IncrementAutoOrder getByIncrementId(Long incrementId) {
|
|
|
+ LambdaQueryWrapper<IncrementAutoOrder> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(IncrementAutoOrder::getUserIncrementId,incrementId);
|
|
|
+ return this.getOne(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void subOrder(PayOrderVo order) {
|
|
|
LambdaUpdateWrapper<IncrementAutoOrder> wrapper = new LambdaUpdateWrapper<>();
|
|
@@ -69,7 +84,6 @@ public class IncrementAutoOrderServiceImpl extends ServiceImpl<IIncrementAutoOrd
|
|
|
|
|
|
incrementOrder.handleOrder(order.getOrderSn(),order.getTradeNo(),order.getOrderSn(),2,null);
|
|
|
|
|
|
- incrementAutoOrder.setUserIncrementId();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -93,6 +107,7 @@ public class IncrementAutoOrderServiceImpl extends ServiceImpl<IIncrementAutoOrd
|
|
|
mailTemplateService.sendSubcriptionCancelledMail(user.getUserName(),increment.getMemberLevels());
|
|
|
}
|
|
|
}
|
|
|
+ this.removeById(incrementAutoOrder.getId());
|
|
|
}
|
|
|
|
|
|
@Override
|