记得上下班打卡 | git大法好,push需谨慎

Commit e07f5bc1 authored by 姜秀龙's avatar 姜秀龙

sqb 规格

parent b5d9dcb9
...@@ -47,9 +47,8 @@ public class GoblinStoreMgtGoodsEditSkuParam implements Serializable { ...@@ -47,9 +47,8 @@ public class GoblinStoreMgtGoodsEditSkuParam implements Serializable {
@NotNull(message = "单品默认图片不能为空") @NotNull(message = "单品默认图片不能为空")
@Size(max = 256, message = "单品默认图片URL过长") @Size(max = 256, message = "单品默认图片URL过长")
private String skuPic; private String skuPic;
@ApiModelProperty(position = 14, required = true, value = "单品规格信息") @ApiModelProperty(position = 14, required = false, value = "单品规格信息;编辑时可不传或传[]表示沿用/无规格(如收钱吧同步SKU)")
@Valid @Valid
@NotNull(message = "规格信息不能为空")
private List<GoblinGoodsSpecDto> skuSpecList; private List<GoblinGoodsSpecDto> skuSpecList;
@ApiModelProperty(position = 15, required = false, value = "单品销售价-原价[20,2]") @ApiModelProperty(position = 15, required = false, value = "单品销售价-原价[20,2]")
private BigDecimal sellPrice; private BigDecimal sellPrice;
......
...@@ -948,8 +948,12 @@ public class GoblinStoreMgtGoodsController { ...@@ -948,8 +948,12 @@ public class GoblinStoreMgtGoodsController {
Map<String, String> delSpuSpecMap = CollectionUtil.mapStringString(); Map<String, String> delSpuSpecMap = CollectionUtil.mapStringString();
Map<String, String> addSpuSpecMap = CollectionUtil.mapStringString(); Map<String, String> addSpuSpecMap = CollectionUtil.mapStringString();
{// 规格校验、处理 {// 规格校验、处理
Map<String, String> befSkuSpecNameVnameMap = mgtGoodsSkuInfoVo.getSkuSpecList().stream() if (null == mgtGoodsEditSkuParam.getSkuSpecList()) {
.collect(Collectors.toMap(GoblinGoodsSpecDto::getSpecName, GoblinGoodsSpecDto::getSpecVname)); mgtGoodsEditSkuParam.setSkuSpecList(new ArrayList<>());
}
List<GoblinGoodsSpecDto> befSkuSpecList = mgtGoodsSkuInfoVo.getSkuSpecList();
Map<String, String> befSkuSpecNameVnameMap = CollectionUtils.isEmpty(befSkuSpecList) ? CollectionUtil.mapStringString()
: befSkuSpecList.stream().collect(Collectors.toMap(GoblinGoodsSpecDto::getSpecName, GoblinGoodsSpecDto::getSpecVname));
List<GoblinGoodsSpecDto> paramSkuSpecList = mgtGoodsEditSkuParam.getSkuSpecList(); List<GoblinGoodsSpecDto> paramSkuSpecList = mgtGoodsEditSkuParam.getSkuSpecList();
Set<String> befSkuSpecNameSet = befSkuSpecNameVnameMap.keySet(); Set<String> befSkuSpecNameSet = befSkuSpecNameVnameMap.keySet();
Map<String, String> paramUpdateSkuSpecMap = CollectionUtil.mapStringString(); Map<String, String> paramUpdateSkuSpecMap = CollectionUtil.mapStringString();
...@@ -1268,6 +1272,9 @@ public class GoblinStoreMgtGoodsController { ...@@ -1268,6 +1272,9 @@ public class GoblinStoreMgtGoodsController {
} }
} }
} }
if (CollectionUtils.isEmpty(mgtGoodsEditSkuParam.getSkuSpecList())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "规格信息不能为空");
}
List<String> skuIdList = goodsInfoVo.getSkuIdList(); List<String> skuIdList = goodsInfoVo.getSkuIdList();
List<GoblinGoodsSpecDto> paramSkuSpecDtoList = mgtGoodsEditSkuParam.getSkuSpecList(); List<GoblinGoodsSpecDto> paramSkuSpecDtoList = mgtGoodsEditSkuParam.getSkuSpecList();
for (String skuId : skuIdList) {// 比对所有SKU规格信息 for (String skuId : skuIdList) {// 比对所有SKU规格信息
......
...@@ -1313,6 +1313,7 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -1313,6 +1313,7 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
boolean updateGoodsInfoVoFlg = false; boolean updateGoodsInfoVoFlg = false;
List<GoblinGoodsSpecDto> skuSpecList = updateSkuInfoVo.getSkuSpecList(); List<GoblinGoodsSpecDto> skuSpecList = updateSkuInfoVo.getSkuSpecList();
List<GoblinGoodsSpecVo> specVoList = goodsInfoVo.getSpecVoList(); List<GoblinGoodsSpecVo> specVoList = goodsInfoVo.getSpecVoList();
if (!CollectionUtils.isEmpty(skuSpecList)) {
skuSpecList.forEach(spec -> { skuSpecList.forEach(spec -> {
String specName = spec.getSpecName(), specVname = spec.getSpecVname(); String specName = spec.getSpecName(), specVname = spec.getSpecVname();
...@@ -1326,6 +1327,7 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -1326,6 +1327,7 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
.add(new Object[] { specVname, marketSkuId, specName })); .add(new Object[] { specVname, marketSkuId, specName }));
} }
}); });
}
if (!delSpuSpecMap.isEmpty()) {// 删除了规格值,需要同步SPU里的规格信息 if (!delSpuSpecMap.isEmpty()) {// 删除了规格值,需要同步SPU里的规格信息
updateGoodsInfoVoFlg = true; updateGoodsInfoVoFlg = true;
goodsInfoVo.setUpdatedBy(uid); goodsInfoVo.setUpdatedBy(uid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment