From de6b1898b4ff8579adde95a37ff0b411d17f5536 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期二, 19 八月 2025 14:26:58 +0800
Subject: [PATCH] update

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderServiceImpl.java |   68 ++++++++++++++++++++++++++++++----
 1 files changed, 60 insertions(+), 8 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderServiceImpl.java
index f99a18d..e5cd5b0 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OrderServiceImpl.java
@@ -170,10 +170,12 @@
         BusinessVO vo = new BusinessVO();
         // 先查企业工商信息 更新数据
         JSONObject jsonObject = getQiChaChaBasicDetailsCompany(company.getCompanyName());
+        Object result = jsonObject.get("Result");
+        jsonObject = JSONObject.parseObject(result.toString());
         company.setOperName(jsonObject.getString("OperName"));
         company.setBelongOrg(jsonObject.getString("BelongOrg"));
         company.setRegistrationStatus(jsonObject.getString("Status"));
-              company.setRegisteredCapital(jsonObject.getString("RegisteredCapital"));
+        company.setRegisteredCapital(jsonObject.getString("RegisteredCapital"));
         company.setPaidInFunds(jsonObject.getString("PaidUpCapital"));
         companyMapper.updateById(company);
         BeanUtils.copyProperties(company, vo);
@@ -191,6 +193,9 @@
 
         String name = companyTypeService.getById(company.getCompanyCategory()).getName();
         vo.setCompanyCategoryName(name);
+        vo.setOperName(company.getOperName());
+        vo.setBelongOrg(company.getBelongOrg());
+        vo.setRegistrationStatus(company.getRegistrationStatus());
         return vo;
     }
 
@@ -329,7 +334,11 @@
         if (null == companyInfo || companyInfo.getIsDelete() != 0) {
             throw new ServiceException("公司不存在");
         }
-        JSONObject jsonObject=getReport(companyInfo.getLink().split("=")[1]);
+        String link = companyInfo.getLink();
+        if(link==null){
+            return R.ok(changeVO);
+        }
+        JSONObject jsonObject=getReport(extractSnFromUrl(link));
 //        JSONObject jsonObject=getReport("ZZD20250508017232394218445");
         if (!"1001".equals(jsonObject.getString("code"))){
             return R.fail(jsonObject.get("msg"));
@@ -349,6 +358,36 @@
 
         return R.ok(changeVO);
     }
+    /**
+     * 从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);
+    }
 
     @Override
     public R tax(String id) {
@@ -357,7 +396,11 @@
         if (null == companyInfo || companyInfo.getIsDelete() != 0) {
             throw new ServiceException("公司不存在");
         }
-        JSONObject jsonObject=getReport(companyInfo.getLink().split("=")[1]);
+        String link = companyInfo.getLink();
+        if (link == null) {
+            return R.ok(taxVO);
+        }
+        JSONObject jsonObject=getReport(extractSnFromUrl(link));
 //        JSONObject jsonObject=getReport("ZZD20250508017232394218445");
         if (!"1001".equals(jsonObject.getString("code"))){
             return R.fail(jsonObject.get("msg"));
@@ -426,7 +469,11 @@
         if (null != taxPrevMnMthsOverdueFineInfoDict){
             JSONObject taxPrev12mthsOverdueFineInfo = taxPrevMnMthsOverdueFineInfoDict.getJSONObject("taxPrev12mthsOverdueFineInfo");
             if (null!= taxPrev12mthsOverdueFineInfo){
-                taxVO.setOverdueFineInfoAmt12( (BigDecimal) taxPrev12mthsOverdueFineInfo.get("overdueFineInfoAmt"));
+                Object o = taxPrev12mthsOverdueFineInfo.get("overdueFineInfoAmt");
+                if(o!=null){
+                    taxVO.setOverdueFineInfoAmt12( new BigDecimal(o.toString()) );
+                }
+
                 taxVO.setOverdueFineInfoCnt12( (Integer) taxPrev12mthsOverdueFineInfo.get("overdueFineInfoCnt"));
             }
             // 近3个月滞纳金金额(元)
@@ -458,7 +505,11 @@
         if (null == companyInfo || companyInfo.getIsDelete() != 0) {
             throw new ServiceException("公司不存在");
         }
-        JSONObject jsonObject=getReport(companyInfo.getLink().split("=")[1]);
+        String link = companyInfo.getLink();
+        if(link==null){
+            return R.ok(vo);
+        }
+        JSONObject jsonObject=getReport(extractSnFromUrl(link));
 //        JSONObject jsonObject=getReport("ZZD20250508017232394218445");
         if (!"1001".equals(jsonObject.getString("code"))){
             return R.fail(jsonObject.get("msg"));
@@ -471,9 +522,10 @@
 
         //近一个月开票金额(元)
         JSONArray f4yPer1mDownFpInfoList = (JSONArray) invoiceInfo.get("f4yPer1mDownFpInfoList");
-        JSONObject f4yPer1mDownFpInfo1 = (JSONObject) f4yPer1mDownFpInfoList.get(1);
-        vo.setHjjeZc1( ObjectToBigDecimal(f4yPer1mDownFpInfo1.get("hjjeZc")) );
-
+        if(f4yPer1mDownFpInfoList!=null){
+            JSONObject f4yPer1mDownFpInfo1 = (JSONObject) f4yPer1mDownFpInfoList.get(1);
+            vo.setHjjeZc1( ObjectToBigDecimal(f4yPer1mDownFpInfo1.get("hjjeZc")) );
+        }
 
         JSONObject fpPrevMnMthsDownFpInfoList = (JSONObject) invoiceInfo.get("fpPrevMnMthsDownFpInfoList");
         JSONObject fpPrev3mthsDownFpInfoList = (JSONObject) fpPrevMnMthsDownFpInfoList.get("fpPrev3mthsDownFpInfoList");

--
Gitblit v1.7.1