miduo_server/tablemanager/src/main/java/config/SGuildRedPackConfig.java

140 lines
3.2 KiB
Java
Raw Normal View History

2020-01-08 17:19:23 +08:00
package config;
import manager.STableManager;
import manager.Table;
2021-05-19 11:18:46 +08:00
import java.util.ArrayList;
2020-01-08 17:19:23 +08:00
import java.util.HashMap;
2021-05-19 11:18:46 +08:00
import java.util.List;
2020-01-08 17:19:23 +08:00
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;
2021-05-19 11:18:46 +08:00
private int baseType;
private int ruleType;
private int maxNum;
private int groupId;
private int[] ruleId;
2020-01-08 17:19:23 +08:00
public static Map<Integer,SGuildRedPackConfig> sGuildRedPackConfigMap;
public static Map<Integer,SGuildRedPackConfig> sGuildRedPackByGoodsId;
2021-05-19 11:18:46 +08:00
public static Map<Integer,SGuildRedPackConfig> sWelfareRedPackByRule;
public static Map<Integer, List<SGuildRedPackConfig>> welfareRedPackBySerise;
2021-05-21 18:52:19 +08:00
public static List<Integer> welfareRedPackIds;
2020-01-08 17:19:23 +08:00
@Override
public void init() throws Exception {
sGuildRedPackConfigMap = STableManager.getConfig(SGuildRedPackConfig.class);
sGuildRedPackByGoodsId = new HashMap<>();
2021-05-19 11:18:46 +08:00
sWelfareRedPackByRule = new HashMap<>();
welfareRedPackBySerise = new HashMap<>();
2021-05-21 18:52:19 +08:00
welfareRedPackIds = new ArrayList<>();
2020-01-08 17:19:23 +08:00
for(Map.Entry<Integer,SGuildRedPackConfig> entry:sGuildRedPackConfigMap.entrySet()){
int tradeId = entry.getValue().getTradeId();
2021-05-19 11:18:46 +08:00
if(entry.getValue().getBaseType() == 1 && !sGuildRedPackConfigMap.containsKey(tradeId)){
2020-01-08 17:19:23 +08:00
sGuildRedPackByGoodsId.put(tradeId,entry.getValue());
}
2021-05-21 18:52:19 +08:00
if(entry.getValue().getBaseType() == 2){
welfareRedPackIds.add(entry.getKey());
}
if(entry.getValue().getBaseType() == 2 && !sWelfareRedPackByRule.containsKey(entry.getValue().getRuleId()[0])){
2021-05-19 11:18:46 +08:00
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);
}
}
2020-01-08 17:19:23 +08:00
}
}
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;
}
2021-05-19 11:18:46 +08:00
public int getBaseType() {
return baseType;
}
2020-01-08 17:19:23 +08:00
2021-05-19 11:18:46 +08:00
public int getRuleType() {
return ruleType;
}
public int getMaxNum() {
return maxNum;
}
public int getGroupId() {
return groupId;
}
public int[] getRuleId() {
return ruleId;
}
2020-01-08 17:19:23 +08:00
}