From 39405c053391f29d2f2c0e2c3104bea111e0e460 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期三, 08 五月 2024 10:25:31 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java |   74 ++++++++++++++++++++++++------------
 1 files changed, 49 insertions(+), 25 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 f115723..75ca769 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
@@ -19,6 +19,7 @@
 import com.ruoyi.project.service.*;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
+import org.apache.ibatis.annotations.Param;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.xssf.usermodel.XSSFColor;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@@ -74,6 +75,9 @@
 
     @Autowired
     private VExpertfeeExpertMapper vExpertfeeExpertMapper;
+
+    @Autowired
+    private VExpertfeeDonorMapper vExpertfeeDonorMapper;
 
     @Autowired
     private VExpertfeeTotalMapper vExpertfeeTotalMapper;
@@ -185,7 +189,17 @@
             serviceFunddetailShareds.get(i).setFundid(serviceFundShared.getId());
             serviceFunddetailShareds.get(i).setId(null);
             //鏁版嵁鍙戦�佺粰璐㈠姟
-            uploadOAFileAndUpdateDb(serviceFunddetailShareds.get(i));
+            try {
+                uploadOAFileAndUpdateDb(serviceFunddetailShareds.get(i));
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.error("Exception涓叆鍙傜殑ID涓猴細{},寮傚父淇℃伅涓� 锛� {}", id, e.getMessage());
+                if (id != null) {
+                    Boolean aBoolean = sharedService.delfundsharedInfoById(null, id);
+                    log.error("fund2鍒嗕韩琛ㄩ噷鐨勬暟鎹槸鍚﹀垹闄ゆ垚鍔燂細{}", aBoolean);
+                }
+                return false;
+            }
         }
         boolean result = false;
         for (ServiceFunddetailShared serviceFunddetailShared : serviceFunddetailShareds) {
@@ -919,13 +933,18 @@
         AjaxResult ajaxResult = util.exportExcel(list, "vExpertfeeTotal");
         String filePath = RuoYiConfig.getDownloadPath() + ajaxResult.get("msg");
 
-        List<VExpertfeeExpert> list2 = vExpertfeeExpertMapper.selectVExpertfeeExpertListByFaxId(faxId);
-        ExcelUtil<VExpertfeeExpert> util2 = new ExcelUtil<VExpertfeeExpert>(VExpertfeeExpert.class);
-        AjaxResult ajaxResult1 = util2.exportExcel(list2, "vExpertfeeExpert");
+        List<VExpertfeeDonor> list2 = vExpertfeeDonorMapper.selectVExpertfeeDonorList2(faxId);
+        ExcelUtil<VExpertfeeDonor> util2= new ExcelUtil<VExpertfeeDonor>(VExpertfeeDonor.class);
+        AjaxResult ajaxResult2 = util2.exportExcel(list2, "VExpertfeeDonor");
+
+        List<VExpertfeeExpert> list3 = vExpertfeeExpertMapper.selectVExpertfeeExpertListByFaxId(faxId);
+        ExcelUtil<VExpertfeeExpert> util3 = new ExcelUtil<VExpertfeeExpert>(VExpertfeeExpert.class);
+        AjaxResult ajaxResult3 = util3.exportExcel(list3, "vExpertfeeExpert");
 
         List<String> list1 = new ArrayList<>();
         list1.add(ajaxResult.get("msg").toString());
-        list1.add(ajaxResult1.get("msg").toString());
+        list1.add(ajaxResult2.get("msg").toString());
+        list1.add(ajaxResult3.get("msg").toString());
 
 
         String name = "涓撳璐规眹鎬诲崟" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".xlsx";
@@ -934,13 +953,13 @@
             new File(RuoYiConfig.getDownloadPath() + path).delete();
         }
         Map<String, Object> map = new HashMap<>();
-        map.put("downloadUrl", "/profile/download/wordtemplate/" + name );
+        map.put("downloadUrl", "/profile/download/" + name);
         map.put("downloadName", name);
         return map;
     }
 
 
-    int uploadOAFileAndUpdateDb(ServiceFunddetailShared remShare) {
+    int uploadOAFileAndUpdateDb(ServiceFunddetailShared remShare) throws Exception {
         //涓婁紶OA鏂囦欢
         //String strUrl = "http://129.88.242.39:8899/seeyon/rest/token?userName=opo&password=127814f8-84e8-4304-84a5-a71573567efd&loginName=demo3";
         String strUrl = "http://129.88.242.39:8899/seeyon/rest/token";
@@ -980,7 +999,7 @@
     }
 
 
-    private Integer uploadFile(String filePath, String strFUrl, List<RbDetailFile> parseArray2, List<RbDetailFile> parseArray, ServiceFunddetailShared remShare, String flag) {
+    private Integer uploadFile(String filePath, String strFUrl, List<RbDetailFile> parseArray2, List<RbDetailFile> parseArray, ServiceFunddetailShared remShare, String flag) throws Exception {
         if (!CollectionUtils.isEmpty(parseArray)) {
             for (int i = 0; i < parseArray.size(); i++) {
                 RbDetailFile rbDetailFile = parseArray.get(i);
@@ -992,24 +1011,24 @@
                 System.out.println("fund鏈嶅姟鐨刦ilePath + substring: " + filePath + substring);
                 File filetest = new File(filePath + substring);
 
-                try {
-                    String struploadResult = HttpClientKit.sendPostWithFile(filetest, strFUrl);
-                    log.info("绗笁鏂逛紶鍥炵殑鏁版嵁: {}", struploadResult);
-                    if (StringUtils.isEmpty(struploadResult)) {
-                        log.error("HttpClientKit.sendPostWithFile 璇锋眰涓虹┖浜� filetest:{},  strFUrl:{} ", filetest, strFUrl);
-                        return 0;
-                    }
-                    //鑾峰彇fileid
-                    JSONObject jsonR = JSONObject.parseObject(struploadResult);
-                    JSONArray jsonArr = jsonR.getJSONArray("atts");
-                    log.info("绗笁鏂逛紶鍥炵殑鏁版嵁鑾峰彇鐨刟tts : {}", jsonArr);
-                    for (int j = 0; j < jsonArr.size(); j++) {
-                        JSONObject jsonRet = jsonArr.getJSONObject(j);
-                        rbDetailFile.setFileid(jsonRet.get("fileUrl").toString());
-                    }
-                } catch (Exception e) {
-                    e.printStackTrace();
+                String struploadResult = HttpClientKit.sendPostWithFile(filetest, strFUrl);
+                log.info("绗笁鏂逛紶鍥炵殑鏁版嵁: {}", struploadResult);
+                if (StringUtils.isEmpty(struploadResult)) {
+                    log.error("HttpClientKit.sendPostWithFile 璇锋眰涓虹┖浜� filetest:{},  strFUrl:{} ", filetest, strFUrl);
+                    return 0;
                 }
+                //鑾峰彇fileid
+                JSONObject jsonR = JSONObject.parseObject(struploadResult);
+                JSONArray jsonArr = jsonR.getJSONArray("atts");
+                log.info("绗笁鏂逛紶鍥炵殑鏁版嵁鑾峰彇鐨刟tts : {}", jsonArr);
+                for (int j = 0; j < jsonArr.size(); j++) {
+                    JSONObject jsonRet = jsonArr.getJSONObject(j);
+                    if (StringUtils.isEmpty(jsonRet.get("fileUrl").toString())) {
+                        throw new BaseException("fileID涓虹┖,璇疯仈绯荤涓夋柟澶勭悊");
+                    }
+                    rbDetailFile.setFileid(jsonRet.get("fileUrl").toString());
+                }
+
                 parseArray2.add(rbDetailFile);
             }
             if (flag.equals("1")) {
@@ -1167,4 +1186,9 @@
             e.printStackTrace();
         }
     }
+
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean updateFundTaxIdById(Long id, Long fundTaxId) {
+        return serviceFundMapper.updateFundTaxIdById(id, fundTaxId);
+    }
 }

--
Gitblit v1.9.3