From 259a60f240fdfff356a236d380d8d682949fc571 Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期一, 26 十月 2026 09:24:25 +0800
Subject: [PATCH] feat(环保门禁): 巡检设备数据回传开放接口(无人机/机器人/AI摄像头)、无人值守地磅模块(表+后端+日报)、车辆采集照片字段、修复车辆修改接口缺@RequestBody
---
src/main/java/com/ruoyi/envaccess/pojo/EnvWeighbridgeSystem.java | 76 +++++++
src/main/java/com/ruoyi/envaccess/controller/EnvWeighbridgeController.java | 82 ++++++++
src/main/java/com/ruoyi/envaccess/service/impl/EnvWeighbridgeSystemServiceImpl.java | 34 +++
src/main/java/com/ruoyi/vehicleInformationCollectionReview/controller/VehicleInformationCollectionController.java | 2
doc/环保门禁-巡检数据回传接口说明.md | 159 +++++++++++++++
src/main/java/com/ruoyi/envaccess/mapper/EnvWeighbridgeSystemMapper.java | 22 ++
src/main/java/com/ruoyi/vehicleInformationCollectionReview/pojo/VehicleInformationCollectionReview.java | 15 +
src/main/resources/mapper/envaccess/EnvWeighbridgeSystemMapper.xml | 42 ++++
src/main/java/com/ruoyi/envaccess/controller/EnvInspectionController.java | 148 ++++++++++++++
src/main/java/com/ruoyi/envaccess/service/IEnvWeighbridgeSystemService.java | 16 +
10 files changed, 595 insertions(+), 1 deletions(-)
diff --git "a/doc/\347\216\257\344\277\235\351\227\250\347\246\201-\345\267\241\346\243\200\346\225\260\346\215\256\345\233\236\344\274\240\346\216\245\345\217\243\350\257\264\346\230\216.md" "b/doc/\347\216\257\344\277\235\351\227\250\347\246\201-\345\267\241\346\243\200\346\225\260\346\215\256\345\233\236\344\274\240\346\216\245\345\217\243\350\257\264\346\230\216.md"
new file mode 100644
index 0000000..6427be0
--- /dev/null
+++ "b/doc/\347\216\257\344\277\235\351\227\250\347\246\201-\345\267\241\346\243\200\346\225\260\346\215\256\345\233\236\344\274\240\346\216\245\345\217\243\350\257\264\346\230\216.md"
@@ -0,0 +1,159 @@
+# 鐜繚闂ㄧ绯荤粺 鈥� 鏃犱汉鏈� / 鏈哄櫒浜� / AI 鎽勫儚澶� 宸℃鏁版嵁鍥炰紶鎺ュ彛璇存槑
+
+> 鐢ㄤ簬璇佹槑"鏅鸿兘宸℃鍙敮鎸佹棤浜烘満銆佹満鍣ㄤ汉鑱斿姩宸℃鏁版嵁鍥炰紶"銆�
+> 浠讳綍鍏峰 HTTP 璋冪敤鑳藉姏鐨勮澶囨垨绗笁鏂瑰钩鍙帮紙鏃犱汉鏈烘満鍦恒�佸贰妫�鏈哄櫒浜轰腑鎺с�丄I 瑙嗛鍒嗘瀽鐩掑瓙锛夐兘鍙互璋冪敤鏈帴鍙d笂鎶ュ贰妫�鏁版嵁锛�
+> 涓婃姤鍚庢暟鎹珛鍗宠惤搴擄紝骞跺彲鍦ㄧ郴缁熴�屾櫤鑳藉贰妫�绠$悊 鈫� 鍥炰紶璇︽儏銆嶄腑鏌ョ湅銆�
+
+## 1. 鎺ュ彛鍩烘湰淇℃伅
+
+| 椤� | 鍊� |
+|---|---|
+| 鎺ュ彛鍦板潃 | `http://10.136.58.73:7003/environmentAccess/inspection/callback` |
+| 璇锋眰鏂规硶 | `POST` |
+| Content-Type | `application/json;charset=utf-8` |
+| 閴存潈 | 璇锋眰浣撲腑鎼哄甫 `secret`锛堥粯璁� `hbmjxt-callback-2026`锛屽彲閫氳繃閰嶇疆椤� `envaccess.callback.secret` 淇敼锛� |
+| 鐧诲綍瑕佹眰 | 鏃狅紙璁惧鏃犻渶鐧诲綍锛岃蛋 secret 鏍¢獙锛� |
+
+## 2. 璇锋眰鍙傛暟
+
+| 鍙傛暟 | 绫诲瀷 | 蹇呭~ | 璇存槑 |
+|---|---|---|---|
+| `secret` | string | 鏄� | 鎺ュ彛瀵嗛挜 |
+| `tenantId` | number | 鏄� | 绉熸埛 ID銆傝姱瀵肩幆淇濅负 `222` |
+| `inspectionId` | number | 鍚� | 鎸囧畾宸℃浠诲姟 ID銆備笉浼犲垯鎸� `area` 鍖归厤鏈�杩戜竴鏉℃湭鍙栨秷浠诲姟锛涗粛鏃犲尮閰嶅垯鑷姩鏂板缓涓�鏉″贰妫�璁板綍 |
+| `area` | string | 寤鸿 | 宸℃鍖哄煙锛屽 `涓滈棬鍖哄煙` |
+| `deviceType` | string | 寤鸿 | 鏁版嵁鏉ユ簮锛歚UAV` 鏃犱汉鏈� / `ROBOT` 宸℃鏈哄櫒浜� / `CAMERA` AI 鎽勫儚澶� |
+| `deviceCode` | string | 寤鸿 | 璁惧缂栧彿锛屽 `UAV-M350-001` |
+| `collectedAt` | string | 鍚� | 璁惧閲囬泦鏃堕棿锛宍yyyy-MM-dd HH:mm:ss` |
+| `aiSummary` | string | 鍚� | AI 鍒嗘瀽缁撹鎽樿 |
+| `aiObjects` | array | 鍚� | AI 璇嗗埆鏉$洰锛屾瘡椤瑰惈 `object`(璇嗗埆瀵硅薄)銆乣conclusion`(璇嗗埆缁撹)銆乣confidence`(缃俊搴� 0~1)銆乣frameTime`(鎴抚鏃堕棿) |
+| `longitude` | number | 鍚� | 閲囬泦鐐圭粡搴� |
+| `latitude` | number | 鍚� | 閲囬泦鐐圭含搴� |
+| `altitude` | number | 鍚� | 浣滀笟楂樺害锛堢背锛夈�傚湴闈㈡満鍣ㄤ汉鍙紶 0 |
+| `battery` | number | 鍚� | 璁惧鐢甸噺鐧惧垎姣� |
+| `photos` | array | 鍚� | 鐜板満鐓х墖 URL 鍒楄〃 |
+| `track` | array | 鍚� | 宸℃杞ㄨ抗鐐癸紝姣忛」鍚� `t`(鏃堕棿)銆乣lng`銆乣lat`銆乣alt` |
+
+## 3. 璇锋眰绀轰緥
+
+### 3.1 鏃犱汉鏈哄贰妫�涓婃姤
+
+```bash
+curl -X POST "http://10.136.58.73:7003/environmentAccess/inspection/callback" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "secret": "hbmjxt-callback-2026",
+ "tenantId": 222,
+ "area": "涓滈棬鍖哄煙",
+ "deviceType": "UAV",
+ "deviceCode": "UAV-M350-001",
+ "collectedAt": "2026-10-24 09:12:10",
+ "aiSummary": "鏈宸℃璇嗗埆 3 绫荤洰鏍囷紝鍙戠幇 1 澶勪汉鍛樻湭浣╂埓瀹夊叏甯�",
+ "aiObjects": [
+ {"object": "浜哄憳鏈僵鎴村畨鍏ㄥ附", "conclusion": "鏈寜瑕佹眰浣╂埓锛屽凡鎺ㄩ�佹暣鏀�", "confidence": 0.93, "frameTime": "2026-10-24 09:12:35"},
+ {"object": "杞︾墝璇嗗埆閫氳繃", "conclusion": "鑻廇8F372 姝e父鏀捐", "confidence": 0.99, "frameTime": "2026-10-24 09:13:02"}
+ ],
+ "longitude": 120.382145,
+ "latitude": 31.298512,
+ "altitude": 45.6,
+ "battery": 78,
+ "photos": [],
+ "track": [
+ {"t": "09:12:10", "lng": 120.382145, "lat": 31.298512, "alt": 45.6},
+ {"t": "09:13:02", "lng": 120.382301, "lat": 31.298604, "alt": 52.1}
+ ]
+ }'
+```
+
+### 3.2 宸℃鏈哄櫒浜轰笂鎶ワ紙鍦伴潰璁惧锛宎ltitude 浼� 0锛�
+
+```bash
+curl -X POST "http://10.136.58.73:7003/environmentAccess/inspection/callback" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "secret": "hbmjxt-callback-2026",
+ "tenantId": 222,
+ "area": "浠撳偍鍖哄煙",
+ "deviceType": "ROBOT",
+ "deviceCode": "ROBOT-XD-S2-01",
+ "collectedAt": "2026-10-24 14:09:50",
+ "aiSummary": "鏈宸℃璇嗗埆 4 绫荤洰鏍囷紝鍙戠幇 1 澶勬秷闃查�氶亾鍗犵敤",
+ "aiObjects": [
+ {"object": "娑堥槻閫氶亾", "conclusion": "閫氶亾琚墭鐩樹复鏃跺崰鐢紝宸查�氱煡娓呯悊", "confidence": 0.95, "frameTime": "2026-10-24 14:10:05"}
+ ],
+ "longitude": 120.381024,
+ "latitude": 31.299348,
+ "altitude": 0.9,
+ "battery": 57
+ }'
+```
+
+### 3.3 AI 鎽勫儚澶翠笂鎶ワ紙鍥哄畾鐐逛綅锛�
+
+```bash
+curl -X POST "http://10.136.58.73:7003/environmentAccess/inspection/callback" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "secret": "hbmjxt-callback-2026",
+ "tenantId": 222,
+ "area": "鐢熶骇涓�鍖�",
+ "deviceType": "CAMERA",
+ "deviceCode": "CAM-PROD1-05",
+ "aiSummary": "鏈杞贰璇嗗埆 5 绫荤洰鏍囷紝鍙戠幇 1 澶勫簾姘旀敹闆嗙僵绉讳綅",
+ "aiObjects": [
+ {"object": "搴熸皵鏀堕泦缃�", "conclusion": "浣嶇疆鍋忕Щ绾� 15cm锛屽奖鍝嶆敹闆嗘晥鐜�", "confidence": 0.87, "frameTime": "2026-10-24 09:35:44"}
+ ],
+ "longitude": 120.384011,
+ "latitude": 31.299772,
+ "altitude": 7.2
+ }'
+```
+
+## 4. 鍝嶅簲绀轰緥
+
+鎴愬姛锛�
+
+```json
+{
+ "code": 200,
+ "msg": "宸℃鏁版嵁鍥炰紶鎴愬姛",
+ "data": {
+ "inspectionId": 3,
+ "created": false,
+ "deviceCode": "UAV-M350-001",
+ "deviceType": "UAV",
+ "area": "涓滈棬鍖哄煙"
+ }
+}
+```
+
+| 瀛楁 | 璇存槑 |
+|---|---|
+| `inspectionId` | 鏁版嵁鍐欏叆鐨勫贰妫�浠诲姟 ID |
+| `created` | `true` 琛ㄧず绯荤粺鑷姩鏂板缓浜嗕竴鏉″贰妫�璁板綍锛堝師鍖哄煙娌℃湁鍖归厤浠诲姟锛� |
+
+澶辫触锛�
+
+| 杩斿洖 | 鍘熷洜 |
+|---|---|
+| `secret 鏍¢獙澶辫触` | 璇锋眰浣� `secret` 涓庨厤缃笉涓�鑷� |
+| `tenantId 涓嶈兘涓虹┖` | 鏈紶绉熸埛 ID |
+| `鍥炰紶鏁版嵁涓嶈兘涓虹┖` | 璇锋眰浣撲负绌� |
+
+## 5. 涓婃姤鍚庡湪鍝噷鐪�
+
+鐧诲綍绯荤粺 鈫� **鐜繚闂ㄧ 鈫� 鏅鸿兘宸℃绠$悊** 鈫� 鎵惧埌瀵瑰簲鍖哄煙鐨勫贰妫�璁板綍 鈫� 鐐规搷浣滃垪 **銆屽洖浼犺鎯呫��**锛�
+
+- **鏁版嵁鏉ユ簮**锛氭潵婧愮被鍨嬶紙鏃犱汉鏈�/宸℃鏈哄櫒浜�/AI 鎽勫儚澶达級銆佽澶囩紪鍙枫�佸贰妫�鍖哄煙銆佽澶囩數閲忋�侀噰闆嗘椂闂淬�佺郴缁熸帴鏀舵椂闂淬�侀噰闆嗗潗鏍囥�佷綔涓氶珮搴�
+- **AI 瑙嗛鍒嗘瀽缁撴灉**锛氬垎鏋愮粨璁烘憳瑕� + 缁撴瀯鍖栬瘑鍒潯鐩〃鏍硷紙璇嗗埆瀵硅薄銆佽瘑鍒粨璁恒�佺疆淇″害%銆佹埅甯ф椂闂达級
+- **鐜板満閲囬泦鐓х墖**锛氳澶囦笂鎶ョ殑 `photos` 浼氫互缂╃暐鍥惧睍绀猴紝鍙偣鍑绘斁澶�
+- **璁惧宸℃杞ㄨ抗**锛歚track` 浼氫互琛ㄦ牸灞曠ず鏃堕棿/缁忕含搴�/楂樺害
+
+## 6. 鐜板満婕旂ず姝ラ锛堝缓璁級
+
+1. 娴忚鍣ㄦ墦寮�绯荤粺 鈫� 鐜繚闂ㄧ 鈫� 鏅鸿兘宸℃绠$悊锛屾壘鍒般�屼笢闂ㄥ尯鍩熴�嶇殑璁板綍锛岀偣銆屽洖浼犺鎯呫�嶇粰瀹㈡埛鐪嬪綋鍓嶆暟鎹�
+2. 鎵撳紑 Postman锛岀矘璐寸 3.1 鑺傜殑 JSON锛岀偣 Send
+3. 鍥炲埌娴忚鍣紝**鍒锋柊鍒楄〃**锛屽啀鐐广�屽洖浼犺鎯呫�嶁�斺�� 绯荤粺鎺ユ敹鏃堕棿銆丄I 璇嗗埆鏉$洰浼氬彉鎴愬垰鍒氫笂鎶ョ殑鍐呭
+4. 濡傛灉鎹竴涓笉瀛樺湪鐨勫尯鍩燂紙濡� `"area": "鍖楀巶鍖�"`锛夛紝鍝嶅簲閲� `created` 浼氭槸 `true`锛屽垪琛ㄤ細**鑷姩澶氬嚭涓�鏉�**璇ュ尯鍩熺殑宸℃璁板綍
+
+绗� 3銆�4 姝ュ氨鏄�"鍙敮鎸佽澶囪仈鍔ㄥ洖浼�"鐨勭洿鎺ヨ瘉鎹細**鎺ュ彛鐪熷疄瀛樺湪锛屾暟鎹湡瀹炲叆搴擄紝椤甸潰鐪熷疄鍙**銆�
diff --git a/src/main/java/com/ruoyi/envaccess/controller/EnvInspectionController.java b/src/main/java/com/ruoyi/envaccess/controller/EnvInspectionController.java
index f9e748e..f5ad961 100644
--- a/src/main/java/com/ruoyi/envaccess/controller/EnvInspectionController.java
+++ b/src/main/java/com/ruoyi/envaccess/controller/EnvInspectionController.java
@@ -1,16 +1,24 @@
package com.ruoyi.envaccess.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.ruoyi.common.handler.CustomTenantLineHandler;
+import com.ruoyi.framework.aspectj.lang.annotation.Anonymous;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.envaccess.pojo.EnvInspection;
import com.ruoyi.envaccess.service.IEnvInspectionService;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
/**
* 鐜繚闂ㄧ--鏅鸿兘宸℃鍙拌处锛堝惈璺緞瑙勫垝/AI瑙嗛鍒嗘瀽/鎶ュ憡/鏃犱汉鏈烘満鍣ㄤ汉锛孉I涓庢棤浜烘満瀛楁棰勭暀锛�
@@ -67,4 +75,144 @@
public void export(HttpServletResponse response, EnvInspection req) {
envInspectionService.export(response, req);
}
+
+ @Value("${envaccess.callback.secret:hbmjxt-callback-2026}")
+ private String callbackSecret;
+
+ private static final ObjectMapper CALLBACK_MAPPER = new ObjectMapper();
+
+ /**
+ * 鏃犱汉鏈� / 鏈哄櫒浜� / AI 鎽勫儚澶� 宸℃鏁版嵁鍥炰紶锛堝澶栧紑鏀炬帴鍙o紝渚涚涓夋柟璁惧璋冪敤锛�
+ *
+ * 璇锋眰绀轰緥锛圥OST JSON锛夛細
+ * {
+ * "secret": "hbmjxt-callback-2026",
+ * "tenantId": 222,
+ * "inspectionId": 3, // 鍙�夛紝涓嶄紶鍒欐寜 area 鍖归厤鏈�杩戜竴鏉℃湭鍙栨秷浠诲姟锛屽啀娌℃湁灏辨柊寤�
+ * "area": "涓滈棬鍖哄煙",
+ * "deviceType": "UAV", // UAV 鏃犱汉鏈� / ROBOT 鏈哄櫒浜� / CAMERA 鎽勫儚澶�
+ * "deviceCode": "UAV-M350-001",
+ * "collectedAt": "2026-10-24 09:12:35",
+ * "aiSummary": "鍏辫瘑鍒� 5 绫荤洰鏍囷紝鍙戠幇 1 澶勬湭浣╂埓瀹夊叏甯�",
+ * "aiObjects": [{"object":"浜哄憳鏈僵鎴村畨鍏ㄥ附","conclusion":"鏈寜瑕佹眰浣╂埓","confidence":0.93,"frameTime":"2026-10-24 09:12:35"}],
+ * "longitude": 120.382145, "latitude": 31.298512, "altitude": 45.6, "battery": 78,
+ * "photos": ["/profile/upload/uav_east_01.jpg"],
+ * "track": [{"t":"09:12:10","lng":120.3821,"lat":31.2985}]
+ * }
+ */
+ @Anonymous
+ @PostMapping("/callback")
+ public AjaxResult callback(@RequestBody Map<String, Object> payload) {
+ if (payload == null || payload.isEmpty()) {
+ return AjaxResult.error("鍥炰紶鏁版嵁涓嶈兘涓虹┖");
+ }
+ if (!callbackSecret.equals(String.valueOf(payload.get("secret")))) {
+ return AjaxResult.error("secret 鏍¢獙澶辫触锛岃鍦ㄨ姹備綋涓惡甯︽纭殑 secret");
+ }
+ Long tenantId = toLong(payload.get("tenantId"));
+ if (tenantId == null) {
+ return AjaxResult.error("tenantId 涓嶈兘涓虹┖");
+ }
+ String area = payload.get("area") == null ? "鏈寚瀹氬尯鍩�" : String.valueOf(payload.get("area"));
+ String deviceType = payload.get("deviceType") == null ? "UAV" : String.valueOf(payload.get("deviceType"));
+ String deviceCode = payload.get("deviceCode") == null ? deviceType + "-UNKNOWN" : String.valueOf(payload.get("deviceCode"));
+
+ Map<String, Object> ai = new LinkedHashMap<>();
+ ai.put("summary", payload.get("aiSummary") == null ? "鏈鍥炰紶鏈檮甯� AI 璇嗗埆缁撹" : payload.get("aiSummary"));
+ ai.put("objects", payload.get("aiObjects") == null ? new ArrayList<>() : payload.get("aiObjects"));
+
+ Map<String, Object> uav = new LinkedHashMap<>();
+ uav.put("deviceType", deviceType);
+ uav.put("deviceCode", deviceCode);
+ uav.put("area", area);
+ uav.put("collectedAt", payload.get("collectedAt") == null ? "" : payload.get("collectedAt"));
+ uav.put("longitude", payload.get("longitude"));
+ uav.put("latitude", payload.get("latitude"));
+ uav.put("altitude", payload.get("altitude"));
+ uav.put("battery", payload.get("battery"));
+ uav.put("photos", payload.get("photos") == null ? new ArrayList<>() : payload.get("photos"));
+ uav.put("track", payload.get("track") == null ? new ArrayList<>() : payload.get("track"));
+ uav.put("receivedAt", new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
+
+ String aiJson;
+ String uavJson;
+ try {
+ aiJson = CALLBACK_MAPPER.writeValueAsString(ai);
+ uavJson = CALLBACK_MAPPER.writeValueAsString(uav);
+ } catch (Exception e) {
+ return AjaxResult.error("鍥炰紶鏁版嵁搴忓垪鍖栧け璐ワ細" + e.getMessage());
+ }
+
+ EnvInspection target = null;
+ Long inspectionId = toLong(payload.get("inspectionId"));
+ if (inspectionId != null) {
+ target = envInspectionService.getById(inspectionId);
+ }
+ if (target == null) {
+ com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<EnvInspection> w =
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<>();
+ w.eq(EnvInspection::getArea, area).ne(EnvInspection::getStatus, 3)
+ .orderByDesc(EnvInspection::getId).last("limit 1");
+ target = envInspectionService.getOne(w, false);
+ }
+
+ boolean created = false;
+ if (target == null) {
+ target = new EnvInspection();
+ target.setInspectionName(area + " 鏅鸿兘宸℃锛堣澶囧洖浼狅級");
+ target.setInspectionType(2);
+ target.setArea(area);
+ target.setStatus(2);
+ target.setPlanStartTime(new Date());
+ target.setPlanEndTime(new Date());
+ target.setActualStartTime(new Date());
+ target.setActualEndTime(new Date());
+ target.setInspector(deviceCode);
+ target.setRoutePlan("鐢� " + deviceType + " 鑷姩瑙勫垝骞舵墽琛�");
+ target.setInspectionResult("璁惧鑷姩宸℃宸插畬鎴愶紝璇嗗埆缁撴灉璇﹁鍥炰紶鏁版嵁銆�");
+ target.setTenantId(tenantId);
+ created = true;
+ }
+ target.setAiAnalysis(aiJson);
+ target.setUavData(uavJson);
+ if (target.getStatus() != null && target.getStatus() == 0) {
+ target.setStatus(2);
+ }
+ if (target.getTenantId() == null) {
+ target.setTenantId(tenantId);
+ }
+
+ // 璁惧鍥炶皟娌℃湁鐧诲綍涓婁笅鏂囷紝涓存椂璺宠繃绉熸埛鎻掍欢锛宼enant_id 宸插湪涓婇潰鏄惧紡鍐欏叆
+ CustomTenantLineHandler.TEMP_IGNORE.set(Boolean.TRUE);
+ try {
+ if (created) {
+ envInspectionService.save(target);
+ } else {
+ envInspectionService.updateById(target);
+ }
+ } catch (Exception e) {
+ return AjaxResult.error("鍥炰紶鏁版嵁钀藉簱澶辫触锛�" + e.getMessage());
+ } finally {
+ CustomTenantLineHandler.TEMP_IGNORE.remove();
+ }
+
+ Map<String, Object> result = new LinkedHashMap<>();
+ result.put("inspectionId", target.getId());
+ result.put("created", created);
+ result.put("deviceCode", deviceCode);
+ result.put("deviceType", deviceType);
+ result.put("area", area);
+ return AjaxResult.success("宸℃鏁版嵁鍥炰紶鎴愬姛", result);
+ }
+
+ private Long toLong(Object v) {
+ if (v == null) {
+ return null;
+ }
+ try {
+ return Long.valueOf(String.valueOf(v).trim());
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ }
}
diff --git a/src/main/java/com/ruoyi/envaccess/controller/EnvWeighbridgeController.java b/src/main/java/com/ruoyi/envaccess/controller/EnvWeighbridgeController.java
new file mode 100644
index 0000000..957d962
--- /dev/null
+++ b/src/main/java/com/ruoyi/envaccess/controller/EnvWeighbridgeController.java
@@ -0,0 +1,82 @@
+package com.ruoyi.envaccess.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.envaccess.pojo.EnvWeighbridgeSystem;
+import com.ruoyi.envaccess.service.IEnvWeighbridgeSystemService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 鐜繚闂ㄧ--鏃犱汉鍊煎畧鍦扮绠$悊 / 鎶ヨ〃涓績
+ */
+@RestController
+@RequestMapping("/environmentAccess")
+public class EnvWeighbridgeController {
+
+ @Resource
+ private IEnvWeighbridgeSystemService envWeighbridgeSystemService;
+
+ @GetMapping("/weighbridgeSystemPage")
+ public AjaxResult page(Page page, EnvWeighbridgeSystem req) {
+ return AjaxResult.success(envWeighbridgeSystemService.listPage(page, req));
+ }
+
+ @GetMapping("/weighbridgeSystemInfo")
+ public AjaxResult info(@RequestParam Long id) {
+ return AjaxResult.success(envWeighbridgeSystemService.getById(id));
+ }
+
+ @PostMapping("/weighbridgeSystemAdd")
+ @Log(title = "鏃犱汉鍊煎畧鍦扮-鏂板", businessType = BusinessType.INSERT)
+ public AjaxResult add(@RequestBody EnvWeighbridgeSystem req) {
+ req.setId(null);
+ fillNetWeight(req);
+ LocalDateTime now = LocalDateTime.now();
+ req.setCreateTime(now);
+ req.setUpdateTime(now);
+ return envWeighbridgeSystemService.save(req) ? AjaxResult.success() : AjaxResult.error("鏂板澶辫触");
+ }
+
+ @PutMapping("/weighbridgeSystemUpdate")
+ @Log(title = "鏃犱汉鍊煎畧鍦扮-淇敼", businessType = BusinessType.UPDATE)
+ public AjaxResult update(@RequestBody EnvWeighbridgeSystem req) {
+ fillNetWeight(req);
+ req.setUpdateTime(LocalDateTime.now());
+ return envWeighbridgeSystemService.updateById(req) ? AjaxResult.success() : AjaxResult.error("淇敼澶辫触");
+ }
+
+ @DeleteMapping("/weighbridgeSystemDelete")
+ @Log(title = "鏃犱汉鍊煎畧鍦扮-鍒犻櫎", businessType = BusinessType.DELETE)
+ public AjaxResult delete(@RequestBody List<Long> ids) {
+ return envWeighbridgeSystemService.removeByIds(ids) ? AjaxResult.success() : AjaxResult.error("鍒犻櫎澶辫触");
+ }
+
+ /**
+ * 姣忔棩杩囩缁熻鎶ヨ〃锛堣溅娆� / 璐ч噺鍚� / 鍋忓樊鐜囷級
+ */
+ @GetMapping("/weighbridgeDailyReport")
+ public AjaxResult dailyReport(@RequestParam(required = false) String startDate,
+ @RequestParam(required = false) String endDate) {
+ List<Map<String, Object>> list = envWeighbridgeSystemService.dailyReport(startDate, endDate);
+ return AjaxResult.success(list);
+ }
+
+ /**
+ * 鍑�閲� = 姣涢噸 - 鐨噸
+ */
+ private void fillNetWeight(EnvWeighbridgeSystem req) {
+ if (req.getNetWeight() == null
+ && req.getGrossWeight() != null
+ && req.getTareWeight() != null) {
+ req.setNetWeight(req.getGrossWeight().subtract(req.getTareWeight()).setScale(2, BigDecimal.ROUND_HALF_UP));
+ }
+ }
+}
diff --git a/src/main/java/com/ruoyi/envaccess/mapper/EnvWeighbridgeSystemMapper.java b/src/main/java/com/ruoyi/envaccess/mapper/EnvWeighbridgeSystemMapper.java
new file mode 100644
index 0000000..3fbf5f9
--- /dev/null
+++ b/src/main/java/com/ruoyi/envaccess/mapper/EnvWeighbridgeSystemMapper.java
@@ -0,0 +1,22 @@
+package com.ruoyi.envaccess.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.envaccess.pojo.EnvWeighbridgeSystem;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface EnvWeighbridgeSystemMapper extends BaseMapper<EnvWeighbridgeSystem> {
+
+ IPage<EnvWeighbridgeSystem> listPage(Page page, @Param("req") EnvWeighbridgeSystem req);
+
+ /**
+ * 鎸夋棩鑱氬悎锛氳溅娆°�佽揣閲�(鍚�)銆佸亸宸巼(%)
+ */
+ List<Map<String, Object>> dailyReport(@Param("startDate") String startDate, @Param("endDate") String endDate);
+}
diff --git a/src/main/java/com/ruoyi/envaccess/pojo/EnvWeighbridgeSystem.java b/src/main/java/com/ruoyi/envaccess/pojo/EnvWeighbridgeSystem.java
new file mode 100644
index 0000000..c945462
--- /dev/null
+++ b/src/main/java/com/ruoyi/envaccess/pojo/EnvWeighbridgeSystem.java
@@ -0,0 +1,76 @@
+package com.ruoyi.envaccess.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 鐜繚闂ㄧ--鏃犱汉鍊煎畧鍦扮绉伴噸璁板綍
+ * env_weighbridge_system
+ */
+@TableName("env_weighbridge_system")
+@Data
+public class EnvWeighbridgeSystem implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @TableId(type = IdType.AUTO)
+ private Long id;
+
+ @ApiModelProperty(value = "杞︾墝鍙�")
+ private String plateNumber;
+
+ @ApiModelProperty(value = "绉伴噸鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime weightTime;
+
+ @ApiModelProperty(value = "鐨噸(kg)")
+ private BigDecimal tareWeight;
+
+ @ApiModelProperty(value = "姣涢噸(kg)")
+ private BigDecimal grossWeight;
+
+ @ApiModelProperty(value = "鍑�閲�(kg)")
+ private BigDecimal netWeight;
+
+ @ApiModelProperty(value = "鍋忕搴�(1-100)")
+ private Integer positionOffset;
+
+ @ApiModelProperty(value = "鍙告満濮撳悕")
+ private String driverName;
+
+ @ApiModelProperty(value = "鑱旂郴鐢佃瘽")
+ private String contactPhone;
+
+ @ApiModelProperty(value = "璐х墿鍚嶇О")
+ private String cargoName;
+
+ @ApiModelProperty(value = "鍦扮缂栧彿")
+ private String weighbridgeNumber;
+
+ @ApiModelProperty(value = "澶囨敞")
+ private String remark;
+
+ @ApiModelProperty(value = "鍒涘缓鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @ApiModelProperty(value = "鍒涘缓浜�")
+ private Long createUser;
+
+ @ApiModelProperty(value = "鏇存柊鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+ @ApiModelProperty(value = "鏇存柊浜�")
+ private Long updateUser;
+
+ @ApiModelProperty(value = "绉熸埛ID")
+ private Long tenantId;
+}
diff --git a/src/main/java/com/ruoyi/envaccess/service/IEnvWeighbridgeSystemService.java b/src/main/java/com/ruoyi/envaccess/service/IEnvWeighbridgeSystemService.java
new file mode 100644
index 0000000..b955032
--- /dev/null
+++ b/src/main/java/com/ruoyi/envaccess/service/IEnvWeighbridgeSystemService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.envaccess.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.envaccess.pojo.EnvWeighbridgeSystem;
+
+import java.util.List;
+import java.util.Map;
+
+public interface IEnvWeighbridgeSystemService extends IService<EnvWeighbridgeSystem> {
+
+ IPage<EnvWeighbridgeSystem> listPage(Page page, EnvWeighbridgeSystem req);
+
+ List<Map<String, Object>> dailyReport(String startDate, String endDate);
+}
diff --git a/src/main/java/com/ruoyi/envaccess/service/impl/EnvWeighbridgeSystemServiceImpl.java b/src/main/java/com/ruoyi/envaccess/service/impl/EnvWeighbridgeSystemServiceImpl.java
new file mode 100644
index 0000000..1f42d6f
--- /dev/null
+++ b/src/main/java/com/ruoyi/envaccess/service/impl/EnvWeighbridgeSystemServiceImpl.java
@@ -0,0 +1,34 @@
+package com.ruoyi.envaccess.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.envaccess.mapper.EnvWeighbridgeSystemMapper;
+import com.ruoyi.envaccess.pojo.EnvWeighbridgeSystem;
+import com.ruoyi.envaccess.service.IEnvWeighbridgeSystemService;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+@Service
+@AllArgsConstructor
+@Transactional(rollbackFor = Exception.class)
+public class EnvWeighbridgeSystemServiceImpl
+ extends ServiceImpl<EnvWeighbridgeSystemMapper, EnvWeighbridgeSystem>
+ implements IEnvWeighbridgeSystemService {
+
+ private EnvWeighbridgeSystemMapper envWeighbridgeSystemMapper;
+
+ @Override
+ public IPage<EnvWeighbridgeSystem> listPage(Page page, EnvWeighbridgeSystem req) {
+ return envWeighbridgeSystemMapper.listPage(page, req);
+ }
+
+ @Override
+ public List<Map<String, Object>> dailyReport(String startDate, String endDate) {
+ return envWeighbridgeSystemMapper.dailyReport(startDate, endDate);
+ }
+}
diff --git a/src/main/java/com/ruoyi/vehicleInformationCollectionReview/controller/VehicleInformationCollectionController.java b/src/main/java/com/ruoyi/vehicleInformationCollectionReview/controller/VehicleInformationCollectionController.java
index f67804d..b213006 100644
--- a/src/main/java/com/ruoyi/vehicleInformationCollectionReview/controller/VehicleInformationCollectionController.java
+++ b/src/main/java/com/ruoyi/vehicleInformationCollectionReview/controller/VehicleInformationCollectionController.java
@@ -32,7 +32,7 @@
}
// 淇敼杞﹁締淇℃伅
@PutMapping("/vehicleInfoUpdate")
- public AjaxResult updateRecord(VehicleInformationCollectionReview vehicleInformationCollectionReview){
+ public AjaxResult updateRecord(@RequestBody VehicleInformationCollectionReview vehicleInformationCollectionReview){
return AjaxResult.success(vehicleInformationCollectionReviewService.updateById(vehicleInformationCollectionReview));
}
// 鍒犻櫎杞﹁締淇℃伅锛堟敮鎸佹壒閲忥級
diff --git a/src/main/java/com/ruoyi/vehicleInformationCollectionReview/pojo/VehicleInformationCollectionReview.java b/src/main/java/com/ruoyi/vehicleInformationCollectionReview/pojo/VehicleInformationCollectionReview.java
index e319a5c..3ad42cf 100644
--- a/src/main/java/com/ruoyi/vehicleInformationCollectionReview/pojo/VehicleInformationCollectionReview.java
+++ b/src/main/java/com/ruoyi/vehicleInformationCollectionReview/pojo/VehicleInformationCollectionReview.java
@@ -80,6 +80,21 @@
private String fuelType;
/**
+ * 杞︾墝鐓х墖
+ */
+ private String platePhoto;
+
+ /**
+ * 琛岄┒璇佺収鐗�
+ */
+ private String licensePhoto;
+
+ /**
+ * 杞﹁締鍏ㄦ櫙鐓х墖
+ */
+ private String scenePhoto;
+
+ /**
* 瀹℃牳鐘舵��
*/
private String reviewStatus;
diff --git a/src/main/resources/mapper/envaccess/EnvWeighbridgeSystemMapper.xml b/src/main/resources/mapper/envaccess/EnvWeighbridgeSystemMapper.xml
new file mode 100644
index 0000000..8cc1906
--- /dev/null
+++ b/src/main/resources/mapper/envaccess/EnvWeighbridgeSystemMapper.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ruoyi.envaccess.mapper.EnvWeighbridgeSystemMapper">
+
+ <select id="listPage" resultType="com.ruoyi.envaccess.pojo.EnvWeighbridgeSystem">
+ SELECT * FROM env_weighbridge_system
+ <where>
+ <if test="req.plateNumber != null and req.plateNumber != ''">
+ AND plate_number LIKE CONCAT('%',#{req.plateNumber},'%')
+ </if>
+ <if test="req.cargoName != null and req.cargoName != ''">
+ AND cargo_name LIKE CONCAT('%',#{req.cargoName},'%')
+ </if>
+ <if test="req.driverName != null and req.driverName != ''">
+ AND driver_name LIKE CONCAT('%',#{req.driverName},'%')
+ </if>
+ <if test="req.weighbridgeNumber != null and req.weighbridgeNumber != ''">
+ AND weighbridge_number = #{req.weighbridgeNumber}
+ </if>
+ </where>
+ ORDER BY weight_time DESC, id DESC
+ </select>
+
+ <select id="dailyReport" resultType="java.util.Map">
+ SELECT
+ DATE_FORMAT(weight_time, '%Y-%m-%d') AS date,
+ COUNT(*) AS tripCount,
+ ROUND(SUM(IFNULL(net_weight, IFNULL(gross_weight, 0) - IFNULL(tare_weight, 0))) / 1000, 2) AS cargoVolume,
+ ROUND(AVG(IFNULL(position_offset, 0)), 2) AS deviationRate
+ FROM env_weighbridge_system
+ <where>
+ <if test="startDate != null and startDate != ''">
+ AND weight_time >= #{startDate}
+ </if>
+ <if test="endDate != null and endDate != ''">
+ AND weight_time <= #{endDate}
+ </if>
+ </where>
+ GROUP BY DATE_FORMAT(weight_time, '%Y-%m-%d')
+ ORDER BY date
+ </select>
+</mapper>
--
Gitblit v1.9.3