master:档口访问量功能完善;

pull/1121/head
liujiang 2025-09-20 20:32:32 +08:00
parent ac0720f3f4
commit 47dea21304
4 changed files with 38 additions and 1 deletions

View File

@ -300,6 +300,9 @@ public class CacheConstants {
*
*/
public static final String RECHARGE_BILL_NO_CACHE = "recharge_bill_no_cache:";
/**
* 访
*/
public static final String STORE_VISIT_COUNT = "store_visit_count";
}

View File

@ -804,6 +804,32 @@ public class XktTask {
}
}
/**
* 2:05访
*/
@Transactional
public void updateStoreVisitCount() {
// 档口访问量
Map<String, Long> storeVisitMap = redisCache.getCacheMap(CacheConstants.STORE_VISIT_COUNT);
if (MapUtil.isEmpty(storeVisitMap)) {
return;
}
List<Store> storeList = this.storeMapper.selectList(new LambdaQueryWrapper<Store>()
.eq(Store::getDelFlag, Constants.UNDELETED));
if (CollectionUtils.isEmpty(storeList)) {
return;
}
storeList.forEach(store -> {
Long viewCount = storeVisitMap.getOrDefault(store.getId().toString(), 0L);
Long existViewCount = ObjectUtils.defaultIfNull(store.getViewCount(), 0L);
store.setViewCount(existViewCount + viewCount);
// 清除当日缓存
redisCache.deleteCacheMapValue(CacheConstants.STORE_VISIT_COUNT, store.getId().toString());
});
// 更新档口访问量
this.storeMapper.updateById(storeList);
}
/**
* 22:00:10 广 biddingTempStatusbiddingStatus

View File

@ -144,5 +144,9 @@ public class Store extends XktBaseEntity {
* 1 2 3
*/
private Integer stockSys;
/**
*
*/
private Long viewCount;
}

View File

@ -217,6 +217,8 @@ public class StoreServiceImpl implements IStoreService {
@Override
@Transactional(readOnly = true)
public StoreAppResDTO getAppInfo(Long storeId) {
// 档口访问次数+1
redisCache.valueIncr(CacheConstants.STORE_VISIT_COUNT, storeId);
Store store = Optional.ofNullable(this.storeMapper.selectOne(new LambdaQueryWrapper<Store>()
.eq(Store::getId, storeId).eq(Store::getDelFlag, Constants.UNDELETED)))
.orElseThrow(() -> new ServiceException("档口不存在!", HttpStatus.ERROR));
@ -480,6 +482,8 @@ public class StoreServiceImpl implements IStoreService {
@Override
@Transactional(readOnly = true)
public StoreSimpleResDTO getSimpleInfo(Long storeId) {
// 档口访问次数+1
redisCache.valueIncr(CacheConstants.STORE_VISIT_COUNT, storeId);
StoreSimpleResDTO simpleDTO = this.storeMapper.getSimpleInfo(storeId);
// 获取档口LOGO
if (ObjectUtils.isNotEmpty(simpleDTO.getStoreLogoId())) {