Skip to content

Commit

Permalink
Merge branch 'liushuai'
Browse files Browse the repository at this point in the history
解决积分商品购买问题,部分参数校验问题,等各种问题优化

# Conflicts:
#	framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsOperationDTO.java
  • Loading branch information
chopper711 committed Sep 24, 2021
2 parents c8de423 + d9b1d78 commit 76fcf84
Show file tree
Hide file tree
Showing 21 changed files with 225 additions and 257 deletions.
2 changes: 2 additions & 0 deletions DB/version4.2.2to4.2.3.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/** 新增会员获的总积分 **/
ALTER TABLE li_store ADD merchant_euid varchar(255) COMMENT '客服标识';
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ public ResultMessage<MemberAddress> addShippingAddress(@Valid MemberAddress ship
@ApiOperation(value = "修改会员收件地址")
@PutMapping
public ResultMessage<MemberAddress> editShippingAddress(@Valid MemberAddress shippingAddress) {
//修改会员地址
shippingAddress.setMemberId(UserContext.getCurrentUser().getId());
if(shippingAddress.getIsDefault()==null){
shippingAddress.setIsDefault(false);
}
return ResultUtil.data(memberAddressService.updateMemberAddress(shippingAddress));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package cn.lili.controller.common;


import cn.hutool.json.JSONUtil;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.system.entity.dos.Setting;
import cn.lili.modules.system.entity.dto.ImSetting;
import cn.lili.modules.system.entity.enums.SettingEnum;
import cn.lili.modules.system.service.SettingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* IM控制器
*
* @author Chopper
* @version v1.0
* 2021-09-16 15:32
*/
@RestController
@RequestMapping("/common/IM")
@Api(tags = "IM 中心")
public class IMController {

@Autowired
private SettingService settingService;

@ApiOperation(value = "获取店铺列表分页")
@GetMapping
public ResultMessage<String> getUrl() {
String imUrl;
try {
Setting imSettingVal = settingService.get(SettingEnum.IM_SETTING.name());
ImSetting imSetting = JSONUtil.toBean(imSettingVal.getSettingValue(), ImSetting.class);
imUrl = imSetting.getHttpUrl() + "?tenant_id=" + imSetting.getTenantId()+"&merchant_euid=";
} catch (Exception e) {
throw new ServiceException(ResultCode.PLATFORM_NOT_SUPPORTED_IM);
}
return ResultUtil.data(imUrl);
}

}
56 changes: 35 additions & 21 deletions consumer/src/main/java/cn/lili/event/impl/MemberPointExecute.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import cn.lili.modules.order.order.entity.dto.OrderMessage;
import cn.lili.modules.order.order.entity.enums.OrderPromotionTypeEnum;
import cn.lili.modules.order.order.entity.enums.OrderStatusEnum;
import cn.lili.modules.order.order.entity.enums.PayStatusEnum;
import cn.lili.modules.order.order.service.OrderService;
import cn.lili.modules.order.trade.entity.enums.AfterSaleStatusEnum;
import cn.lili.modules.system.entity.dos.Setting;
Expand Down Expand Up @@ -62,7 +63,7 @@ public void memberRegister(Member member) {
//获取积分设置
PointSetting pointSetting = getPointSetting();
//赠送会员积分
memberService.updateMemberPoint(Long.valueOf(pointSetting.getRegister().longValue()), PointTypeEnum.INCREASE.name(), member.getId(), "会员注册,赠送积分" + pointSetting.getRegister() + "分");
memberService.updateMemberPoint(pointSetting.getRegister().longValue(), PointTypeEnum.INCREASE.name(), member.getId(), "会员注册,赠送积分" + pointSetting.getRegister() + "分");
}

/**
Expand All @@ -75,7 +76,7 @@ public void goodsComment(MemberEvaluation memberEvaluation) {
//获取积分设置
PointSetting pointSetting = getPointSetting();
//赠送会员积分
memberService.updateMemberPoint(Long.valueOf(pointSetting.getComment().longValue()), PointTypeEnum.INCREASE.name(), memberEvaluation.getMemberId(), "会员评价,赠送积分" + pointSetting.getComment() + "分");
memberService.updateMemberPoint(pointSetting.getComment().longValue(), PointTypeEnum.INCREASE.name(), memberEvaluation.getMemberId(), "会员评价,赠送积分" + pointSetting.getComment() + "分");
}

/**
Expand All @@ -86,30 +87,43 @@ public void goodsComment(MemberEvaluation memberEvaluation) {
@Override
public void orderChange(OrderMessage orderMessage) {

if (orderMessage.getNewStatus().equals(OrderStatusEnum.COMPLETED)) {
Order order = orderService.getBySn(orderMessage.getOrderSn());
//根据订单编号获取订单数据,如果订单促销类型不为空,并且订单促销类型为积分订单 则直接返回
if (StringUtils.isNotEmpty(order.getOrderPromotionType()) && order.getOrderPromotionType().equals(OrderPromotionTypeEnum.POINTS.name())) {
return;
switch (orderMessage.getNewStatus()) {
case CANCELLED: {
Order order = orderService.getBySn(orderMessage.getOrderSn());
Long point = order.getPriceDetailDTO().getPayPoint();
if (point <= 0) {
return;
}
//如果未付款,则不去要退回相关代码执行
if (order.getPayStatus().equals(PayStatusEnum.UNPAID.name())) {
return;
}
String content = "订单取消,积分返还:" + point + "分";
//赠送会员积分
memberService.updateMemberPoint(point, PointTypeEnum.INCREASE.name(), order.getMemberId(), content);
break;
}
//获取积分设置
PointSetting pointSetting = getPointSetting();
//计算赠送积分数量
Double point = CurrencyUtil.mul(pointSetting.getMoney(), order.getFlowPrice(), 0);
//赠送会员积分
memberService.updateMemberPoint(point.longValue(), PointTypeEnum.INCREASE.name(), order.getMemberId(), "会员下单,赠送积分" + point + "分");
//取消订单恢复积分
} else if (orderMessage.getNewStatus().equals(OrderStatusEnum.CANCELLED)) {
//根据订单编号获取订单数据,如果为积分订单则跳回
Order order = orderService.getBySn(orderMessage.getOrderSn());
//增加对积分订单的判定,如果积分支付,取消订单则退还用户积分
if (StringUtils.isNotEmpty(order.getOrderPromotionType()) &&
order.getOrderPromotionType().equals(OrderPromotionTypeEnum.POINTS.name()) && order.getPriceDetailDTO().getPayPoint() != null) {
memberService.updateMemberPoint(Convert.toLong(order.getPriceDetailDTO().getPayPoint()), PointTypeEnum.INCREASE.name(), order.getMemberId(), "订单取消,恢复积分:" + order.getPriceDetailDTO().getPayPoint() + "分");
case COMPLETED: {
Order order = orderService.getBySn(orderMessage.getOrderSn());
//根据订单编号获取订单数据,如果订单促销类型不为空,并且订单促销类型为积分订单 则直接返回
if (StringUtils.isNotEmpty(order.getOrderPromotionType()) && order.getOrderPromotionType().equals(OrderPromotionTypeEnum.POINTS.name())) {
return;
}
//获取积分设置
PointSetting pointSetting = getPointSetting();
//计算赠送积分数量
Double point = CurrencyUtil.mul(pointSetting.getMoney(), order.getFlowPrice(), 0);
//赠送会员积分
memberService.updateMemberPoint(point.longValue(), PointTypeEnum.INCREASE.name(), order.getMemberId(), "会员下单,赠送积分" + point + "分");
break;
}

default:
break;
}
}


/**
* 提交售后后扣除积分
*
Expand Down
57 changes: 0 additions & 57 deletions consumer/src/main/java/cn/lili/event/impl/PointExecute.java

This file was deleted.

5 changes: 4 additions & 1 deletion framework/src/main/java/cn/lili/common/enums/ResultCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
/**
* 分类
*/
Expand Down Expand Up @@ -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, "积分商品库存不足"),

/**
* 砍价活动
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public <T> QueryWrapper<T> storeQueryWrapper() {

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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
*/
Expand All @@ -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;

Expand Down
Loading

0 comments on commit 76fcf84

Please sign in to comment.