社稷大典积分恢复
parent
3e4b27fa9d
commit
13849ac7b8
|
@ -0,0 +1,125 @@
|
||||||
|
package com.ljsd.jieling.kefu;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ljsd.jieling.core.Lockeys;
|
||||||
|
import com.ljsd.jieling.core.SimpleTransaction;
|
||||||
|
import com.ljsd.jieling.db.mongo.AreaManager;
|
||||||
|
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||||
|
import com.ljsd.jieling.db.redis.RedisKey;
|
||||||
|
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
|
import com.ljsd.jieling.logic.activity.AbstractActivity;
|
||||||
|
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||||
|
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.CommitSheJiEvent;
|
||||||
|
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.rank.RankContext;
|
||||||
|
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||||
|
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||||
|
import config.SGodSacrificeSetting;
|
||||||
|
import manager.STableManager;
|
||||||
|
import org.springframework.data.redis.core.ZSetOperations;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description: 热修复全局信息 gm线程执行
|
||||||
|
* Author: zsx
|
||||||
|
* CreateDate: 2019/9/26 11:48
|
||||||
|
* <p>
|
||||||
|
* //fixsj
|
||||||
|
*/
|
||||||
|
public class Cmd_fixsj extends GmAbstract {
|
||||||
|
@Override
|
||||||
|
public boolean exec(String[] args) throws Exception {
|
||||||
|
|
||||||
|
// for (int i = 0; i <150 ; i++) {
|
||||||
|
// String key = RedisKey.getKey(RedisKey.FORCE_RANK, "", false);
|
||||||
|
// RedisUtil.getInstence().zsetAddOne(key, String.valueOf(10000+i), 10000+i);
|
||||||
|
// }
|
||||||
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
Map<Integer, GuildInfo> guildInfoMap = GuilidManager.guildInfoMap;
|
||||||
|
AbstractRank guildRank = RankContext.getRankEnum(RankEnum.GUILD_SHEJI_SCORE_RANK.getType());
|
||||||
|
|
||||||
|
for(Map.Entry<Integer,GuildInfo> guildInfoEntry:guildInfoMap.entrySet()){
|
||||||
|
try {
|
||||||
|
|
||||||
|
GuildInfo guildInfo = guildInfoEntry.getValue();
|
||||||
|
Double zSetScore = RedisUtil.getInstence().getZSetScore(RankEnum.GUILD_SHEJI_SCORE_RANK.getRedisKey(), "50002", Integer.toString(guildInfo.getId()));
|
||||||
|
|
||||||
|
// if(zSetScore<0){
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
Double sumValue =0d;
|
||||||
|
|
||||||
|
Set<Integer> sendUids = new HashSet<>();
|
||||||
|
for (Set<Integer> items : guildInfo.getMembers().values()) {
|
||||||
|
sendUids.addAll(items);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Integer uid : sendUids) {
|
||||||
|
|
||||||
|
Double zSetScore1 = RedisUtil.getInstence().getZSetScore(RankEnum.EXPERT_RANK.getRedisKey(), "50002", Integer.toString(uid));
|
||||||
|
sumValue+=zSetScore1;
|
||||||
|
}
|
||||||
|
if(sumValue<0){
|
||||||
|
sumValue=0d;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(guildInfo.getName()+"guildInfo.get = " + guildInfo.getGuildSheJiScore());
|
||||||
|
System.out.println(guildInfo.getName()+"zSetScore = " + zSetScore);
|
||||||
|
System.out.println(guildInfo.getName()+"sumValue = " + sumValue);
|
||||||
|
|
||||||
|
SGodSacrificeSetting sGodSacrificeSetting = STableManager.getConfig(SGodSacrificeSetting.class).get(1);
|
||||||
|
if(sumValue>=sGodSacrificeSetting.getL1Score()){
|
||||||
|
guildRank.addRank(guildInfo.getId(),"50002",sumValue);
|
||||||
|
}else {
|
||||||
|
String key= RedisUtil.getInstence().getKey(RankEnum.GUILD_SHEJI_SCORE_RANK.getRedisKey(), "50002");
|
||||||
|
RedisUtil.getInstence().zsetRemoveOne(key,Integer.toString(guildInfo.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
guildInfo.setGuildSheJiScore(sumValue.intValue());
|
||||||
|
|
||||||
|
|
||||||
|
for (Integer uid : sendUids) {
|
||||||
|
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
if (null == user) {
|
||||||
|
LOGGER.error("Exception::user==null,uid=>{}", uid);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityType(50002);
|
||||||
|
if (abstractActivity == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
abstractActivity.update(user, sumValue.intValue());
|
||||||
|
// Double zSetScore1 = RedisUtil.getInstence().getZSetScore(RankEnum.EXPERT_RANK.getRedisKey(), "50002", Integer.toString(uid));
|
||||||
|
// sumValue+=zSetScore1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
LOGGER.error("Exception resetGuildInfo err");
|
||||||
|
}finally {
|
||||||
|
}
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.info("修复排行榜异常" + e.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue