189 lines
4.7 KiB
Java
189 lines
4.7 KiB
Java
package config;
|
|
|
|
import manager.STableManager;
|
|
import manager.Table;
|
|
import util.TimeUtils;
|
|
|
|
import java.util.*;
|
|
|
|
@Table(name ="GlobalActivity")
|
|
public class SGlobalActivity implements BaseConfig {
|
|
|
|
private int id;
|
|
|
|
private int type;
|
|
|
|
private String startTime;
|
|
|
|
private String endtime;
|
|
|
|
private int time;
|
|
|
|
private long startTimeLong;
|
|
|
|
private long endTimeLong;
|
|
|
|
private static Map<Integer, SGlobalActivity> sGlobalActivityMap;
|
|
|
|
private String sesc;
|
|
|
|
private int isSaving;
|
|
|
|
private int isMail;
|
|
|
|
private int[] ifOpen;
|
|
|
|
private int[] shopId;
|
|
|
|
private int resetGrade;
|
|
|
|
private int openRanking;
|
|
|
|
private int[] openRules;
|
|
|
|
private int[] foreshow;
|
|
|
|
private int gapTime;
|
|
|
|
private int[] canBuyRechargeId;
|
|
|
|
private int isOpen;
|
|
|
|
public static Map<Integer, List<SGlobalActivity>> sGlobalActivityMapByType;
|
|
public static Map<Integer, List<SGlobalActivity>> sGlobalActivityMapByOpenRules;
|
|
|
|
public static Map<Integer, Integer> sRechargeId2ActivityId;
|
|
@Override
|
|
public void init() throws Exception {
|
|
Map<Integer, List<SGlobalActivity>> sGlobalActivityMapByTypeTmp = new HashMap<>();
|
|
Map<Integer, List<SGlobalActivity>> sGlobalActivityMapByOpenRulesTmp = new HashMap<>();
|
|
Map<Integer,Integer> sRechargeId2ActivityIdTemp = new HashMap<>();
|
|
Map<Integer, SGlobalActivity> config = STableManager.getConfig(SGlobalActivity.class);
|
|
for(SGlobalActivity sGlobalActivity : config.values()){
|
|
if(sGlobalActivity.getCanBuyRechargeId()!=null&&sGlobalActivity.getCanBuyRechargeId().length!=0){
|
|
Arrays.stream(sGlobalActivity.getCanBuyRechargeId()).forEach(n->sRechargeId2ActivityIdTemp.put(n,sGlobalActivity.getId()));
|
|
}
|
|
sGlobalActivityMapByTypeTmp.computeIfAbsent(sGlobalActivity.getType(),n->new ArrayList<>()).add(sGlobalActivity);
|
|
if(sGlobalActivity.getOpenRules().length>0){
|
|
sGlobalActivityMapByOpenRulesTmp.computeIfAbsent(sGlobalActivity.getOpenRules()[0],n->new ArrayList<>()).add(sGlobalActivity);
|
|
}
|
|
int time = sGlobalActivity.getTime();
|
|
String startTime = sGlobalActivity.getStartTime();
|
|
String endtime = sGlobalActivity.getEndtime();
|
|
if(time == 1 ){//ActivityType.OPEN_TYPE_TIME
|
|
if(!"0".equals(startTime)){
|
|
sGlobalActivity.setStartTimeLong(TimeUtils.parseTimeToMiles(startTime,TimeUtils.Stand_CeHua_Data_format));
|
|
}
|
|
if(!"0".equals(endtime)){
|
|
sGlobalActivity.setEndTimeLong(TimeUtils.parseTimeToMiles(endtime,TimeUtils.Stand_CeHua_Data_format));
|
|
}
|
|
continue;
|
|
}
|
|
sGlobalActivity.setStartTimeLong(Long.parseLong(startTime));
|
|
sGlobalActivity.setEndTimeLong(Long.parseLong(endtime));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
sGlobalActivityMap = config;
|
|
sGlobalActivityMapByType = sGlobalActivityMapByTypeTmp;
|
|
sGlobalActivityMapByOpenRules = sGlobalActivityMapByOpenRulesTmp;
|
|
sRechargeId2ActivityId = sRechargeId2ActivityIdTemp;
|
|
}
|
|
|
|
public static Map<Integer, SGlobalActivity> getsGlobalActivityMap() {
|
|
return sGlobalActivityMap;
|
|
}
|
|
|
|
public int getId() {
|
|
return id;
|
|
}
|
|
|
|
public int getType() {
|
|
return type;
|
|
}
|
|
|
|
public String getStartTime() {
|
|
return startTime;
|
|
}
|
|
|
|
public String getEndtime() {
|
|
return endtime;
|
|
}
|
|
|
|
public int getTime() {
|
|
return time;
|
|
}
|
|
|
|
public static List<SGlobalActivity> getsGlobalActivityMapByType(int type) {
|
|
return sGlobalActivityMapByType.get(type);
|
|
}
|
|
|
|
public void setStartTimeLong(long startTimeLong) {
|
|
this.startTimeLong = startTimeLong;
|
|
}
|
|
|
|
public void setEndTimeLong(long endTimeLong) {
|
|
this.endTimeLong = endTimeLong;
|
|
}
|
|
|
|
public long getStartTimeLong() {
|
|
return startTimeLong;
|
|
}
|
|
|
|
public long getEndTimeLong() {
|
|
return endTimeLong;
|
|
}
|
|
|
|
public String getSesc() { return sesc; }
|
|
|
|
public int getIsSaving() {
|
|
return isSaving;
|
|
}
|
|
|
|
public int getIsMail() {
|
|
return isMail;
|
|
}
|
|
|
|
public int[] getIfOpen() {
|
|
return ifOpen;
|
|
}
|
|
|
|
public int[] getShopId() {
|
|
return shopId;
|
|
}
|
|
|
|
public int getResetGrade() {
|
|
return resetGrade;
|
|
}
|
|
|
|
public int getOpenRanking() {
|
|
return openRanking;
|
|
}
|
|
|
|
public int[] getOpenRules() {
|
|
return openRules;
|
|
}
|
|
|
|
public int[] getForeshow() {
|
|
return foreshow;
|
|
}
|
|
|
|
public int getGapTime() {
|
|
return gapTime;
|
|
}
|
|
|
|
public void setType(int type) {
|
|
this.type = type;
|
|
}
|
|
|
|
public int[] getCanBuyRechargeId() {
|
|
return canBuyRechargeId;
|
|
}
|
|
|
|
public int getIsOpen() {
|
|
return isOpen;
|
|
}
|
|
} |