You've already forked FrameTour-BE
bug
This commit is contained in:
@ -18,16 +18,18 @@ public class OrderRepository {
|
||||
public static final String ORDER_ITEM_CACHE_KEY = "order:user:%s:type:%s:id:%s";
|
||||
|
||||
public boolean checkUserBuyItem(Long userId, int goodsType, Long goodsId) {
|
||||
if (redisTemplate.hasKey(String.format(ORDER_ITEM_CACHE_KEY, userId, goodsType, goodsId))) {
|
||||
return "1".equals(redisTemplate.opsForValue().get(String.format(ORDER_ITEM_CACHE_KEY, userId, goodsType, goodsId)));
|
||||
synchronized (this) {
|
||||
if (redisTemplate.hasKey(String.format(ORDER_ITEM_CACHE_KEY, userId, goodsType, goodsId))) {
|
||||
return "1".equals(redisTemplate.opsForValue().get(String.format(ORDER_ITEM_CACHE_KEY, userId, goodsType, goodsId)));
|
||||
}
|
||||
OrderEntity orderEntity = orderMapper.getUserBuyItem(userId, goodsType, goodsId);
|
||||
if (orderEntity == null) {
|
||||
redisTemplate.opsForValue().set(String.format(ORDER_ITEM_CACHE_KEY, userId, goodsType, goodsId), "0", 60, TimeUnit.SECONDS);
|
||||
return false;
|
||||
}
|
||||
redisTemplate.opsForValue().set(String.format(ORDER_ITEM_CACHE_KEY, userId, goodsType, goodsId), "1");
|
||||
return true;
|
||||
}
|
||||
OrderEntity orderEntity = orderMapper.getUserBuyItem(userId, goodsType, goodsId);
|
||||
if (orderEntity == null) {
|
||||
redisTemplate.opsForValue().set(String.format(ORDER_ITEM_CACHE_KEY, userId, goodsType, goodsId), "0", 60, TimeUnit.SECONDS);
|
||||
return false;
|
||||
}
|
||||
redisTemplate.opsForValue().set(String.format(ORDER_ITEM_CACHE_KEY, userId, goodsType, goodsId), "1");
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean checkUserBuyFaceSourceImage(Long userId, Long faceId) {
|
||||
|
@ -5,12 +5,14 @@ import com.ycwl.basic.mapper.FaceMapper;
|
||||
import com.ycwl.basic.mapper.FaceSampleMapper;
|
||||
import com.ycwl.basic.mapper.TemplateMapper;
|
||||
import com.ycwl.basic.model.pc.template.entity.TemplateConfigEntity;
|
||||
import com.ycwl.basic.model.pc.template.entity.TemplateEntity;
|
||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||
import com.ycwl.basic.utils.SnowFlakeUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@ -44,6 +46,14 @@ public class TemplateRepository {
|
||||
}
|
||||
}
|
||||
|
||||
public List<TemplateRespVO> getAllEnabledTemplateList() {
|
||||
List<TemplateEntity> entityList = templateMapper.listEnabled();
|
||||
if (entityList == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return entityList.stream().map(entity -> getTemplate(entity.getId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<TemplateRespVO> getTemplateListByScenicId(Long scenicId) {
|
||||
List<Long> idList;
|
||||
if (redisTemplate.hasKey(String.format(TEMPLATE_ID_BY_SCENIC_ID_CACHE_KEY, scenicId))) {
|
||||
|
Reference in New Issue
Block a user