店铺会员返回优惠券数量
This commit is contained in:
@@ -5,19 +5,15 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.dto.shopuser.*;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.entity.ShopUserFlow;
|
||||
import com.czg.account.entity.UserInfo;
|
||||
import com.czg.account.service.ShopUserFlowService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.account.service.UserInfoService;
|
||||
import com.czg.account.entity.*;
|
||||
import com.czg.account.service.*;
|
||||
import com.czg.config.RedisCst;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.RedisService;
|
||||
import com.czg.service.account.mapper.ShopInfoMapper;
|
||||
import com.czg.service.account.mapper.ShopUserMapper;
|
||||
import com.czg.system.dto.SysParamsDTO;
|
||||
import com.czg.system.entity.SysParams;
|
||||
import com.czg.system.service.SysParamsService;
|
||||
import com.czg.utils.AssertUtil;
|
||||
@@ -34,7 +30,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
|
||||
import static com.mybatisflex.core.query.QueryMethods.column;
|
||||
|
||||
/**
|
||||
* 商户储值会员 服务层实现。
|
||||
@@ -54,6 +49,10 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
||||
private UserInfoService userInfoService;
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
@Resource
|
||||
private ShopActivateCouponRecordService shopActivateCouponRecordService;
|
||||
@Resource
|
||||
private ShopInfoMapper shopInfoMapper;
|
||||
|
||||
private ShopUser getUserInfo(Long shopId, Long shopUserId) {
|
||||
ShopUser shopUser = queryChain().eq(ShopUser::getShopId, shopId).eq(ShopUser::getId, shopUserId).one();
|
||||
@@ -251,4 +250,21 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
||||
shopUser.setUserId(userId);
|
||||
return save(shopUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShopUserDetailDTO getInfo(Long shopId, long userId) {
|
||||
ShopUser shopUser = getOne(new QueryWrapper().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, userId));
|
||||
if (shopUser == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
long couponNum = shopActivateCouponRecordService.count(new QueryWrapper().eq(ShopActivateCouponRecord::getShopUserId, shopUser.getId()).eq(ShopActivateCouponRecord::getStatus, 0));
|
||||
ShopUserDetailDTO shopUserDetailDTO = BeanUtil.copyProperties(shopUser, ShopUserDetailDTO.class);
|
||||
shopUserDetailDTO.setCouponNum(couponNum);
|
||||
|
||||
ShopInfo shopInfo = shopInfoMapper.selectOneById(shopId);
|
||||
shopUserDetailDTO.setShopName(shopInfo.getShopName());
|
||||
shopUserDetailDTO.setShopId(shopInfo.getId());
|
||||
return shopUserDetailDTO;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user