fix store gm
parent
6dd5cd1cde
commit
f5955def99
|
@ -0,0 +1,70 @@
|
||||||
|
package com.ljsd.jieling.kefu;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import config.SStoreConfig;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description: 热修复全局信息 gm线程执行
|
||||||
|
* Author: zsx
|
||||||
|
* CreateDate: 2019/9/26 11:48
|
||||||
|
*/
|
||||||
|
public class Cmd_fix_store 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);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
Map<Integer,Integer> vip2itemid = new HashMap<>();
|
||||||
|
|
||||||
|
for (Map.Entry<Integer,SStoreConfig> entry :SStoreConfig.getSstoreConfigMap().entrySet()){
|
||||||
|
if(entry.getValue().getRelatedtoVIP()!=1){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
vip2itemid.put(entry.getValue().getLimit(),entry.getKey());
|
||||||
|
}
|
||||||
|
LOGGER.error(vip2itemid.toString());
|
||||||
|
|
||||||
|
List<User> userList = MongoUtil.getInstence().getMyMongoTemplate().findAll(User.getCollectionName(), User.class);
|
||||||
|
LOGGER.error("userList size"+userList.size());
|
||||||
|
|
||||||
|
int process = 0;
|
||||||
|
for (User user :userList){
|
||||||
|
process++;
|
||||||
|
try {
|
||||||
|
for (Map.Entry<Integer, Integer> en:user.getPlayerInfoManager().getVipInfo().entrySet()){
|
||||||
|
if(en.getValue()!=0){
|
||||||
|
Integer itemId = vip2itemid.get(en.getKey());
|
||||||
|
if(itemId == null ){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int storeid = SStoreConfig.getSstoreConfigMap().get(itemId).getStoreId();
|
||||||
|
Map<Integer, Integer> itemNumMap = user.getStoreManager().getStoreInfoMap().get(storeid).getItemNumMap();
|
||||||
|
if(itemNumMap.containsKey(itemId)){
|
||||||
|
itemNumMap.put(itemId,en.getValue());
|
||||||
|
}
|
||||||
|
user.getStoreManager().getStoreInfoMap().get(storeid).setItemNumMap(itemNumMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(process/5==0){
|
||||||
|
LOGGER.error("process"+process+"/5");
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
LOGGER.error("userList size Exception"+e.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
MongoUtil.getInstence().lastUpdate();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue