|
@@ -1,22 +1,19 @@
|
|
|
package com.zhongzheng.modules.order.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.zhongzheng.common.core.redis.RedisCache;
|
|
|
+import com.zhongzheng.common.core.redis.RedisLockEntity;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
-import com.zhongzheng.common.utils.SecurityUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
-import com.zhongzheng.modules.alisms.service.IAliSmsService;
|
|
|
-import com.zhongzheng.modules.bank.domain.QuestionBusiness;
|
|
|
import com.zhongzheng.modules.base.service.IProfileTpService;
|
|
|
import com.zhongzheng.modules.base.service.IShoppingCartService;
|
|
|
-import com.zhongzheng.modules.base.vo.ProfileTpVo;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
-import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
import com.zhongzheng.modules.grade.bo.ClassGradeQueryBo;
|
|
|
-import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
|
|
|
import com.zhongzheng.modules.grade.bo.ClassGradeUserTempQueryBo;
|
|
|
import com.zhongzheng.modules.grade.domain.*;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeGoodsService;
|
|
@@ -25,13 +22,10 @@ import com.zhongzheng.modules.grade.service.IClassGradeUserService;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeUserTempService;
|
|
|
import com.zhongzheng.modules.grade.vo.ClassGradeUserTempVo;
|
|
|
import com.zhongzheng.modules.grade.vo.ClassGradeVo;
|
|
|
-import com.zhongzheng.modules.inform.bo.InformUserAddBo;
|
|
|
import com.zhongzheng.modules.inform.service.IInformRemindService;
|
|
|
import com.zhongzheng.modules.inform.service.IInformUserService;
|
|
|
-import com.zhongzheng.modules.inform.vo.InformRemindVo;
|
|
|
import com.zhongzheng.modules.order.bo.*;
|
|
|
import com.zhongzheng.modules.order.domain.Order;
|
|
|
-import com.zhongzheng.modules.order.domain.OrderBusiness;
|
|
|
import com.zhongzheng.modules.order.domain.OrderGoods;
|
|
|
import com.zhongzheng.modules.order.mapper.OrderMapper;
|
|
|
import com.zhongzheng.modules.order.service.IOrderBusinessService;
|
|
@@ -99,6 +93,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
@Autowired
|
|
|
private IShoppingCartService iShoppingCartService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RedisCache redisCache;
|
|
|
+
|
|
|
@Autowired
|
|
|
private com.zhongzheng.modules.alisms.service.IAliSmsService IAliSmsService;
|
|
|
|
|
@@ -249,7 +246,15 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
if(g.getGoodsInputData().getType()!=null&&g.getGoodsInputData().getType().equals("class")){
|
|
|
//判断是否购买历史班级都过期
|
|
|
canRepeatBuy =this.canBuyRepeatGoods(g.getGoodsId(),bo.getUserId());
|
|
|
- arrangeGrade(goods.getGoodsName(),goods.getGoodsId(),orderGoods.getOrderGoodsId(),gradeId,add.getUserId(),out_trade_no);
|
|
|
+ String requestId = IdUtil.simpleUUID();
|
|
|
+ RedisLockEntity redisLockEntity = new RedisLockEntity();
|
|
|
+ redisLockEntity.setLockKey(RedisLockEntity.KEY_LOCK_GRADE);
|
|
|
+ redisLockEntity.setRequestId(requestId);
|
|
|
+ if(redisCache.lock(redisLockEntity)){
|
|
|
+ arrangeGrade(goods.getGoodsName(),goods.getGoodsId(),orderGoods.getOrderGoodsId(),gradeId,add.getUserId(),out_trade_no);
|
|
|
+ redisCache.unlockLua(redisLockEntity);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|