本地的手机号码归属地查询-oracle数据
生活随笔
收集整理的這篇文章主要介紹了
本地的手机号码归属地查询-oracle数据
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
最近做的項(xiàng)目中,有個(gè)功能是手機(jī)歸屬地查詢,因?yàn)轫?xiàng)目要在內(nèi)網(wǎng)下運(yùn)行,所以不能用提供的webservice,只好在網(wǎng)上找手機(jī)歸屬地的數(shù)據(jù),很多都是access的,我們的項(xiàng)目是用oracle,只好自己轉(zhuǎn)吧,轉(zhuǎn)過來(lái)的提供到網(wǎng)上,方便大家使用。數(shù)據(jù)還是比較新的,是2014年的。
下面是部分代碼,如果需要全部代碼,可以直接下載。
TabMobileServiceImpl.java
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | packagecom.zhouyu.service.impl; importjava.util.List; importorg.springframework.beans.factory.annotation.Autowired; importorg.springframework.stereotype.Service; importcom.zhouyu.dao.BaseDaoI; importcom.zhouyu.model.TabMobile; importcom.zhouyu.service.TabMobileServiceI; @Service("tabMobileService") publicclassTabMobileServiceImpl implementsTabMobileServiceI { ????privateBaseDaoI<TabMobile> tabMobileDao; ????@Autowired ????publicvoidsetTabMobileDao(BaseDaoI<TabMobile> tabMobileDao) ????{ ????????this.tabMobileDao = tabMobileDao; ????} ????@Override ????publicString getMobileArea(Long mobileNumber) ????{ ????????// TODO Auto-generated method stub ????????String area = ""; ????????String hql = "from TabMobile m where m.mobileNumber = '"+mobileNumber+"'"; ????????List<TabMobile> list = tabMobileDao.find(hql); ????????if(list.size()>0) ????????{ ????????????area = list.get(0).getMobileArea() + "? --? "+ list.get(0).getMobileType(); ????????} ????????returnarea; ????} } |
MobileAction.java
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | packagecom.zhouyu.action; importorg.apache.struts2.convention.annotation.Action; importorg.apache.struts2.convention.annotation.Result; importorg.springframework.beans.factory.annotation.Autowired; importcom.opensymphony.xwork2.ModelDriven; importcom.zhouyu.pageModel.Mobile; importcom.zhouyu.service.TabMobileServiceI; @Action(value = "mobileAction", results = { @Result(name = "goMobile", location = "/wnl/mobile.jsp")}) publicclassMobileAction extendsBaseAction implementsModelDriven<Mobile> { ????privateMobile mobile = newMobile(); ????privateTabMobileServiceI tabMobileService; ????@Autowired ????publicvoidsetTabMobileService(TabMobileServiceI tabMobileService) ????{ ????????this.tabMobileService = tabMobileService; ????} ????@Override ????publicMobile getModel() ????{ ????????// TODO Auto-generated method stub ????????returnmobile; ????} ????? ????publicString goMobile() ????{ ????????return"goMobile"; ????} ????? ????publicvoidgetArea() throwsException ????{ ????????String area = tabMobileService.getMobileArea(mobile.getMobileNumber()); ????????super.writeJson(area); ????} } |
mobile.jsp
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | <%@ page contentType="text/html; charset=utf-8"%> <!DOCTYPE html> <html> <head> <jsp:include page="../inc.jsp"></jsp:include> <style type="text/css"> .input { ????width: 260px; ????height: 30px; ????font-size: 28px; ????text-align:center; ????border-top: 1px solid #404040; ????border-left: 1px solid #404040; ????border-right: 1px solid #D4D0C8; ????border-bottom: 1px solid #D4D0C8; } .STYLE1 { ????font-size: 36px; ????color: #FF0000; } </style> <script type="text/javascript"> document.onkeyup=function(){ ????var s = document.getElementById("dd").value; ???????????document.getElementById("a").innerHTML= s ???????????if(s.length > 11) ????????????{ ????????????????document.getElementById("a").innerHTML= "輸入的號(hào)碼超出11位"; ????????????} ????} ????function testzy(obj) ????{ ????????obj.value = obj.value.replace(/[^\d.]/g,""); ????????var d = $('#dd').val(); ????????if(d.length == 7) ????????{ ????????????$.ajax({ ????????????????type: "POST",//使用get方法訪問后臺(tái)或者post ????????????????dataType: "json",//返回json格式的數(shù)據(jù) ????????????????url: "mobileAction!getArea.action?mobileNumber="+d,//要訪問的后臺(tái)地址 ????????????????contentType: "application/x-www-form-urlencoded; charset=utf-8", ????????????????success: function(data){//成功時(shí)會(huì)允許下面的函數(shù),data為返回的數(shù)據(jù),為數(shù)組類型 ????????????????????$("#cc").html(data); ????????????????} ????????????}); ????????} ????????if(d.length >7&& d.length <=11) ????????{ ????????????var str = d.substr(0,7); ????????????$.ajax({ ????????????????type: "POST",//使用get方法訪問后臺(tái)或者post ????????????????dataType: "json",//返回json格式的數(shù)據(jù) ????????????????url: "mobileAction!getArea.action?mobileNumber="+str,//要訪問的后臺(tái)地址 ????????????????contentType: "application/x-www-form-urlencoded; charset=utf-8", ????????????????success: function(data){//成功時(shí)會(huì)允許下面的函數(shù),data為返回的數(shù)據(jù),為數(shù)組類型 ????????????????????$("#cc").html(data); ????????????????} ????????????}); ????????} ????????if(d.length > 11) ????????{ ????????????document.getElementById("a").innerHTML= "輸入的號(hào)碼超出11位"; ????????} ????} ????? ????function aaa() ????{ ????????$("#dd").val(''); ????} </script> </head> ??? <body> ????<h2>手機(jī)號(hào)碼歸屬地查詢</h2> ????<input type="text"id="dd"class="input"onkeyup="testzy(this)"/>??? <input id="btn"type="button"value="清空"onclick="aaa()"/>??? <span id="a"class="STYLE1"></span><br /> ????<div id="cc"class="STYLE1"></div> </body> </html> |
?
全部代碼及數(shù)據(jù)庫(kù)文件請(qǐng)到這里下載
http://download.csdn.net/detail/zyaizz/8145759
總結(jié)
以上是生活随笔為你收集整理的本地的手机号码归属地查询-oracle数据的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python中list函数例题_pyth
- 下一篇: 重贴:MFC类中获得其它类指针 (转)