yangdamao 2 anni fa
parent
commit
b7ff10d35a

+ 2 - 0
zhongzheng-admin-saas/src/main/resources/application-dev.yml

@@ -170,3 +170,5 @@ oldSys:
 
 invoice:
     host: http://192.168.1.222:7077/sys/common/openMplatform/log
+
+liveHost: http://192.168.1.222:6009

+ 2 - 0
zhongzheng-admin/src/main/resources/application-dev.yml

@@ -172,3 +172,5 @@ oldSys:
 
 invoice:
     host: http://192.168.1.222:7077/sys/common/openMplatform/log
+
+liveHost: http://192.168.1.222:6009

+ 3 - 1
zhongzheng-api/src/main/resources/application-dev.yml

@@ -172,4 +172,6 @@ oldSys:
     host: http://gdxypx.xy.com
 
 invoice:
-    host: http://192.168.1.222:7077/sys/common/openMplatform/log
+    host: http://192.168.1.222:7077/sys/common/openMplatform/log
+
+liveHost: http://192.168.1.222:6009

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseMenuMapper.java

@@ -39,4 +39,8 @@ public interface CourseMenuMapper extends BaseMapper<CourseMenu> {
 
     @InterceptorIgnore(tenantLine = "true")
     void deleteByIdTenant(@Param("newCourseId") Long newCourseId,@Param("newTenantId") Long newTenantId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    List<CourseMenu> selectByNotTenant(@Param("newCourseId") Long newCourseId,@Param("type") Integer type,@Param("newModuleId") Long newModuleId,@Param("newTenantId") Long newTenantId);
+
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseMenuService.java

@@ -66,4 +66,6 @@ public interface ICourseMenuService extends IService<CourseMenu> {
 	List<CourseUserMenuVo> getGoodsRebuildMenuList(CourseMenuQueryBo bo);
 
     void deleteByIdTenant(Long newCourseId, Long newTenantId);
+
+    List<CourseMenu> selectByNotTenant(Long newCourseId, Integer type, Long newModuleId,Long newTenantId);
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseMenuServiceImpl.java

@@ -326,4 +326,9 @@ public class CourseMenuServiceImpl extends ServiceImpl<CourseMenuMapper, CourseM
     public void deleteByIdTenant(Long newCourseId, Long newTenantId) {
         baseMapper.deleteByIdTenant(newCourseId, newTenantId);
     }
+
+    @Override
+    public List<CourseMenu> selectByNotTenant(Long newCourseId, Integer type, Long newModuleId,Long newTenantId) {
+        return baseMapper.selectByNotTenant(newCourseId, type, newModuleId,newTenantId);
+    }
 }

+ 16 - 30
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseSectionWatchPerServiceImpl.java

@@ -2,13 +2,11 @@ package com.zhongzheng.modules.course.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.codec.Base64;
-
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zhongzheng.common.utils.DateUtils;
-import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.modules.course.bo.CheckSectionWatchVo;
 import com.zhongzheng.modules.course.bo.SectionWatchPerAddBo;
 import com.zhongzheng.modules.course.bo.SectionWatchPerBo;
@@ -51,40 +49,28 @@ public class CourseSectionWatchPerServiceImpl extends ServiceImpl<CourseSectionW
     @Value("${liveGotoURL}")
     private String liveGotoURL;
 
+    @Value("${liveHost}")
+    private String liveHost;
+
     @Override
     public CourseSectionWatchPerVo getSectionWatchPer(SectionWatchPerBo bo) {
         CourseSectionWatchPerVo vo = new CourseSectionWatchPerVo();
-        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
-        //获取课程节信息
-        CourseSection section = courseSectionService.getById(bo.getSectionId());
-//        String url = "";
-        String live = "living-room/";
-        vo.setEnCode(wxLoginService.getLiveEnCode(bo));
-        String format = String.format("cid=%s&gid=%s&sid=%s", bo.getCourseId(), bo.getGoodsId(), bo.getSectionId());
+//        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
+//        //获取课程节信息
+//        CourseSection section = courseSectionService.getById(bo.getSectionId());
+//        String live = "living-room/";
+//        vo.setEnCode(wxLoginService.getLiveEnCode(bo));
+//        String format = String.format("cid=%s&gid=%s&sid=%s", bo.getCourseId(), bo.getGoodsId(), bo.getSectionId());
+//        String s = Base64.encode(format);
+//        String domainPc =  iSysTenantService.getById(tenantId).getHostPc();
+//        String url = String.format("%s%s/%s%s?a=1&%s",liveGotoURL, domainPc,live,section.getLiveUrl(), s);
+//        vo.setEnCodePC(url);
 
+        String format = String.format("cid=%s&gid=%s&sid=%s", bo.getCourseId(), bo.getGoodsId(), bo.getSectionId());
         String s = Base64.encode(format);
-
-//        String s = DigestUtils.md5Hex(format);
-//        String url = String.format("%s%s%s?a=1&cid=%s&gid=%s&sid=%s", liveGotoURL,live,section.getLiveUrl(), bo.getCourseId(), bo.getGoodsId(), bo.getSectionId());
-        // https://web.xyyxt.net/
-        String domainPc =  iSysTenantService.getById(tenantId).getHostPc();
-        String url = String.format("%s%s/%s%s?a=1&%s",liveGotoURL, domainPc,live,section.getLiveUrl(), s);
-//        //生成微信小程序码
-//        switch (bo.getSectionType()){
-//            case 2://直播 living-room/
-//                String live = "living-room/";
-//                vo.setEnCode(wxLoginService.getLiveEnCode(bo));
-//                url = String.format("%s%s%s?a=1&cid=%s&gid=%s&sid=%s", liveGotoURL,live,section.getLiveUrl(), bo.getCourseId(), bo.getGoodsId(), bo.getSectionId());
-//                break;
-//            case 3://回放 my-live-detail/
-//                String detail = "my-live-detail/";
-//                vo.setEnCode(wxLoginService.getBackEnCode(bo));
-//                url = String.format("%s%s%s?a=1&cid=%s&gid=%s&sid=%s", liveGotoURL,detail,bo.getGoodsId(), bo.getCourseId(), bo.getGoodsId(), bo.getSectionId());
-//                break;
-//            default:
-//                throw new CustomException("课程节类型不正确,请检查");
-//        }
+        String url = String.format("%s?param=%s",liveHost,s);
         vo.setEnCodePC(url);
+        vo.setEnCode(url);
         CourseSectionWatchPer watchPer = getOne(new LambdaQueryWrapper<CourseSectionWatchPer>()
                 .eq(ObjectUtils.isNotNull(bo.getCourseId()), CourseSectionWatchPer::getCourseId, bo.getCourseId())
                 .eq(ObjectUtils.isNotNull(bo.getChapterId()), CourseSectionWatchPer::getChapterId, bo.getChapterId())

+ 13 - 8
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java

@@ -30,15 +30,9 @@ import com.zhongzheng.modules.bank.domain.QuestionBusiness;
 import com.zhongzheng.modules.bank.service.IExamService;
 import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
 import com.zhongzheng.modules.exam.bo.*;
-import com.zhongzheng.modules.exam.domain.ExamApply;
-import com.zhongzheng.modules.exam.domain.ExamApplySite;
-import com.zhongzheng.modules.exam.domain.ExamApplySiteTime;
-import com.zhongzheng.modules.exam.domain.ExamApplyUser;
+import com.zhongzheng.modules.exam.domain.*;
 import com.zhongzheng.modules.exam.mapper.ExamApplyMapper;
-import com.zhongzheng.modules.exam.service.IExamApplyService;
-import com.zhongzheng.modules.exam.service.IExamApplySiteService;
-import com.zhongzheng.modules.exam.service.IExamApplySiteTimeService;
-import com.zhongzheng.modules.exam.service.IExamApplyUserService;
+import com.zhongzheng.modules.exam.service.*;
 import com.zhongzheng.modules.exam.vo.*;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
@@ -85,6 +79,8 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
     @Autowired
     private IExamService iExamService;
     @Autowired
+    private IExamSiteService iExamSiteService;
+    @Autowired
     private IActivityRecommendService iActivityRecommendService;
     @Autowired
     private IActivityRecommendGoodsService iActivityRecommendGoodsService;
@@ -869,6 +865,15 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
         }
         //获取考试学员
         vo.forEach(item -> {
+            //考场名称和考试名称
+            ExamSite site = iExamSiteService.getById(item.getSiteId());
+            if (ObjectUtils.isNotNull(site)){
+                item.setSiteName(site.getSiteAddress());
+            }
+            ExamApply examApply = getById(item.getApplyId());
+            if (ObjectUtils.isNotNull(examApply)){
+                item.setApplyName(examApply.getApplyName());
+            }
             List<ExamApplyUserDetailVo> examUserInfo = baseMapper.getExamUserInfo(item);
             if (CollectionUtils.isNotEmpty(examUserInfo)){
                 examUserInfo.forEach(user -> {

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamApplyDetailVo.java

@@ -16,6 +16,10 @@ public class ExamApplyDetailVo implements Serializable {
     private Long siteId;
     @ApiModelProperty("考试日期")
     private Long examTime;
+    @ApiModelProperty("考场名称")
+    private String siteName;
+    @ApiModelProperty("考试名称")
+    private String applyName;
     @ApiModelProperty("开始时间")
     private String startTime;
     @ApiModelProperty("结束时间")

+ 11 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsNodeCopyTenantBo.java

@@ -14,10 +14,18 @@ import java.util.List;
 public class GoodsNodeCopyTenantBo implements Serializable {
 
     @ApiModelProperty("机构ID")
-    private Long tenantId;
+    private List<Long> tenantId;
 
-    @ApiModelProperty("标识ID")
-    private Long signId;
+    @ApiModelProperty("商品ID")
+    private Long goodsId;
+    @ApiModelProperty("课程ID")
+    private Long courseId;
+    @ApiModelProperty("模块ID")
+    private Long modelId;
+    @ApiModelProperty("章ID")
+    private Long chapterId;
+    @ApiModelProperty("节ID")
+    private Long sectionId;
 
     @ApiModelProperty("类型:1课程 2模块 3章 4节")
     private Integer type;

+ 118 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -1625,7 +1625,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
                 disposeGoodsCourse(oldGoodsId,newGoodsId,newTenantId,newCourseMenuExamList,recordList);
                 //课程双师
                 disposeGoodsCourseTeacher(oldGoodsId,newGoodsId,newTenantId);
-                //商品试卷
+                //题库商品
                 disposeGoodsAttached(oldGoodsId,newGoodsId,newTenantId,recordList);
 
                 //处理商品试卷
@@ -2461,6 +2461,75 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         }
         return null;
     }
+
+    private void disposeModule(Long oldModuleId,Long newTenantId,Long oldCourseId,Long newCourseId,List<SysGoodsCopyRecord> array){
+        CourseModule module = iCourseModuleService.getById(oldModuleId);
+        if (ObjectUtils.isNotNull(module)){
+            Long oid = module.getModuleId();
+            Long newModuleId = getNewIdByTenant(oid,GoodsCopyEnum.COURSE_MODULE.getType(),newTenantId);
+            if (ObjectUtils.isNull(newModuleId)){
+                module.setModuleId(null);
+                module.setTenantId(newTenantId);
+                iCourseModuleService.save(module);
+                newModuleId = module.getModuleId();
+                addSysGoodsRecord(oid,newModuleId,GoodsCopyEnum.COURSE_MODULE.getType(),newTenantId,array);
+            }
+
+            //删除之前的关联
+            iCourseModuleBusinessService.deleteByIdAndTenant(newModuleId,newTenantId);
+            //新关联
+            List<CourseModuleBusiness> moduleBusinessList = iCourseModuleBusinessService
+                    .list(new LambdaQueryWrapper<CourseModuleBusiness>()
+                            .eq(CourseModuleBusiness::getModuleId, oldModuleId));
+            if (CollectionUtils.isNotEmpty(moduleBusinessList)){
+                for (CourseModuleBusiness item : moduleBusinessList) {
+                    item.setId(null);
+                    item.setTenantId(newTenantId);
+                    item.setModuleId(newModuleId);
+                    item.setEducationTypeId(getNewEducationTypeId(item.getEducationTypeId(), newTenantId,array));
+                    item.setBusinessId(getNewBusinessId(item.getBusinessId(), newTenantId,array));
+                    item.setSubjectId(getNewSubjectId(item.getSubjectId(), newTenantId,array));
+                    item.setProjectId(getNewProjectTypeId(item.getProjectId(), newTenantId,array));
+                }
+                iCourseModuleBusinessService.saveBatch(moduleBusinessList);
+            }
+
+            //模块章
+            iCourseModuleChapterService.deleteByIdAndTenant(newModuleId,newTenantId);
+            List<CourseModuleChapter> moduleChapterList = iCourseModuleChapterService
+                    .list(new LambdaQueryWrapper<CourseModuleChapter>()
+                            .eq(CourseModuleChapter::getModuleId, oldModuleId));
+            if (CollectionUtils.isNotEmpty(moduleChapterList)){
+                for (CourseModuleChapter item : moduleChapterList) {
+                    item.setId(null);
+                    item.setModuleId(newModuleId);
+                    item.setTenantId(newTenantId);
+                    item.setChapterId(getNewChapterId(item.getChapterId(),newTenantId,array));
+                }
+                iCourseModuleChapterService.saveBatch(moduleChapterList);
+            }
+
+            //课程模块关联
+            List<CourseMenu> courseMenus = iCourseMenuService.selectByNotTenant(newCourseId,1,newModuleId,newTenantId);
+            if (CollectionUtils.isEmpty(courseMenus)){
+                List<CourseMenu> list = iCourseMenuService.list(new LambdaQueryWrapper<CourseMenu>()
+                        .eq(CourseMenu::getCourseId, oldCourseId)
+                        .eq(CourseMenu::getMenuId, oid)
+                        .eq(CourseMenu::getType, 1));
+                if (CollectionUtils.isNotEmpty(list)){
+                    for (CourseMenu item : list) {
+                        item.setId(null);
+                        item.setCourseId(newCourseId);
+                        item.setMenuId(newModuleId);
+                        item.setTenantId(newTenantId);
+                    }
+                    iCourseMenuService.saveBatch(list);
+                }
+            }
+        }
+
+    }
+
     private Long getNewChapterId(Long oldChapterId,Long newTenantId,List<SysGoodsCopyRecord> array){
         CourseChapter chapter = iCourseChapterService.getById(oldChapterId);
         if (ObjectUtils.isNotNull(chapter)){
@@ -4394,7 +4463,55 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
 
     @Override
     public boolean goodsNodeCopyAddTenant(GoodsNodeCopyTenantBo bo) {
+        Goods goods = getById(bo.getGoodsId());
+        if (ObjectUtils.isNull(goods)){
+            throw new CustomException("商品信息获取有误");
+        }
+        Long oldGoodsId = goods.getGoodsId();
+        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
+        switch (bo.getType()){
+            case 1://课程复制
+                bo.getTenantId().forEach(newTenantId -> {
+                    Goods newGoods = getGoodsByTenantTwo(goods.getGoodsName(), goods.getCode(), newTenantId);
+                    if (ObjectUtils.isNull(newGoods)){
+                        throw new CustomException("该机构不存在此商品,请先复制商品!");
+                    }
+                    Long newGoodsId = newGoods.getGoodsId();
+                    //商品课程
+                    List<CourseMenuExam> newCourseMenuExamList = new ArrayList<>();
+                    List<SysGoodsCopyRecord> recordList = new ArrayList<>();
+                    if (goods.getGoodsType() == 2){
+                        //题库商品
+                        disposeGoodsAttached(oldGoodsId,newGoodsId,newTenantId,recordList);
+                    }else {
+                        disposeGoodsCourse(oldGoodsId,newGoodsId,newTenantId,newCourseMenuExamList,recordList);
+                    }
 
+                    //处理商品试卷
+                    if (CollectionUtils.isNotEmpty(newCourseMenuExamList)){
+                        for (CourseMenuExam menuExam : newCourseMenuExamList) {
+                            menuExam.setExamId(getNewExamId(menuExam.getExamId(),newTenantId,recordList));
+                        }
+                        iCourseMenuExamService.saveBatch(newCourseMenuExamList);
+                    }
+                });
+                break;
+            case 2://模块复制
+                Course course = iCourseService.getById(bo.getCourseId());
+                bo.getTenantId().forEach(newTenantId -> {
+                    List<SysGoodsCopyRecord> recordList = new ArrayList<>();
+                    Long newCourseId = iCourseService.getCourseByTenantTwo(course.getCourseName(), course.getCode(), newTenantId);
+                    if (ObjectUtils.isNull(newCourseId)){
+                        throw new CustomException("该机构不存在此商品课程,请先复制商品课程!");
+                    }
+                    getNewModuleId(bo.getModelId(),newTenantId,recordList);
+                });
+                break;
+
+
+
+
+        }
 
         return false;
     }

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMenuMapper.xml

@@ -368,4 +368,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             and usr.course_id=#{courseId}
             AND usr.current_status =1
     </select>
+
+    <select id="selectByNotTenant" parameterType="map"  resultType="com.zhongzheng.modules.course.domain.CourseMenu">
+        SELECT * FROM `course_menu` WHERE course_id = #{newCourseId} AND menu_id = #{newModuleId} AND type = #{type} AND tenant_id = #{newTenantId}
+    </select>
 </mapper>