yangdamao 2 yıl önce
ebeveyn
işleme
979f8d8b0e

+ 27 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -43,7 +43,9 @@ import com.zhongzheng.modules.goods.domain.*;
 import com.zhongzheng.modules.goods.mapper.GoodsMapper;
 import com.zhongzheng.modules.goods.service.*;
 import com.zhongzheng.modules.goods.vo.*;
+import com.zhongzheng.modules.grade.domain.ClassGradeGoods;
 import com.zhongzheng.modules.grade.domain.ClassGradeInterface;
+import com.zhongzheng.modules.grade.service.IClassGradeGoodsService;
 import com.zhongzheng.modules.grade.service.IClassGradeInterfaceService;
 import com.zhongzheng.modules.grade.vo.ClassGradeVo;
 import com.zhongzheng.modules.grade.vo.SyncGoodsExport;
@@ -129,7 +131,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
     private IOrderInputTemplateService iOrderInputTemplateService;
     @Autowired
     private IClassGradeInterfaceService iClassGradeInterfaceService;
-
+    @Autowired
+    private IClassGradeGoodsService iClassGradeGoodsService;
     @Autowired
     private ICourseMenuService iCourseMenuService;
     @Autowired
@@ -581,9 +584,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         }
         Long goodsId = add.getGoodsId();
         //七大员商品,默认绑定七大员学员资料模板
-        CourseEducationType educationType = iCourseEducationTypeService.getById(add.getEducationTypeId());
-        CourseBusiness business = iCourseBusinessService.getById(add.getBusinessId());
-        if (educationType.getEducationName().contains("考前培训") && business.getBusinessName().contains("七大员")){
+        String businessName = baseMapper.getBusinessName(goodsId);
+        if (businessName.contains("考前培训") && businessName.contains("施工现场专业人员")){
             //获取七大员学员资料模版
             List<ProfileTpBusiness> tpBusinessList = iProfileTpBusinessService.list(new LambdaQueryWrapper<ProfileTpBusiness>()
                     .eq(ProfileTpBusiness::getEducationTypeId, add.getEducationTypeId())
@@ -601,6 +603,27 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
                 });
                 iProfileTpService.updateBatchById(profileTpList);
             }
+        }else if (businessName.contains("继续教育") && businessName.contains("施工现场专业人员")){
+            //七大员继教同专业下共用一个班级
+            Goods oneGoods = getOne(new LambdaQueryWrapper<Goods>()
+                    .eq(Goods::getEducationTypeId, add.getEducationTypeId())
+                    .eq(Goods::getProjectId, add.getProjectId())
+                    .eq(Goods::getBusinessId, add.getBusinessId())
+                    .eq(ObjectUtils.isNotNull(add.getMajorId()), Goods::getMajorId, add.getMajorId())
+                    .eq(Goods::getSubjectIds, add.getSubjectIds())
+                    .eq(Goods::getStatus, 1)
+                    .eq(Goods::getGoodsStatus,1)
+                    .ne(Goods::getGoodsId, goodsId)
+                    .last("limit 1"));
+            if (ObjectUtils.isNotNull(oneGoods)){
+                List<ClassGradeGoods> classGradeList = iClassGradeGoodsService
+                        .list(new LambdaQueryWrapper<ClassGradeGoods>()
+                        .eq(ClassGradeGoods::getGoodsId, oneGoods.getGoodsId()));
+                if (CollectionUtils.isNotEmpty(classGradeList)){
+                    classGradeList.forEach(item -> item.setGoodsId(goodsId));
+                    iClassGradeGoodsService.saveBatch(classGradeList);
+                }
+            }
         }
         return result;
     }

+ 22 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -286,7 +286,28 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                 }
             });
         }
-
+        //七大员继教班级默认学时推送和报名推送
+        if (bo.getClassGradeGoodsAddBos() != null ) {
+            Long goodsId = bo.getClassGradeGoodsAddBos()[0];
+            String businessName = iGoodsService.getGoodsBusinessName(goodsId);
+            if (businessName.contains("继续教育") && businessName.contains("施工现场专业人员")) {
+                List<ClassGradeInterface> interfaceList = iClassGradeInterfaceService
+                        .list(new LambdaQueryWrapper<ClassGradeInterface>()
+                        .in(ClassGradeInterface::getType, Arrays.asList(1, 3))
+                        .eq(ClassGradeInterface::getStatus, 1));
+                if (CollectionUtils.isNotEmpty(interfaceList)){
+                    interfaceList.forEach(item -> {
+                        if (item.getType() == 1){
+                            //官方信息推送
+                            add.setInterfacePushId(item.getId());
+                        }else if (item.getType() == 3){
+                            //学时推送
+                            add.setInterfacePeriodId(item.getId());
+                        }
+                    });
+                }
+            }
+        }
         //是否创建官方班级编号
         if (bo.getClassGradeGoodsAddBos() != null &&
                 (ObjectUtils.isNull(bo.getClassStatus()) || 0 == bo.getClassStatus()) && org.getShareClass() == 1) {