|
|
@@ -6,6 +6,7 @@ import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
@@ -16,6 +17,8 @@ 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.common.utils.ToolsUtils;
|
|
|
+import com.zhongzheng.common.utils.http.HttpUtils;
|
|
|
import com.zhongzheng.modules.bank.domain.*;
|
|
|
import com.zhongzheng.modules.bank.mapper.QuestionMapper;
|
|
|
import com.zhongzheng.modules.bank.service.*;
|
|
|
@@ -67,6 +70,7 @@ import com.zhongzheng.modules.user.vo.SubjectStudyRecordVo;
|
|
|
import com.zhongzheng.modules.user.vo.UserVo;
|
|
|
import net.polyv.common.v1.util.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
@@ -74,6 +78,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
@@ -238,6 +243,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
@Autowired
|
|
|
private ISysGoodsCopyRecordService iGoodsCopyRecordService;
|
|
|
|
|
|
+ @Value("${oldStudySys.educationalInspector}")
|
|
|
+ private String INFORM_PATH;
|
|
|
+
|
|
|
@Override
|
|
|
public GoodsVo queryById(Long goodsId) {
|
|
|
Goods db = this.baseMapper.selectById(goodsId);
|
|
|
@@ -976,17 +984,23 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
if (Validator.isEmpty(bo.getTelphone())) {
|
|
|
throw new CustomException("参数错误");
|
|
|
}
|
|
|
- User user = iUserService.getOne(new LambdaQueryWrapper<User>()
|
|
|
- .eq(User::getTelphone, bo.getTelphone()));
|
|
|
- if (ObjectUtils.isNull(user)) {
|
|
|
+
|
|
|
+ List<User> users = iUserService.getUserByTelNotTenant(bo.getTelphone());
|
|
|
+ if (CollectionUtils.isNotEmpty(users)) {
|
|
|
throw new CustomException("通过手机号获取用户信息失败");
|
|
|
}
|
|
|
//获取用户订单商品信息
|
|
|
- List<UserGoodsListVo> voList = baseMapper.getOrderGoodsListByUser(user.getUserId());
|
|
|
+ List<UserGoodsListVo> voList = new ArrayList<>();
|
|
|
+ users.forEach(item -> {
|
|
|
+ List<UserGoodsListVo> orderGoodsListByUser = baseMapper.getOrderGoodsListByUser(item.getUserId());
|
|
|
+ voList.addAll(orderGoodsListByUser);
|
|
|
+ });
|
|
|
+
|
|
|
if (CollectionUtils.isEmpty(voList)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
voList.forEach(goodsVo -> {
|
|
|
+ User user = users.stream().filter(x -> x.getTenantId().equals(goodsVo.getTenantId())).findFirst().orElse(null);
|
|
|
//已学和未学
|
|
|
Long secLong = 0L;
|
|
|
Long studyLong = 0L;
|
|
|
@@ -1056,11 +1070,94 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
return voList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 督学通知e管证
|
|
|
+ * @author change
|
|
|
+ * @date 2023/1/4 10:24
|
|
|
+ * @param userId
|
|
|
+ * @param goodsId
|
|
|
+ * @param type
|
|
|
+ * @param content
|
|
|
+ * @param dataJson
|
|
|
+ * @return boolean
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public boolean informOldSys(Long userId, Long goodsId,Long orderGoodsId,Long gradeId, Integer type, String content, List<String> dataJson) {
|
|
|
+ User user = iUserService.getById(userId);
|
|
|
+ if (ObjectUtils.isNull(user)){
|
|
|
+ log.error("informOldSys:督学通知E管证失败(用户信息获取失败)userId:"+userId);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ Goods goods = null;
|
|
|
+ if (ObjectUtils.isNotNull(goodsId)){
|
|
|
+ goods = getById(goodsId);
|
|
|
+ }
|
|
|
+ GoodsEGZInformBo bo = new GoodsEGZInformBo();
|
|
|
+ bo.setIdNum(user.getIdCard());
|
|
|
+ bo.setMobile(user.getTelphone());
|
|
|
+ bo.setTipsType(type);
|
|
|
+ bo.setTipsContent(content);
|
|
|
+ bo.setDataJson(JSONArray.toJSONString(dataJson));
|
|
|
+ if (ObjectUtils.isNotNull(orderGoodsId) && ObjectUtils.isNotNull(gradeId)){
|
|
|
+ //获取小程序appID
|
|
|
+ String tenantId = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
+ SysConfig sysConfig = iSysConfigService.getOne(new LambdaQueryWrapper<SysConfig>()
|
|
|
+ .eq(SysConfig::getConfigKey, "wx.small.appid")
|
|
|
+ .eq(SysConfig::getTenantId,Long.valueOf(tenantId)));
|
|
|
+ if (ObjectUtils.isNull(sysConfig)) {
|
|
|
+ log.error("informOldSys:督学通知E管证失败(小程序appID获取失败)tenantId:"+tenantId);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ bo.setWeAppId(sysConfig.getConfigValue());
|
|
|
+ //跳转路径
|
|
|
+ //课程
|
|
|
+ List<Long> courseIds = iGoodsCourseService.getCourseIdsByGoodsAndTenant(goodsId,Long.valueOf(tenantId));
|
|
|
+ Long courseId = 0L;
|
|
|
+ if (CollectionUtils.isNotEmpty(courseIds) && courseIds.size() == 1) {
|
|
|
+ courseId = courseIds.get(0);
|
|
|
+ }
|
|
|
+ if (goods.getGoodsType() == 2) {
|
|
|
+ //题库
|
|
|
+ bo.setToWeAppPagePath("/pages/questionBank/index");
|
|
|
+ } else if (goods.getGoodsType() == 6) {
|
|
|
+ //直播
|
|
|
+ bo.setToWeAppPagePath(String.format("/pages3/live/detail?orderGoodsId=%s&goodsId=%s&gradeId=0&courseId=%s",
|
|
|
+ orderGoodsId, goodsId, courseId));
|
|
|
+ } else {
|
|
|
+ //视频
|
|
|
+ bo.setToWeAppPagePath(String.format("/pages3/polyv/detail?id=%s&goodsId=%s&orderGoodsId=%s&gradeId=%s",
|
|
|
+ courseId, goodsId, orderGoodsId, gradeId));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ Long nowTime = DateUtils.getNowTime();
|
|
|
+ String sign = ToolsUtils.EncoderByMd5(nowTime.toString()+"pubilc2022");
|
|
|
+ params.put("stamp", nowTime.toString());
|
|
|
+ params.put("sign", sign);
|
|
|
+ params.put("jsonstr", JSONArray.toJSONString(Arrays.asList(bo)));
|
|
|
+ String respone = "";
|
|
|
+ try {
|
|
|
+ respone = HttpUtils.postFormBody(INFORM_PATH, params);
|
|
|
+ if (!respone.contains("\"Status\":true")) {
|
|
|
+ log.error("E管证督学通知接口请求错误"+respone);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ log.error("E管证督学通知接口请求错误"+respone);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public String getGoodsStudyUrl(GoodsStudyUrlBo bo) {
|
|
|
String url = "";
|
|
|
- String domain = "http://192.168.1.222:6002/";
|
|
|
- String domainH5 = "https://h.xyyxt.net";
|
|
|
+ //中正学堂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 = "https://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 +1195,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 +1214,553 @@ 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<GoodsSpecAttributeRelation> newRelationList = new ArrayList<>();
|
|
|
+ for (Goods goods : goodsList) {
|
|
|
+ //判断商品是否存在
|
|
|
+ GoodsVo newGoods = this.baseMapper.queryGoodsByIdTenant(goods.getGoodsId(),newTenantId);
|
|
|
+ if (ObjectUtils.isNull(newGoods)){
|
|
|
+ //不存在(新增)
|
|
|
+ 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);
|
|
|
+ //服务类型ID
|
|
|
+ if (ObjectUtil.isNotNull(supply.getServerId())){
|
|
|
+ PayServe payServe = iPayServeService.getById(supply.getServerId());
|
|
|
+ if (ObjectUtils.isNotNull(payServe)){
|
|
|
+ PayServe newPayServer = iPayServeService.getPayServeByTenant(payServe.getServeName(),newTenantId);
|
|
|
+ if (ObjectUtils.isNotNull(newPayServer)){
|
|
|
+ supply.setServerId(newPayServer.getServeId());
|
|
|
+ }else {
|
|
|
+ //新增服务
|
|
|
+ payServe.setServeId(null);
|
|
|
+ payServe.setTenantId(newTenantId);
|
|
|
+ iPayServeService.save(payServe);
|
|
|
+ supply.setServerId(newPayServer.getServeId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ //项目ID
|
|
|
+ if (ObjectUtils.isNotNull(business.getProjectId())){
|
|
|
+ CourseProjectType projectType = iCourseProjectTypeService.getById(business.getProjectId());
|
|
|
+ if (ObjectUtil.isNotNull(projectType)){
|
|
|
+ CourseProjectType newProject = iCourseProjectTypeService.getProjectByTenant(projectType.getEncoder(), newTenantId);
|
|
|
+ if (ObjectUtil.isNotNull(newProject)){
|
|
|
+ business.setProjectId(newProject.getId().intValue());
|
|
|
+ }else {
|
|
|
+ //新增项目
|
|
|
+ //判断项目的教育类型是否存在
|
|
|
+ CourseEducationType educationType = iCourseEducationTypeService.getById(projectType.getEducationId());
|
|
|
+ CourseEducationType newEducationType = iCourseEducationTypeService.getEducationTypeBytenant(educationType.getEncoder(), newTenantId);
|
|
|
+ if (ObjectUtil.isNotNull(newEducationType)){
|
|
|
+ projectType.setEducationId(newEducationType.getId().intValue());
|
|
|
+ }else {
|
|
|
+ educationType.setId(null);
|
|
|
+ educationType.setTenantId(newTenantId);
|
|
|
+ iCourseEducationTypeService.save(educationType);
|
|
|
+ projectType.setEducationId(educationType.getId().intValue());
|
|
|
+ }
|
|
|
+ projectType.setId(null);
|
|
|
+ projectType.setTenantId(newTenantId);
|
|
|
+ iCourseProjectTypeService.save(projectType);
|
|
|
+ business.setProjectId(projectType.getId().intValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ //判断项目的教育类型是否存在
|
|
|
+ CourseEducationType educationType = iCourseEducationTypeService.getById(project.getEducationId());
|
|
|
+ CourseEducationType newEducationType = iCourseEducationTypeService.getEducationTypeBytenant(educationType.getEncoder(), newTenantId);
|
|
|
+ if (ObjectUtil.isNotNull(newEducationType)){
|
|
|
+ project.setEducationId(newEducationType.getId().intValue());
|
|
|
+ }else {
|
|
|
+ educationType.setId(null);
|
|
|
+ educationType.setTenantId(newTenantId);
|
|
|
+ iCourseEducationTypeService.save(educationType);
|
|
|
+ project.setEducationId(educationType.getId().intValue());
|
|
|
+ }
|
|
|
+ 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 {
|
|
|
+ //讲义业务层次
|
|
|
+ List<CourseHandoutsBusiness> handoutsBusinessList = iCourseHandoutsBusinessService
|
|
|
+ .list(new LambdaQueryWrapper<CourseHandoutsBusiness>()
|
|
|
+ .eq(CourseHandoutsBusiness::getHandoutsId, courseHandouts.getHandoutsId()));
|
|
|
+ newCourseHandouts.setHandoutsId(null);
|
|
|
+ newCourseHandouts.setTenantId(newTenantId);
|
|
|
+ iCourseHandoutsService.save(newCourseHandouts);
|
|
|
+ goods.setHandoutsId(courseHandouts.getHandoutsId());
|
|
|
+ if (CollectionUtils.isNotEmpty(handoutsBusinessList)){
|
|
|
+ List<CourseHandoutsBusiness> collect = handoutsBusinessList.stream().map(business -> {
|
|
|
+ business.setId(null);
|
|
|
+ business.setTenantId(newTenantId);
|
|
|
+ //项目
|
|
|
+ business.setEducationId(getNewEducationTypeId(business.getEducationId(), newTenantId));
|
|
|
+ //业务
|
|
|
+ business.setBusinessId(getNewBusinessId(business.getBusinessId(), newTenantId));
|
|
|
+ //科目
|
|
|
+ business.setSubjectId(getNewSubjectId(business.getSubjectId(), newTenantId));
|
|
|
+ //讲义
|
|
|
+ business.setHandoutsId(courseHandouts.getHandoutsId());
|
|
|
+ return business;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iCourseHandoutsBusinessService.saveBatch(collect);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //科目ID,拼接
|
|
|
+ if (StringUtils.isNotBlank(goods.getSubjectIds())){
|
|
|
+ List<Long> subIds = new ArrayList<>();
|
|
|
+ List<Long> ids = Arrays.asList(goods.getSubjectIds().split(",")).stream().map(x -> Long.valueOf(x)).collect(Collectors.toList());
|
|
|
+ ids.forEach(item -> {
|
|
|
+ Long newSubjectId = getNewSubjectId(item, newTenantId);
|
|
|
+ if (ObjectUtils.isNotNull(newSubjectId)){
|
|
|
+ subIds.add(newSubjectId);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (CollectionUtils.isNotEmpty(subIds)){
|
|
|
+ goods.setSubjectIds(subIds.stream().map(x -> x.toString()).collect(Collectors.joining(",")));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //证书类型
|
|
|
+ if (ObjectUtils.isNotNull(goods.getCertificateTypeId())){
|
|
|
+ goods.setCertificateTypeId(getNewCertificateTypeId(goods.getCertificateTypeId(),newTenantId));
|
|
|
+ }
|
|
|
+
|
|
|
+ //证书
|
|
|
+ if (ObjectUtils.isNotNull(goods.getCertificateId())){
|
|
|
+ goods.setCertificateId(getNewCertificateId(goods.getCertificateId(),newTenantId));
|
|
|
+ }
|
|
|
+
|
|
|
+ //证书模板
|
|
|
+ if (ObjectUtils.isNotNull(goods.getCertificateTpId())){
|
|
|
+ CertificateTp certificateTp = iCertificateTpService.getById(goods.getCertificateTpId());
|
|
|
+ if (ObjectUtils.isNotNull(certificateTp)){
|
|
|
+ CertificateTp newCertificateTp =iCertificateTpService.getCertificateTpByTenant(certificateTp.getCode(),newTenantId);
|
|
|
+ if (ObjectUtils.isNotNull(newCertificateTp)){
|
|
|
+ goods.setCertificateTpId(newCertificateTp.getTpId());
|
|
|
+ }else {
|
|
|
+ certificateTp.setTpId(null);
|
|
|
+ certificateTp.setTenantId(newTenantId);
|
|
|
+ certificateTp.setCertificateId(getNewCertificateId(certificateTp.getCertificateId(),newTenantId));
|
|
|
+ certificateTp.setTpId(getNewCertificateTypeId(certificateTp.getTpId(),newTenantId));
|
|
|
+ iCertificateTpService.save(certificateTp);
|
|
|
+ goods.setCertificateTpId(certificateTp.getTpId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //规格模板
|
|
|
+ if (ObjectUtils.isNotNull(goods.getSpecTemplateId())){
|
|
|
+ List<GoodsSpecAttributeRelation> attributeRelationList = goodsSpecAttributeRelationService
|
|
|
+ .list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
|
|
|
+ .eq(GoodsSpecAttributeRelation::getGoodsId, goods.getGoodsId()));
|
|
|
+ if (CollectionUtils.isNotEmpty(attributeRelationList)){
|
|
|
+ for (GoodsSpecAttributeRelation relation : attributeRelationList) {
|
|
|
+ GoodsSpecTemplate specTemplate = goodsSpecTemplateService.getById(relation.getSpecTemplateId());
|
|
|
+ GoodsSpecTemplate newSpecTemplate = goodsSpecTemplateService.getSpecTpByTenant(specTemplate.getName(),specTemplate.getCreateTime(),newTenantId);
|
|
|
+ if (ObjectUtils.isNotNull(newSpecTemplate)){
|
|
|
+ //更新
|
|
|
+ List<Long> specIds = goodsSpecService.getIdsByTenant(newSpecTemplate.getSpecTemplateId(),newTenantId);
|
|
|
+ if (CollectionUtils.isNotEmpty(specIds)){
|
|
|
+ //删除关联信息
|
|
|
+ List<Long> specAttrIds = goodsSpecAttributeService.getIdsByTenant(specIds);
|
|
|
+ if (CollectionUtils.isNotEmpty(specAttrIds)){
|
|
|
+ goodsSpecAttributeService.deleteByIdsTenant(specAttrIds);
|
|
|
+ goodsSpecAttributeRelationService.deleteByTemplateIdTenant(newSpecTemplate.getSpecTemplateId(),newTenantId);
|
|
|
+ }
|
|
|
+ goodsSpecService.deleteByIdsTenant(specIds);
|
|
|
+ }
|
|
|
+ //新增关联
|
|
|
+ List<GoodsSpec> specList = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>()
|
|
|
+ .eq(GoodsSpec::getSpecTemplateId, specTemplate.getSpecTemplateId()));
|
|
|
+ if (CollectionUtils.isNotEmpty(specList)){
|
|
|
+ specList.forEach(item -> {
|
|
|
+ Long oldSpecId = item.getSpecId();
|
|
|
+ item.setSpecId(null);
|
|
|
+ item.setSpecTemplateId(newSpecTemplate.getSpecTemplateId());
|
|
|
+ item.setTenantId(newTenantId);
|
|
|
+ goodsSpecService.save(item);
|
|
|
+ List<GoodsSpecAttribute> specAttributeList = goodsSpecAttributeService
|
|
|
+ .list(new LambdaQueryWrapper<GoodsSpecAttribute>()
|
|
|
+ .eq(GoodsSpecAttribute::getSpecId, oldSpecId));
|
|
|
+ if (CollectionUtils.isNotEmpty(specAttributeList)){
|
|
|
+ List<GoodsSpecAttributeRelation> relationList = goodsSpecAttributeRelationService
|
|
|
+ .list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
|
|
|
+ .eq(GoodsSpecAttributeRelation::getSpecTemplateId, specTemplate.getSpecTemplateId()));
|
|
|
+ if (CollectionUtils.isNotEmpty(relationList)){
|
|
|
+ newRelationList.addAll(relationList);
|
|
|
+ }
|
|
|
+ List<GoodsSpecAttribute> collect = specAttributeList.stream().map(attrItem -> {
|
|
|
+ attrItem.setSpecAttributeId(null);
|
|
|
+ attrItem.setSpecId(item.getSpecId());
|
|
|
+ attrItem.setTenantId(newTenantId);
|
|
|
+ return attrItem;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ goodsSpecAttributeService.saveBatch(collect);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ }else {
|
|
|
+ Long oldSpecTemplateId = specTemplate.getSpecTemplateId();
|
|
|
+ //新增
|
|
|
+ specTemplate.setSpecTemplateId(null);
|
|
|
+ specTemplate.setTenantId(newTenantId);
|
|
|
+ goodsSpecTemplateService.save(specTemplate);
|
|
|
+ //新增关联
|
|
|
+ List<GoodsSpec> specList = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>()
|
|
|
+ .eq(GoodsSpec::getSpecTemplateId, oldSpecTemplateId));
|
|
|
+ if (CollectionUtils.isNotEmpty(specList)){
|
|
|
+ specList.forEach(item -> {
|
|
|
+ Long oldSpecId = item.getSpecId();
|
|
|
+ item.setSpecId(null);
|
|
|
+ item.setSpecTemplateId(specTemplate.getSpecTemplateId());
|
|
|
+ item.setTenantId(newTenantId);
|
|
|
+ goodsSpecService.save(item);
|
|
|
+ List<GoodsSpecAttribute> specAttributeList = goodsSpecAttributeService
|
|
|
+ .list(new LambdaQueryWrapper<GoodsSpecAttribute>()
|
|
|
+ .eq(GoodsSpecAttribute::getSpecId, oldSpecId));
|
|
|
+ if (CollectionUtils.isNotEmpty(specAttributeList)){
|
|
|
+ List<GoodsSpecAttributeRelation> relationList = goodsSpecAttributeRelationService
|
|
|
+ .list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
|
|
|
+ .eq(GoodsSpecAttributeRelation::getSpecTemplateId,oldSpecTemplateId));
|
|
|
+ if (CollectionUtils.isNotEmpty(relationList)){
|
|
|
+ newRelationList.addAll(relationList);
|
|
|
+ }
|
|
|
+ List<GoodsSpecAttribute> collect = specAttributeList.stream().map(attrItem -> {
|
|
|
+ attrItem.setSpecAttributeId(null);
|
|
|
+ attrItem.setSpecId(item.getSpecId());
|
|
|
+ attrItem.setTenantId(newTenantId);
|
|
|
+ return attrItem;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ goodsSpecAttributeService.saveBatch(collect);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //商品课程
|
|
|
+
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void disposeGoodsCourse(Goods goods,Long newTenantId){
|
|
|
+ List<GoodsCourse> goodsCourseList = iGoodsCourseService
|
|
|
+ .list(new LambdaQueryWrapper<GoodsCourse>()
|
|
|
+ .eq(GoodsCourse::getGoodsId, goods.getGoodsId()));
|
|
|
+ for (GoodsCourse goodsCourse : goodsCourseList) {
|
|
|
+ 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 {
|
|
|
+ course.setCourseId(null);
|
|
|
+ course.setTenantId(newTenantId);
|
|
|
+ course.setEducationTypeId(getNewEducationTypeId(course.getEducationTypeId(),newTenantId));
|
|
|
+ course.setProjectId(getNewProjectTypeId(course.getProjectId(),newTenantId));
|
|
|
+ course.setSubjectId(getNewSubjectId(course.getSubjectId(), newTenantId));
|
|
|
+ course.setProjectId(getNewProjectTypeId(course.getProjectId(), newTenantId));
|
|
|
+ course.setMajorId(getNewMajorId(course.getMajorId(),newTenantId));
|
|
|
+ iCourseService.save(course);
|
|
|
+ newCourseId = course.getCourseId();
|
|
|
+ }
|
|
|
+ List<CourseMenu> courseMenuList = iCourseMenuService.list(new LambdaQueryWrapper<CourseMenu>()
|
|
|
+ .eq(CourseMenu::getCourseId, oldCourseId));
|
|
|
+ if (CollectionUtils.isNotEmpty(courseMenuList)){
|
|
|
+ for (CourseMenu courseMenu : courseMenuList) {
|
|
|
+ courseMenu.setCourseId(newCourseId);
|
|
|
+ Long menuId = courseMenu.getMenuId();
|
|
|
+ switch (courseMenu.getType()){
|
|
|
+ case 1:
|
|
|
+ //模块
|
|
|
+ CourseModule module = iCourseModuleService.getById(menuId);
|
|
|
+ if (ObjectUtils.isNotNull(module)){
|
|
|
+ CourseModule newModule = iCourseModuleService.getModuleByTenant(module.getCode(),newTenantId);
|
|
|
+ if (ObjectUtils.isNotNull(newModule)){
|
|
|
+ courseMenu.setMenuId(newModule.getTenantId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private Long getNewCertificateId(Long certificateId,Long newTenantId){
|
|
|
+ CertificateCommon certificateCommon = iCertificateCommonService.getById(certificateId);
|
|
|
+ if (ObjectUtils.isNotNull(certificateCommon)){
|
|
|
+ CertificateCommon newCertificateCommon = iCertificateCommonService.getCertificateByTenant(certificateCommon.getCode(),newTenantId);
|
|
|
+ if (ObjectUtils.isNotNull(newCertificateCommon)){
|
|
|
+ return newCertificateCommon.getId();
|
|
|
+ }else {
|
|
|
+ certificateCommon.setId(null);
|
|
|
+ certificateCommon.setTenantId(newTenantId);
|
|
|
+ //证书类型
|
|
|
+ //证书类型
|
|
|
+ if (ObjectUtils.isNotNull(certificateCommon.getCertificateTypeId())){
|
|
|
+ certificateCommon.setCertificateTypeId(getNewCertificateTypeId(certificateCommon.getCertificateTypeId(),newTenantId));
|
|
|
+ }
|
|
|
+ iCertificateCommonService.save(certificateCommon);
|
|
|
+ return certificateCommon.getId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Long getNewCertificateTypeId(Long certificateTypeId,Long newTenantId){
|
|
|
+ Certificate certificate = iCertificateService.getById(certificateTypeId);
|
|
|
+ if (ObjectUtils.isNotNull(certificate)){
|
|
|
+ Certificate newCertificate = iCertificateService.getCertificateByTenant(certificate.getCode(),newTenantId);
|
|
|
+ if (ObjectUtils.isNotNull(newCertificate)){
|
|
|
+ return newCertificate.getId();
|
|
|
+ }else {
|
|
|
+ certificate.setId(null);
|
|
|
+ certificate.setTenantId(newTenantId);
|
|
|
+ iCertificateService.save(certificate);
|
|
|
+ return certificate.getId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Long getNewEducationTypeId(Long oldEducationTypeId,Long newTenantId){
|
|
|
+ //教育类型
|
|
|
+ CourseEducationType educationType = iCourseEducationTypeService.getById(oldEducationTypeId);
|
|
|
+ if (ObjectUtils.isNull(educationType)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ CourseEducationType newEducationType = iCourseEducationTypeService.getEducationTypeBytenant(educationType.getEncoder(), newTenantId);
|
|
|
+ if (ObjectUtil.isNull(newEducationType)){
|
|
|
+ //新增教育类型
|
|
|
+ educationType.setId(null);
|
|
|
+ educationType.setTenantId(newTenantId);
|
|
|
+ iCourseEducationTypeService.save(educationType);
|
|
|
+ return educationType.getId();
|
|
|
+ }
|
|
|
+ return newEducationType.getId();
|
|
|
+ }
|
|
|
+
|
|
|
+ private Long getNewProjectTypeId(Long projectTypeId,Long newTenantId){
|
|
|
+ //项目类型
|
|
|
+ CourseProjectType project = iCourseProjectTypeService.getById(projectTypeId);
|
|
|
+ if (ObjectUtils.isNull(project)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ CourseProjectType newProject = iCourseProjectTypeService.getProjectByTenant(project.getEncoder(),newTenantId);
|
|
|
+ if (ObjectUtil.isNull(newProject)){
|
|
|
+ //新增项目类型
|
|
|
+ project.setId(null);
|
|
|
+ project.setTenantId(newTenantId);
|
|
|
+ //教育类型
|
|
|
+ Long newEducationTypeId = getNewEducationTypeId(project.getEducationId().longValue(), newTenantId);
|
|
|
+ project.setEducationId(newEducationTypeId.intValue());
|
|
|
+ iCourseProjectTypeService.save(project);
|
|
|
+
|
|
|
+ return project.getId();
|
|
|
+ }
|
|
|
+ return newProject.getId();
|
|
|
+ }
|
|
|
+
|
|
|
+ private Long getNewMajorId(Long majorId,Long newTenantId){
|
|
|
+ //专业
|
|
|
+ Major major = iMajorService.getById(majorId);
|
|
|
+ if (ObjectUtils.isNull(major)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ Major newMajor = iMajorService.getMajorByTenant(major.getEncoder(), newTenantId);
|
|
|
+ if (ObjectUtil.isNull(newMajor)){
|
|
|
+ //新增专业
|
|
|
+ major.setId(null);
|
|
|
+ major.setTenantId(newTenantId);
|
|
|
+ iMajorService.save(major);
|
|
|
+
|
|
|
+ return major.getId();
|
|
|
+ }
|
|
|
+ return newMajor.getId();
|
|
|
+ }
|
|
|
+
|
|
|
+ private Long getNewBusinessId(Long businessId,Long newTenantId){
|
|
|
+ //业务层次
|
|
|
+ CourseBusiness business = iCourseBusinessService.getById(businessId);
|
|
|
+ if (ObjectUtils.isNull(business)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ CourseBusiness newBusiness = iCourseBusinessService.getBusinessByTenant(business.getEncoder(),newTenantId);
|
|
|
+ if (ObjectUtil.isNull(newBusiness)){
|
|
|
+ //新增业务层次
|
|
|
+ business.setId(null);
|
|
|
+ business.setTenantId(newTenantId);
|
|
|
+ iCourseBusinessService.save(business);
|
|
|
+ return business.getId();
|
|
|
+ }
|
|
|
+ return newBusiness.getId();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private Long getNewSubjectId(Long subjectId,Long newTenantId){
|
|
|
+ //业务层次
|
|
|
+ CourseSubject courseSubject = iCourseSubjectService.getById(subjectId);
|
|
|
+ if (ObjectUtils.isNull(courseSubject)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ CourseSubject newCourseSubject = iCourseSubjectService.getSubjectByTenant(courseSubject.getEncoder(),newTenantId);
|
|
|
+ if (ObjectUtil.isNull(newCourseSubject)){
|
|
|
+ //业务项目关联
|
|
|
+ List<CourseSubjectProject> projectList = iCourseSubjectProjectService
|
|
|
+ .list(new LambdaQueryWrapper<CourseSubjectProject>()
|
|
|
+ .eq(CourseSubjectProject::getSubjectId, courseSubject.getId()));
|
|
|
+ //新增业务层次
|
|
|
+ courseSubject.setId(null);
|
|
|
+ courseSubject.setTenantId(newTenantId);
|
|
|
+ iCourseSubjectService.save(courseSubject);
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(projectList)){
|
|
|
+ List<CourseSubjectProject> collect = projectList.stream().map(item -> {
|
|
|
+ item.setId(null);
|
|
|
+ item.setSubjectId(courseSubject.getId());
|
|
|
+ //项目ID
|
|
|
+ Long newProjectTypeId = getNewProjectTypeId(item.getProjectId(), newTenantId);
|
|
|
+ item.setProjectId(newProjectTypeId);
|
|
|
+ item.setTenantId(newTenantId);
|
|
|
+ return item;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ iCourseSubjectProjectService.saveBatch(collect);
|
|
|
+ }
|
|
|
+ return courseSubject.getId();
|
|
|
+ }
|
|
|
+ return newCourseSubject.getId();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@@ -2278,6 +2807,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean goodsBatchCopyDisposeTenant() {
|
|
|
@@ -2797,6 +3328,23 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ private final String KEY_PREFIX = "GOODS_SHARE";
|
|
|
+ @Override
|
|
|
+ public List<GoodsVo> getShareList(Long time) {
|
|
|
+ String key = KEY_PREFIX+time;
|
|
|
+ Object obj = redisCache.getCacheObjectNoTenant(key);
|
|
|
+ if (ObjectUtils.isNull(obj)){
|
|
|
+ throw new CustomException("商品信息异常,请重新生成二维码!");
|
|
|
+ }
|
|
|
+ List<Long> goodsIds = Arrays.asList(obj.toString().split(",")).stream().map(x -> Long.valueOf(x)).collect(Collectors.toList());
|
|
|
+ //获取商品列表
|
|
|
+ List<Goods> goodsList = listByIds(goodsIds);
|
|
|
+ if (CollectionUtils.isEmpty(goodsList)){
|
|
|
+ throw new CustomException("商品信息获取异常");
|
|
|
+ }
|
|
|
+ return goodsList.stream().map(item -> BeanUtil.toBean(item,GoodsVo.class)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
private Long getNewId(Long oldId, Integer type){
|
|
|
if (ObjectUtils.isNull(oldId) || oldId <= 0L){
|
|
|
return null;
|