|
@@ -33,6 +33,13 @@ import com.zhongzheng.modules.grade.vo.ClassGradeVo;
|
|
|
import com.zhongzheng.modules.grade.vo.SyncGoodsExport;
|
|
|
import com.zhongzheng.modules.order.domain.OrderGoods;
|
|
|
import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
|
+import com.zhongzheng.modules.system.domain.SysConfig;
|
|
|
+import com.zhongzheng.modules.system.service.ISysConfigService;
|
|
|
+import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
|
|
|
+import com.zhongzheng.modules.user.domain.User;
|
|
|
+import com.zhongzheng.modules.user.service.IUserService;
|
|
|
+import com.zhongzheng.modules.user.service.IUserStudyRecordService;
|
|
|
+import com.zhongzheng.modules.user.vo.SubjectStudyRecordVo;
|
|
|
import net.polyv.common.v1.util.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -59,7 +66,6 @@ import static java.math.RoundingMode.HALF_UP;
|
|
|
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements IGoodsService {
|
|
|
|
|
|
|
|
|
-
|
|
|
@Autowired
|
|
|
private IGoodsCourseService iGoodsCourseService;
|
|
|
|
|
@@ -102,35 +108,44 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
private ICourseBusinessService iCourseBusinessService;
|
|
|
|
|
|
@Autowired
|
|
|
- private ICourseSubjectService iCourseSubjectService;
|
|
|
+ private ICourseSubjectService iCourseSubjectService;
|
|
|
|
|
|
@Autowired
|
|
|
- private IGoodsSpecService goodsSpecService;
|
|
|
+ private IGoodsSpecService goodsSpecService;
|
|
|
|
|
|
@Autowired
|
|
|
private QuestionMapper questionMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IUserService iUserService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IUserStudyRecordService iUserStudyRecordService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysConfigService iSysConfigService;
|
|
|
+
|
|
|
@Override
|
|
|
- public GoodsVo queryById(Long goodsId){
|
|
|
+ public GoodsVo queryById(Long goodsId) {
|
|
|
Goods db = this.baseMapper.selectById(goodsId);
|
|
|
- if(Validator.isEmpty(db)){
|
|
|
+ if (Validator.isEmpty(db)) {
|
|
|
return null;
|
|
|
}
|
|
|
GoodsVo goodsVo = BeanUtil.toBean(db, GoodsVo.class);
|
|
|
//试听配置
|
|
|
- if(db.getGoodsAuditionConfig()!=null){
|
|
|
+ if (db.getGoodsAuditionConfig() != null) {
|
|
|
goodsVo.setAuditionList(JSON.parseArray(db.getGoodsAuditionConfig(), GoodsAuditionConfigVo.class));
|
|
|
}
|
|
|
//播放设置
|
|
|
- if(db.getGoodsPlayConfig()!=null){
|
|
|
+ if (db.getGoodsPlayConfig() != null) {
|
|
|
goodsVo.setGoodsPlayConfigVo(JSON.parseObject(db.getGoodsPlayConfig(), GoodsPlayConfigVo.class));
|
|
|
}
|
|
|
//拍照设置
|
|
|
- if(db.getGoodsPhotographConfig()!=null){
|
|
|
+ if (db.getGoodsPhotographConfig() != null) {
|
|
|
goodsVo.setGoodsPhotographConfigVo(JSON.parseObject(db.getGoodsPhotographConfig(), GoodsPhotographConfigVo.class));
|
|
|
}
|
|
|
//试卷试做配置
|
|
|
- if(db.getGoodsExamConfig()!=null){
|
|
|
+ if (db.getGoodsExamConfig() != null) {
|
|
|
goodsVo.setExamConfigList(JSON.parseArray(db.getGoodsExamConfig(), GoodsExamConfigVo.class));
|
|
|
}
|
|
|
return goodsVo;
|
|
@@ -139,18 +154,18 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
@Override
|
|
|
@DataScope(businessAlias = "cb")
|
|
|
public List<GoodsVo> selectList(GoodsQueryBo bo) {
|
|
|
- if(Validator.isNotEmpty(bo.getGoodsName())){
|
|
|
+ if (Validator.isNotEmpty(bo.getGoodsName())) {
|
|
|
bo.setGoodsName(bo.getGoodsName().trim());
|
|
|
}
|
|
|
List<GoodsVo> list = baseMapper.selectAllList(bo);
|
|
|
- if(Validator.isNotEmpty(bo.getSectionNum())&&bo.getSectionNum().longValue()==1){
|
|
|
- for(GoodsVo vo : list){
|
|
|
+ if (Validator.isNotEmpty(bo.getSectionNum()) && bo.getSectionNum().longValue() == 1) {
|
|
|
+ for (GoodsVo vo : list) {
|
|
|
Long sectionNum = baseMapper.getSectionNum(vo.getGoodsId());
|
|
|
vo.setSectionNum(sectionNum);
|
|
|
}
|
|
|
}
|
|
|
- if(Validator.isNotEmpty(bo.getGoodsType())&&bo.getGoodsType()==2){
|
|
|
- for(GoodsVo vo : list){
|
|
|
+ if (Validator.isNotEmpty(bo.getGoodsType()) && bo.getGoodsType() == 2) {
|
|
|
+ for (GoodsVo vo : list) {
|
|
|
Long totalNum = getExamNum(vo.getGoodsId());
|
|
|
vo.setTotalExamNum(totalNum);
|
|
|
}
|
|
@@ -172,11 +187,11 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
// }
|
|
|
// }
|
|
|
//多规格下的价格区间
|
|
|
- if (ObjectUtils.isNotNull(goods.getSpecTemplateId())){
|
|
|
+ if (ObjectUtils.isNotNull(goods.getSpecTemplateId())) {
|
|
|
List<GoodsSpecAttributeRelation> specAttributeRelations = goodsSpecAttributeRelationService
|
|
|
.list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
|
|
|
.eq(GoodsSpecAttributeRelation::getSpecTemplateId, goods.getSpecTemplateId()));
|
|
|
- if (CollectionUtils.isNotEmpty(specAttributeRelations)){
|
|
|
+ if (CollectionUtils.isNotEmpty(specAttributeRelations)) {
|
|
|
List<Long> goodsIds = specAttributeRelations.stream().filter(x -> ObjectUtils.isNotNull(x.getGoodsId())).map(GoodsSpecAttributeRelation::getGoodsId).collect(Collectors.toList());
|
|
|
List<Goods> goodsList = listByIds(goodsIds);
|
|
|
//从小到大排序
|
|
@@ -186,15 +201,15 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
}
|
|
|
}
|
|
|
//是否包含每日一练试卷
|
|
|
- if (goods.getGoodsType() == 2){
|
|
|
+ if (goods.getGoodsType() == 2) {
|
|
|
//题库商品
|
|
|
List<BankGoodsExamVo> examVos = questionMapper.getBankGoodsExamList(goods.getGoodsId());
|
|
|
- if (examVos.stream().filter(x -> StringUtils.isNotBlank(x.getPaperName())).anyMatch(x -> x.getPaperName().equals("每日一练"))){
|
|
|
+ if (examVos.stream().filter(x -> StringUtils.isNotBlank(x.getPaperName())).anyMatch(x -> x.getPaperName().equals("每日一练"))) {
|
|
|
goods.setExamRecord(1);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
goods.setExamRecord(0);
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
goods.setExamRecord(0);
|
|
|
}
|
|
|
});
|
|
@@ -234,7 +249,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- goodsVo.setClassHours((new BigDecimal(String.valueOf(classHours))).setScale(0,HALF_UP));
|
|
|
+ goodsVo.setClassHours((new BigDecimal(String.valueOf(classHours))).setScale(0, HALF_UP));
|
|
|
});
|
|
|
}
|
|
|
return list;
|
|
@@ -266,11 +281,11 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
// }
|
|
|
// }
|
|
|
//多规格下的价格区间
|
|
|
- if (ObjectUtils.isNotNull(goodsVo.getSpecTemplateId())){
|
|
|
+ if (ObjectUtils.isNotNull(goodsVo.getSpecTemplateId())) {
|
|
|
List<GoodsSpecAttributeRelation> list = goodsSpecAttributeRelationService
|
|
|
.list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
|
|
|
- .eq(GoodsSpecAttributeRelation::getSpecTemplateId, goodsVo.getSpecTemplateId()));
|
|
|
- if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ .eq(GoodsSpecAttributeRelation::getSpecTemplateId, goodsVo.getSpecTemplateId()));
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
List<Long> goodsIds = list.stream().filter(x -> ObjectUtils.isNotNull(x.getGoodsId())).map(GoodsSpecAttributeRelation::getGoodsId).collect(Collectors.toList());
|
|
|
List<Goods> goodsList = listByIds(goodsIds);
|
|
|
//从小到大排序
|
|
@@ -289,7 +304,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
|
|
|
@Override
|
|
|
public Long getRandomQuestionNum(Long goodsId, Long examPaperId) {
|
|
|
- return baseMapper.getRandomQuestionNum(goodsId,examPaperId);
|
|
|
+ return baseMapper.getRandomQuestionNum(goodsId, examPaperId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -329,19 +344,19 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 实体类转化成视图对象
|
|
|
- *
|
|
|
- * @param collection 实体类集合
|
|
|
- * @return
|
|
|
- */
|
|
|
+ * 实体类转化成视图对象
|
|
|
+ *
|
|
|
+ * @param collection 实体类集合
|
|
|
+ * @return
|
|
|
+ */
|
|
|
private List<GoodsVo> entity2Vo(Collection<Goods> collection) {
|
|
|
List<GoodsVo> voList = collection.stream()
|
|
|
.map(any -> BeanUtil.toBean(any, GoodsVo.class))
|
|
|
.collect(Collectors.toList());
|
|
|
if (collection instanceof Page) {
|
|
|
- Page<Goods> page = (Page<Goods>)collection;
|
|
|
+ Page<Goods> page = (Page<Goods>) collection;
|
|
|
Page<GoodsVo> pageVo = new Page<>();
|
|
|
- BeanUtil.copyProperties(page,pageVo);
|
|
|
+ BeanUtil.copyProperties(page, pageVo);
|
|
|
pageVo.addAll(voList);
|
|
|
voList = pageVo;
|
|
|
}
|
|
@@ -357,26 +372,26 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
|
//试听设置列表
|
|
|
- if(bo.getAuditionList()!=null){
|
|
|
+ if (bo.getAuditionList() != null) {
|
|
|
add.setGoodsAuditionConfig(JSON.toJSONString(bo.getAuditionList()));
|
|
|
}
|
|
|
//播放设置
|
|
|
- if(bo.getPlayConfig()!=null){
|
|
|
+ if (bo.getPlayConfig() != null) {
|
|
|
add.setGoodsPlayConfig(JSON.toJSONString(bo.getPlayConfig()));
|
|
|
}
|
|
|
//拍照设置
|
|
|
- if(bo.getPhotographConfig()!=null){
|
|
|
+ if (bo.getPhotographConfig() != null) {
|
|
|
add.setGoodsPhotographConfig(JSON.toJSONString(bo.getPhotographConfig()));
|
|
|
}
|
|
|
//试卷拍照设置
|
|
|
- if(bo.getGoodsPhotographExamConfig()!=null){
|
|
|
+ if (bo.getGoodsPhotographExamConfig() != null) {
|
|
|
add.setGoodsPhotoExamConfig(JSON.toJSONString(bo.getGoodsPhotographExamConfig()));
|
|
|
}
|
|
|
boolean result = this.save(add);
|
|
|
//课程列表
|
|
|
- if(bo.getCourseList()!=null&&bo.getCourseList().size()>0){
|
|
|
+ if (bo.getCourseList() != null && bo.getCourseList().size() > 0) {
|
|
|
Collection<GoodsCourse> coll = new HashSet<>();
|
|
|
- for(int i=0;i<bo.getCourseList().size();i++){
|
|
|
+ for (int i = 0; i < bo.getCourseList().size(); i++) {
|
|
|
GoodsCourseAddBo item = bo.getCourseList().get(i);
|
|
|
GoodsCourse addItem = new GoodsCourse();
|
|
|
addItem.setGoodsId(add.getGoodsId());
|
|
@@ -387,7 +402,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
iGoodsCourseService.saveBatch(coll);
|
|
|
}
|
|
|
//模块章列表
|
|
|
- if(bo.getMenuList()!=null&&bo.getMenuList().size()>0){
|
|
|
+ if (bo.getMenuList() != null && bo.getMenuList().size() > 0) {
|
|
|
CourseMenuListAddBo menuListAddBo = new CourseMenuListAddBo();
|
|
|
menuListAddBo.setGoodsId(add.getGoodsId());
|
|
|
menuListAddBo.setMenuList(bo.getMenuList());
|
|
@@ -405,13 +420,13 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
|
//试卷试做设置列表
|
|
|
- if(bo.getExamConfigList()!=null){
|
|
|
+ if (bo.getExamConfigList() != null) {
|
|
|
add.setGoodsExamConfig(JSON.toJSONString(bo.getExamConfigList()));
|
|
|
}
|
|
|
boolean result = this.save(add);
|
|
|
- if(bo.getBankList()!=null){
|
|
|
+ if (bo.getBankList() != null) {
|
|
|
Collection<GoodsAttached> coll = new HashSet<>();
|
|
|
- for(int i=0;i<bo.getBankList().size();i++){
|
|
|
+ for (int i = 0; i < bo.getBankList().size(); i++) {
|
|
|
GoodsAttachedAddBo item = bo.getBankList().get(i);
|
|
|
GoodsAttached addItem = BeanUtil.toBean(item, GoodsAttached.class);
|
|
|
addItem.setGoodsId(add.getGoodsId());
|
|
@@ -431,19 +446,19 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
validEntityBeforeSave(update);
|
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
|
//课程列表
|
|
|
- if(bo.getCourseList()!=null){
|
|
|
+ if (bo.getCourseList() != null) {
|
|
|
GoodsCourseQueryBo courseQueryBo = new GoodsCourseQueryBo();
|
|
|
courseQueryBo.setGoodsId(bo.getGoodsId());
|
|
|
List<GoodsCourseVo> courseVoList = iGoodsCourseService.queryList(courseQueryBo);
|
|
|
iGoodsCourseService.remove(new LambdaQueryWrapper<GoodsCourse>().eq(GoodsCourse::getGoodsId, bo.getGoodsId()));
|
|
|
Collection<GoodsCourse> coll = new HashSet<>();
|
|
|
- for(int i=0;i<bo.getCourseList().size();i++){
|
|
|
+ for (int i = 0; i < bo.getCourseList().size(); i++) {
|
|
|
GoodsCourseAddBo item = bo.getCourseList().get(i);
|
|
|
GoodsCourse addItem = new GoodsCourse();
|
|
|
addItem.setGoodsId(update.getGoodsId());
|
|
|
addItem.setCourseId(item.getCourseId());
|
|
|
addItem.setSort(item.getSort());
|
|
|
- Optional<GoodsCourseVo> first = courseVoList.stream().filter(course -> Objects.equals(course.getCourseId(),item.getCourseId())).findFirst();
|
|
|
+ Optional<GoodsCourseVo> first = courseVoList.stream().filter(course -> Objects.equals(course.getCourseId(), item.getCourseId())).findFirst();
|
|
|
if (first.isPresent()) {
|
|
|
addItem.setAliasName(first.get().getAliasName());
|
|
|
}
|
|
@@ -452,44 +467,44 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
iGoodsCourseService.saveBatch(coll);
|
|
|
}
|
|
|
//购买须知
|
|
|
- if(Validator.isEmpty(bo.getBuyNote())){
|
|
|
+ if (Validator.isEmpty(bo.getBuyNote())) {
|
|
|
LambdaUpdateWrapper<Goods> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
|
- objectLambdaUpdateWrapper.eq(Goods::getGoodsId,bo.getGoodsId());
|
|
|
- objectLambdaUpdateWrapper.set(Goods::getBuyNote,null);
|
|
|
+ objectLambdaUpdateWrapper.eq(Goods::getGoodsId, bo.getGoodsId());
|
|
|
+ objectLambdaUpdateWrapper.set(Goods::getBuyNote, null);
|
|
|
update(null, objectLambdaUpdateWrapper);
|
|
|
}
|
|
|
//最大节数量
|
|
|
- if(Validator.isEmpty(bo.getSectionMaxNum())){
|
|
|
+ if (Validator.isEmpty(bo.getSectionMaxNum())) {
|
|
|
LambdaUpdateWrapper<Goods> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
|
- objectLambdaUpdateWrapper.eq(Goods::getGoodsId,bo.getGoodsId());
|
|
|
- objectLambdaUpdateWrapper.set(Goods::getSectionMaxNum,null);
|
|
|
+ objectLambdaUpdateWrapper.eq(Goods::getGoodsId, bo.getGoodsId());
|
|
|
+ objectLambdaUpdateWrapper.set(Goods::getSectionMaxNum, null);
|
|
|
update(null, objectLambdaUpdateWrapper);
|
|
|
}
|
|
|
//试听列表
|
|
|
- if(bo.getAuditionList()!=null&&bo.getAuditionList().size()>0){
|
|
|
+ if (bo.getAuditionList() != null && bo.getAuditionList().size() > 0) {
|
|
|
update.setGoodsAuditionConfig(JSON.toJSONString(bo.getAuditionList()));
|
|
|
}
|
|
|
//播放设置
|
|
|
- if(bo.getPlayConfig()!=null){
|
|
|
+ if (bo.getPlayConfig() != null) {
|
|
|
update.setGoodsPlayConfig(JSON.toJSONString(bo.getPlayConfig()));
|
|
|
}
|
|
|
|
|
|
//拍照设置
|
|
|
- if(bo.getPhotographConfig()!=null){
|
|
|
+ if (bo.getPhotographConfig() != null) {
|
|
|
update.setGoodsPhotographConfig(JSON.toJSONString(bo.getPhotographConfig()));
|
|
|
}
|
|
|
//试卷拍照设置
|
|
|
- if(bo.getGoodsPhotographExamConfig()!=null){
|
|
|
+ if (bo.getGoodsPhotographExamConfig() != null) {
|
|
|
update.setGoodsPhotoExamConfig(JSON.toJSONString(bo.getGoodsPhotographExamConfig()));
|
|
|
}
|
|
|
//模块章列表
|
|
|
- if(bo.getMenuList()!=null&&bo.getMenuList().size()>0){
|
|
|
- if(Validator.isEmpty(bo.getCourseId())){
|
|
|
+ if (bo.getMenuList() != null && bo.getMenuList().size() > 0) {
|
|
|
+ if (Validator.isEmpty(bo.getCourseId())) {
|
|
|
CourseMenuListAddBo menuListAddBo = new CourseMenuListAddBo();
|
|
|
menuListAddBo.setGoodsId(bo.getGoodsId());
|
|
|
menuListAddBo.setMenuList(bo.getMenuList());
|
|
|
iCourseMenuService.insertByGoodsAddBo(menuListAddBo);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
//绑定虚拟课程ID
|
|
|
GoodsCourse addItem = new GoodsCourse();
|
|
|
addItem.setGoodsId(update.getGoodsId());
|
|
@@ -505,18 +520,18 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
|
|
|
//修改商品课程节观看权限
|
|
|
List<CourseMenuAddBo> menuList = bo.getMenuList();
|
|
|
- if (CollectionUtils.isEmpty(menuList)){
|
|
|
+ if (CollectionUtils.isEmpty(menuList)) {
|
|
|
//商品下没有课程/节
|
|
|
iCourseSectionWatchPerService.update(new LambdaUpdateWrapper<CourseSectionWatchPer>()
|
|
|
- .set(CourseSectionWatchPer::getStatus,0)
|
|
|
- .eq(CourseSectionWatchPer::getGoodsId,bo.getGoodsId()));
|
|
|
- }else {
|
|
|
+ .set(CourseSectionWatchPer::getStatus, 0)
|
|
|
+ .eq(CourseSectionWatchPer::getGoodsId, bo.getGoodsId()));
|
|
|
+ } else {
|
|
|
//对比观看权限
|
|
|
List<Long> courseIds = menuList.stream().map(CourseMenuAddBo::getCourseId).collect(Collectors.toList());
|
|
|
iCourseSectionWatchPerService.update(new LambdaUpdateWrapper<CourseSectionWatchPer>()
|
|
|
- .set(CourseSectionWatchPer::getStatus,0)
|
|
|
- .eq(CourseSectionWatchPer::getGoodsId,bo.getGoodsId())
|
|
|
- .notIn(CourseSectionWatchPer::getCourseId,courseIds));
|
|
|
+ .set(CourseSectionWatchPer::getStatus, 0)
|
|
|
+ .eq(CourseSectionWatchPer::getGoodsId, bo.getGoodsId())
|
|
|
+ .notIn(CourseSectionWatchPer::getCourseId, courseIds));
|
|
|
}
|
|
|
|
|
|
return this.updateById(update);
|
|
@@ -528,10 +543,10 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
Goods update = BeanUtil.toBean(bo, Goods.class);
|
|
|
validEntityBeforeSave(update);
|
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
|
- if(bo.getBankList()!=null){
|
|
|
+ if (bo.getBankList() != null) {
|
|
|
iGoodsAttachedService.remove(new LambdaQueryWrapper<GoodsAttached>().eq(GoodsAttached::getGoodsId, bo.getGoodsId()));
|
|
|
Collection<GoodsAttached> coll = new HashSet<>();
|
|
|
- for(int i=0;i<bo.getBankList().size();i++){
|
|
|
+ for (int i = 0; i < bo.getBankList().size(); i++) {
|
|
|
GoodsAttachedEditBo item = bo.getBankList().get(i);
|
|
|
GoodsAttached addItem = BeanUtil.toBean(item, GoodsAttached.class);
|
|
|
addItem.setGoodsId(update.getGoodsId());
|
|
@@ -542,7 +557,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
iGoodsAttachedService.saveBatch(coll);
|
|
|
}
|
|
|
//试卷试做设置列表
|
|
|
- if(bo.getExamConfigList()!=null&&bo.getExamConfigList().size()>0){
|
|
|
+ if (bo.getExamConfigList() != null && bo.getExamConfigList().size() > 0) {
|
|
|
update.setGoodsExamConfig(JSON.toJSONString(bo.getExamConfigList()));
|
|
|
}
|
|
|
return this.updateById(update);
|
|
@@ -553,34 +568,34 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
*
|
|
|
* @param entity 实体类数据
|
|
|
*/
|
|
|
- private void validEntityBeforeSave(Goods entity){
|
|
|
+ private void validEntityBeforeSave(Goods entity) {
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
- if (entity.getStatus() !=-1) {
|
|
|
+ if (entity.getStatus() != -1) {
|
|
|
if (entity.getStatus() == 0 && entity.getGoodsStatus() == 1) {
|
|
|
throw new CustomException("无效商品不允许上架");
|
|
|
}
|
|
|
- if (Validator.isNotEmpty(entity.getValidityEndTime())&&entity.getValidityEndTime() < DateUtils.getNowTime() && entity.getGoodsStatus() == 1) {
|
|
|
+ if (Validator.isNotEmpty(entity.getValidityEndTime()) && entity.getValidityEndTime() < DateUtils.getNowTime() && entity.getGoodsStatus() == 1) {
|
|
|
throw new CustomException("过期商品不允许上架");
|
|
|
}
|
|
|
}
|
|
|
- if ((entity.getStatus() ==-1||entity.getStatus() ==0)&&entity.getGoodsId().longValue()>0) {
|
|
|
+ if ((entity.getStatus() == -1 || entity.getStatus() == 0) && entity.getGoodsId().longValue() > 0) {
|
|
|
List<Long> payStatus = new ArrayList<>();
|
|
|
payStatus.add(2L);
|
|
|
payStatus.add(3L);
|
|
|
//查看是否有出售过
|
|
|
- OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper< OrderGoods >().eq(OrderGoods::getGoodsId,entity.getGoodsId())
|
|
|
- .in(OrderGoods::getPayStatus,payStatus).ne(OrderGoods::getRefundStatus,2).last("limit 1"));
|
|
|
- if(Validator.isNotEmpty(orderGoods)){
|
|
|
+ OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getGoodsId, entity.getGoodsId())
|
|
|
+ .in(OrderGoods::getPayStatus, payStatus).ne(OrderGoods::getRefundStatus, 2).last("limit 1"));
|
|
|
+ if (Validator.isNotEmpty(orderGoods)) {
|
|
|
throw new CustomException("该商品已被购买过,无法改变状态");
|
|
|
}
|
|
|
}
|
|
|
- if(Validator.isNotEmpty(entity.getGoodsType())&&entity.getGoodsType().longValue()==1&&Validator.isNotEmpty(entity.getStudyCount())&&Validator.isNotEmpty(entity.getGoodsId())){
|
|
|
+ if (Validator.isNotEmpty(entity.getGoodsType()) && entity.getGoodsType().longValue() == 1 && Validator.isNotEmpty(entity.getStudyCount()) && Validator.isNotEmpty(entity.getGoodsId())) {
|
|
|
//判断学习次数有没有变化
|
|
|
GoodsVo old = this.queryById(entity.getGoodsId());
|
|
|
- if(Validator.isEmpty(old.getStudyCount())){
|
|
|
+ if (Validator.isEmpty(old.getStudyCount())) {
|
|
|
old.setStudyCount(0L);
|
|
|
}
|
|
|
- if(entity.getStudyCount().longValue()>old.getStudyCount().longValue()){
|
|
|
+ if (entity.getStudyCount().longValue() > old.getStudyCount().longValue()) {
|
|
|
Long addNum = entity.getStudyCount() - old.getStudyCount();
|
|
|
//增加购买用户的学习次数
|
|
|
/* OrderGoodsQueryBo bo = new OrderGoodsQueryBo();
|
|
@@ -595,7 +610,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
iOrderGoodsService.updateById(orderGoods);
|
|
|
}*/
|
|
|
}
|
|
|
- if(entity.getStudyCount().longValue()<old.getStudyCount().longValue()){
|
|
|
+ if (entity.getStudyCount().longValue() < old.getStudyCount().longValue()) {
|
|
|
throw new CustomException("学习次数不允许变小");
|
|
|
}
|
|
|
|
|
@@ -604,7 +619,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
|
|
|
@Override
|
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
- if(isValid){
|
|
|
+ if (isValid) {
|
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
|
}
|
|
|
return this.removeByIds(ids);
|
|
@@ -657,8 +672,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
public GoodsVo selectUserDetail(CourseQueryBo bo) {
|
|
|
GoodsVo goodsVo = baseMapper.selectUserDetail(bo);
|
|
|
//获得当前所在班级
|
|
|
- ClassGradeVo classGradeVo = courseMapper.gradeIdSelect(bo.getUserId(),bo.getGoodsId(),null);
|
|
|
- if(Validator.isNotEmpty(classGradeVo)){
|
|
|
+ ClassGradeVo classGradeVo = courseMapper.gradeIdSelect(bo.getUserId(), bo.getGoodsId(), null);
|
|
|
+ if (Validator.isNotEmpty(classGradeVo)) {
|
|
|
goodsVo.setGradeId(classGradeVo.getGradeId());
|
|
|
}
|
|
|
return goodsVo;
|
|
@@ -671,6 +686,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
|
|
|
/**
|
|
|
* 获取商品模块绑定赠送的题库卷列表
|
|
|
+ *
|
|
|
* @param goodsId
|
|
|
* @return
|
|
|
*/
|
|
@@ -680,23 +696,23 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
GoodsCourseQueryBo courseQueryBo = new GoodsCourseQueryBo();
|
|
|
courseQueryBo.setGoodsId(goodsId);
|
|
|
List<CourseVo> courseVoList = iGoodsCourseService.selectList(courseQueryBo);
|
|
|
- for(CourseVo vo : courseVoList){
|
|
|
+ for (CourseVo vo : courseVoList) {
|
|
|
CourseMenuQueryBo bo = new CourseMenuQueryBo();
|
|
|
bo.setCourseId(vo.getCourseId());
|
|
|
bo.setType(1);//过滤模块
|
|
|
List<CourseMenuVo> moduleList = iCourseMenuService.selectList(bo);
|
|
|
- for(CourseMenuVo menuVo : moduleList){
|
|
|
- if(Validator.isNotEmpty(menuVo.getExamType())&&Validator.isNotEmpty(menuVo.getFreeExamId())){
|
|
|
+ for (CourseMenuVo menuVo : moduleList) {
|
|
|
+ if (Validator.isNotEmpty(menuVo.getExamType()) && Validator.isNotEmpty(menuVo.getFreeExamId())) {
|
|
|
//获取模块绑定的免费卷ID
|
|
|
CourseModuleFreeExamVo freeExamVo = BeanUtil.toBean(menuVo, CourseModuleFreeExamVo.class);
|
|
|
boolean hasExit = false;
|
|
|
- for(int i=0;i<moduleExamList.size();i++){
|
|
|
- if(moduleExamList.get(i).getExamType()==freeExamVo.getExamType()&&moduleExamList.get(i).getFreeExamId().longValue()==freeExamVo.getFreeExamId().longValue()){
|
|
|
+ for (int i = 0; i < moduleExamList.size(); i++) {
|
|
|
+ if (moduleExamList.get(i).getExamType() == freeExamVo.getExamType() && moduleExamList.get(i).getFreeExamId().longValue() == freeExamVo.getFreeExamId().longValue()) {
|
|
|
hasExit = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- if(!hasExit){
|
|
|
+ if (!hasExit) {
|
|
|
moduleExamList.add(freeExamVo);
|
|
|
}
|
|
|
}
|
|
@@ -707,9 +723,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
|
|
|
@Override
|
|
|
public List<SyncGoodsExport> selectRjJzsList(GoodsQueryBo bo) {
|
|
|
- CourseEducationType educationType = iCourseEducationTypeService.getOne(new LambdaQueryWrapper<CourseEducationType>().eq(CourseEducationType::getStatus, 1).eq(CourseEducationType::getEducationName,"继续教育").last("limit 1"));
|
|
|
- CourseProjectType projectType = iCourseProjectTypeService.getOne(new LambdaQueryWrapper<CourseProjectType>().eq(CourseProjectType::getStatus, 1).eq(CourseProjectType::getEducationId,educationType.getId()).eq(CourseProjectType::getProjectName,"建造师").last("limit 1"));
|
|
|
- CourseBusiness business = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getStatus, 1).eq(CourseBusiness::getProjectId,projectType.getId()).eq(CourseBusiness::getBusinessName,"二级").last("limit 1"));
|
|
|
+ CourseEducationType educationType = iCourseEducationTypeService.getOne(new LambdaQueryWrapper<CourseEducationType>().eq(CourseEducationType::getStatus, 1).eq(CourseEducationType::getEducationName, "继续教育").last("limit 1"));
|
|
|
+ CourseProjectType projectType = iCourseProjectTypeService.getOne(new LambdaQueryWrapper<CourseProjectType>().eq(CourseProjectType::getStatus, 1).eq(CourseProjectType::getEducationId, educationType.getId()).eq(CourseProjectType::getProjectName, "建造师").last("limit 1"));
|
|
|
+ CourseBusiness business = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getStatus, 1).eq(CourseBusiness::getProjectId, projectType.getId()).eq(CourseBusiness::getBusinessName, "二级").last("limit 1"));
|
|
|
GoodsQueryBo goodsQueryBo = new GoodsQueryBo();
|
|
|
goodsQueryBo.setEducationTypeId(educationType.getId());
|
|
|
goodsQueryBo.setBusinessId(business.getId());
|
|
@@ -717,8 +733,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
goodsQueryBo.setStatus(new ArrayList<Integer>(Arrays.asList(1)));
|
|
|
List<GoodsVo> goodsVoList = queryList(goodsQueryBo);
|
|
|
List<GoodsJzsVo> jzsVoList = new ArrayList<>();
|
|
|
- for(GoodsVo goodsVo : goodsVoList){
|
|
|
- if(goodsVo.getGoodsId()!=921L){
|
|
|
+ for (GoodsVo goodsVo : goodsVoList) {
|
|
|
+ if (goodsVo.getGoodsId() != 921L) {
|
|
|
continue;
|
|
|
}
|
|
|
GoodsJzsVo jzsVo = new GoodsJzsVo();
|
|
@@ -726,19 +742,19 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
jzsVo.setGoodsName(goodsVo.getGoodsName());
|
|
|
jzsVo.setClassHours(goodsVo.getClassHours());
|
|
|
CourseSubject courseSubject = iCourseSubjectService.getOne(new LambdaQueryWrapper<CourseSubject>().eq(CourseSubject::getId, goodsVo.getSubjectIds()).last("limit 1"));
|
|
|
- if(Validator.isNotEmpty(courseSubject)){
|
|
|
+ if (Validator.isNotEmpty(courseSubject)) {
|
|
|
jzsVo.setSubjectName(courseSubject.getSubjectName());
|
|
|
}
|
|
|
List<GoodsJzsChapterVo> jzsChapterVoList = new ArrayList<>();
|
|
|
GoodsCourseQueryBo goodsCourseQueryBo = new GoodsCourseQueryBo();
|
|
|
goodsCourseQueryBo.setGoodsId(goodsVo.getGoodsId());
|
|
|
List<CourseVo> courseVoList = iGoodsCourseService.selectList(goodsCourseQueryBo);
|
|
|
- for(CourseVo courseVo : courseVoList){
|
|
|
+ for (CourseVo courseVo : courseVoList) {
|
|
|
CourseMenuQueryBo menuQueryBo = new CourseMenuQueryBo();
|
|
|
menuQueryBo.setCourseId(courseVo.getCourseId());
|
|
|
List<CourseMenuVo> courseMenuVoList = iCourseMenuService.selectList(menuQueryBo);
|
|
|
courseMenuVoList.forEach(courseMenuVo -> {
|
|
|
- if(courseMenuVo.getType()==1){
|
|
|
+ if (courseMenuVo.getType() == 1) {
|
|
|
//获取章信息
|
|
|
List<CourseModuleChapterVo> courseModuleChapterVoList = iCourseModuleChapterService.getListById(courseMenuVo.getMenuId());
|
|
|
courseModuleChapterVoList.forEach(courseModuleChapterVo -> {
|
|
@@ -766,9 +782,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
jzsVoList.add(jzsVo);
|
|
|
}
|
|
|
List<SyncGoodsExport> exportList = new ArrayList<>();
|
|
|
- for(GoodsJzsVo jzsVo : jzsVoList){
|
|
|
- for(GoodsJzsChapterVo chapterVo : jzsVo.getChapterList()){
|
|
|
- for(GoodsJzsSectionVo sectionVo : chapterVo.getSectionList()){
|
|
|
+ for (GoodsJzsVo jzsVo : jzsVoList) {
|
|
|
+ for (GoodsJzsChapterVo chapterVo : jzsVo.getChapterList()) {
|
|
|
+ for (GoodsJzsSectionVo sectionVo : chapterVo.getSectionList()) {
|
|
|
SyncGoodsExport goodsExport = new SyncGoodsExport();
|
|
|
goodsExport.setGoodsId(jzsVo.getGoodsId());
|
|
|
goodsExport.setGoodsName(jzsVo.getGoodsName());
|
|
@@ -789,87 +805,164 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean GoodsBatchUpdateStatusBo(GoodsBatchUpdateStatusBo bo) {
|
|
|
- if (CollectionUtils.isEmpty(bo.getGoodsIds())){
|
|
|
+ if (CollectionUtils.isEmpty(bo.getGoodsIds())) {
|
|
|
throw new CustomException("商品ID不能为空");
|
|
|
}
|
|
|
- if (bo.getGoodsStatus() !=-1) {
|
|
|
+ if (bo.getGoodsStatus() != -1) {
|
|
|
List<Goods> goodsList = listByIds(bo.getGoodsIds());
|
|
|
if (goodsList.stream().anyMatch(x -> x.getStatus() == 0) && bo.getGoodsStatus() == 1) {
|
|
|
throw new CustomException("存在无效商品不允许上架,请检查!");
|
|
|
}
|
|
|
- if (goodsList.stream().anyMatch(x -> Validator.isNotEmpty(x.getValidityEndTime())&&x.getValidityEndTime() < DateUtils.getNowTime()) && bo.getGoodsStatus() == 1) {
|
|
|
+ if (goodsList.stream().anyMatch(x -> Validator.isNotEmpty(x.getValidityEndTime()) && x.getValidityEndTime() < DateUtils.getNowTime()) && bo.getGoodsStatus() == 1) {
|
|
|
throw new CustomException("存在过期商品不允许上架,请检查!");
|
|
|
}
|
|
|
}
|
|
|
return update(new LambdaUpdateWrapper<Goods>()
|
|
|
- .set(Goods::getGoodsStatus,bo.getGoodsStatus())
|
|
|
- .set(Goods::getUpdateTime,DateUtils.getNowTime())
|
|
|
- .in(Goods::getGoodsId,bo.getGoodsIds()));
|
|
|
+ .set(Goods::getGoodsStatus, bo.getGoodsStatus())
|
|
|
+ .set(Goods::getUpdateTime, DateUtils.getNowTime())
|
|
|
+ .in(Goods::getGoodsId, bo.getGoodsIds()));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean batchDelGoods(GoodsBatchDelBo bo) {
|
|
|
- if (CollectionUtils.isEmpty(bo.getIds())){
|
|
|
+ if (CollectionUtils.isEmpty(bo.getIds())) {
|
|
|
throw new CustomException("商品ID不能为空");
|
|
|
}
|
|
|
- if (bo.getStatus() ==-1||bo.getStatus() ==0) {
|
|
|
+ if (bo.getStatus() == -1 || bo.getStatus() == 0) {
|
|
|
List<Long> payStatus = new ArrayList<>();
|
|
|
payStatus.add(2L);
|
|
|
payStatus.add(3L);
|
|
|
payStatus.add(4L);
|
|
|
//查看是否有出售过
|
|
|
- List<OrderGoods> orderGoodsList = iOrderGoodsService.list(new LambdaQueryWrapper< OrderGoods >().in(OrderGoods::getGoodsId,bo.getIds())
|
|
|
- .in(OrderGoods::getPayStatus,payStatus).ne(OrderGoods::getRefundStatus,2));
|
|
|
- if(CollectionUtils.isNotEmpty(orderGoodsList)){
|
|
|
+ List<OrderGoods> orderGoodsList = iOrderGoodsService.list(new LambdaQueryWrapper<OrderGoods>().in(OrderGoods::getGoodsId, bo.getIds())
|
|
|
+ .in(OrderGoods::getPayStatus, payStatus).ne(OrderGoods::getRefundStatus, 2));
|
|
|
+ if (CollectionUtils.isNotEmpty(orderGoodsList)) {
|
|
|
throw new CustomException("存在已购买商品,无法改变状态,请检查!");
|
|
|
}
|
|
|
}
|
|
|
return update(new LambdaUpdateWrapper<Goods>()
|
|
|
- .set(Goods::getStatus,bo.getStatus())
|
|
|
- .set(Goods::getUpdateTime,DateUtils.getNowTime())
|
|
|
- .in(Goods::getGoodsId,bo.getIds()));
|
|
|
+ .set(Goods::getStatus, bo.getStatus())
|
|
|
+ .set(Goods::getUpdateTime, DateUtils.getNowTime())
|
|
|
+ .in(Goods::getGoodsId, bo.getIds()));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public boolean cancelSpecTemplate(GoodsSpecTempEditBo bo) {
|
|
|
Goods goods = getById(bo.getGoodsId());
|
|
|
- if (ObjectUtils.isNull(goods)){
|
|
|
+ if (ObjectUtils.isNull(goods)) {
|
|
|
throw new CustomException("商品信息获取失败");
|
|
|
}
|
|
|
return update(new LambdaUpdateWrapper<Goods>()
|
|
|
- .set(Goods::getSpecTemplateId,null)
|
|
|
- .eq(Goods::getGoodsId,bo.getGoodsId()));
|
|
|
+ .set(Goods::getSpecTemplateId, null)
|
|
|
+ .eq(Goods::getGoodsId, bo.getGoodsId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<UserGoodsListVo> getUserGoodsList(UserGoodsListBo bo) {
|
|
|
+ if (Validator.isEmpty(bo.getTelphone())) {
|
|
|
+ throw new CustomException("参数错误");
|
|
|
+ }
|
|
|
+ User user = iUserService.getOne(new LambdaQueryWrapper<User>()
|
|
|
+ .eq(User::getTelphone, bo.getTelphone()));
|
|
|
+ if (ObjectUtils.isNull(user)) {
|
|
|
+ throw new CustomException("通过手机号获取用户信息失败");
|
|
|
+ }
|
|
|
+ //获取用户订单商品信息
|
|
|
+ List<UserGoodsListVo> voList = baseMapper.getOrderGoodsListByUser(user.getUserId());
|
|
|
+ if (CollectionUtils.isEmpty(voList)) {
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ voList.forEach(goodsVo -> {
|
|
|
+ //已学和未学
|
|
|
+ Long secLong = 0L;
|
|
|
+ Long studyLong = 0L;
|
|
|
+ SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
|
|
|
+ subjectStudyRecordQueryBo.setGoodsId(goodsVo.getGoodsId());
|
|
|
+ subjectStudyRecordQueryBo.setUserId(user.getUserId());
|
|
|
+ subjectStudyRecordQueryBo.setOrderGoodsId(goodsVo.getOrderGoodsId());
|
|
|
+ subjectStudyRecordQueryBo.setGradeId(goodsVo.getGradeId());
|
|
|
+ List<SubjectStudyRecordVo> subjectStudyRecordVos = iUserStudyRecordService.listSubject(subjectStudyRecordQueryBo);
|
|
|
+ for (SubjectStudyRecordVo subjectStudyRecordVo : subjectStudyRecordVos) {
|
|
|
+ secLong = new BigDecimal(secLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getSectionNum().toString())).longValue();
|
|
|
+ studyLong = new BigDecimal(studyLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getRecordNum().toString())).longValue();
|
|
|
+ }
|
|
|
+ goodsVo.setTotalHours(secLong.intValue());
|
|
|
+ goodsVo.setStudyHours(studyLong.intValue());
|
|
|
+ goodsVo.setCreateTime(DateUtils.timestampToDateFormat(goodsVo.getCreateTimeStr()));
|
|
|
+ //审核状态
|
|
|
+ if (goodsVo.getCourseType() == 1) {
|
|
|
+ //视频商品
|
|
|
+ //获得当前所在班级
|
|
|
+ ClassGradeVo classGradeVo = courseMapper.gradeIdSelect(user.getUserId(), goodsVo.getGoodsId(), goodsVo.getGradeId());
|
|
|
+ if (ObjectUtils.isNotNull(classGradeVo)) {
|
|
|
+ goodsVo.setPeriodStatus(classGradeVo.getPeriodStatus());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (studyLong == 0) {
|
|
|
+ goodsVo.setStatusName("未学习");
|
|
|
+ } else if (studyLong < secLong) {
|
|
|
+ goodsVo.setStatusName("学习中");
|
|
|
+ } else if (studyLong.equals(secLong) && ObjectUtils.isNotNull(goodsVo.getPeriodStatus()) && goodsVo.getPeriodStatus() == 1){
|
|
|
+ goodsVo.setStatusName("已学完");
|
|
|
+ }else if (studyLong.equals(secLong) && ObjectUtils.isNotNull(goodsVo.getPeriodStatus()) && goodsVo.getPeriodStatus() == 2){
|
|
|
+ goodsVo.setStatusName("审核中");
|
|
|
+ }else if (studyLong.equals(secLong) && ObjectUtils.isNotNull(goodsVo.getPeriodStatus()) && goodsVo.getPeriodStatus() == 0){
|
|
|
+ goodsVo.setStatusName("不通过");
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取小程序appID
|
|
|
+ SysConfig sysConfig = iSysConfigService.getOne(new LambdaQueryWrapper<SysConfig>()
|
|
|
+ .eq(SysConfig::getConfigKey, "wx.small.appid")
|
|
|
+ .eq(SysConfig::getTenantId, goodsVo.getTrainOrgId()));
|
|
|
+ if (ObjectUtils.isNull(sysConfig)){
|
|
|
+ throw new CustomException("获取小程序appId失败");
|
|
|
+ }
|
|
|
+ goodsVo.setWeAppId(sysConfig.getConfigValue());
|
|
|
+ if (goodsVo.getCourseType() == 2){
|
|
|
+ //题库
|
|
|
+ goodsVo.setToWeAppPagePath("/pages2/bank/question_detail");
|
|
|
+ }else if (goodsVo.getCourseType() == 6){
|
|
|
+ //直播
|
|
|
+ goodsVo.setToWeAppPagePath("/pages3/live/detail");
|
|
|
+ }else {
|
|
|
+ //视频
|
|
|
+ goodsVo.setToWeAppPagePath("/pages3/polyv/detail");
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取商品规格模板列表
|
|
|
- * @author change
|
|
|
- * @date 2022/10/9 16:38
|
|
|
+ *
|
|
|
* @param goodsId
|
|
|
* @return java.util.List<com.zhongzheng.modules.goods.vo.GoodsSpecTemplateVo>
|
|
|
+ * @author change
|
|
|
+ * @date 2022/10/9 16:38
|
|
|
*/
|
|
|
@Override
|
|
|
public List<GoodsSpecTemplateVo> getSpecTemplateList(Long goodsId) {
|
|
|
List<GoodsSpecAttributeRelation> relationList = goodsSpecAttributeRelationService
|
|
|
.list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
|
|
|
- .eq(GoodsSpecAttributeRelation::getGoodsId, goodsId)
|
|
|
- .eq(GoodsSpecAttributeRelation::getStatus, 1));
|
|
|
+ .eq(GoodsSpecAttributeRelation::getGoodsId, goodsId)
|
|
|
+ .eq(GoodsSpecAttributeRelation::getStatus, 1));
|
|
|
List<GoodsSpecTemplate> templates = new ArrayList<>();
|
|
|
- if (CollectionUtils.isEmpty(relationList)){
|
|
|
+ if (CollectionUtils.isEmpty(relationList)) {
|
|
|
//没有关联获取商品业务层次下所有模板
|
|
|
Goods goods = getById(goodsId);
|
|
|
templates = goodsSpecTemplateService.list(new LambdaQueryWrapper<GoodsSpecTemplate>()
|
|
|
- .eq(GoodsSpecTemplate::getEducationTypeId,goods.getEducationTypeId())
|
|
|
- .eq(GoodsSpecTemplate::getBusinessId,goods.getBusinessId()));
|
|
|
- }else {
|
|
|
+ .eq(GoodsSpecTemplate::getEducationTypeId, goods.getEducationTypeId())
|
|
|
+ .eq(GoodsSpecTemplate::getBusinessId, goods.getBusinessId()));
|
|
|
+ } else {
|
|
|
Set<Long> specTemplateIds = relationList.stream().filter(x -> ObjectUtils.isNotNull(x.getSpecTemplateId()))
|
|
|
.map(GoodsSpecAttributeRelation::getSpecTemplateId).collect(Collectors.toSet());
|
|
|
templates = goodsSpecTemplateService
|
|
|
.list(new LambdaQueryWrapper<GoodsSpecTemplate>()
|
|
|
.in(GoodsSpecTemplate::getSpecTemplateId, specTemplateIds));
|
|
|
}
|
|
|
- if (CollectionUtils.isEmpty(templates)){
|
|
|
+ if (CollectionUtils.isEmpty(templates)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
|
|
@@ -896,7 +989,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
@Override
|
|
|
public boolean updateSpecTemplate(GoodsSpecTempEditBo bo) {
|
|
|
Goods goods = getById(bo.getGoodsId());
|
|
|
- if (ObjectUtils.isNull(goods)){
|
|
|
+ if (ObjectUtils.isNull(goods)) {
|
|
|
throw new CustomException("商品信息获取失败");
|
|
|
}
|
|
|
goods.setSpecTemplateId(bo.getSpecTemplateId());
|