积分赠送以及返还问题处理。

积分购买时预校验,以免下单后取消订单,积分返还无效操作
额外的一些代码完善问题处理
This commit is contained in:
Chopper
2021-09-24 18:15:29 +08:00
parent ff24c95d02
commit d9b1d78c61
12 changed files with 95 additions and 212 deletions

View File

@@ -335,7 +335,8 @@ public enum ResultCode {
* 其他促销
*/
MEMBER_SIGN_REPEAT(47001, "请勿重复签到"),
POINT_GOODS_ACTIVE_STOCK_ERROR(47002, "最低金额不能高于商品金额"),
POINT_GOODS_ACTIVE_STOCK_ERROR(47002, "活动库存数量不能高于商品库存"),
POINT_GOODS_ACTIVE_STOCK_INSUFFICIENT(47003, "积分商品库存不足"),
/**
* 砍价活动

View File

@@ -31,7 +31,7 @@ public class DistributionGoodsSearchParams extends PageVO {
public <T> QueryWrapper<T> distributionQueryWrapper() {
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StringUtils.isNotEmpty(goodsName), "dg.goods_name", goodsName);
queryWrapper.like(StringUtils.isNotEmpty(goodsName), "dg.goods_name", goodsName);
return queryWrapper;
}

View File

@@ -31,9 +31,10 @@ public class DraftGoods extends BaseEntity {
@ApiModelProperty(value = "商品名称")
private String goodsName;
@Length(max = 30, message = "商品规格编号太长不能超过30个字符")
@ApiModelProperty(value = "商品编号")
private String sn;
@Max(value = 99999999, message = "价格不能超过99999999")
@ApiModelProperty(value = "商品价格")
private Double price;
@ApiModelProperty(value = "品牌id")
private String brandId;
@@ -47,9 +48,6 @@ public class DraftGoods extends BaseEntity {
@ApiModelProperty(value = "卖点")
private String sellingPoint;
@ApiModelProperty(value = "重量")
@Max(value = 99999999, message = "重量不能超过99999999")
private Double weight;
/**
* @see GoodsStatusEnum
*/
@@ -63,14 +61,6 @@ public class DraftGoods extends BaseEntity {
@ApiModelProperty(value = "商品移动端详情")
private String mobileIntro;
@Max(value = 99999999, message = "价格不能超过99999999")
@ApiModelProperty(value = "商品价格")
private Double price;
@Max(value = 99999999, message = "成本价格99999999")
@ApiModelProperty(value = "成本价格")
private Double cost;
@ApiModelProperty(value = "购买数量")
private Integer buyCount;
@@ -137,7 +127,7 @@ public class DraftGoods extends BaseEntity {
@ApiModelProperty(value = "商品图片JSON")
private String goodsGalleryListJson;
@ApiModelProperty(value = "sku列表JSON")
private String skuListJson;

View File

@@ -19,6 +19,9 @@ import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Map;
/**
@@ -33,17 +36,17 @@ import java.util.Map;
public class Goods extends BaseEntity {
private static final long serialVersionUID = 370683495251252601L;
/**
* 商品名称
*/
@ApiModelProperty(value = "商品名称")
@NotEmpty(message = "商品名称不能为空")
@Length(max = 100, message = "商品名称提案仓不能超过100个字符")
private String goodsName;
/**
* 商品编号
*/
@Length(max = 30, message = "商品规格编号太长不能超过30个字符")
@ApiModelProperty(value = "商品编号")
private String sn;
@ApiModelProperty(value = "商品价格", required = true)
@NotNull(message = "商品价格不能为空")
@Min(value = 0, message = "商品价格不能为负数")
@Max(value = 99999999, message = "商品价格不能超过99999999")
private Double price;
@ApiModelProperty(value = "品牌id")
private String brandId;
@@ -54,129 +57,69 @@ public class Goods extends BaseEntity {
@ApiModelProperty(value = "计量单位")
private String goodsUnit;
/**
* 卖点
*/
@Length(max = 60, message = "商品卖点太长不能超过60个字符")
@ApiModelProperty(value = "卖点")
private String sellingPoint;
/**
* 重量
*/
@ApiModelProperty(value = "重量")
@Max(value = 99999999, message = "重量不能超过99999999")
private Double weight;
/**
* 上架状态
*
* @see GoodsStatusEnum
*/
@ApiModelProperty(value = "上架状态")
private String marketEnable;
/**
* 详情
*/
@ApiModelProperty(value = "详情")
private String intro;
/**
* 商品价格
*/
@Max(value = 99999999, message = "价格不能超过99999999")
@ApiModelProperty(value = "商品价格")
private Double price;
/**
* 成本价格
*/
@Max(value = 99999999, message = "成本价格99999999")
@ApiModelProperty(value = "成本价格")
private Double cost;
/**
* 购买数量
*/
@ApiModelProperty(value = "购买数量")
private Integer buyCount;
/**
* 库存
*/
@Max(value = 99999999, message = "库存不能超过99999999")
@ApiModelProperty(value = "库存")
private Integer quantity;
/**
* 商品好评率
*/
@ApiModelProperty(value = "商品好评率")
private Double grade;
/**
* 缩略图路径
*/
@ApiModelProperty(value = "缩略图路径")
private String thumbnail;
/**
* 小图路径
*/
@ApiModelProperty(value = "小图路径")
private String small;
/**
* 原图路径
*/
@ApiModelProperty(value = "原图路径")
private String original;
/**
* 店铺分类id
*/
@ApiModelProperty(value = "店铺分类id")
private String storeCategoryPath;
/**
* 评论数量
*/
@ApiModelProperty(value = "评论数量")
private Integer commentNum;
/**
* 卖家id
*/
@ApiModelProperty(value = "卖家id")
private String storeId;
/**
* 卖家名字
*/
@ApiModelProperty(value = "卖家名字")
private String storeName;
/**
* 运费模板id
*/
@ApiModelProperty(value = "运费模板id")
private String templateId;
/**
* 审核状态
*
* @see GoodsAuthEnum
*/
@ApiModelProperty(value = "审核状态")
private String isAuth;
/**
* 审核信息
*/
@ApiModelProperty(value = "审核信息")
private String authMessage;
/**
* 下架原因
*/
@ApiModelProperty(value = "下架原因")
private String underMessage;
/**
* 是否自营
*/
@ApiModelProperty(value = "是否自营")
private Boolean selfOperated;
/**
* 商品移动端详情
*/
@ApiModelProperty(value = "商品移动端详情")
private String mobileIntro;
/**
* 商品视频
*/
@ApiModelProperty(value = "商品视频")
private String goodsVideo;
@@ -207,9 +150,6 @@ public class Goods extends BaseEntity {
this.categoryPath = goodsOperationDTO.getCategoryPath();
this.storeCategoryPath = goodsOperationDTO.getStoreCategoryPath();
this.brandId = goodsOperationDTO.getBrandId();
this.sn = goodsOperationDTO.getSn();
this.price = goodsOperationDTO.getPrice();
this.weight = goodsOperationDTO.getWeight();
this.templateId = goodsOperationDTO.getTemplateId();
this.recommend = goodsOperationDTO.getRecommend();
this.sellingPoint = goodsOperationDTO.getSellingPoint();
@@ -217,8 +157,8 @@ public class Goods extends BaseEntity {
this.goodsUnit = goodsOperationDTO.getGoodsUnit();
this.intro = goodsOperationDTO.getIntro();
this.mobileIntro = goodsOperationDTO.getMobileIntro();
this.cost = goodsOperationDTO.getCost();
this.goodsVideo = goodsOperationDTO.getGoodsVideo();
this.price = goodsOperationDTO.getPrice();
if (goodsOperationDTO.getGoodsParamsDTOList() != null && goodsOperationDTO.getGoodsParamsDTOList().isEmpty()) {
this.params = JSONUtil.toJsonStr(goodsOperationDTO.getGoodsParamsDTOList());
}

View File

@@ -29,6 +29,12 @@ public class GoodsOperationDTO implements Serializable {
@ApiModelProperty(hidden = true)
private String goodsId;
@ApiModelProperty(value = "商品价格", required = true)
@NotNull(message = "商品价格不能为空")
@Min(value = 0, message = "商品价格不能为负数")
@Max(value = 99999999, message = "商品价格不能超过99999999")
private Double price;
@ApiModelProperty(value = "分类path")
private String categoryPath;
@@ -45,25 +51,6 @@ public class GoodsOperationDTO implements Serializable {
@NotEmpty(message = "商品名称不能为空")
private String goodsName;
@ApiModelProperty(value = "商品编号", required = true)
@Length(max = 30, message = "商品编号太长不能超过30个字符")
private String sn;
@ApiModelProperty(value = "商品价格", required = true)
@NotNull(message = "商品价格不能为空")
@Min(value = 0, message = "商品价格不能为负数")
@Max(value = 99999999, message = "商品价格不能超过99999999")
private Double price;
@ApiModelProperty(value = "市场价格", required = true)
@NotNull(message = "市场价格不能为空")
private Double cost;
@ApiModelProperty(value = "重量", required = true)
@NotNull(message = "商品重量不能为空")
@Min(value = 0, message = "重量不能为负数")
@Max(value = 99999999, message = "重量不能超过99999999")
private Double weight;
@ApiModelProperty(value = "详情")
private String intro;

View File

@@ -26,7 +26,7 @@ public class GoodsSearchParams extends PageVO {
private String goodsName;
@ApiModelProperty(value = "商品编号")
private String sn;
private String id;
@ApiModelProperty(value = "商家ID")
private String storeId;
@@ -78,8 +78,8 @@ public class GoodsSearchParams extends PageVO {
if (StringUtils.isNotEmpty(goodsName)) {
queryWrapper.like("goods_name", goodsName);
}
if (StringUtils.isNotEmpty(sn)) {
queryWrapper.eq("sn", sn);
if (StringUtils.isNotEmpty(id)) {
queryWrapper.eq("id", id);
}
if (StringUtils.isNotEmpty(storeId)) {
queryWrapper.eq("store_id", storeId);

View File

@@ -744,6 +744,10 @@ public class CartServiceImpl implements CartService {
PointsGoodsVO pointsGoodsVO = pointsGoodsService.getPointsGoodsVOByMongo(cartSkuVO.getGoodsSku().getId());
if (pointsGoodsVO != null) {
if (pointsGoodsVO.getActiveStock() < 1) {
throw new ServiceException(ResultCode.POINT_GOODS_ACTIVE_STOCK_INSUFFICIENT);
}
cartSkuVO.setPoint(pointsGoodsVO.getPoints());
cartSkuVO.setPurchasePrice(0D);
cartSkuVO.setPointsId(pointsGoodsVO.getId());

File diff suppressed because one or more lines are too long

View File

@@ -185,7 +185,7 @@ public class KanjiaActivityGoodsServiceImpl extends ServiceImpl<KanJiaActivityGo
}
//校验活动库存是否超出此sku的库存
if (goodsSku.getQuantity() < kanJiaActivityGoodsDTO.getStock()) {
throw new ServiceException(ResultCode.POINT_GOODS_ACTIVE_STOCK_ERROR);
throw new ServiceException(ResultCode.KANJIA_GOODS_ACTIVE_STOCK_ERROR);
}
//校验最低购买金额不能高于商品金额
if (goodsSku.getPrice() < kanJiaActivityGoodsDTO.getPurchasePrice()) {

View File

@@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@@ -27,15 +29,17 @@ public class StoreGoodsLabel extends BaseEntity {
private String storeId;
@NotEmpty(message = "店铺商品分类名称不能为空")
@Length(max = 20,message = "店铺商品分类名称太长")
@ApiModelProperty("店铺商品分类名称")
private String labelName;
@NotNull(message = "店铺商品分类排序不能为空")
@Max(value = 99999,message = "排序值太大")
@ApiModelProperty("店铺商品分类排序")
private BigDecimal sortOrder;
@NotNull(message = "父节点不能为空,需设定根节点或者某节点的子节点")
@NotEmpty(message = "父节点不能为空,需设定根节点或者某节点的子节点")
@ApiModelProperty(value = "父id, 根节点为0")
private String parentId;