From a76e1d17d67641993dea6335cb8e1465a94df58d Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 21 五月 2026 15:39:05 +0800
Subject: [PATCH] feat(stock): 优化库存管理和成品树结构功能 1- 为ApproveProcessMapper.xml和ProductBomMapper.xml添加排序功能 2- 在ProductionProductMainDto中新增bomInputQty字段用于产品结构投入数量 3- 修改ProductionProductMainServiceImpl中投入数量计算逻辑,使用前端传入的bomInputQty值 4- 在ProductWorkOrderDto中添加bomInputQty字段并在服务实现中计算标准投入数量 5- 更新SalesLedgerMapper.xml查询逻辑,从product_summary获取电压信息 6- 为SalesLedgerProduct添加stockId字段并修改库存扣减逻辑使用具体库存ID 7- 重构StockInventoryController中的成品库存树查询接口和导入导出功能 8- 新增成品和非成品库存导入导出的数据模型和Excel工具类 9- 优化StockInventoryServiceImpl中的库存扣减逻辑,支持按特定库存ID操作 10- 更新库存导入导出功能,区分成品和非成品类型并提供相应模板

---
 src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java |   50 ++++++++++++++++++++++++++++++--------------------
 1 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java b/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
index 0a33b66..3de2b9e 100644
--- a/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
+++ b/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
@@ -1,5 +1,6 @@
 package com.ruoyi.project.system.service.impl;
 
+import com.alibaba.fastjson2.JSON;
 import com.getui.push.v2.sdk.ApiHelper;
 import com.getui.push.v2.sdk.GtApiConfiguration;
 import com.getui.push.v2.sdk.api.PushApi;
@@ -25,6 +26,7 @@
 import org.springframework.stereotype.Component;
 
 import javax.annotation.PostConstruct;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -84,6 +86,7 @@
 
             // 鎺ㄩ��
             sendRoutingPush(
+                    sysNotice.getNoticeId(),
                     client.getCid(),
                     sysNotice.getNoticeTitle(),
                     sysNotice.getRemark() != null ? sysNotice.getRemark() : sysNotice.getNoticeContent(),
@@ -95,7 +98,7 @@
     /**
      * 灏� Web 绔垎灞傚叏璺緞杞崲涓� App 绔粍浠惰矾鐢�
      */
-    private String convertWebPathToAppPath(String webPath) {
+    public String convertWebPathToAppPath(String webPath) {
         if (StringUtils.isEmpty(webPath)) {
             return DEFAULT_APP_PAGE;
         }
@@ -108,13 +111,12 @@
             queryString = webPath.substring(index);
         }
 
-        String[] pathSegments = pathOnly.split("/");
-        String lastSegment = "";
-        for (int i = pathSegments.length - 1; i >= 0; i--) {
-            if (StringUtils.isNotEmpty(pathSegments[i])) {
-                lastSegment = pathSegments[i];
-                break;
-            }
+        String lastSegment;
+        int lastSlashIndex = pathOnly.lastIndexOf("/");
+        if (lastSlashIndex != -1) {
+            lastSegment = pathOnly.substring(lastSlashIndex + 1);
+        } else {
+            lastSegment = pathOnly;
         }
 
         if (StringUtils.isEmpty(lastSegment)) {
@@ -124,11 +126,14 @@
         SysMenu menu = sysMenuMapper.selectMenuByPath(lastSegment);
 
         if (menu != null && StringUtils.isNotEmpty(menu.getAppComponent())) {
-            String appComponent = menu.getAppComponent();
-            if (appComponent.startsWith("/")) {
-                appComponent = appComponent.substring(1);
+            String appPath = menu.getAppComponent();
+
+            if (appPath.startsWith("/")) {
+                appPath = appPath.substring(1);
             }
-            return appComponent + queryString;
+
+            //  鎷兼帴 Web 绔師濮嬪弬鏁板苟杩斿洖
+            return appPath + queryString;
         }
 
         return DEFAULT_APP_PAGE;
@@ -137,18 +142,23 @@
     /**
      * 鍙戦�佸崟浜鸿矾鐢辨帹閫�
      */
-    private void sendRoutingPush(String cid, String title, String content, String targetPath) {
-        log.info("鍑嗗鎺ㄩ�佹秷鎭�: CID={}, Title={}, TargetPath={}", cid, title, targetPath);
+    private void sendRoutingPush(Long noticeId, String cid, String title, String content, String targetPath) {
+        log.info("鍑嗗鎺ㄩ�佹秷鎭�:NoticeId={}, CID={}, Title={}, TargetPath={}", noticeId, cid, title, targetPath);
 
         PushDTO<Audience> pushDTO = new PushDTO<>();
         pushDTO.setRequestId("REQ_" + System.currentTimeMillis());
 
         // 鍦ㄧ嚎閫忎紶鍐呭
         PushMessage pushMessage = new PushMessage();
-        String transmissionContent = String.format(
-                "{\"title\":\"%s\",\"content\":\"%s\",\"payload\":\"%s\"}",
-                title, content, targetPath
-        );
+        Map<String, Object> pushMessageMap = new HashMap<>();
+        Map<String, Object> payloadMap = new HashMap<>();
+        pushMessageMap.put("title", title);
+        pushMessageMap.put("content", content);
+        payloadMap.put("url", targetPath);
+        payloadMap.put("noticeId", noticeId);
+        pushMessageMap.put("payload", JSON.toJSONString(payloadMap));
+
+        String transmissionContent = JSON.toJSONString(pushMessageMap);
         pushMessage.setTransmission(transmissionContent);
         pushDTO.setPushMessage(pushMessage);
 
@@ -158,7 +168,7 @@
         pushDTO.setAudience(audience);
 
         // 绂荤嚎鎺ㄩ�侀�氶亾
-        pushDTO.setPushChannel(getPushChannel(title, content, targetPath));
+//        pushDTO.setPushChannel(getPushChannel(noticeId, title, content, targetPath));
 
         try {
             ApiResult<Map<String, Map<String, String>>> result = pushApi.pushToSingleByCid(pushDTO);
@@ -173,7 +183,7 @@
     }
 
     @NotNull
-    private PushChannel getPushChannel(String title, String content, String targetPath) {
+    private PushChannel getPushChannel(Long noticeId, String title, String content, String targetPath) {
         PushChannel pushChannel = new PushChannel();
         AndroidDTO androidDTO = new AndroidDTO();
         Ups ups = new Ups();

--
Gitblit v1.9.3