dongyuan二期修改

zhangjiang大厦新增
This commit is contained in:
qwsun
2016-01-06 14:11:57 +08:00
parent 9b40bb35c9
commit c12d3ab7e2
9 changed files with 125 additions and 11 deletions

View File

@ -36,7 +36,7 @@
function searchSuggest()
{
searchReq.open("POST", 'jqueryEZParkingStatus', true);
searchReq.open("POST", 'jqueryEZParkingStatus?location=dongyuan', true);
searchReq.onreadystatechange = handleEZParkingStatus;
searchReq.send(null);
}
@ -49,7 +49,6 @@
for (var i = 0; i <= str.length - 1; i++)
{
alert(str[i])
var parkingIdStatus = str[i].split("_");
if(parkingIdStatus[1] == "1")

View File

@ -81,6 +81,8 @@
<button type="button" onClick="updateStatus()">Update</button>
<br/><br/>
<img src="position.jpg" width="600" height="700" />
<br/><br/>
<img src="zhangjiang.png" />
</div>

View File

@ -0,0 +1,97 @@
<HTML>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>EZParking</title>
<script language="JavaScript" type="text/javascript">
var searchReq = createAjaxObj();
function createAjaxObj()
{
var httprequest = false;
if (window.XMLHttpRequest)
{
httprequest = new XMLHttpRequest()
if (httprequest.overrideMimeType)
httprequest.overrideMimeType('text/xml')
}
else if (window.ActiveXObject)
{
try
{
httprequest = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httprequest = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
}
}
}
return httprequest
}
function searchSuggest()
{
searchReq.open("POST", 'jqueryEZParkingStatus?location=zhangjiang', true);
searchReq.onreadystatechange = handleEZParkingStatus;
searchReq.send(null);
}
function handleEZParkingStatus()
{
if (searchReq.readyState == 4)
{
var str = searchReq.responseText.split(",");
for (var i = 0; i <= str.length - 1; i++)
{
var parkingIdStatus = str[i].split("_");
if(parkingIdStatus[1] == "1")
{
document.getElementById("position"+parkingIdStatus[0]).style.backgroundImage = "url(car.png)";
}
if(parkingIdStatus[1] == "0")
{
document.getElementById("position"+parkingIdStatus[0]).style.background = "transparent";
}
}
}
}
setInterval("searchSuggest()",60000);
</script>
</head>
<Body>
<p>张江大厦停车位地图</p>
<div>
<div id="position506976" style="background:transparent;width:61px;height:29px;position:absolute;left:36px;top:74px"></div>
<div id="position506975" style="background:transparent;width:61px;height:29px;position:absolute;left:100px;top:74px"></div>
<div id="position506974" style="background:transparent;width:61px;height:29px;position:absolute;left:163px;top:74px"></div>
<div id="position506973" style="background:transparent;width:61px;height:29px;position:absolute;left:227px;top:74px"></div>
<div id="position506972" style="background:transparent;width:60px;height:29px;position:absolute;left:291px;top:74px"></div>
<div id="position506971" style="background:transparent;width:60px;height:29px;position:absolute;left:354px;top:74px"></div>
<div id="position506970" style="background:transparent;width:60px;height:29px;position:absolute;left:418px;top:74px"></div>
<div id="position506969" style="background:transparent;width:60px;height:29px;position:absolute;left:482px;top:74px"></div>
<div id="position506968" style="background:transparent;width:60px;height:29px;position:absolute;left:794px;top:74px"></div>
<div id="position506967" style="background:transparent;width:60px;height:29px;position:absolute;left:857px;top:74px"></div>
<div id="position506966" style="background:transparent;width:60px;height:29px;position:absolute;left:920px;top:74px"></div>
<div id="position506965" style="background:transparent;width:60px;height:29px;position:absolute;left:983px;top:74px"></div>
<div id="position506964" style="background:transparent;width:60px;height:29px;position:absolute;left:1046px;top:74px"></div>
<div id="position506963" style="background:transparent;width:60px;height:29px;position:absolute;left:1109px;top:74px"></div>
<div id="position506962" style="background:transparent;width:60px;height:29px;position:absolute;left:1172px;top:74px"></div>
<div id="position506961" style="background:transparent;width:60px;height:29px;position:absolute;left:1235px;top:74px"></div>
</div>
<div class="div">
<img src="zhangjiang.png" border="0" usemap="#zhangjiangmap" alt="Parking" />
<map name="zhangjiangmap" id="zhangjiangmap"></map>
</div>
</Body>
</HTML>

BIN
WebContent/car.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
WebContent/zhangjiang.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -40,7 +40,14 @@ public class EZParkingMap extends HttpServlet
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
String path=req.getContextPath();
req.getRequestDispatcher("WEB-INF/pages/parking.html").forward(req, resp);
String location=req.getParameter("location");
if(("dongyuan").equals(location))
{
req.getRequestDispatcher("WEB-INF/pages/parking.html").forward(req, resp);
}
if(("zhangjiang").equals(location))
{
req.getRequestDispatcher("WEB-INF/pages/zhangjiang.html").forward(req, resp);
}
}
}

View File

@ -32,11 +32,13 @@ public class EZParkingStatusServlet extends HttpServlet
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
String location = req.getParameter("location");
GPRSService service = new GPRSService();
List<TblModule> tblList = new ArrayList<TblModule>();
StringBuffer tblIds = new StringBuffer();
tblList = service.listTblModule();
tblList = service.listTblModule(location);
for(TblModule tbl : tblList)
{
tblIds.append(tbl.getId()+"_"+tbl.getStatus()+",");

View File

@ -26,8 +26,8 @@ public class GPRSDBUtil
{
Class.forName("org.postgresql.Driver");
String url = "jdbc:postgresql://121.41.88.171:5432/ParkDevice";
conn = DriverManager.getConnection(url, "postgres", "Abcd1234");
String url = "jdbc:postgresql://139.196.106.197:5432/ParkDevice";
conn = DriverManager.getConnection(url, "postgres", "root");
}
}

View File

@ -134,12 +134,19 @@ public class GPRSService
return modelList;
}
public List<TblModule> listTblModule()
{
public List<TblModule> listTblModule(String location)
{
Connection conn = GPRSDBUtil.getConn();
StringBuffer sqlBuffer = new StringBuffer(
"SELECT * FROM \"tbl_Module\" ORDER BY \"UDT\" desc");
StringBuffer sqlBuffer = new StringBuffer();
if(("dongyuan").equals(location))
{
sqlBuffer.append("SELECT * FROM \"tbl_Module\" WHERE \"ID\" < 506900 ORDER BY \"UDT\" desc");
}
if(("zhangjiang").equals(location))
{
sqlBuffer.append("SELECT * FROM \"tbl_Module\" WHERE \"ID\" >= 506900 ORDER BY \"UDT\" desc");
}
List<TblModule> moduleList = new ArrayList<TblModule>();
PreparedStatement pstmt = GPRSDBUtil.getPreparedStatement(conn, sqlBuffer.toString());