金币兑换钻石-公会金币结算-clanGoldSettlementMap RLocalCacheMap

This commit is contained in:
2022-11-21 19:55:19 +08:00
parent e6d9c9373d
commit 60c8645019
5 changed files with 5 additions and 6 deletions

View File

@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.redisson.api.RLocalCachedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@@ -64,7 +65,7 @@ public class ClanGoldSettlementService {
//为了userPureseService.subGolds那个校验
//先把他们设置为结算状态
Map<Long, Double> settlementGoldsMap = userPurseService.getClanGoldSettlementMap();
RLocalCachedMap<Long, Double> settlementGoldsMap = userPurseService.getClanGoldSettlementMap();
settlementGoldsMap.putAll(memberGoldsMap);
log.info("[公会金币结算] 设置结算状态 uids: {}", memberUids.stream().map(Object::toString).collect(Collectors.joining(", ")));
//冷却3秒等已经抢到lock准备subGolds都差不多执行完再结算

View File

@@ -56,7 +56,7 @@ public class GoldExchangeDiamondService {
private GoldExchangeDiamondConfigDto checkAndGetConfig(Long uid) {
//公会成员(除会长)要校验公会金币结算时间
Clan clan = clanService.getClanBaseInfoByUid(uid);
if (null != clan && !clan.getClanElderUid().equals(uid) && userPurseService.getClanGoldSettlementMap().containsKey(uid)){
if (null != clan && !clan.getClanElderUid().equals(uid) && userPurseService.getClanGoldSettlementMap().containsKey(Long.parseLong(uid.toString()))){
throw new ServiceException(BusiStatus.CLAN_GOLD_SETTLEMENT);
}

View File

@@ -324,7 +324,7 @@ public class UserPurseService extends ServiceImpl<UserPurseMapper,UserPurse> imp
return baseMapper.sumGoldNumAndDiamondNum();
}
public Map<Long, Double> getClanGoldSettlementMap() {
public RLocalCachedMap<Long, Double> getClanGoldSettlementMap() {
return clanGoldSettlementMap;
}

View File

@@ -1,5 +1,3 @@
#MySQL数据库配置
spring:
datasource:

View File

@@ -109,7 +109,7 @@
<jackson-module-kotlin.version>2.9.7</jackson-module-kotlin.version>
<jackson-mapper-asl.version>1.9.13</jackson-mapper-asl.version>
<sud-mgp-auth-java.version>1.0.2</sud-mgp-auth-java.version>
<redisson.version>3.16.8</redisson.version>
<redisson.version>3.18.0</redisson.version>
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
<esayexcel.version>3.1.1</esayexcel.version>
<googlecode-libphonenumber.version>8.12.43</googlecode-libphonenumber.version>