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

📄 urlfromdatabaseimpl.java

📁 本系统实现了从五个网站上搜索的图书进行整合后
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		}
		if (!"null".equals(list.get(3))) {
			publisher = list.get(3).replace("20%", "+");
		} 
		if (!"null".equals(list.get(4))) {
			publishUpYear = list.get(4).replace("20%", "+");
			
		} 
		if (!"null".equals(list.get(5))) {
			publishUpmonth = list.get(5).replace("20%", "+");

		} 
		if (!"null".equals(list.get(6))) {
			publishDoanYear = list.get(6).replace("20%", "+");
		} 
		if (!"null".equals(list.get(7))) {
			publishDoanMonth = list.get(7).replace("20%", "+");
		} 
		if (!"null".equals(list.get(8))) {
			minprice = list.get(8).replace("20%", "+");
		} 
		if (!"null".equals(list.get(9))) {
			maxprice = list.get(9).replace("20%", "+");
		} 

		List advList = this.urlLoadDao.loadUrl();
		Iterator it = advList.iterator();
		/* 迭代advList,构建url并放到静态urlmap中 */
		while (it.hasNext()) {

			Url url = (Url) it.next();

			if ("dangdang".equals(url.getWebname())) {
                
              	String temKeyword = "";
    			if(name.indexOf(" ")!=-1){				
    				
    				for(int i=0;i<strList.size();i++){
    					temKeyword += URLEncoder.encode(strList.get(i), "gbk") + "+";
    				}
    			    temKeyword = temKeyword.substring(0, temKeyword.length() - 1);
    			}else{
    				temKeyword = URLEncoder.encode(name, "gbk");
    			}
				if (("null".equals(list.get(6).trim()))
						&& ("null".equals(list.get(7).trim()))
						&& ("null".equals(list.get(8).trim()))
						&& ("null".equals(list.get(9).trim()))) {
					fullAdvURL = url.getWebsite() + url.getAdvancedPage()
						       + "?" + url.getBookName() + "=" + temKeyword
							   + "&" + url.getBookAuthor() + "=" + URLEncoder.encode(author, "gbk")
							   + "&" + url.getBookPublisher() + "=" + URLEncoder.encode(publisher, "gbk")
							   + "&" + url.getBookISBN() + "=" + ISBN + "&rebate_rang=lall"
							   + "&" + url.getMinPrice() + "=" + minprice 
							   + "&" + url.getMaxPrice() + "=" + maxprice
							   + "&" + url.getPublishDownYear()+ "=" + URLEncoder.encode("选择年", "gbk")
							   + "&" + url.getPublishDownMonth() + "=" + URLEncoder.encode("月", "gbk")+ "&sd=1"
							   + "&begin_date=" 
							   + "&" + url.getPublishUpYear() + "=" + URLEncoder.encode("选择年", "gbk") 
							   + "&" + url.getPublishUpMonth() + "=" + URLEncoder.encode("月", "gbk") + "&ed=1"
							   + "&end_date=";
				} else {
	
					fullAdvURL = url.getWebsite() + url.getAdvancedPage() 
					           + "?" + url.getBookName() + "=" + temKeyword
					           + "&" + url.getBookAuthor() + "=" + URLEncoder.encode(author, "gbk")
				               + "&" + url.getBookPublisher() + "=" + URLEncoder.encode(publisher, "gbk")
					           + "&" + url.getBookISBN() + "=" + ISBN + "&rebate_rang=lall"
					           + "&" + url.getMinPrice() + "=" + minprice 
				               + "&" + url.getMaxPrice() + "=" + maxprice
					           + "&" + url.getPublishDownYear()+ "=" + publishDoanYear
					           + "&" + url.getPublishDownMonth() + "=" + publishDoanMonth+ "&sd=1"
					           + "&begin_date=" + publishDoanYear + publishDoanMonth + "01"
					           + "&" + url.getPublishUpYear() + "=" + publishUpYear 
					           + "&" + url.getPublishUpMonth() + "=" + publishUpmonth + "&ed=1"
					           + "&end_date=" + publishUpYear + publishUpmonth + "01";

				}
				System.out.println(fullAdvURL);
			}

			if ("tsinghua".equals(url.getWebname())&&(publisher.indexOf("清华")!=-1||"".equals(publisher))) {
				
                  if("".equals(publishUpYear)&&"".equals(publishUpmonth)
                		  &&"".equals(publishDoanYear)&&"".equals(publishDoanMonth)
                		  &&"".equals(maxprice)&&"".equals(minprice)&&name.indexOf(" ")==-1){		
       
					   fullAdvURL = url.getWebsite() + url.getAdvancedPage()
					              + "?" + url.getBookName() + "=" + URLEncoder.encode(name, "gbk")
							      + "&" + url.getBookISBN() + "=" + ISBN
							      + "&BMDM=0" + "&" + url.getBookAuthor() + "=" +URLEncoder.encode(author, "gbk")
							      + "&c=1";
					   System.out.println(fullAdvURL);
                  }
                  
			}
			if ("zhuoyue".equals(url.getWebname())) {
                
            	String temKeyword = "";
    			if(name.indexOf(" ")!=-1){				
    				
    				for(int i=0;i<strList.size();i++){
    					temKeyword += URLEncoder.encode(strList.get(i), "utf-8") + "+";
    				}
    			    temKeyword = temKeyword.substring(0, temKeyword.length() - 1);
    			}else{
    				temKeyword = URLEncoder.encode(name, "utf-8");
    			}
				fullAdvURL = url.getWebsite() + url.getAdvancedPage()
						+ "?type=book" 
						+ "&" + url.getBookName() + "=" + temKeyword
						+ "&" + url.getBookAuthor() + "=" + URLEncoder.encode(author, "utf-8")
						+ "&" + url.getBookPublisher() + "=" + URLEncoder.encode(publisher, "utf-8")
						+ "&" + url.getBookISBN() + "=" + ISBN 
						+ "&browse_node=" 
						+ "&" + url.getMinPrice() + "=" + minprice
						+ "&" + url.getMinPrice() + "=" + maxprice
						+ "&list_price_up=&list_price_down=&discount="
						+ "&" + url.getPublishDownYear() + "=" + publishDoanYear
						+ "&" + url.getPublishDownMonth() + "=" + publishDoanMonth
						+ "&" + url.getPublishUpYear() + "=" + publishUpYear
						+ "&" + url.getPublishUpMonth() + "=" + publishUpmonth;
				System.out.println(fullAdvURL);

			}
			if ("china_pub".equals(url.getWebname())) {
                if("".equals(publishUpYear)&&"".equals(publishUpmonth)
              		  &&"".equals(publishDoanYear)&&"".equals(publishDoanMonth)
              		  &&"".equals(maxprice)&&"".equals(minprice)){
                	
                	String temKeyword = "";
        			if(name.indexOf(" ")!=-1){				
        				
        				for(int i=0;i<strList.size();i++){
        					temKeyword += URLEncoder.encode(strList.get(i), "gbk") + "+";
        				}
        			    temKeyword = temKeyword.substring(0, temKeyword.length() - 1);
        			}else{
        				temKeyword = URLEncoder.encode(name, "gbk");
        			}
				    fullAdvURL = url.getWebsite() + url.getAdvancedPage()
						+ "?type=&ref=&tid=0" 
						+ "&" + url.getBookName() + "=" + temKeyword 
						+ url.getBookAuthor() + URLEncoder.encode(author, "gbk") 
						+ url.getBookPublisher() + URLEncoder.encode(publisher, "gbk")
						+ url.getBookISBN() + ISBN;
                }
                System.out.println(fullAdvURL);
			}
			if ("chinabook".equals(url.getWebname())) {
				if("".equals(maxprice)&&"".equals(minprice)){
					
                	String temKeyword = "";
        			if(name.indexOf(" ")!=-1){				
        				
        				for(int i=0;i<strList.size();i++){
        					temKeyword += URLEncoder.encode(strList.get(i), "gbk") + "+";
        				}
        			    temKeyword = temKeyword.substring(0, temKeyword.length() - 1);
        			}else{
        				temKeyword = URLEncoder.encode(name, "gbk");
        			}
					if (("null".equals(list.get(5).trim()))
							&& ("null".equals(list.get(6).trim()))
							&& ("null".equals(list.get(7).trim()))
							&& ("null".equals(list.get(8).trim()))) {
						fullAdvURL = url.getWebsite() + "bookFindResult.aspx"
								+ "?" + url.getBookName() + "=" + temKeyword
								+ "&" + url.getBookAuthor() + "=" + URLEncoder.encode(author, "gbk")
								+ "&" + url.getBookPublisher() + "=" + URLEncoder.encode(publisher, "gbk")
								+ "&startdate=" + "&enddate=";
					} else {
						fullAdvURL = url.getWebsite() + url.getAdvancedPage()
						+ "?" + url.getBookName() + "=" + temKeyword
						+ "&" + url.getBookAuthor() + "=" + URLEncoder.encode(author, "gbk")
						+ "&" + url.getBookPublisher() + "=" + URLEncoder.encode(publisher, "gbk")
						+ "&" + url.getPublishDownYear() + "=" + publishDoanYear 
						+ "-" + publishDoanMonth + "-1" 
						+ "&" + url.getPublishUpYear() + "=" + publishUpYear
						+ "-" + publishUpmonth + "-1";
					}
				}
				System.out.println(fullAdvURL);
			}
			if ("weilan".equals(url.getWebname())) {
            	String temKeyword = "";
    			if(name.indexOf(" ")!=-1){				
    				
    				for(int i=0;i<strList.size();i++){
    					temKeyword += URLEncoder.encode(strList.get(i), "utf-8") + "+";
    				}
    			    temKeyword = temKeyword.substring(0, temKeyword.length() - 1);
    			}else{
    				temKeyword = URLEncoder.encode(name, "utf-8");
    			}
				fullAdvURL = url.getWebsite() + url.getAdvancedPage()
						+ "?producttype=1&ProductId="
						+ "&" + url.getBookName() + "=" + temKeyword
						+ "&" + url.getBookAuthor() + "=" + URLEncoder.encode(author, "utf-8")
						+ "&" + url.getBookPublisher() + "=" + URLEncoder.encode(publisher, "utf-8")
						+ "&" + url.getBookISBN() + "=" + ISBN
						+ "&mindiscount=&maxdiscount=" 
						+ "&" + url.getMinPrice() + "=" + minprice
						+ "&" + url.getMaxPrice() + "=" +  maxprice
						+ "&minprice=&maxprice=&mindiscount=0&maxdiscount=0"
						+ "&" + url.getPublishDownYear() + "=" + publishDoanYear + publishDoanMonth
						+ "&" + url.getPublishDownYear() + "=" + publishUpYear + publishUpmonth;
				System.out.println(fullAdvURL);
			}

			advUrlMap.put(url.getWebname(), fullAdvURL);
			//System.out.println(advUrlMap.get(url.getWebname()));
		}

		return advUrlMap;

	}


}

⌨️ 快捷键说明

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