140 lines
3.2 KiB
Java
140 lines
3.2 KiB
Java
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<Integer,SGuildRedPackConfig> sGuildRedPackConfigMap;
|
|
|
|
public static Map<Integer,SGuildRedPackConfig> sGuildRedPackByGoodsId;
|
|
|
|
public static Map<Integer,SGuildRedPackConfig> sWelfareRedPackByRule;
|
|
|
|
public static Map<Integer, List<SGuildRedPackConfig>> welfareRedPackBySerise;
|
|
|
|
public static List<Integer> 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<Integer,SGuildRedPackConfig> 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<SGuildRedPackConfig> 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;
|
|
}
|
|
} |