⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sagstdloc.java

📁 中国移动定位引擎的客户端
💻 JAVA
字号:
/**
* <p>Title: 小区推送LBP项目</p>
* <p>Description:
*   此类组织ISAG需要的参数,然后调用WSDL生成的Client代码,处理路由表,流量控制
* </p>
* <p>Copyright: 2008 福建福富软件技术股份有限公司 </p>
* <p>Company: 福建福富软件技术股份有限公司</p> 
* @author chenxin
* @version v1.0
*/
package ffcs.lbp.SagClient;

import java.util.Iterator;
import java.util.List;
import java.util.Vector;

import cn.com.chinatelecom.schema.ctcc.common.v2_1.ServiceError;
import cn.com.chinatelecom.schema.ctcc.terminal_location.v2_1.LocationData;
import cn.com.chinatelecom.schema.ctcc.terminal_location.v2_1.LocationInfo;
import cn.com.chinatelecom.schema.ctcc.terminal_location.v2_1.RetrievalStatus;
import cn.com.chinatelecom.wsdl.ctcc.terminal_location.v2_1.service.TerminalLocation;
import cn.com.chinatelecom.wsdl.ctcc.terminal_location.v2_1.service.TerminalLocationServiceClient;
import ffcs.config.Config;
import ffcs.config.Module;
import ffcs.lbp.common.LeResult;
import ffcs.lbp.dao.LCS;
import ffcs.lbp.dao.RouteDAO;
import ffcs.lbp.le.LocPrefixIOProcess;
import ffcs.lbp.le.message.LocReport;
import ffcs.lbp.le.message.UserTrig;
import ffcs.lbp.le.message.tlv.TLVTable;
import ffcs.logging.Log;
import ffcs.logging.LogFactory;

public class SagStdLoc {
	private TLVTable Isdn=null;
	private int AcceptableAccuracy;
	private int RequestedAccuracy;
	private static Log log = LogFactory.getLog(SagStdLoc.class);
	public SagStdLoc() {
		readConfig();    
	}
	public SagStdLoc(UserTrig stdloc){//TLVTable isdnrange,int interval,long  starttime,long  stoptime,int duration) {
		this.Isdn=stdloc.getIsdn();
	   }
	  public void bulidSagCycLoc() throws Exception
	    {
		  //构造要定位的号码,以List表示一个个真实的号码
		  Iterator   msids  = Isdn.values().iterator();//get(Tag.IsdnRange);
		  List<String> Isdns =new   Vector<String>(); 
		  while(msids.hasNext()){
			  Isdns.add((String)msids.next());
		  }
		  RouteDAO route=new RouteDAO();
		  //输入一组号码List,返回一组LCS List 其中每个LCS对象,都包含了要发送的号码组,URL等信息
//		  List<LCS> lcs_list=route.getLCSforStdLoc(Isdns);
		  //如果用循环做,就太慢了,而且发往其他服务器的,没必要等这个服务器调用完毕
		  
    	

	    } 
	
	
	
	
	
	
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
try{
	SagStdLoc tt=new SagStdLoc();
}catch (Exception e){
	e.printStackTrace();
}
	}
	
	
	
	

		public void readConfig() {
			try {
				Module module = Config.getInstance().getModule("SAG_CLIENT");
			    RequestedAccuracy = Integer.parseInt(module.getProperties("RequestedAccuracy"));
			    AcceptableAccuracy = Integer.parseInt(module.getProperties("AcceptableAccuracy"));
			} catch (Exception e) {
				log.error("读配置文件出错", e);
				System.exit(0);
			}
		}
		/**调用WebService接口
		 * @param List<LCS>
		 * @return send_succ 成功true,失败false
		 */
		class   useWSDLClient   extends   Thread   {         

	        private LCS lcs_object;
	     public useWSDLClient(LCS lcs){
	    	 this.lcs_object=lcs;
	     }
			public LCS getLcs_object() {
				return lcs_object;
			}

			public void setLcs_object(LCS lcs_object) {
				this.lcs_object = lcs_object;
			}

			public   void   run()   {                 
	   	     //构造WebServiceClient,其中要发送至的对端实体URL,从路由表读出
		    	TerminalLocationServiceClient service = new TerminalLocationServiceClient();
		    	TerminalLocation LocCli=service.getTerminalLocation(lcs_object.getURL());
	            
		    	 List<LocationData> res_lt =  new   Vector<LocationData>(); 
//		  	参数构造完毕,调用Client
		    	try{ res_lt=LocCli.getLocationForGroup(lcs_object.getIsdnGroup(), RequestedAccuracy, AcceptableAccuracy);
		    		    	}catch (Exception e){
		    		    		log.error("ISAG进行标准定位时,发生错误:"+lcs_object.toString());
		    		    	}
		    		    
		      for(int j=0;j<res_lt.size();j++){
		    	  LocationData resLocData=res_lt.get(j);
		    	  RetrievalStatus ret_stat=resLocData.getReportStatus();
		    	  LocationInfo loc_info= resLocData.getCurrentLocation();
		  		LocReport std_loc_rpt=new LocReport();
		    	  switch(ret_stat){
		    	  case   RETRIEVED	:
		  	    	break;
		    	  case   NOT_RETRIEVED	:
			  	    	break;
		    	  case  ERROR	:
		    		  ServiceError  sv_err=resLocData.getErrorInformation();
		    		  int err_msgId=new Integer(sv_err.getMessageId()).intValue();
		    		  String err_text=sv_err.getText();
//		    		 List<String> err_list= sv_err.getVariables();
/*//		    		将得到的位置信息,放到新建的LeResult对象里
		    			LeResult leErrRs=new LeResult(loc_info.getAddress(),LeResult.Error,err_msgId,
		    					err_text);*/
		    	  
		    			std_loc_rpt.setIsdn(loc_info.getAddress());
		    			std_loc_rpt.setRetType(LeResult.Error);
		    			std_loc_rpt.setShapeType(err_msgId);
		    			//现在是组TLV结构有困难
//		    			std_loc_rpt.setShapeDesc(new TLVTable(err_text);
		    			
		    			
			  	    	break;
		    	  default:
		    		
		/*    	  		//将得到的位置信息,放到新建的LeResult对象里
		    	  	  LeResult leRs=new LeResult(loc_info.getAddress(),LeResult.Shape,LeResult.Round,
		    	  				loc_info.getLongitude()+","+loc_info.getLatitude()+","+loc_info.getAccuracy());*/
		    	   
	    			std_loc_rpt.setIsdn(loc_info.getAddress());
	    			std_loc_rpt.setRetType(LeResult.Shape);
	    			std_loc_rpt.setShapeType(LeResult.Round);
//	    			std_loc_rpt.setShapeDesc(loc_info.getLongitude()+","+loc_info.getLatitude()+","+loc_info.getAccuracy());
	    			
		    	 
		    	  }
//		    	查找路由表,得到位置信息管理模块的server_id
		    	  RouteDAO rtdao=new RouteDAO();
	    			int svr_id=rtdao.routeBack(loc_info.getAddress());
	    			LocPrefixIOProcess  LcPrFCon=new LocPrefixIOProcess();
	    			//调用IOProcess的发包操作
	    			LcPrFCon.sendToLocInfoMgr(std_loc_rpt, new Integer(svr_id).intValue());
		      } 
	        } 
	} 



}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -