会员调整
This commit is contained in:
parent
fc2757ff17
commit
9f9b292919
|
|
@ -38,7 +38,7 @@ public class MemberDeliverTask {
|
|||
// @Scheduled(cron = "0 0 1 * * ? ")
|
||||
public void run() {
|
||||
shopUserService.list(new QueryWrapper().eq(ShopUser::getIsVip, 1).lt(ShopUser::getNextDeliverTime, DateUtil.date().toLocalDateTime())).forEach(item -> {
|
||||
memberConfigService.deliver(item.getShopId(), item.getUserId(), TableValueConstant.MemberExpFlow.Type.MEMBER_TASK, null, null, null);
|
||||
memberConfigService.deliver(item.getSourceShopId(), item.getUserId(), TableValueConstant.MemberExpFlow.Type.MEMBER_TASK, null, null, null);
|
||||
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class MemberOrderServiceImpl extends ServiceImpl<MemberOrderMapper, Membe
|
|||
AssertUtil.isNull(userInfo, "生成订单失败,用户信息不存在");
|
||||
}
|
||||
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getShopId, orderDTO.getShopId()).eq(ShopUser::getUserId, orderDTO.getUserId()));
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getSourceShopId, orderDTO.getShopId()).eq(ShopUser::getUserId, orderDTO.getUserId()));
|
||||
AssertUtil.isNull(shopUser, "生成订单失败,用户信息不存在");
|
||||
|
||||
|
||||
|
|
@ -83,14 +83,14 @@ public class MemberOrderServiceImpl extends ServiceImpl<MemberOrderMapper, Membe
|
|||
canOpen = switch (item.getCode()) {
|
||||
case "BIND_PHONE" -> StrUtil.isNotBlank(shopUser.getPhone());
|
||||
case "ORDER" ->
|
||||
orderInfoService.count(new QueryWrapper().eq(OrderInfo::getShopId, shopUser.getShopId()).eq(OrderInfo::getUserId, shopUser.getUserId())
|
||||
orderInfoService.count(new QueryWrapper().eq(OrderInfo::getShopId, shopUser.getSourceShopId()).eq(OrderInfo::getUserId, shopUser.getUserId())
|
||||
.notIn(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode(), OrderStatusEnums.CANCELLED.getCode())) > Integer.parseInt(item.getValue());
|
||||
case "COST_AMOUNT" ->
|
||||
orderInfoService.list(new QueryWrapper().eq(OrderInfo::getShopId, shopUser.getShopId()).eq(OrderInfo::getUserId, shopUser.getUserId())
|
||||
orderInfoService.list(new QueryWrapper().eq(OrderInfo::getShopId, shopUser.getSourceShopId()).eq(OrderInfo::getUserId, shopUser.getUserId())
|
||||
.notIn(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode(), OrderStatusEnums.CANCELLED.getCode()))
|
||||
.stream().map(OrderInfo::getPayAmount).reduce(BigDecimal.ZERO, BigDecimal::add).compareTo(new BigDecimal(item.getValue())) > 0;
|
||||
case "RECHARGE_AMOUNT" ->
|
||||
orderPaymentService.list(new QueryWrapper().eq(OrderPayment::getShopId, shopUser.getShopId())
|
||||
orderPaymentService.list(new QueryWrapper().eq(OrderPayment::getShopId, shopUser.getSourceShopId())
|
||||
.eq(OrderPayment::getSourceId, shopUser.getId()).isNotNull(OrderPayment::getTradeNumber))
|
||||
.stream().map(OrderPayment::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add).compareTo(new BigDecimal(item.getValue())) > 0;
|
||||
default -> throw new CzgException("会员开通条件类型错误");
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class MkShopConsumeDiscountRecordServiceImpl extends ServiceImpl<MkShopCo
|
|||
|
||||
@Override
|
||||
public MkShopConsumeDiscountRecord getDiscount(Long shopId, Long userId, Long orderId) {
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getUserId, userId).eq(ShopUser::getShopId, shopId));
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getUserId, userId).eq(ShopUser::getSourceShopId, shopId));
|
||||
MkShopConsumeDiscountRecord discountRecord = getOne(new QueryWrapper().eq(MkShopConsumeDiscountRecord::getShopId, shopId)
|
||||
.eq(MkShopConsumeDiscountRecord::getOrderId, orderId)
|
||||
.eq(MkShopConsumeDiscountRecord::getShopUserId, shopUser.getId()));
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ public class MkShopCouponRecordServiceImpl extends ServiceImpl<MkShopCouponRecor
|
|||
|
||||
@Override
|
||||
public Boolean grant(Long shopId, MkRewardCouponDTO rewardCouponDTO) {
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, rewardCouponDTO.getUserId()));
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getSourceShopId, shopId).eq(ShopUser::getUserId, rewardCouponDTO.getUserId()));
|
||||
MkShopCouponGiftDTO giftDTO = new MkShopCouponGiftDTO().setCouponId(rewardCouponDTO.getCouponId())
|
||||
.setShopId(shopId)
|
||||
.setSourceId(rewardCouponDTO.getUserId())
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
|||
Page<Object> page = PageUtil.buildPage();
|
||||
List<Long> shopUserIds = shopUserService.queryChain()
|
||||
.eq(ShopUser::getUserId, userId)
|
||||
.eq(ShopUser::getShopId, shopId)
|
||||
.eq(ShopUser::getSourceShopId, shopId)
|
||||
.select(ShopUser::getId).listAs(Long.class);
|
||||
if (CollectionUtil.isNotEmpty(shopUserIds)) {
|
||||
PageHelper.startPage(Math.toIntExact(page.getPageNumber()), Math.toIntExact(page.getPageSize()));
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deliver(Long shopId, Long userId, TableValueConstant.MemberExpFlow.Type type, BigDecimal money, Integer expVal, Long sourceId) {
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, userId));
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getSourceShopId, shopId).eq(ShopUser::getUserId, userId));
|
||||
if (shopUser == null || shopUser.getIsVip() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -304,7 +304,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean joinMember(Long shopId, Long userId, Long memberOrderId) {
|
||||
MemberConfigVO memberConfigVO = detail(shopId);
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, userId));
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getSourceShopId, shopId).eq(ShopUser::getUserId, userId));
|
||||
if (shopUser == null) {
|
||||
log.warn("用户不存在, 店铺id: {}, 用户id: {}", shopId, userId);
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue