diff --git a/src/main/java/com/sipai/controller/jsyw/VehicleGateController.java b/src/main/java/com/sipai/controller/jsyw/VehicleGateController.java new file mode 100644 index 00000000..9bef676a --- /dev/null +++ b/src/main/java/com/sipai/controller/jsyw/VehicleGateController.java @@ -0,0 +1,114 @@ +package com.sipai.controller.jsyw; + +import net.sf.json.JSONArray; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +@Controller +@RequestMapping("/jsyw/vehicleGate") +public class VehicleGateController { + + @RequestMapping("/showList.do") + public String showList(HttpServletRequest request, Model model) { + return "/jsyw/vehicleGateList"; + } + + @RequestMapping("/getList.do") + public ModelAndView getList(HttpServletRequest request, Model model, + @RequestParam(value = "page", required = false, defaultValue = "1") Integer page, + @RequestParam(value = "rows", required = false, defaultValue = "10") Integer rows) { + String plateNo = safeStr(request.getParameter("plateNo")).toUpperCase(Locale.ROOT); + String passDate = safeStr(request.getParameter("passDate")); + String direction = safeStr(request.getParameter("direction")); + String status = safeStr(request.getParameter("status")); + + List> mockRows = buildMockRows(); + List> filteredRows = new ArrayList>(); + int inCount = 0; + int outCount = 0; + int abnormalCount = 0; + + for (Map item : mockRows) { + String itemPlateNo = safeStr(item.get("plateNo")).toUpperCase(Locale.ROOT); + String itemPassTime = safeStr(item.get("passTime")); + String itemDirection = safeStr(item.get("direction")); + String itemStatus = safeStr(item.get("status")); + + boolean matchPlate = plateNo.isEmpty() || itemPlateNo.contains(plateNo); + boolean matchDate = passDate.isEmpty() || itemPassTime.startsWith(passDate); + boolean matchDirection = direction.isEmpty() || direction.equals(itemDirection); + boolean matchStatus = status.isEmpty() || status.equals(itemStatus); + if (matchPlate && matchDate && matchDirection && matchStatus) { + filteredRows.add(item); + if ("IN".equals(itemDirection)) { + inCount++; + } else if ("OUT".equals(itemDirection)) { + outCount++; + } + if ("ABNORMAL".equals(itemStatus)) { + abnormalCount++; + } + } + } + + int total = filteredRows.size(); + int pageStart = Math.max((page - 1) * rows, 0); + int pageEnd = Math.min(pageStart + rows, total); + List> pageRows = new ArrayList>(); + if (pageStart < pageEnd) { + pageRows = filteredRows.subList(pageStart, pageEnd); + } + + JSONArray rowsJson = JSONArray.fromObject(pageRows); + String result = "{" + + "\"total\":" + total + "," + + "\"rows\":" + rowsJson + "," + + "\"summaryInCount\":" + inCount + "," + + "\"summaryOutCount\":" + outCount + "," + + "\"summaryInsideCount\":" + (inCount - outCount) + "," + + "\"summaryAbnormalCount\":" + abnormalCount + + "}"; + model.addAttribute("result", result); + return new ModelAndView("result"); + } + + private String safeStr(Object value) { + return value == null ? "" : String.valueOf(value).trim(); + } + + private List> buildMockRows() { + List> rows = new ArrayList>(); + rows.add(buildRow("鲁A12345", "IN", "2026-03-03 08:12:21", "东门1号闸", "张三", "NORMAL", "自动识别放行")); + rows.add(buildRow("鲁B66K88", "OUT", "2026-03-03 08:18:46", "东门1号闸", "李四", "NORMAL", "自动识别放行")); + rows.add(buildRow("鲁C99871", "IN", "2026-03-03 08:27:19", "南门2号闸", "王五", "ABNORMAL", "车牌识别异常,人工放行")); + rows.add(buildRow("鲁A77889", "IN", "2026-03-03 09:04:52", "北门1号闸", "赵六", "NORMAL", "自动识别放行")); + rows.add(buildRow("鲁D22319", "OUT", "2026-03-03 09:19:11", "南门2号闸", "钱七", "NORMAL", "自动识别放行")); + rows.add(buildRow("鲁E55120", "IN", "2026-03-03 10:03:35", "西门1号闸", "孙八", "NORMAL", "访客车辆")); + rows.add(buildRow("鲁F90111", "OUT", "2026-03-03 10:16:05", "北门1号闸", "周九", "ABNORMAL", "未登记离场,值班确认")); + rows.add(buildRow("鲁A0P365", "IN", "2026-03-03 10:42:30", "东门1号闸", "吴十", "NORMAL", "自动识别放行")); + return rows; + } + + private Map buildRow(String plateNo, String direction, String passTime, String gateName, + String driverName, String status, String note) { + Map row = new HashMap(); + row.put("plateNo", plateNo); + row.put("direction", direction); + row.put("passTime", passTime); + row.put("gateName", gateName); + row.put("driverName", driverName); + row.put("status", status); + row.put("note", note); + return row; + } +} diff --git a/src/main/resources/es.properties b/src/main/resources/es.properties index 86073721..f7f2f6ec 100644 --- a/src/main/resources/es.properties +++ b/src/main/resources/es.properties @@ -2,8 +2,8 @@ es.nodes=127.0.0.1 #es.nodes=122.51.194.184 es.host=9300 #es.name=elastic -es.name=my-application +#es.name=elasticsearch #es.name=elasticsearch-sipaiis - +es.name=my-application diff --git a/src/main/webapp/CSS/module/jsyw-vehicle-gate.css b/src/main/webapp/CSS/module/jsyw-vehicle-gate.css new file mode 100644 index 00000000..65345a66 --- /dev/null +++ b/src/main/webapp/CSS/module/jsyw-vehicle-gate.css @@ -0,0 +1,39 @@ +.gate-summary-row .small-box { + margin-bottom: 12px; +} + +.gate-summary-row .small-box .icon { + top: 4px; +} + +.gate-search-line { + margin-bottom: 12px; +} + +.gate-input { + width: 170px; + margin-right: 8px; + margin-bottom: 8px; +} + +.gate-detail-line { + line-height: 28px; + font-size: 13px; +} + +.gate-detail-line span:first-child { + color: #666; + display: inline-block; + width: 72px; +} + +.gate-photo-placeholder { + margin-top: 12px; + border: 1px dashed #d2d6de; + background: #fafafa; + color: #999; + text-align: center; + line-height: 120px; + height: 120px; +} + diff --git a/src/main/webapp/JS/jsyw/vehicleGateList.js b/src/main/webapp/JS/jsyw/vehicleGateList.js new file mode 100644 index 00000000..cffe7e68 --- /dev/null +++ b/src/main/webapp/JS/jsyw/vehicleGateList.js @@ -0,0 +1,161 @@ +function getDirectionText(direction) { + return direction === "IN" ? "进闸" : "出闸"; +} + +function getStatusText(status) { + return status === "ABNORMAL" ? "异常" : "正常"; +} + +function getDirectionLabel(direction) { + if (direction === "IN") { + return "进闸"; + } + return "出闸"; +} + +function getStatusLabel(status) { + if (status === "ABNORMAL") { + return "异常"; + } + return "正常"; +} + +function renderSummaryByResponse(res) { + $("#summaryInCount").text(res.summaryInCount || 0); + $("#summaryOutCount").text(res.summaryOutCount || 0); + $("#summaryInsideCount").text(res.summaryInsideCount || 0); + $("#summaryAbnormalCount").text(res.summaryAbnormalCount || 0); +} + +function initGateTable() { + $("#gateTable").bootstrapTable({ + url: ext.contextPath + "/jsyw/vehicleGate/getList.do", + method: "post", + cache: false, + striped: true, + pagination: true, + pageList: [10, 20, 50], + pageSize: 10, + pageNumber: 1, + sidePagination: "server", + queryParams: function (params) { + return { + rows: params.limit, + page: params.offset / params.limit + 1, + sort: params.sort, + order: params.order, + plateNo: $.trim($("#search_plateNo").val()), + passDate: $.trim($("#search_passDate").val()), + direction: $("#search_direction").val(), + status: $("#search_status").val() + }; + }, + responseHandler: function (res) { + renderSummaryByResponse(res || {}); + return { + total: (res && res.total) ? res.total : 0, + rows: (res && res.rows) ? res.rows : [] + }; + }, + columns: [ + { + field: "plateNo", + title: "车牌号", + align: "center", + valign: "middle" + }, + { + field: "direction", + title: "通行方向", + align: "center", + valign: "middle", + formatter: function (value) { + return getDirectionLabel(value); + } + }, + { + field: "passTime", + title: "通行时间", + align: "center", + valign: "middle" + }, + { + field: "gateName", + title: "闸机", + align: "center", + valign: "middle" + }, + { + field: "driverName", + title: "司机", + align: "center", + valign: "middle" + }, + { + field: "status", + title: "状态", + align: "center", + valign: "middle", + formatter: function (value) { + return getStatusLabel(value); + } + }, + { + field: "note", + title: "备注", + align: "center", + valign: "middle" + }, + { + title: "操作", + align: "center", + valign: "middle", + width: 100, + formatter: function (value, row, index) { + return ""; + } + } + ], + onLoadSuccess: function () { + adjustBootstrapTableView("gateTable"); + } + }); +} + +function searchGateRecords() { + $("#gateTable").bootstrapTable("refresh", {pageNumber: 1}); +} + +function resetGateSearch() { + $("#search_plateNo").val(""); + $("#search_passDate").val(""); + $("#search_direction").val(""); + $("#search_status").val(""); + $("#gateTable").bootstrapTable("refresh", {pageNumber: 1}); +} + +function showGateDetail(index) { + var pageRows = $("#gateTable").bootstrapTable("getData") || []; + var row = pageRows[index]; + if (!row) { + return; + } + $("#detail_plateNo").text(row.plateNo || ""); + $("#detail_direction").text(getDirectionText(row.direction || "")); + $("#detail_passTime").text(row.passTime || ""); + $("#detail_gateName").text(row.gateName || ""); + $("#detail_driverName").text(row.driverName || ""); + $("#detail_status").text(getStatusText(row.status || "")); + $("#detail_note").text(row.note || ""); + $("#gateDetailModal").modal("show"); +} + +$(function () { + $("#search_passDate").datepicker({ + autoclose: true, + language: "zh-CN", + format: "yyyy-mm-dd" + }); + initGateTable(); +}); + diff --git a/src/main/webapp/jsp/jsyw/vehicleGateList.jsp b/src/main/webapp/jsp/jsyw/vehicleGateList.jsp new file mode 100644 index 00000000..0da09a75 --- /dev/null +++ b/src/main/webapp/jsp/jsyw/vehicleGateList.jsp @@ -0,0 +1,122 @@ +<%@ page language="java" pageEncoding="UTF-8" %> +<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> +<%@ page import="com.sipai.entity.base.ServerObject" %> + + + <%= ServerObject.atttable.get("TOPTITLE")%> + + + + + + +
+
+
+

+ +
+
+
+ +
+
+
+
+

0

+

今日进闸

+
+
+
+
+
+
+
+

0

+

今日出闸

+
+
+
+
+
+
+
+

0

+

当前场内车辆

+
+
+
+
+
+
+
+

0

+

异常记录

+
+
+
+
+
+ +
+
+

车辆通行记录(静态展示)

+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+
+ + + + +