瀏覽代碼

Merge branch 'master' of https://mc.cloudpure.cn/mjava/cont

wzy 1 月之前
父節點
當前提交
586e7a27b0

+ 13 - 2
mjava-huagao/src/main/java/com/malk/huagao/service/impl/KdYdOrderServiceImpl.java

@@ -212,7 +212,7 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
                     String bz1 = safeGetString(item, "textareaField_mjryuaok");
                     int sl = parseInt(safeGetString(item, "numberField_mfbx1prb"), 0);
                     BigDecimal zse = toBigDecimal(safeGetString(item, "numberField_mfbx1prh"));
-                    BigDecimal bbh = toBigDecimal(safeGetString(item, "numberField_mowq936x"));
+                    BigDecimal bbh = toBigDecimal1(safeGetString(item, "numberField_mowq936x"));
                     BigDecimal zje = toBigDecimal(safeGetString(item, "numberField_mfbx1pri"));
                     BigDecimal zjshj = toBigDecimal(safeGetString(item, "numberField_mfbx1prj"));
                     BigDecimal jj = toBigDecimal(safeGetString(item, "numberField_mfbx1prk"));
@@ -774,7 +774,18 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
             return BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
         }
     }
-
+    public static BigDecimal toBigDecimal1(String str) {
+        if (str == null || str.trim().isEmpty()) {
+            return BigDecimal.ZERO.setScale(6, RoundingMode.HALF_UP);
+        }
+        try {
+            return new BigDecimal(str.trim())
+                    .setScale(6, RoundingMode.HALF_UP);
+        } catch (NumberFormatException e) {
+            // 返回默认值而不是抛出异常,避免程序中断
+            return BigDecimal.ZERO.setScale(6, RoundingMode.HALF_UP);
+        }
+    }
     /**
      * 重载方法,支持Number类型输入
      */

+ 33 - 19
mjava-qiwang/src/main/java/com/malk/qiwang/Controller/CompanyTitleController.java

@@ -73,9 +73,6 @@ private YDClient ydClient;
         int successCount = 0;
         int failCount = 0;
 
-        // 用于记录处理的税号,避免重复处理同一个税号(可选,根据业务需求)
-        Set<String> processedTaxIds = new HashSet<>();
-
         for (String instanceId : allInstanceIds) {
             try {
                 // 获取审批实例详情
@@ -83,7 +80,7 @@ private YDClient ydClient;
 
                 if (processInstance != null) {
                     // 提取并保存公司抬头数据
-                    boolean result = saveCompanyTitleFromInstance(processInstance, processedTaxIds);
+                    boolean result = saveCompanyTitleFromInstance(processInstance);
                     if (result) {
                         successCount++;
                     } else {
@@ -102,8 +99,7 @@ private YDClient ydClient;
 
         return McR.success();
     }
-
-    private boolean saveCompanyTitleFromInstance(Map<String, Object> processInstance, Set<String> processedTaxIds) {
+    private boolean saveCompanyTitleFromInstance(Map<String, Object> processInstance) {
         List<Map<String, Object>> formComponentValues =
                 (List<Map<String, Object>>) processInstance.get("formComponentValues");
 
@@ -168,16 +164,18 @@ private YDClient ydClient;
             return false;
         }
 
-        // 可选:避免重复处理同一个税号
-        if (processedTaxIds.contains(sh)) {
-            log.debug("税号 {} 已处理过,跳过", sh);
-            return false;
-        }
+        // 打印日志查看税号
+        log.info("处理税号: {}", sh);
 
         // 查询数据库中该税号的最新记录
-        CompanyTitle existing = companyTitleMapper.selectByTaxId(sh);
+        CompanyTitle existing = companyTitleMapper.selectByTaxId1(sh);
+
+        // 打印查询结果
+        log.info("查询数据库结果: existing={}", existing != null ? "存在" : "不存在");
 
         if (existing != null) {
+            log.info("税号 {} 已存在,执行更新操作", sh);
+
             // 比较审批时间,判断是否为最新数据
             if (finishTime != null && existing.getUpdatedAt() != null) {
                 long existingTime = existing.getUpdatedAt().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
@@ -188,7 +186,7 @@ private YDClient ydClient;
                 }
             }
 
-            // 更新
+            // 更新现有记录
             existing.setCompanyName(tt);
             existing.setAddress(dz);
             existing.setPhone(dh);
@@ -197,10 +195,19 @@ private YDClient ydClient;
             existing.setStatus("启用".equals(zt) ? (byte) 0 : (byte) 1);
             existing.setUpdatedAt(LocalDateTime.now());
 
-            companyTitleMapper.updateById(existing);
-            log.info("公司抬头更新成功: taxId={}, 审批时间={}", sh, finishTime);
+            int updateResult = companyTitleMapper.updateById(existing);
+            log.info("更新结果: {}, 税号: {}", updateResult, sh);
+
+            if (updateResult > 0) {
+                log.info("公司抬头更新成功: taxId={}, 审批时间={}", sh, finishTime);
+            } else {
+                log.warn("公司抬头更新失败: taxId={}", sh);
+                return false;
+            }
         } else {
-            // 新增
+            // 税号不存在时才新增
+            log.info("税号 {} 不存在,执行新增操作", sh);
+
             CompanyTitle companyTitle = new CompanyTitle();
             companyTitle.setCompanyName(tt);
             companyTitle.setTaxId(sh);
@@ -212,11 +219,18 @@ private YDClient ydClient;
             companyTitle.setCreatedAt(LocalDateTime.now());
             companyTitle.setUpdatedAt(LocalDateTime.now());
 
-            companyTitleMapper.insert(companyTitle);
-            log.info("公司抬头新增成功: taxId={}", sh);
+            int insertResult = companyTitleMapper.insert(companyTitle);
+            log.info("新增结果: {}, 税号: {}", insertResult, sh);
+
+            if (insertResult > 0) {
+                log.info("公司抬头新增成功: taxId={}", sh);
+            } else {
+                log.warn("公司抬头新增失败: taxId={}", sh);
+                return false;
+            }
         }
 
-        processedTaxIds.add(sh);
+        companyTitleMapper.delZT();
         return true;
     }
 }

+ 9 - 2
mjava-qiwang/src/main/java/com/malk/qiwang/Controller/InvoiceLibraryController.java

@@ -54,7 +54,7 @@ public class InvoiceLibraryController {
     private static final String url = "http://47.103.203.2:9092/qiwang/";
             //员工报销
     @PostMapping("/invoiceLibrary")
-    public McR test(@RequestBody Map map) {
+    public McR test(@RequestBody Map map)  {
         log.info("map:{}", map);
         invoiceLibrary.invoiceLibrary(map);
        return McR.success();
@@ -91,7 +91,7 @@ public class InvoiceLibraryController {
         return McR.success();
     }
 
-    //付款申请(一对多)
+    //批量付款申请(一对多)
     @PostMapping("/invoiceLibrary6")
     public McR invoiceLibrary6(@RequestBody Map map) {
         log.info("map:{}", map);
@@ -110,6 +110,13 @@ public class InvoiceLibraryController {
         invoiceLibrary.updateOaStatusByOaId(map);
         return McR.success();
     }
+
+    @PostMapping("/updateSfctByOaId")
+    public McR updateSfctByOaId(@RequestBody Map map) {
+        log.info("map:{}", map);
+        invoiceLibrary.updateSfctByOaId(map);
+        return McR.success();
+    }
     @PostMapping("/deleteAll")
     public McR deleteAllByOaId(@RequestParam("oaId") String oaId) {
 

+ 2 - 1
mjava-qiwang/src/main/java/com/malk/qiwang/Controller/QiWangController.java

@@ -68,6 +68,7 @@ public class QiWangController {
     private DDClient_Workflow ddClientWorkflow ;
     @Autowired
     private DDClient_Contacts ddClient_contacts;
+    private static final String bdurl = "D://qiwang//files//";
     private static final String url = "http://47.103.203.2:9092/qiwang/";
     @PostMapping("/test")
     public McR test(@RequestBody Map map) {
@@ -374,7 +375,7 @@ public McR test4(@RequestBody Map map) {
             @RequestParam(defaultValue = "download") String option) throws IOException {
 
         // 根据fileId获取实际文件路径,这里简化处理,实际可能需要从数据库查询
-        Path filePath = Paths.get("C://Users//EDY//Desktop//项目//琦王//files//").resolve(fileId).normalize();
+        Path filePath = Paths.get(bdurl).resolve(fileId).normalize();
 
         // 检查文件是否存在
         if (!Files.exists(filePath)) {

+ 2 - 0
mjava-qiwang/src/main/java/com/malk/qiwang/Service/IInvoiceLibraryService.java

@@ -33,4 +33,6 @@ public interface IInvoiceLibraryService extends IService<InvoiceLibrary> {
     McR invoiceLibrary5(Map map);
 
     McR invoiceLibrary6(Map map);
+
+    void updateSfctByOaId(Map map);
 }

+ 326 - 91
mjava-qiwang/src/main/java/com/malk/qiwang/Service/impl/InvoiceLibraryServiceImpl.java

@@ -60,6 +60,7 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.concurrent.CompletableFuture;
 import java.util.stream.Collectors;
 
 /**
@@ -131,6 +132,10 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
             BigDecimal mainJe = null;
             String bxlb = null;
             String bm = null;
+            String fkzhxx = null;
+            String fkzh = null;
+            String yhqc = null;
+            String sfct = null;
 
             // 遍历收集主表字段值
             for (Map formComponentValue : formComponentValues) {
@@ -155,17 +160,29 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                 if ("DDSelectField_1TP75OVCPAAO0".equals(id)) {
                     bxlb = value != null ? String.valueOf(value) : "";
                 }
-                if ("DepartmentField_OKBSJN0MD6O0".equals(id)) {
+                if ("DepartmentField_1RD2SROH579C0".equals(id)) {
                     bm = value != null ? String.valueOf(value) : "";
                 }
+                if ("DDSelectField_11D6S45JKFHS0".equals(id)) {
+                    fkzhxx = value != null ? String.valueOf(value) : "";
+                }
+                if ("TextField_1S1VV9PIIQWW0".equals(id)) {
+                    fkzh = value != null ? String.valueOf(value) : "";
+                }
+                if ("TextField_ZUVAAH3FIGW0".equals(id)) {
+                    yhqc = value != null ? String.valueOf(value) : "";
+                }
+                if ("DDSelectField_DEKPLHARB6O0".equals(id)) {
+                    sfct = value != null ? String.valueOf(value) : "否";
+                }
             }
 
             // 判断主表状态 - 无发票
             if ("否".equals(zt)) {
-                Map<String, Object> result = new HashMap<>();
-                result.put("je", mainJe);
-                result.put("status", "否");
-                result.put("message", "无发票报销");
+//                Map<String, Object> result = new HashMap<>();
+//                result.put("je", mainJe);
+//                result.put("status", "否");
+//                result.put("message", "无发票报销");
                 // 保存基础报销记录
                 InvoiceLibrary baseInvoice = new InvoiceLibrary();
                 baseInvoice.setOaId(processInstanceId);
@@ -186,9 +203,14 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                 baseInvoice.setBuyerTaxId("");
                 baseInvoice.setSellerName("");
                 baseInvoice.setSellerTaxId("");
+                baseInvoice.setFormName("员工费用报销");
+                baseInvoice.setPaySubject(fkzhxx != null ? fkzhxx : "");
+                baseInvoice.setPayAccount(fkzh != null ? fkzh : "");
+                baseInvoice.setBankName(yhqc != null ? yhqc : "");
+                baseInvoice.setIsLongTerm(sfct != null ? sfct : "");
                 baseMapper.insert(baseInvoice);
-                addWorkflowComment(processInstanceId, userId, result);
-                return McR.success(result);
+                addWorkflowComment(processInstanceId, userId, "报销总金额:"+mainJe);
+                return McR.success();
             }
 
             // 判断主表状态 - 有发票
@@ -341,7 +363,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 terminateWorkflow(accessToken, processInstanceId, userId, errorMsg);
                                 return McR.error("400", errorMsg);
                             }
-
+                            BigDecimal totalAmount = BigDecimal.ZERO;
                             // ========== 第二遍遍历:保存发票数据(校验通过后) ==========
                             for (Map<String, Object> parsedData : parsedInvoiceDataList) {
                                 JSONObject invoice = (JSONObject) parsedData.get("invoice");
@@ -349,7 +371,11 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 Object responseData = parsedData.get("responseData");
 
                                 allResults.add(responseData);
-
+                                // 汇总 amount
+                                BigDecimal amount = invoice.getBigDecimal("amount");
+                                if (amount != null) {
+                                    totalAmount = totalAmount.add(amount);
+                                }
                                 // 构建InvoiceLibrary对象
                                 InvoiceLibrary invoiceLibrary = new InvoiceLibrary();
                                 invoiceLibrary.setOaId(processInstanceId);
@@ -374,6 +400,11 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 invoiceLibrary.setSellerName(invoice.getString("sellerName") != null ? invoice.getString("sellerName") : "");
                                 invoiceLibrary.setSellerTaxId(invoice.getString("sellerTaxId") != null ? invoice.getString("sellerTaxId") : "");
                                 invoiceLibrary.setOaStatus("0");
+                                invoiceLibrary.setFormName("员工费用报销");
+                                invoiceLibrary.setPaySubject(fkzhxx != null ? fkzhxx : "");
+                                invoiceLibrary.setPayAccount(fkzh != null ? fkzh : "");
+                                invoiceLibrary.setBankName(yhqc != null ? yhqc : "");
+                                invoiceLibrary.setIsLongTerm(sfct != null ? sfct : "");
                                 invoiceLibrary.setInvoiceStatus("0");
                                 invoiceLibrary.setDep(bm != null ? bm : "");
                                 invoiceLibrary.setAccountTitle(bxlb != null ? bxlb : "");
@@ -392,7 +423,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 log.info("成功保存 {} 条发票记录", invoiceList.size());
                             }
 
-                            addWorkflowComment(processInstanceId, userId, allResults);
+                            addWorkflowComment1(processInstanceId, userId, totalAmount);
                             return McR.success(allResults);
 
                         } catch (Exception e) {
@@ -420,8 +451,30 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
      * @param remark 终止原因备注
      */
     private void terminateWorkflow(String accessToken, String processInstanceId, String operatingUserId, String remark) {
+        // 异步延迟15秒后执行终止
+        CompletableFuture.runAsync(() -> {
+            try {
+                log.info("延迟15秒后开始终止审批流程: processInstanceId={}, remark={}", processInstanceId, remark);
+                Thread.sleep(15000);
+
+                // 实际执行终止操作
+                doTerminateWorkflow(accessToken, processInstanceId, operatingUserId, remark);
+
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                log.error("延迟终止流程被中断: processInstanceId={}", processInstanceId, e);
+            } catch (Exception e) {
+                log.error("异步执行终止流程异常: processInstanceId={}", processInstanceId, e);
+            }
+        });
+    }
+
+    /**
+     * 实际执行钉钉审批流程终止
+     */
+    private void doTerminateWorkflow(String accessToken, String processInstanceId, String operatingUserId, String remark) {
         try {
-            log.info("开始终止审批流程: processInstanceId={}, remark={}", processInstanceId, remark);
+            log.info("开始调用钉钉API终止审批流程: processInstanceId={}", processInstanceId);
 
             // 构建请求URL
             String url = "https://api.dingtalk.com/v1.0/workflow/processInstances/terminate";
@@ -438,6 +491,8 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
             requestBody.put("remark", remark);
             requestBody.put("operatingUserId", operatingUserId);
 
+            log.info("钉钉终止请求参数: {}", requestBody);
+
             // 发送POST请求
             HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(requestBody, headers);
             RestTemplate restTemplate = new RestTemplate();
@@ -445,9 +500,6 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
 
             if (response.getStatusCode().is2xxSuccessful()) {
                 log.info("审批流程终止成功: processInstanceId={}, response={}", processInstanceId, response.getBody());
-
-                // 同时添加审批评论,让用户更清楚终止原因
-//                addWorkflowComment(processInstanceId, operatingUserId, "流程已终止,原因: " + remark);
             } else {
                 log.error("审批流程终止失败: processInstanceId={}, statusCode={}, response={}",
                         processInstanceId, response.getStatusCode(), response.getBody());
@@ -780,6 +832,10 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
             BigDecimal mainJe = null;
             String bxlb = null;
             String bm = null;
+            String fkzhxx = null;
+            String fkzh = null;
+            String yhqc = null;
+            String sfct = null;
 
             // 遍历收集主表字段值
             for (Map formComponentValue : formComponentValues) {
@@ -807,14 +863,27 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                 if ("DepartmentField_RF93A6VHA9C0".equals(id)) {
                     bm = value != null ? String.valueOf(value) : "";
                 }
+                if ("DDSelectField_23RVAEKUM5UO0".equals(id)) {
+                    fkzhxx = value != null ? String.valueOf(value) : "";
+                }
+                if ("TextField_1TE3AOHRMD4W0".equals(id)) {
+                    fkzh = value != null ? String.valueOf(value) : "";
+                }
+                if ("TextField_EN2MDZIMUTK0".equals(id)) {
+                    yhqc = value != null ? String.valueOf(value) : "";
+                }
+                if ("DDSelectField_P2EFYKN5ALC0".equals(id)) {
+                    sfct = value != null ? String.valueOf(value) : "否";
+                }
+
             }
 
             // 判断主表状态 - 无发票
             if ("否".equals(zt)) {
-                Map<String, Object> result = new HashMap<>();
-                result.put("je", mainJe);
-                result.put("status", "否");
-                result.put("message", "无发票报销");
+//                Map<String, Object> result = new HashMap<>();
+//                result.put("je", mainJe);
+//                result.put("status", "否");
+//                result.put("message", "无发票报销");
                 // 保存基础报销记录
                 InvoiceLibrary baseInvoice = new InvoiceLibrary();
                 baseInvoice.setOaId(processInstanceId);
@@ -822,6 +891,10 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                 baseInvoice.setInvoiceStatus("0");
                 baseInvoice.setDep(bm != null ? bm : "");
                 baseInvoice.setAccountTitle(bxlb != null ? bxlb : "");
+                baseInvoice.setPaySubject(fkzhxx != null ? fkzhxx : "");
+                baseInvoice.setPayAccount(fkzh != null ? fkzh : "");
+                baseInvoice.setBankName(yhqc != null ? yhqc : "");
+                baseInvoice.setIsLongTerm(sfct != null ? sfct : "");
                 baseInvoice.setPayAmount(mainJe != null ? mainJe : BigDecimal.ZERO);
                 baseInvoice.setCreatedAt(LocalDateTime.now());
                 baseInvoice.setUpdatedAt(LocalDateTime.now());
@@ -835,9 +908,10 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                 baseInvoice.setBuyerTaxId("");
                 baseInvoice.setSellerName("");
                 baseInvoice.setSellerTaxId("");
+                baseInvoice.setFormName("付款申请");
                 baseMapper.insert(baseInvoice);
-                addWorkflowComment(processInstanceId, userId, result);
-                return McR.success(result);
+                addWorkflowComment(processInstanceId, userId, "报销总金额:"+mainJe);
+                return McR.success();
             }
 
             // 判断主表状态 - 有发票
@@ -990,7 +1064,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 terminateWorkflow(accessToken, processInstanceId, userId, errorMsg);
                                 return McR.error("400", errorMsg);
                             }
-
+                            BigDecimal totalAmount = BigDecimal.ZERO;
                             // ========== 第二遍遍历:保存发票数据(校验通过后) ==========
                             for (Map<String, Object> parsedData : parsedInvoiceDataList) {
                                 JSONObject invoice = (JSONObject) parsedData.get("invoice");
@@ -998,7 +1072,10 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 Object responseData = parsedData.get("responseData");
 
                                 allResults.add(responseData);
-
+                                BigDecimal amount = invoice.getBigDecimal("amount");
+                                if (amount != null) {
+                                    totalAmount = totalAmount.add(amount);
+                                }
                                 // 构建InvoiceLibrary对象
                                 InvoiceLibrary invoiceLibrary = new InvoiceLibrary();
                                 invoiceLibrary.setOaId(processInstanceId);
@@ -1023,7 +1100,12 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 invoiceLibrary.setSellerName(invoice.getString("sellerName") != null ? invoice.getString("sellerName") : "");
                                 invoiceLibrary.setSellerTaxId(invoice.getString("sellerTaxId") != null ? invoice.getString("sellerTaxId") : "");
                                 invoiceLibrary.setOaStatus("0");
+                                invoiceLibrary.setFormName("付款申请");
                                 invoiceLibrary.setInvoiceStatus("0");
+                                invoiceLibrary.setPaySubject(fkzhxx != null ? fkzhxx : "");
+                                invoiceLibrary.setPayAccount(fkzh != null ? fkzh : "");
+                                invoiceLibrary.setBankName(yhqc != null ? yhqc : "");
+                                invoiceLibrary.setIsLongTerm(sfct != null ? sfct : "");
                                 invoiceLibrary.setDep(bm != null ? bm : "");
                                 invoiceLibrary.setAccountTitle(bxlb != null ? bxlb : "");
                                 invoiceLibrary.setPayAmount(mainJe != null ? mainJe : BigDecimal.ZERO);
@@ -1041,7 +1123,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 log.info("成功保存 {} 条发票记录", invoiceList.size());
                             }
 
-                            addWorkflowComment(processInstanceId, userId, allResults);
+                            addWorkflowComment1(processInstanceId, userId, totalAmount);
                             return McR.success(allResults);
 
                         } catch (Exception e) {
@@ -1094,7 +1176,10 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
             BigDecimal mainJe = null;
             String bxlb = null;
             String bm = null;
-
+            String fkzhxx = null;
+            String fkzh = null;
+            String yhqc = null;
+            String sfct = null;
             // 遍历收集主表字段值
             for (Map formComponentValue : formComponentValues) {
                 String id = String.valueOf(formComponentValue.get("id"));
@@ -1118,17 +1203,29 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                 if ("DDSelectField_YLLB7AD1ATS0".equals(id)) {
                     bxlb = value != null ? String.valueOf(value) : "";
                 }
-//                if ("DepartmentField_OKBSJN0MD6O0".equals(id)) {
-//                    bm = value != null ? String.valueOf(value) : "";
-//                }
+                if ("DepartmentField_ZI9KALEYOTC0".equals(id)) {
+                    bm = value != null ? String.valueOf(value) : "";
+                }
+                if ("DDSelectField_1WEX2WWCJ3PC0".equals(id)) {
+                    fkzhxx = value != null ? String.valueOf(value) : "";
+                }
+                if ("TextField_2W39FPCZH1A0".equals(id)) {
+                    fkzh = value != null ? String.valueOf(value) : "";
+                }
+                if ("TextField_QW7HJIR7T800".equals(id)) {
+                    yhqc = value != null ? String.valueOf(value) : "";
+                }
+                if ("DDSelectField_12JNC3P1K5V40".equals(id)) {
+                    sfct = value != null ? String.valueOf(value) : "否";
+                }
             }
 
             // 判断主表状态 - 无发票
             if ("否".equals(zt)) {
-                Map<String, Object> result = new HashMap<>();
-                result.put("je", mainJe);
-                result.put("status", "否");
-                result.put("message", "无发票报销");
+//                Map<String, Object> result = new HashMap<>();
+//                result.put("总金额", mainJe);
+//                result.put("status", "否");
+//                result.put("message", "无发票报销");
                 // 保存基础报销记录
                 InvoiceLibrary baseInvoice = new InvoiceLibrary();
                 baseInvoice.setOaId(processInstanceId);
@@ -1141,6 +1238,10 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                 baseInvoice.setUpdatedAt(LocalDateTime.now());
                 baseInvoice.setInvoiceCode("");
                 baseInvoice.setInvoiceNumber("");
+                baseInvoice.setPaySubject(fkzhxx != null ? fkzhxx : "");
+                baseInvoice.setPayAccount(fkzh != null ? fkzh : "");
+                baseInvoice.setBankName(yhqc != null ? yhqc : "");
+                baseInvoice.setIsLongTerm(sfct != null ? sfct : "");
                 baseInvoice.setInvoiceType("");
                 baseInvoice.setAmount(BigDecimal.ZERO);
                 baseInvoice.setTaxAmount(BigDecimal.ZERO);
@@ -1149,9 +1250,10 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                 baseInvoice.setBuyerTaxId("");
                 baseInvoice.setSellerName("");
                 baseInvoice.setSellerTaxId("");
+                baseInvoice.setFormName("合作商付款申请");
                 baseMapper.insert(baseInvoice);
-                addWorkflowComment(processInstanceId, userId, result);
-                return McR.success(result);
+                addWorkflowComment(processInstanceId, userId, "报销总金额:"+mainJe);
+                return McR.success();
             }
 
             // 判断主表状态 - 有发票
@@ -1304,7 +1406,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 terminateWorkflow(accessToken, processInstanceId, userId, errorMsg);
                                 return McR.error("400", errorMsg);
                             }
-
+                            BigDecimal totalAmount = BigDecimal.ZERO;
                             // ========== 第二遍遍历:保存发票数据(校验通过后) ==========
                             for (Map<String, Object> parsedData : parsedInvoiceDataList) {
                                 JSONObject invoice = (JSONObject) parsedData.get("invoice");
@@ -1312,7 +1414,10 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 Object responseData = parsedData.get("responseData");
 
                                 allResults.add(responseData);
-
+                                BigDecimal amount = invoice.getBigDecimal("amount");
+                                if (amount != null) {
+                                    totalAmount = totalAmount.add(amount);
+                                }
                                 // 构建InvoiceLibrary对象
                                 InvoiceLibrary invoiceLibrary = new InvoiceLibrary();
                                 invoiceLibrary.setOaId(processInstanceId);
@@ -1338,12 +1443,16 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 invoiceLibrary.setSellerTaxId(invoice.getString("sellerTaxId") != null ? invoice.getString("sellerTaxId") : "");
                                 invoiceLibrary.setOaStatus("0");
                                 invoiceLibrary.setInvoiceStatus("0");
+                                invoiceLibrary.setFormName("合作商付款申请");
                                 invoiceLibrary.setDep(bm != null ? bm : "");
                                 invoiceLibrary.setAccountTitle(bxlb != null ? bxlb : "");
                                 invoiceLibrary.setPayAmount(mainJe != null ? mainJe : BigDecimal.ZERO);
                                 invoiceLibrary.setCreatedAt(LocalDateTime.now());
                                 invoiceLibrary.setUpdatedAt(LocalDateTime.now());
-
+                                invoiceLibrary.setPaySubject(fkzhxx != null ? fkzhxx : "");
+                                invoiceLibrary.setPayAccount(fkzh != null ? fkzh : "");
+                                invoiceLibrary.setBankName(yhqc != null ? yhqc : "");
+                                invoiceLibrary.setIsLongTerm(sfct != null ? sfct : "");
                                 invoiceList.add(invoiceLibrary);
                             }
 
@@ -1355,7 +1464,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 log.info("成功保存 {} 条发票记录", invoiceList.size());
                             }
 
-                            addWorkflowComment(processInstanceId, userId, allResults);
+                            addWorkflowComment1(processInstanceId, userId, totalAmount);
                             return McR.success(allResults);
 
                         } catch (Exception e) {
@@ -1408,6 +1517,10 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
             BigDecimal mainJe = null;
             String bxlb = null;
             String bm = null;
+            String fkzhxx = null;
+            String fkzh = null;
+            String yhqc = null;
+            String sfct = null;
 
             // 遍历收集主表字段值
             for (Map formComponentValue : formComponentValues) {
@@ -1429,20 +1542,33 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                         }
                     }
                 }
-//                if ("DDSelectField_1TP75OVCPAAO0".equals(id)) {
-//                    bxlb = value != null ? String.valueOf(value) : "";
-//                }
-//                if ("DepartmentField_OKBSJN0MD6O0".equals(id)) {
-//                    bm = value != null ? String.valueOf(value) : "";
-//                }
+                if ("DDSelectField_1UX0JVU89Q000".equals(id)) {
+                    bxlb = value != null ? String.valueOf(value) : "";
+                }
+                if ("DepartmentField_1HCL8SNLQORK0".equals(id)) {
+                    bm = value != null ? String.valueOf(value) : "";
+                }
+
+                if ("DDSelectField_GLW8YHBHSLS0".equals(id)) {
+                    fkzhxx = value != null ? String.valueOf(value) : "";
+                }
+                if ("TextField_1PR1HQ4H28SG0".equals(id)) {
+                    fkzh = value != null ? String.valueOf(value) : "";
+                }
+                if ("TextField_1UPR1XZTI3VK".equals(id)) {
+                    yhqc = value != null ? String.valueOf(value) : "";
+                }
+                if ("DDSelectField_1TMBRS8T7DPC0".equals(id)) {
+                    sfct = value != null ? String.valueOf(value) : "否";
+                }
             }
 
             // 判断主表状态 - 无发票
             if ("否".equals(zt)) {
-                Map<String, Object> result = new HashMap<>();
-                result.put("je", mainJe);
-                result.put("status", "否");
-                result.put("message", "无发票报销");
+//                Map<String, Object> result = new HashMap<>();
+//                result.put("je", mainJe);
+//                result.put("status", "否");
+//                result.put("message", "无发票报销");
                 // 保存基础报销记录
                 InvoiceLibrary baseInvoice = new InvoiceLibrary();
                 baseInvoice.setOaId(processInstanceId);
@@ -1460,12 +1586,17 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                 baseInvoice.setTaxAmount(BigDecimal.ZERO);
                 baseInvoice.setTotalAmount(BigDecimal.ZERO);
                 baseInvoice.setBuyerName("");
+                baseInvoice.setFormName("合作商报销申请");
+                baseInvoice.setPaySubject(fkzhxx != null ? fkzhxx : "");
+                baseInvoice.setPayAccount(fkzh != null ? fkzh : "");
+                baseInvoice.setBankName(yhqc != null ? yhqc : "");
+                baseInvoice.setIsLongTerm(sfct != null ? sfct : "");
                 baseInvoice.setBuyerTaxId("");
                 baseInvoice.setSellerName("");
                 baseInvoice.setSellerTaxId("");
                 baseMapper.insert(baseInvoice);
-                addWorkflowComment(processInstanceId, userId, result);
-                return McR.success(result);
+                addWorkflowComment(processInstanceId, userId, "报销总金额:"+mainJe);
+                return McR.success();
             }
 
             // 判断主表状态 - 有发票
@@ -1618,7 +1749,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 terminateWorkflow(accessToken, processInstanceId, userId, errorMsg);
                                 return McR.error("400", errorMsg);
                             }
-
+                            BigDecimal totalAmount = BigDecimal.ZERO;
                             // ========== 第二遍遍历:保存发票数据(校验通过后) ==========
                             for (Map<String, Object> parsedData : parsedInvoiceDataList) {
                                 JSONObject invoice = (JSONObject) parsedData.get("invoice");
@@ -1626,7 +1757,10 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 Object responseData = parsedData.get("responseData");
 
                                 allResults.add(responseData);
-
+                                BigDecimal amount = invoice.getBigDecimal("amount");
+                                if (amount != null) {
+                                    totalAmount = totalAmount.add(amount);
+                                }
                                 // 构建InvoiceLibrary对象
                                 InvoiceLibrary invoiceLibrary = new InvoiceLibrary();
                                 invoiceLibrary.setOaId(processInstanceId);
@@ -1657,7 +1791,11 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 invoiceLibrary.setPayAmount(mainJe != null ? mainJe : BigDecimal.ZERO);
                                 invoiceLibrary.setCreatedAt(LocalDateTime.now());
                                 invoiceLibrary.setUpdatedAt(LocalDateTime.now());
-
+                                invoiceLibrary.setPaySubject(fkzhxx != null ? fkzhxx : "");
+                                invoiceLibrary.setPayAccount(fkzh != null ? fkzh : "");
+                                invoiceLibrary.setBankName(yhqc != null ? yhqc : "");
+                                invoiceLibrary.setIsLongTerm(sfct != null ? sfct : "");
+                                invoiceLibrary.setFormName("合作商报销申请");
                                 invoiceList.add(invoiceLibrary);
                             }
 
@@ -1669,7 +1807,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 log.info("成功保存 {} 条发票记录", invoiceList.size());
                             }
 
-                            addWorkflowComment(processInstanceId, userId, allResults);
+                            addWorkflowComment1(processInstanceId, userId, totalAmount);
                             return McR.success(allResults);
 
                         } catch (Exception e) {
@@ -1722,6 +1860,10 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
             BigDecimal mainJe = null;
             String bxlb = null;
             String bm = null;
+            String fkzhxx = null;
+            String fkzh = null;
+            String yhqc = null;
+            String sfct = null;
 
             // 遍历收集主表字段值
             for (Map formComponentValue : formComponentValues) {
@@ -1744,20 +1886,32 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                     }
                 }
                 // 如果需要这两个字段,请取消注释并填写正确的字段ID
-                // if ("DDSelectField_1TP75OVCPAAO0".equals(id)) {
-                //     bxlb = value != null ? String.valueOf(value) : "";
-                // }
-                // if ("DepartmentField_OKBSJN0MD6O0".equals(id)) {
-                //     bm = value != null ? String.valueOf(value) : "";
-                // }
+                 if ("DDSelectField_1UX0JVU89Q000".equals(id)) {
+                     bxlb = value != null ? String.valueOf(value) : "";
+                 }
+                 if ("DepartmentField_1BJT6UY9Y5B40".equals(id)) {
+                     bm = value != null ? String.valueOf(value) : "";
+                 }
+                if ("DDSelectField_1D77TV92WXEO0".equals(id)) {
+                    fkzhxx = value != null ? String.valueOf(value) : "";
+                }
+                if ("TextField_3CQPLF9BVBO0".equals(id)) {
+                    fkzh = value != null ? String.valueOf(value) : "";
+                }
+                if ("TextField_YSFYQQ305SG0".equals(id)) {
+                    yhqc = value != null ? String.valueOf(value) : "";
+                }
+                if ("DDSelectField_1AYKIPZ3435S0".equals(id)) {
+                    sfct = value != null ? String.valueOf(value) : "否";
+                }
             }
 
             // 判断主表状态 - 无发票
             if ("否".equals(zt)) {
-                Map<String, Object> result = new HashMap<>();
-                result.put("je", mainJe);
-                result.put("status", "否");
-                result.put("message", "无发票报销");
+//                Map<String, Object> result = new HashMap<>();
+//                result.put("je", mainJe);
+//                result.put("status", "否");
+//                result.put("message", "无发票报销");
                 // 保存基础报销记录
                 InvoiceLibrary baseInvoice = new InvoiceLibrary();
                 baseInvoice.setOaId(processInstanceId);
@@ -1765,10 +1919,15 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                 baseInvoice.setInvoiceStatus("0");
                 baseInvoice.setDep(bm != null ? bm : "");
                 baseInvoice.setAccountTitle(bxlb != null ? bxlb : "");
+                baseInvoice.setPaySubject(fkzhxx != null ? fkzhxx : "");
+                baseInvoice.setPayAccount(fkzh != null ? fkzh : "");
+                baseInvoice.setBankName(yhqc != null ? yhqc : "");
+                baseInvoice.setIsLongTerm(sfct != null ? sfct : "");
                 baseInvoice.setPayAmount(mainJe != null ? mainJe : BigDecimal.ZERO);
                 baseInvoice.setCreatedAt(LocalDateTime.now());
                 baseInvoice.setUpdatedAt(LocalDateTime.now());
                 baseInvoice.setInvoiceCode("");
+                baseInvoice.setFormName("出差费用报销");
                 baseInvoice.setInvoiceNumber("");
                 baseInvoice.setInvoiceType("");
                 baseInvoice.setAmount(BigDecimal.ZERO);
@@ -1779,8 +1938,8 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                 baseInvoice.setSellerName("");
                 baseInvoice.setSellerTaxId("");
                 baseMapper.insert(baseInvoice);
-                addWorkflowComment(processInstanceId, userId, result);
-                return McR.success(result);
+                addWorkflowComment(processInstanceId, userId, "报销总金额:"+mainJe);
+                return McR.success();
             }
 
             // 判断主表状态 - 有发票
@@ -1937,14 +2096,17 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 terminateWorkflow(accessToken, processInstanceId, userId, errorMsg);
                                 return McR.error("400", errorMsg);
                             }
-
+                            BigDecimal totalAmount = BigDecimal.ZERO;
                             // ========== 第二遍遍历:保存发票数据(校验通过后) ==========
                             for (Map<String, Object> parsedData : parsedInvoiceDataList) {
                                 JSONObject invoice = (JSONObject) parsedData.get("invoice");
                                 Object responseData = parsedData.get("responseData");
 
                                 allResults.add(responseData);
-
+                                BigDecimal amount = invoice.getBigDecimal("amount");
+                                if (amount != null) {
+                                    totalAmount = totalAmount.add(amount);
+                                }
                                 // 构建InvoiceLibrary对象
                                 InvoiceLibrary invoiceLibrary = new InvoiceLibrary();
                                 invoiceLibrary.setOaId(processInstanceId);
@@ -1975,7 +2137,11 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 invoiceLibrary.setPayAmount(mainJe != null ? mainJe : BigDecimal.ZERO);
                                 invoiceLibrary.setCreatedAt(LocalDateTime.now());
                                 invoiceLibrary.setUpdatedAt(LocalDateTime.now());
-
+                                invoiceLibrary.setPaySubject(fkzhxx != null ? fkzhxx : "");
+                                invoiceLibrary.setPayAccount(fkzh != null ? fkzh : "");
+                                invoiceLibrary.setBankName(yhqc != null ? yhqc : "");
+                                invoiceLibrary.setIsLongTerm(sfct != null ? sfct : "");
+                                invoiceLibrary.setFormName("出差费用报销");
                                 invoiceList.add(invoiceLibrary);
                             }
 
@@ -1989,7 +2155,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 log.warn("没有有效的发票数据可保存");
                             }
 
-                            addWorkflowComment(processInstanceId, userId, allResults);
+                            addWorkflowComment1(processInstanceId, userId, totalAmount);
                             return McR.success(allResults);
 
                         } catch (Exception e) {
@@ -2042,7 +2208,10 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
             BigDecimal mainJe = null;
             String bxlb = null;
             String bm = null;
-
+            String fkzhxx = null;
+            String fkzh = null;
+            String yhqc = null;
+            String sfct = null;
             // 遍历收集主表字段值
             for (Map formComponentValue : formComponentValues) {
                 String id = String.valueOf(formComponentValue.get("id"));
@@ -2064,20 +2233,32 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                     }
                 }
                 // 如果需要这两个字段,请取消注释并填写正确的字段ID
-                // if ("DDSelectField_1TP75OVCPAAO0".equals(id)) {
-                //     bxlb = value != null ? String.valueOf(value) : "";
-                // }
-                // if ("DepartmentField_OKBSJN0MD6O0".equals(id)) {
-                //     bm = value != null ? String.valueOf(value) : "";
-                // }
+                 if ("DDSelectField_YLLB7AD1ATS0".equals(id)) {
+                     bxlb = value != null ? String.valueOf(value) : "";
+                 }
+                 if ("DepartmentField_RF93A6VHA9C0".equals(id)) {
+                     bm = value != null ? String.valueOf(value) : "";
+                 }
+                if ("DDSelectField_IQXAGL7Z8XC0".equals(id)) {
+                    fkzhxx = value != null ? String.valueOf(value) : "";
+                }
+                if ("TextField_3W9CLQOZZ540".equals(id)) {
+                    fkzh = value != null ? String.valueOf(value) : "";
+                }
+                if ("TextField_9PJ4JW8KTCS0".equals(id)) {
+                    yhqc = value != null ? String.valueOf(value) : "";
+                }
+                if ("DDSelectField_21L6KT7DT70G0".equals(id)) {
+                    sfct = value != null ? String.valueOf(value) : "否";
+                }
             }
 
             // 判断主表状态 - 无发票
             if ("否".equals(zt)) {
-                Map<String, Object> result = new HashMap<>();
-                result.put("je", mainJe);
-                result.put("status", "否");
-                result.put("message", "无发票报销");
+//                Map<String, Object> result = new HashMap<>();
+//                result.put("je", mainJe);
+//                result.put("status", "否");
+//                result.put("message", "无发票报销");
                 // 保存基础报销记录
                 InvoiceLibrary baseInvoice = new InvoiceLibrary();
                 baseInvoice.setOaId(processInstanceId);
@@ -2095,12 +2276,17 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                 baseInvoice.setTaxAmount(BigDecimal.ZERO);
                 baseInvoice.setTotalAmount(BigDecimal.ZERO);
                 baseInvoice.setBuyerName("");
+                baseInvoice.setFormName("批量付款申请(一对多)");
+                baseInvoice.setPaySubject(fkzhxx != null ? fkzhxx : "");
+                baseInvoice.setPayAccount(fkzh != null ? fkzh : "");
+                baseInvoice.setBankName(yhqc != null ? yhqc : "");
+                baseInvoice.setIsLongTerm(sfct != null ? sfct : "");
                 baseInvoice.setBuyerTaxId("");
                 baseInvoice.setSellerName("");
                 baseInvoice.setSellerTaxId("");
                 baseMapper.insert(baseInvoice);
-                addWorkflowComment(processInstanceId, userId, result);
-                return McR.success(result);
+                addWorkflowComment(processInstanceId, userId, "报销总金额:"+mainJe);
+                return McR.success();
             }
 
             // 判断主表状态 - 有发票
@@ -2257,14 +2443,17 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 terminateWorkflow(accessToken, processInstanceId, userId, errorMsg);
                                 return McR.error("400", errorMsg);
                             }
-
+                            BigDecimal totalAmount = BigDecimal.ZERO;
                             // ========== 第二遍遍历:保存发票数据(校验通过后) ==========
                             for (Map<String, Object> parsedData : parsedInvoiceDataList) {
                                 JSONObject invoice = (JSONObject) parsedData.get("invoice");
                                 Object responseData = parsedData.get("responseData");
 
                                 allResults.add(responseData);
-
+                                BigDecimal amount = invoice.getBigDecimal("amount");
+                                if (amount != null) {
+                                    totalAmount = totalAmount.add(amount);
+                                }
                                 // 构建InvoiceLibrary对象
                                 InvoiceLibrary invoiceLibrary = new InvoiceLibrary();
                                 invoiceLibrary.setOaId(processInstanceId);
@@ -2295,7 +2484,11 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 invoiceLibrary.setPayAmount(mainJe != null ? mainJe : BigDecimal.ZERO);
                                 invoiceLibrary.setCreatedAt(LocalDateTime.now());
                                 invoiceLibrary.setUpdatedAt(LocalDateTime.now());
-
+                                invoiceLibrary.setFormName("批量付款申请(一对多)");
+                                invoiceLibrary.setPaySubject(fkzhxx != null ? fkzhxx : "");
+                                invoiceLibrary.setPayAccount(fkzh != null ? fkzh : "");
+                                invoiceLibrary.setBankName(yhqc != null ? yhqc : "");
+                                invoiceLibrary.setIsLongTerm(sfct != null ? sfct : "");
                                 invoiceList.add(invoiceLibrary);
                             }
 
@@ -2309,7 +2502,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 log.warn("没有有效的发票数据可保存");
                             }
 
-                            addWorkflowComment(processInstanceId, userId, allResults);
+                            addWorkflowComment1(processInstanceId, userId, totalAmount);
                             return McR.success(allResults);
 
                         } catch (Exception e) {
@@ -2328,15 +2521,40 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
         }
     }
 
+    @Override
+    public void updateSfctByOaId(Map map) {
+        try {
+            String oaId = UtilMap.getString(map, "oaId");
+            String sfct = UtilMap.getString(map, "sfct");
+            sfct = (sfct == null || sfct.trim().isEmpty()) ? "否" : sfct;
+            // 创建更新条件
+            LambdaUpdateWrapper<InvoiceLibrary> updateWrapper = new LambdaUpdateWrapper<>();
+            updateWrapper.eq(InvoiceLibrary::getOaId, oaId)
+                    .set(InvoiceLibrary::getIsLongTerm, sfct)
+                    .set(InvoiceLibrary::getUpdatedAt, LocalDateTime.now());
+
+            int updateCount = baseMapper.update(null, updateWrapper);
+
+            if (updateCount > 0) {
+                log.info("更新成功: 共更新{}条记录", updateCount);
+            } else {
+                log.warn("未找到符合条件的记录: oaId={}", oaId);
+            }
+        } catch (Exception e) {
+
+            throw new RuntimeException("更新OA状态失败", e);
+        }
+    }
+
 
     /**
      * 添加钉钉审批评论
      */
-    private void addWorkflowComment(String processInstanceId, String userId, Object content) {
+    private void addWorkflowComment(String processInstanceId, String userId, Object totalAmount) {
         try {
             Map<String, Object> body = new HashMap<>();
             body.put("processInstanceId", processInstanceId);
-            body.put("text", JSON.toJSONString(content));
+            body.put("text", totalAmount);
             body.put("commentUserId", userId);
 
             String result = UtilHttp.doPost(
@@ -2351,7 +2569,25 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
             log.error("添加审批评论失败", e);
         }
     }
+    private void addWorkflowComment1(String processInstanceId, String userId, BigDecimal totalAmount) {
+        try {
+            Map<String, Object> body = new HashMap<>();
+            body.put("processInstanceId", processInstanceId);
+            body.put("text", "发票总金额:"+totalAmount);
+            body.put("commentUserId", userId);
 
+            String result = UtilHttp.doPost(
+                    "https://api.dingtalk.com/v1.0/workflow/processInstances/comments",
+                    ddClient.initTokenHeader(),
+                    null,
+                    body
+            );
+
+            log.info("添加审批评论成功: {}", result);
+        } catch (Exception e) {
+            log.error("添加审批评论失败", e);
+        }
+    }
     /**
      * 从 Map 中获取字符串值
      */
@@ -2511,8 +2747,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                     .amount(UtilNumber.setBigDecimal(UtilMap.getString_first(prop, "Total", "Fare")))
                     .tax(UtilNumber.setBigDecimal(UtilMap.getString_first(prop, "Tax")))
                     .excludingTax(UtilNumber.setBigDecimal(UtilMap.getString(prop, "PretaxAmount")))
-                    .buyerName(StringUtils.isBlank(guyuanNameRepalce(UtilMap.getString(prop, "Buyer")))
-                            ? "上海能辉科技股份有限公司" : guyuanNameRepalce(UtilMap.getString(prop, "Buyer")))
+                    .buyerName(StringUtils.defaultString(guyuanNameRepalce(UtilMap.getString(prop, "Buyer"))))
                     .buyerTaxId(StringUtils.isBlank(UtilMap.getString(prop, "BuyerTaxID"))
                             ? "" : UtilMap.getString(prop, "BuyerTaxID"))
                     .sellerName(guyuanNameRepalce(UtilMap.getString_first(prop, "Seller", "Issuer")))
@@ -2614,7 +2849,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
             @RequestParam(defaultValue = "download") String option) throws IOException {
 
         // 根据fileId获取实际文件路径,这里简化处理,实际可能需要从数据库查询
-        Path filePath = Paths.get("C://Users//EDY//Desktop//项目//琦王//files//").resolve(fileId).normalize();
+        Path filePath = Paths.get("D://qiwang//files//").resolve(fileId).normalize();
 
         // 检查文件是否存在
         if (!Files.exists(filePath)) {

+ 12 - 0
mjava-qiwang/src/main/java/com/malk/qiwang/entity/InvoiceLibrary.java

@@ -125,4 +125,16 @@ public class InvoiceLibrary implements Serializable {
      * 报销金额
      */
     private BigDecimal payAmount;
+    /**
+     * 表单名称
+     */
+    private String formName;
+//    付款主体
+    private String paySubject;
+//    付款账号
+    private String payAccount;
+    //银行全称
+    private String bankName;
+    //是否长摊
+    private String isLongTerm;
 }

+ 5 - 0
mjava-qiwang/src/main/java/com/malk/qiwang/mapper/CompanyTitleMapper.java

@@ -35,6 +35,8 @@ public interface CompanyTitleMapper extends BaseMapper<CompanyTitle> {
     @Select("SELECT * FROM company_title WHERE company_name = #{companyName}")
     CompanyTitle selectByTaxId(@Param("companyName") String companyName);
 
+    @Select("SELECT * FROM company_title WHERE tax_id = #{taxId}")
+    CompanyTitle selectByTaxId1(String taxId);
     /**
      * 软删除(根据税号更新删除标记)
      *
@@ -43,4 +45,7 @@ public interface CompanyTitleMapper extends BaseMapper<CompanyTitle> {
      */
     @Update("UPDATE company_title SET deleted_at = NOW() WHERE tax_id = #{taxId}")
     int softDeleteByTaxId(@Param("taxId") String taxId);
+
+    @Delete("DELETE FROM company_title WHERE status = 1")
+    void delZT();
 }

+ 7 - 7
mjava-qiwang/src/main/java/com/malk/qiwang/tencent/TXYConf.java

@@ -14,16 +14,16 @@ import java.util.Map;
 //@ConfigurationProperties(prefix = "tencent")
 public class TXYConf {
 
-//    private String APPID="1412895585";
-    private String APPID="1425374127";
+    private String APPID="1412895585";
 
-//    private String SecretId="AKIDDF3cw3wb3QZUBeuxnTwBCzYu1tWv624t";
 
-//    private String SecretKey="d1CAvRkyxhCbliRwEIB2yugSRNHGSdeb";
+    private String SecretId="AKIDDF3cw3wb3QZUBeuxnTwBCzYu1tWv624t";
 
-    private String SecretId="AKIDZ9WjjU2NUNYAaw87tRmsmUzHLE6Leqsh";
-
-    private String SecretKey="f8NQ8h2CAvTnuTowqX2JNEsKYZXIp9F8";
+    private String SecretKey="d1CAvRkyxhCbliRwEIB2yugSRNHGSdeb";
+//    private String APPID="1425374127";
+//    private String SecretId="AKIDZ9WjjU2NUNYAaw87tRmsmUzHLE6Leqsh";
+//
+//    private String SecretKey="f8NQ8h2CAvTnuTowqX2JNEsKYZXIp9F8";
 
     private String Region="ap-guangzhou";