update 汇付会员

This commit is contained in:
2023-06-09 16:10:25 +08:00
parent b42fc8a6cf
commit ea0ba0c03c
5 changed files with 37 additions and 3 deletions

View File

@@ -23,7 +23,9 @@ public class CacheConstants {
public static final int cache_expire_time_1d = 60 * 60 * 24;
public static final String PILE_PROGRAM_VERSION = "pile_program_version";
public static final String ADAPAY_MEMBER_INFO = "adapay_member_info:";
public static final String PILE_PROGRAM_VERSION = "pile_program_version_";
public static final String QUERY_ORDER_CALLBACK = "query_order_callback:";

View File

@@ -16,4 +16,6 @@ public interface AdapayMemberInfoService {
int updateByPrimaryKey(AdapayMemberInfo record);
AdapayMemberInfo selectByMerchantId(String merchantId);
AdapayMemberInfo selectByStationId(String stationId);
}

View File

@@ -70,4 +70,6 @@ public interface IPileMerchantInfoService {
* @return
*/
List<String> queryByMerchantDeptIds(List<String> merchantDeptIds);
}

View File

@@ -1,8 +1,13 @@
package com.jsowell.pile.service.impl;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.pile.domain.AdapayMemberInfo;
import com.jsowell.pile.domain.PileStationInfo;
import com.jsowell.pile.mapper.AdapayMemberInfoMapper;
import com.jsowell.pile.service.AdapayMemberInfoService;
import com.jsowell.pile.service.IPileStationInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -12,6 +17,12 @@ public class AdapayMemberInfoServiceImpl implements AdapayMemberInfoService {
@Resource
private AdapayMemberInfoMapper adapayMemberInfoMapper;
@Autowired
private RedisCache redisCache;
@Autowired
private IPileStationInfoService pileStationInfoService;
@Override
public int deleteByPrimaryKey(Integer id) {
return adapayMemberInfoMapper.deleteByPrimaryKey(id);
@@ -44,7 +55,24 @@ public class AdapayMemberInfoServiceImpl implements AdapayMemberInfoService {
@Override
public AdapayMemberInfo selectByMerchantId(String merchantId) {
return adapayMemberInfoMapper.selectByMerchantId(merchantId);
String redisKey = CacheConstants.ADAPAY_MEMBER_INFO + merchantId;
AdapayMemberInfo adapayMemberInfo = redisCache.getCacheObject(redisKey);
if (adapayMemberInfo == null) {
adapayMemberInfo = adapayMemberInfoMapper.selectByMerchantId(merchantId);
if (adapayMemberInfo != null) {
redisCache.setCacheObject(redisKey, adapayMemberInfo, CacheConstants.cache_expire_time_1d);
}
}
return adapayMemberInfo;
}
@Override
public AdapayMemberInfo selectByStationId(String stationId) {
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(Long.parseLong(stationId));
if (pileStationInfo != null) {
return selectByMerchantId(pileStationInfo.getMerchantId() + "");
}
return null;
}
}

View File

@@ -87,7 +87,7 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
if (pileStationInfo == null) {
// 查数据库
pileStationInfo = pileStationInfoMapper.selectPileStationInfoById(id);
redisCache.setCacheObject(redisKey, pileStationInfo, 5, TimeUnit.MINUTES);
redisCache.setCacheObject(redisKey, pileStationInfo, 15, TimeUnit.MINUTES);
}
return pileStationInfo;
}