Merge branch 'liushuai'

解决积分商品购买问题,部分参数校验问题,等各种问题优化

# Conflicts:
#	framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsOperationDTO.java
This commit is contained in:
Chopper
2021-09-24 18:17:59 +08:00
21 changed files with 225 additions and 257 deletions

View File

@@ -37,6 +37,8 @@ public enum ResultCode {
LIMIT_ERROR(1003, "访问过于频繁,请稍后再试"),
ILLEGAL_REQUEST_ERROR(1004, "非法请求,请重新刷新页面操作"),
IMAGE_FILE_EXT_ERROR(1005, "不支持图片格式"),
PLATFORM_NOT_SUPPORTED_IM(1006, "平台未开启IM"),
STORE_NOT_SUPPORTED_IM(1007, "店铺未开启IM"),
/**
* 分类
*/
@@ -334,7 +336,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

@@ -35,9 +35,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;
@@ -51,9 +52,6 @@ public class DraftGoods extends BaseEntity {
@ApiModelProperty(value = "卖点")
private String sellingPoint;
@ApiModelProperty(value = "重量")
@Max(value = 99999999, message = "重量不能超过99999999")
private Double weight;
/**
* @see GoodsStatusEnum
*/
@@ -67,14 +65,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;

View File

@@ -20,6 +20,9 @@ import lombok.EqualsAndHashCode;
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;
/**
@@ -35,17 +38,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;
@@ -56,129 +59,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;
@@ -209,9 +152,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();
@@ -219,8 +159,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

@@ -30,6 +30,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;
@@ -47,28 +53,6 @@ public class GoodsOperationDTO implements Serializable {
@Length(max = 50, message = "商品名称不能超过50个字符")
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 = "市场价格不能为空")
@Min(value = 0, message = "市场价格不能为负数")
@Max(value = 99999999, message = "市场价格不能超过99999999")
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

@@ -3,6 +3,7 @@ package cn.lili.modules.member.serviceimpl;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.modules.member.entity.enums.PointTypeEnum;
import cn.lili.modules.system.entity.dto.PointSettingItem;
import cn.lili.rocketmq.RocketmqSendCallbackBuilder;
import cn.lili.rocketmq.tags.MemberTagsEnum;
import cn.lili.common.security.AuthUser;
@@ -118,24 +119,19 @@ public class MemberSignServiceImpl extends ServiceImpl<MemberSignMapper, MemberS
if (setting != null) {
PointSetting pointSetting = new Gson().fromJson(setting.getSettingValue(), PointSetting.class);
String content = "";
Long point = -1L;
//将对象转换成map 方便签到天数和签到积分数获取,方便扩展
Map map = StringUtils.objectToMap(pointSetting);
for (int i = 1; i <= 4; i++) {
//连续签到数
Object dayObj = map.get("signIn" + i);
//连续签到赠送积分
Object pointObj = map.get("signIn" + i + "Point");
if (dayObj != null && pointObj != null) {
//如果当前连续赠送天数等于设置连续赠送天数 则记录赠送积分数
if (dayObj == day) {
point = Long.valueOf(map.get("signIn" + i + "Point").toString());
//赠送积分
Long point = null;
List<PointSettingItem> pointSettingItems = pointSetting.getPointSettingItems();
if (!pointSettingItems.isEmpty()) {
for (PointSettingItem item : pointSettingItems) {
if (item.getDay().equals(day)) {
point = item.getPoint().longValue();
content = "会员连续签到" + day + "天,赠送积分" + point + "";
}
}
}
//如果他不处于连续赠送阶段,则只赠送签到积分数
if (point == -1 && pointSetting.getSignIn() != null) {
if (point == null && pointSetting.getSignIn() != null) {
point = Long.valueOf(pointSetting.getSignIn().toString());
content = "会员签到第" + day + "天,赠送积分" + point + "";
}

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

@@ -56,7 +56,7 @@ public class MemberAddressServiceImpl extends ServiceImpl<MemberAddressMapper, M
@Override
public MemberAddress saveMemberAddress(MemberAddress memberAddress) {
//判断当前地址是否为默认地址,如果为默认需要将其他的地址修改为非默认
updateDefaultShippingAddress(memberAddress);
removeDefaultAddress(memberAddress);
//添加会员地址
this.save(memberAddress);
@@ -65,8 +65,18 @@ public class MemberAddressServiceImpl extends ServiceImpl<MemberAddressMapper, M
@Override
public MemberAddress updateMemberAddress(MemberAddress memberAddress) {
//判断当前地址是否为默认地址,如果为默认需要将其他的地址修改为非默认
updateDefaultShippingAddress(memberAddress);
MemberAddress originalMemberAddress = this.getMemberAddress(memberAddress.getId());
if (originalMemberAddress != null &&
originalMemberAddress.getMemberId().equals(UserContext.getCurrentUser().getId())) {
if (memberAddress.getIsDefault() == null) {
memberAddress.setIsDefault(false);
}
//判断当前地址是否为默认地址,如果为默认需要将其他的地址修改为非默认
removeDefaultAddress(memberAddress);
this.saveOrUpdate(memberAddress);
}
return memberAddress;
}
@@ -81,7 +91,7 @@ public class MemberAddressServiceImpl extends ServiceImpl<MemberAddressMapper, M
*
* @param memberAddress 收件地址
*/
private void updateDefaultShippingAddress(MemberAddress memberAddress) {
private void removeDefaultAddress(MemberAddress memberAddress) {
//如果不是默认地址不需要处理
if (memberAddress.getIsDefault()) {
//将会员的地址修改为非默认地址
@@ -89,11 +99,6 @@ public class MemberAddressServiceImpl extends ServiceImpl<MemberAddressMapper, M
lambdaUpdateWrapper.set(MemberAddress::getIsDefault, false);
lambdaUpdateWrapper.eq(MemberAddress::getMemberId, memberAddress.getMemberId());
this.update(lambdaUpdateWrapper);
//修改会员地址
this.update(memberAddress,
new QueryWrapper<MemberAddress>()
.eq("id", memberAddress.getId()));
}
}

View File

@@ -97,6 +97,11 @@ public class Store extends BaseEntity {
@ApiModelProperty(value = "腾讯云智服小程序唯一标识")
private String yzfMpSign;
@ApiModelProperty(value = "udesk IM标识")
private String merchantEuid;
public Store(Member member) {
this.memberId = member.getId();
this.memberName = member.getUsername();

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;

View File

@@ -0,0 +1,26 @@
package cn.lili.modules.system.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* IM设置
*
* @author Bulbasaur
* @since 2021/5/16 11:10 下午
*/
@Data
public class ImSetting implements Serializable {
@ApiModelProperty(value = "平台地址")
private String httpUrl;
@ApiModelProperty(value = "平台ID")
private Integer tenantId;
}

View File

@@ -31,6 +31,8 @@ public enum SettingEnum {
EXPERIENCE_SETTING,
//秒杀活动设置
SECKILL_SETTING,
//IM 配置
IM_SETTING,
//微信 联合登陆设置
WECHAT_CONNECT,