/**
*
*/
package test;
import java.awt.Toolkit;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Timer;
import java.util.TimerTask;
import jsoup.ConnectionManager;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.dom4j.Element;
import org.jsoup.Connection;
import org.jsoup.nodes.Document;
import common.Config;
import common.InfoUtil;
import common.MP3Player;
import cputils.DataItem;
import cputils.XmlUtils;
/**
* @author zhengweiwei
* @date 2014年8月8日
*/
public class SSC {
private static DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static Toolkit toolkit = Toolkit.getDefaultToolkit();
private static String ERROR = "×";
private static String CORRECT = "√";
private boolean isPullData = true;
private int lastPullCount = 0;
private String dataTipMsg = "";
private static Properties prop = null;
private static String url = "http://115.28.33.86/table.aspx";
static{
prop = new Properties();
try {
prop.load(new FileInputStream("config/config.properties"));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public SSC(){
}
Timer timer;
public SSC(int seconds){
timer = new Timer();
timer.schedule(new RemindTask(), 0, 1000);
}
class RemindTask extends TimerTask{
public void run(){
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"+format.format(new Date()));
// timer.cancel(); //Terminate the timer thread
}
}
// public static void main(String args[]) ...{
// System.out.println("About to schedule task.");
// new Reminder(5);
// System.out.println("Task scheduled.");
// }
public static void main(String[] args) throws InterruptedException {
SSC ssc = new SSC();
// System.out.println(prop.getProperty("config_file_path"));
// ssc.dataSSC(url);
/*try {
while (true) {
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"+format.format(new Date()));
// ssc.dataFFC(url);
// everyPosFFC("ffc");
toolkit.beep();
ssc.kjSSC();
Calendar c = Calendar.getInstance();
int minute = c.get(Calendar.MINUTE);
if (minute - 10 >= 0) {
}
Thread.sleep(10000);
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/
//BL ssc 100
String day = new SimpleDateFormat("yyMMdd").format(new Date());
// ssc.pull115(ssc,day);
// ssc.pullssc(ssc, new SimpleDateFormat("yyyyMMdd").format(new Date()));
ssc.pullBLssc(ssc, day);
}
private void pullBLssc(SSC ssc,String day) throws InterruptedException{
while (true) {
dataTipMsg = "";
ssc.getIsPullData(url,Config.prop.getProperty("blsscid"));
if (ssc.isPullData) {
ssc.dataSSC(url, Config.prop.getProperty("blsscid"));
if (StringUtils.isNotBlank(dataTipMsg)) {
InfoUtil tool = new InfoUtil();
tool.show(dataTipMsg);
}
everySSCPos("blssc");
}
dataTipMsg = "";
Thread.sleep(60000);
}
}
private void pullssc(SSC ssc,String day) throws InterruptedException{
while (true) {
dataTipMsg = "";
ssc.getIsPullData(url,Config.prop.getProperty("cqsscid"));
if (ssc.isPullData) {
ssc.dataSSC(url, Config.prop.getProperty("cqsscid"));
if (StringUtils.isNotBlank(dataTipMsg)) {
InfoUtil tool = new InfoUtil();
tool.show(dataTipMsg);
}
everySSCPos("cqssc");
dataTipMsg = "";
ssc.dataSSC(url, Config.prop.getProperty("jxsscid"));
if (StringUtils.isNotBlank(dataTipMsg)) {
InfoUtil tool = new InfoUtil();
tool.show(dataTipMsg);
}
everySSCPos("jxssc");
}
dataTipMsg = "";
Thread.sleep(120000);
// break;
}
}
private void pull115(SSC ssc,String day) throws InterruptedException{
while (true) {
dataTipMsg = "";
ssc.getIsPullSD115Data();
/*if (ssc.isPullData) {
ssc.data115(day, Config.prop.getProperty("sd115id"));;
every115Pos("sd115", day);
}*/
/*ssc.getIsPullData(url,Config.prop.getProperty("jx115id"));
if (ssc.isPullData) {
ssc.data115(day, Config.prop.getProperty("jx115id"));;
every115Pos("jx115", day);
}*/
/*ssc.getIsPullData(url,Config.prop.getProperty("gd115id"));
if (ssc.isPullData) {
ssc.data115(day, Config.prop.getProperty("gd115id"));;
every115Pos("gd115", day);
}*/
ssc.getIsPullData(url,Config.prop.getProperty("cq115id"));
if (ssc.isPullData) {
ssc.data115(day, Config.prop.getProperty("cq115id"));;
every115Pos("cq115", day);
}
dataTipMsg = "";
Thread.sleep(120000);
}
}
private void pullBLSSCData(String url) throws InterruptedException{
while (true) {
System.out.println("~~~~~~~~~~~~~~~~~~~~~"+format.format(new Date())+"~~~~~~~~~~~~~~~~~");
getIsPullBLData(url);
if (isPullData) {
dataBLSSC(url);
everyBLSSCPos();
}
Thread.sleep(60000);
}
}
public void kjSSC(){
String cqurl = "http://www.hq6m.com/game/?mod=cai&act=board&cai_id=1";
String jxurl = "http://www.hq6m.com/game/?mod=cai&act=board&cai_id=2";
try {
Connection conn = ConnectionManager.getInstance().getConnection(cqurl);
// conn.cookie("id", "21");
conn.cookie("PcAicaip", "3307f%2FVmMBYVuaqdGe8QIi6otjFMA7yaPM%2Bh%2Fg3Gk1K2o4VadpS%2B3dFciwhDSxqYTnA%2F9KqvHrt0JECP3pc%2FxksZwewPkoJ27ZVdjXs2cxaWKmKLyLx5ljyn%2B%2Bitpg%2FqWq6yvHP%2FCypVgdU%2BBntiEGYC%2BYvrSrb83V7ceawUHWE");
conn.cookie("PcAicain", "haha");
conn.cookie("playTimes06481010C78141AB89F3EBBC43A1E9A9", "0");
conn.cookie("5pao_VID_06481010C78141AB89F3EBBC43A1E9A9", "true");
Document doc = conn.post();
String res = doc.text();
res = res.substring(res.indexOf("{"), res.indexOf("}")+1);
JSONObject obj = JSONObject.fromObject(res);
String title = obj.getString("title");
String numbers = obj.getString("numbers");
System.out.println("CQ>>> "+title+": "+numbers);
conn = ConnectionManager.getInstance().getConnection(jxurl);
// conn.cookie("id", "21");
conn.cookie("PcAicaip", "3307f%2FVmMBYVuaqdGe8QIi6otjFMA7yaPM%2Bh%2Fg3Gk1K2o4VadpS%2B3dFciwhDSxqYTnA%2F9KqvHrt0JECP3pc%2FxksZwewPkoJ27ZVdjXs2cxaWKmKLyLx5ljyn%2B%2Bitpg%2FqWq6yvHP%2FCypVgdU%2BBntiEGYC%2BYvrSrb83V7ceawUHWE");
conn.cookie("PcAicain", "haha");
conn.cookie("playTimes06481010C78141AB89F3EBBC43A1E9A9", "0");
conn.cookie("5pao_VID_06481010C78141AB89F3EBBC43A1E9A9", "true");
doc = conn.post();
res = doc.text();
res = res.substring(res.indexOf("{"), res.indexOf("}")+1);
obj = JSONObject.fromObject(res);
title = obj.getString("title");
numbers = obj.getString("numbers");
System.out.println("JX>>> "+title+": "+numbers);
} catch (Exception e) {
e.printStackTrace();
}
}
public static List<String> everyPosFFC(String type) {
List<String> resList = new ArrayList<String>();
XmlUtils utils = new XmlUtils();
Map<Integer, Map<Integer, Integer>> posMap = new HashMap<Integer, Map<Integer, Integer>>();
// Map<Integer, Integer> dataMap1 = new HashMap<Integer, Integer>();
// Map<Integer, Integer> dataMap2 = new HashMap<Integer, Integer>();
// Map<Integer, Integer> dataMap3 = new HashMap<Integer, Integer>();
// Map<Integer, Integer> dataMap4 = new HashMap<Integer, Integer>();
Map<Integer, Integer> dataMap5 = new HashMap<Integer, Integer>();
Map<Integer, Map<String, Integer>> posdxMap = new HashMap<Integer, Map<String, Integer>>();
for (int i = 1; i <= 5; i++) {
posdxMap.put(i, initDXMap());
}
Map<Integer, Integer> first5 = new HashMap<Integer, Integer>();
for (int i = 0; i <= 9; i++) {
first5.put(i, 0);
// dataMap1.put(i, 0);
// dataMap2.put(i, 0);
// dataMap3.put(i, 0);
// dataMap4.put(i, 0);
dataMap5.put(i, 0);
}
List<DataItem> list = new ArrayList<DataItem>();
try {
org.dom4j.Document root = utils.getDocumentComm(Config.DATA_FILE_PATH + type +".xml");
Element rootEl = root.getRootElement();
Iterator<Element> it = rootEl.elementIterator();
Element el;
DataItem item1;
while (it.hasNext()) {
el = it.next();
item1 = new DataItem(el.attributeValue("ID"),
el.attributeValue("opencode"), el.attributeValue("type"));
list.add(item1);
}
System.out.println("all size:" + list.size());
for (DataItem item : list) {
if (StringUtils.isBlank(item.getOpencode())) {
continue;
}
String[] codeArr = item.getOpencode().split(" ");
Integer[] intCodeArr = new Integer[codeArr.length];
for (int i = 0; i < codeArr.length; i++) {
intCodeArr[i] = Integer.parseInt(codeArr[i]);
}
// addMapData(dataMap1, intCodeArr[0]);
// addMapData(dataMap2, intCodeArr[1]);
// addMapData(dataMap3, intCodeArr[2]);
// addMapData(dataMap4, intCodeArr[3]);
addMapData(dataMap5, intCodeArr[4]);
// addMapData(first5, intCodeArr[0]);
// addMapData(first5, intCodeArr[1]);
// addMapData(first5, intCodeArr[2]);
// addMapData(first5, intCodeArr[3]);
// addMapData(first5, intCodeArr[4]);
}
} catch (Exception e) {
e.printStackTrace();
}
// posMap.put(1, XmlUtils.makeSortedMap(dataMap1));
// posMap.put(2, XmlUtils.makeSortedMap(dataMap2));
// posMap.put(3, XmlUtils.makeSortedMap(dataMap3));
// posMap.put(4, XmlUtils.makeSortedMap(dataMap4));
posMap.put(5, XmlUtils.makeSortedMap(dataMap5));
// System.out.println("/*****************every position**********************/");
for (Entry<Integer, Map<Integer, Integer>> tem : posMap.entrySet()) {
System.out.println(tem.getKey() + ": " + tem.getValue());
Map<String, Integer> dxMap = initDXMap();
for (Entry<Integer, Integer> te : tem.getValue().entrySet()) {
if (te.getKey()>=5) {
dxMap.put("big", dxMap.get("big")+te.getValue());
}else {
dxMap.put("small", dxMap.get("small")+te.getValue());
}
}
posdxMap.put(tem.getKey(), dxMap);
System.out.println(tem.getKey() + ": " + dxMap);
}
return resList;
}
public static List<String> everyPos(String type) {
List<String> resList = new ArrayList<String>();
XmlUtils utils = new XmlUtils();
Map<Integer, Map<Integer, Integer>> posMap = new HashMap<Integer, Map<Integer, Integer>>();
Map<Integer, Integer> dataMap1 = new HashMap<Integer, Integer>();
Map<Integer, Integer> dataMap2 = new HashMap<Integer, Integer>();
Map<Integer, Integer> dataMap3 = new HashMap<Integer, Integer>();
Map<Integer, Integer> dataMap4 = new HashMap<Integer, Integer>();
Map<Integer, Integer> dataMap5 = new HashMap<Integer, Integer>();
Map<String, Integer> dxMap1 = initDXMap();
Map<String, Integer> dxMap2 = initDXMap();
Map<String, Integer> dxMap3 = initDXMap();
Map<String, Integer> dxMap4 = initDXMap();
Map<String, Integer> dxMap5 = initDXMap();
Map<Integer, Map<String, Integer>> posdxMap = new HashMap<Integer, Map<String, Integer>>();
for (int i = 1; i <= 5; i++) {
posdxMap.put(i, initDXMap());
}
Map<Integer, Integer> first2 = new HashMap<Integer, Integer>();
Map<Integer, Integer> first3 = new HashMap<Integer, Integer>();
Map<Integer, Integer> first4 = new HashMap<Integer, Integer>();
Map<Integer, Integer> first5 = new HashMap<Integer, Integer>();
for (int i = 0; i <= 9; i++) {
first2.put(i, 0);
first3.put(i, 0);
first4.put(i, 0);
first5.put(i, 0);
dataMap1.put(i, 0);
dataMap2.put(i, 0);
dataMap3.put(i, 0);
dataMap4.put(i, 0);
dataMap5.put(i, 0);
}
List<DataItem> list = new ArrayList<DataItem>();
try {
org.dom4j.Document root = utils.getDocumentComm(Config.DATA_FILE_PATH + type +".xml");
Element rootEl = root.getRootElement();
Iterator<Element> it = rootEl.elementIterator();
Element el;
DataItem item1;
while (it.hasNext()) {
el = it.next();
item1 = new DataItem(el.attributeValue("ID"),
el.attributeValue("opencode"), el.attributeValue("type"));
list.add(item1);
}
System.out.println("all size:" + list.size());
for (DataItem item : list) {
if (StringUtils.isBlank(item.getOpencode())) {
continue;
}
String[] codeArr = item.getOpencode().split(" ");
Integer[] intCodeArr = new Integer[codeArr.length];
for (int i = 0; i < codeArr.length; i++) {
intCodeArr[i] = Integer.parseInt(codeArr[i]);
}
addMapData(dataMap1, intCodeArr[0]);
addMapData(dataMap2, intCodeArr[1]);
addMapData(dataMap3, intCodeArr[2]);
addMapData(dataMap4, intCodeArr[3]);
addMapData(dataMap5, intCodeArr[4]);
addMapData(first2, intCodeArr[0]);
addMapData(first2, intCodeArr[1]);
addMapData(first3, intCodeArr[0]);
addMapData(first3, intCodeArr[1]);
addMapData(first3, intCodeArr[2]);
addMapData(first4, intCodeArr[0]);
addMapData(first4, intCodeArr[1]);
addMapData(first4, intCodeArr[2]);
addMapData(first4, intCodeArr[3]);
addMapData(first5, intCodeArr[0]);
addMapData(first5, intCodeArr[1]);
addMapData(first5, intCodeArr[2]);
addMapData(first5, intCodeArr[3]);
addMapData(first5, intCodeArr[4]);
}
} catch (Exception e) {
e.printStackTrace();
}
posMap.put(1, XmlUtils.makeSortedMap(dataMap1));
posMap.put(2, XmlUtils.makeSortedMap(dataMap2));
posMap.put(3, XmlUtils.makeSortedMap(dataMap3));
posMap.put(4, XmlUtils.makeSortedMap(dataMap4));
posMap.put(5, XmlUtils.makeSortedMap(dataMap5));
System.out.println("/*****************every position**********************/");
for (Entry<Integer, Map<Integer, Integer>> tem : posMap.entrySet()) {
System.out.println(tem.getKey() + ": " + tem.getValue());
Map<String, Integer> dxMap = initDXMap();
for (Entry<Integer, Integer> te : tem.getValue().entrySet()) {
if (te.getKey()>=5) {
dxMap.put("big", dxMap.get("big")+te.getValue());
}else {
dxMap.put("small", dxMap.get("small")+te.getValue());
}
}
posdxMap.put(tem.getKey(), dxMap);
System.out.println(tem.getKey() + ": " + dxMap);
}
// System.out.println("dx5: "+dxMap5);
// First two
System.out
.println("/*****************first2 3 4 5 position**********************/");
System.out.println("first2:" + XmlUtils.makeSortedMap(first2));
System.out.println("first3:" + XmlUtils.makeSortedMap(first3));
System.out.println("first4:" + XmlUtils.makeSortedMap(first4));
System.out
.println("/*****************all position**********************/");
System.out.println("all:" + XmlUtils.makeSortedMap(first5));
return resList;
}
private static void addMapData(Map<Integer, Integer> dataMap, Integer key) {
dataMap.put(key, addCount(dataMap, key));
}
private static int addCount(Map<Integer, Integer> dataMap, Integer key) {
return (dataMap.get(key) != null ? dataMap.get(key) : 0) + 1;
}
private static Map<String, Integer> initDXMap(){
Map<String, Integer> dxMap = new HashMap<String, Integer>();
dxMap.put("big", 0);
dxMap.put("small", 0);
return dxMap;
}
public static List<String> everyBLSSCPos() {
return everySSCPos("blssc");
}
public static List<String> everySSCPos(String type) {
List<String> resList = new ArrayList<String>();
XmlUtils utils = new XmlUtils();
Map<Integer, Map<Integer, Integer>> posMap = new HashMap<Integer, Map<Integer, Integer>>();
Map<Integer, Integer> dataMap1 = new HashMap<Integer, Integer>();
Map<Integer, Integer> dataMap2 = new HashMap<Integer, Integer>();
Map<Integer, Integer> dataMap3 = new HashMap<Integer, Integer>();
Map<Integer, Integer> dataMap4 = new HashMap<Integer, Integer>();
Map<Integer, Integer> dataMap5 = new HashMap<Integer, Integer>();
Map<Integer, Map<String, Integer>> posdxMap = new HashMap<Integer, Map<String, Integer>>();
Map<Integer, Map<Integer, Integer>> posNumMap = new HashMap<Integer, Map<Integer, Integer>>();
//万、千、百、十、个
Map<Integer, Integer> posNum0 = new HashMap<Integer, Integer>();
Map<Integer, Integer> posNum1 = new HashMap<Integer, Integer>();
Map<Integer, Integer> posNum2 = new HashMap<Integer, Integer>();
Map<Integer, Integer> posNum3 = new HashMap<Integer, Integer>();
Map<Integer, Integer> posNum4 = new HashMap<Integer, Integer>();
//万、千、百、十、个 最大遗漏
Map<Integer, Integer> posMaxNum0 = new HashMap<Integer, Integer>();
Map<Integer, Integer> posMaxNum1 = new HashMap<Integer, Integer>();
Map<Integer, Integer> posMaxNum2 = new HashMap<Integer, Integer>();
Map<Integer, Integer> posMaxNum3 = new HashMap<Integer, Integer>();
Map<Integer, Integer> posMaxNum4 = new HashMap<Integer, Integer>();
//大小历史
Map<Integer, String> dxHistory = new HashMap<Integer, String>();
Map<Integer, Integer> temp = null;
for (int i = 1; i <= 5; i++) {
posdxMap.put(i, initDXMap());
dxHistory.put(i, "");
temp = new HashMap<Integer, Integer>();
for (int j = 0; j <= 9; j++) {
temp.put(j, 0);
}
posNumMap.put(i, temp);
}
Map<Integer, Integer> first2 = new HashMap<Integer, Integer>();
Map<Integer, Integer> first4 = new HashMap<Integer, Integer>();
Map<Integer, Integer> first5 = new HashMap<Integer, Integer>();
Map<Integer, Integer> first3 = new HashMap<Integer, Integer>();
Map<Integer, Integer> mid3 = new HashMap<Integer, Integer>();
Map<Integer, Integer> last3 = new HashMap<Integer, Integer>();
Map<Integer, Integer> row2 = new HashMap<Integer, Integer>();
Map<Integer, Integer> row3 = new HashMap<Integer, Integer>();
Map<Integer, Integer> row4 = new HashMap<Integer, Integer>();
Map<Integer, Integer> row5 = new HashMap<Integer, Integer>();
//最大遗漏
Map<Integer, Integer> maxOmit = new HashMap<Integer, Integer>();
//当前遗漏
Map<Integer, Integer> currentOmit = new HashMap<Integer, Integer>();
Map<Integer, String> omitHistory = new HashMap<Integer, String>();
temp = new HashMap<Integer, Integer>();
for (int i = 0; i <= 9; i++) {
omitHistory.put(i, "");
temp.put(i, 0);
}
first2.putAll(temp);
mid3.putAll(temp);
first3.putAll(temp);
last3.putAll(temp);
first4.putAll(temp);
first5.putAll(temp);
dataMap1.putAll(temp);
dataMap2.putAll(temp);
dataMap3.putAll(temp);
dataMap4.putAll(temp);
dataMap5.putAll(temp);
row2.putAll(temp);
row3.putAll(temp);
row4.putAll(temp);
row5.putAll(temp);
maxOmit.putAll(temp);
currentOmit.putAll(temp);
posNum0.putAll(temp);
posNum1.putAll(temp);
posNum2.putAll(temp);
posNum3.putAll(temp);
posNum4.putAll(temp);
posMaxNum0.putAll(temp);
posMaxNum1.putAll(temp);
posMaxNum2.putAll(temp);
posMaxNum3.putAll(temp);
posMaxNum4.putAll(temp);
//万、千、百、十、个
// int posNum1=0,posNum2=0,posNum3=0,posNum4=0,posNum5=0;
List<DataItem> list = new ArrayList<DataItem>();
String today = new SimpleDateFormat("yyyyMMdd").format(new Date());
try {
org.dom4j.Document root = utils.getDocumentComm(Config.DATA_FILE_PATH + type +".xml");
Element rootEl = root.getRootElement();
Iterator<Element> it = rootEl.elementIterator();
Element el;
DataItem item1;
while (it.hasNext()) {
el = it.next();
if (el.attributeValue("ID").indexOf(today) == -1) {
continue;
}
item1 = new DataItem(el.attributeValue("ID"),
el.attributeValue("opencode"), el.attributeValue("type"));
list.add(item1);
}
printMsg(type,"all size:" + list.size());
for (DataItem item : list) {
if (StringUtils.isBlank(item.getOpencode())) {
continue;
}
String[] codeArr = item.getOpencode().split(" ");
Integer[] intCodeArr = new Integer[codeArr.length];
for (int i = 0; i < codeArr.length; i++) {
intCodeArr[i] = Integer.parseInt(codeArr[i]);
if (intCodeArr[i] >= 5) {
addOmitData(dxHistory, i+1, CORRECT);
}else {
addOmitData(dxHistory, i+1, ERROR);
}
}
Map<Integer,Integer> set = getNummber(intCodeArr);
for (Entry<Integer,Integer> i : set.entrySet()) {
if (i.getValue()>=2) {
addMapData(row2, i.getKey());
if (i.getValue()>=3) {
addMapData(row3, i.getKey());
}
if (i.getValue()>=4) {
addMapData(row4, i.getKey());
}
if (i.getValue()>=5) {
addMapData(row5, i.getKey());
}
}
}
for (int i = 0; i <= 9; i++) {
if (item.getOpencode().indexOf(i+"") == -1) {
addMapData(currentOmit, i);
}else {
currentOmit.put(i, 0);
}
if (currentOmit.get(i) > maxOmit.get(i)) {
maxOmit.put(i, currentOmit.get(i));
}
}
for (Entry<Integer, Integer> e : currentOmit.entrySet()) {
omitHistory.put(e.getKey(), omitHistory.get(e.getKey())+e.getValue());
}
addMapData(dataMap1, intCodeArr[0]);
addMapData(dataMap2, intCodeArr[1]);
addMapData(dataMap3, intCodeArr[2]);
addMapData(dataMap4, intCodeArr[3]);
addMapData(dataMap5, intCodeArr[4]);
for (int i = 0; i <= 9; i++) {
if (intCodeArr[0] == i) {
posNum0.put(i, 0);
}else{
addMapData(posNum0, i);
}
if (posNum0.get(i) > posMaxNum0.get(i)) {
posMaxNum0.put(i, posNum0.get(i));
}
if (intCodeArr[1] == i) {
posNum1.put(i, 0);
}else{
addMapData(posNum1, i);
}
if (posNum1.get(i) > posMaxNum1.get(i)) {
posMaxNum1.put(i, posNum1.get(i));
}
if (intCodeArr[2] == i) {
posNum2.put(i, 0);
}else{
addMapData(posNum2, i);
}
if (posNum2.get(i) > posMaxNum2.get(i)) {
posMaxNum2.put(i, posNum2.get(i));
}
if (intCodeArr[3] == i) {
posNum3.put(i, 0);
}else{
addMapData(posNum3, i);
}
if (posNum3.get(i) > posMaxNum3.get(i)) {
posMaxNum3.put(i, posNum3.get(i));
}
if (intCodeArr[4] == i) {
posNum4.put(i, 0);
}else{
addMapData(posNum4, i);
}
if (posNum4.get(i) > posMaxNum4.get(i)) {
posMaxNum4.put(i, posNum4.get(i));
}
}
addMapData(first2, intCodeArr[0]);
addMapData(first2, intCodeArr[1]);
addMapData(first3, intCodeArr[0]);
addMapData(first3, intCodeArr[1]);
addMapData(first3, intCodeArr[2]);
addMapData(mid3, intCodeArr[1]);
addMapData(mid3, intCodeArr[2]);
addMapData(mid3, intCodeArr[3]);
addMapData(last3, intCodeArr[2]);
addMapData(last3, intCodeArr[3]);
addMapData(last3, intCodeArr[4]);
addMapData(first4, intCodeArr[0]);
addMapData(first4, intCodeArr[1]);
addMapData(first4, intCodeArr[2]);
addMapData(first4, intCodeArr[3]);
addMapData(first5, intCodeArr[0]);
addMapData(first5, intCodeArr[1]);
addMapData(first5, intCodeArr[2]);
addMapData(first5, intCodeArr[3]);
addMapData(first5, intCodeArr[4]);
}
} catch (Exception e) {
e.printStackTrace();
}
posMap.put(1, XmlUtils.makeSortedMap(dataMap1));
posMap.put(2, XmlUtils.makeSortedMap(dataMap2));
posMap.put(3, XmlUtils.makeSortedMap(dataMap3));
posMap.put(4, XmlUtils.makeSortedMap(dataMap4));
posMap.put(5, XmlUtils.makeSortedMap(dataMap5));
printMsg(type,"/*****************every position**********************/");
for (Entry<Integer, Map<Integer, Integer>> tem : posMap.entrySet()) {
printMsg(type,tem.getKey() + ": " + tem.getValue());
Map<String, Integer> dxMap = initDXMap();
for (Entry<Integer, Integer> te : tem.getValue().entrySet()) {
if (te.getKey()>=5) {
dxMap.put("big", dxMap.get("big")+te.getValue());
}else {
dxMap.put("small", dxMap.get("small")+te.getValue());
}
}
posdxMap.put(tem.getKey(), dxMap);
printMsg(type,tem.getKey() + ": " + dxMap);
}
printMsg(type,"/*****************dxHistory**********************/");
for (Entry<Integer, String> e : dxHistory.entrySet()) {
printMsg(type,e.getKey()+"--"+e.getValue());
}
// First two
// System.out
// .println("/*****************first2 4 position**********************/");
// printMsg(type,"first2:" + XmlUtils.makeSortedMap(first2));
// printMsg(type,"first3:" + XmlUtils.makeSortedMap(first3));
// printMsg(type,"first4:" + XmlUtils.makeSortedMap(first4));
//
// //first3 mid3 last3
// printMsg(type,"/*****************first3 mid3 last3**********************/");
// printMsg(type,"first3:" + XmlUtils.makeSortedMap(first3));
// printMsg(type,"mid3:" + XmlUtils.makeSortedMap(mid3));
// printMsg(type,"last3:" + XmlUtils.makeSortedMap(last3));
//
// //row 2 3 4
printMsg(type,"/*****************row 2 3 4 5 position**********************/");
printMsg(type,"row2:" + XmlUtils.makeSortedMap(row2));
printMsg(type,"row3:" + XmlUtils.makeSortedMap(row3));
printMsg(type,"row4:" + XmlUtils.makeSortedMap(row4));
printMsg(type,"row5:" + XmlUtils.makeSortedMap(row5));
//history
printMsg(type,"/*****************omitHistory**********************/");
for (Entry<Integer, String> e : omitHistory.entrySet()) {
printMsg(type,e.getKey()+"--"+e.getValue().replaceAll("[0]", CORRECT).replaceAll("[1-9]", ERROR));
}
String tips = "";
//maxOmit
printMsg(type,"yffs maxOmit:" + XmlUtils.makeSortedMap(maxOmit));
//currentOmit
printMsg(type,"yffs currentOmit:" + XmlUtils.makeSortedMap(currentOmit));
//万、千、百、十、个
printMsg(type," max w:" + XmlUtils.makeSortedMap(posMaxNum0));
printMsg(type,"current w:" + XmlUtils.makeSortedMap(posNum0));
printMsg(type," max q:" + XmlUtils.makeSortedMap(posMaxNum1));
printMsg(type,"current q:" + XmlUtils.makeSortedMap(posNum1));
printMsg(type," max b:" + XmlUtils.makeSortedMap(posMaxNum2));
printMsg(type,"current b:" + XmlUtils.makeSortedMap(posNum2));
printMsg(type," max s:" + XmlUtils.makeSortedMap(posMaxNum3));
printMsg(type,"current s:" + XmlUtils.makeSortedMap(posNum3));
printMsg(type," max g:" + XmlUtils.makeSortedMap(posMaxNum4));
printMsg(type,"current g:" + XmlUtils.makeSortedMap(posNum4));
for (Entry<Integer, Integer> en : posNum0.entrySet()) {
if (en.getValue() >= Config.POS_ALERT_COUNT) {
tips += " w---"+ en.getKey()+" over "+Config.POS_ALERT_COUNT+" ->"+en.getValue()+".\r\n";
}
}
for (Entry<Integer, Integer> en : posNum1.entrySet()) {
if (en.getValue() >= Config.POS_ALERT_COUNT) {
tips += " q---"+ en.getKey()+" over "+Config.POS_ALERT_COUNT+" ->"+en.getValue()+".\r\n";
}
}
for (Entry<Integer, Integer> en : posNum2.entrySet()) {
if (en.getValue() >= Config.POS_ALERT_COUNT) {
tips += " b---"+ en.getKey()+" over "+Config.POS_ALERT_COUNT+" ->"+en.getValue()+".\r\n";
}
}
for (Entry<Integer, Integer> en : posNum3.entrySet()) {
if (en.getValue() >= Config.POS_ALERT_COUNT) {
tips += " s---"+ en.getKey()+" over "+Config.POS_ALERT_COUNT+" ->"+en.getValue()+".\r\n";
}
}
for (Entry<Integer, Integer> en : posNum4.entrySet()) {
if (en.getValue() >= Config.POS_ALERT_COUNT) {
tips += " g---"+ en.getKey()+" over "+Config.POS_ALERT_COUNT+" ->"+en.getValue()+".\r\n";
}
}
for (Entry<Integer, Integer> en : currentOmit.entrySet()) {
if (en.getValue() >= Config.ALERT_COUNT) {
tips += " yffs---"+ en.getKey()+" over "+Config.ALERT_COUNT+" ->"+en.getValue()+".\r\n";
}
}
if (StringUtils.isNotBlank(tips)) {
printMsg(type,tips);
InfoUtil tool = new InfoUtil();
tool.show(type+": "+tips);
MP3Player.play("倍儿爽.mp3", 1);
}
printMsg(type,"/*****************all position**********************/");
printMsg(type,"all:" + XmlUtils.makeSortedMap(first5));
return resList;
}
public static Map<String,String> everySSCPos(String fileName,String day) {
return null;
}
private void stat3(List<DataItem> list){
//hou3 //qian3 //zhong3
if (list == null || list.isEmpty()) {
printMsg("", "list is null.");
return;
}
}
private void statData(List<DataItem> list,int pos){
//1 2 3 4 5
if (list == null || list.isEmpty()) {
printMsg("", "list is null.");
return;
}
Map<Integer, Integer> numMap = new HashMap<Integer, Integer>();
Map<Integer, Integer> data1 = new HashMap<Integer, Integer>();
Map<Integer, Integer> data2 = new HashMap<Integer, Integer>();
Map<Integer, Integer> data3 = new HashMap<Integer, Integer>();
Map<Integer, Integer> data4 = new HashMap<Integer, Integer>();
Map<Integer, Integer> data5 = new HashMap<Integer, Integer>();
//最大遗漏
Map<Integer, Integer> maxOmit = new HashMap<Integer, Integer>();
// Map<Integer, Integer> tempMaxOmit = new HashMap<Integer, Integer>();
//当前遗漏
Map<Integer, Integer> currentOmit = new HashMap<Integer, Integer>();
Map<Integer, String> omitHistory = new HashMap<Integer, String>();
for (int i = 0; i <= 9; i++) {
numMap.put(i, 0);
currentOmit.put(i, 0);
omitHistory.put(i, "0");
}
String type = "";
try {
printMsg(type,"all size:" + list.size());
for (DataItem item : list) {
if (StringUtils.isBlank(item.getOpencode())) {
printMsg("", item.getId()+" is null..");
continue;
}
String[] codeArr = item.getOpencode().split(" ");
int posNum = Integer.parseInt(codeArr[pos-1]);
for (int i = 0; i <= 9; i++) {
if (item.getOpencode().indexOf(i+"") == -1) {
addMapData(currentOmit, i);
}else {
currentOmit.put(i, 0);
}
if (currentOmit.get(i) > maxOmit.get(i)) {
maxOmit.put(i, currentOmit.get(i));
}
}
for (Entry<Integer, Integer> e : currentOmit.entrySet()) {
omitHistory.put(e.getKey(), omitHistory.get(e.getKey())+","+e.getValue());
}
addMapData(numMap, posNum);
}
} catch (Exception e) {
e.printStackTrace();
}
// dataMap1 = XmlUtils.makeSortedMap(dataMap1);
printMsg(type,"pos: "+pos);
// for (Entry<Integer, Map<Integer, Integer>> tem : posMap.entrySet()) {
// printMsg(type,tem.getKey() + ": " + tem.getValue());
//
// Map<String, Integer> dxMap = initDXMap();
// for (Entry<Integer, Integer> te : tem.getValue().entrySet()) {
// if (te.getKey()>=5) {
// dxMap.put("big", dxMap.get("big")+te.getValue());
// }else {
// dxMap.put("small", dxMap.get("small")+te.getValue());
// }
// }
// posdxMap.put(tem.getKey(), dxMap);
// printMsg(type,tem.getKey() + ": " + dxMap);
// }
//
//history
printMsg(type,"/*****************omitHistory**********************/");
for (Entry<Integer, String> e : omitHistory.entrySet()) {
printMsg(type,"========"+e.getKey()+" history:");
printMsg(type,e.getValue());
}
//maxOmit
printMsg(type,"/*****************maxOmit**********************/");
printMsg(type,"maxOmit:" + XmlUtils.makeSortedMap(maxOmit));
//currentOmit
printMsg(type,"/*****************current omit**********************/");
printMsg(type,"currentOmit:" + XmlUtils.makeSortedMap(currentOmit));
for (Entry<Integer, Integer> en : currentOmit.entrySet()) {
if (en.getValue() >= 8) {
printMsg(type,en.getKey()+" over 8.");
MP3Player.play("倍儿爽.mp3", 1);
break;
}
}
}
public static Map<String,String> every115Pos(String fileName,String day) {
Map<String,String> resMap = new HashMap<String,String>();
XmlUtils utils = new XmlUtils();
Map<Integer, String> num = new HashMap<Integer, String>();
//最大遗漏
Map<Integer, Integer> maxOmit = new HashMap<Integer, Integer>();
// Map<Integer, Integer> tempMaxOmit = new HashMap<Integer, Integer>();
//当前遗漏
Map<Integer, Integer> currentOmit = new HashMap<Integer, Integer>();
Map<Integer, String> omitHistory = new HashMap<Integer, String>();
for (int i = 1; i <= 11; i++) {
num.put(i, "");
maxOmit.put(i, 0);
currentOmit.put(i, 0);
omitHistory.put(i, "0");
}
List<DataItem> list = new ArrayList<DataItem>();
try {
org.dom4j.Document root = utils.getDocumentComm(Config.DATA_FILE_PATH + fileName +".xml");
Element rootEl = root.getRootElement();
Iterator<Element> it = rootEl.elementIterator();
Element el;
DataItem item1;
while (it.hasNext()) {
el = it.next();
if (StringUtils.isNotBlank(day) && el.attributeValue("ID").indexOf(day) == -1) {
continue;
}
item1 = new DataItem(el.attributeValue("ID"),
el.attributeValue("opencode"), el.attributeValue("type"));
list.add(item1);
}
printMsg(fileName, "^^^^^^all size:" + list.size());
for (DataItem item : list) {
if (StringUtils.isBlank(item.getOpencode())) {
continue;
}
String[] codeArr = item.getOpencode().split(" ");
Integer[] intCodeArr = new Integer[codeArr.length];
List<Integer> intList = new ArrayList<Integer>();
for (int i = 0; i < codeArr.length; i++) {
intCodeArr[i] = Integer.parseInt(codeArr[i]);
intList.add(intCodeArr[i]);
}
for (int i = 1; i <= 11; i++) {
if (!intList.contains(i)) {
addMapData(currentOmit, i);
}else {
currentOmit.put(i, 0);
}
if (currentOmit.get(i) > maxOmit.get(i)) {
maxOmit.put(i, currentOmit.get(i));
}
//1~11
if (intList.contains(i)) {
addOmitData(num, i, CORRECT);
}else {
addOmitData(num, i, ERROR);
}
}
for (Entry<Integer, Integer> e : currentOmit.entrySet()) {
omitHistory.put(e.getKey(), omitHistory.get(e.getKey())+","+e.getValue());
}
// addMapData(dataMap1, intCodeArr[0]);
}
} catch (Exception e) {
e.printStackTrace();
}
// posMap.put(1, XmlUtils.makeSortedMap(dataMap1));
//num
for (Entry<Integer, String> e : num.entrySet()) {
printMsg(fileName, ((e.getKey()+"").length()==1?"0"+e.getKey():e.getKey())+"--"+e.getValue());
}
//history
// System.out.println("/*****************omitHistory**********************/");
// for (Entry<Integer, String> e : omitHistory.entrySet()) {
// System.out.println("========"+e.getKey()+" history:");
// System.out.println(e.getValue());
// }
//maxOmit
// System.out.println("/*****************maxOmit**********************/");
printMsg(fileName, "^^^^^^^^^^maxOmit:" + XmlUtils.makeSortedMap(maxOmit));
// //currentOmit
// System.out.println("/*****************current omit**********************/");
printMsg(fileName, "^^^^^^currentOmit:" + XmlUtils.makeSortedMap(currentOmit));
//
/*for (Entry<Integer, Integer> en : currentOmit.entrySet()) {
if (en.getValue() >= 8) {
printMsg(fileName, en.getKey()+" over 8.");
MP3Player.play("倍儿爽.mp3", 1);
break;
}
}*/
return resMap;
}
private static void addOmitData(Map<Integer, String> dataMap,int num, String val) {
dataMap.put(num, dataMap.get(num)+val);
}
private static Map<Integer,Integer> getNummber(Integer[] intCodeArr) {
Map<Integer,Integer> dataMap = new HashMap<>();
for (int i = 0;i<intCodeArr.length; i++) {
addMapData(dataMap, intCodeArr[i]);
}
return dataMap;
}
public void getIsPullData(String url,String id) {//100 BLSSC
try {
Connection conn = ConnectionManager.getInstance().getConnection(url);
conn.cookie("id", id).data("id",id,"page","1","rows","10");
Document doc = conn.post();
String res = doc.text();
JSONObject obj = JSONObject.fromObject(res);
int total = obj.getInt("total");
System.out.println("^^^^^^total:"+total +" lastPullCount:"+lastPullCount+"~~~~~"+format.format(new Date()));
isPullData = total != lastPullCount;
lastPullCount = total;
} catch (Exception e) {
e.printStackTrace();
}
}
public void getIsPullBLData(String url) {//100 BLSSC
getIsPullData(url,"100");
}
public void getIsPullSD115Data() {
getIsPullData(url,Config.prop.getProperty("sd115id"));
}
public void data115(String day,String id) {
String type = "";
if (Config.prop.getProperty("sd115id").equals(id)) {
type = "sd115";
}else if (Config.prop.getProperty("jx115id").equals(id)) {
type = "jx115";
}else if (Config.prop.getProperty("gd115id").equals(id)) {
type = "gd115";
}else if (Config.prop.getProperty("cq115id").equals(id)) {
type = "cq115";
}
int pageNo = 1;
try {
XmlUtils utils = new XmlUtils();
Connection conn = ConnectionManager.getInstance().getConnection(url);
conn.cookie("id", id).data("id",id,"page",""+pageNo,"rows","10");
Document doc = conn.post();
String res = doc.text();
JSONObject obj = JSONObject.fromObject(res);
int total = obj.getInt("total");
int count = 0;
boolean skipout = false;
do {
conn = ConnectionManager.getInstance().getConnection(url);
conn.cookie("id", id).data("id",id,"page",""+pageNo,"rows","50");
doc = conn.post();
res = doc.text();
JSONArray rows = JSONObject.fromObject(res).getJSONArray("rows");
count = count + rows.size();
for (Object object : rows) {
JSONObject row = (JSONObject) object;
if (row.getString("phase").indexOf(day) == -1) {
skipout = true;
continue;
}
DataItem item = new DataItem(row.getString("phase"), row.getString("code").replaceAll(",", " "), type);
if (utils.addSSCItem(item)) {
printMsg(id,row.getString("phase") +": "+row.getString("code")+ " insert...");
}else {
skipout = true;
break;
}
}
pageNo++;
} while (count < total && !skipout);
sortOpened(new XmlUtils(),type+".xml");
} catch (Exception e) {
e.printStackTrace();
}
}
public void dataBLSSC(String url) {//100 BLSSC
String id = "100";
int pageNo = 1;
try {
String today = new SimpleDateFormat("yyyyMMdd").format(new Date());
// today = "20140917";
XmlUtils utils = new XmlUtils();
Connection conn = ConnectionManager.getInstance().getConnection(url);
conn.cookie("id", id).data("id",id,"page",""+pageNo,"rows","10");
Document doc = conn.post();
String res = doc.text();
JSONObject obj = JSONObject.fromObject(res);
int total = obj.getInt("total");
int count = 0;
boolean skipout = false;
do {
conn = ConnectionManager.getInstance().getConnection(url);
conn.cookie("id", id).data("id",id,"page",""+pageNo,"rows","50");
doc = conn.post();
res = doc.text();
JSONArray rows = JSONObject.fromObject(res).getJSONArray("rows");
count = count + rows.size();
for (Object object : rows) {
JSONObject row = (JSONObject) object;
if (row.getString("phase").indexOf(today) == -1) {
skipout = true;
continue;
}
DataItem item = new DataItem();
item = new DataItem(row.getString("phase"), row.getString("code").replaceAll(",", " "), "blssc");
if (utils.addSSCItem(item)) {
System.out.println(row.getString("phase") +": "+row.getString("code")+ " insert...");
}else {
// System.err.println(row.getString("phase")+" is inserted!");
skipout = true;
break;
}
}
pageNo++;
} while (count < total && !skipout);
sortOpened(new XmlUtils(),"blssc.xml");
System.out.println("**********END insert "+count+"**********");
} catch (Exception e) {
e.printStackTrace();
}
}
public void dataSSC(String url,String id) {//21 CQ 22 JX
String type = "";
if (Config.prop.getProperty("blsscid").equals(id)) {
type = "blssc";
}else if (Config.prop.getProperty("jxsscid").equals(id)) {
type = "jxssc";
}else if (Config.prop.getProperty("cqsscid").equals(id)) {
type = "cqssc";
}
int pageNo = 1;
try {
String today = new SimpleDateFormat("yyyyMMdd").format(new Date());
XmlUtils utils = new XmlUtils();
Connection conn = ConnectionManager.getInstance().getConnection(url);
conn.cookie("id", id).data("id",id,"page",""+pageNo,"rows","10");
Document doc = conn.post();
String res = doc.text();
JSONObject obj = JSONObject.fromObject(res);
int total = obj.getInt("total");
int count = 0;
boolean skipout = false;
do {
conn = ConnectionManager.getInstance().getConnection(url);
conn.cookie("id", id).data("id",id,"page",""+pageNo,"rows","50");
doc = conn.post();
res = doc.text();
JSONArray rows = JSONObject.fromObject(res).getJSONArray("rows");
count = count + rows.size();
for (Object object : rows) {
JSONObject row = (JSONObject) object;
if (row.getString("phase").indexOf(today) == -1) {
skipout = true;
continue;
}
DataItem item = new DataItem(row.getString("phase"), row.getString("code").replaceAll(",", " "), type);
if (utils.addSSCItem(item)) {
printMsg(id, row.getString("phase") +": "+row.getString("code")+ " insert...");
dataTipMsg += type + " " + row.getString("phase") +": "+row.getString("code")+"\r\n";
}else {
skipout = true;
break;
}
}
pageNo++;
} while (count < total && !skipout);
sortOpened(new XmlUtils(),type+".xml");
} catch (Exception e) {
e.printStackTrace();
}
}
public void dataFFC(String url) {
int pageNo = 1;
try {
XmlUtils utils = new XmlUtils();
Connection conn = ConnectionManager.getInstance().getConnection(url);
conn.cookie("id", "103").data("id","103","page",""+pageNo,"rows","10");
Document doc = conn.post();
String res = doc.text();
JSONObject obj = JSONObject.fromObject(res);
int total = obj.getInt("total");
// System.out.println(total);
int count = 0;
boolean skipout = false;
String today = new SimpleDateFormat("yyyyMMdd").format(new Date());
do {
conn = ConnectionManager.getInstance().getConnection(url);
conn.cookie("id", "103").data("id","103","page",""+pageNo,"rows","50");
doc = conn.post();
res = doc.text();
JSONArray rows = JSONObject.fromObject(res).getJSONArray("rows");
count = count + rows.size();
for (Object object : rows) {
JSONObject row = (JSONObject) object;
if (row.getString("phase").indexOf(today) == -1) {
skipout = true;
continue;
}
DataItem item = new DataItem();
item = new DataItem(row.getString("phase"), row.getString("code").replaceAll(",", " "), "ffc");
if (utils.addSSCItem(item)) {
System.out.println(row.getString("phase") + ": " + row.getString("code") + " insert...");
}else {
skipout = true;
break;
}
}
pageNo++;
} while (count < total && !skipout);
sortOpened(new XmlUtils(),"ffc.xml");
System.out.println("**********END**********");
} catch (Exception e) {
e.printStackTrace();
}
}
private void sortOpened(XmlUtils utils,String fileName){
try {
org.dom4j.Document root = utils.getDocumentComm(Config.DATA_FILE_PATH + fileName);
Element rootEl = root.getRootElement();
Iterator<Element> it = rootEl.elementIterator();
Element el;
DataItem item1;
List<DataItem> list = new ArrayList<DataItem>();
while (it.hasNext()) {
el = it.next();
item1 = new DataItem(el.attributeValue("ID"),
el.attributeValue("opencode"), el.attributeValue("type"));
list.add(item1);
utils.delete(el.attributeValue("ID"), Config.DATA_FILE_PATH + fileName);
}
Collections.sort(list, new Comparator<DataItem>() {
public int compare(DataItem o1, DataItem o2) {
return BigDecimal.valueOf(Long.parseLong(o1.getId().replaceAll("-", ""))).subtract(BigDecimal.valueOf(Long.parseLong(o2.getId().replaceAll("-", "")))).intValue();
}
});
for (DataItem dataItem : list) {
if (utils.addSSCItem(dataItem)) {
// System.out.println(dataItem.getId() + " insert...");
}else{
System.out.println(dataItem.getId() + " insert fail...");
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
private static void printMsg(String type,String msg){
//100 BLSSC //21 CQ 22 JX
if (Config.prop.getProperty("blsscid").equals(type) || "blssc".equals(type)) {
System.out.println("BL: "+msg);
}else if (Config.prop.getProperty("cqsscid").equals(type) || "cqssc".equals(type)) {
System.out.println("CQ: "+msg);
}else if (Config.prop.getProperty("jxsscid").equals(type) || "jxssc".equals(type)) {
System.out.println("JX: "+msg);
}else if (Config.prop.getProperty("sd115id").equals(type) || "sd115".equals(type)) {
System.out.println("SD: "+msg);
}else if (Config.prop.getProperty("jx115id").equals(type) || "jx115".equals(type)) {
System.out.println("JX: "+msg);
}else if (Config.prop.getProperty("gd115id").equals(type) || "gd115".equals(type)) {
System.out.println("GD: "+msg);
}else if (Config.prop.getProperty("cq115id").equals(type) || "cq115".equals(type)) {
System.out.println("CQ: "+msg);
}else {
System.out.println(msg);
}
}
}