Browse Source

修改不过

multiwx
xh-pan1 1 year ago
parent
commit
a25b2fa19c
  1. 2
      cereshop-admin/src/main/java/com/shop/cereshop/admin/page/product/SkuValueParam.java
  2. 11
      cereshop-business/src/main/java/com/shop/cereshop/business/param/product/NameValue.java
  3. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/param/product/ProductSaveParam.java
  4. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/param/product/SkuValueParam.java
  5. 20
      cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereProductClassifyServiceImpl.java
  6. 25
      cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereShopProductServiceImpl.java

2
cereshop-admin/src/main/java/com/shop/cereshop/admin/page/product/SkuValueParam.java

@ -28,7 +28,7 @@ public class SkuValueParam {
* 规格值 * 规格值
*/ */
@ApiModelProperty(value = "规格值") @ApiModelProperty(value = "规格值")
@NotBlank(message = "规格值不能为空")
// @NotBlank(message = "规格值不能为空")
private String skuValue; private String skuValue;
/** /**

11
cereshop-business/src/main/java/com/shop/cereshop/business/param/product/NameValue.java

@ -5,10 +5,14 @@
*/ */
package com.shop.cereshop.business.param.product; package com.shop.cereshop.business.param.product;
import com.baomidou.mybatisplus.annotation.TableField;
import com.shop.cereshop.commons.domain.product.CereSkuNameLangInfo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.Map;
/** /**
* 商品规格名值数据 * 商品规格名值数据
*/ */
@ -38,4 +42,11 @@ public class NameValue {
* 是否需要配图 * 是否需要配图
*/ */
private Integer need; private Integer need;
/**
* 名称Map
*/
@ApiModelProperty(value = "名称Map")
@TableField(exist = false)
private Map<String, CereSkuNameLangInfo> langInfoMap;
} }

2
cereshop-business/src/main/java/com/shop/cereshop/business/param/product/ProductSaveParam.java

@ -41,7 +41,7 @@ public class ProductSaveParam {
* 商品名称 * 商品名称
*/ */
@ApiModelProperty(value = "商品名称") @ApiModelProperty(value = "商品名称")
@NotBlank(message = "商品名称不能为空")
// @NotBlank(message = "商品名称不能为空")
private String productName; private String productName;
/** /**

2
cereshop-business/src/main/java/com/shop/cereshop/business/param/product/SkuValueParam.java

@ -31,7 +31,7 @@ public class SkuValueParam {
* 规格值 * 规格值
*/ */
@ApiModelProperty(value = "规格值") @ApiModelProperty(value = "规格值")
@NotBlank(message = "规格值不能为空")
// @NotBlank(message = "规格值不能为空")
private String skuValue; private String skuValue;
/** /**

20
cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereProductClassifyServiceImpl.java

@ -210,9 +210,6 @@ public class CereProductClassifyServiceImpl implements CereProductClassifyServic
private void addOneClassify(CereProductClassify classify, String time, private void addOneClassify(CereProductClassify classify, String time,
List<CereProductClassify> updates, List<Long> updateIds, List<CereProductClassify> updates, List<Long> updateIds,
List<CereProductClassifyLangInfo> langInfoList) throws CoBusinessException{ List<CereProductClassifyLangInfo> langInfoList) throws CoBusinessException{
if(EmptyUtils.isEmpty(classify.getClassifyName())){
throw new CoBusinessException(CoReturnFormat.CLASSIFY_NAME_NULL);
}
CereProductClassify cereProductClassify=new CereProductClassify(); CereProductClassify cereProductClassify=new CereProductClassify();
cereProductClassify.setClassifyId(classify.getClassifyId()); cereProductClassify.setClassifyId(classify.getClassifyId());
cereProductClassify.setClassifyName(classify.getClassifyName()); cereProductClassify.setClassifyName(classify.getClassifyName());
@ -220,10 +217,13 @@ public class CereProductClassifyServiceImpl implements CereProductClassifyServic
cereProductClassify.setClassifyImage(classify.getClassifyImage()); cereProductClassify.setClassifyImage(classify.getClassifyImage());
cereProductClassify.setClassifyLevel(IntegerEnum.CLASSIFY_LEVEL_ONE.getCode()); cereProductClassify.setClassifyLevel(IntegerEnum.CLASSIFY_LEVEL_ONE.getCode());
cereProductClassify.setLink(classify.getLink()); cereProductClassify.setLink(classify.getLink());
cereProductClassify.setProject(ProjectUtil.DEFAULT_PROJECT);
cereProductClassify.setProject(ContextUtil.getProject());
cereProductClassify.setClassifyHierarchy("-"+classify.getClassifyName()); cereProductClassify.setClassifyHierarchy("-"+classify.getClassifyName());
cereProductClassify.setLangInfoMap(classify.getLangInfoMap()); cereProductClassify.setLangInfoMap(classify.getLangInfoMap());
cereProductClassify.initData(); cereProductClassify.initData();
if(EmptyUtils.isEmpty(cereProductClassify.getClassifyName())){
throw new CoBusinessException(CoReturnFormat.CLASSIFY_NAME_NULL);
}
if(!EmptyUtils.isLongEmpty(classify.getClassifyId())){ if(!EmptyUtils.isLongEmpty(classify.getClassifyId())){
//更新一级类别 //更新一级类别
cereProductClassify.setUpdateTime(time); cereProductClassify.setUpdateTime(time);
@ -240,7 +240,7 @@ public class CereProductClassifyServiceImpl implements CereProductClassifyServic
for (Map.Entry<String, CereProductClassifyLangInfo> productClassifyLangInfoEntry : cereProductClassify.getLangInfoMap().entrySet()) { for (Map.Entry<String, CereProductClassifyLangInfo> productClassifyLangInfoEntry : cereProductClassify.getLangInfoMap().entrySet()) {
CereProductClassifyLangInfo productClassifyLangInfo = productClassifyLangInfoEntry.getValue(); CereProductClassifyLangInfo productClassifyLangInfo = productClassifyLangInfoEntry.getValue();
productClassifyLangInfo.setClassifyId(classify.getClassifyId());
productClassifyLangInfo.setClassifyId(cereProductClassify.getClassifyId());
productClassifyLangInfo.setId(null); productClassifyLangInfo.setId(null);
langInfoList.add(productClassifyLangInfo); langInfoList.add(productClassifyLangInfo);
} }
@ -257,9 +257,6 @@ public class CereProductClassifyServiceImpl implements CereProductClassifyServic
List<Long> updateIds, List<Long> updateIds,
String time, CereProductClassify child,Integer level, String time, CereProductClassify child,Integer level,
List<CereProductClassifyLangInfo> langInfoList) throws CoBusinessException{ List<CereProductClassifyLangInfo> langInfoList) throws CoBusinessException{
if(EmptyUtils.isEmpty(child.getClassifyName())){
throw new CoBusinessException(CoReturnFormat.CLASSIFY_NAME_NULL);
}
CereProductClassify productClassify=new CereProductClassify(); CereProductClassify productClassify=new CereProductClassify();
productClassify.setClassifyId(child.getClassifyId()); productClassify.setClassifyId(child.getClassifyId());
productClassify.setClassifyName(child.getClassifyName()); productClassify.setClassifyName(child.getClassifyName());
@ -267,10 +264,13 @@ public class CereProductClassifyServiceImpl implements CereProductClassifyServic
productClassify.setClassifyLevel(level); productClassify.setClassifyLevel(level);
productClassify.setLink(child.getLink()); productClassify.setLink(child.getLink());
productClassify.setClassifyImage(child.getClassifyImage()); productClassify.setClassifyImage(child.getClassifyImage());
productClassify.setProject(ProjectUtil.DEFAULT_PROJECT);
productClassify.setProject(ContextUtil.getProject());
productClassify.setClassifyHierarchy(parent.getClassifyHierarchy()+"-"+child.getClassifyName()); productClassify.setClassifyHierarchy(parent.getClassifyHierarchy()+"-"+child.getClassifyName());
productClassify.setLangInfoMap(child.getLangInfoMap()); productClassify.setLangInfoMap(child.getLangInfoMap());
productClassify.initData(); productClassify.initData();
if(EmptyUtils.isEmpty(productClassify.getClassifyName())){
throw new CoBusinessException(CoReturnFormat.CLASSIFY_NAME_NULL);
}
if(!EmptyUtils.isLongEmpty(child.getClassifyId())){ if(!EmptyUtils.isLongEmpty(child.getClassifyId())){
//更新子级类别 //更新子级类别
productClassify.setUpdateTime(time); productClassify.setUpdateTime(time);
@ -287,7 +287,7 @@ public class CereProductClassifyServiceImpl implements CereProductClassifyServic
for (Map.Entry<String, CereProductClassifyLangInfo> productClassifyLangInfoEntry : productClassify.getLangInfoMap().entrySet()) { for (Map.Entry<String, CereProductClassifyLangInfo> productClassifyLangInfoEntry : productClassify.getLangInfoMap().entrySet()) {
CereProductClassifyLangInfo productClassifyLangInfo = productClassifyLangInfoEntry.getValue(); CereProductClassifyLangInfo productClassifyLangInfo = productClassifyLangInfoEntry.getValue();
productClassifyLangInfo.setClassifyId(child.getClassifyId());
productClassifyLangInfo.setClassifyId(productClassify.getClassifyId());
productClassifyLangInfo.setId(null); productClassifyLangInfo.setId(null);
langInfoList.add(productClassifyLangInfo); langInfoList.add(productClassifyLangInfo);
} }

25
cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereShopProductServiceImpl.java

@ -192,9 +192,23 @@ public class CereShopProductServiceImpl implements CereShopProductService {
}else { }else {
nameValue.setNeed(IntegerEnum.NO.getCode()); nameValue.setNeed(IntegerEnum.NO.getCode());
} }
Map<String, CereSkuNameLangInfo> langInfoMap = new HashMap<>();
for (String langKey : a.getLangInfoMap().keySet()) {
CereSkuNameLangInfo skuNameLangInfo = new CereSkuNameLangInfo();
if(a.getLangInfoMap().containsKey(langKey)){
skuNameLangInfo.setSkuName(a.getLangInfoMap().get(langKey).getSkuName());
}
if(value.getLangInfoMap().containsKey(langKey)){
skuNameLangInfo.setSkuValue(value.getLangInfoMap().get(langKey).getSkuValue());
}
langInfoMap.put(langKey, skuNameLangInfo);
}
nameValue.setLangInfoMap(langInfoMap);
map.put(a.getCode()+"-"+value.getValueCode(),nameValue); map.put(a.getCode()+"-"+value.getValueCode(),nameValue);
}); });
}); });
log.info(new Gson().toJson(map));
//查询当前是否有全部商品且进行中状态的优惠券 //查询当前是否有全部商品且进行中状态的优惠券
List<CereShopCoupon> coupons=cereShopCouponService.findAllByShopId(cereShopProduct.getShopId()); List<CereShopCoupon> coupons=cereShopCouponService.findAllByShopId(cereShopProduct.getShopId());
if(!EmptyUtils.isEmpty(coupons)){ if(!EmptyUtils.isEmpty(coupons)){
@ -1102,7 +1116,8 @@ public class CereShopProductServiceImpl implements CereShopProductService {
cereSkuName.setSkuValue(names.get(0).getValues().get(0).getSkuValue()); cereSkuName.setSkuValue(names.get(0).getValues().get(0).getSkuValue());
cereSkuName.setSkuId(cereProductSku.getSkuId()); cereSkuName.setSkuId(cereProductSku.getSkuId());
cereSkuName.setNeed(IntegerEnum.NO.getCode()); cereSkuName.setNeed(IntegerEnum.NO.getCode());
cereSkuNameService.insert(cereSkuName);
cereSkuName.setLangInfoMap(map.values().stream().findFirst().get().getLangInfoMap());
cereSkuName.initData(ContextUtil.getLanguage());
}else { }else {
//多款式 //多款式
if(!EmptyUtils.isEmpty(sku.getSkuAttrCodeDTOList())){ if(!EmptyUtils.isEmpty(sku.getSkuAttrCodeDTOList())){
@ -1118,6 +1133,10 @@ public class CereShopProductServiceImpl implements CereShopProductService {
cereSkuName.setNameCode(a.getCode()); cereSkuName.setNameCode(a.getCode());
cereSkuName.setValueCode(a.getValueCode()); cereSkuName.setValueCode(a.getValueCode());
cereSkuName.setNeed(nameValue.getNeed()); cereSkuName.setNeed(nameValue.getNeed());
cereSkuName.setLangInfoMap(nameValue.getLangInfoMap());
cereSkuName.initData(ContextUtil.getLanguage());
return cereSkuName; return cereSkuName;
}else { }else {
return null; return null;
@ -1162,6 +1181,8 @@ public class CereShopProductServiceImpl implements CereShopProductService {
cereSkuName.setSkuValue(names.get(0).getValues().get(0).getSkuValue()); cereSkuName.setSkuValue(names.get(0).getValues().get(0).getSkuValue());
cereSkuName.setSkuId(cereProductSku.getSkuId()); cereSkuName.setSkuId(cereProductSku.getSkuId());
cereSkuName.setNeed(IntegerEnum.NO.getCode()); cereSkuName.setNeed(IntegerEnum.NO.getCode());
cereSkuName.setLangInfoMap(map.values().stream().findFirst().get().getLangInfoMap());
cereSkuName.initData(ContextUtil.getLanguage());
cereSkuNameService.insert(cereSkuName); cereSkuNameService.insert(cereSkuName);
}else { }else {
//多款式 //多款式
@ -1178,6 +1199,8 @@ public class CereShopProductServiceImpl implements CereShopProductService {
cereSkuName.setNameCode(a.getCode()); cereSkuName.setNameCode(a.getCode());
cereSkuName.setValueCode(a.getValueCode()); cereSkuName.setValueCode(a.getValueCode());
cereSkuName.setNeed(nameValue.getNeed()); cereSkuName.setNeed(nameValue.getNeed());
cereSkuName.setLangInfoMap(nameValue.getLangInfoMap());
cereSkuName.initData(ContextUtil.getLanguage());
return cereSkuName; return cereSkuName;
}else { }else {
return null; return null;

Loading…
Cancel
Save