<%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*,java.util.*,java.text.SimpleDateFormat,com.bmtech.utils.tcp.*, com.qianlima.zhaobiao.se.search.*"%> <%@ include file="conn.jsp"%> <%@ include file="checklogin.jsp"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ include file="sub.jsp"%> <%@page import="com.google.gson.Gson"%> <%@ include file="pageUtil.jsp"%> <%@ page import="java.sql.*,java.util.*,java.text.SimpleDateFormat"%> <%@ page import="java.net.*,java.io.*"%> <%@ include file="searchSolrList.jsp"%> <% int areaId=intshuzi(request.getParameter("areaId"), 0); int pageNo=intshuzi(request.getParameter("pageNo"), 1); List ids =new ArrayList(); String name=getAreaByName(conn, areaId); if(name==null){ response.setStatus(404); out.println("404 not found"); conn.close(); return; } Integer pageSize=10; try{ // TransResult tr=zhureload(name+"政府采购网",pageNo,pageSize); // ids= tr.ids; String datetype=""; String types=""; String sort="updatetime desc"; Integer filtermode=1; String beginTime=""; String endTime=""; Integer isprecise=0; String areas=""; SearchResult result = getSolrIds(name+"政府采购网", pageSize, pageNo, sort, filtermode, datetype, beginTime, endTime, isprecise, areas, types); if(result !=null){ List list = result.getResults(); if(list.size()>0){ for(Product product:list){ ids.add(Integer.parseInt(product.getId())); } } } List> showList=getShowList(conn, ids); int total=(int)result.getRowCount(); if(total>500){ total=500; } String areaUrl=null; if(areaId<10&&areaId>=0){ areaUrl="000"+areaId; }else if(areaId<100&&areaId>=10){ areaUrl="00"+areaId; }else if(areaId<1000&&areaId>=100){ areaUrl="0"+areaId; }else if(areaId<10000&&areaId>=1000){ areaUrl=""+areaId; } String jp=getSkiplist(conn, areaId); String herf="/zc/"+areaUrl+"/"; pageContext.setAttribute("showList", showList); PageUtil pageUtil=new PageUtil(total, pageNo, pageSize,10); pageContext.setAttribute("page", pageUtil); pageContext.setAttribute("name", name); pageContext.setAttribute("herf", herf); pageContext.setAttribute("jp", jp); pageContext.setAttribute("areaUrl", areaUrl); pageContext.setAttribute("parea", name); }catch(Exception e){ e.printStackTrace(); } finally{ if(conn!=null){ try{ conn.close(); } catch(Exception e){} } } %> ${name}政府采购网_${name}政府采购中心 <%@ include file="wap_tongji.jsp"%>
<%@ include file="fenzhan.jsp"%>
全面跟踪 "${name}政府采购网" 招标项目
<%! public List> getShowList(Connection conn,List ids)throws Exception{ List> showList=new ArrayList>(); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); for(Integer contentid:ids){ PreparedStatement ps=conn.prepareStatement("select title,url,updatetime from phpcms_content where contentid=? and status=99"); ps.setInt(1, contentid); ResultSet rs=ps.executeQuery(); if(rs.next()){ Map map=new HashMap(); map.put("title",jiequ(rs.getString("title"), 90)); map.put("url",rs.getString("url").replace("www.qianlima.com","wap.qianlima.com")); map.put("updatetime", sdf.format(new java.util.Date(rs.getInt("updatetime")*1000L))); showList.add(map); } } return showList; } public String jiequ(String str,int num){ String reString=""; int k=0; char[] a=str.toCharArray(); for(int i=0;ik;i++){ String s1 = String.valueOf(a[i]); //获取字符串数组中的字符并转换成String型 byte[] getBytes = s1.getBytes(); //字符串数组中的字符串以字节数组的形式存储 if(getBytes.length==2){ //为了应付题目,把一个汉字当做2个字节 k += getBytes.length-1; }else{ k += getBytes.length; } if(k<=num){ //处理如:"a我",2的情况,只输出"a",而不是"a我" reString += a[i]; } } if(reString.equals(str)){ return str; }else{ return reString+"..."; } } public TransResult zhureload(String word,int pageNo,int pageSize)throws Exception{ int offset=(pageNo-1)*pageSize; TransQuerys tq = new TransQuerys(1001, offset, pageSize); QueryEntry qe = new QueryEntry(0); qe.addRawKeywords(word.toLowerCase()); tq.add(qe); TCPLink.QueryTo qt =new TCPLink.QueryTo("192.168.1.202",45001); TransResult res = TCPLink.getQueryResult(tq,qt); return res; } public List> getSjList(Connection conn,int sid)throws Exception{ List> sjList=new ArrayList>(); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); int sjid=buildRandom(3); PreparedStatement ps=conn.prepareStatement("SELECT title,url,updatetime,contentid FROM phpcms_content WHERE STATUS=99 ORDER BY updatetime DESC LIMIT "+sjid+","+sid); ResultSet rs=ps.executeQuery(); while(rs.next()){ Map map=new HashMap(); map.put("title",jiequ(rs.getString("title"), 90)); map.put("url",rs.getString("url").replace("www.qianlima.com","wap.qianlima.com")); map.put("updatetime", sdf.format(new java.util.Date(rs.getInt("updatetime")*1000L))); sjList.add(map); } return sjList; } public static int buildRandom(int length) { int num = 1; double random = Math.random(); if (random < 0.1) { random = random + 0.1; } for (int i = 0; i < length; i++) { num = num * 10; } return (int) ((random * num)); } public String getAreaByName(Connection conn,int area)throws Exception{ String sql="select name from zdy_area_new where areaid=? and child!=0"; PreparedStatement ps=conn.prepareStatement(sql); ps.setInt(1, area); ResultSet rs=ps.executeQuery(); if(rs.next()){ String starea=rs.getString(1); return starea; } return null; } public String getSkiplist(Connection conn,int areaid)throws Exception{ String sql="select jp from zdy_area_jp where areaid=? and sid=1"; PreparedStatement ps=conn.prepareStatement(sql); ps.setInt(1, areaid); ResultSet rs=ps.executeQuery(); if(rs.next()){ String jp=rs.getString("jp"); return jp; } return null; } %>