虚拟商品重量字段兼容问题处理
This commit is contained in:
parent
8f93ac4d49
commit
19154aa2b8
@ -240,9 +240,12 @@ public class Goods extends BaseEntity {
|
|||||||
if (StringUtil.isEmpty(sku.get("cost").toString()) || Integer.parseInt( sku.get("cost").toString()) <= 0) {
|
if (StringUtil.isEmpty(sku.get("cost").toString()) || Integer.parseInt( sku.get("cost").toString()) <= 0) {
|
||||||
throw new ServiceException(ResultCode.GOODS_SKU_COST_ERROR);
|
throw new ServiceException(ResultCode.GOODS_SKU_COST_ERROR);
|
||||||
}
|
}
|
||||||
if (StringUtil.isEmpty(sku.get("weight").toString()) || Integer.parseInt( sku.get("weight").toString()) < 0) {
|
//虚拟商品没有重量字段
|
||||||
|
if(sku.containsKey("weight")) {
|
||||||
|
if (StringUtil.isEmpty(sku.get("weight").toString()) || Integer.parseInt(sku.get("weight").toString()) < 0) {
|
||||||
throw new ServiceException(ResultCode.GOODS_SKU_WEIGHT_ERROR);
|
throw new ServiceException(ResultCode.GOODS_SKU_WEIGHT_ERROR);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (StringUtil.isEmpty(sku.get("quantity").toString()) || Integer.parseInt( sku.get("quantity").toString()) < 0) {
|
if (StringUtil.isEmpty(sku.get("quantity").toString()) || Integer.parseInt( sku.get("quantity").toString()) < 0) {
|
||||||
throw new ServiceException(ResultCode.GOODS_SKU_QUANTITY_ERROR);
|
throw new ServiceException(ResultCode.GOODS_SKU_QUANTITY_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -164,6 +164,13 @@ public class GoodsSku extends BaseEntity {
|
|||||||
@ApiModelProperty(value = "商品类型", required = true)
|
@ApiModelProperty(value = "商品类型", required = true)
|
||||||
private String goodsType;
|
private String goodsType;
|
||||||
|
|
||||||
|
public Double getWeight() {
|
||||||
|
if (weight == null) {
|
||||||
|
return 0d;
|
||||||
|
}
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date getUpdateTime() {
|
public Date getUpdateTime() {
|
||||||
if (super.getUpdateTime() == null) {
|
if (super.getUpdateTime() == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user