|
@@ -1155,6 +1155,10 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
// String domainH5 = "https://h.xyyxt.net";
|
|
|
String domain = "https://zzyxt.gdzzkj.net/";
|
|
|
String domainH5 = "https://h.gdzzkj.net";
|
|
|
+ if (ObjectUtils.isNotNull(bo.getTenantId()) && "867735392558919680".equals(bo.getTenantId())){
|
|
|
+ domain = "https://web.xyyxt.net/";
|
|
|
+ domainH5 = "https://h.xyyxt.net";
|
|
|
+ }
|
|
|
GoodsVo goods = baseMapper.queryGoodsByIdTenant(bo.getGoodsId(), bo.getTenantId());
|
|
|
if (ObjectUtils.isNull(goods)) {
|
|
|
throw new CustomException("商品不存在!");
|
|
@@ -1227,7 +1231,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
for (Goods goods : goodsList) {
|
|
|
Long oldGoodsId = goods.getGoodsId();
|
|
|
//判断商品是否存在
|
|
|
- Long newGoodsId = getNewId(goods.getGoodsId(), GoodsCopyEnum.GOODS.getType());
|
|
|
+ Long newGoodsId = getNewIdByTenant(goods.getGoodsId(), GoodsCopyEnum.GOODS.getType(),newTenantId);
|
|
|
// Goods newGoods = this.baseMapper.queryGoodsByTenant(goods.getCode(),newTenantId);
|
|
|
if (ObjectUtils.isNull(newGoodsId)){
|
|
|
//不存在(新增)
|
|
@@ -1245,7 +1249,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
if (ObjectUtils.isNotNull(supply)){
|
|
|
Long oldSupplyId = supply.getSupplyId();
|
|
|
//新机构是否存在
|
|
|
- Long newSupplyId = getNewId(supply.getSupplyId(), GoodsCopyEnum.PAY_SUPPLY.getType());
|
|
|
+ Long newSupplyId = getNewIdByTenant(supply.getSupplyId(), GoodsCopyEnum.PAY_SUPPLY.getType(),newTenantId);
|
|
|
if (ObjectUtil.isNotNull(newSupplyId)){
|
|
|
goods.setSupplyId(newSupplyId);
|
|
|
}else {
|
|
@@ -1256,7 +1260,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
PayServe payServe = iPayServeService.getById(supply.getServerId());
|
|
|
Long oldServeId = payServe.getServeId();
|
|
|
if (ObjectUtils.isNotNull(payServe)){
|
|
|
- Long newPayServerId = getNewId(payServe.getServeId(), GoodsCopyEnum.PAY_SERVE.getType());
|
|
|
+ Long newPayServerId = getNewIdByTenant(payServe.getServeId(), GoodsCopyEnum.PAY_SERVE.getType(),newTenantId);
|
|
|
if (ObjectUtils.isNotNull(newPayServerId)){
|
|
|
supply.setServerId(newPayServerId);
|
|
|
}else {
|
|
@@ -1319,7 +1323,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
CourseHandouts courseHandouts = iCourseHandoutsService.getById(goods.getHandoutsId());
|
|
|
if (ObjectUtil.isNotNull(courseHandouts)){
|
|
|
Long oid = courseHandouts.getHandoutsId();
|
|
|
- Long newId = getNewId(oid, GoodsCopyEnum.COURSE_HANDOUTS.getType());
|
|
|
+ Long newId = getNewIdByTenant(oid, GoodsCopyEnum.COURSE_HANDOUTS.getType(),newTenantId);
|
|
|
// CourseHandouts newCourseHandouts = iCourseHandoutsService.getHandoutsByTenant(courseHandouts.getEncoder(),newTenantId);
|
|
|
if (ObjectUtil.isNotNull(newId)){
|
|
|
goods.setHandoutsId(newId);
|
|
@@ -1386,7 +1390,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
//规格模板
|
|
|
if (ObjectUtils.isNotNull(goods.getSpecTemplateId())){
|
|
|
Long oldSpecTemplateId = goods.getSpecTemplateId();
|
|
|
- Long newSpecTemplateId = getNewId(oldSpecTemplateId,GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType());
|
|
|
+ Long newSpecTemplateId = getNewIdByTenant(oldSpecTemplateId,GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType(),newTenantId);
|
|
|
GoodsSpecTemplate specTemplate = goodsSpecTemplateService.getById(oldSpecTemplateId);
|
|
|
// GoodsSpecTemplate newSpecTemplate = goodsSpecTemplateService.getSpecTpByTenant(specTemplate.getName(),specTemplate.getCreateTime(),newTenantId);
|
|
|
if (ObjectUtils.isNotNull(newSpecTemplateId)){
|
|
@@ -1484,7 +1488,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
//模板ID
|
|
|
if (ObjectUtils.isNotNull(relation.getSpecTemplateId())){
|
|
|
GoodsSpecTemplate specTemplate = goodsSpecTemplateService.getById(relation.getSpecTemplateId());
|
|
|
- Long newId = getNewId(specTemplate.getSpecTemplateId(), GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType());
|
|
|
+ Long newId = getNewIdByTenant(specTemplate.getSpecTemplateId(), GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType(),newTenantId);
|
|
|
// GoodsSpecTemplate newSpecTemplate = goodsSpecTemplateService.getSpecTpByTenant(specTemplate.getName(),specTemplate.getCreateTime(),newTenantId);
|
|
|
if (ObjectUtils.isNotNull(newId)){
|
|
|
relation.setSpecTemplateId(newId);
|
|
@@ -1496,7 +1500,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
//商品ID
|
|
|
if (ObjectUtils.isNotNull(relation.getGoodsId())){
|
|
|
Goods goods = getById(relation.getGoodsId());
|
|
|
- Long newId = getNewId(goods.getGoodsId(), GoodsCopyEnum.GOODS.getType());
|
|
|
+ Long newId = getNewIdByTenant(goods.getGoodsId(), GoodsCopyEnum.GOODS.getType(),newTenantId);
|
|
|
// Goods newGoods = baseMapper.queryGoodsByTenant(goods.getCode(),newTenantId);
|
|
|
if (ObjectUtils.isNotNull(newId)){
|
|
|
relation.setGoodsId(newId);
|
|
@@ -1512,7 +1516,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
if (CollectionUtils.isNotEmpty(specAttributeList)){
|
|
|
List<Long> newIds = new ArrayList<>();
|
|
|
specAttributeList.forEach(item -> {
|
|
|
- Long newId = getNewId(item.getSpecAttributeId(), GoodsCopyEnum.GOODS_SPEC_ATTRIBUTE.getType());
|
|
|
+ Long newId = getNewIdByTenant(item.getSpecAttributeId(), GoodsCopyEnum.GOODS_SPEC_ATTRIBUTE.getType(),newTenantId);
|
|
|
// GoodsSpecAttribute newSpecAttribute = goodsSpecAttributeService.getSpecAttrByTenant(item.getName(),item.getCreateTime(),newTenantId);
|
|
|
if (ObjectUtils.isNotNull(newId)){
|
|
|
newIds.add(newId);
|
|
@@ -1528,6 +1532,11 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
goodsSpecAttributeRelationService.saveBatch(newRelationList);
|
|
|
}
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(recordList)){
|
|
|
+ //保存记录
|
|
|
+ iSysGoodsCopyRecordService.saveBatch(recordList);
|
|
|
+ }
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -1589,11 +1598,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
Course course = iCourseService.getById(goodsCourse.getCourseId());
|
|
|
if(ObjectUtils.isNotNull(course)){
|
|
|
Long oldCourseId = course.getCourseId();
|
|
|
- Long newCourseId = 0L;
|
|
|
- Course newCourse = iCourseService.getCourseByTenant(course.getCode(),newTenantId);
|
|
|
- if (ObjectUtils.isNotNull(newCourse)){
|
|
|
- newCourseId = newCourse.getCourseId();
|
|
|
- }else {
|
|
|
+ Long newCourseId = getNewIdByTenant(oldCourseId, GoodsCopyEnum.COURSE.getType(),newTenantId);
|
|
|
+// Course newCourse = iCourseService.getCourseByTenant(course.getCode(),newTenantId);
|
|
|
+ if (ObjectUtils.isNull(newCourseId)){
|
|
|
course.setCourseId(null);
|
|
|
course.setTenantId(newTenantId);
|
|
|
course.setEducationTypeId(getNewEducationTypeId(course.getEducationTypeId(),newTenantId,array));
|
|
@@ -1666,7 +1673,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
QuestionModule questionModule = iQuestionModuleService.getById(moduleExamId);
|
|
|
if (ObjectUtils.isNotNull(questionModule)){
|
|
|
Long oldModuleExamId = questionModule.getModuleExamId();
|
|
|
- Long newModuleExamId = getNewId(oldModuleExamId, GoodsCopyEnum.QUESTION_MODULE.getType());
|
|
|
+ Long newModuleExamId = getNewIdByTenant(oldModuleExamId, GoodsCopyEnum.QUESTION_MODULE.getType(),newTenantId);
|
|
|
// QuestionModule newQuestionModule = iQuestionModuleService.getModuleByTenant(questionModule.getCode(),newTenantId);
|
|
|
if (ObjectUtils.isNull(newModuleExamId)){
|
|
|
questionModule.setModuleExamId(null);
|
|
@@ -1718,7 +1725,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
QuestionChapter questionChapter = iQuestionChapterService.getOne(new LambdaQueryWrapper<QuestionChapter>().eq(QuestionChapter::getChapterExamId,oldChapterExamId));
|
|
|
if (ObjectUtils.isNotNull(questionChapter)){
|
|
|
Long oid = questionChapter.getChapterExamId();
|
|
|
- Long newChapterExamId = getNewId(oid,GoodsCopyEnum.QUESTION_CHAPTER.getType());
|
|
|
+ Long newChapterExamId = getNewIdByTenant(oid,GoodsCopyEnum.QUESTION_CHAPTER.getType(),newTenantId);
|
|
|
// QuestionChapter newQuestionChapter = iQuestionChapterService.getChaptereExamByTenant(questionChapter.getCode(),newTenantId);
|
|
|
if (ObjectUtils.isNull(newChapterExamId)){
|
|
|
questionChapter.setChapterExamId(null);
|
|
@@ -1770,13 +1777,13 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
Exam exam = iExamService.getById(oldExamId);
|
|
|
if (ObjectUtils.isNotNull(exam)){
|
|
|
Long oid = exam.getExamId();
|
|
|
- Long newExamId = getNewId(oid,GoodsCopyEnum.EXAM.getType());
|
|
|
+ Long newExamId = getNewIdByTenant(oid,GoodsCopyEnum.EXAM.getType(),newTenantId);
|
|
|
if (ObjectUtils.isNull(newExamId)){
|
|
|
//试卷类型
|
|
|
ExamPaper examPaper = iExamPaperService.getById(exam.getExamPaperId());
|
|
|
if (ObjectUtils.isNotNull(examPaper)){
|
|
|
Long paperOid = examPaper.getPaperId();
|
|
|
- Long newExamPaperId = getNewId(paperOid, GoodsCopyEnum.EXAM_PAPER.getType());
|
|
|
+ Long newExamPaperId = getNewIdByTenant(paperOid, GoodsCopyEnum.EXAM_PAPER.getType(),newTenantId);
|
|
|
if (ObjectUtils.isNotNull(newExamPaperId)){
|
|
|
exam.setExamPaperId(newExamPaperId);
|
|
|
}else {
|
|
@@ -1837,7 +1844,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
Question question = iQuestionService.getById(oldQuestionId);
|
|
|
if (ObjectUtils.isNotNull(question)){
|
|
|
Long oid = question.getQuestionId();
|
|
|
- Long newQuestionId = getNewId(oid,GoodsCopyEnum.QUESTION.getType());
|
|
|
+ Long newQuestionId = getNewIdByTenant(oid,GoodsCopyEnum.QUESTION.getType(),newTenantId);
|
|
|
// Question newQuestion = iQuestionService.getQuestionByTenant(question.getCode(),newTenantId);
|
|
|
if (ObjectUtils.isNull(newQuestionId)){
|
|
|
//新增
|
|
@@ -1874,7 +1881,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
CourseModule module = iCourseModuleService.getById(oldModuleId);
|
|
|
if (ObjectUtils.isNotNull(module)){
|
|
|
Long oid = module.getModuleId();
|
|
|
- Long newModuleId = getNewId(oid,GoodsCopyEnum.COURSE_MODULE.getType());
|
|
|
+ Long newModuleId = getNewIdByTenant(oid,GoodsCopyEnum.COURSE_MODULE.getType(),newTenantId);
|
|
|
// CourseModule newModule = iCourseModuleService.getModuleByTenant(module.getCode(),newTenantId);
|
|
|
if (ObjectUtils.isNull(newModuleId)){
|
|
|
module.setModuleId(null);
|
|
@@ -1925,9 +1932,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
CourseChapter chapter = iCourseChapterService.getById(oldChapterId);
|
|
|
if (ObjectUtils.isNotNull(chapter)){
|
|
|
Long oid = chapter.getChapterId();
|
|
|
- Long newChapterId = getNewId(oid,GoodsCopyEnum.COURSE_CHAPTER.getType());
|
|
|
+ Long newChapterId = getNewIdByTenant(oid,GoodsCopyEnum.COURSE_CHAPTER.getType(),newTenantId);
|
|
|
// CourseChapter newChapter = iCourseChapterService.getChapterByTenant(chapter.getCode(),newTenantId);
|
|
|
- if (ObjectUtils.isNotNull(newChapterId)){
|
|
|
+ if (ObjectUtils.isNull(newChapterId)){
|
|
|
chapter.setChapterId(null);
|
|
|
chapter.setTenantId(newTenantId);
|
|
|
iCourseChapterService.save(chapter);
|
|
@@ -1976,7 +1983,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
CourseSection section = iCourseSectionService.getById(oldSectionId);
|
|
|
if (ObjectUtils.isNotNull(section)){
|
|
|
Long oid = section.getSectionId();
|
|
|
- Long newSectionId = getNewId(oid,GoodsCopyEnum.COURSE_SECTION.getType());
|
|
|
+ Long newSectionId = getNewIdByTenant(oid,GoodsCopyEnum.COURSE_SECTION.getType(),newTenantId);
|
|
|
// CourseSection newSection = iCourseSectionService.getSectionByTenant(section.getCode(),newTenantId);
|
|
|
if (ObjectUtils.isNull(newSectionId)){
|
|
|
//新增
|
|
@@ -2012,7 +2019,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
CertificateCommon certificateCommon = iCertificateCommonService.getById(certificateId);
|
|
|
if (ObjectUtils.isNotNull(certificateCommon)){
|
|
|
Long oid = certificateCommon.getId();
|
|
|
- Long newId = getNewId(oid, GoodsCopyEnum.CERTIFICATE_COMMON.getType());
|
|
|
+ Long newId = getNewIdByTenant(oid, GoodsCopyEnum.CERTIFICATE_COMMON.getType(),newTenantId);
|
|
|
// CertificateCommon newCertificateCommon = iCertificateCommonService.getCertificateByTenant(certificateCommon.getCode(),newTenantId);
|
|
|
if (ObjectUtils.isNotNull(newId)){
|
|
|
return newId;
|
|
@@ -2036,7 +2043,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
CertificateTp certificateTp = iCertificateTpService.getById(certificateTpId);
|
|
|
if (ObjectUtils.isNotNull(certificateTp)){
|
|
|
Long oid = certificateTp.getTpId();
|
|
|
- Long newId = getNewId(oid, GoodsCopyEnum.CERTIFICATE_TP.getType());
|
|
|
+ Long newId = getNewIdByTenant(oid, GoodsCopyEnum.CERTIFICATE_TP.getType(),newTenantId);
|
|
|
// CertificateTp newCertificateTp =iCertificateTpService.getCertificateTpByTenant(certificateTp.getCode(),newTenantId);
|
|
|
if (ObjectUtils.isNotNull(newId)){
|
|
|
return newId;
|
|
@@ -2057,7 +2064,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
Certificate certificate = iCertificateService.getById(certificateTypeId);
|
|
|
if (ObjectUtils.isNotNull(certificate)){
|
|
|
Long oid = certificate.getId();
|
|
|
- Long newId = getNewId(oid, GoodsCopyEnum.CERTIFICATE.getType());
|
|
|
+ Long newId = getNewIdByTenant(oid, GoodsCopyEnum.CERTIFICATE.getType(),newTenantId);
|
|
|
// Certificate newCertificate = iCertificateService.getCertificateByTenant(certificate.getCode(),newTenantId);
|
|
|
if (ObjectUtils.isNotNull(newId)){
|
|
|
return newId;
|
|
@@ -2078,7 +2085,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
return null;
|
|
|
}
|
|
|
Long oId = educationType.getId();
|
|
|
- Long newEducationTypeId = getNewId(educationType.getId(), GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType());
|
|
|
+ Long newEducationTypeId = getNewIdByTenant(educationType.getId(), GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType(),newTenantId);
|
|
|
// CourseEducationType newEducationType = iCourseEducationTypeService.getEducationTypeBytenant(educationType.getEncoder(), newTenantId);
|
|
|
if (ObjectUtil.isNull(newEducationTypeId)){
|
|
|
//新增教育类型
|
|
@@ -2098,7 +2105,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
return null;
|
|
|
}
|
|
|
Long oid = project.getId();
|
|
|
- Long newId = getNewId(oid, GoodsCopyEnum.COURSE_PROJECT_TYPE.getType());
|
|
|
+ Long newId = getNewIdByTenant(oid, GoodsCopyEnum.COURSE_PROJECT_TYPE.getType(),newTenantId);
|
|
|
// CourseProjectType newProject = iCourseProjectTypeService.getProjectByTenant(project.getEncoder(),newTenantId);
|
|
|
if (ObjectUtil.isNull(newId)){
|
|
|
//新增项目类型
|
|
@@ -2121,7 +2128,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
return null;
|
|
|
}
|
|
|
Long oid = major.getId();
|
|
|
- Long newMajorId = getNewId(oid,GoodsCopyEnum.MAJOR.getType());
|
|
|
+ Long newMajorId = getNewIdByTenant(oid,GoodsCopyEnum.MAJOR.getType(),newTenantId);
|
|
|
// Major newMajor = iMajorService.getMajorByTenant(major.getEncoder(), newTenantId);
|
|
|
if (ObjectUtil.isNull(newMajorId)){
|
|
|
//新增专业
|
|
@@ -2157,7 +2164,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
return null;
|
|
|
}
|
|
|
Long oid = business.getId();
|
|
|
- Long newId = getNewId(oid, GoodsCopyEnum.COURSE_BUSINESS.getType());
|
|
|
+ Long newId = getNewIdByTenant(oid, GoodsCopyEnum.COURSE_BUSINESS.getType(),newTenantId);
|
|
|
// CourseBusiness newBusiness = iCourseBusinessService.getBusinessByTenant(business.getEncoder(),newTenantId);
|
|
|
if (ObjectUtil.isNull(newId)){
|
|
|
//新增业务层次
|
|
@@ -2179,7 +2186,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
return null;
|
|
|
}
|
|
|
Long oid = courseSubject.getId();
|
|
|
- Long newId = getNewId(oid, GoodsCopyEnum.COURSE_SUBJECT.getType());
|
|
|
+ Long newId = getNewIdByTenant(oid, GoodsCopyEnum.COURSE_SUBJECT.getType(),newTenantId);
|
|
|
// CourseSubject newCourseSubject = iCourseSubjectService.getSubjectByTenant(courseSubject.getEncoder(),newTenantId);
|
|
|
if (ObjectUtil.isNull(newId)){
|
|
|
//业务项目关联
|
|
@@ -3753,6 +3760,24 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private Long getNewIdByTenant(Long oldId, Integer type,Long tenantId){
|
|
|
+ if (ObjectUtils.isNull(oldId) || oldId <= 0L){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+
|
|
|
+ SysGoodsCopyRecord record = iSysGoodsCopyRecordService.getNewIdByTenant(oldId,type,tenantId);
|
|
|
+ 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;
|