| | |
| | | package com.mzl.flower.service; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.mzl.flower.base.cache.MarkupCacheClient; |
| | | import com.mzl.flower.base.cache.StringCacheClient; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.constant.Constants; |
| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.security.oauth2.common.OAuth2AccessToken; |
| | | import org.springframework.security.oauth2.common.OAuth2RefreshToken; |
| | | import org.springframework.security.oauth2.provider.token.TokenStore; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import static java.time.format.DateTimeFormatter.BASIC_ISO_DATE; |
| | | |
| | | @Service |
| | | public class BaseService { |
| | | |
| | | @Autowired |
| | |
| | | protected Member getMember(Long levelId){ |
| | | return memberMapper.selectById(levelId); |
| | | } |
| | | |
| | | @Autowired |
| | | private StringCacheClient stringCacheClient; |
| | | |
| | | @Autowired |
| | | private TokenStore tokenStore; |
| | | |
| | | public static final String TOKEN_KEY = "TOKEN-KEY"; |
| | | |
| | | public static final String SEPARATOR = ":"; |
| | | |
| | | protected double getServiceFeeRate(List<FeeService> fees, Integer saleCount){ |
| | | int sc = saleCount == null ? 0 : saleCount; |
| | |
| | | break; |
| | | } |
| | | } |
| | | fp = fp.add(b); |
| | | fp = fp.add(getAmount(b)); |
| | | dto.setFirstFee(b); |
| | | } |
| | | |
| | |
| | | break; |
| | | } |
| | | } |
| | | fp = fp.add(b); |
| | | fp = fp.add(getAmount(b)); |
| | | dto.setSecondFee(b); |
| | | |
| | | FlowerMarkupSpCg fmpsc = null; |
| | |
| | | break; |
| | | } |
| | | } |
| | | fp = fp.add(b); |
| | | fp = fp.add(getAmount(b)); |
| | | dto.setPartnerFee(b); |
| | | } |
| | | |
| | |
| | | break; |
| | | } |
| | | } |
| | | fp = fp.add(b); |
| | | fp = fp.add(getAmount(b)); |
| | | } |
| | | |
| | | //二次加价 |
| | |
| | | break; |
| | | } |
| | | } |
| | | fp = fp.add(b); |
| | | fp = fp.add(getAmount(b)); |
| | | |
| | | return fp; |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | public void removeToken(String userId) { |
| | | String tokenCache = stringCacheClient.get(TOKEN_KEY + SEPARATOR + userId); |
| | | if (StringUtils.isNotBlank(tokenCache)) { |
| | | //强制删除token,下线 |
| | | if (StringUtils.isNotBlank(tokenCache) && StringUtils.isNotBlank(userId)) { |
| | | stringCacheClient.delete(TOKEN_KEY + SEPARATOR + userId); |
| | | String tokenValue = tokenCache.replace(OAuth2AccessToken.BEARER_TYPE, StrUtil.EMPTY).trim(); |
| | | OAuth2AccessToken accessToken = tokenStore.readAccessToken(tokenValue); |
| | | if (accessToken != null && StringUtils.isNotBlank(accessToken.getValue())) { |
| | | tokenStore.removeAccessToken(accessToken); |
| | | OAuth2RefreshToken refreshToken = accessToken.getRefreshToken(); |
| | | tokenStore.removeRefreshToken(refreshToken); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |