From e00825ef6dc894e11dffa7f8015fccc9f2f1071a Mon Sep 17 00:00:00 2001
From: sinake <sinake1@qq.com>
Date: 星期三, 14 十月 2026 14:25:43 +0800
Subject: [PATCH] 钉钉通知

---
 ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java |   43 +++++++++++++++++++++++++++++++------------
 1 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java
index 296e3ec..8fa2965 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java
@@ -545,7 +545,7 @@
 
             //璁板綍涓�涓嬶紝涓嬩竴绾х殑瀹℃壒锛屼互渚夸簬涓嬩竴绾ч��鍥炲悗锛屽彂璧疯�呮彁浜ゆ椂锛岃兘鍐嶆彁鍒板綋鍓嶅鎵瑰眰绾�
             serviceFund.setBackflowlevel(FlowLevel);
-        } else {
+        } //else {
             CheckFlag = 2;
             if (CheckFlag == 2) {
                 //搴斿尰闄㈣姹傚鏋滃嚭鐜伴��鍥烇紝鐩存帴閫�鍒板彂璧疯��
@@ -567,7 +567,7 @@
                     serviceFund.getUsername(), serviceFund.getPretaxcost(), serviceFund.getDonorname(),
                     FundNotifyMessageBuilder.billNo(serviceFund.getBh(), serviceFund.getId()));
             FundNotifyMessageBuilder.addAuditResult(contentList, loginUser.getUser().getNickName(), new Date(),
-                    FundNotifyMessageBuilder.opinion(FundNotifyMessageBuilder.CONCLUSION_REJECT,
+                    FundNotifyMessageBuilder.opinion(checkFundVO.getFlowconclusion()+"",
                             checkFundVO.getFlowcontent()));
             try {
                 DingTalkReqVo dingTalkReqVo = new DingTalkReqVo();
@@ -578,7 +578,7 @@
             } catch (Exception e) {
                 log.error("璐圭敤---瀹℃壒鏈�氳繃閽夐拤閫氱煡澶辫触锛宖undId={}", serviceFund.getId(), e);
             }
-        }
+        //}
 
         serviceFund.setRecordstatus(RecordStatus);
         serviceFund.setFlowlevel(FlowLevel.longValue());
@@ -609,8 +609,16 @@
             sysUsers = sysUserMapper.selectUserByUserName(user.getUserName());
             log.info("璐圭敤sysUsers杩斿洖鐨勫�间负:{}", sysUsers);
         }
-        if (checkFundVO.getFlowconclusion() == 1 && sysUsers != null && sysUsers.getRoles() != null && sysUsers.getRoles().stream().anyMatch(role -> "officedirector".equals(role.getRoleKey()))) {
-            serviceFund.setOfficedirector(user.getNickName());
+        // 2026-10-09锛氭帹閫佹潯浠剁敱"褰撳墠瀹℃牳浜烘湁 officedirector 瑙掕壊"鏀逛负"鏈瀹℃壒鍚庡埌杈炬渶鍚庝竴绾�"銆�
+        // 鍘熷啓娉曞湪"鏈�鍚庝竴绾у鏍镐汉娌℃湁璇ヨ鑹�"鏃舵案杩滀笉浼氭帹閫侊紝鑰�"闈炴渶鍚庝竴绾х殑 officedirector"浼氭彁鍓嶆帹閫併��
+        boolean uploadAtLastLevel = checkFundVO.getFlowconclusion() == 1
+                && TotalLevel != null && TotalLevel != 0 && TotalLevel == OriginalFlowLevel + 1;
+        if (uploadAtLastLevel) {
+            // 浠嶅彧鍦ㄨ瑙掕壊瀹℃壒鏃惰褰曞姙鍏涓讳换锛屼繚鎸佸瓧娈佃涔変笉鍙�
+            if (sysUsers != null && sysUsers.getRoles() != null
+                    && sysUsers.getRoles().stream().anyMatch(role -> "officedirector".equals(role.getRoleKey()))) {
+                serviceFund.setOfficedirector(user.getNickName());
+            }
             serviceFund.setUploadStates(1);
             //鏁版嵁鍙戦��
             Boolean aBoolean1 = null;
@@ -709,8 +717,12 @@
     }
 
     private Boolean doSendData(ServiceFund serviceFund) {
-        // fund鍜宖unddetail鐨勬暟鎹幏鍙�
-        addFundSharedInfo(serviceFund.getId());
+        // 2026-10-09锛氭帴浣� addFundSharedInfo 鐨勫け璐ヤ俊鍙凤紙闄勪欢涓婁紶澶辫触鏃跺畠浼氬洖婊氬垎浜〃骞惰繑鍥� false锛�
+        Boolean sharedOk = addFundSharedInfo(serviceFund.getId());
+        if (sharedOk == null || !sharedOk) {
+            log.error("璐圭敤鎶ラ攢鍗曚笂浼犲け璐ワ細鍒嗕韩琛�/闄勪欢鐜妭澶辫触锛屽鎵逛笉鐢熸晥锛宖undId={}", serviceFund.getId());
+            return false;
+        }
         List<ServiceFundShared> fundShareInfos = serviceFundSharedMapper.getFundShareInfoById(serviceFund.getId());
         if (CollectionUtils.isEmpty(fundShareInfos)) return false;
 
@@ -1011,11 +1023,10 @@
             try {
                 if (isUploadOaEnabled()) uploadOAFileAndUpdateDb(serviceFunddetailShareds.get(i));
             } catch (Exception e) {
-                e.printStackTrace();
-                log.error("Exception涓叆鍙傜殑ID涓猴細{},寮傚父淇℃伅涓� 锛� {}", id, e.getMessage());
+                log.error("璐圭敤闄勪欢涓婁紶鍖婚櫌鍗忓弸绯荤粺澶辫触锛氬崟鎹甶d={}锛堟湰娆℃姤閿�鍗曚笂浼犳暣浣撳け璐ワ紝瀹℃壒涓嶇敓鏁堬級", id, e);
                 if (id != null) {
                     Boolean aBoolean = sharedService.delfundsharedInfoById(null, id);
-                    log.error("fund2鍒嗕韩琛ㄩ噷鐨勬暟鎹槸鍚﹀垹闄ゆ垚鍔燂細{}", aBoolean);
+                    log.error("宸插洖婊氬垎浜〃鏁版嵁锛歿}", aBoolean);
                 }
                 return false;
             }
@@ -1843,7 +1854,7 @@
         Map<String, Object> map = new HashMap<String, Object>();
         map.put("userName", "opo");
         map.put("password", "4126407a-9821-4874-be41-6568abd6dbe5");
-        map.put("loginName", "OPO绯荤粺瀹℃壒");
+        map.put("loginName", "OPO绯荤粺");
 
         JSONObject jsonObj = new JSONObject(map);
 
@@ -1860,10 +1871,18 @@
                 log.info("filePath鐨勪慨鏀�:{}", filePath);
                 String url = rbDetailFile.getUrl();
                 //file鐢ㄧ殑鏄粷瀵逛綅缃�
-                String substring = url.substring(url.indexOf("/profile/upload") + "/profile/upload".length());
+                // 2026-10-09锛氶檮浠跺湴鍧�瑙f瀽鍔犲浐锛岄伩鍏� url 寮傚父/鏂囦欢缂哄け鏃舵姏 NPE 瀵艰嚧鐪嬩笉鍒板け璐ュ師鍥�
+                int profileIdx = url == null ? -1 : url.indexOf("/profile/upload");
+                if (profileIdx < 0) {
+                    throw new ServiceException("闄勪欢鍦板潃鏍煎紡涓嶆纭紙缂哄皯 /profile/upload锛夛紝鏃犳硶涓婁紶鍗忓弸锛�" + url);
+                }
+                String substring = url.substring(profileIdx + "/profile/upload".length());
 //            String strFile = rbDetailFile.getUrl().replace(filePath, "/profile/upload");
                 System.out.println("fund鏈嶅姟鐨刦ilePath + substring: " + filePath + substring);
                 File filetest = new File(filePath + substring);
+                if (!filetest.exists()) {
+                    throw new ServiceException("闄勪欢鏂囦欢鍦ㄦ湇鍔″櫒涓婁笉瀛樺湪锛屾棤娉曚笂浼犲崗鍙嬶細" + filetest.getAbsolutePath());
+                }
 
                 String struploadResult = HttpClientKit.sendPostWithFile(filetest, strFUrl);
                 log.info("绗笁鏂逛紶鍥炵殑鏁版嵁: {}", struploadResult);

--
Gitblit v1.9.3