|
@@ -1542,14 +1542,20 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
//规格属性IDS
|
|
//规格属性IDS
|
|
if (StringUtils.isNotBlank(relation.getSpecAttributeIds())){
|
|
if (StringUtils.isNotBlank(relation.getSpecAttributeIds())){
|
|
List<Long> ids = Arrays.asList(relation.getSpecAttributeIds().split(",")).stream().map(x -> Long.valueOf(x)).collect(Collectors.toList());
|
|
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(ids)){
|
|
|
|
|
|
+ log.info("规格属性ids:"+JSONArray.toJSONString(ids));
|
|
|
|
+ List<GoodsSpecAttribute> specAttributeList = goodsSpecAttributeService.listByIds(ids);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(specAttributeList)){
|
|
List<Long> newIds = new ArrayList<>();
|
|
List<Long> newIds = new ArrayList<>();
|
|
- ids.forEach(item -> {
|
|
|
|
- Long newId = getNewIdByTenant(item,GoodsCopyEnum.GOODS_SPEC_ATTRIBUTE.getType(),newTenantId);
|
|
|
|
|
|
+ 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)){
|
|
if (ObjectUtils.isNotNull(newId)){
|
|
newIds.add(newId);
|
|
newIds.add(newId);
|
|
|
|
+ }else {
|
|
|
|
+ GoodsSpecAttribute newSpecAttribute = goodsSpecAttributeService.getSpecAttrByTenant(item.getName(),item.getCreateTime(),newTenantId);
|
|
|
|
+ if (ObjectUtils.isNotNull(newSpecAttribute)){
|
|
|
|
+ newIds.add(newSpecAttribute.getSpecAttributeId());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
});
|
|
});
|
|
if (CollectionUtils.isNotEmpty(newIds)){
|
|
if (CollectionUtils.isNotEmpty(newIds)){
|