积分订单、用户下单积分数值判断
This commit is contained in:
@@ -125,6 +125,7 @@ public enum ResultCode {
|
||||
USER_OVERDUE_CONNECT_ERROR(20022, "授权信息已过期,请重新授权/登录"),
|
||||
USER_CONNECT_BANDING_ERROR(20023, "当前联合登陆方式,已绑定其他账号,需进行解绑操作"),
|
||||
USER_CONNECT_NOT_EXIST_ERROR(20024, "暂无联合登陆信息,无法实现一键注册功能,请点击第三方登录进行授权"),
|
||||
USER_POINTS_ERROR(20024, "用户积分不足"),
|
||||
|
||||
/**
|
||||
* 权限
|
||||
|
||||
@@ -10,6 +10,8 @@ import cn.lili.modules.goods.entity.dos.GoodsSku;
|
||||
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
|
||||
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
|
||||
import cn.lili.modules.goods.service.GoodsSkuService;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.cart.entity.enums.CartTypeEnum;
|
||||
import cn.lili.modules.order.cart.entity.enums.DeliveryMethodEnum;
|
||||
@@ -49,6 +51,9 @@ public class CheckDataRender implements CartRenderStep {
|
||||
@Autowired
|
||||
private PintuanService pintuanService;
|
||||
|
||||
@Autowired
|
||||
private MemberService memberService;
|
||||
|
||||
@Override
|
||||
public void render(TradeDTO tradeDTO) {
|
||||
//预校验
|
||||
@@ -159,9 +164,12 @@ public class CheckDataRender implements CartRenderStep {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else if(tradeDTO.getCartTypeEnum().equals(CartTypeEnum.KANJIA)){
|
||||
|
||||
//积分商品,判断用户积分是否满足
|
||||
}else if(tradeDTO.getCartTypeEnum().equals(CartTypeEnum.POINTS)){
|
||||
Member member=memberService.getUserInfo();
|
||||
if(member.getPoint()<tradeDTO.getSkuList().get(0).getPoint()){
|
||||
throw new ServiceException(ResultCode.USER_POINTS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -207,8 +207,8 @@ public class PointsGoodsServiceImpl extends ServiceImpl<PointsGoodsMapper, Point
|
||||
public PointsGoodsVO getPointsGoodsVOByMongo(String skuId) {
|
||||
//mongo查询条件
|
||||
Query query = new Query();
|
||||
query.addCriteria(Criteria.where("skuId").ne(skuId))
|
||||
.addCriteria(Criteria.where("promotionStatus").ne(PromotionStatusEnum.START.name()));
|
||||
query.addCriteria(Criteria.where("skuId").is(skuId))
|
||||
.addCriteria(Criteria.where("promotionStatus").is(PromotionStatusEnum.START.name()));
|
||||
List<PointsGoodsVO> pointsGoodsVO=this.mongoTemplate.find(query, PointsGoodsVO.class);
|
||||
return pointsGoodsVO.get(0);
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class PromotionServiceImpl implements PromotionService {
|
||||
break;
|
||||
//积分商品
|
||||
case POINTS_GOODS:
|
||||
result = this.updatePointsGoods(promotionMessage, esPromotionKey, promotionTypeEnum);
|
||||
result = this.updatePointsGoods(promotionMessage, promotionTypeEnum);
|
||||
break;
|
||||
//砍价商品商品
|
||||
case KANJIA:
|
||||
@@ -439,11 +439,10 @@ public class PromotionServiceImpl implements PromotionService {
|
||||
* 修改积分商品状态
|
||||
*
|
||||
* @param promotionMessage 信息队列传输促销信息实体
|
||||
* @param esPromotionKey es Key
|
||||
* @param promotionTypeEnum 促销分类枚举
|
||||
* @return 修改结果
|
||||
*/
|
||||
private boolean updatePointsGoods(PromotionMessage promotionMessage, String esPromotionKey, PromotionTypeEnum promotionTypeEnum) {
|
||||
private boolean updatePointsGoods(PromotionMessage promotionMessage, PromotionTypeEnum promotionTypeEnum) {
|
||||
boolean result;
|
||||
PointsGoodsVO pointsGoodsVO = this.mongoTemplate.findById(promotionMessage.getPromotionId(), PointsGoodsVO.class);
|
||||
if (pointsGoodsVO == null) {
|
||||
@@ -452,8 +451,6 @@ public class PromotionServiceImpl implements PromotionService {
|
||||
}
|
||||
pointsGoodsVO.setPromotionStatus(promotionMessage.getPromotionStatus());
|
||||
result = this.pointsGoodsService.update(updateWrapper(promotionMessage));
|
||||
PointsGoods pointsGoods = JSONUtil.toBean(JSONUtil.toJsonStr(pointsGoodsVO), PointsGoods.class);
|
||||
this.goodsIndexService.updateEsGoodsIndex(pointsGoodsVO.getSkuId(), pointsGoods, esPromotionKey, null);
|
||||
this.mongoTemplate.save(pointsGoodsVO);
|
||||
return result;
|
||||
}
|
||||
@@ -528,6 +525,7 @@ public class PromotionServiceImpl implements PromotionService {
|
||||
|
||||
/**
|
||||
* 根据消息,获取update wrapper
|
||||
*
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user