private void sendGifMsg( String serviceid, String userid, String operator, String service, String mtcontent, BigDecimal requestid, int contenttype) { try { MsgObject msg = new MsgObject(); msg.setContenttype(contenttype); msg.setUserid(userid); msg.setMobileoperator(operator); msg.setMsgtype(0); msg.setRequestid(requestid); msg.setServiceid(serviceid); msg.setKeyword(service); msg.setUsertext(mtcontent); DBUtil.sendMT(msg); } catch (Exception ex) { Util.logger.sysLog(2, this.getClass().getName(), "Send gif Failed"); } }
protected Collection getMessages(MsgObject msgObject, Keyword keyword) throws Exception { Collection messages = new ArrayList(); // String dbcontent = "textbase"; String gameid = "soicau"; String sServiceID = msgObject.getServiceid(); String sMsg = replaceAllWhiteLetter(msgObject.getUsertext()); // String COMPANY_NAME = ""; String COMMAND_CODE = "INV"; String sMsg1 = replaceAllWhiteWithOne(sMsg); sMsg1 = validMsgInput(sMsg1); // Lấy CAUXXX COMMAND_CODE = getCommandCode(sMsg1); try { // Neu ma tinh khong ton tai thi return luon if ("INV".equalsIgnoreCase(COMMAND_CODE)) { msgObject.setUsertext( "Tin sai cu phap. Hay soan tin:\n*CAU<MaTinh> gui " + sServiceID + " de soi cau.\n*XS<MaTinh> de xem Tuong thuat truc tiep ket qua"); msgObject.setMsgtype(1); messages.add(new MsgObject(msgObject)); return messages; } int companyId = getCompanyId(COMMAND_CODE); // Lay noi dung va tra ve String hour = getTimeLottery(companyId); // Neu thoi gian ma lon hon if (!isNewSession(hour)) { msgObject.setUsertext("Hien tai he thong chua cap nhat cho ngay moi. Vui long lien he lai"); } else { String content = getContent(gameid, COMMAND_CODE); String[] sTokens = content.split("###"); for (int i = 0; i < sTokens.length; i++) { if (!"".equalsIgnoreCase(sTokens[i])) { msgObject.setUsertext(sTokens[i]); if (i == 0) { msgObject.setMsgtype(1); } else { msgObject.setMsgtype(0); } msgObject.setContenttype(0); messages.add(new MsgObject(msgObject)); } } } return messages; } catch (Exception e) { msgObject.setUsertext( "Tin sai cu phap. Hay soan tin:\n*CAU<MaTinh> gui " + sServiceID + " de soi cau.\n*XS<MaTinh> de xem Tuong thuat truc tiep ket qua"); } return messages; }
@Override protected Collection getMessages(MsgObject msgObject, Keyword keyword) throws Exception { String ismtadd = "1"; try { Collection messages = new ArrayList(); String infoid = ""; String sKeyword = msgObject.getKeyword(); String inv_telco = "Hien tai dich vu chua ho tro mang cua ban, moi ban quay lai sau.DTHT 1900571566"; HashMap _option = new HashMap(); String options = keyword.getOptions(); String numberid = "8x51"; String dtbase = "gateway"; String last_msg = "MCA tencasy gui 8751.DTHT 1900571566"; try { Util.logger.sysLog(2, this.getClass().getName(), "options: " + options); _option = getParametersAsString(options); numberid = getString(_option, "numberid", numberid); dtbase = getString(_option, "dtbase", dtbase); inv_telco = getString(_option, "inv_telco", inv_telco); last_msg = getString(_option, "last_msg", last_msg); ismtadd = getString(_option, "ismtadd", ismtadd); } catch (Exception e) { Util.logger.sysLog(2, this.getClass().getName(), "Error: " + e.toString()); throw new Exception("Wrong config in options"); } /*kiem tra thue bao khach hang*/ if ("VIETTEL".equalsIgnoreCase(msgObject.getMobileoperator()) || "VIETEL".equalsIgnoreCase(msgObject.getMobileoperator())) { infoid = "viettel"; } else if (("VMS".equalsIgnoreCase(msgObject.getMobileoperator())) || "mobifone".equalsIgnoreCase(msgObject.getMobileoperator())) { infoid = "mobifone"; } else if (("GPC".equalsIgnoreCase(msgObject.getMobileoperator())) || ("VINAPHONE".equalsIgnoreCase(msgObject.getMobileoperator()))) { infoid = "vinaphone"; } else if (("GTEL".equalsIgnoreCase(msgObject.getMobileoperator())) || ("Beeline".equalsIgnoreCase(msgObject.getMobileoperator()))) { infoid = "beeline"; } else { infoid = "other"; } if ("other".equalsIgnoreCase(infoid)) { msgObject.setUsertext(inv_telco); msgObject.setMsgtype(1); messages.add(new MsgObject(msgObject)); return messages; } // lay so thue bao nguoi gui String userid = msgObject.getUserid(); /*lay noi dung gui */ String userText = replaceAllWhiteWithOne(msgObject.getUsertext().toUpperCase()); String[] sTokens = replaceAllWhiteWithOne(userText).split(" "); String serviceid = msgObject.getServiceid(); /* * nc ten bai hat */ if (sTokens.length > 1) { String subTokens = ""; for (int k = 1; k < sTokens.length; k++) { subTokens = subTokens + sTokens[k] + " "; } Util.logger.info("SubTokens : " + subTokens); String subTokens2 = subTokens.replace(" ", ""); String[] resultMusicID = new String[2]; // 0 la ten bai hat, 1 ma ma bai hat resultMusicID = findMusicID(subTokens2, infoid); if ("".equalsIgnoreCase(resultMusicID[1])) { resultMusicID = findMusicIDlike(subTokens2, infoid); } // MT1 if (!"".equalsIgnoreCase(resultMusicID[1])) { Random iRandom = new Random(); int imusic = iRandom.nextInt(10); if ("viettel".equalsIgnoreCase(infoid)) { if (musicHot_Viettel[imusic].startsWith(resultMusicID[0].trim())) { if (imusic == musicHot_Viettel.length) { imusic = imusic - 1; } else { imusic = imusic + 1; } } resultMusicID[1] = "De tai " + resultMusicID[0] + " ban soan: B1: Soan DK gui 1221.B2: Soan BH " + resultMusicID[1] + " gui 1221.Bai hat HOT nhat trong thang: " + musicHot_Viettel[imusic]; } else if ("vinaphone".equalsIgnoreCase(infoid)) { if (musicHot_Vinaphone[imusic].startsWith(resultMusicID[0].trim())) { if (imusic == musicHot_Vinaphone.length) { imusic = imusic - 1; } else { imusic = imusic + 1; } } resultMusicID[1] = "De tai " + resultMusicID[0] + " ban soan: B1: Soan DK gui 9194.B2: Soan TUNE " + resultMusicID[1] + " gui 9194.Bai hat HOT nhat trong thang: " + musicHot_Vinaphone[imusic]; } else if ("mobifone".equalsIgnoreCase(infoid)) { if (musicHot_Mobifone[imusic].startsWith(resultMusicID[0].trim())) { if (imusic == musicHot_Mobifone.length) { imusic = imusic - 1; } else { imusic = imusic + 1; } } resultMusicID[1] = "De tai " + resultMusicID[0] + " ban soan: B1: Soan DK gui 9224.B2: Soan CHON " + resultMusicID[1] + " gui 9224.Bai hat HOT nhat trong thang: " + musicHot_Mobifone[imusic]; } else if ("beeline".equalsIgnoreCase(infoid)) { // New mang Beeline if (musicHot_Beeline[imusic].startsWith(resultMusicID[0].trim())) { if (imusic == musicHot_Beeline.length) { imusic = imusic - 1; } else { imusic = imusic + 1; } } resultMusicID[1] = "De tai " + resultMusicID[0] + " ban soan: CHON " + resultMusicID[1] + " gui 1221.Bai hat HOT nhat trong thang: " + musicHot_Beeline[imusic]; } if (resultMusicID[1].length() > 160) { String[] subString = new String[2]; subString[0] = resultMusicID[1].substring(0, 159); subString[1] = resultMusicID[1].substring(160); for (int k = 0; k < 2; k++) { if (!"".equalsIgnoreCase(subString[k])) { msgObject.setUsertext(subString[k]); if (k == 0) { msgObject.setMsgtype(1); } else { msgObject.setMsgtype(0); } msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); } } } else { msgObject.setUsertext(resultMusicID[1]); msgObject.setMsgtype(1); msgObject.setContenttype(0); // messages.add(new MsgObject(ms//gObject)); DBUtil.sendMT(msgObject); Thread.sleep(1000); } // tim danh sach bai hat hot // Kiem tra so lan gui tin cua khach hang int time2send = getUserID(userid, dbcontent, 1); String lastid = ""; if (time2send >= 1) { lastid = getMusicID(userid, dbcontent, 1); } else { // Ghi lai danh sach khach hang da gui saverequest(userid, dbcontent, 1); } // Lay danh sach cac bai hat HOT String musichotsend = findListofMusic(userid, infoid, lastid, 1); String[] listsendClient = splitString(musichotsend); if (!"".equalsIgnoreCase(listsendClient[0])) { msgObject.setUsertext(listsendClient[0]); msgObject.setMsgtype(0); msgObject.setContenttype(0); // messages.add(new MsgObject(msgObject)); DBUtil.sendMT(msgObject); Thread.sleep(500); } // Send MT4 cho khach hang String sendtoClient = "Ngoai nhung BH ban vua nhan duoc,van con hang ngan BH khac tren " + numberid + ".De tiep tuc nhan duoc ma so BH.Soan:" + last_msg; msgObject.setUsertext(sendtoClient); msgObject.setMsgtype(0); msgObject.setContenttype(0); // messages.add(new MsgObject(msgObject)); DBUtil.sendMT(msgObject); Thread.sleep(500); return null; } else { // Bai hat chua co trong he thong. // Send MT 1 String info2Client = ""; if ("viettel".equalsIgnoreCase(infoid)) { info2Client = "Bai hat ban thich hien tai chua co trong he thong. De tai bai hat.Buoc1, soan DK gui 1221.Buoc2, soan: BH maso gui 1221. Tang ban ma so BH HOT:"; } else if ("vinaphone".equalsIgnoreCase(infoid)) { info2Client = "Bai hat ban thich hien tai chua co trong he thong. De tai bai hat.Buoc1, soan DK gui 9194.Buoc2, soan: TUNE maso gui 9194. Tang ban ma so BH HOT:"; } else if ("mobifone".equalsIgnoreCase(infoid)) { info2Client = "Bai hat ban thich hien tai chua co trong he thong. De tai bai hat.Buoc1, soan DK gui 9224.Buoc2, soan: CHON maso gui 9224. Tang ban ma so BH HOT:"; } else if ("beeline".equalsIgnoreCase(infoid)) { info2Client = "Bai hat ban thich hien tai chua co trong he thong. De tai bai hat, soan: CHON masobaihat gui 1221. Tang ban ma so BH HOT:"; } msgObject.setUsertext(info2Client); msgObject.setMsgtype(1); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); // Send MT 2 - 3 // tim danh sach bai hat hot // Kiem tra so lan gui tin cua khach hang int time2send = getUserID(userid, dbcontent, 1); String lastid = ""; if (time2send >= 1) { lastid = getMusicID(userid, dbcontent, 1); } else { // Ghi lai danh sach khach hang da gui saverequest(userid, dbcontent, 1); } // Lay danh sach cac bai hat HOT String musichotsend = findListofMusic(userid, infoid, lastid, 1); String[] listsendClient = splitString(musichotsend); if (!"".equalsIgnoreCase(listsendClient[0])) { msgObject.setUsertext(listsendClient[0]); msgObject.setMsgtype(0); msgObject.setContenttype(0); // messages.add(new MsgObject(msgObject)); DBUtil.sendMT(msgObject); Thread.sleep(500); } // Send MT4 cho khach hang String sendtoClient = "Ngoai nhung BH ban vua nhan duoc, van con hang ngan BH khac tren " + numberid + ".De tiep tuc nhan duoc ma so BH.Soan: " + last_msg; msgObject.setUsertext(sendtoClient); msgObject.setMsgtype(0); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(500); return null; } } else { /* nc */ // Send MT int timesend = getUserID(userid, dbcontent, 0); String lastid = ""; if (timesend >= 1) { // Gui lan thu 2 lastid = getMusicID(userid, dbcontent, 0); } else { // Ghi lai thong tin ghi nhan khach hang da gui den 6x54 saverequest(userid, dbcontent, 0); } String info2Client = ""; if ("viettel".equalsIgnoreCase(infoid)) { info2Client = viettelGuide; } else if ("vinaphone".equalsIgnoreCase(infoid)) { info2Client = vinaphoneGuide; } else if ("mobifone".equalsIgnoreCase(infoid)) { info2Client = mobifoneGuide; } else if ("beeline".equalsIgnoreCase(infoid)) { info2Client = beelineGuide; } msgObject.setUsertext(info2Client); msgObject.setMsgtype(1); msgObject.setContenttype(0); // messages.add(new MsgObject(msgObject)); DBUtil.sendMT(msgObject); Thread.sleep(1000); // MT2 - 3 String musichotsend = findListofMusic(userid, infoid, lastid, 1); String[] listsendClient = splitString(musichotsend); if (!"".equalsIgnoreCase(listsendClient[0])) { msgObject.setUsertext(listsendClient[0]); msgObject.setMsgtype(0); msgObject.setContenttype(0); // messages.add(new MsgObject(msgObject)); DBUtil.sendMT(msgObject); Thread.sleep(500); } // MT 4 // Send MT4 cho khach hang String sendtoClient = "Ngoai nhung BH ban vua nhan duoc, van con hang ngan BH khac tren " + numberid + ".De tiep tuc nhan duoc ma so BH.Soan: " + last_msg; msgObject.setUsertext(sendtoClient); msgObject.setMsgtype(0); msgObject.setContenttype(0); // messages.add(new MsgObject(msgObject)); DBUtil.sendMT(msgObject); Thread.sleep(500); return null; } } catch (Exception e) { Util.logger.sysLog(2, this.getClass().getName(), "Exception:" + e.getMessage()); return null; } finally { if ("1".equalsIgnoreCase(ismtadd)) ExecuteADVCR.add2queueADV( msgObject.getMsgtype(), msgObject.getServiceid(), msgObject.getUserid(), msgObject.getKeyword(), msgObject.getRequestid(), msgObject.getTTimes(), msgObject.getMobileoperator()); } }
@Override protected Collection getMessages(MsgObject msgObject, Keyword keyword) throws Exception { String ismtadd = "0"; String isforwardMO = "0"; try { Collection messages = new ArrayList(); String infoid = ""; String sKeyword = msgObject.getKeyword(); String inv_telco = "Hien tai dich vu chua ho tro mang cua ban, moi ban quay lai sau.DTHT 1900571566"; HashMap _option = new HashMap(); String options = keyword.getOptions(); try { Util.logger.sysLog(2, this.getClass().getName(), "options: " + options); _option = getParametersAsString(options); ismtadd = getString(_option, "ismtadd", ismtadd); isforwardMO = getString(_option, "mo", isforwardMO); } catch (Exception e) { Util.logger.sysLog(2, this.getClass().getName(), "Error: " + e.toString()); throw new Exception("Wrong config in options"); } // lay so thue bao nguoi gui String userid = msgObject.getUserid(); /* lay noi dung gui */ String userText = replaceAllWhiteWithOne(msgObject.getUsertext()); String[] sTokens = replaceAllWhiteWithOne(userText).split(" "); Calendar cal = Calendar.getInstance(); int day = cal.get(Calendar.DATE); int month = cal.get(Calendar.MONTH) + 1; int year = cal.get(Calendar.YEAR); String date = FormatNumber(day) + "/" + FormatNumber(month) + "/" + year; String mt2 = "Tang ban 3 game online HOT nhat hien nay.DTHT 1900571566:http://s.mobinet.vn/d/list_gf.htm"; if (sTokens.length == 1) { msgObject.setUsertext( "Tin ban gui khong hop le. De tim ban theo nam sinh, soan: N namsinh gui 8251. De tim ban theo noi o va nam sinh, soan T namsinh tinh gui 8251."); msgObject.setMsgtype(1); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); return null; } else { List<String> nick = findBirth(sTokens[1]); String nick_example = ""; if (nick.size() > 0) { String allNick = ""; nick_example = nick.get(0); int size = 0; for (int i = 0; i < nick.size(); i++) { allNick += nick.get(i) + ","; size += 1; if (size == 5) { allNick = allNick.substring(0, allNick.length() - 1); break; } } msgObject.setUsertext("Thanh vien sinh nam " + sTokens[1] + ": " + allNick); msgObject.setMsgtype(1); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); msgObject.setUsertext( "De xin SDT cua thanh vien khac, soan: SDT <ma so cua thanh vien do> gui 8551. VD: SDT " + nick_example + " gui 8551. DTHT: 1900571566"); msgObject.setMsgtype(0); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); } else { msgObject.setUsertext( "Khong tim thay nick nao theo yeu cau cua ban. Ban co the tim theo ngay sinh khac. DTHT: 1900571566"); msgObject.setMsgtype(1); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); } return null; } } catch (Exception e) { Util.logger.sysLog(2, this.getClass().getName(), "Exception:" + e.getMessage()); return null; } finally { if ("1".equalsIgnoreCase(ismtadd)) ExecuteADVCR.add2queueADV( msgObject.getMsgtype(), msgObject.getServiceid(), msgObject.getUserid(), msgObject.getKeyword(), msgObject.getRequestid(), msgObject.getTTimes(), msgObject.getMobileoperator()); } }
@Override protected Collection getMessages(MsgObject msgObject, Keyword keyword) throws Exception { HashMap _option = new HashMap(); Collection messages = new ArrayList(); String dtbase = "gateway"; String operator = msgObject.getMobileoperator(); try { int[] result = new int[2]; String infoid = msgObject.getMobileoperator(); String userid = msgObject.getUserid(); String info = msgObject.getUsertext(); String[] sTokens = replaceAllWhiteWithOne(info).split(" "); if ("SFONE".equalsIgnoreCase(msgObject.getMobileoperator())) { msgObject.setUsertext("Dich vu chua ho tro mang cua ban. DTHT 1900571566"); msgObject.setMsgtype(2); DBUtil.sendMT(msgObject); Thread.sleep(1000); return null; } if (sTokens.length < 2) { msgObject.setUsertext( "Cam on ban da su dung dich vu.Yeu cau cua ban chua hop le, ban vui long kiem tra lai cu phap hoac lien he tong dai 1900571566 de duoc huong dan su dung dich vu."); msgObject.setMsgtype(1); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); msgObject.setUsertext( "Tang ban 3 game online HOT nhat hien nay.DTHT 1900571566:http://s.mobinet.vn/d/list_gf.htm"); msgObject.setMsgtype(0); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); return null; } else { String sttuser = Getnickbysdt(msgObject.getUserid()); if (sttuser.equalsIgnoreCase("")) { msgObject.setUsertext( "Ban chua dang ky Chat tren Hop Nhac So VTV6. Soan: IC nickchat gui 8751 de dky nick va tham gia Chat cung ban be. DTHT: 1900571566"); msgObject.setMsgtype(1); DBUtil.sendMT(msgObject); Thread.sleep(1000); return null; } String chatuser = Checknick(sTokens[1]); Util.logger.info("chatuser : "******"")) { msgObject.setUsertext( "Ten nick ban vua chon khong ton tai. Vui long kiem tra lai. DTHT: 1900571566"); msgObject.setMsgtype(1); DBUtil.sendMT(msgObject); Thread.sleep(1000); return null; } String blacklist = Getblacklist(sTokens[1]); blacklist = blacklist + "," + sTokens[1]; updateBlacklist(msgObject.getUserid(), blacklist); msgObject.setUsertext( "Ban da khoa tin chat rieng tu nick " + sTokens[1] + " thanh cong. De mo khoa, soan: ICM tennicktuchoi gui 8151"); msgObject.setMsgtype(1); DBUtil.sendMT(msgObject); Thread.sleep(1000); } return null; } catch (Exception e) { Util.logger.sysLog(2, this.getClass().getName(), "Exception: " + e.getMessage()); return null; } finally { } }
@Override protected Collection getMessages(MsgObject msgObject, Keyword keyword) throws Exception { String ismtadd = "0"; String isforwardMO = "0"; try { Collection messages = new ArrayList(); String infoid = ""; String sKeyword = msgObject.getKeyword(); String inv_telco = "Hien tai dich vu chua ho tro mang cua ban, moi ban quay lai sau.DTHT 1900571566"; String mt1 = "De tai Game theo ma so, soan: GAME maso gui 8751.Cai dat GPRS 3.0 tu dong ve may de co the luot web va choi game,tai nhac,soan tin GPRS gui 8751."; HashMap _option = new HashMap(); String options = keyword.getOptions(); try { Util.logger.sysLog(2, this.getClass().getName(), "options: " + options); _option = getParametersAsString(options); ismtadd = getString(_option, "ismtadd", ismtadd); mt1 = getString(_option, "mt1", mt1); isforwardMO = getString(_option, "mo", isforwardMO); } catch (Exception e) { Util.logger.sysLog(2, this.getClass().getName(), "Error: " + e.toString()); throw new Exception("Wrong config in options"); } /* kiem tra thue bao khach hang */ if ("SFONE".equalsIgnoreCase(msgObject.getMobileoperator())) { msgObject.setUsertext(inv_telco); msgObject.setMsgtype(2); messages.add(new MsgObject(msgObject)); return messages; } // lay so thue bao nguoi gui String userid = msgObject.getUserid(); /* lay noi dung gui */ String userText = replaceAllWhiteWithOne(msgObject.getUsertext()); String[] sTokens = replaceAllWhiteWithOne(userText).split(" "); Calendar cal = Calendar.getInstance(); int day = cal.get(Calendar.DATE); int month = cal.get(Calendar.MONTH) + 1; int year = cal.get(Calendar.YEAR); String date = FormatNumber(day) + "/" + FormatNumber(month) + "/" + year; String mt2 = "Tang ban 3 game online HOT nhat hien nay.DTHT 1900571566:http://s.mobinet.vn/d/list_gf.htm"; if (sTokens.length == 1) { msgObject.setUsertext( "Cam on ban da su dung dich vu.Yeu cau cua ban chua hop le, ban vui long kiem tra lai cu phap hoac lien he tong dai 1900571566 de duoc huong dan su dung dich vu."); msgObject.setMsgtype(1); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); msgObject.setUsertext(mt2); msgObject.setMsgtype(0); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); return null; } else { String nick = ""; if (sTokens[1].length() > 20) { msgObject.setUsertext( "Nick ban dang ky khong hop le. Vui long chon nick khac hoac goi 1900571566 de duoc huong dan chi tiet."); msgObject.setMsgtype(1); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); } else { nick = Getnickbysdt(msgObject.getUserid()); if (!nick.equalsIgnoreCase("")) { msgObject.setUsertext( "SDT nay da dky nick " + nick + " tren HNS. De huy nick, soan: HUYN gui 8151. DTHT: 1900571566"); msgObject.setMsgtype(1); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); } else { nick = Checknick(sTokens[1]); if (!nick.equalsIgnoreCase("")) { msgObject.setUsertext( "Nick ban chon da co nguoi su dung. Vui long chon nick khac. Chuc ban co nhung giay phut vui ve cung Hop Nhac So tu 8h - 11h hang ngay tren VTV6"); msgObject.setMsgtype(1); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); } else { msgObject.setUsertext( "Nick cua ban da chuyen sang che do cho duyet. Xin vui long cho. DTHT: 1900571566"); msgObject.setMsgtype(1); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); // insert vao bang queue savenickqueue(msgObject.getUserid(), sTokens[1], msgObject.getRequestid() + ""); } } } // mt2 msgObject.setUsertext( "Cac bai hat Hot tren iMbox:" + findListofMusic(date) + " Lien he 1900571566 de duoc ho tro"); msgObject.setMsgtype(0); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); msgObject.setUsertext( "Game Lam vuon hap dan, soi dong,thoai mai chat chit, dang ky ngay tai day:http://funzone.vn/lamvuon/sub_icom.php"); msgObject.setMsgtype(0); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); return null; } } catch (Exception e) { Util.logger.sysLog(2, this.getClass().getName(), "Exception:" + e.getMessage()); return null; } finally { if ("1".equalsIgnoreCase(ismtadd)) ExecuteADVCR.add2queueADV( msgObject.getMsgtype(), msgObject.getServiceid(), msgObject.getUserid(), msgObject.getKeyword(), msgObject.getRequestid(), msgObject.getTTimes(), msgObject.getMobileoperator()); } }
@Override protected Collection getMessages(MsgObject msgObject, Keyword keyword) throws Exception { HashMap _option = new HashMap(); String options = keyword.getOptions(); Collection messages = new ArrayList(); String dtbase = "gateway"; String operator = msgObject.getMobileoperator(); try { Util.logger.sysLog(2, this.getClass().getName(), "options: " + options); _option = getParametersAsString(options); dtbase = getString(_option, "dtbase", dtbase); String info = msgObject.getUsertext(); String mt = ""; mt = getContent(info); if (!mt.equalsIgnoreCase("")) { String[] mtsplit = mt.split("###"); String total = ""; String index = ""; String ismore = ""; int intindex = 0; for (int j = 0; j < mtsplit.length; j++) { if (!"".equalsIgnoreCase(mtsplit[j])) { msgObject.setUsertext(mtsplit[j]); if (j == 0) { msgObject.setMsgtype(1); } else msgObject.setMsgtype(0); msgObject.setContenttype(0); total = mtsplit.length + ""; intindex = j + 1; index = intindex + ""; if (j == mtsplit.length - 1) { ismore = 0 + ""; } else ismore = 1 + ""; DBUtil.sendMT(msgObject); Thread.sleep(1000); } } } else { msgObject.setUsertext("Ban nhan tin sai cu phap. DTHT 1900571566"); msgObject.setMsgtype(1); msgObject.setContenttype(0); DBUtil.sendMT(msgObject); Thread.sleep(1000); } return null; } catch (Exception e) { Util.logger.sysLog(2, this.getClass().getName(), "Exception: " + e.getMessage()); return null; } finally { ExecuteADVCR.add2queueADV( msgObject.getMsgtype(), msgObject.getServiceid(), msgObject.getUserid(), msgObject.getKeyword(), msgObject.getRequestid(), msgObject.getTTimes(), msgObject.getMobileoperator()); } }