From 14c10d5021513463109aa800aeb3e8dbf479b05c Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期四, 28 八月 2025 10:58:11 +0800
Subject: [PATCH] update

---
 ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/CompanyController.java |   79 ++++++++++++++++++++++++++++++---------
 1 files changed, 61 insertions(+), 18 deletions(-)

diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/CompanyController.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/CompanyController.java
index edeb7f5..91a25fd 100644
--- a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/CompanyController.java
+++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/system/CompanyController.java
@@ -149,7 +149,7 @@
     }
 
     public static void main(String[] args) {
-        Object report = getReport("ZZD20250321019744801521301");
+        Object report = getReport("ZZE2025070102412440776825");
         System.out.println(report);
     }
     @ApiOperation(value = "立即发布",tags = {"发布模块"})
@@ -165,14 +165,17 @@
             return R.fail("该公司已发布");
         }
         // 判断水母报告和 公司名称是否一致
-        String link = dto.getLink();
-        String[] split = link.split("=");
-        String sign =split [split.length-1];
-        boolean b = checkName(dto.getCompanyName(), sign);
-        if(b){
-            return R.fail("水母报告和公司名称不一致");
+        if(dto.getTaxpayerType()!=3){
+            if(dto.getLink()==null){
+                return R.fail("请上传水母报告");
+            }
+            String link = dto.getLink();
+            String sign = extractSnFromUrl(link);
+            boolean b = checkName(dto.getCompanyName(), sign);
+            if(b){
+                return R.fail("水母报告和公司名称不一致");
+            }
         }
-
         String companyId = tbCompanyService.pushCompany(dto, userId);
         return R.ok(companyId);
     }
@@ -225,12 +228,16 @@
             return R.fail("订单状态不能修改");
         }
         // 判断水母报告和 公司名称是否一致
-        String link = dto.getLink();
-        String[] split = link.split("=");
-        String sign =split [split.length-1];
-        boolean b = checkName(dto.getCompanyName(), sign);
-        if(b){
-            return R.fail("水母报告和公司名称不一致");
+        if(dto.getTaxpayerType()!=3){
+            if(dto.getLink()==null){
+                return R.fail("请上传水母报告");
+            }
+            String link = dto.getLink();
+            String sign = extractSnFromUrl(link);
+            boolean b = checkName(dto.getCompanyName(), sign);
+            if(b){
+                return R.fail("水母报告和公司名称不一致");
+            }
         }
         tbCompanyService.editCompany(dto,company,userId);
         return R.ok(dto.getId());
@@ -389,6 +396,7 @@
         return jsonObject;
     }
 
+
     @ApiOperation(value = "已完成",tags = {"发布模块"})
     @PostMapping("/saleSuccessOrder")
     public R<?> saleSuccessOrder(String orderId) {
@@ -458,14 +466,49 @@
             return R.fail("参数错误");
         }
         TbCompany company = tbCompanyService.getById(companyId);
+
         String link = company.getLink();
-        String[] split = link.split("=");
-        String sign =split [split.length-1];
-        Object report = getReport(sign);
-        return R.ok(report);
+        if(link!=null){
+            String sign = extractSnFromUrl(link);
+            Object report = getReport(sign);
+            return R.ok(report);
+        }else {
+            return R.ok(new Object());
+        }
+
     }
 
 
+    /**
+     * 从URL中提取sn参数
+     * @param url 包含sn参数的URL
+     * @return sn参数值
+     */
+    public static String extractSnFromUrl(String url) {
+        if (url == null || url.isEmpty()) {
+            return null;
+        }
+
+        // 查找sn参数的位置
+        String snParam = "sn=";
+        int startIndex = url.indexOf(snParam);
+
+        if (startIndex == -1) {
+            return null; // 未找到sn参数
+        }
+
+        // 计算sn值的起始位置
+        startIndex += snParam.length();
+
+        // 查找sn值的结束位置(遇到&或字符串结束)
+        int endIndex = url.indexOf("&", startIndex);
+        if (endIndex == -1) {
+            endIndex = url.length();
+        }
+
+        // 提取并返回sn值
+        return url.substring(startIndex, endIndex);
+    }
 
 
 

--
Gitblit v1.7.1