|
@@ -16,11 +16,15 @@ import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.type.EncryptHandler;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.SecurityUtils;
|
|
|
+import com.zhongzheng.common.utils.ServletUtils;
|
|
|
import com.zhongzheng.modules.base.bo.ConsoleQueryBo;
|
|
|
import com.zhongzheng.modules.base.domain.ShoppingCart;
|
|
|
import com.zhongzheng.modules.base.domain.UserProfile;
|
|
|
import com.zhongzheng.modules.base.service.IShoppingCartService;
|
|
|
import com.zhongzheng.modules.base.service.IUserProfileService;
|
|
|
+import com.zhongzheng.modules.course.domain.Course;
|
|
|
+import com.zhongzheng.modules.course.domain.CourseBusiness;
|
|
|
+import com.zhongzheng.modules.course.domain.CourseMenu;
|
|
|
import com.zhongzheng.modules.course.mapper.CourseMapper;
|
|
|
import com.zhongzheng.modules.course.mapper.CourseMenuMapper;
|
|
|
import com.zhongzheng.modules.course.service.ICourseChapterSectionService;
|
|
@@ -39,6 +43,7 @@ import com.zhongzheng.modules.exam.service.IExamBeforeService;
|
|
|
import com.zhongzheng.modules.exam.vo.ExamApplyGoodsVo;
|
|
|
import com.zhongzheng.modules.goods.bo.*;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
+import com.zhongzheng.modules.goods.domain.GoodsCourse;
|
|
|
import com.zhongzheng.modules.goods.domain.GoodsQuestionRel;
|
|
|
import com.zhongzheng.modules.goods.domain.QuestionMerchant;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsCourseService;
|
|
@@ -48,6 +53,7 @@ import com.zhongzheng.modules.goods.service.IQuestionMerchantService;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsSectionListVo;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsSectionNumVo;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
+import com.zhongzheng.modules.grade.bo.ClassGradeGoodsAddBo;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGradeGoods;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGradeUser;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeGoodsService;
|
|
@@ -74,11 +80,10 @@ import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
|
|
|
import com.zhongzheng.modules.user.bo.UserExamGoodsQueryBo;
|
|
|
import com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo;
|
|
|
import com.zhongzheng.modules.user.domain.User;
|
|
|
+import com.zhongzheng.modules.user.domain.UserExamGoods;
|
|
|
+import com.zhongzheng.modules.user.domain.UserExamGoodsSupplement;
|
|
|
import com.zhongzheng.modules.user.domain.UserSubscribe;
|
|
|
-import com.zhongzheng.modules.user.service.IUserExamGoodsService;
|
|
|
-import com.zhongzheng.modules.user.service.IUserService;
|
|
|
-import com.zhongzheng.modules.user.service.IUserStudyRecordService;
|
|
|
-import com.zhongzheng.modules.user.service.IUserSubscribeService;
|
|
|
+import com.zhongzheng.modules.user.service.*;
|
|
|
import com.zhongzheng.modules.user.vo.SubjectStudyRecordVo;
|
|
|
import net.polyv.common.v1.util.StringUtils;
|
|
|
import net.polyv.live.v1.entity.channel.operate.LiveChannelBasicInfoResponse;
|
|
@@ -111,6 +116,7 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
|
@Autowired
|
|
|
private IClassGradeService iClassGradeService;
|
|
|
|
|
|
+
|
|
|
@Autowired
|
|
|
private IOrderService iOrderService;
|
|
|
|
|
@@ -176,6 +182,10 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
|
@Autowired
|
|
|
private IQuestionMerchantService iQuestionMerchantService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IUserExamGoodsSupplementService iUserExamGoodsSupplementService;
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public OrderGoodsVo queryById(Long orderGoodsId) {
|
|
|
OrderGoods db = this.baseMapper.selectById(orderGoodsId);
|
|
@@ -920,8 +930,9 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Long firstChoiceGoods(GoodsFirstChoiceAddBo bo) {
|
|
|
- if(Validator.isEmpty(bo.getGoodsId())||Validator.isEmpty(bo.getOrderGoodsId())){
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public GoodsFirstChoiceAddBo firstChoiceGoods(GoodsFirstChoiceAddBo bo) {
|
|
|
+ if(Validator.isEmpty(bo.getGradeId())||Validator.isEmpty(bo.getGoodsId())||Validator.isEmpty(bo.getOrderGoodsId())||Validator.isEmpty(bo.getCourseId())){
|
|
|
throw new CustomException("参数错误");
|
|
|
}
|
|
|
Goods goodsOld = iGoodsService.getOne(new LambdaQueryWrapper<Goods>()
|
|
@@ -934,9 +945,77 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
|
}
|
|
|
OrderGoods orderGoods = getOne(new LambdaQueryWrapper<OrderGoods>()
|
|
|
.eq(OrderGoods::getOrderGoodsId, bo.getOrderGoodsId()));
|
|
|
- if(Validator.isEmpty(orderGoods)||orderGoods.getGoodsId()!=bo.getGoodsId()){
|
|
|
+ if(Validator.isEmpty(orderGoods)||orderGoods.getGoodsId().longValue()!=bo.getGoodsId().longValue()||orderGoods.getGradeId().longValue()!=bo.getGradeId().longValue()){
|
|
|
throw new CustomException("订单商品数据错误");
|
|
|
}
|
|
|
- return null;
|
|
|
+ Course courseOld =courseMapper.selectOne(new LambdaQueryWrapper<Course>()
|
|
|
+ .eq(Course::getCourseId, bo.getCourseId()));
|
|
|
+ Course courseNew = BeanUtil.toBean(courseOld, Course.class);
|
|
|
+ courseNew.setCourseId(null);
|
|
|
+ courseNew.setFirstChoice(1);
|
|
|
+ courseNew.setCreateTime(DateUtils.getNowTime());
|
|
|
+ courseNew.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ courseNew.setCode(ServletUtils.getEncoded("KC"));
|
|
|
+ courseMapper.insert(courseNew);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<CourseMenu> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(bo.getCourseId() != null, CourseMenu::getCourseId, bo.getCourseId());
|
|
|
+ lqw.in( CourseMenu::getMenuId, bo.getChapterIdList());
|
|
|
+ lqw.eq(CourseMenu::getType, 2);
|
|
|
+ List<CourseMenu> menuList = courseMenuMapper.selectList(lqw);
|
|
|
+ if(Validator.isEmpty(menuList)||menuList.size()==0){
|
|
|
+ throw new CustomException("章数据错误");
|
|
|
+ }
|
|
|
+ for(CourseMenu menu : menuList){
|
|
|
+ menu.setCourseId(courseNew.getCourseId());
|
|
|
+ menu.setFirstChoiceStatus(0);
|
|
|
+ menu.setCreateTime(DateUtils.getNowTime());
|
|
|
+ menu.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ courseMenuMapper.insert(menu);
|
|
|
+ }
|
|
|
+
|
|
|
+ Goods goodsNew = BeanUtil.toBean(goodsOld, Goods.class);
|
|
|
+ goodsNew.setGoodsId(null);
|
|
|
+ goodsNew.setCreateTime(DateUtils.getNowTime());
|
|
|
+ goodsNew.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ goodsNew.setCode(ServletUtils.getEncoded("KC"));
|
|
|
+ goodsNew.setFirstChoiceGoods(1);
|
|
|
+ goodsNew.setFirstChoiceStatus(0);
|
|
|
+ goodsNew.setCode(ServletUtils.getEncoded("SP"));
|
|
|
+ iGoodsService.save(goodsNew);
|
|
|
+
|
|
|
+ GoodsCourse goodsCourseOld = iGoodsCourseService.getOne(new LambdaQueryWrapper<GoodsCourse>()
|
|
|
+ .eq(GoodsCourse::getGoodsId, bo.getGoodsId()).eq(GoodsCourse::getCourseId, bo.getCourseId()));
|
|
|
+ if(Validator.isEmpty(goodsCourseOld)){
|
|
|
+ throw new CustomException("商品课程错误");
|
|
|
+ }
|
|
|
+ GoodsCourse goodsCourseNew = BeanUtil.toBean(goodsCourseOld, GoodsCourse.class);
|
|
|
+ goodsCourseNew.setCourseId(courseNew.getCourseId());
|
|
|
+ goodsCourseNew.setGoodsId(goodsNew.getGoodsId());
|
|
|
+ iGoodsCourseService.save(goodsCourseNew);
|
|
|
+
|
|
|
+ orderGoods.setGoodsId(goodsNew.getGoodsId());
|
|
|
+ updateById(orderGoods);
|
|
|
+
|
|
|
+ ClassGradeGoodsAddBo gradeGoodsAddBo = new ClassGradeGoodsAddBo();
|
|
|
+ gradeGoodsAddBo.setGoodsId(goodsNew.getGoodsId());
|
|
|
+ gradeGoodsAddBo.setGradeId(orderGoods.getGradeId());
|
|
|
+ iClassGradeGoodsService.insertByAddBo(gradeGoodsAddBo);
|
|
|
+
|
|
|
+ LambdaUpdateWrapper<UserExamGoods> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
|
+ objectLambdaUpdateWrapper.eq(UserExamGoods::getOrderGoodsId, bo.getOrderGoodsId());
|
|
|
+ objectLambdaUpdateWrapper.set(UserExamGoods::getGoodsId, goodsNew.getGoodsId());
|
|
|
+ objectLambdaUpdateWrapper.set(UserExamGoods::getUpdateTime,DateUtils.getNowTime());
|
|
|
+ iUserExamGoodsService.update(null, objectLambdaUpdateWrapper);
|
|
|
+
|
|
|
+ LambdaUpdateWrapper<UserExamGoodsSupplement> objectLambdaUpdateWrapper2 = Wrappers.lambdaUpdate();
|
|
|
+ objectLambdaUpdateWrapper2.eq(UserExamGoodsSupplement::getOrderGoodsId, bo.getOrderGoodsId());
|
|
|
+ objectLambdaUpdateWrapper2.set(UserExamGoodsSupplement::getGoodsId, goodsNew.getGoodsId());
|
|
|
+ objectLambdaUpdateWrapper2.set(UserExamGoodsSupplement::getUpdateTime,DateUtils.getNowTime());
|
|
|
+ iUserExamGoodsSupplementService.update(null, objectLambdaUpdateWrapper2);
|
|
|
+
|
|
|
+ bo.setGoodsId(goodsNew.getGoodsId());
|
|
|
+ bo.setCourseId(goodsCourseNew.getCourseId());
|
|
|
+ return bo;
|
|
|
}
|
|
|
}
|