|
@@ -505,8 +505,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
throw new CustomException(goods.getGoodsName() + "商品已下架,请重新选择商品下单");
|
|
|
}
|
|
|
//校验是否有重复商品
|
|
|
- if (StringUtils.isNotBlank(g.getSevenYear())){
|
|
|
- Long count = iOrderGoodsService.countOrderGoodsByYear(g.getSevenYear(),g.getGoodsId(),bo.getUserId());
|
|
|
+ if (StringUtils.isNotBlank(goods.getSevenYear())){
|
|
|
+ Long count = iOrderGoodsService.countOrderGoodsByYear(goods.getSevenYear(),g.getGoodsId(),bo.getUserId());
|
|
|
if (count > 0){
|
|
|
throw new CustomException(goods.getGoodsName() + ",请勿重复购买相同年份的商品");
|
|
|
}
|
|
@@ -1632,8 +1632,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
throw new CustomException(goods.getGoodsName() + "商品已下架,请重新选择商品下单");
|
|
|
}
|
|
|
//校验是否有重复商品
|
|
|
- if (StringUtils.isNotBlank(g.getSevenYear())){
|
|
|
- Long count = iOrderGoodsService.countOrderGoodsByYear(g.getSevenYear(),g.getGoodsId(),bo.getUserId());
|
|
|
+ if (StringUtils.isNotBlank(goods.getSevenYear())){
|
|
|
+ Long count = iOrderGoodsService.countOrderGoodsByYear(goods.getSevenYear(),g.getGoodsId(),bo.getUserId());
|
|
|
if (count > 0){
|
|
|
throw new CustomException(goods.getGoodsName() + ",请勿重复购买相同年份的商品");
|
|
|
}
|
|
@@ -2407,34 +2407,46 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
String gradeCode = ServletUtils.getEncoded("BJ");
|
|
|
classGrade.setGradeCode(gradeCode);
|
|
|
// classGrade.setClassName(goodsName + gradeCode);
|
|
|
- //班级名称 年份+期数+业务层次(俗名)+教育类型+科目(存在多个科目时,显示多个科目,用“+”分割)
|
|
|
- String businessName = businessVo.getAliasName();
|
|
|
- Goods goods = iGoodsService.getById(goodsId);
|
|
|
- CourseEducationType educationType = courseEducationTypeService.getById(goods.getEducationTypeId());
|
|
|
- String educationName = educationType.getEducationName();
|
|
|
- String className = businessName + educationName;
|
|
|
- if (StringUtils.isNotBlank(goods.getSubjectIds())) {
|
|
|
- List<CourseSubject> subjects = courseSubjectService.listByIds(Arrays.stream(goods.getSubjectIds().split(",")).collect(Collectors.toList()));
|
|
|
- List<String> names = subjects.stream().map(CourseSubject::getSubjectName).collect(Collectors.toList());
|
|
|
- className = String.format("%s(%s)", className, org.apache.commons.lang3.StringUtils.join(names, '+'));
|
|
|
- }
|
|
|
- Integer nameSort = 1;
|
|
|
- //获取排序值
|
|
|
- List<ClassGrade> list = iClassGradeService
|
|
|
- .list(new LambdaQueryWrapper<ClassGrade>()
|
|
|
- .like(ClassGrade::getClassName, className));
|
|
|
- if (CollectionUtils.isNotEmpty(list)) {
|
|
|
- List<Integer> collect = list.stream().filter(x -> x.getClassName().contains("第") && x.getClassName().contains("期")).map(item -> {
|
|
|
- String name = item.getClassName();
|
|
|
- String substring = name.substring(name.indexOf("第") + 1, name.indexOf("期"));
|
|
|
- return Integer.parseInt(substring);
|
|
|
- }).collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isNotEmpty(collect)) {
|
|
|
- Integer integer = collect.stream().sorted(Comparator.reverseOrder()).findFirst().get();
|
|
|
- nameSort = integer + 1;
|
|
|
- }
|
|
|
- }
|
|
|
- classGrade.setClassName(String.format("%s年第%s期%s", goods.getYear(), nameSort, className));
|
|
|
+ //七大员继教同一个专业下同一个班级名称
|
|
|
+ Boolean classFlag = true;
|
|
|
+ if (businessFull.contains("继续教育") && businessFull.contains("施工现场专业人员")){
|
|
|
+ Goods goods = iGoodsService.getById(goodsId);
|
|
|
+ ClassGrade gradeName = baseMapper.getClassNameByGoods(goods.getEducationTypeId(),goods.getProjectId().longValue(),goods.getBusinessId(),goods.getMajorId());
|
|
|
+ if (ObjectUtils.isNotNull(gradeName)){
|
|
|
+ classGrade.setClassName(gradeName.getClassName());
|
|
|
+ classFlag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (classFlag){
|
|
|
+ //班级名称 年份+期数+业务层次(俗名)+教育类型+科目(存在多个科目时,显示多个科目,用“+”分割)
|
|
|
+ String businessName = businessVo.getAliasName();
|
|
|
+ Goods goods = iGoodsService.getById(goodsId);
|
|
|
+ CourseEducationType educationType = courseEducationTypeService.getById(goods.getEducationTypeId());
|
|
|
+ String educationName = educationType.getEducationName();
|
|
|
+ String className = businessName + educationName;
|
|
|
+ if (StringUtils.isNotBlank(goods.getSubjectIds())) {
|
|
|
+ List<CourseSubject> subjects = courseSubjectService.listByIds(Arrays.stream(goods.getSubjectIds().split(",")).collect(Collectors.toList()));
|
|
|
+ List<String> names = subjects.stream().map(CourseSubject::getSubjectName).collect(Collectors.toList());
|
|
|
+ className = String.format("%s(%s)", className, org.apache.commons.lang3.StringUtils.join(names, '+'));
|
|
|
+ }
|
|
|
+ Integer nameSort = 1;
|
|
|
+ //获取排序值
|
|
|
+ List<ClassGrade> list = iClassGradeService
|
|
|
+ .list(new LambdaQueryWrapper<ClassGrade>()
|
|
|
+ .like(ClassGrade::getClassName, className));
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ List<Integer> collect = list.stream().filter(x -> x.getClassName().contains("第") && x.getClassName().contains("期")).map(item -> {
|
|
|
+ String name = item.getClassName();
|
|
|
+ String substring = name.substring(name.indexOf("第") + 1, name.indexOf("期"));
|
|
|
+ return Integer.parseInt(substring);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(collect)) {
|
|
|
+ Integer integer = collect.stream().sorted(Comparator.reverseOrder()).findFirst().get();
|
|
|
+ nameSort = integer + 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ classGrade.setClassName(String.format("%s年第%s期%s", goods.getYear(), nameSort, className));
|
|
|
+ }
|
|
|
|
|
|
boolean save = iClassGradeService.save(classGrade);
|
|
|
//绑定班级商品
|
|
@@ -2451,20 +2463,19 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
private String getSevenCode(Long goodsId) {
|
|
|
Goods g = iGoodsService.getById(goodsId);
|
|
|
- Goods oneGoods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>()
|
|
|
+ List<Goods> list = iGoodsService.list(new LambdaQueryWrapper<Goods>()
|
|
|
.eq(Goods::getEducationTypeId, g.getEducationTypeId())
|
|
|
.eq(Goods::getProjectId, g.getProjectId())
|
|
|
.eq(Goods::getBusinessId, g.getBusinessId())
|
|
|
.eq(ObjectUtils.isNotNull(g.getMajorId()), Goods::getMajorId, g.getMajorId())
|
|
|
.eq(Goods::getSubjectIds, g.getSubjectIds())
|
|
|
.eq(Goods::getStatus, 1)
|
|
|
- .eq(Goods::getGoodsStatus,1)
|
|
|
- .ne(Goods::getGoodsId, goodsId)
|
|
|
- .last("limit 1"));
|
|
|
- if (ObjectUtils.isNotNull(oneGoods)){
|
|
|
+ .eq(Goods::getGoodsStatus, 1)
|
|
|
+ .ne(Goods::getGoodsId, goodsId));
|
|
|
+ if (CollectionUtils.isNotEmpty(list)){
|
|
|
List<ClassGradeGoods> classGradeList = iClassGradeGoodsService
|
|
|
.list(new LambdaQueryWrapper<ClassGradeGoods>()
|
|
|
- .eq(ClassGradeGoods::getGoodsId, oneGoods.getGoodsId()));
|
|
|
+ .in(ClassGradeGoods::getGoodsId, list.stream().map(Goods::getGoodsId).collect(Collectors.toList())));
|
|
|
if (CollectionUtils.isNotEmpty(classGradeList)){
|
|
|
ClassGrade classGrade = baseMapper.getSevenGrade(classGradeList.stream().map(ClassGradeGoods::getGradeId).collect(Collectors.toList()));
|
|
|
if (ObjectUtils.isNotNull(classGrade)){
|