|
@@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
@@ -15,7 +16,11 @@ import com.zhongzheng.common.core.redis.RedisCache;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
+import com.zhongzheng.modules.bank.domain.*;
|
|
|
import com.zhongzheng.modules.bank.mapper.QuestionMapper;
|
|
|
+import com.zhongzheng.modules.bank.service.*;
|
|
|
+import com.zhongzheng.modules.base.domain.*;
|
|
|
+import com.zhongzheng.modules.base.service.*;
|
|
|
import com.zhongzheng.modules.course.bo.CourseMenuAddBo;
|
|
|
import com.zhongzheng.modules.course.bo.CourseMenuListAddBo;
|
|
|
import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
|
|
@@ -25,6 +30,8 @@ import com.zhongzheng.modules.course.mapper.CourseMapper;
|
|
|
import com.zhongzheng.modules.course.service.*;
|
|
|
import com.zhongzheng.modules.course.vo.*;
|
|
|
import com.zhongzheng.modules.exam.bo.ExamNumberGoodsQueryBo;
|
|
|
+import com.zhongzheng.modules.exam.domain.ExamPaper;
|
|
|
+import com.zhongzheng.modules.exam.service.IExamPaperService;
|
|
|
import com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo;
|
|
|
import com.zhongzheng.modules.goods.bo.*;
|
|
|
import com.zhongzheng.modules.goods.domain.*;
|
|
@@ -35,13 +42,25 @@ 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.pay.domain.PayServe;
|
|
|
import com.zhongzheng.modules.pay.domain.PaySupply;
|
|
|
+import com.zhongzheng.modules.pay.service.IPayServeService;
|
|
|
import com.zhongzheng.modules.pay.service.IPaySupplyService;
|
|
|
+import com.zhongzheng.modules.polyv.domain.PolyvCata;
|
|
|
+import com.zhongzheng.modules.polyv.domain.PolyvVideo;
|
|
|
+import com.zhongzheng.modules.polyv.service.IPolyvCataService;
|
|
|
+import com.zhongzheng.modules.polyv.service.IPolyvLiveService;
|
|
|
+import com.zhongzheng.modules.polyv.service.IPolyvVideoService;
|
|
|
+import com.zhongzheng.modules.system.bo.GoodsCopyEnum;
|
|
|
import com.zhongzheng.modules.system.domain.SysConfig;
|
|
|
+import com.zhongzheng.modules.system.domain.SysGoodsCopyRecord;
|
|
|
import com.zhongzheng.modules.system.service.ISysConfigService;
|
|
|
+import com.zhongzheng.modules.system.service.ISysGoodsCopyRecordService;
|
|
|
import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
|
|
|
import com.zhongzheng.modules.user.bo.UserPhoneBo;
|
|
|
+import com.zhongzheng.modules.user.domain.School;
|
|
|
import com.zhongzheng.modules.user.domain.User;
|
|
|
+import com.zhongzheng.modules.user.service.ISchoolService;
|
|
|
import com.zhongzheng.modules.user.service.IUserService;
|
|
|
import com.zhongzheng.modules.user.service.IUserStudyRecordService;
|
|
|
import com.zhongzheng.modules.user.vo.SubjectStudyRecordVo;
|
|
@@ -85,13 +104,21 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
@Autowired
|
|
|
private CourseMapper courseMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICourseService iCourseService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private IOrderGoodsService iOrderGoodsService;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private ICourseMenuService iCourseMenuService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private ICourseMenuExamService iCourseMenuExamService;
|
|
|
+ @Autowired
|
|
|
+ private ICourseModuleService iCourseModuleService;
|
|
|
+ @Autowired
|
|
|
+ private ICourseModuleBusinessService iCourseModuleBusinessService;
|
|
|
@Autowired
|
|
|
private ICourseChapterSectionService iCourseChapterSectionService;
|
|
|
|
|
@@ -103,26 +130,61 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
@Autowired
|
|
|
private IGoodsSpecTemplateService goodsSpecTemplateService;
|
|
|
@Autowired
|
|
|
+ private IGoodsSpecAttributeService goodsSpecAttributeService;
|
|
|
+ @Autowired
|
|
|
private IGoodsSpecAttributeRelationService goodsSpecAttributeRelationService;
|
|
|
|
|
|
@Autowired
|
|
|
private ICourseEducationTypeService iCourseEducationTypeService;
|
|
|
+ @Autowired
|
|
|
+ private ICourseHandoutsService iCourseHandoutsService;
|
|
|
+ @Autowired
|
|
|
+ private ICourseHandoutsBusinessService iCourseHandoutsBusinessService;
|
|
|
|
|
|
@Autowired
|
|
|
- private ICourseProjectTypeService iCourseProjectTypeService;
|
|
|
+ private ICourseEducationTierService iCourseEducationTierService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICourseProjectTypeService iCourseProjectTypeService;
|
|
|
+ @Autowired
|
|
|
+ private ICourseSectionService iCourseSectionService;
|
|
|
+ @Autowired
|
|
|
+ private ICourseSectionBusinessService iCourseSectionBusinessService;
|
|
|
@Autowired
|
|
|
private ICourseBusinessService iCourseBusinessService;
|
|
|
|
|
|
@Autowired
|
|
|
private ICourseSubjectService iCourseSubjectService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private ICourseSubjectProjectService iCourseSubjectProjectService;
|
|
|
+ @Autowired
|
|
|
+ private IExamService iExamService;
|
|
|
+ @Autowired
|
|
|
+ private IExamPaperService iExamPaperService;
|
|
|
+ @Autowired
|
|
|
+ private IExamQuestionService iExamQuestionService;
|
|
|
@Autowired
|
|
|
private IGoodsSpecService goodsSpecService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private IQuestionService iQuestionService;
|
|
|
@Autowired
|
|
|
private QuestionMapper questionMapper;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private IQuestionBusinessService iQuestionBusinessService;
|
|
|
+ @Autowired
|
|
|
+ private IQuestionChapterService iQuestionChapterService;
|
|
|
+ @Autowired
|
|
|
+ private IQuestionChapterExamService iQuestionChapterExamService;
|
|
|
+ @Autowired
|
|
|
+ private IQuestionModuleService iQuestionModuleService;
|
|
|
+ @Autowired
|
|
|
+ private IQuestionModuleChapterService iQuestionModuleChapterService;
|
|
|
+ @Autowired
|
|
|
+ private ICertificateService iCertificateService;
|
|
|
+ @Autowired
|
|
|
+ private ICertificateCommonService iCertificateCommonService;
|
|
|
+ @Autowired
|
|
|
+ private ICertificateTpService iCertificateTpService;
|
|
|
@Autowired
|
|
|
private IUserService iUserService;
|
|
|
|
|
@@ -132,11 +194,49 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
@Autowired
|
|
|
private ISysConfigService iSysConfigService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISysGoodsCopyRecordService iSysGoodsCopyRecordService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private RedisCache redisCache;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IGoodsCourseTeacherService goodsCourseTeacherService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICourseChapterService iCourseChapterService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICourseChapterBusinessService iCourseChapterBusinessService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private IPaySupplyService iPaySupplyService;
|
|
|
+ @Autowired
|
|
|
+ private ICourseStreamingService iCourseStreamingService;
|
|
|
+ @Autowired
|
|
|
+ private ICourseStreamingBusinessService iCourseStreamingBusinessService;
|
|
|
+ @Autowired
|
|
|
+ private IPolyvVideoService iPolyvVideoService;
|
|
|
+ @Autowired
|
|
|
+ private IPolyvCataService iPolyvCataService;
|
|
|
+ @Autowired
|
|
|
+ private ISchoolService iSchoolService;
|
|
|
+ @Autowired
|
|
|
+ private IProfileFieldService iProfileFieldService;
|
|
|
+ @Autowired
|
|
|
+ private IProfileTpService iProfileTpService;
|
|
|
+ @Autowired
|
|
|
+ private IProfileTpBusinessService iProfileTpBusinessService;
|
|
|
+ @Autowired
|
|
|
+ private IMajorService iMajorService;
|
|
|
+ @Autowired
|
|
|
+ private IMajorProjectService iMajorProjectService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IPayServeService iPayServeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysGoodsCopyRecordService iGoodsCopyRecordService;
|
|
|
|
|
|
@Override
|
|
|
public GoodsVo queryById(Long goodsId) {
|
|
@@ -908,7 +1008,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
if (goodsVo.getCourseType() == 1) {
|
|
|
//视频商品
|
|
|
//获得当前所在班级
|
|
|
- ClassGradeVo classGradeVo = courseMapper.gradeIdSelectTenant(user.getUserId(), goodsVo.getGoodsId(), goodsVo.getGradeId(),goodsVo.getTenantId());
|
|
|
+ ClassGradeVo classGradeVo = courseMapper.gradeIdSelectTenant(user.getUserId(), goodsVo.getGoodsId(), goodsVo.getGradeId(), goodsVo.getTenantId());
|
|
|
if (ObjectUtils.isNotNull(classGradeVo)) {
|
|
|
goodsVo.setPeriodStatus(classGradeVo.getPeriodStatus());
|
|
|
}
|
|
@@ -917,11 +1017,11 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
goodsVo.setStatusName("未学习");
|
|
|
} else if (studyLong < secLong) {
|
|
|
goodsVo.setStatusName("学习中");
|
|
|
- } else if (studyLong.equals(secLong) && ObjectUtils.isNotNull(goodsVo.getPeriodStatus()) && goodsVo.getPeriodStatus() == 1){
|
|
|
+ } 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){
|
|
|
+ } 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){
|
|
|
+ } else if (studyLong.equals(secLong) && ObjectUtils.isNotNull(goodsVo.getPeriodStatus()) && goodsVo.getPeriodStatus() == 0) {
|
|
|
goodsVo.setStatusName("不通过");
|
|
|
}
|
|
|
|
|
@@ -929,26 +1029,26 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
SysConfig sysConfig = iSysConfigService.getOne(new LambdaQueryWrapper<SysConfig>()
|
|
|
.eq(SysConfig::getConfigKey, "wx.small.appid")
|
|
|
.eq(SysConfig::getTenantId, goodsVo.getTenantId()));
|
|
|
- if (ObjectUtils.isNull(sysConfig)){
|
|
|
+ if (ObjectUtils.isNull(sysConfig)) {
|
|
|
throw new CustomException("获取小程序appId失败");
|
|
|
}
|
|
|
//课程
|
|
|
- List<Long> courseIds = iGoodsCourseService.getCourseIdsByGoodsAndTenant(goodsVo.getGoodsId(),goodsVo.getTenantId());
|
|
|
- if (CollectionUtils.isNotEmpty(courseIds) && courseIds.size() == 1){
|
|
|
+ List<Long> courseIds = iGoodsCourseService.getCourseIdsByGoodsAndTenant(goodsVo.getGoodsId(), goodsVo.getTenantId());
|
|
|
+ if (CollectionUtils.isNotEmpty(courseIds) && courseIds.size() == 1) {
|
|
|
goodsVo.setCourseId(courseIds.get(0));
|
|
|
}
|
|
|
goodsVo.setWeAppId(sysConfig.getConfigValue());
|
|
|
- if (goodsVo.getCourseType() == 2){
|
|
|
+ if (goodsVo.getCourseType() == 2) {
|
|
|
//题库
|
|
|
goodsVo.setToWeAppPagePath("/pages/questionBank/index");
|
|
|
- }else if (goodsVo.getCourseType() == 6){
|
|
|
+ } else if (goodsVo.getCourseType() == 6) {
|
|
|
//直播
|
|
|
goodsVo.setToWeAppPagePath(String.format("/pages3/live/detail?orderGoodsId=%s&goodsId=%s&gradeId=0&courseId=%s",
|
|
|
- goodsVo.getOrderGoodsId(),goodsVo.getGoodsId(),goodsVo.getCourseId()));
|
|
|
- }else {
|
|
|
+ goodsVo.getOrderGoodsId(), goodsVo.getGoodsId(), goodsVo.getCourseId()));
|
|
|
+ } else {
|
|
|
//视频
|
|
|
goodsVo.setToWeAppPagePath(String.format("/pages3/polyv/detail?id=%s&goodsId=%s&orderGoodsId=%s&gradeId=%s",
|
|
|
- goodsVo.getCourseId(),goodsVo.getGoodsId(),goodsVo.getOrderGoodsId(),goodsVo.getGradeId()));
|
|
|
+ goodsVo.getCourseId(), goodsVo.getGoodsId(), goodsVo.getOrderGoodsId(), goodsVo.getGradeId()));
|
|
|
}
|
|
|
|
|
|
});
|
|
@@ -961,110 +1061,1777 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
String url = "";
|
|
|
String domain = "http://192.168.1.222:6002/";
|
|
|
String domainH5 = "https://h.xyyxt.net";
|
|
|
- GoodsVo goods = baseMapper.queryGoodsByIdTenant(bo.getGoodsId(),bo.getTenantId());
|
|
|
- if (ObjectUtils.isNull(goods)){
|
|
|
+ GoodsVo goods = baseMapper.queryGoodsByIdTenant(bo.getGoodsId(), bo.getTenantId());
|
|
|
+ if (ObjectUtils.isNull(goods)) {
|
|
|
throw new CustomException("商品不存在!");
|
|
|
}
|
|
|
- User user = iUserService.queryUserByTelphoneTenant(bo.getTelphone(),bo.getTenantId());
|
|
|
- if (ObjectUtils.isNull(user)){
|
|
|
+ User user = iUserService.queryUserByTelphoneTenant(bo.getTelphone(), bo.getTenantId());
|
|
|
+ if (ObjectUtils.isNull(user)) {
|
|
|
throw new CustomException("用户不存在!");
|
|
|
}
|
|
|
//校验当前商品是否用户购买
|
|
|
- UserOrderGoodsVo vo = baseMapper.countUserOrderGoods(bo.getGoodsId(),user.getUserId(),bo.getTenantId());
|
|
|
- if (ObjectUtils.isNull(vo)){
|
|
|
+ UserOrderGoodsVo vo = baseMapper.countUserOrderGoods(bo.getGoodsId(), user.getUserId(), bo.getTenantId());
|
|
|
+ if (ObjectUtils.isNull(vo)) {
|
|
|
throw new CustomException("用户没有购买该商品!");
|
|
|
}
|
|
|
//商品课程
|
|
|
Long courseId = 0L;
|
|
|
- List<Long> courseIds = iGoodsCourseService.getCourseIdsByGoodsAndTenant(bo.getGoodsId(),bo.getTenantId());
|
|
|
- if (CollectionUtils.isNotEmpty(courseIds) && courseIds.size() == 1){
|
|
|
+ List<Long> courseIds = iGoodsCourseService.getCourseIdsByGoodsAndTenant(bo.getGoodsId(), bo.getTenantId());
|
|
|
+ if (CollectionUtils.isNotEmpty(courseIds) && courseIds.size() == 1) {
|
|
|
courseId = courseIds.get(0);
|
|
|
}
|
|
|
//当前时间戳
|
|
|
Long nowTime = DateUtils.getNowTime();
|
|
|
- if (bo.getSkipPort() == 1){
|
|
|
+ if (bo.getSkipPort() == 1) {
|
|
|
//PC端
|
|
|
- if (goods.getGoodsType() == 2){
|
|
|
+ if (goods.getGoodsType() == 2) {
|
|
|
//题库
|
|
|
- url = String.format("%sperson-center/my-bank/index?goodsId=%s&skipPort=%s",domain,vo.getGoodsId(),nowTime);
|
|
|
- }else if (goods.getGoodsType() == 6){
|
|
|
+ url = String.format("%sperson-center/my-bank/index?goodsId=%s&skipPort=%s", domain, vo.getGoodsId(), nowTime);
|
|
|
+ } else if (goods.getGoodsType() == 6) {
|
|
|
//直播
|
|
|
- url = String.format("%sperson-center/my-live?goodsId=%s&skipPort=%s",domain,vo.getGoodsId(),nowTime);
|
|
|
- }else {
|
|
|
+ url = String.format("%sperson-center/my-live?goodsId=%s&skipPort=%s", domain, vo.getGoodsId(), nowTime);
|
|
|
+ } else {
|
|
|
//视频
|
|
|
- url = String.format("%smy-course-detail/%s?gradeId=%s&orderGoodsId=%s&skipPort=%s",domain,vo.getGoodsId(),vo.getGradeId(),vo.getOrderGoodsId(),nowTime);
|
|
|
+ url = String.format("%smy-course-detail/%s?gradeId=%s&orderGoodsId=%s&skipPort=%s", domain, vo.getGoodsId(), vo.getGradeId(), vo.getOrderGoodsId(), nowTime);
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//H5
|
|
|
- if (goods.getGoodsType() == 2){
|
|
|
+ if (goods.getGoodsType() == 2) {
|
|
|
//题库
|
|
|
- url = String.format("%s/pages/questionBank/index&skipPort=%s",domainH5,nowTime);
|
|
|
- }else if (goods.getGoodsType() == 6){
|
|
|
+ url = String.format("%s/pages/questionBank/index&skipPort=%s", domainH5, nowTime);
|
|
|
+ } else if (goods.getGoodsType() == 6) {
|
|
|
//直播
|
|
|
url = String.format("%s/pages3/live/detail?orderGoodsId=%s&goodsId=%s&gradeId=0&courseId=%s&skipPort=%s",
|
|
|
- domainH5,vo.getOrderGoodsId(),vo.getGoodsId(),courseId,nowTime);
|
|
|
- }else {
|
|
|
+ domainH5, vo.getOrderGoodsId(), vo.getGoodsId(), courseId, nowTime);
|
|
|
+ } else {
|
|
|
//视频
|
|
|
url = String.format("%s/pages3/polyv/detail?id=%s&goodsId=%s&orderGoodsId=%s&gradeId=%s&skipPort=%s",
|
|
|
- domainH5,courseId,vo.getGoodsId(),vo.getOrderGoodsId(),vo.getGradeId(),nowTime);
|
|
|
+ domainH5, courseId, vo.getGoodsId(), vo.getOrderGoodsId(), vo.getGradeId(), nowTime);
|
|
|
}
|
|
|
}
|
|
|
UserPhoneBo phoneBo = new UserPhoneBo();
|
|
|
phoneBo.setTelphone(user.getTelphone());
|
|
|
phoneBo.setTenantId(bo.getTenantId());
|
|
|
//缓存用户手机号码 30分钟失效
|
|
|
- redisCache.setCacheObject(nowTime.toString(), JSONObject.toJSONString(phoneBo),30, TimeUnit.MINUTES);
|
|
|
+ redisCache.setCacheObjectTenant(nowTime.toString(), JSONObject.toJSONString(phoneBo), 30, TimeUnit.MINUTES);
|
|
|
return url;
|
|
|
}
|
|
|
|
|
|
+// @Override
|
|
|
+// public boolean goodsBatchCopyTenant(GoodsBatchCopyTenantBo bo) {
|
|
|
+// //获取商品信息
|
|
|
+// List<Goods> goodsList = list(new LambdaQueryWrapper<Goods>()
|
|
|
+// .in(CollectionUtils.isNotEmpty(bo.getGoodsIds()), Goods::getGoodsId, bo.getGoodsIds()));
|
|
|
+// if (CollectionUtils.isEmpty(goodsList)){
|
|
|
+// return true;
|
|
|
+// }
|
|
|
+// Long tenantId = 867735392558919680L;
|
|
|
+// Long newTenantId = bo.getTenantId();
|
|
|
+// List<Goods> oldGoodsList = goodsList.stream().map(x -> BeanUtil.toBean(x, Goods.class)).collect(Collectors.toList());
|
|
|
+// for (Goods goods : goodsList) {
|
|
|
+// goods.setGoodsId(null);
|
|
|
+// goods.setTeacherId(newTenantId);
|
|
|
+// //供应方ID
|
|
|
+// if (ObjectUtil.isNotNull(goods.getSupplyId())){
|
|
|
+// PaySupply supply = iPaySupplyService.getById(goods.getSupplyId());
|
|
|
+// if (ObjectUtils.isNotNull(supply)){
|
|
|
+// //新机构是否存在
|
|
|
+// PaySupply newSupply = iPaySupplyService.getSupplyByTenant(supply.getSupplyName(),newTenantId);
|
|
|
+// if (ObjectUtil.isNotNull(newSupply)){
|
|
|
+// goods.setSupplyId(newSupply.getSupplyId());
|
|
|
+// }else {
|
|
|
+// supply.setSupplyId(null);
|
|
|
+// supply.setTenantId(newTenantId);
|
|
|
+// iPaySupplyService.save(supply);
|
|
|
+// goods.setSupplyId(supply.getSupplyId());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// //教育类型
|
|
|
+// if (ObjectUtil.isNotNull(goods.getEducationTypeId())){
|
|
|
+// CourseEducationType type = iCourseEducationTypeService.getById(goods.getEducationTypeId());
|
|
|
+// if (ObjectUtil.isNotNull(type)){
|
|
|
+// CourseEducationType newType = iCourseEducationTypeService.getEducationTypeBytenant(type.getEncoder(),newTenantId);
|
|
|
+// if (ObjectUtil.isNotNull(newType)){
|
|
|
+// goods.setEducationTypeId(newType.getId());
|
|
|
+// }else {
|
|
|
+// type.setId(null);
|
|
|
+// type.setTenantId(newTenantId);
|
|
|
+// iCourseEducationTypeService.save(type);
|
|
|
+// goods.setEducationTypeId(type.getId());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// //业务层次
|
|
|
+// if (ObjectUtil.isNotNull(goods.getBusinessId())){
|
|
|
+// CourseBusiness business = iCourseBusinessService.getById(goods.getBusinessId());
|
|
|
+// if (ObjectUtil.isNotNull(business)){
|
|
|
+// CourseBusiness newBusiness = iCourseBusinessService.getBusinessByTenant(business.getEncoder(),newTenantId);
|
|
|
+// if (ObjectUtil.isNotNull(newBusiness)){
|
|
|
+// goods.setBusinessId(newBusiness.getId());
|
|
|
+// }else {
|
|
|
+// business.setId(null);
|
|
|
+// business.setTenantId(newTenantId);
|
|
|
+// iCourseBusinessService.save(business);
|
|
|
+// goods.setBusinessId(business.getId());
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// //所属院校
|
|
|
+// if (ObjectUtil.isNotNull(goods.getSchoolId())){
|
|
|
+// School school = iSchoolService.getById(goods.getSchoolId());
|
|
|
+// if (ObjectUtil.isNotNull(school)){
|
|
|
+// School newSchool = iSchoolService.getSchoolByTenant(school.getEncoder(),newTenantId);
|
|
|
+// if (ObjectUtil.isNotNull(newSchool)){
|
|
|
+// goods.setBusinessId(newSchool.getId());
|
|
|
+// }else {
|
|
|
+// school.setId(null);
|
|
|
+// school.setTenantId(newTenantId);
|
|
|
+// iSchoolService.save(school);
|
|
|
+// goods.setBusinessId(school.getId());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// //所属专业
|
|
|
+// if (ObjectUtil.isNotNull(goods.getMajorId())){
|
|
|
+// Major major = iMajorService.getById(goods.getMajorId());
|
|
|
+// if (ObjectUtil.isNotNull(major)){
|
|
|
+// Major newMajor = iMajorService.getMajorByTenant(major.getEncoder(),newTenantId);
|
|
|
+// if (ObjectUtil.isNotNull(newMajor)){
|
|
|
+// goods.setMajorId(newMajor.getId());
|
|
|
+// }else {
|
|
|
+// major.setId(null);
|
|
|
+// major.setTenantId(newTenantId);
|
|
|
+// iMajorService.save(major);
|
|
|
+// goods.setBusinessId(major.getId());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// //项目
|
|
|
+// if (ObjectUtil.isNotNull(goods.getProjectId())){
|
|
|
+// CourseProjectType project = iCourseProjectTypeService.getById(goods.getProjectId());
|
|
|
+// if (ObjectUtil.isNotNull(project)){
|
|
|
+// CourseProjectType newProject = iCourseProjectTypeService.getProjectByTenant(project.getEncoder(),newTenantId);
|
|
|
+// if (ObjectUtil.isNotNull(newProject)){
|
|
|
+// goods.setMajorId(newProject.getId());
|
|
|
+// }else {
|
|
|
+// project.setId(null);
|
|
|
+// project.setTenantId(newTenantId);
|
|
|
+// iCourseProjectTypeService.save(project);
|
|
|
+// goods.setBusinessId(project.getId());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public boolean goodsBatchCopyTenant(GoodsBatchCopyTenantBo bo) {
|
|
|
- //获取商品信息
|
|
|
- List<Goods> goodsList = list(new LambdaQueryWrapper<Goods>()
|
|
|
- .in(CollectionUtils.isNotEmpty(bo.getGoodsIds()), Goods::getGoodsId, bo.getGoodsIds()));
|
|
|
+ String tenantId = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
+ Long newTenantId = bo.getTenantId();
|
|
|
+ List<SysGoodsCopyRecord> copyRecordList = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(bo.getGoodsIds())) {
|
|
|
+ //增量
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ //全量同步
|
|
|
+ // 1 goods
|
|
|
+ List<Goods> goodsList = list();
|
|
|
if (CollectionUtils.isEmpty(goodsList)){
|
|
|
return true;
|
|
|
}
|
|
|
- Long tenantId = 867735392558919680L;
|
|
|
- Long newTenantId = bo.getTenantId();
|
|
|
- List<Goods> oldGoodsList = goodsList.stream().map(x -> BeanUtil.toBean(x, Goods.class)).collect(Collectors.toList());
|
|
|
+ List<Goods> newGoodsList = goodsList.stream().map(x -> {
|
|
|
+ Goods goods = BeanUtil.toBean(x, Goods.class);
|
|
|
+ goods.setGoodsId(null);
|
|
|
+ goods.setTenantId(newTenantId);
|
|
|
+ return goods;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ saveBatch(newGoodsList);
|
|
|
+ //记录
|
|
|
+ newGoodsList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.GOODS.getType());
|
|
|
+ record.setNewId(item.getGoodsId());
|
|
|
+ Goods goods = goodsList.stream().filter(x -> x.getCode().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(goods)){
|
|
|
+ record.setOldId(goods.getGoodsId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+
|
|
|
+ //2 商品规格
|
|
|
+ List<GoodsSpec> goodsSpecList = goodsSpecService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(goodsSpecList)){
|
|
|
+ List<GoodsSpec> newGoodsSpecList = goodsSpecList.stream().map(x -> {
|
|
|
+ GoodsSpec goodsSpec = BeanUtil.toBean(x, GoodsSpec.class);
|
|
|
+ goodsSpec.setSpecId(null);
|
|
|
+ goodsSpec.setTenantId(newTenantId);
|
|
|
+ return goodsSpec;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ goodsSpecService.saveBatch(newGoodsSpecList);
|
|
|
+ //记录
|
|
|
+ newGoodsSpecList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.GOODS_SPEC.getType());
|
|
|
+ record.setNewId(item.getSpecId());
|
|
|
+ GoodsSpec spec = goodsSpecList.stream().filter(x -> x.getName().equals(item.getName()) && x.getCreateTime().equals(item.getCreateTime())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(spec)){
|
|
|
+ record.setOldId(spec.getSpecId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //3 规格模板
|
|
|
+ List<GoodsSpecTemplate> specTemplateList = goodsSpecTemplateService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(specTemplateList)){
|
|
|
+ List<GoodsSpecTemplate> newSpecTemplateList = specTemplateList.stream().map(x -> {
|
|
|
+ GoodsSpecTemplate specTemplate = BeanUtil.toBean(x, GoodsSpecTemplate.class);
|
|
|
+ specTemplate.setSpecTemplateId(null);
|
|
|
+ specTemplate.setTenantId(newTenantId);
|
|
|
+ return specTemplate;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ goodsSpecTemplateService.saveBatch(newSpecTemplateList);
|
|
|
+ //记录
|
|
|
+ newSpecTemplateList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType());
|
|
|
+ record.setNewId(item.getSpecTemplateId());
|
|
|
+ GoodsSpecTemplate template = specTemplateList.stream().filter(x -> x.getName().equals(item.getName()) && x.getCreateTime().equals(item.getCreateTime())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(template)){
|
|
|
+ record.setOldId(template.getSpecTemplateId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //4 规格属性
|
|
|
+ List<GoodsSpecAttribute> attributeList = goodsSpecAttributeService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(attributeList)){
|
|
|
+ List<GoodsSpecAttribute> newAttributeList = attributeList.stream().map(x -> {
|
|
|
+ GoodsSpecAttribute attribute = BeanUtil.toBean(x, GoodsSpecAttribute.class);
|
|
|
+ attribute.setSpecAttributeId(null);
|
|
|
+ attribute.setTenantId(newTenantId);
|
|
|
+ return attribute;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ goodsSpecAttributeService.saveBatch(newAttributeList);
|
|
|
+ //记录
|
|
|
+ newAttributeList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.GOODS_SPEC_ATTRIBUTE.getType());
|
|
|
+ record.setNewId(item.getSpecAttributeId());
|
|
|
+ GoodsSpecAttribute attribute = attributeList.stream().filter(x -> x.getName().equals(item.getName()) && x.getCreateTime().equals(item.getCreateTime())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(attribute)){
|
|
|
+ record.setOldId(attribute.getSpecAttributeId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //5 规格属性关联
|
|
|
+ List<GoodsSpecAttributeRelation> attributeRelationList = goodsSpecAttributeRelationService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(attributeRelationList)){
|
|
|
+ List<GoodsSpecAttributeRelation> newAttributeRelationList = attributeRelationList.stream().map(x -> {
|
|
|
+ GoodsSpecAttributeRelation relation = BeanUtil.toBean(x, GoodsSpecAttributeRelation.class);
|
|
|
+ relation.setId(null);
|
|
|
+ relation.setTenantId(newTenantId);
|
|
|
+ return relation;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ goodsSpecAttributeRelationService.saveBatch(newAttributeRelationList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //6 商品课程关联
|
|
|
+ List<GoodsCourse> goodsCourseList = iGoodsCourseService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(goodsCourseList)){
|
|
|
+ List<GoodsCourse> newGoodsCourseList = goodsCourseList.stream().map(x -> {
|
|
|
+ GoodsCourse goodsCourse = BeanUtil.toBean(x, GoodsCourse.class);
|
|
|
+ goodsCourse.setId(null);
|
|
|
+ goodsCourse.setTenantId(newTenantId);
|
|
|
+ return goodsCourse;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iGoodsCourseService.saveBatch(newGoodsCourseList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //7 课程老师关联
|
|
|
+ List<GoodsCourseTeacher> teacherList = goodsCourseTeacherService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(teacherList)){
|
|
|
+ List<GoodsCourseTeacher> newTeacherList = teacherList.stream().map(x -> {
|
|
|
+ GoodsCourseTeacher courseTeacher = BeanUtil.toBean(x, GoodsCourseTeacher.class);
|
|
|
+ courseTeacher.setId(null);
|
|
|
+ courseTeacher.setTenantId(newTenantId);
|
|
|
+ return courseTeacher;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ goodsCourseTeacherService.saveBatch(newTeacherList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //8 课程
|
|
|
+ List<Course> courseList = iCourseService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(courseList)){
|
|
|
+ List<Course> newCourseList = courseList.stream().map(x -> {
|
|
|
+ Course course = BeanUtil.toBean(x, Course.class);
|
|
|
+ course.setCourseId(null);
|
|
|
+ course.setTenantId(newTenantId);
|
|
|
+ return course;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iCourseService.saveBatch(newCourseList);
|
|
|
+ //记录
|
|
|
+ newCourseList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.COURSE.getType());
|
|
|
+ record.setNewId(item.getCourseId());
|
|
|
+ Course course = courseList.stream().filter(x -> x.getCode().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(course)){
|
|
|
+ record.setOldId(course.getCourseId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //9 业务层次
|
|
|
+ List<CourseBusiness> businessList = iCourseBusinessService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(businessList)){
|
|
|
+ List<CourseBusiness> newBusinessList = businessList.stream().map(x -> {
|
|
|
+ CourseBusiness business = BeanUtil.toBean(x, CourseBusiness.class);
|
|
|
+ business.setId(null);
|
|
|
+ business.setTenantId(newTenantId);
|
|
|
+ return business;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iCourseBusinessService.saveBatch(newBusinessList);
|
|
|
+ //记录
|
|
|
+ newBusinessList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.COURSE_BUSINESS.getType());
|
|
|
+ record.setNewId(item.getId());
|
|
|
+ CourseBusiness business = businessList.stream().filter(x -> x.getBusinessName().equals(item.getBusinessName()) && x.getCreateTime().equals(item.getCreateTime())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(business)){
|
|
|
+ record.setOldId(business.getId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //10 课程章
|
|
|
+ List<CourseChapter> chapterList = iCourseChapterService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(chapterList)){
|
|
|
+ List<CourseChapter> newChapterList = chapterList.stream().map(x -> {
|
|
|
+ CourseChapter courseChapter = BeanUtil.toBean(x, CourseChapter.class);
|
|
|
+ courseChapter.setChapterId(null);
|
|
|
+ courseChapter.setTenantId(newTenantId);
|
|
|
+ return courseChapter;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iCourseChapterService.saveBatch(newChapterList);
|
|
|
+ //记录
|
|
|
+ newChapterList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.COURSE_CHAPTER.getType());
|
|
|
+ record.setNewId(item.getChapterId());
|
|
|
+ CourseChapter chapter = chapterList.stream().filter(x -> x.getCode().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(chapter)){
|
|
|
+ record.setOldId(chapter.getChapterId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //11 课程章业务层次关联
|
|
|
+ List<CourseChapterBusiness> chapterBusinesseList = iCourseChapterBusinessService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(chapterBusinesseList)){
|
|
|
+ List<CourseChapterBusiness> newChapterBusinesseList = chapterBusinesseList.stream().map(x -> {
|
|
|
+ CourseChapterBusiness courseChapterBusiness = BeanUtil.toBean(x, CourseChapterBusiness.class);
|
|
|
+ courseChapterBusiness.setId(null);
|
|
|
+ courseChapterBusiness.setTenantId(newTenantId);
|
|
|
+ return courseChapterBusiness;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iCourseChapterBusinessService.saveBatch(newChapterBusinesseList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //12 课程章节关联
|
|
|
+ List<CourseChapterSection> chapterSectionList = iCourseChapterSectionService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(chapterSectionList)){
|
|
|
+ List<CourseChapterSection> newChapterSectionList = chapterSectionList.stream().map(x -> {
|
|
|
+ CourseChapterSection courseChapterSection = BeanUtil.toBean(x, CourseChapterSection.class);
|
|
|
+ courseChapterSection.setId(null);
|
|
|
+ courseChapterSection.setTenantId(newTenantId);
|
|
|
+ return courseChapterSection;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iCourseChapterSectionService.saveBatch(newChapterSectionList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //13 教育类型关联
|
|
|
+ List<CourseEducationTier> educationTiers = iCourseEducationTierService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(educationTiers)){
|
|
|
+ List<CourseEducationTier> newEducationTiers = educationTiers.stream().map(x -> {
|
|
|
+ CourseEducationTier courseEducationTier = BeanUtil.toBean(x, CourseEducationTier.class);
|
|
|
+ courseEducationTier.setId(null);
|
|
|
+ courseEducationTier.setTenantId(newTenantId);
|
|
|
+ return courseEducationTier;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iCourseEducationTierService.saveBatch(newEducationTiers);
|
|
|
+ }
|
|
|
+
|
|
|
+ //14 教育类型
|
|
|
+ List<CourseEducationType> educationTypeList = iCourseEducationTypeService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(educationTypeList)){
|
|
|
+ List<CourseEducationType> newEducationTypeList = educationTypeList.stream().map(x -> {
|
|
|
+ CourseEducationType educationType = BeanUtil.toBean(x, CourseEducationType.class);
|
|
|
+ educationType.setId(null);
|
|
|
+ educationType.setTenantId(newTenantId);
|
|
|
+ return educationType;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iCourseEducationTypeService.saveBatch(newEducationTypeList);
|
|
|
+ //记录
|
|
|
+ newEducationTypeList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType());
|
|
|
+ record.setNewId(item.getId());
|
|
|
+ CourseEducationType educationType = educationTypeList.stream().filter(x -> x.getEncoder().equals(item.getEncoder())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(educationType)){
|
|
|
+ record.setOldId(educationType.getId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //15 课程讲义
|
|
|
+ List<CourseHandouts> handoutsList = iCourseHandoutsService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(handoutsList)){
|
|
|
+ List<CourseHandouts> newHandoutsList = handoutsList.stream().map(x -> {
|
|
|
+ CourseHandouts handouts = BeanUtil.toBean(x, CourseHandouts.class);
|
|
|
+ handouts.setHandoutsId(null);
|
|
|
+ handouts.setTenantId(newTenantId);
|
|
|
+ return handouts;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iCourseHandoutsService.saveBatch(newHandoutsList);
|
|
|
+ //记录
|
|
|
+ newHandoutsList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.COURSE_HANDOUTS.getType());
|
|
|
+ record.setNewId(item.getHandoutsId());
|
|
|
+ CourseHandouts handouts = handoutsList.stream().filter(x -> x.getEncoder().equals(item.getEncoder())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(handouts)){
|
|
|
+ record.setOldId(handouts.getHandoutsId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //16 讲义业务层次关联
|
|
|
+ List<CourseHandoutsBusiness> handoutsBusinessList = iCourseHandoutsBusinessService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(handoutsBusinessList)){
|
|
|
+ List<CourseHandoutsBusiness> newHandoutsBusinessList = handoutsBusinessList.stream().map(x -> {
|
|
|
+ CourseHandoutsBusiness handoutsBusiness = BeanUtil.toBean(x, CourseHandoutsBusiness.class);
|
|
|
+ handoutsBusiness.setId(null);
|
|
|
+ handoutsBusiness.setTenantId(newTenantId);
|
|
|
+ return handoutsBusiness;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iCourseHandoutsBusinessService.saveBatch(newHandoutsBusinessList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //17 课程目录关联
|
|
|
+ List<CourseMenu> courseMenuList = iCourseMenuService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(courseMenuList)){
|
|
|
+ List<CourseMenu> newCourseMenuList = courseMenuList.stream().map(x -> {
|
|
|
+ CourseMenu courseMenu = BeanUtil.toBean(x, CourseMenu.class);
|
|
|
+ courseMenu.setId(null);
|
|
|
+ courseMenu.setTenantId(newTenantId);
|
|
|
+ return courseMenu;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iCourseMenuService.saveBatch(newCourseMenuList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //18 课程目录试卷关联 course_menu_exam
|
|
|
+ List<CourseMenuExam> menuExamList = iCourseMenuExamService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(menuExamList)){
|
|
|
+ List<CourseMenuExam> newMenuExamList = menuExamList.stream().map(x -> {
|
|
|
+ CourseMenuExam menuExam = BeanUtil.toBean(x, CourseMenuExam.class);
|
|
|
+ menuExam.setId(null);
|
|
|
+ menuExam.setTenantId(newTenantId);
|
|
|
+ return menuExam;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iCourseMenuExamService.saveBatch(newMenuExamList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //19 课程模块
|
|
|
+ List<CourseModule> moduleList = iCourseModuleService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(moduleList)){
|
|
|
+ List<CourseModule> newModuleList = moduleList.stream().map(x -> {
|
|
|
+ CourseModule module = BeanUtil.toBean(x, CourseModule.class);
|
|
|
+ module.setModuleId(null);
|
|
|
+ module.setTenantId(newTenantId);
|
|
|
+ return module;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iCourseModuleService.saveBatch(newModuleList);
|
|
|
+ //记录
|
|
|
+ newModuleList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.COURSE_MODULE.getType());
|
|
|
+ record.setNewId(item.getModuleId());
|
|
|
+ CourseModule courseModule = moduleList.stream().filter(x -> x.getCode().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(courseModule)){
|
|
|
+ record.setOldId(courseModule.getModuleId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //20 课程模块业务关联
|
|
|
+ List<CourseModuleBusiness> moduleBusinessList = iCourseModuleBusinessService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(moduleBusinessList)){
|
|
|
+ List<CourseModuleBusiness> newModuleBusinessList = moduleBusinessList.stream().map(x -> {
|
|
|
+ CourseModuleBusiness moduleBusiness = BeanUtil.toBean(x, CourseModuleBusiness.class);
|
|
|
+ moduleBusiness.setId(null);
|
|
|
+ moduleBusiness.setTenantId(newTenantId);
|
|
|
+ return moduleBusiness;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iCourseModuleBusinessService.saveBatch(newModuleBusinessList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //21 课程模块章关联
|
|
|
+ List<CourseModuleChapter> moduleChapterList = iCourseModuleChapterService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(moduleChapterList)){
|
|
|
+ List<CourseModuleChapter> newModuleChapterList = moduleChapterList.stream().map(x -> {
|
|
|
+ CourseModuleChapter moduleChapter = BeanUtil.toBean(x, CourseModuleChapter.class);
|
|
|
+ moduleChapter.setId(null);
|
|
|
+ moduleChapter.setTenantId(newTenantId);
|
|
|
+ return moduleChapter;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iCourseModuleChapterService.saveBatch(newModuleChapterList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //22 课程项目
|
|
|
+ List<CourseProjectType> projectTypeList = iCourseProjectTypeService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(projectTypeList)){
|
|
|
+ List<CourseProjectType> newProjectTypeList = projectTypeList.stream().map(x -> {
|
|
|
+ CourseProjectType projectType = BeanUtil.toBean(x, CourseProjectType.class);
|
|
|
+ projectType.setId(null);
|
|
|
+ projectType.setTenantId(newTenantId);
|
|
|
+ return projectType;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iCourseProjectTypeService.saveBatch(newProjectTypeList);
|
|
|
+ //记录
|
|
|
+ newProjectTypeList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.COURSE_PROJECT_TYPE.getType());
|
|
|
+ record.setNewId(item.getId());
|
|
|
+ CourseProjectType projectType = projectTypeList.stream().filter(x -> x.getEncoder().equals(item.getEncoder())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(projectType)){
|
|
|
+ record.setOldId(projectType.getId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //23 课程节
|
|
|
+ List<CourseSection> sectionList = iCourseSectionService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(sectionList)){
|
|
|
+ List<CourseSection> newSectionList = sectionList.stream().map(x -> {
|
|
|
+ CourseSection section = BeanUtil.toBean(x, CourseSection.class);
|
|
|
+ section.setSectionId(null);
|
|
|
+ section.setTenantId(newTenantId);
|
|
|
+ return section;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iCourseSectionService.saveBatch(newSectionList);
|
|
|
+ //记录
|
|
|
+ newSectionList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.COURSE_SECTION.getType());
|
|
|
+ record.setNewId(item.getSectionId());
|
|
|
+ CourseSection courseSection = sectionList.stream().filter(x -> x.getCode().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(courseSection)){
|
|
|
+ record.setOldId(courseSection.getSectionId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //24 课程节业务关联
|
|
|
+ List<CourseSectionBusiness> sectionBusinessList = iCourseSectionBusinessService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(sectionBusinessList)){
|
|
|
+ List<CourseSectionBusiness> newSectionBusinessList = sectionBusinessList.stream().map(x -> {
|
|
|
+ CourseSectionBusiness sectionBusiness = BeanUtil.toBean(x, CourseSectionBusiness.class);
|
|
|
+ sectionBusiness.setId(null);
|
|
|
+ sectionBusiness.setTenantId(newTenantId);
|
|
|
+ return sectionBusiness;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iCourseSectionBusinessService.saveBatch(newSectionBusinessList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //25 课程节观看权限关联
|
|
|
+ List<CourseSectionWatchPer> sectionWatchPerList = iCourseSectionWatchPerService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(sectionWatchPerList)){
|
|
|
+ List<CourseSectionWatchPer> newSectionWatchPerList = sectionWatchPerList.stream().map(x -> {
|
|
|
+ CourseSectionWatchPer sectionWatchPer = BeanUtil.toBean(x, CourseSectionWatchPer.class);
|
|
|
+ sectionWatchPer.setId(null);
|
|
|
+ sectionWatchPer.setTenantId(newTenantId);
|
|
|
+ return sectionWatchPer;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iCourseSectionWatchPerService.saveBatch(newSectionWatchPerList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //26 课程科目
|
|
|
+ List<CourseSubject> subjectList = iCourseSubjectService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(subjectList)){
|
|
|
+ List<CourseSubject> newSubjectList = subjectList.stream().map(x -> {
|
|
|
+ CourseSubject subject = BeanUtil.toBean(x, CourseSubject.class);
|
|
|
+ subject.setId(null);
|
|
|
+ subject.setTenantId(newTenantId);
|
|
|
+ return subject;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iCourseSubjectService.saveBatch(newSubjectList);
|
|
|
+ //记录
|
|
|
+ newSubjectList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.COURSE_SUBJECT.getType());
|
|
|
+ record.setNewId(item.getId());
|
|
|
+ CourseSubject courseSubject = subjectList.stream().filter(x -> x.getEncoder().equals(item.getEncoder())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(courseSubject)){
|
|
|
+ record.setOldId(courseSubject.getId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //27 课程科目项目关联
|
|
|
+ List<CourseSubjectProject> subjectProjectList = iCourseSubjectProjectService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(subjectProjectList)){
|
|
|
+ List<CourseSubjectProject> newSubjectProjectList = subjectProjectList.stream().map(x -> {
|
|
|
+ CourseSubjectProject subjectProject = BeanUtil.toBean(x, CourseSubjectProject.class);
|
|
|
+ subjectProject.setId(null);
|
|
|
+ subjectProject.setTenantId(newTenantId);
|
|
|
+ return subjectProject;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iCourseSubjectProjectService.saveBatch(newSubjectProjectList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //28 试卷
|
|
|
+ List<Exam> examList = iExamService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(examList)){
|
|
|
+ List<Exam> newExamList = examList.stream().map(x -> {
|
|
|
+ Exam exam = BeanUtil.toBean(x, Exam.class);
|
|
|
+ exam.setExamId(null);
|
|
|
+ exam.setTenantId(newTenantId);
|
|
|
+ return exam;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iExamService.saveBatch(newExamList);
|
|
|
+ //记录
|
|
|
+ newExamList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.EXAM.getType());
|
|
|
+ record.setNewId(item.getExamId());
|
|
|
+ Exam exam = examList.stream().filter(x -> x.getCode().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(exam)){
|
|
|
+ record.setOldId(exam.getExamId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //29 试卷类型
|
|
|
+ List<ExamPaper> examPaperList = iExamPaperService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(examPaperList)){
|
|
|
+ List<ExamPaper> newExamPaperList = examPaperList.stream().map(x -> {
|
|
|
+ ExamPaper examPaper = BeanUtil.toBean(x, ExamPaper.class);
|
|
|
+ examPaper.setPaperId(null);
|
|
|
+ examPaper.setTenantId(newTenantId);
|
|
|
+ return examPaper;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iExamPaperService.saveBatch(newExamPaperList);
|
|
|
+ //记录
|
|
|
+ newExamPaperList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.EXAM_PAPER.getType());
|
|
|
+ record.setNewId(item.getPaperId());
|
|
|
+ ExamPaper examPaper = examPaperList.stream().filter(x -> x.getPaperName().equals(item.getPaperName()) && x.getCreateTime().equals(item.getCreateTime())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(examPaper)){
|
|
|
+ record.setOldId(examPaper.getPaperId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //30 试卷题目关联
|
|
|
+ List<ExamQuestion> examQuestionList = iExamQuestionService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(examQuestionList)){
|
|
|
+ List<ExamQuestion> newExamQuestionList = examQuestionList.stream().map(x -> {
|
|
|
+ ExamQuestion examQuestion = BeanUtil.toBean(x, ExamQuestion.class);
|
|
|
+ examQuestion.setId(null);
|
|
|
+ examQuestion.setTenantId(newTenantId);
|
|
|
+ return examQuestion;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iExamQuestionService.saveBatch(newExamQuestionList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //31 专业
|
|
|
+ List<Major> majorList = iMajorService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(majorList)){
|
|
|
+ List<Major> newMajorList = majorList.stream().map(x -> {
|
|
|
+ Major major = BeanUtil.toBean(x, Major.class);
|
|
|
+ major.setId(null);
|
|
|
+ major.setTenantId(newTenantId);
|
|
|
+ return major;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iMajorService.saveBatch(newMajorList);
|
|
|
+ //记录
|
|
|
+ newMajorList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.MAJOR.getType());
|
|
|
+ record.setNewId(item.getId());
|
|
|
+ Major major = majorList.stream().filter(x -> x.getEncoder().equals(item.getEncoder())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(major)){
|
|
|
+ record.setOldId(major.getId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //32 专业项目关联
|
|
|
+ List<MajorProject> majorProjectList = iMajorProjectService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(majorProjectList)){
|
|
|
+ List<MajorProject> newMajorProjectList = majorProjectList.stream().map(x -> {
|
|
|
+ MajorProject majorProject = BeanUtil.toBean(x, MajorProject.class);
|
|
|
+ majorProject.setId(null);
|
|
|
+ majorProject.setTenantId(newTenantId);
|
|
|
+ return majorProject;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iMajorProjectService.saveBatch(newMajorProjectList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //33 服务
|
|
|
+ List<PayServe> serveList = iPayServeService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(serveList)){
|
|
|
+ List<PayServe> newServeList = serveList.stream().map(x -> {
|
|
|
+ PayServe serve = BeanUtil.toBean(x, PayServe.class);
|
|
|
+ serve.setServeId(null);
|
|
|
+ serve.setTenantId(newTenantId);
|
|
|
+ return serve;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iPayServeService.saveBatch(newServeList);
|
|
|
+ //记录
|
|
|
+ newServeList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.PAY_SERVE.getType());
|
|
|
+ record.setNewId(item.getServeId());
|
|
|
+ PayServe payServe = serveList.stream().filter(x -> x.getServeName().equals(item.getServeName()) && x.getCreateTime().equals(item.getCreateTime())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(payServe)){
|
|
|
+ record.setOldId(payServe.getServeId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //34 服务供应
|
|
|
+ List<PaySupply> paySup = iPaySupplyService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(paySup)){
|
|
|
+ List<PaySupply> newPaySup = paySup.stream().map(x -> {
|
|
|
+ PaySupply supply = BeanUtil.toBean(x, PaySupply.class);
|
|
|
+ supply.setSupplyId(null);
|
|
|
+ supply.setTenantId(newTenantId);
|
|
|
+ return supply;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iPaySupplyService.saveBatch(newPaySup);
|
|
|
+ //记录
|
|
|
+ newPaySup.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.PAY_SUPPLY.getType());
|
|
|
+ record.setNewId(item.getSupplyId());
|
|
|
+ PaySupply sup = paySup.stream().filter(x -> x.getSupplyName().equals(item.getSupplyName()) && x.getCreateTime().equals(item.getCreateTime())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(sup)){
|
|
|
+ record.setOldId(sup.getSupplyId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //35 课程流
|
|
|
+ List<CourseStreaming> streamingList = iCourseStreamingService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(streamingList)){
|
|
|
+ List<CourseStreaming> newStreamingList = streamingList.stream().map(x -> {
|
|
|
+ CourseStreaming streaming = BeanUtil.toBean(x, CourseStreaming.class);
|
|
|
+ streaming.setId(null);
|
|
|
+ streaming.setTenantId(newTenantId);
|
|
|
+ return streaming;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iCourseStreamingService.saveBatch(newStreamingList);
|
|
|
+ //记录
|
|
|
+ newStreamingList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.COURSE_STREAMING.getType());
|
|
|
+ record.setNewId(item.getId());
|
|
|
+ CourseStreaming streaming = streamingList.stream().filter(x -> x.getCode().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(streaming)){
|
|
|
+ record.setOldId(streaming.getId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //36 课程流业务层次
|
|
|
+ List<CourseStreamingBusiness> streamingBusinessList = iCourseStreamingBusinessService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(streamingBusinessList)){
|
|
|
+ List<CourseStreamingBusiness> newStreamingBusinessList = streamingBusinessList.stream().map(x -> {
|
|
|
+ CourseStreamingBusiness streamingBusiness = BeanUtil.toBean(x, CourseStreamingBusiness.class);
|
|
|
+ streamingBusiness.setId(null);
|
|
|
+ streamingBusiness.setTenantId(newTenantId);
|
|
|
+ return streamingBusiness;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iCourseStreamingBusinessService.saveBatch(newStreamingBusinessList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //37 保利威资源类型
|
|
|
+ List<PolyvCata> polyvCataList = iPolyvCataService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(polyvCataList)){
|
|
|
+ List<PolyvCata> newPolyvCataList = polyvCataList.stream().map(x -> {
|
|
|
+ PolyvCata cata = BeanUtil.toBean(x, PolyvCata.class);
|
|
|
+ cata.setId(null);
|
|
|
+ cata.setTenantId(newTenantId);
|
|
|
+ return cata;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iPolyvCataService.saveBatch(newPolyvCataList);
|
|
|
+ //记录
|
|
|
+ newPolyvCataList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.POLYV_CATA.getType());
|
|
|
+ record.setNewId(item.getId());
|
|
|
+ PolyvCata cata = polyvCataList.stream().filter(x -> x.getCataname().equals(item.getCataname()) && x.getCreateTime().equals(item.getCreateTime())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(cata)){
|
|
|
+ record.setOldId(cata.getId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //38 保利威视频资源
|
|
|
+ List<PolyvVideo> polyvVideoList = iPolyvVideoService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(polyvVideoList)){
|
|
|
+ List<PolyvVideo> newPolyvVideoList = polyvVideoList.stream().map(x -> {
|
|
|
+ PolyvVideo video = BeanUtil.toBean(x, PolyvVideo.class);
|
|
|
+ video.setPolyvId(null);
|
|
|
+ video.setTenantId(newTenantId);
|
|
|
+ return video;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iPolyvVideoService.saveBatch(newPolyvVideoList);
|
|
|
+ //记录
|
|
|
+ newPolyvVideoList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.POLYV_VIDEO.getType());
|
|
|
+ record.setNewId(item.getPolyvId());
|
|
|
+ PolyvVideo video = polyvVideoList.stream().filter(x -> x.getTitle().equals(item.getTitle()) && x.getCreateTime().equals(item.getCreateTime())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(video)){
|
|
|
+ record.setOldId(video.getPolyvId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //39 资料字段
|
|
|
+ List<ProfileField> fieldList = iProfileFieldService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(fieldList)){
|
|
|
+ List<ProfileField> newFieldList = fieldList.stream().map(x -> {
|
|
|
+ ProfileField field = BeanUtil.toBean(x, ProfileField.class);
|
|
|
+ field.setFieldId(null);
|
|
|
+ field.setTenantId(newTenantId);
|
|
|
+ return field;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iProfileFieldService.saveBatch(newFieldList);
|
|
|
+ //记录
|
|
|
+ newFieldList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.PROFILE_FIELD.getType());
|
|
|
+ record.setNewId(item.getFieldId());
|
|
|
+ ProfileField field = fieldList.stream().filter(x -> x.getFieldName().equals(item.getFieldName()) && x.getCreateTime().equals(item.getCreateTime())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(field)){
|
|
|
+ record.setOldId(field.getFieldId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //40 资料模板
|
|
|
+ List<ProfileTp> fProfileTpList = iProfileTpService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(fProfileTpList)){
|
|
|
+ List<ProfileTp> newFProfileTpList = fProfileTpList.stream().map(x -> {
|
|
|
+ ProfileTp fProfileTp = BeanUtil.toBean(x, ProfileTp.class);
|
|
|
+ fProfileTp.setProfileTpId(null);
|
|
|
+ fProfileTp.setTenantId(newTenantId);
|
|
|
+ return fProfileTp;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iProfileTpService.saveBatch(newFProfileTpList);
|
|
|
+ //记录
|
|
|
+ newFProfileTpList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.PROFILE_TP.getType());
|
|
|
+ record.setNewId(item.getProfileTpId());
|
|
|
+ ProfileTp tp = fProfileTpList.stream().filter(x -> x.getCode().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(tp)){
|
|
|
+ record.setOldId(tp.getProfileTpId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //41 资料模板业务层次关联
|
|
|
+ List<ProfileTpBusiness> tpBusinessList = iProfileTpBusinessService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(tpBusinessList)){
|
|
|
+ List<ProfileTpBusiness> newTpBusinessList = tpBusinessList.stream().map(x -> {
|
|
|
+ ProfileTpBusiness tpBusiness = BeanUtil.toBean(x, ProfileTpBusiness.class);
|
|
|
+ tpBusiness.setId(null);
|
|
|
+ tpBusiness.setTenantId(newTenantId);
|
|
|
+ return tpBusiness;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iProfileTpBusinessService.saveBatch(newTpBusinessList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //42 题目
|
|
|
+ List<Question> questionList = iQuestionService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(questionList)){
|
|
|
+ List<Question> newQuestionList = questionList.stream().map(x -> {
|
|
|
+ Question question = BeanUtil.toBean(x, Question.class);
|
|
|
+ question.setQuestionId(null);
|
|
|
+ question.setTenantId(newTenantId);
|
|
|
+ return question;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iQuestionService.saveBatch(newQuestionList);
|
|
|
+ //记录
|
|
|
+ newQuestionList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.QUESTION.getType());
|
|
|
+ record.setNewId(item.getQuestionId());
|
|
|
+ Question question = questionList.stream().filter(x -> x.getCode().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(question)){
|
|
|
+ record.setOldId(question.getQuestionId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //43 题目业务层次关联
|
|
|
+ List<QuestionBusiness> questionBusinessList = iQuestionBusinessService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(questionBusinessList)){
|
|
|
+ List<QuestionBusiness> newQuestionBusinessList = questionBusinessList.stream().map(x -> {
|
|
|
+ QuestionBusiness questionBusiness = BeanUtil.toBean(x, QuestionBusiness.class);
|
|
|
+ questionBusiness.setId(null);
|
|
|
+ questionBusiness.setTenantId(newTenantId);
|
|
|
+ return questionBusiness;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iQuestionBusinessService.saveBatch(newQuestionBusinessList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //44 题目章
|
|
|
+ List<QuestionChapter> questionChapterList = iQuestionChapterService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(questionChapterList)){
|
|
|
+ List<QuestionChapter> newQuestionChapterList = questionChapterList.stream().map(x -> {
|
|
|
+ QuestionChapter questionChapter = BeanUtil.toBean(x, QuestionChapter.class);
|
|
|
+ questionChapter.setChapterExamId(null);
|
|
|
+ questionChapter.setTenantId(newTenantId);
|
|
|
+ return questionChapter;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iQuestionChapterService.saveBatch(newQuestionChapterList);
|
|
|
+ //记录
|
|
|
+ newQuestionChapterList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.QUESTION_CHAPTER.getType());
|
|
|
+ record.setNewId(item.getChapterExamId());
|
|
|
+ QuestionChapter questionChapter = questionChapterList.stream().filter(x -> x.getCode().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(questionChapter)){
|
|
|
+ record.setOldId(questionChapter.getChapterExamId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //45 题库章试卷关联
|
|
|
+ List<QuestionChapterExam> questionChapterExamList = iQuestionChapterExamService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(questionChapterExamList)){
|
|
|
+ List<QuestionChapterExam> newQuestionChapterExamList = questionChapterExamList.stream().map(x -> {
|
|
|
+ QuestionChapterExam questionChapterExam = BeanUtil.toBean(x, QuestionChapterExam.class);
|
|
|
+ questionChapterExam.setId(null);
|
|
|
+ questionChapterExam.setTenantId(newTenantId);
|
|
|
+ return questionChapterExam;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iQuestionChapterExamService.saveBatch(newQuestionChapterExamList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //46 题库模块
|
|
|
+ List<QuestionModule> questionModuleList = iQuestionModuleService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(questionModuleList)){
|
|
|
+ List<QuestionModule> newQuestionModuleList = questionModuleList.stream().map(x -> {
|
|
|
+ QuestionModule questionModule = BeanUtil.toBean(x, QuestionModule.class);
|
|
|
+ questionModule.setModuleExamId(null);
|
|
|
+ questionModule.setTenantId(newTenantId);
|
|
|
+ return questionModule;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iQuestionModuleService.saveBatch(newQuestionModuleList);
|
|
|
+ //记录
|
|
|
+ newQuestionModuleList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.QUESTION_MODULE.getType());
|
|
|
+ record.setNewId(item.getModuleExamId());
|
|
|
+ QuestionModule questionModule = questionModuleList.stream().filter(x -> x.getCode().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(questionModule)){
|
|
|
+ record.setOldId(questionModule.getModuleExamId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //47 题库模块章关联
|
|
|
+ List<QuestionModuleChapter> questionModuleChapterList = iQuestionModuleChapterService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(questionModuleChapterList)){
|
|
|
+ List<QuestionModuleChapter> newQuestionModuleChapterList = questionModuleChapterList.stream().map(x -> {
|
|
|
+ QuestionModuleChapter questionModuleChapter = BeanUtil.toBean(x, QuestionModuleChapter.class);
|
|
|
+ questionModuleChapter.setId(null);
|
|
|
+ questionModuleChapter.setTenantId(newTenantId);
|
|
|
+ return questionModuleChapter;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
+ iQuestionModuleChapterService.saveBatch(newQuestionModuleChapterList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //48 证书
|
|
|
+ List<CertificateCommon> certificateCommonList = iCertificateCommonService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(certificateCommonList)){
|
|
|
+ List<CertificateCommon> newCertificateCommonList = certificateCommonList.stream().map(x -> {
|
|
|
+ CertificateCommon common = BeanUtil.toBean(x, CertificateCommon.class);
|
|
|
+ common.setId(null);
|
|
|
+ common.setTenantId(newTenantId);
|
|
|
+ return common;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iCertificateCommonService.saveBatch(newCertificateCommonList);
|
|
|
+ //记录
|
|
|
+ newCertificateCommonList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.CERTIFICATE_COMMON.getType());
|
|
|
+ record.setNewId(item.getId());
|
|
|
+ CertificateCommon common = certificateCommonList.stream().filter(x -> x.getCode().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(common)){
|
|
|
+ record.setOldId(common.getId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //49 证书类型
|
|
|
+ List<Certificate> certificateList = iCertificateService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(certificateList)){
|
|
|
+ List<Certificate> newCertificateList = certificateList.stream().map(x -> {
|
|
|
+ Certificate certificate = BeanUtil.toBean(x, Certificate.class);
|
|
|
+ certificate.setId(null);
|
|
|
+ certificate.setTenantId(newTenantId);
|
|
|
+ return certificate;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iCertificateService.saveBatch(newCertificateList);
|
|
|
+ //记录
|
|
|
+ newCertificateList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.CERTIFICATE.getType());
|
|
|
+ record.setNewId(item.getId());
|
|
|
+ Certificate certificate = certificateList.stream().filter(x -> x.getCode().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(certificate)){
|
|
|
+ record.setOldId(certificate.getId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //50 证书模板
|
|
|
+ List<CertificateTp> certificateTpList = iCertificateTpService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(certificateTpList)){
|
|
|
+ List<CertificateTp> newCertificateTpList = certificateTpList.stream().map(x -> {
|
|
|
+ CertificateTp certificateTp = BeanUtil.toBean(x, CertificateTp.class);
|
|
|
+ certificateTp.setTpId(null);
|
|
|
+ certificateTp.setTenantId(newTenantId);
|
|
|
+ return certificateTp;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iCertificateTpService.saveBatch(newCertificateTpList);
|
|
|
+ //记录
|
|
|
+ newCertificateTpList.forEach(item -> {
|
|
|
+ SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
|
+ record.setType(GoodsCopyEnum.CERTIFICATE_TP.getType());
|
|
|
+ record.setNewId(item.getTpId());
|
|
|
+ CertificateTp certificateTp = certificateTpList.stream().filter(x -> x.getCode().equals(item.getCode())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotNull(certificateTp)){
|
|
|
+ record.setOldId(certificateTp.getTpId());
|
|
|
+ }
|
|
|
+ record.setCreateTime(DateUtils.getNowTime());
|
|
|
+ record.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ record.setTenantId(newTenantId);
|
|
|
+ copyRecordList.add(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //保存记录
|
|
|
+ iSysGoodsCopyRecordService.saveBatch(copyRecordList);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean goodsBatchCopyDisposeTenant() {
|
|
|
+ List<Goods> goodsList = list();
|
|
|
+ if (CollectionUtils.isEmpty(goodsList)){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ //处理关联ID
|
|
|
for (Goods goods : goodsList) {
|
|
|
//供应方ID
|
|
|
- if (ObjectUtil.isNotNull(goods.getSupplyId())){
|
|
|
- PaySupply supply = iPaySupplyService.getById(goods.getSupplyId());
|
|
|
- if (ObjectUtils.isNotNull(supply)){
|
|
|
- //新机构是否存在
|
|
|
- PaySupply newSupply = iPaySupplyService.getSupplyByTenant(supply.getSupplyName(),newTenantId);
|
|
|
- if (ObjectUtil.isNotNull(newSupply)){
|
|
|
- goods.setSupplyId(newSupply.getSupplyId());
|
|
|
- }else {
|
|
|
- supply.setSupplyId(null);
|
|
|
- supply.setTenantId(newTenantId);
|
|
|
- iPaySupplyService.save(supply);
|
|
|
- goods.setSupplyId(supply.getSupplyId());
|
|
|
+ goods.setSupplyId(getNewId(goods.getSupplyId(), GoodsCopyEnum.PAY_SUPPLY.getType()));
|
|
|
+ //教育类型
|
|
|
+ goods.setEducationTypeId(getNewId(goods.getEducationTypeId(), GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType()));
|
|
|
+ //业务层次
|
|
|
+ goods.setBusinessId(getNewId(goods.getBusinessId(), GoodsCopyEnum.COURSE_BUSINESS.getType()));
|
|
|
+ //所属专业
|
|
|
+ goods.setMajorId(getNewId(goods.getMajorId(), GoodsCopyEnum.MAJOR.getType()));
|
|
|
+ //项目
|
|
|
+ if (ObjectUtils.isNotNull(goods.getProjectId())){
|
|
|
+ Long newId = getNewId(goods.getProjectId().longValue(), GoodsCopyEnum.COURSE_PROJECT_TYPE.getType());
|
|
|
+ goods.setProjectId(ObjectUtils.isNull(newId)?null :newId.intValue());
|
|
|
+ }
|
|
|
+ //讲义
|
|
|
+ goods.setHandoutsId(getNewId(goods.getHandoutsId(), GoodsCopyEnum.COURSE_HANDOUTS.getType()));
|
|
|
+ //科目
|
|
|
+ goods.setSubjectIds(getNewIds(goods.getSubjectIds(), GoodsCopyEnum.COURSE_SUBJECT.getType()));
|
|
|
+ //证书类型
|
|
|
+ goods.setCertificateTypeId(getNewId(goods.getCertificateTypeId(), GoodsCopyEnum.CERTIFICATE.getType()));
|
|
|
+ //证书
|
|
|
+ goods.setCertificateId(getNewId(goods.getCertificateId(), GoodsCopyEnum.CERTIFICATE_COMMON.getType()));
|
|
|
+ //证书模板
|
|
|
+ goods.setCertificateTpId(getNewId(goods.getCertificateTpId(), GoodsCopyEnum.CERTIFICATE_TP.getType()));
|
|
|
+ //规格模板
|
|
|
+ goods.setSpecTemplateId(getNewId(goods.getSpecTemplateId(), GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType()));
|
|
|
+ }
|
|
|
+
|
|
|
+ updateBatchById(goodsList);
|
|
|
+
|
|
|
+
|
|
|
+ //2 商品规格
|
|
|
+ List<GoodsSpec> specList = goodsSpecService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(specList)){
|
|
|
+ for (GoodsSpec item : specList) {
|
|
|
+ //规格模板ID
|
|
|
+ item.setSpecTemplateId(getNewId(item.getSpecTemplateId(), GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType()));
|
|
|
+ }
|
|
|
+ goodsSpecService.updateBatchById(specList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //3 规格模板
|
|
|
+ List<GoodsSpecTemplate> specTemplateList = goodsSpecTemplateService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(specTemplateList)){
|
|
|
+ for (GoodsSpecTemplate item : specTemplateList) {
|
|
|
+ //教育类型
|
|
|
+ item.setEducationTypeId(getNewId(item.getEducationTypeId(), GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType()));
|
|
|
+ //业务层次
|
|
|
+ item.setBusinessId(getNewId(item.getBusinessId(), GoodsCopyEnum.COURSE_BUSINESS.getType()));
|
|
|
+ }
|
|
|
+ goodsSpecTemplateService.updateBatchById(specTemplateList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //4 规格属性
|
|
|
+ List<GoodsSpecAttribute> specAttributeList = goodsSpecAttributeService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(specAttributeList)){
|
|
|
+ for (GoodsSpecAttribute item : specAttributeList) {
|
|
|
+ //规格ID
|
|
|
+ item.setSpecId(getNewId(item.getSpecId(), GoodsCopyEnum.GOODS_SPEC.getType()));
|
|
|
+ }
|
|
|
+ goodsSpecAttributeService.updateBatchById(specAttributeList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //5 规格属性关联
|
|
|
+ List<GoodsSpecAttributeRelation> attributeRelationList = goodsSpecAttributeRelationService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(attributeRelationList)){
|
|
|
+ for (GoodsSpecAttributeRelation item : attributeRelationList) {
|
|
|
+ //规格属性IDs
|
|
|
+ item.setSpecAttributeIds(getNewIds(item.getSpecAttributeIds(), GoodsCopyEnum.GOODS_SPEC_ATTRIBUTE.getType()));
|
|
|
+ //商品ID
|
|
|
+ item.setGoodsId(getNewId(item.getGoodsId(),GoodsCopyEnum.GOODS.getType()));
|
|
|
+ //规格模板ID
|
|
|
+ item.setSpecTemplateId(getNewId(item.getSpecTemplateId(),GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType()));
|
|
|
+ }
|
|
|
+ goodsSpecAttributeRelationService.updateBatchById(attributeRelationList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //6 商品课程关联
|
|
|
+ List<GoodsCourse> goodsCourseList = iGoodsCourseService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(goodsCourseList)){
|
|
|
+ for (GoodsCourse item : goodsCourseList) {
|
|
|
+ //商品ID
|
|
|
+ item.setGoodsId(getNewId(item.getGoodsId(), GoodsCopyEnum.GOODS.getType()));
|
|
|
+ //课程ID
|
|
|
+ item.setCourseId(getNewId(item.getCourseId(),GoodsCopyEnum.COURSE.getType()));
|
|
|
+ }
|
|
|
+ iGoodsCourseService.updateBatchById(goodsCourseList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //7 课程老师关联
|
|
|
+ List<GoodsCourseTeacher> courseTeacherList = goodsCourseTeacherService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(courseTeacherList)){
|
|
|
+ for (GoodsCourseTeacher item : courseTeacherList) {
|
|
|
+ //商品ID
|
|
|
+ item.setGoodsId(getNewId(item.getGoodsId(), GoodsCopyEnum.GOODS.getType()));
|
|
|
+ //课程IDS
|
|
|
+ item.setCourseIds(getNewIds(item.getCourseIds(),GoodsCopyEnum.COURSE.getType()));
|
|
|
+ }
|
|
|
+ goodsCourseTeacherService.updateBatchById(courseTeacherList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //8 课程
|
|
|
+ List<Course> courseList = iCourseService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(courseList)){
|
|
|
+ for (Course item : courseList) {
|
|
|
+ //教育类型
|
|
|
+ item.setEducationTypeId(getNewId(item.getEducationTypeId(), GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType()));
|
|
|
+ //业务层次
|
|
|
+ item.setBusinessId(getNewId(item.getBusinessId(), GoodsCopyEnum.COURSE_BUSINESS.getType()));
|
|
|
+ //所属专业
|
|
|
+ item.setMajorId(getNewId(item.getMajorId(), GoodsCopyEnum.MAJOR.getType()));
|
|
|
+ //项目
|
|
|
+ item.setProjectId(getNewId(item.getProjectId(), GoodsCopyEnum.COURSE_PROJECT_TYPE.getType()));
|
|
|
+ //科目
|
|
|
+ item.setSubjectId(getNewId(item.getSubjectId(), GoodsCopyEnum.COURSE_SUBJECT.getType()));
|
|
|
+ }
|
|
|
+ iCourseService.updateBatchById(courseList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //9 业务层次
|
|
|
+ List<CourseBusiness> businessList = iCourseBusinessService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(businessList)){
|
|
|
+ for (CourseBusiness item : businessList) {
|
|
|
+ //项目
|
|
|
+ if (ObjectUtils.isNotNull(item.getProjectId())){
|
|
|
+ Long newId = getNewId(item.getProjectId().longValue(), GoodsCopyEnum.COURSE_PROJECT_TYPE.getType());
|
|
|
+ item.setProjectId(ObjectUtils.isNull(newId)?null:newId.intValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ iCourseBusinessService.updateBatchById(businessList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //10 课程章
|
|
|
+ //11 课程章业务层次关联
|
|
|
+ List<CourseChapterBusiness> courseChapterBusinessList = iCourseChapterBusinessService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(courseChapterBusinessList)){
|
|
|
+ for (CourseChapterBusiness item : courseChapterBusinessList) {
|
|
|
+ //章ID
|
|
|
+ item.setChapterId(getNewId(item.getChapterId(),GoodsCopyEnum.COURSE_CHAPTER.getType()));
|
|
|
+ //教育类型
|
|
|
+ item.setEducationTypeId(getNewId(item.getEducationTypeId(), GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType()));
|
|
|
+ //业务层次
|
|
|
+ item.setBusinessId(getNewId(item.getBusinessId(), GoodsCopyEnum.COURSE_BUSINESS.getType()));
|
|
|
+ //项目
|
|
|
+ item.setProjectId(getNewId(item.getProjectId(), GoodsCopyEnum.COURSE_PROJECT_TYPE.getType()));
|
|
|
+ //科目
|
|
|
+ item.setSubjectId(getNewId(item.getSubjectId(), GoodsCopyEnum.COURSE_SUBJECT.getType()));
|
|
|
+ }
|
|
|
+ iCourseChapterBusinessService.updateBatchById(courseChapterBusinessList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //12 课程章节关联
|
|
|
+ List<CourseChapterSection> chapterSectionList = iCourseChapterSectionService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(chapterSectionList)){
|
|
|
+ for (CourseChapterSection item : chapterSectionList) {
|
|
|
+ //章ID
|
|
|
+ item.setChapterId(getNewId(item.getChapterId(),GoodsCopyEnum.COURSE_CHAPTER.getType()));
|
|
|
+ //节ID
|
|
|
+ item.setSectionId(getNewId(item.getSectionId(), GoodsCopyEnum.COURSE_SECTION.getType()));
|
|
|
+ }
|
|
|
+ iCourseChapterSectionService.updateBatchById(chapterSectionList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //13 教育类型关联
|
|
|
+ List<CourseEducationTier> educationTierList = iCourseEducationTierService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(educationTierList)){
|
|
|
+ for (CourseEducationTier item : educationTierList) {
|
|
|
+ //教育类型ID
|
|
|
+ item.setEducationId(getNewId(item.getEducationId(),GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType()));
|
|
|
+ }
|
|
|
+ iCourseEducationTierService.updateBatchById(educationTierList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //14 教育类型
|
|
|
+ //15 课程讲义
|
|
|
+ //16 讲义业务层次关联
|
|
|
+ List<CourseHandoutsBusiness> handoutsBusinessList = iCourseHandoutsBusinessService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(handoutsBusinessList)){
|
|
|
+ for (CourseHandoutsBusiness item : handoutsBusinessList) {
|
|
|
+ //教育类型
|
|
|
+ item.setEducationId(getNewId(item.getEducationId(), GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType()));
|
|
|
+ //业务层次
|
|
|
+ item.setBusinessId(getNewId(item.getBusinessId(), GoodsCopyEnum.COURSE_BUSINESS.getType()));
|
|
|
+ //科目
|
|
|
+ item.setSubjectId(getNewId(item.getSubjectId(), GoodsCopyEnum.COURSE_SUBJECT.getType()));
|
|
|
+ //讲义ID
|
|
|
+ item.setHandoutsId(getNewId(item.getHandoutsId(), GoodsCopyEnum.COURSE_HANDOUTS.getType()));
|
|
|
+ }
|
|
|
+ iCourseHandoutsBusinessService.updateBatchById(handoutsBusinessList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //17 课程目录关联
|
|
|
+ List<CourseMenu> courseMenuList = iCourseMenuService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(courseMenuList)){
|
|
|
+ for (CourseMenu item : courseMenuList) {
|
|
|
+ //课程ID
|
|
|
+ item.setCourseId(getNewId(item.getCourseId(), GoodsCopyEnum.COURSE.getType()));
|
|
|
+ //目录ID
|
|
|
+ if (ObjectUtils.isNotNull(item.getType())){
|
|
|
+ if (item.getType() == 1){
|
|
|
+ //模快
|
|
|
+ item.setMenuId(getNewId(item.getMenuId(), GoodsCopyEnum.COURSE_MODULE.getType()));
|
|
|
+ }else if (item.getType() == 2){
|
|
|
+ //章
|
|
|
+ item.setMenuId(getNewId(item.getMenuId(), GoodsCopyEnum.COURSE_CHAPTER.getType()));
|
|
|
+ }else if (item.getType() == 3){
|
|
|
+ //节
|
|
|
+ item.setMenuId(getNewId(item.getMenuId(), GoodsCopyEnum.COURSE_SECTION.getType()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ iCourseMenuService.updateBatchById(courseMenuList);
|
|
|
+ }
|
|
|
|
|
|
- //教育类型
|
|
|
- if (ObjectUtil.isNotNull(goods.getEducationTypeId())){
|
|
|
- CourseEducationType type = iCourseEducationTypeService.getById(goods.getEducationTypeId());
|
|
|
- if (ObjectUtil.isNotNull(type)){
|
|
|
- CourseEducationType newType = iCourseEducationTypeService.getEducationTypeBytenant(type.getEncoder(),newTenantId);
|
|
|
- if (ObjectUtil.isNotNull(newType)){
|
|
|
- goods.setEducationTypeId(newType.getId());
|
|
|
- }else {
|
|
|
- type.setId(null);
|
|
|
- type.setTenantId(newTenantId);
|
|
|
- iCourseEducationTypeService.save(type);
|
|
|
- goods.setEducationTypeId(type.getId());
|
|
|
+ //18 课程目录试卷关联
|
|
|
+ List<CourseMenuExam> courseMenuExamList = iCourseMenuExamService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(courseMenuExamList)){
|
|
|
+ for (CourseMenuExam item : courseMenuExamList) {
|
|
|
+ //课程ID
|
|
|
+ item.setCourseId(getNewId(item.getCourseId(), GoodsCopyEnum.COURSE.getType()));
|
|
|
+ //模快
|
|
|
+ item.setModuleId(getNewId(item.getModuleId(), GoodsCopyEnum.COURSE_MODULE.getType()));
|
|
|
+ //章
|
|
|
+ item.setChapterId(getNewId(item.getChapterId(), GoodsCopyEnum.COURSE_CHAPTER.getType()));
|
|
|
+ //节
|
|
|
+ item.setSectionId(getNewId(item.getSectionId(), GoodsCopyEnum.COURSE_SECTION.getType()));
|
|
|
+ //试卷
|
|
|
+ item.setExamId(getNewId(item.getExamId(), GoodsCopyEnum.EXAM.getType()));
|
|
|
+ }
|
|
|
+ iCourseMenuExamService.updateBatchById(courseMenuExamList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //19 课程模块
|
|
|
+ //20 课程模块业务关联
|
|
|
+ List<CourseModuleBusiness> moduleBusinessList = iCourseModuleBusinessService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(moduleBusinessList)){
|
|
|
+ for (CourseModuleBusiness item : moduleBusinessList) {
|
|
|
+ //教育类型
|
|
|
+ item.setEducationTypeId(getNewId(item.getEducationTypeId(), GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType()));
|
|
|
+ //业务层次
|
|
|
+ item.setBusinessId(getNewId(item.getBusinessId(), GoodsCopyEnum.COURSE_BUSINESS.getType()));
|
|
|
+ //科目
|
|
|
+ item.setSubjectId(getNewId(item.getSubjectId(), GoodsCopyEnum.COURSE_SUBJECT.getType()));
|
|
|
+ //项目
|
|
|
+ item.setProjectId(getNewId(item.getProjectId(), GoodsCopyEnum.COURSE_PROJECT_TYPE.getType()));
|
|
|
+ //模块
|
|
|
+ item.setModuleId(getNewId(item.getModuleId(), GoodsCopyEnum.COURSE_MODULE.getType()));
|
|
|
+ }
|
|
|
+ iCourseModuleBusinessService.updateBatchById(moduleBusinessList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //21 课程模块章关联
|
|
|
+ List<CourseModuleChapter> moduleChapterList = iCourseModuleChapterService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(moduleChapterList)){
|
|
|
+ for (CourseModuleChapter item : moduleChapterList) {
|
|
|
+ //模块
|
|
|
+ item.setModuleId(getNewId(item.getModuleId(), GoodsCopyEnum.COURSE_MODULE.getType()));
|
|
|
+ //模块
|
|
|
+ item.setChapterId(getNewId(item.getChapterId(), GoodsCopyEnum.COURSE_CHAPTER.getType()));
|
|
|
+ }
|
|
|
+ iCourseModuleChapterService.updateBatchById(moduleChapterList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //22 课程项目
|
|
|
+ List<CourseProjectType> projectTypeList = iCourseProjectTypeService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(projectTypeList)){
|
|
|
+ for (CourseProjectType item : projectTypeList) {
|
|
|
+ //教育类型
|
|
|
+ if (ObjectUtils.isNotNull(item.getEducationId())){
|
|
|
+ Long newId = getNewId(item.getEducationId().longValue(), GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType());
|
|
|
+ item.setEducationId(ObjectUtils.isNull(newId)?null:newId.intValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ iCourseProjectTypeService.updateBatchById(projectTypeList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //23 课程节
|
|
|
+ //24 课程节业务关联
|
|
|
+ List<CourseSectionBusiness> sectionBusinessList = iCourseSectionBusinessService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(sectionBusinessList)){
|
|
|
+ for (CourseSectionBusiness item : sectionBusinessList) {
|
|
|
+ //教育类型
|
|
|
+ item.setEducationTypeId(getNewId(item.getEducationTypeId(), GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType()));
|
|
|
+ //业务层次
|
|
|
+ item.setBusinessId(getNewId(item.getBusinessId(), GoodsCopyEnum.COURSE_BUSINESS.getType()));
|
|
|
+ //科目
|
|
|
+ item.setSubjectId(getNewId(item.getSubjectId(), GoodsCopyEnum.COURSE_SUBJECT.getType()));
|
|
|
+ //项目
|
|
|
+ item.setProjectId(getNewId(item.getProjectId(), GoodsCopyEnum.COURSE_PROJECT_TYPE.getType()));
|
|
|
+ //节
|
|
|
+ item.setSectionId(getNewId(item.getSectionId(), GoodsCopyEnum.COURSE_SECTION.getType()));
|
|
|
+ }
|
|
|
+ iCourseSectionBusinessService.updateBatchById(sectionBusinessList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //25 课程节观看权限关联
|
|
|
+ List<CourseSectionWatchPer> sectionWatchPerList = iCourseSectionWatchPerService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(sectionWatchPerList)){
|
|
|
+ for (CourseSectionWatchPer item : sectionWatchPerList) {
|
|
|
+ //课程ID
|
|
|
+ item.setCourseId(getNewId(item.getCourseId(), GoodsCopyEnum.COURSE.getType()));
|
|
|
+ //模快
|
|
|
+ item.setModuleId(getNewId(item.getModuleId(), GoodsCopyEnum.COURSE_MODULE.getType()));
|
|
|
+ //章
|
|
|
+ item.setChapterId(getNewId(item.getChapterId(), GoodsCopyEnum.COURSE_CHAPTER.getType()));
|
|
|
+ //节
|
|
|
+ item.setSectionId(getNewId(item.getSectionId(), GoodsCopyEnum.COURSE_SECTION.getType()));
|
|
|
+ //商品
|
|
|
+ item.setGoodsId(getNewId(item.getGoodsId(), GoodsCopyEnum.GOODS.getType()));
|
|
|
+ }
|
|
|
+ iCourseSectionWatchPerService.updateBatchById(sectionWatchPerList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //26 课程科目
|
|
|
+ //27 课程科目项目关联
|
|
|
+ List<CourseSubjectProject> subjectProjectList = iCourseSubjectProjectService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(subjectProjectList)){
|
|
|
+ for (CourseSubjectProject item : subjectProjectList) {
|
|
|
+ //科目
|
|
|
+ item.setSubjectId(getNewId(item.getSubjectId(), GoodsCopyEnum.COURSE_SUBJECT.getType()));
|
|
|
+ //项目
|
|
|
+ item.setProjectId(getNewId(item.getProjectId(), GoodsCopyEnum.COURSE_PROJECT_TYPE.getType()));
|
|
|
+ }
|
|
|
+ iCourseSubjectProjectService.updateBatchById(subjectProjectList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //28 试卷
|
|
|
+ List<Exam> examList = iExamService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(examList)){
|
|
|
+ for (Exam item : examList) {
|
|
|
+ //试卷类型
|
|
|
+ item.setExamPaperId(getNewId(item.getExamPaperId(), GoodsCopyEnum.EXAM_PAPER.getType()));
|
|
|
+ }
|
|
|
+ iExamService.updateBatchById(examList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //29 试卷类型
|
|
|
+ //30 试卷题目关联
|
|
|
+ List<ExamQuestion> examQuestionList = iExamQuestionService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(examQuestionList)){
|
|
|
+ for (ExamQuestion item : examQuestionList) {
|
|
|
+ //试卷
|
|
|
+ item.setExamId(getNewId(item.getExamId(), GoodsCopyEnum.EXAM.getType()));
|
|
|
+ //题目
|
|
|
+ item.setQuestionId(getNewId(item.getQuestionId(), GoodsCopyEnum.QUESTION.getType()));
|
|
|
+ }
|
|
|
+ iExamQuestionService.updateBatchById(examQuestionList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //31 专业
|
|
|
+ //32 专业项目关联
|
|
|
+ List<MajorProject> majorProjectList = iMajorProjectService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(majorProjectList)){
|
|
|
+ for (MajorProject item : majorProjectList) {
|
|
|
+ //项目
|
|
|
+ item.setProjectId(getNewId(item.getProjectId(), GoodsCopyEnum.COURSE_PROJECT_TYPE.getType()));
|
|
|
+ //专业
|
|
|
+ item.setMajorId(getNewId(item.getMajorId(), GoodsCopyEnum.MAJOR.getType()));
|
|
|
+ }
|
|
|
+ iMajorProjectService.updateBatchById(majorProjectList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //33 服务
|
|
|
+ //34 服务供应
|
|
|
+ List<PaySupply> paySupplyList = iPaySupplyService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(paySupplyList)){
|
|
|
+ for (PaySupply item : paySupplyList) {
|
|
|
+ //服务类型
|
|
|
+ item.setServerId(getNewId(item.getServerId(), GoodsCopyEnum.PAY_SERVE.getType()));
|
|
|
+ }
|
|
|
+ iPaySupplyService.updateBatchById(paySupplyList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //35 课程流
|
|
|
+ List<CourseStreaming> streamingList = iCourseStreamingService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(streamingList)){
|
|
|
+ for (CourseStreaming item : streamingList) {
|
|
|
+ //本地保利威视频ID
|
|
|
+ item.setPolyvId(getNewId(item.getPolyvId(), GoodsCopyEnum.POLYV_VIDEO.getType()));
|
|
|
+ }
|
|
|
+ iCourseStreamingService.updateBatchById(streamingList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //36 课程流业务层次
|
|
|
+ List<CourseStreamingBusiness> streamingBusinessList = iCourseStreamingBusinessService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(streamingBusinessList)){
|
|
|
+ for (CourseStreamingBusiness item : streamingBusinessList) {
|
|
|
+ //教育类型
|
|
|
+ item.setEducationTypeId(getNewId(item.getEducationTypeId(), GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType()));
|
|
|
+ //业务层次
|
|
|
+ item.setBusinessId(getNewId(item.getBusinessId(), GoodsCopyEnum.COURSE_BUSINESS.getType()));
|
|
|
+ //流ID
|
|
|
+ item.setStreamingId(getNewId(item.getStreamingId(), GoodsCopyEnum.COURSE_STREAMING.getType()));
|
|
|
+ //项目
|
|
|
+ item.setProjectId(getNewId(item.getProjectId(), GoodsCopyEnum.COURSE_PROJECT_TYPE.getType()));
|
|
|
+ }
|
|
|
+ iCourseStreamingBusinessService.updateBatchById(streamingBusinessList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //37 保利威资源类型
|
|
|
+ //38 保利威视频资源
|
|
|
+ //39 资料字段
|
|
|
+ //40 资料模板
|
|
|
+ List<ProfileTp> profileTpList = iProfileTpService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(profileTpList)){
|
|
|
+ for (ProfileTp item : profileTpList) {
|
|
|
+ //商品
|
|
|
+ item.setGoodsIds(getNewIds(item.getGoodsIds(), GoodsCopyEnum.GOODS.getType()));
|
|
|
+ }
|
|
|
+ iProfileTpService.updateBatchById(profileTpList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //41 资料模板业务层次关联
|
|
|
+ List<ProfileTpBusiness> profileTpBusinessList = iProfileTpBusinessService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(profileTpBusinessList)){
|
|
|
+ for (ProfileTpBusiness item : profileTpBusinessList) {
|
|
|
+ //教育类型
|
|
|
+ item.setEducationTypeId(getNewId(item.getEducationTypeId(), GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType()));
|
|
|
+ //业务层次
|
|
|
+ item.setBusinessId(getNewId(item.getBusinessId(), GoodsCopyEnum.COURSE_BUSINESS.getType()));
|
|
|
+ //资料模板ID
|
|
|
+ item.setProfileTpId(getNewId(item.getProfileTpId(), GoodsCopyEnum.PROFILE_TP.getType()));
|
|
|
+ }
|
|
|
+ iProfileTpBusinessService.updateBatchById(profileTpBusinessList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //42 题目
|
|
|
+ //43 题目业务层次关联
|
|
|
+ List<QuestionBusiness> questionBusinessList = iQuestionBusinessService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(questionBusinessList)){
|
|
|
+ for (QuestionBusiness item : questionBusinessList) {
|
|
|
+ //教育类型
|
|
|
+ item.setEducationTypeId(getNewId(item.getEducationTypeId(), GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType()));
|
|
|
+ //业务层次
|
|
|
+ item.setBusinessId(getNewId(item.getBusinessId(), GoodsCopyEnum.COURSE_BUSINESS.getType()));
|
|
|
+ //科目
|
|
|
+ item.setSubjectId(getNewId(item.getSubjectId(), GoodsCopyEnum.COURSE_SUBJECT.getType()));
|
|
|
+ //项目
|
|
|
+ item.setProjectId(getNewId(item.getProjectId(), GoodsCopyEnum.COURSE_PROJECT_TYPE.getType()));
|
|
|
+ if (ObjectUtils.isNotNull(item.getType())){
|
|
|
+ if (item.getType() == 1){
|
|
|
+ //题目
|
|
|
+ item.setMajorId(getNewId(item.getMajorId(), GoodsCopyEnum.QUESTION.getType()));
|
|
|
+ }else if (item.getType() == 2){
|
|
|
+ //试卷
|
|
|
+ item.setMajorId(getNewId(item.getMajorId(), GoodsCopyEnum.EXAM.getType()));
|
|
|
+ }else if (item.getType() == 3){
|
|
|
+ //章卷
|
|
|
+ item.setMajorId(getNewId(item.getMajorId(), GoodsCopyEnum.QUESTION_CHAPTER.getType()));
|
|
|
+ }else if (item.getType() == 4){
|
|
|
+ //模块卷
|
|
|
+ item.setMajorId(getNewId(item.getMajorId(), GoodsCopyEnum.QUESTION_MODULE.getType()));
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
+ iQuestionBusinessService.updateBatchById(questionBusinessList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //44 题目章
|
|
|
+ //45 题库章试卷关联
|
|
|
+ List<QuestionChapterExam> chapterExamList = iQuestionChapterExamService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(chapterExamList)){
|
|
|
+ for (QuestionChapterExam item : chapterExamList) {
|
|
|
+ //章卷
|
|
|
+ item.setChapterExamId(getNewId(item.getChapterExamId(), GoodsCopyEnum.QUESTION_CHAPTER.getType()));
|
|
|
+ //试卷
|
|
|
+ item.setExamId(getNewId(item.getExamId(), GoodsCopyEnum.EXAM.getType()));
|
|
|
+ }
|
|
|
+ iQuestionChapterExamService.updateBatchById(chapterExamList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //46 题库模块
|
|
|
+ //47 题库模块章关联
|
|
|
+ List<QuestionModuleChapter> questionModuleChapterList = iQuestionModuleChapterService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(questionModuleChapterList)){
|
|
|
+ for (QuestionModuleChapter item : questionModuleChapterList) {
|
|
|
+ //章卷
|
|
|
+ item.setChapterExamId(getNewId(item.getChapterExamId(), GoodsCopyEnum.QUESTION_CHAPTER.getType()));
|
|
|
+ //模块卷
|
|
|
+ item.setModuleExamId(getNewId(item.getModuleExamId(), GoodsCopyEnum.QUESTION_MODULE.getType()));
|
|
|
+ }
|
|
|
+ iQuestionModuleChapterService.updateBatchById(questionModuleChapterList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //48 证书
|
|
|
+ List<CertificateCommon> certificateCommonList = iCertificateCommonService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(certificateCommonList)){
|
|
|
+ for (CertificateCommon item : certificateCommonList) {
|
|
|
+ //证书类型
|
|
|
+ item.setCertificateTypeId(getNewId(item.getCertificateTypeId(), GoodsCopyEnum.CERTIFICATE.getType()));
|
|
|
+ }
|
|
|
+ iCertificateCommonService.updateBatchById(certificateCommonList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //49 证书类型
|
|
|
+ //50 证书模板
|
|
|
+ List<CertificateTp> certificateTpList = iCertificateTpService.list();
|
|
|
+ if (CollectionUtils.isNotEmpty(certificateTpList)){
|
|
|
+ for (CertificateTp item : certificateTpList) {
|
|
|
+ //证书类型
|
|
|
+ item.setTypeId(getNewId(item.getTypeId(), GoodsCopyEnum.CERTIFICATE.getType()));
|
|
|
+ //证书
|
|
|
+ item.setCertificateId(getNewId(item.getCertificateId(), GoodsCopyEnum.CERTIFICATE_COMMON.getType()));
|
|
|
+ }
|
|
|
+ iCertificateTpService.updateBatchById(certificateTpList);
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
+ private Long getNewId(Long oldId, Integer type){
|
|
|
+ if (ObjectUtils.isNull(oldId) || oldId <= 0L){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ SysGoodsCopyRecord record = iSysGoodsCopyRecordService.getOne(new LambdaQueryWrapper<SysGoodsCopyRecord>()
|
|
|
+ .eq(SysGoodsCopyRecord::getOldId, oldId)
|
|
|
+ .eq(SysGoodsCopyRecord::getType, type));
|
|
|
+ if (ObjectUtils.isEmpty(record)){
|
|
|
+// throw new CustomException(String.format("新ID查找失败old:%s,type:%s",oldId,type));
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return record.getNewId();
|
|
|
+ }catch (Exception e){
|
|
|
+// throw new CustomException(String.format("(getone报错)新ID查找失败old:%s,type:%s",oldId,type));
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ private String getNewIds(String oldIds, Integer type){
|
|
|
+ if (StringUtils.isBlank(oldIds)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ List<Long> collect = Arrays.asList(oldIds.split(",")).stream().map(x -> Long.valueOf(x)).collect(Collectors.toList());
|
|
|
+ List<Long> ids = collect.stream().filter(x -> x > 0L).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isEmpty(ids)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ List<SysGoodsCopyRecord> records = iSysGoodsCopyRecordService.list(new LambdaQueryWrapper<SysGoodsCopyRecord>()
|
|
|
+ .in(SysGoodsCopyRecord::getOldId, ids)
|
|
|
+ .eq(SysGoodsCopyRecord::getType, type));
|
|
|
+ if (ObjectUtils.isEmpty(records)){
|
|
|
+ throw new CustomException(String.format("新ID查找失败old:%s,type:%s",oldIds,type));
|
|
|
}
|
|
|
- return false;
|
|
|
+ return records.stream().map(x -> x.getNewId().toString()).collect(Collectors.joining(","));
|
|
|
}
|
|
|
|
|
|
/**
|