package cputils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mail.MailSenderInfo;
import mail.SimpleMailSender;
import common.Utils;
public abstract class AbstractLinkAndData {
public abstract List<String> dataLinks(int pageNo);
public abstract List<String> data(String dataLink);
/**
* @param issueNo
* @param is_not_full 1:full,2:notfull
* @return
* @throws IOException
*/
public Map<String, Map<Integer, Integer>> stat(String issueNo,int is_not_full,String from) throws IOException{
Map<String, Map<Integer, Integer>> res = new HashMap<String, Map<Integer,Integer>>();
String fileName = from + "_" + issueNo;
List<String> list = new ArrayList<String>();
switch (is_not_full) {
case 1:
fileName = fileName+"_full";
list = XmlUtils.getHMData(fileName);
break;
case 3:
fileName = fileName+"_full";
list = XmlUtils.getHMData(fileName);
break;
case 2:
fileName = fileName+"_notfull";
list = XmlUtils.getHMData(fileName);
break;
case 100:
list = XmlUtils.getHMData(fileName+"_notfull");
list.addAll(XmlUtils.getHMData(fileName+"_full"));
fileName = fileName+"_all";
break;
default:
break;
}
Utils.print(fileName+" line:"+list.size());
res = Utils.makeMap(list, issueNo);
res = XmlUtils.makeSortedMap(res, true);
return res;
}
public String getFullOrNotName(int is_not_full){
String fullOrNotStr = "";
switch (is_not_full) {
case 2:
fullOrNotStr = "notfull";
break;
case 1:
fullOrNotStr = "full";
break;
case 3:
fullOrNotStr = "full";
break;
case 4:
fullOrNotStr = "notfull";
break;
case 5:
fullOrNotStr = "full";
break;
case 100:
fullOrNotStr = "all";
break;
default:
break;
}
return fullOrNotStr;
}
public String getLotteryType(String issueNo,String from){
String gameName = "";
if(issueNo.length()==7){
if("ac".equals(from)){
gameName = "FC_SSQ";
}else if ("lc".equals(from)) {
gameName = "50";
}else if ("wy".equals(from)) {
gameName = "ssq";
}else if ("tb".equals(from)) {
gameName = "SSQ";
}
}else if (issueNo.length()==5) {
if("ac".equals(from)){
gameName = "TC_DLT";
}else if ("lc".equals(from)) {
gameName = "1";
}else if ("wy".equals(from)) {
gameName = "dlt";
}else if ("tb".equals(from)) {
gameName = "DLT";
}
}
return gameName;
}
public void sendMail(String issueNo, String content){
SimpleMailSender send = new SimpleMailSender();
MailSenderInfo info = new MailSenderInfo();
info.setToAddress("119851423@qq.com");
//info.setToAddress("zhengweiwei@purang.com");
info.setSubject(issueNo);
info.setContent(content);
send.sendTextMail(info);
}
}