From c1594b6c8de0005a53b03f0d23179d7a5b7537fb Mon Sep 17 00:00:00 2001
From: sinake <sinake1@qq.com>
Date: 星期二, 10 十一月 2026 09:10:08 +0800
Subject: [PATCH] 发票管理

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceInvoiceController.java |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceInvoiceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceInvoiceController.java
index f656021..3394cd3 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceInvoiceController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceInvoiceController.java
@@ -168,6 +168,7 @@
             String url = url1 + fileName;
             String base64= Base64.getEncoder().encodeToString(file.getBytes());
             List<Map<String,Object>> lists=aliOCR(base64,userId,caseId);
+            logger.info(JSON.toJSONString(lists));
             List<ServiceInvoice> invoiceList=new ArrayList<>();
             for(Map<String,Object> row : lists){
                 ServiceInvoice invoice=new ServiceInvoice();
@@ -177,14 +178,14 @@
                 if(ObjectUtils.isNotEmpty(caseId)) {
                     invoice.setCaseId(Long.parseLong(caseId));
                 }
-                invoice.setInvoiceType(row.get("鍙戠エ鍒嗙被")+"");
+                invoice.setInvoiceType(row.get("type")+"");
                 invoice.setInvoiceNo(row.get("鍙戠エ鍙风爜")+"");
                 invoice.setOccurDate(row.get("寮�绁ㄦ棩鏈�")+"");
-                invoice.setInvoiceAmount(row.get("閲戦")+"");
+                invoice.setInvoiceAmount(row.get("鍙戠エ閲戦")+"");
                 invoice.setSellerName(row.get("鍙楃エ鏂瑰悕绉�")+"");
                 invoice.setInvoiceUrl(url);
                 String invoiceName=newFilename.isEmpty() ? filename : newFilename;
-                invoice.setInvoiceName(invoiceName.split(".")[0]);
+                invoice.setInvoiceName(invoiceName.substring(0, invoiceName.lastIndexOf(".")));
                 invoice.setExtContent(JSON.toJSONString(row));
                 invoice.setCreateBy(userId);
                 invoice.setCreateTime(DateUtils.getNowDate());
@@ -221,6 +222,7 @@
             HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
             //鑾峰彇response鐨刡ody
             String content= EntityUtils.toString(response.getEntity());
+            logger.info(content);
             JSONObject jsonContent=JSONObject.parseObject(content);
             JSONArray subMsgs=jsonContent.getJSONArray("subMsgs");
 
@@ -234,19 +236,20 @@
                 for(Map.Entry<String, Object> entry : result.entrySet()){
                     tempList.put(entry.getKey(),entry.getValue());
                 }
-                if(rowObject.getString("鍙戠エ鍒嗙被").equals("閾惰鎵垮厬姹囩エ")){
+                if(rowObject.getString("type").equals("閾惰鎵垮厬姹囩エ")){
                     BigDecimal totalAmount= ChineseUtils.chineseToNumber(result.getString("绁ㄦ嵁閲戦澶у啓"));
-                    tempList.put("閲戦",totalAmount);
+                    tempList.put("鍙戠エ閲戦",totalAmount);
                 }
-                if(rowObject.getString("鍙戠エ鍒嗙被").equals("鐏溅绁�")){
-                    tempList.put("閲戦",result.getString("绁ㄤ环"));
+                if(rowObject.getString("type").equals("鐏溅绁�")){
+                    tempList.put("鍙戠エ閲戦",result.getString("绁ㄤ环"));
                 }
-
+                tempList.put("type",rowObject.getString("type"));
                 lists.add(tempList);
             }
 
             return lists;
         } catch (Exception e) {
+            logger.error(e.getMessage());
             return lists;
         }
     }

--
Gitblit v1.9.3