From 2f52450964665480f13c94c865bcac9027490380 Mon Sep 17 00:00:00 2001
From: wangrong <wangrong@shsening.com>
Date: 星期二, 29 九月 2026 22:49:41 +0800
Subject: [PATCH] fix-home-logo and repair the index overview
---
src/modules/push/service/open.ts | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/src/modules/push/service/open.ts b/src/modules/push/service/open.ts
index e165739..6aa7215 100644
--- a/src/modules/push/service/open.ts
+++ b/src/modules/push/service/open.ts
@@ -58,11 +58,13 @@
try {
// 1. 淇濆瓨鍘熷绉伴噸鏁版嵁
const rawWeight = new PushWeightEntity();
+ const rawWeightValue = data.garbageWeight || 0;
+ const processedWeight = this.calcProcessedWeight(data.garbageType, rawWeightValue);
rawWeight.deviceNo = data.deviceNo;
// rawWeight.uploadTime = data.uploadTime ? new Date(data.uploadTime) : new Date();
rawWeight.uploadTime = new Date();
rawWeight.garbageType = data.garbageType;
- rawWeight.weight = data.garbageWeight || 0;
+ rawWeight.weight = processedWeight;
rawWeight.extraData =
typeof data.extraData === 'object'
? JSON.stringify(data.extraData)
@@ -87,7 +89,6 @@
siteWeight.businessId = iotDevices[0].businessId;
siteWeight.departmentId = iotDevices[0].departmentId;
await this.pushSiteweightEntity.save(siteWeight);
-
} else {
siteWeight.businessId = 'UNKNOWN';
siteWeight.departmentId = -1;
@@ -582,4 +583,28 @@
}
}
+ /**
+ * 璁$畻澶勭悊鍚庣殑閲嶉噺
+ * 瑙勫垯锛�
+ * 1. 鍘荤毊閲嶏細骞插瀮鍦�/鍙洖鏀剁墿 -1kg锛屾箍鍨冨溇 -10kg锛屽叾瀹冪被鍨嬪悓骞插瀮鍦撅紙-1kg锛�
+ * 2. 鍘荤毊鍚庨噸閲� 脳 1/10
+ * 3. 缁撴灉涓嶅皬浜� 0
+ * SW60 鏈夋瘨鏈夊
+ * SW61 婀垮瀮鍦�
+ * SW62001 鍙洖鏀�-搴熺焊寮�
+ * SW62002 鍙洖鏀�-搴熷鏂�
+ * SW62003 鍙洖鏀�-搴熼噾灞�
+ * SW62004 鍙洖鏀�-搴熺幓鐠�
+ * SW62005 鍙洖鏀�-搴熺粐鐗�
+ * SW62006 鍙洖鏀�-搴熸棫鐢靛瓙浜у搧
+ * SW62007 鍙洖鏀�-搴熸棫鐢垫簮鐢垫睜
+ * SW63 澶т欢鍨冨溇
+ * SW64 骞插瀮鍦�
+ */
+ private calcProcessedWeight(garbageType: string, weight: number): number {
+ const TARE_MAP: Record<string, number> = { SW61: 10 };
+ const tareWeight = TARE_MAP[garbageType] ?? 1;
+ return Math.max((weight - tareWeight) / 10, 0);
+ }
+
}
\ No newline at end of file
--
Gitblit v1.9.1