|
@@ -1059,8 +1059,11 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
@Override
|
|
|
public String getGoodsStudyUrl(GoodsStudyUrlBo bo) {
|
|
|
String url = "";
|
|
|
+ //中正学堂PC域名和H5域名 https://zzyxt.gdzzkj.net/ h.gdzzkj.net
|
|
|
String domain = "http://192.168.1.222:6002/";
|
|
|
String domainH5 = "https://h.xyyxt.net";
|
|
|
+// String domain = "http://zzyxt.gdzzkj.net/";
|
|
|
+// String domainH5 = "https://h.gdzzkj.net";
|
|
|
GoodsVo goods = baseMapper.queryGoodsByIdTenant(bo.getGoodsId(), bo.getTenantId());
|
|
|
if (ObjectUtils.isNull(goods)) {
|
|
|
throw new CustomException("商品不存在!");
|
|
@@ -1098,7 +1101,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
//H5
|
|
|
if (goods.getGoodsType() == 2) {
|
|
|
//题库
|
|
|
- url = String.format("%s/pages/questionBank/index&skipPort=%s", domainH5, nowTime);
|
|
|
+ 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",
|
|
@@ -1117,121 +1120,136 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
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
|
|
|
+ public boolean goodsBatchCopyIncrementTenant(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.setSchoolId(newSchool.getId());
|
|
|
+ }else {
|
|
|
+ school.setId(null);
|
|
|
+ school.setTenantId(newTenantId);
|
|
|
+ iSchoolService.save(school);
|
|
|
+ goods.setSchoolId(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.setMajorId(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.setProjectId(newProject.getId().intValue());
|
|
|
+ }else {
|
|
|
+ project.setId(null);
|
|
|
+ project.setTenantId(newTenantId);
|
|
|
+ iCourseProjectTypeService.save(project);
|
|
|
+ goods.setProjectId(project.getId().intValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //讲义
|
|
|
+ if (ObjectUtil.isNotNull(goods.getHandoutsId())){
|
|
|
+ CourseHandouts courseHandouts = iCourseHandoutsService.getById(goods.getHandoutsId());
|
|
|
+ if (ObjectUtil.isNotNull(courseHandouts)){
|
|
|
+ CourseHandouts newCourseHandouts = iCourseHandoutsService.getHandoutsByTenant(courseHandouts.getEncoder(),newTenantId);
|
|
|
+ if (ObjectUtil.isNotNull(newCourseHandouts)){
|
|
|
+ goods.setHandoutsId(newCourseHandouts.getHandoutsId());
|
|
|
+ }else {
|
|
|
+ newCourseHandouts.setHandoutsId(null);
|
|
|
+ newCourseHandouts.setTenantId(newTenantId);
|
|
|
+ iCourseHandoutsService.save(newCourseHandouts);
|
|
|
+ goods.setHandoutsId(courseHandouts.getHandoutsId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|