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

217 lines
5.4 KiB
Java
Raw Normal View History

2021-05-14 17:05:27 +08:00
package config;
import manager.STableManager;
import manager.Table;
2021-04-26 17:27:54 +08:00
import java.util.ArrayList;
2021-05-14 17:05:27 +08:00
import java.util.HashMap;
2021-04-26 17:27:54 +08:00
import java.util.List;
2021-05-14 17:05:27 +08:00
import java.util.Map;
@Table(name ="RechargeCommodityConfig")
2021-05-14 17:05:27 +08:00
public class SRechargeCommodityNewConfig implements BaseConfig {
private int id;
private String rechargeId;
private String name;
private int type;
private double price;
private int[][] firstMultiple;
private int[][] baseReward;
private int[] openPrivilege;
private int contiueDays;
private int limit;
private int firstInvest;
private int accumulativeRecharge;
private int time;
2021-04-22 13:55:20 +08:00
private String onSaleRule;
2021-05-14 17:05:27 +08:00
private int dailyUpdate;
2021-04-22 17:43:30 +08:00
private int[] mail;
2021-05-14 17:05:27 +08:00
private int otype;
private String rechargeId2;
private String rechargeId3;
2021-04-22 13:55:20 +08:00
private String rechargeId4;
private String rechargeId5;
private String rechargeId6;
2021-07-01 18:29:39 +08:00
private String rechargeId7;
private String rechargeId8;
private String rechargeId9;
private String rechargeId10;
2021-04-22 13:55:20 +08:00
2021-08-25 17:32:14 +08:00
private int isShowInWeb;
2021-06-23 14:29:54 +08:00
2021-05-14 14:30:35 +08:00
private int[] forbid;
2021-05-31 17:55:50 +08:00
private String[][] condition;
2021-09-22 18:34:44 +08:00
private int isRecommond;
2021-05-14 17:05:27 +08:00
public static Map<Integer,SRechargeCommodityNewConfig> configMap;
public static Map<String,SRechargeCommodityNewConfig> sdkconfigMap;
2021-04-26 17:27:54 +08:00
public static Map<Integer, List<Integer>> configTypeMap;
2021-05-14 17:05:27 +08:00
public void init() throws Exception {
Map<Integer, SRechargeCommodityNewConfig> config = STableManager.getConfig(SRechargeCommodityNewConfig.class);
Map<Integer,SRechargeCommodityNewConfig> tempConfigMap = new HashMap<>();
Map<String,SRechargeCommodityNewConfig> tempSdkConfigMap = new HashMap<>();
2021-04-26 17:27:54 +08:00
Map<Integer, List<Integer>> tempConfigTypeMap = new HashMap<>();
2021-05-14 17:05:27 +08:00
for(SRechargeCommodityNewConfig newConfig : config.values()){
2021-05-31 17:55:50 +08:00
newConfig.setCondition(initConditon(newConfig));
2021-05-14 17:05:27 +08:00
tempConfigMap.put(newConfig.getId(),newConfig);
tempSdkConfigMap.put(newConfig.getRechargeId(),newConfig);
tempSdkConfigMap.put(newConfig.getRechargeId2(),newConfig);
tempSdkConfigMap.put(newConfig.getRechargeId3(),newConfig);
2021-04-26 17:27:54 +08:00
if(tempConfigTypeMap.containsKey(newConfig.getType())){
tempConfigTypeMap.get(newConfig.getType()).add(newConfig.getId());
}else{
List<Integer> list = new ArrayList<>();
list.add(newConfig.getId());
tempConfigTypeMap.put(newConfig.getType(),list);
}
2021-05-14 17:05:27 +08:00
}
2021-07-08 02:33:14 +08:00
// if(configMap == null){
2021-05-14 17:05:27 +08:00
configMap = tempConfigMap;
2021-07-08 02:37:27 +08:00
System.out.println("重新加载Recharge");
2021-05-14 17:05:27 +08:00
sdkconfigMap = tempSdkConfigMap;
2021-04-26 17:27:54 +08:00
configTypeMap = tempConfigTypeMap;
2021-07-08 02:33:14 +08:00
// }
2021-05-14 17:05:27 +08:00
}
2021-05-31 17:55:50 +08:00
public static String[][] getConditon(int id){
return configMap.get(id).getCondition();
}
public String[][] initConditon(SRechargeCommodityNewConfig config){
String[] s = config.getOnSaleRule().split("\\|");
condition = new String[s.length][3];
int i = 0;
for (String s0 : s) {
String[] s1 = s0.split("#");
condition[i][0] = s1[0];
condition[i][1] = s1[1];
if(s1.length > 2){
condition[i][2] = s1[2];
}
i++;
}
return condition;
}
2021-05-14 17:05:27 +08:00
public static SRechargeCommodityNewConfig getConfigById(int id){
return configMap.get(id);
}
2021-04-26 17:27:54 +08:00
public static List<Integer> getConfigListByType(int type){
return configTypeMap.get(type);
}
2021-05-14 17:05:27 +08:00
public int getId() { return id; }
public String getRechargeId() { return rechargeId; }
public String getName() { return name; }
public int getType() {
return type;
}
public double getPrice() { return price; }
public int[][] getFirstMultiple() { return firstMultiple; }
public int[][] getBaseReward() { return baseReward; }
public int[] getOpenPrivilege() { return openPrivilege; }
public int getContiueDays() { return contiueDays; }
public int getLimit() { return limit; }
public int getFirstInvest() { return firstInvest; }
public int getAccumulativeRecharge() { return accumulativeRecharge; }
public int getTime() { return time; }
2021-04-22 13:55:20 +08:00
public String getOnSaleRule() { return onSaleRule; }
2021-05-14 17:05:27 +08:00
public int getDailyUpdate() { return dailyUpdate; }
2021-04-22 17:43:30 +08:00
public int[] getMail() { return mail; }
2021-05-14 17:05:27 +08:00
public int getOtype() { return otype; }
2021-05-14 14:30:35 +08:00
public int[] getForbid() {
return forbid;
}
2021-05-14 17:05:27 +08:00
public String getRechargeId2() { return rechargeId2; }
public String getRechargeId3() { return rechargeId3; }
2021-04-22 13:55:20 +08:00
public String getRechargeId4() {
return rechargeId4;
}
2021-05-14 17:05:27 +08:00
2021-04-22 13:55:20 +08:00
public String getRechargeId5() {
return rechargeId5;
}
public String getRechargeId6() {
return rechargeId6;
}
2021-05-31 17:55:50 +08:00
2021-07-01 18:29:39 +08:00
public String getRechargeId7() {
return rechargeId7;
}
public String getRechargeId8() {
return rechargeId8;
}
public String getRechargeId9() {
return rechargeId9;
}
public String getRechargeId10() {
return rechargeId10;
}
2021-05-31 17:55:50 +08:00
public String[][] getCondition() {
return condition;
}
public void setCondition(String[][] condition) {
this.condition = condition;
}
2021-06-23 14:29:54 +08:00
2021-08-25 17:32:14 +08:00
public int getIsShowInWeb() {
return isShowInWeb;
}
2021-09-22 18:34:44 +08:00
public int getIsRecommond() {
return isRecommond;
}
2021-05-14 17:05:27 +08:00
}