package config; import manager.STableManager; import manager.Table; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Table(name ="GuildRedPackConfig") public class SGuildRedPackConfig implements BaseConfig { private int id; private int dailyNum; private int[] totalMoney; private int num; private int reward; private int lastTime; private int minPercent; private int maxPercent; private int tradeId; private int baseType; private int ruleType; private int maxNum; private int groupId; private int[] ruleId; public static Map sGuildRedPackConfigMap; public static Map sGuildRedPackByGoodsId; public static Map sWelfareRedPackByRule; public static Map> welfareRedPackBySerise; public static List welfareRedPackIds; @Override public void init() throws Exception { sGuildRedPackConfigMap = STableManager.getConfig(SGuildRedPackConfig.class); sGuildRedPackByGoodsId = new HashMap<>(); sWelfareRedPackByRule = new HashMap<>(); welfareRedPackBySerise = new HashMap<>(); welfareRedPackIds = new ArrayList<>(); for(Map.Entry entry:sGuildRedPackConfigMap.entrySet()){ int tradeId = entry.getValue().getTradeId(); if(entry.getValue().getBaseType() == 1 && !sGuildRedPackConfigMap.containsKey(tradeId)){ sGuildRedPackByGoodsId.put(tradeId,entry.getValue()); } if(entry.getValue().getBaseType() == 2){ welfareRedPackIds.add(entry.getKey()); } if(entry.getValue().getBaseType() == 2 && !sWelfareRedPackByRule.containsKey(entry.getValue().getRuleId()[0])){ sWelfareRedPackByRule.put(entry.getValue().getRuleId()[0],entry.getValue()); } if(entry.getValue().getRuleType() == 3){ if(welfareRedPackBySerise.containsKey(entry.getValue().getGroupId())){ welfareRedPackBySerise.get(entry.getValue().getGroupId()).add(entry.getValue()); }else{ List list = new ArrayList<>(); list.add(entry.getValue()); welfareRedPackBySerise.put(entry.getValue().getGroupId(),list); } } } } public int getId() { return id; } public int getDailyNum() { return dailyNum; } public int[] getTotalMoney() { return totalMoney; } public int getNum() { return num; } public int getReward() { return reward; } public int getLastTime() { return lastTime; } public int getMinPercent() { return minPercent; } public int getMaxPercent() { return maxPercent; } public int getTradeId() { return tradeId; } public int getBaseType() { return baseType; } public int getRuleType() { return ruleType; } public int getMaxNum() { return maxNum; } public int getGroupId() { return groupId; } public int[] getRuleId() { return ruleId; } }