|
@@ -42,6 +42,8 @@ import com.zhongzheng.modules.goods.service.*;
|
|
import com.zhongzheng.modules.goods.vo.*;
|
|
import com.zhongzheng.modules.goods.vo.*;
|
|
import com.zhongzheng.modules.grade.vo.ClassGradeVo;
|
|
import com.zhongzheng.modules.grade.vo.ClassGradeVo;
|
|
import com.zhongzheng.modules.grade.vo.SyncGoodsExport;
|
|
import com.zhongzheng.modules.grade.vo.SyncGoodsExport;
|
|
|
|
+import com.zhongzheng.modules.inform.domain.InformRemind;
|
|
|
|
+import com.zhongzheng.modules.inform.service.IInformRemindService;
|
|
import com.zhongzheng.modules.order.domain.OrderGoods;
|
|
import com.zhongzheng.modules.order.domain.OrderGoods;
|
|
import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
import com.zhongzheng.modules.pay.domain.PayServe;
|
|
import com.zhongzheng.modules.pay.domain.PayServe;
|
|
@@ -66,6 +68,8 @@ import com.zhongzheng.modules.user.service.IUserService;
|
|
import com.zhongzheng.modules.user.service.IUserStudyRecordService;
|
|
import com.zhongzheng.modules.user.service.IUserStudyRecordService;
|
|
import com.zhongzheng.modules.user.vo.SubjectStudyRecordVo;
|
|
import com.zhongzheng.modules.user.vo.SubjectStudyRecordVo;
|
|
import net.polyv.common.v1.util.StringUtils;
|
|
import net.polyv.common.v1.util.StringUtils;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -237,12 +241,17 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
@Autowired
|
|
@Autowired
|
|
private IPayServeService iPayServeService;
|
|
private IPayServeService iPayServeService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IInformRemindService iInformRemindService;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private ISysGoodsCopyRecordService iGoodsCopyRecordService;
|
|
private ISysGoodsCopyRecordService iGoodsCopyRecordService;
|
|
|
|
|
|
@Value("${oldStudySys.educationalInspector}")
|
|
@Value("${oldStudySys.educationalInspector}")
|
|
private String INFORM_PATH;
|
|
private String INFORM_PATH;
|
|
|
|
|
|
|
|
+ private static Logger log = LoggerFactory.getLogger(GoodsServiceImpl.class);
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public GoodsVo queryById(Long goodsId) {
|
|
public GoodsVo queryById(Long goodsId) {
|
|
Goods db = this.baseMapper.selectById(goodsId);
|
|
Goods db = this.baseMapper.selectById(goodsId);
|
|
@@ -983,7 +992,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
}
|
|
}
|
|
|
|
|
|
List<User> users = iUserService.getUserByTelNotTenant(bo.getTelphone());
|
|
List<User> users = iUserService.getUserByTelNotTenant(bo.getTelphone());
|
|
- if (CollectionUtils.isNotEmpty(users)) {
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(users)) {
|
|
throw new CustomException("通过手机号获取用户信息失败");
|
|
throw new CustomException("通过手机号获取用户信息失败");
|
|
}
|
|
}
|
|
//获取用户订单商品信息
|
|
//获取用户订单商品信息
|
|
@@ -1037,18 +1046,16 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
}
|
|
}
|
|
|
|
|
|
//获取小程序appID
|
|
//获取小程序appID
|
|
- SysConfig sysConfig = iSysConfigService.getOne(new LambdaQueryWrapper<SysConfig>()
|
|
|
|
- .eq(SysConfig::getConfigKey, "wx.small.appid")
|
|
|
|
- .eq(SysConfig::getTenantId, goodsVo.getTenantId()));
|
|
|
|
- if (ObjectUtils.isNull(sysConfig)) {
|
|
|
|
- throw new CustomException("获取小程序appId失败");
|
|
|
|
|
|
+ SysConfig sysConfig = iSysConfigService.getSysConfigByKeyTenant("wx.small.appid",goodsVo.getTenantId());
|
|
|
|
+ if (ObjectUtils.isNotNull(sysConfig)) {
|
|
|
|
+ goodsVo.setWeAppId(sysConfig.getConfigValue());
|
|
}
|
|
}
|
|
//课程
|
|
//课程
|
|
List<Long> courseIds = iGoodsCourseService.getCourseIdsByGoodsAndTenant(goodsVo.getGoodsId(), goodsVo.getTenantId());
|
|
List<Long> courseIds = iGoodsCourseService.getCourseIdsByGoodsAndTenant(goodsVo.getGoodsId(), goodsVo.getTenantId());
|
|
if (CollectionUtils.isNotEmpty(courseIds) && courseIds.size() == 1) {
|
|
if (CollectionUtils.isNotEmpty(courseIds) && courseIds.size() == 1) {
|
|
goodsVo.setCourseId(courseIds.get(0));
|
|
goodsVo.setCourseId(courseIds.get(0));
|
|
}
|
|
}
|
|
- goodsVo.setWeAppId(sysConfig.getConfigValue());
|
|
|
|
|
|
+
|
|
if (goodsVo.getCourseType() == 2) {
|
|
if (goodsVo.getCourseType() == 2) {
|
|
//题库
|
|
//题库
|
|
goodsVo.setToWeAppPagePath("/pages/questionBank/index");
|
|
goodsVo.setToWeAppPagePath("/pages/questionBank/index");
|
|
@@ -1155,7 +1162,12 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
// String domainH5 = "https://h.xyyxt.net";
|
|
// String domainH5 = "https://h.xyyxt.net";
|
|
String domain = "https://zzyxt.gdzzkj.net/";
|
|
String domain = "https://zzyxt.gdzzkj.net/";
|
|
String domainH5 = "https://h.gdzzkj.net";
|
|
String domainH5 = "https://h.gdzzkj.net";
|
|
- GoodsVo goods = baseMapper.queryGoodsByIdTenant(bo.getGoodsId(), bo.getTenantId());
|
|
|
|
|
|
+ Long tenantId = 867735392558919680L; //祥粤云
|
|
|
|
+ if (ObjectUtils.isNotNull(bo.getTenantId()) && bo.getTenantId().equals(tenantId)){
|
|
|
|
+ domain = "https://web.xyyxt.net/";
|
|
|
|
+ domainH5 = "https://h.xyyxt.net";
|
|
|
|
+ }
|
|
|
|
+ Goods goods = baseMapper.queryGoodsByIdTenant(bo.getGoodsId(), bo.getTenantId());
|
|
if (ObjectUtils.isNull(goods)) {
|
|
if (ObjectUtils.isNull(goods)) {
|
|
throw new CustomException("商品不存在!");
|
|
throw new CustomException("商品不存在!");
|
|
}
|
|
}
|
|
@@ -1206,6 +1218,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
UserPhoneBo phoneBo = new UserPhoneBo();
|
|
UserPhoneBo phoneBo = new UserPhoneBo();
|
|
phoneBo.setTelphone(user.getTelphone());
|
|
phoneBo.setTelphone(user.getTelphone());
|
|
phoneBo.setTenantId(bo.getTenantId());
|
|
phoneBo.setTenantId(bo.getTenantId());
|
|
|
|
+ log.info(String.format("旧系统获取商品学习中心路径:%s(url),%s(tenantId)",url,bo.getTenantId()));
|
|
//缓存用户手机号码 30分钟失效
|
|
//缓存用户手机号码 30分钟失效
|
|
redisCache.setCacheObjectTenant(nowTime.toString(), JSONObject.toJSONString(phoneBo), 30, TimeUnit.MINUTES);
|
|
redisCache.setCacheObjectTenant(nowTime.toString(), JSONObject.toJSONString(phoneBo), 30, TimeUnit.MINUTES);
|
|
return url;
|
|
return url;
|
|
@@ -1214,323 +1227,373 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
public boolean goodsBatchCopyIncrementTenant(GoodsBatchCopyTenantBo bo) {
|
|
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;
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(bo.getGoodsIds()) && bo.getGoodsIds().size() > 10){
|
|
|
|
+ throw new CustomException("商品复制一次最多10条!");
|
|
}
|
|
}
|
|
- Long tenantId = 867735392558919680L;
|
|
|
|
- Long newTenantId = bo.getTenantId();
|
|
|
|
- List<GoodsSpecAttributeRelation> newRelationList = new ArrayList<>();
|
|
|
|
- List<SysGoodsCopyRecord> recordList = new ArrayList<>();
|
|
|
|
- for (Goods goods : goodsList) {
|
|
|
|
- Long oldGoodsId = goods.getGoodsId();
|
|
|
|
- //判断商品是否存在
|
|
|
|
- Long newGoodsId = getNewId(goods.getGoodsId(), GoodsCopyEnum.GOODS.getType());
|
|
|
|
|
|
+ String key = "GOODS_COPY";
|
|
|
|
+ Object object = redisCache.getCacheObject(key);
|
|
|
|
+ if (ObjectUtils.isNotNull(object)){
|
|
|
|
+ throw new CustomException("存在商品正在复制中,请稍后重试!");
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ redisCache.setCacheObject(key,DateUtils.getNowTime(),30,TimeUnit.MINUTES);
|
|
|
|
+ //获取商品信息
|
|
|
|
+ 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<>();
|
|
|
|
+ List<SysGoodsCopyRecord> recordList = new ArrayList<>();
|
|
|
|
+ for (Goods goods : goodsList) {
|
|
|
|
+ Long oldGoodsId = goods.getGoodsId();
|
|
|
|
+ //判断商品是否存在
|
|
|
|
+ Long newGoodsId = getNewIdByTenant(goods.getGoodsId(), GoodsCopyEnum.GOODS.getType(),newTenantId);
|
|
// Goods newGoods = this.baseMapper.queryGoodsByTenant(goods.getCode(),newTenantId);
|
|
// Goods newGoods = this.baseMapper.queryGoodsByTenant(goods.getCode(),newTenantId);
|
|
- if (ObjectUtils.isNull(newGoodsId)){
|
|
|
|
- //不存在(新增)
|
|
|
|
- goods.setGoodsId(null);
|
|
|
|
- goods.setTenantId(newTenantId);
|
|
|
|
- }else {
|
|
|
|
- //修改
|
|
|
|
- goods.setGoodsId(newGoodsId);
|
|
|
|
- goods.setTenantId(newTenantId);
|
|
|
|
- }
|
|
|
|
|
|
+ if (ObjectUtils.isNull(newGoodsId)){
|
|
|
|
+ //不存在(新增)
|
|
|
|
+ goods.setGoodsId(null);
|
|
|
|
+ goods.setTenantId(newTenantId);
|
|
|
|
+ }else {
|
|
|
|
+ //修改
|
|
|
|
+ goods.setGoodsId(newGoodsId);
|
|
|
|
+ goods.setTenantId(newTenantId);
|
|
|
|
+ }
|
|
|
|
|
|
- //供应方ID
|
|
|
|
- if (ObjectUtil.isNotNull(goods.getSupplyId())){
|
|
|
|
- PaySupply supply = iPaySupplyService.getById(goods.getSupplyId());
|
|
|
|
- if (ObjectUtils.isNotNull(supply)){
|
|
|
|
- Long oldSupplyId = supply.getSupplyId();
|
|
|
|
- //新机构是否存在
|
|
|
|
- Long newSupplyId = getNewId(supply.getSupplyId(), GoodsCopyEnum.PAY_SUPPLY.getType());
|
|
|
|
- if (ObjectUtil.isNotNull(newSupplyId)){
|
|
|
|
- goods.setSupplyId(newSupplyId);
|
|
|
|
- }else {
|
|
|
|
- supply.setSupplyId(null);
|
|
|
|
- supply.setTenantId(newTenantId);
|
|
|
|
- //服务类型ID
|
|
|
|
- if (ObjectUtil.isNotNull(supply.getServerId())){
|
|
|
|
- PayServe payServe = iPayServeService.getById(supply.getServerId());
|
|
|
|
- Long oldServeId = payServe.getServeId();
|
|
|
|
- if (ObjectUtils.isNotNull(payServe)){
|
|
|
|
- Long newPayServerId = getNewId(payServe.getServeId(), GoodsCopyEnum.PAY_SERVE.getType());
|
|
|
|
- if (ObjectUtils.isNotNull(newPayServerId)){
|
|
|
|
- supply.setServerId(newPayServerId);
|
|
|
|
- }else {
|
|
|
|
- //新增服务
|
|
|
|
- payServe.setServeId(null);
|
|
|
|
- payServe.setTenantId(newTenantId);
|
|
|
|
- iPayServeService.save(payServe);
|
|
|
|
- supply.setServerId(payServe.getServeId());
|
|
|
|
- addSysGoodsRecord(oldServeId,payServe.getServeId(),GoodsCopyEnum.PAY_SERVE.getType(),newTenantId,recordList);
|
|
|
|
|
|
+ //供应方ID
|
|
|
|
+ if (ObjectUtil.isNotNull(goods.getSupplyId())){
|
|
|
|
+ PaySupply supply = iPaySupplyService.getById(goods.getSupplyId());
|
|
|
|
+ if (ObjectUtils.isNotNull(supply)){
|
|
|
|
+ Long oldSupplyId = supply.getSupplyId();
|
|
|
|
+ //新机构是否存在
|
|
|
|
+ Long newSupplyId = getNewIdByTenant(supply.getSupplyId(), GoodsCopyEnum.PAY_SUPPLY.getType(),newTenantId);
|
|
|
|
+ if (ObjectUtil.isNotNull(newSupplyId)){
|
|
|
|
+ goods.setSupplyId(newSupplyId);
|
|
|
|
+ }else {
|
|
|
|
+ supply.setSupplyId(null);
|
|
|
|
+ supply.setTenantId(newTenantId);
|
|
|
|
+ //服务类型ID
|
|
|
|
+ if (ObjectUtil.isNotNull(supply.getServerId())){
|
|
|
|
+ PayServe payServe = iPayServeService.getById(supply.getServerId());
|
|
|
|
+ Long oldServeId = payServe.getServeId();
|
|
|
|
+ if (ObjectUtils.isNotNull(payServe)){
|
|
|
|
+ Long newPayServerId = getNewIdByTenant(payServe.getServeId(), GoodsCopyEnum.PAY_SERVE.getType(),newTenantId);
|
|
|
|
+ if (ObjectUtils.isNotNull(newPayServerId)){
|
|
|
|
+ supply.setServerId(newPayServerId);
|
|
|
|
+ }else {
|
|
|
|
+ //新增服务
|
|
|
|
+ payServe.setServeId(null);
|
|
|
|
+ payServe.setTenantId(newTenantId);
|
|
|
|
+ iPayServeService.save(payServe);
|
|
|
|
+ supply.setServerId(payServe.getServeId());
|
|
|
|
+ addSysGoodsRecord(oldServeId,payServe.getServeId(),GoodsCopyEnum.PAY_SERVE.getType(),newTenantId,recordList);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ iPaySupplyService.save(supply);
|
|
|
|
+ goods.setSupplyId(supply.getSupplyId());
|
|
|
|
+ addSysGoodsRecord(oldSupplyId,supply.getSupplyId(),GoodsCopyEnum.PAY_SUPPLY.getType(),newTenantId,recordList);
|
|
}
|
|
}
|
|
- iPaySupplyService.save(supply);
|
|
|
|
- goods.setSupplyId(supply.getSupplyId());
|
|
|
|
- addSysGoodsRecord(oldSupplyId,supply.getSupplyId(),GoodsCopyEnum.PAY_SUPPLY.getType(),newTenantId,recordList);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- //教育类型
|
|
|
|
- if (ObjectUtil.isNotNull(goods.getEducationTypeId())){
|
|
|
|
- goods.setEducationTypeId(getNewEducationTypeId(goods.getEducationTypeId(),newTenantId,recordList));
|
|
|
|
- }
|
|
|
|
|
|
+ //教育类型
|
|
|
|
+ if (ObjectUtil.isNotNull(goods.getEducationTypeId())){
|
|
|
|
+ goods.setEducationTypeId(getNewEducationTypeId(goods.getEducationTypeId(),newTenantId,recordList));
|
|
|
|
+ }
|
|
|
|
|
|
- //业务层次
|
|
|
|
- if (ObjectUtil.isNotNull(goods.getBusinessId())){
|
|
|
|
- goods.setBusinessId(getNewBusinessId(goods.getBusinessId(),newTenantId,recordList));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //所属院校
|
|
|
|
- if (ObjectUtil.isNotNull(goods.getSchoolId())){
|
|
|
|
- School school = iSchoolService.getById(goods.getSchoolId());
|
|
|
|
- if (ObjectUtil.isNotNull(school)){
|
|
|
|
- Long oid = school.getId();
|
|
|
|
- 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());
|
|
|
|
- addSysGoodsRecord(oid,school.getId(),GoodsCopyEnum.SCHOOL.getType(),newTenantId,recordList);
|
|
|
|
|
|
+ //业务层次
|
|
|
|
+ if (ObjectUtil.isNotNull(goods.getBusinessId())){
|
|
|
|
+ goods.setBusinessId(getNewBusinessId(goods.getBusinessId(),newTenantId,recordList));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //所属院校
|
|
|
|
+ if (ObjectUtil.isNotNull(goods.getSchoolId())){
|
|
|
|
+ School school = iSchoolService.getById(goods.getSchoolId());
|
|
|
|
+ if (ObjectUtil.isNotNull(school)){
|
|
|
|
+ Long oid = school.getId();
|
|
|
|
+ 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());
|
|
|
|
+ addSysGoodsRecord(oid,school.getId(),GoodsCopyEnum.SCHOOL.getType(),newTenantId,recordList);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- //所属专业
|
|
|
|
- if (ObjectUtil.isNotNull(goods.getMajorId())){
|
|
|
|
- goods.setMajorId(getNewMajorId(goods.getMajorId(),newTenantId,recordList));
|
|
|
|
- }
|
|
|
|
|
|
+ //所属专业
|
|
|
|
+ if (ObjectUtil.isNotNull(goods.getMajorId())){
|
|
|
|
+ goods.setMajorId(getNewMajorId(goods.getMajorId(),newTenantId,recordList));
|
|
|
|
+ }
|
|
|
|
|
|
- //项目
|
|
|
|
- if (ObjectUtil.isNotNull(goods.getProjectId())){
|
|
|
|
- goods.setProjectId(getNewProjectTypeId(goods.getProjectId().longValue(),newTenantId,recordList).intValue());
|
|
|
|
- }
|
|
|
|
|
|
+ //项目
|
|
|
|
+ if (ObjectUtil.isNotNull(goods.getProjectId())){
|
|
|
|
+ goods.setProjectId(getNewProjectTypeId(goods.getProjectId().longValue(),newTenantId,recordList).intValue());
|
|
|
|
+ }
|
|
|
|
|
|
- //讲义
|
|
|
|
- if (ObjectUtil.isNotNull(goods.getHandoutsId())){
|
|
|
|
- CourseHandouts courseHandouts = iCourseHandoutsService.getById(goods.getHandoutsId());
|
|
|
|
- if (ObjectUtil.isNotNull(courseHandouts)){
|
|
|
|
- Long oid = courseHandouts.getHandoutsId();
|
|
|
|
- Long newId = getNewId(oid, GoodsCopyEnum.COURSE_HANDOUTS.getType());
|
|
|
|
|
|
+ //讲义
|
|
|
|
+ if (ObjectUtil.isNotNull(goods.getHandoutsId())){
|
|
|
|
+ CourseHandouts courseHandouts = iCourseHandoutsService.getById(goods.getHandoutsId());
|
|
|
|
+ if (ObjectUtil.isNotNull(courseHandouts)){
|
|
|
|
+ Long oid = courseHandouts.getHandoutsId();
|
|
|
|
+ Long newId = getNewIdByTenant(oid, GoodsCopyEnum.COURSE_HANDOUTS.getType(),newTenantId);
|
|
// CourseHandouts newCourseHandouts = iCourseHandoutsService.getHandoutsByTenant(courseHandouts.getEncoder(),newTenantId);
|
|
// CourseHandouts newCourseHandouts = iCourseHandoutsService.getHandoutsByTenant(courseHandouts.getEncoder(),newTenantId);
|
|
- if (ObjectUtil.isNotNull(newId)){
|
|
|
|
- goods.setHandoutsId(newId);
|
|
|
|
- }else {
|
|
|
|
- //讲义业务层次
|
|
|
|
- List<CourseHandoutsBusiness> handoutsBusinessList = iCourseHandoutsBusinessService
|
|
|
|
- .list(new LambdaQueryWrapper<CourseHandoutsBusiness>()
|
|
|
|
- .eq(CourseHandoutsBusiness::getHandoutsId, courseHandouts.getHandoutsId()));
|
|
|
|
- courseHandouts.setHandoutsId(null);
|
|
|
|
- courseHandouts.setTenantId(newTenantId);
|
|
|
|
- iCourseHandoutsService.save(courseHandouts);
|
|
|
|
- addSysGoodsRecord(oid,courseHandouts.getHandoutsId(),GoodsCopyEnum.COURSE_HANDOUTS.getType(),newTenantId,recordList);
|
|
|
|
- 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,recordList));
|
|
|
|
- //业务
|
|
|
|
- business.setBusinessId(getNewBusinessId(business.getBusinessId(), newTenantId,recordList));
|
|
|
|
- //科目
|
|
|
|
- business.setSubjectId(getNewSubjectId(business.getSubjectId(), newTenantId,recordList));
|
|
|
|
- //讲义
|
|
|
|
- business.setHandoutsId(courseHandouts.getHandoutsId());
|
|
|
|
- return business;
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
- iCourseHandoutsBusinessService.saveBatch(collect);
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(newId)){
|
|
|
|
+ goods.setHandoutsId(newId);
|
|
|
|
+ }else {
|
|
|
|
+ //讲义业务层次
|
|
|
|
+ List<CourseHandoutsBusiness> handoutsBusinessList = iCourseHandoutsBusinessService
|
|
|
|
+ .list(new LambdaQueryWrapper<CourseHandoutsBusiness>()
|
|
|
|
+ .eq(CourseHandoutsBusiness::getHandoutsId, courseHandouts.getHandoutsId()));
|
|
|
|
+ courseHandouts.setHandoutsId(null);
|
|
|
|
+ courseHandouts.setTenantId(newTenantId);
|
|
|
|
+ iCourseHandoutsService.save(courseHandouts);
|
|
|
|
+ addSysGoodsRecord(oid,courseHandouts.getHandoutsId(),GoodsCopyEnum.COURSE_HANDOUTS.getType(),newTenantId,recordList);
|
|
|
|
+ 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,recordList));
|
|
|
|
+ //业务
|
|
|
|
+ business.setBusinessId(getNewBusinessId(business.getBusinessId(), newTenantId,recordList));
|
|
|
|
+ //科目
|
|
|
|
+ business.setSubjectId(getNewSubjectId(business.getSubjectId(), newTenantId,recordList));
|
|
|
|
+ //讲义
|
|
|
|
+ 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,recordList);
|
|
|
|
- if (ObjectUtils.isNotNull(newSubjectId)){
|
|
|
|
- subIds.add(newSubjectId);
|
|
|
|
|
|
+ //科目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,recordList);
|
|
|
|
+ if (ObjectUtils.isNotNull(newSubjectId)){
|
|
|
|
+ subIds.add(newSubjectId);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ if (CollectionUtils.isNotEmpty(subIds)){
|
|
|
|
+ goods.setSubjectIds(subIds.stream().map(x -> x.toString()).collect(Collectors.joining(",")));
|
|
}
|
|
}
|
|
- });
|
|
|
|
- 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,recordList));
|
|
|
|
- }
|
|
|
|
|
|
+ //证书类型
|
|
|
|
+ if (ObjectUtils.isNotNull(goods.getCertificateTypeId())){
|
|
|
|
+ goods.setCertificateTypeId(getNewCertificateTypeId(goods.getCertificateTypeId(),newTenantId,recordList));
|
|
|
|
+ }
|
|
|
|
|
|
- //证书
|
|
|
|
- if (ObjectUtils.isNotNull(goods.getCertificateId())){
|
|
|
|
- goods.setCertificateId(getNewCertificateId(goods.getCertificateId(),newTenantId,recordList));
|
|
|
|
- }
|
|
|
|
|
|
+ //证书
|
|
|
|
+ if (ObjectUtils.isNotNull(goods.getCertificateId())){
|
|
|
|
+ goods.setCertificateId(getNewCertificateId(goods.getCertificateId(),newTenantId,recordList));
|
|
|
|
+ }
|
|
|
|
|
|
- //证书模板
|
|
|
|
- if (ObjectUtils.isNotNull(goods.getCertificateTpId())){
|
|
|
|
- goods.setCertificateTpId(getNewCertificateTpId(goods.getCertificateTpId(),newTenantId,recordList));
|
|
|
|
- }
|
|
|
|
|
|
+ //证书模板
|
|
|
|
+ if (ObjectUtils.isNotNull(goods.getCertificateTpId())){
|
|
|
|
+ goods.setCertificateTpId(getNewCertificateTpId(goods.getCertificateTpId(),newTenantId,recordList));
|
|
|
|
+ }
|
|
|
|
|
|
- //规格模板
|
|
|
|
- if (ObjectUtils.isNotNull(goods.getSpecTemplateId())){
|
|
|
|
- Long oldSpecTemplateId = goods.getSpecTemplateId();
|
|
|
|
- Long newSpecTemplateId = getNewId(oldSpecTemplateId,GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType());
|
|
|
|
- GoodsSpecTemplate specTemplate = goodsSpecTemplateService.getById(oldSpecTemplateId);
|
|
|
|
|
|
+ //规格模板
|
|
|
|
+ if (ObjectUtils.isNotNull(goods.getSpecTemplateId())){
|
|
|
|
+ Long oldSpecTemplateId = goods.getSpecTemplateId();
|
|
|
|
+ Long newSpecTemplateId = getNewIdByTenant(oldSpecTemplateId,GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType(),newTenantId);
|
|
|
|
+ GoodsSpecTemplate specTemplate = goodsSpecTemplateService.getById(oldSpecTemplateId);
|
|
// GoodsSpecTemplate newSpecTemplate = goodsSpecTemplateService.getSpecTpByTenant(specTemplate.getName(),specTemplate.getCreateTime(),newTenantId);
|
|
// GoodsSpecTemplate newSpecTemplate = goodsSpecTemplateService.getSpecTpByTenant(specTemplate.getName(),specTemplate.getCreateTime(),newTenantId);
|
|
- if (ObjectUtils.isNotNull(newSpecTemplateId)){
|
|
|
|
- //更新
|
|
|
|
- List<Long> specIds = goodsSpecService.getIdsByTenant(newSpecTemplateId,newTenantId);
|
|
|
|
- if (CollectionUtils.isNotEmpty(specIds)){
|
|
|
|
- //删除关联信息
|
|
|
|
- List<Long> specAttrIds = goodsSpecAttributeService.getIdsByTenant(specIds);
|
|
|
|
- if (CollectionUtils.isNotEmpty(specAttrIds)){
|
|
|
|
- goodsSpecAttributeService.deleteByIdsTenant(specAttrIds);
|
|
|
|
- goodsSpecAttributeRelationService.deleteByTemplateIdTenant(newSpecTemplateId,newTenantId);
|
|
|
|
|
|
+ if (ObjectUtils.isNotNull(newSpecTemplateId)){
|
|
|
|
+ //更新
|
|
|
|
+ List<Long> specIds = goodsSpecService.getIdsByTenant(newSpecTemplateId,newTenantId);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(specIds)){
|
|
|
|
+ //删除关联信息
|
|
|
|
+ List<Long> specAttrIds = goodsSpecAttributeService.getIdsByTenant(specIds);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(specAttrIds)){
|
|
|
|
+ goodsSpecAttributeService.deleteByIdsTenant(specAttrIds);
|
|
|
|
+ iSysGoodsCopyRecordService.deleteByTenantId(specAttrIds,GoodsCopyEnum.GOODS_SPEC_ATTRIBUTE.getType(),newTenantId);
|
|
|
|
+ goodsSpecAttributeRelationService.deleteByTemplateIdTenant(newSpecTemplateId,newTenantId);
|
|
|
|
+ }
|
|
|
|
+ goodsSpecService.deleteByIdsTenant(specIds);
|
|
|
|
+ iSysGoodsCopyRecordService.deleteByTenantId(specIds,GoodsCopyEnum.GOODS_SPEC.getType(),newTenantId);
|
|
}
|
|
}
|
|
- goodsSpecService.deleteByIdsTenant(specIds);
|
|
|
|
|
|
+ }else {
|
|
|
|
+ //新增
|
|
|
|
+ specTemplate.setEducationTypeId(getNewEducationTypeId(specTemplate.getEducationTypeId(),newTenantId,recordList));
|
|
|
|
+ specTemplate.setBusinessId(getNewBusinessId(specTemplate.getBusinessId(), newTenantId,recordList));
|
|
|
|
+ specTemplate.setSpecTemplateId(null);
|
|
|
|
+ specTemplate.setTenantId(newTenantId);
|
|
|
|
+ goodsSpecTemplateService.save(specTemplate);
|
|
|
|
+ newSpecTemplateId = specTemplate.getSpecTemplateId();
|
|
|
|
+ addSysGoodsRecord(oldSpecTemplateId,newSpecTemplateId,GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType(),newTenantId,recordList);
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
- //新增
|
|
|
|
- specTemplate.setEducationTypeId(getNewEducationTypeId(specTemplate.getEducationTypeId(),newTenantId,recordList));
|
|
|
|
- specTemplate.setBusinessId(getNewBusinessId(specTemplate.getBusinessId(), newTenantId,recordList));
|
|
|
|
- specTemplate.setSpecTemplateId(null);
|
|
|
|
- specTemplate.setTenantId(newTenantId);
|
|
|
|
- goodsSpecTemplateService.save(specTemplate);
|
|
|
|
- newSpecTemplateId = specTemplate.getSpecTemplateId();
|
|
|
|
- addSysGoodsRecord(oldSpecTemplateId,newSpecTemplateId,GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType(),newTenantId,recordList);
|
|
|
|
- }
|
|
|
|
|
|
|
|
- //新增关联
|
|
|
|
- List<GoodsSpec> specList = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>()
|
|
|
|
- .eq(GoodsSpec::getSpecTemplateId, oldSpecTemplateId));
|
|
|
|
- if (CollectionUtils.isNotEmpty(specList)){
|
|
|
|
- for (GoodsSpec item : specList) {
|
|
|
|
- Long oldSpecId = item.getSpecId();
|
|
|
|
- item.setSpecId(null);
|
|
|
|
- item.setSpecTemplateId(newSpecTemplateId);
|
|
|
|
- item.setTenantId(newTenantId);
|
|
|
|
- goodsSpecService.save(item);
|
|
|
|
- addSysGoodsRecord(oldSpecId,item.getSpecId(),GoodsCopyEnum.GOODS_SPEC.getType(),newTenantId,recordList);
|
|
|
|
- List<GoodsSpecAttribute> specAttributeList = goodsSpecAttributeService
|
|
|
|
- .list(new LambdaQueryWrapper<GoodsSpecAttribute>()
|
|
|
|
- .eq(GoodsSpecAttribute::getSpecId, oldSpecId));
|
|
|
|
- if (CollectionUtils.isNotEmpty(specAttributeList)){
|
|
|
|
- List<GoodsSpecAttribute> collect = specAttributeList.stream().map(attrItem -> {
|
|
|
|
- attrItem.setSpecAttributeId(null);
|
|
|
|
- attrItem.setSpecId(item.getSpecId());
|
|
|
|
- attrItem.setTenantId(newTenantId);
|
|
|
|
- attrItem.setOId(attrItem.getSpecAttributeId());
|
|
|
|
- return attrItem;
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
- goodsSpecAttributeService.saveBatch(collect);
|
|
|
|
- for (GoodsSpecAttribute attr : collect) {
|
|
|
|
- addSysGoodsRecord(attr.getOId(),attr.getSpecAttributeId(),GoodsCopyEnum.GOODS_SPEC_ATTRIBUTE.getType(),newTenantId,recordList);
|
|
|
|
|
|
+ //新增关联
|
|
|
|
+ List<GoodsSpec> specList = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>()
|
|
|
|
+ .eq(GoodsSpec::getSpecTemplateId, oldSpecTemplateId));
|
|
|
|
+ if (CollectionUtils.isNotEmpty(specList)){
|
|
|
|
+ for (GoodsSpec item : specList) {
|
|
|
|
+ Long oldSpecId = item.getSpecId();
|
|
|
|
+ item.setSpecId(null);
|
|
|
|
+ item.setSpecTemplateId(newSpecTemplateId);
|
|
|
|
+ item.setTenantId(newTenantId);
|
|
|
|
+ goodsSpecService.save(item);
|
|
|
|
+ addSysGoodsRecord(oldSpecId,item.getSpecId(),GoodsCopyEnum.GOODS_SPEC.getType(),newTenantId,recordList);
|
|
|
|
+ List<GoodsSpecAttribute> specAttributeList = goodsSpecAttributeService
|
|
|
|
+ .list(new LambdaQueryWrapper<GoodsSpecAttribute>()
|
|
|
|
+ .eq(GoodsSpecAttribute::getSpecId, oldSpecId));
|
|
|
|
+ if (CollectionUtils.isNotEmpty(specAttributeList)){
|
|
|
|
+ List<GoodsSpecAttribute> collect = specAttributeList.stream().map(attrItem -> {
|
|
|
|
+ attrItem.setOId(attrItem.getSpecAttributeId());
|
|
|
|
+ attrItem.setSpecAttributeId(null);
|
|
|
|
+ attrItem.setSpecId(item.getSpecId());
|
|
|
|
+ attrItem.setTenantId(newTenantId);
|
|
|
|
+ return attrItem;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ goodsSpecAttributeService.saveBatch(collect);
|
|
|
|
+ for (GoodsSpecAttribute attr : collect) {
|
|
|
|
+ addSysGoodsRecord(attr.getOId(),attr.getSpecAttributeId(),GoodsCopyEnum.GOODS_SPEC_ATTRIBUTE.getType(),newTenantId,recordList);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //模板属性值关联
|
|
|
|
+ List<GoodsSpecAttributeRelation> relationList = goodsSpecAttributeRelationService
|
|
|
|
+ .list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
|
|
|
|
+ .eq(GoodsSpecAttributeRelation::getSpecTemplateId,oldSpecTemplateId));
|
|
|
|
+ if (CollectionUtils.isNotEmpty(relationList)){
|
|
|
|
+ newRelationList.addAll(relationList);
|
|
|
|
+ }
|
|
|
|
+ goods.setSpecTemplateId(newSpecTemplateId);
|
|
}
|
|
}
|
|
- //模板属性值关联
|
|
|
|
- List<GoodsSpecAttributeRelation> relationList = goodsSpecAttributeRelationService
|
|
|
|
- .list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
|
|
|
|
- .eq(GoodsSpecAttributeRelation::getSpecTemplateId,oldSpecTemplateId));
|
|
|
|
- if (CollectionUtils.isNotEmpty(relationList)){
|
|
|
|
- newRelationList.addAll(relationList);
|
|
|
|
- }
|
|
|
|
- goods.setSpecTemplateId(newSpecTemplateId);
|
|
|
|
- }
|
|
|
|
|
|
|
|
- if (ObjectUtils.isNull(goods.getGoodsId())){
|
|
|
|
- //新增
|
|
|
|
- save(goods);
|
|
|
|
- addSysGoodsRecord(oldGoodsId,goods.getGoodsId(),GoodsCopyEnum.GOODS.getType(),newTenantId,recordList);
|
|
|
|
- }else {
|
|
|
|
- //修改
|
|
|
|
- baseMapper.updateByTenant(goods);
|
|
|
|
|
|
+ if (ObjectUtils.isNull(goods.getGoodsId())){
|
|
|
|
+ //新增
|
|
|
|
+ save(goods);
|
|
|
|
+ addSysGoodsRecord(oldGoodsId,goods.getGoodsId(),GoodsCopyEnum.GOODS.getType(),newTenantId,recordList);
|
|
|
|
+ }else {
|
|
|
|
+ //修改
|
|
|
|
+ baseMapper.updateByTenant(goods);
|
|
|
|
+ }
|
|
|
|
+ newGoodsId = goods.getGoodsId();
|
|
|
|
+
|
|
|
|
+ //商品课程
|
|
|
|
+ List<CourseMenuExam> newCourseMenuExamList = new ArrayList<>();
|
|
|
|
+ disposeGoodsCourse(oldGoodsId,newGoodsId,newTenantId,newCourseMenuExamList,recordList);
|
|
|
|
+ //课程双师
|
|
|
|
+ disposeGoodsCourseTeacher(oldGoodsId,newGoodsId,newTenantId);
|
|
|
|
+ //商品试卷
|
|
|
|
+ disposeGoodsAttached(oldGoodsId,newGoodsId,newTenantId,recordList);
|
|
|
|
+
|
|
|
|
+ //处理商品试卷
|
|
|
|
+ if (CollectionUtils.isNotEmpty(newCourseMenuExamList)){
|
|
|
|
+ for (CourseMenuExam menuExam : newCourseMenuExamList) {
|
|
|
|
+ menuExam.setExamId(getNewExamId(menuExam.getExamId(),newTenantId,recordList));
|
|
|
|
+ }
|
|
|
|
+ iCourseMenuExamService.saveBatch(newCourseMenuExamList);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- newGoodsId = goods.getGoodsId();
|
|
|
|
|
|
|
|
- //商品课程
|
|
|
|
- List<CourseMenuExam> newCourseMenuExamList = new ArrayList<>();
|
|
|
|
- disposeGoodsCourse(oldGoodsId,newGoodsId,newTenantId,newCourseMenuExamList,recordList);
|
|
|
|
- //商品试卷
|
|
|
|
- disposeGoodsAttached(oldGoodsId,newGoodsId,newTenantId,recordList);
|
|
|
|
-
|
|
|
|
- //处理商品试卷
|
|
|
|
- if (CollectionUtils.isNotEmpty(newCourseMenuExamList)){
|
|
|
|
- for (CourseMenuExam menuExam : newCourseMenuExamList) {
|
|
|
|
- menuExam.setExamId(getNewExamId(menuExam.getExamId(),newTenantId,recordList));
|
|
|
|
- }
|
|
|
|
- iCourseMenuExamService.saveBatch(newCourseMenuExamList);
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(recordList)){
|
|
|
|
+ //保存记录
|
|
|
|
+ iSysGoodsCopyRecordService.saveBatch(recordList);
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- //规格模板商品重新绑定
|
|
|
|
- if (CollectionUtils.isNotEmpty(newRelationList)){
|
|
|
|
- for (GoodsSpecAttributeRelation relation : newRelationList) {
|
|
|
|
- relation.setId(null);
|
|
|
|
- relation.setTenantId(newTenantId);
|
|
|
|
- //模板ID
|
|
|
|
- if (ObjectUtils.isNotNull(relation.getSpecTemplateId())){
|
|
|
|
- GoodsSpecTemplate specTemplate = goodsSpecTemplateService.getById(relation.getSpecTemplateId());
|
|
|
|
- Long newId = getNewId(specTemplate.getSpecTemplateId(), GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType());
|
|
|
|
|
|
+ //规格模板商品重新绑定
|
|
|
|
+ if (CollectionUtils.isNotEmpty(newRelationList)){
|
|
|
|
+ for (GoodsSpecAttributeRelation relation : newRelationList) {
|
|
|
|
+ relation.setId(null);
|
|
|
|
+ relation.setTenantId(newTenantId);
|
|
|
|
+ //模板ID
|
|
|
|
+ if (ObjectUtils.isNotNull(relation.getSpecTemplateId())){
|
|
|
|
+ GoodsSpecTemplate specTemplate = goodsSpecTemplateService.getById(relation.getSpecTemplateId());
|
|
|
|
+ Long newId = getNewIdByTenant(specTemplate.getSpecTemplateId(), GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType(),newTenantId);
|
|
// GoodsSpecTemplate newSpecTemplate = goodsSpecTemplateService.getSpecTpByTenant(specTemplate.getName(),specTemplate.getCreateTime(),newTenantId);
|
|
// GoodsSpecTemplate newSpecTemplate = goodsSpecTemplateService.getSpecTpByTenant(specTemplate.getName(),specTemplate.getCreateTime(),newTenantId);
|
|
- if (ObjectUtils.isNotNull(newId)){
|
|
|
|
- relation.setSpecTemplateId(newId);
|
|
|
|
- }else {
|
|
|
|
- relation.setSpecTemplateId(null);
|
|
|
|
|
|
+ if (ObjectUtils.isNotNull(newId)){
|
|
|
|
+ relation.setSpecTemplateId(newId);
|
|
|
|
+ }else {
|
|
|
|
+ relation.setSpecTemplateId(null);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- //商品ID
|
|
|
|
- if (ObjectUtils.isNotNull(relation.getGoodsId())){
|
|
|
|
- Goods goods = getById(relation.getGoodsId());
|
|
|
|
- Long newId = getNewId(goods.getGoodsId(), GoodsCopyEnum.GOODS.getType());
|
|
|
|
|
|
+ //商品ID
|
|
|
|
+ if (ObjectUtils.isNotNull(relation.getGoodsId())){
|
|
|
|
+ Goods goods = getById(relation.getGoodsId());
|
|
|
|
+ Long newId = getNewIdByTenant(goods.getGoodsId(), GoodsCopyEnum.GOODS.getType(),newTenantId);
|
|
// Goods newGoods = baseMapper.queryGoodsByTenant(goods.getCode(),newTenantId);
|
|
// Goods newGoods = baseMapper.queryGoodsByTenant(goods.getCode(),newTenantId);
|
|
- if (ObjectUtils.isNotNull(newId)){
|
|
|
|
- relation.setGoodsId(newId);
|
|
|
|
- }else {
|
|
|
|
- relation.setGoodsId(null);
|
|
|
|
|
|
+ if (ObjectUtils.isNotNull(newId)){
|
|
|
|
+ relation.setGoodsId(newId);
|
|
|
|
+ }else {
|
|
|
|
+ relation.setGoodsId(null);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- //规格属性IDS
|
|
|
|
- if (StringUtils.isNotBlank(relation.getSpecAttributeIds())){
|
|
|
|
- List<Long> ids = Arrays.asList(relation.getSpecAttributeIds().split(",")).stream().map(x -> Long.valueOf(x)).collect(Collectors.toList());
|
|
|
|
- List<GoodsSpecAttribute> specAttributeList = goodsSpecAttributeService.listByIds(ids);
|
|
|
|
- if (CollectionUtils.isNotEmpty(specAttributeList)){
|
|
|
|
- List<Long> newIds = new ArrayList<>();
|
|
|
|
- specAttributeList.forEach(item -> {
|
|
|
|
- Long newId = getNewId(item.getSpecAttributeId(), GoodsCopyEnum.GOODS_SPEC_ATTRIBUTE.getType());
|
|
|
|
|
|
+ //规格属性IDS
|
|
|
|
+ if (StringUtils.isNotBlank(relation.getSpecAttributeIds())){
|
|
|
|
+ List<Long> ids = Arrays.asList(relation.getSpecAttributeIds().split(",")).stream().map(x -> Long.valueOf(x)).collect(Collectors.toList());
|
|
|
|
+ List<GoodsSpecAttribute> specAttributeList = goodsSpecAttributeService.listByIds(ids);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(specAttributeList)){
|
|
|
|
+ List<Long> newIds = new ArrayList<>();
|
|
|
|
+ specAttributeList.forEach(item -> {
|
|
|
|
+ Long newId = getNewIdByTenant(item.getSpecAttributeId(), GoodsCopyEnum.GOODS_SPEC_ATTRIBUTE.getType(),newTenantId);
|
|
// GoodsSpecAttribute newSpecAttribute = goodsSpecAttributeService.getSpecAttrByTenant(item.getName(),item.getCreateTime(),newTenantId);
|
|
// GoodsSpecAttribute newSpecAttribute = goodsSpecAttributeService.getSpecAttrByTenant(item.getName(),item.getCreateTime(),newTenantId);
|
|
- if (ObjectUtils.isNotNull(newId)){
|
|
|
|
- newIds.add(newId);
|
|
|
|
|
|
+ if (ObjectUtils.isNotNull(newId)){
|
|
|
|
+ newIds.add(newId);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ if (CollectionUtils.isNotEmpty(newIds)){
|
|
|
|
+ relation.setSpecAttributeIds(newIds.stream().map(x -> x.toString()).collect(Collectors.joining(",")));
|
|
}
|
|
}
|
|
- });
|
|
|
|
- if (CollectionUtils.isNotEmpty(newIds)){
|
|
|
|
- relation.setSpecAttributeIds(newIds.stream().map(x -> x.toString()).collect(Collectors.joining(",")));
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ goodsSpecAttributeRelationService.saveBatch(newRelationList);
|
|
}
|
|
}
|
|
|
|
|
|
- goodsSpecAttributeRelationService.saveBatch(newRelationList);
|
|
|
|
|
|
+ redisCache.deleteObject(key);
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ //释放
|
|
|
|
+ redisCache.deleteObject(key);
|
|
|
|
+ log.error("商品增量报错:"+e.getMessage());
|
|
}
|
|
}
|
|
-
|
|
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void disposeGoodsCourseTeacher(Long oldGoodsId, Long newGoodsId, Long newTenantId) {
|
|
|
|
+ //双师关联
|
|
|
|
+ goodsCourseTeacherService.deleteByIdTeanant(newGoodsId,newTenantId);
|
|
|
|
+ List<GoodsCourseTeacher> list = goodsCourseTeacherService
|
|
|
|
+ .list(new LambdaQueryWrapper<GoodsCourseTeacher>()
|
|
|
|
+ .eq(GoodsCourseTeacher::getGoodsId, oldGoodsId));
|
|
|
|
+ if (CollectionUtils.isNotEmpty(list)){
|
|
|
|
+ for (GoodsCourseTeacher teacher : list) {
|
|
|
|
+ teacher.setId(null);
|
|
|
|
+ teacher.setTenantId(newTenantId);
|
|
|
|
+ teacher.setGoodsId(newGoodsId);
|
|
|
|
+ if (StringUtils.isNotBlank(teacher.getCourseIds())){
|
|
|
|
+ String ids = Arrays.asList(teacher.getCourseIds().split(",")).stream().map(x -> {
|
|
|
|
+ Long oid = Long.valueOf(x);
|
|
|
|
+ Long newId = getNewId(oid, GoodsCopyEnum.COURSE.getType());
|
|
|
|
+ return ObjectUtils.isNotNull(newId)?newId.toString() : "";
|
|
|
|
+ }).collect(Collectors.joining(","));
|
|
|
|
+ teacher.setCourseIds(ids);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ goodsCourseTeacherService.saveBatch(list);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
private void addSysGoodsRecord(Long oldId,Long newId,Integer type,Long newTenantId,List<SysGoodsCopyRecord> array){
|
|
private void addSysGoodsRecord(Long oldId,Long newId,Integer type,Long newTenantId,List<SysGoodsCopyRecord> array){
|
|
SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
SysGoodsCopyRecord record = new SysGoodsCopyRecord();
|
|
record.setOldId(oldId);
|
|
record.setOldId(oldId);
|
|
@@ -1589,11 +1652,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
Course course = iCourseService.getById(goodsCourse.getCourseId());
|
|
Course course = iCourseService.getById(goodsCourse.getCourseId());
|
|
if(ObjectUtils.isNotNull(course)){
|
|
if(ObjectUtils.isNotNull(course)){
|
|
Long oldCourseId = course.getCourseId();
|
|
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.setCourseId(null);
|
|
course.setTenantId(newTenantId);
|
|
course.setTenantId(newTenantId);
|
|
course.setEducationTypeId(getNewEducationTypeId(course.getEducationTypeId(),newTenantId,array));
|
|
course.setEducationTypeId(getNewEducationTypeId(course.getEducationTypeId(),newTenantId,array));
|
|
@@ -1666,7 +1727,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
QuestionModule questionModule = iQuestionModuleService.getById(moduleExamId);
|
|
QuestionModule questionModule = iQuestionModuleService.getById(moduleExamId);
|
|
if (ObjectUtils.isNotNull(questionModule)){
|
|
if (ObjectUtils.isNotNull(questionModule)){
|
|
Long oldModuleExamId = questionModule.getModuleExamId();
|
|
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);
|
|
// QuestionModule newQuestionModule = iQuestionModuleService.getModuleByTenant(questionModule.getCode(),newTenantId);
|
|
if (ObjectUtils.isNull(newModuleExamId)){
|
|
if (ObjectUtils.isNull(newModuleExamId)){
|
|
questionModule.setModuleExamId(null);
|
|
questionModule.setModuleExamId(null);
|
|
@@ -1718,7 +1779,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
QuestionChapter questionChapter = iQuestionChapterService.getOne(new LambdaQueryWrapper<QuestionChapter>().eq(QuestionChapter::getChapterExamId,oldChapterExamId));
|
|
QuestionChapter questionChapter = iQuestionChapterService.getOne(new LambdaQueryWrapper<QuestionChapter>().eq(QuestionChapter::getChapterExamId,oldChapterExamId));
|
|
if (ObjectUtils.isNotNull(questionChapter)){
|
|
if (ObjectUtils.isNotNull(questionChapter)){
|
|
Long oid = questionChapter.getChapterExamId();
|
|
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);
|
|
// QuestionChapter newQuestionChapter = iQuestionChapterService.getChaptereExamByTenant(questionChapter.getCode(),newTenantId);
|
|
if (ObjectUtils.isNull(newChapterExamId)){
|
|
if (ObjectUtils.isNull(newChapterExamId)){
|
|
questionChapter.setChapterExamId(null);
|
|
questionChapter.setChapterExamId(null);
|
|
@@ -1770,13 +1831,13 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
Exam exam = iExamService.getById(oldExamId);
|
|
Exam exam = iExamService.getById(oldExamId);
|
|
if (ObjectUtils.isNotNull(exam)){
|
|
if (ObjectUtils.isNotNull(exam)){
|
|
Long oid = exam.getExamId();
|
|
Long oid = exam.getExamId();
|
|
- Long newExamId = getNewId(oid,GoodsCopyEnum.EXAM.getType());
|
|
|
|
|
|
+ Long newExamId = getNewIdByTenant(oid,GoodsCopyEnum.EXAM.getType(),newTenantId);
|
|
if (ObjectUtils.isNull(newExamId)){
|
|
if (ObjectUtils.isNull(newExamId)){
|
|
//试卷类型
|
|
//试卷类型
|
|
ExamPaper examPaper = iExamPaperService.getById(exam.getExamPaperId());
|
|
ExamPaper examPaper = iExamPaperService.getById(exam.getExamPaperId());
|
|
if (ObjectUtils.isNotNull(examPaper)){
|
|
if (ObjectUtils.isNotNull(examPaper)){
|
|
Long paperOid = examPaper.getPaperId();
|
|
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)){
|
|
if (ObjectUtils.isNotNull(newExamPaperId)){
|
|
exam.setExamPaperId(newExamPaperId);
|
|
exam.setExamPaperId(newExamPaperId);
|
|
}else {
|
|
}else {
|
|
@@ -1837,7 +1898,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
Question question = iQuestionService.getById(oldQuestionId);
|
|
Question question = iQuestionService.getById(oldQuestionId);
|
|
if (ObjectUtils.isNotNull(question)){
|
|
if (ObjectUtils.isNotNull(question)){
|
|
Long oid = question.getQuestionId();
|
|
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);
|
|
// Question newQuestion = iQuestionService.getQuestionByTenant(question.getCode(),newTenantId);
|
|
if (ObjectUtils.isNull(newQuestionId)){
|
|
if (ObjectUtils.isNull(newQuestionId)){
|
|
//新增
|
|
//新增
|
|
@@ -1874,7 +1935,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
CourseModule module = iCourseModuleService.getById(oldModuleId);
|
|
CourseModule module = iCourseModuleService.getById(oldModuleId);
|
|
if (ObjectUtils.isNotNull(module)){
|
|
if (ObjectUtils.isNotNull(module)){
|
|
Long oid = module.getModuleId();
|
|
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);
|
|
// CourseModule newModule = iCourseModuleService.getModuleByTenant(module.getCode(),newTenantId);
|
|
if (ObjectUtils.isNull(newModuleId)){
|
|
if (ObjectUtils.isNull(newModuleId)){
|
|
module.setModuleId(null);
|
|
module.setModuleId(null);
|
|
@@ -1925,9 +1986,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
CourseChapter chapter = iCourseChapterService.getById(oldChapterId);
|
|
CourseChapter chapter = iCourseChapterService.getById(oldChapterId);
|
|
if (ObjectUtils.isNotNull(chapter)){
|
|
if (ObjectUtils.isNotNull(chapter)){
|
|
Long oid = chapter.getChapterId();
|
|
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);
|
|
// CourseChapter newChapter = iCourseChapterService.getChapterByTenant(chapter.getCode(),newTenantId);
|
|
- if (ObjectUtils.isNotNull(newChapterId)){
|
|
|
|
|
|
+ if (ObjectUtils.isNull(newChapterId)){
|
|
chapter.setChapterId(null);
|
|
chapter.setChapterId(null);
|
|
chapter.setTenantId(newTenantId);
|
|
chapter.setTenantId(newTenantId);
|
|
iCourseChapterService.save(chapter);
|
|
iCourseChapterService.save(chapter);
|
|
@@ -1976,7 +2037,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
CourseSection section = iCourseSectionService.getById(oldSectionId);
|
|
CourseSection section = iCourseSectionService.getById(oldSectionId);
|
|
if (ObjectUtils.isNotNull(section)){
|
|
if (ObjectUtils.isNotNull(section)){
|
|
Long oid = section.getSectionId();
|
|
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);
|
|
// CourseSection newSection = iCourseSectionService.getSectionByTenant(section.getCode(),newTenantId);
|
|
if (ObjectUtils.isNull(newSectionId)){
|
|
if (ObjectUtils.isNull(newSectionId)){
|
|
//新增
|
|
//新增
|
|
@@ -2012,7 +2073,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
CertificateCommon certificateCommon = iCertificateCommonService.getById(certificateId);
|
|
CertificateCommon certificateCommon = iCertificateCommonService.getById(certificateId);
|
|
if (ObjectUtils.isNotNull(certificateCommon)){
|
|
if (ObjectUtils.isNotNull(certificateCommon)){
|
|
Long oid = certificateCommon.getId();
|
|
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);
|
|
// CertificateCommon newCertificateCommon = iCertificateCommonService.getCertificateByTenant(certificateCommon.getCode(),newTenantId);
|
|
if (ObjectUtils.isNotNull(newId)){
|
|
if (ObjectUtils.isNotNull(newId)){
|
|
return newId;
|
|
return newId;
|
|
@@ -2036,7 +2097,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
CertificateTp certificateTp = iCertificateTpService.getById(certificateTpId);
|
|
CertificateTp certificateTp = iCertificateTpService.getById(certificateTpId);
|
|
if (ObjectUtils.isNotNull(certificateTp)){
|
|
if (ObjectUtils.isNotNull(certificateTp)){
|
|
Long oid = certificateTp.getTpId();
|
|
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);
|
|
// CertificateTp newCertificateTp =iCertificateTpService.getCertificateTpByTenant(certificateTp.getCode(),newTenantId);
|
|
if (ObjectUtils.isNotNull(newId)){
|
|
if (ObjectUtils.isNotNull(newId)){
|
|
return newId;
|
|
return newId;
|
|
@@ -2057,7 +2118,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
Certificate certificate = iCertificateService.getById(certificateTypeId);
|
|
Certificate certificate = iCertificateService.getById(certificateTypeId);
|
|
if (ObjectUtils.isNotNull(certificate)){
|
|
if (ObjectUtils.isNotNull(certificate)){
|
|
Long oid = certificate.getId();
|
|
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);
|
|
// Certificate newCertificate = iCertificateService.getCertificateByTenant(certificate.getCode(),newTenantId);
|
|
if (ObjectUtils.isNotNull(newId)){
|
|
if (ObjectUtils.isNotNull(newId)){
|
|
return newId;
|
|
return newId;
|
|
@@ -2078,7 +2139,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
Long oId = educationType.getId();
|
|
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);
|
|
// CourseEducationType newEducationType = iCourseEducationTypeService.getEducationTypeBytenant(educationType.getEncoder(), newTenantId);
|
|
if (ObjectUtil.isNull(newEducationTypeId)){
|
|
if (ObjectUtil.isNull(newEducationTypeId)){
|
|
//新增教育类型
|
|
//新增教育类型
|
|
@@ -2098,7 +2159,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
Long oid = project.getId();
|
|
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);
|
|
// CourseProjectType newProject = iCourseProjectTypeService.getProjectByTenant(project.getEncoder(),newTenantId);
|
|
if (ObjectUtil.isNull(newId)){
|
|
if (ObjectUtil.isNull(newId)){
|
|
//新增项目类型
|
|
//新增项目类型
|
|
@@ -2121,7 +2182,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
Long oid = major.getId();
|
|
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);
|
|
// Major newMajor = iMajorService.getMajorByTenant(major.getEncoder(), newTenantId);
|
|
if (ObjectUtil.isNull(newMajorId)){
|
|
if (ObjectUtil.isNull(newMajorId)){
|
|
//新增专业
|
|
//新增专业
|
|
@@ -2157,7 +2218,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
Long oid = business.getId();
|
|
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);
|
|
// CourseBusiness newBusiness = iCourseBusinessService.getBusinessByTenant(business.getEncoder(),newTenantId);
|
|
if (ObjectUtil.isNull(newId)){
|
|
if (ObjectUtil.isNull(newId)){
|
|
//新增业务层次
|
|
//新增业务层次
|
|
@@ -2179,7 +2240,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
Long oid = courseSubject.getId();
|
|
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);
|
|
// CourseSubject newCourseSubject = iCourseSubjectService.getSubjectByTenant(courseSubject.getEncoder(),newTenantId);
|
|
if (ObjectUtil.isNull(newId)){
|
|
if (ObjectUtil.isNull(newId)){
|
|
//业务项目关联
|
|
//业务项目关联
|
|
@@ -2344,6 +2405,19 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
iGoodsCourseService.saveBatch(newGoodsCourseList);
|
|
iGoodsCourseService.saveBatch(newGoodsCourseList);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //6 题库商品关联
|
|
|
|
+ List<GoodsAttached> goodsAttachedList = iGoodsAttachedService.list();
|
|
|
|
+ if (CollectionUtils.isNotEmpty(goodsAttachedList)){
|
|
|
|
+ List<GoodsAttached> newGoodsAttachedList = goodsAttachedList.stream().map(x -> {
|
|
|
|
+ GoodsAttached goodsAttached = BeanUtil.toBean(x, GoodsAttached.class);
|
|
|
|
+ goodsAttached.setId(null);
|
|
|
|
+ goodsAttached.setTenantId(newTenantId);
|
|
|
|
+ return goodsAttached;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ //关联表不需要记录(后续修改ID)
|
|
|
|
+ iGoodsAttachedService.saveBatch(newGoodsAttachedList);
|
|
|
|
+ }
|
|
|
|
+
|
|
//7 课程老师关联
|
|
//7 课程老师关联
|
|
List<GoodsCourseTeacher> teacherList = goodsCourseTeacherService.list();
|
|
List<GoodsCourseTeacher> teacherList = goodsCourseTeacherService.list();
|
|
if (CollectionUtils.isNotEmpty(teacherList)){
|
|
if (CollectionUtils.isNotEmpty(teacherList)){
|
|
@@ -3191,6 +3265,17 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //通知规则
|
|
|
|
+ List<InformRemind> informRemindList = iInformRemindService.list();
|
|
|
|
+ if (CollectionUtils.isNotEmpty(informRemindList)){
|
|
|
|
+ List<InformRemind> newInformRemind = informRemindList.stream().map(x -> {
|
|
|
|
+ InformRemind informRemind = BeanUtil.toBean(x, InformRemind.class);
|
|
|
|
+ informRemind.setId(null);
|
|
|
|
+ informRemind.setTenantId(newTenantId);
|
|
|
|
+ return informRemind;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ iInformRemindService.saveBatch(newInformRemind);
|
|
|
|
+ }
|
|
//保存记录
|
|
//保存记录
|
|
iSysGoodsCopyRecordService.saveBatch(copyRecordList);
|
|
iSysGoodsCopyRecordService.saveBatch(copyRecordList);
|
|
return true;
|
|
return true;
|
|
@@ -3295,6 +3380,29 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
iGoodsCourseService.updateBatchById(goodsCourseList);
|
|
iGoodsCourseService.updateBatchById(goodsCourseList);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //6 题库商品关联
|
|
|
|
+ List<GoodsAttached> goodsAttachedList = iGoodsAttachedService.list();
|
|
|
|
+ if (CollectionUtils.isNotEmpty(goodsAttachedList)){
|
|
|
|
+ for (GoodsAttached item : goodsAttachedList) {
|
|
|
|
+ //课程ID
|
|
|
|
+ item.setGoodsId(getNewId(item.getGoodsId(), GoodsCopyEnum.GOODS.getType()));
|
|
|
|
+ //目录ID
|
|
|
|
+ if (ObjectUtils.isNotNull(item.getType())){
|
|
|
|
+ if (item.getType() == 1){
|
|
|
|
+ //模快卷
|
|
|
|
+ item.setMajorId(getNewId(item.getMajorId(), GoodsCopyEnum.QUESTION_MODULE.getType()));
|
|
|
|
+ }else if (item.getType() == 2){
|
|
|
|
+ //章卷
|
|
|
|
+ item.setMajorId(getNewId(item.getMajorId(), GoodsCopyEnum.QUESTION_CHAPTER.getType()));
|
|
|
|
+ }else if (item.getType() == 3){
|
|
|
|
+ //试卷
|
|
|
|
+ item.setMajorId(getNewId(item.getMajorId(), GoodsCopyEnum.EXAM.getType()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ iGoodsAttachedService.updateBatchById(goodsAttachedList);
|
|
|
|
+ }
|
|
|
|
+
|
|
//7 课程老师关联
|
|
//7 课程老师关联
|
|
List<GoodsCourseTeacher> courseTeacherList = goodsCourseTeacherService.list();
|
|
List<GoodsCourseTeacher> courseTeacherList = goodsCourseTeacherService.list();
|
|
if (CollectionUtils.isNotEmpty(courseTeacherList)){
|
|
if (CollectionUtils.isNotEmpty(courseTeacherList)){
|
|
@@ -3753,6 +3861,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){
|
|
private String getNewIds(String oldIds, Integer type){
|
|
if (StringUtils.isBlank(oldIds)){
|
|
if (StringUtils.isBlank(oldIds)){
|
|
return null;
|
|
return null;
|