|
|
@@ -12,6 +12,8 @@ import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
import com.zhongzheng.modules.base.service.IProfileTpService;
|
|
|
import com.zhongzheng.modules.base.service.IShoppingCartService;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseBusinessService;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseBusinessVo;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
import com.zhongzheng.modules.grade.bo.ClassGradeQueryBo;
|
|
|
@@ -95,6 +97,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
@Autowired
|
|
|
private IShoppingCartService iShoppingCartService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICourseBusinessService iCourseBusinessService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private RedisCache redisCache;
|
|
|
|
|
|
@@ -263,7 +268,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
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);
|
|
|
+ arrangeGrade(goods.getGoodsName(),goods.getGoodsId(),orderGoods.getOrderGoodsId(),gradeId,add.getUserId(),out_trade_no,goods.getBusinessId());
|
|
|
redisCache.unlockLua(redisLockEntity);
|
|
|
}
|
|
|
iOrderGoodsService.updateById(orderGoods);
|
|
|
@@ -362,7 +367,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
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);
|
|
|
+ arrangeGrade(goods.getGoodsName(),goods.getGoodsId(),orderGoods.getOrderGoodsId(),gradeId,add.getUserId(),out_trade_no,goods.getBusinessId());
|
|
|
redisCache.unlockLua(redisLockEntity);
|
|
|
}
|
|
|
iOrderGoodsService.updateById(orderGoods);
|
|
|
@@ -557,7 +562,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
* @param gradeId
|
|
|
* @return
|
|
|
*/
|
|
|
- public boolean arrangeGrade(String goodsName,Long goodsId,Long orderGoodsId,Long gradeId,Long userId,String orderSn){
|
|
|
+ public boolean arrangeGrade(String goodsName,Long goodsId,Long orderGoodsId,Long gradeId,Long userId,String orderSn,Long businessId){
|
|
|
//查询该学员有没有有效期内同商品班级 有就不允许添加
|
|
|
/* Integer classNum = baseMapper.selectUserClass(goodsId,userId);
|
|
|
if (classNum > 0){
|
|
|
@@ -615,10 +620,19 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
|
|
|
//创建新班级
|
|
|
+ CourseBusinessVo businessVo = iCourseBusinessService.queryById(businessId);
|
|
|
+ boolean isConfigTp = false; //商品是否有配置选班模板
|
|
|
+ if(Validator.isNotEmpty(businessVo)&&Validator.isNotEmpty(businessVo.getTemplateStatus())&&businessVo.getTemplateStatus()==1){
|
|
|
+ isConfigTp = true;
|
|
|
+ }
|
|
|
ClassGrade classGrade = new ClassGrade();
|
|
|
classGrade.setStudentUpper(ClassGrade.INIT_UPPER); //上限300
|
|
|
classGrade.setCreateTime(DateUtils.getNowTime());
|
|
|
- classGrade.setLearningStatus(2);//待定
|
|
|
+ if(isConfigTp){
|
|
|
+ classGrade.setLearningStatus(2);//待定
|
|
|
+ }else{
|
|
|
+ classGrade.setLearningStatus(1);//即刻
|
|
|
+ }
|
|
|
classGrade.setUpdateTime(DateUtils.getNowTime());
|
|
|
classGrade.setStatus(1);
|
|
|
String gradeCode = ServletUtils.getEncoded("BJ");
|