浏览代码

Merge branch 'master' of http://60.171.161.56:20000/tjf/rongzidanbao

wangmengwei 8 月之前
父节点
当前提交
70f4258271

+ 91 - 2
ruoyi-common/src/main/java/com/ruoyi/common/utils/IdCardUtil.java

@@ -6,12 +6,18 @@ package com.ruoyi.common.utils;
  * @Describe:
  */
 
+import cn.hutool.http.HttpRequest;
 import com.alibaba.fastjson2.JSONArray;
 import com.aliyun.cloudauth20190307.Client;
 import com.aliyun.cloudauth20190307.models.*;
 import com.aliyun.teaopenapi.models.Config;
 import com.aliyun.teautil.models.RuntimeOptions;
 
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.nio.file.Path;
 import java.util.Arrays;
 import java.util.List;
 
@@ -29,17 +35,19 @@ import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.common.core.domain.AjaxResult;
 import okhttp3.*;
+import org.apache.http.client.HttpClient;
 import org.apache.poi.util.IOUtils;
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.crypto.Cipher;
 import javax.crypto.spec.SecretKeySpec;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.util.*;
 
+
 import static com.ruoyi.common.constant.CommonConstants.*;
 
 public class IdCardUtil {
@@ -1474,5 +1482,86 @@ public class IdCardUtil {
     }
 
 
+    /**
+     * pdf文字识别
+     *
+     * @param filePath 本地文件路径
+     * @return
+     */
+    public static String accurateBasicCjpdf(String filePath) throws IOException {
+        String urlString = "http://69.172.93.148:5001/pdfFixedTextRecognition"; // 替换为你的URL
+
+        URL url = new URL(urlString);
+        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+
+        // 设置请求方法为POST
+        connection.setRequestMethod("POST");
+        connection.setDoOutput(true);
+
+        // 设置请求头
+        connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
+        connection.setRequestProperty("x-api-key", "123456789");
+
+        try (
+                OutputStream outputStream = connection.getOutputStream();
+                PrintWriter writer = new PrintWriter(new OutputStreamWriter(outputStream, "UTF-8"), true);
+                FileInputStream fileInputStream = new FileInputStream(filePath);
+        ) {
+            // 构建form-data部分
+            writer.append("------WebKitFormBoundary7MA4YWxkTrZu0gW").append(System.lineSeparator());
+            writer.append("Content-Disposition: form-data; name=\"file\"; filename=\"" + filePath.substring(filePath.lastIndexOf("/") + 1) + "\"").append(System.lineSeparator());
+            writer.append("Content-Type: text/plain").append(System.lineSeparator()).append(System.lineSeparator());
+            writer.flush();
+
+            // 发送文件数据
+            byte[] buffer = new byte[1024];
+            int bytesRead;
+            while ((bytesRead = fileInputStream.read(buffer)) != -1) {
+                outputStream.write(buffer, 0, bytesRead);
+            }
+            writer.flush();
+
+            // 结束数据发送
+            writer.append(System.lineSeparator()).flush();
+            writer.append("------WebKitFormBoundary7MA4YWxkTrZu0gW--").append(System.lineSeparator());
+            writer.flush();
+
+            // 获取响应码和响应内容
+            int responseCode = connection.getResponseCode();
+            System.out.println("Response Code: " + responseCode);
+            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+            String inputLine;
+            StringBuilder response = new StringBuilder();
+            while ((inputLine = in.readLine()) != null) {
+                response.append(inputLine);
+            }
+            in.close();
+
+            // 打印返回结果
+            System.out.println(response.toString());
+            JSONObject jsonObject = JSONObject.parseObject(response.toString());
+            String data = (String) jsonObject.get("data");
+            return data;
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (connection != null) {
+                connection.disconnect();
+            }
+        }
+        return null;
+    }
+
+
+    //{"words_result":[{"words":"担保001"},{"words":"保证合同"},{"words":"合同编号:W建潜公(2024)0724-1号"},{"words":"保证人(甲方):潜山市皖源融资担保有限公司"},{"words":"住所:潜山市经济开发区潜阳路0077号"},{"words":"邮政编码:246300"},{"words":"法定代表人(负责人):徐春生"},{"words":"传真:此栏空白"},{"words":"电话:13305564345"},{"words":"债权人(乙方):中国建设银行股份有限公司潜山支行"},{"words":"住所:潜山市梅城镇桃园路111号"},{"words":"邮政编码:246300"},{"words":"负责人:方虎"},{"words":"传真:此栏空白"},{"words":"电话:0556-8927748"},{"words":"扫描全能王创建"}],"words_result_num":16,"pdf_file_size":10,"log_id":1848635230024108475}
+
+    public static void main(String[] args) throws IOException {
+        String filePath = "D:\\0240809183931A169.pdf";
+        String stringObjectMap = accurateBasicCjpdf(filePath);
+        System.out.println(stringObjectMap);
+
+    }
+
+
     static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().build();
 }

+ 146 - 108
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelFillUtils.java

@@ -1,64 +1,68 @@
 package com.ruoyi.common.utils.poi;
+
 import com.ruoyi.common.config.RuoYiConfig;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellUtil;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.*;
+import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 public class ExcelFillUtils {
 
     //    public static final String FILL_EXPRESSION_REGEX = "\\{\\.\\w+\\}";
     private static final String FILL_EXPRESSION_REGEX = "\\{\\.[\\p{L}\\p{M}\\S]+\\}";
+    private static final String FILL_EXPRESSION_NAME = "xlsxName";
 
     /**
      * 给定模板,指定某个页签,将数据填充到模板中的指定页签,并在模板所在目录生成新的副本文件。
-     * @param template 模板文件地址
+     *
+     * @param template  模板文件地址
      * @param sheetName 页签名称
-     * @param data 待填充的数据,数据格式如下
+     * @param data      待填充的数据,数据格式如下
      *                  [
-     *                      {"colName1":v1 ,"colName2":v2...},
-     *                      {"colName1":v1 ,"colName2":v2...}
-     *                      ,...
+     *                  {"colName1":v1 ,"colName2":v2...},
+     *                  {"colName1":v1 ,"colName2":v2...}
+     *                  ,...
      *                  ]
      * @return 新生成的副本文件的地址
-     *
-     * */
-    public static String fillOneSheet(String template ,String sheetName , List<Map<String,Object>> data) {
-        return fillOneSheet(template ,FileUtils.getAvailableFullName(template) ,sheetName ,data);
+     */
+    public static String fillOneSheet(String template, String sheetName, List<Map<String, String>> data) {
+        return fillOneSheet(template, FileUtils.getAvailableFullName(template), sheetName, data);
     }
 
     /**
      * 给定模板,指定某个页签,将数据填充到模板中的指定页签,并将数据导入到指定文件上。
-     * @param template 模板文件地址
+     *
+     * @param template   模板文件地址
      * @param outputFile 新生成的文件的地址
-     * @param sheetName 页签名称
-     * @param data 待填充的数据,数据格式如下
-     *                  [
-     *                      {"colName1":v1 ,"colName2":v2...},
-     *                      {"colName1":v1 ,"colName2":v2...}
-     *                      ,...
-     *                  ]
+     * @param sheetName  页签名称
+     * @param data       待填充的数据,数据格式如下
+     *                   [
+     *                   {"colName1":v1 ,"colName2":v2...},
+     *                   {"colName1":v1 ,"colName2":v2...}
+     *                   ,...
+     *                   ]
      * @return 新生成的副本文件的地址
-     *
-     * */
-    public static String fillOneSheet(String template , String outputFile,String sheetName , List<Map<String,Object>> data){
+     */
+    public static String fillOneSheet(String template, String outputFile, String sheetName, List<Map<String, String>> data) {
 
         try (Workbook workbook = new XSSFWorkbook(new FileInputStream(template))) {
 
-            fill(workbook,sheetName,data);//填充数据
+            fill(workbook, sheetName, data);//填充数据
             refreshFormula(workbook);//刷新公式
 
             try (FileOutputStream outputStream = new FileOutputStream(outputFile)) {
                 workbook.write(outputStream);
-            }catch (Exception e){
+            } catch (Exception e) {
                 throw new RuntimeException(e);
             }
 
-        }catch (IOException e){
+        } catch (IOException e) {
             throw new RuntimeException(e);
         }
 
@@ -67,112 +71,129 @@ public class ExcelFillUtils {
 
     /**
      * 给定模板,将数据填充到模板中的多个页签,并在模板所在目录生成新的副本文件。
-     * @param template 模板文件地址
-     * @param datas 待填充的数据集,数据格式如下
-     *              {
-     *                  "SheetName1":[
-     *                      {"colName1":v1 ,"colName2":v2...},
-     *                      {"colName1":v1 ,"colName2":v2...}
-     *                      ,...
-     *                  ],
-     *                  "SheetName2":[
-     *                      {"colName1":v1 ,"colName2":v2...}
-     *                      {"colName1":v1 ,"colName2":v2...}
-     *                      ,...
-     *                  ],
-     *                  ...
-     *              }
-     *
-     * */
-    public static String fillMultipleSheet(String template ,Map<String,List<Map<String,Object>>> datas) {
-        return fillMultipleSheet(template ,FileUtils.getAvailableFullName(template) ,datas);
+     * <p>
+     * template 模板文件地址
+     * datas    待填充的数据集,数据格式如下
+     * {
+     * "SheetName1":[
+     * {"colName1":v1 ,"colName2":v2...},
+     * {"colName1":v1 ,"colName2":v2...}
+     * ,...
+     * ],
+     * "SheetName2":[
+     * {"colName1":v1 ,"colName2":v2...}
+     * {"colName1":v1 ,"colName2":v2...}
+     * ,...
+     * ],
+     * ...
+     * }
+     */
+    public static String fillMultipleSheet(String template, Map<String, List<Map<String, String>>> datas) {
+        return fillMultipleSheet(template, FileUtils.getAvailableFullName(template), datas);
     }
 
     /**
      * 给定模板,将数据填充到模板中的多个页签,并将数据导入到指定文件上。
-     * @param template 模板文件地址
-     * @param datas 待填充的数据集,数据格式如下
-     *              {
-     *                  "SheetName1":[
-     *                      {"colName1":v1 ,"colName2":v2...},
-     *                      {"colName1":v1 ,"colName2":v2...}
-     *                      ,...
-     *                  ],
-     *                  "SheetName2":[
-     *                      {"colName1":v1 ,"colName2":v2...}
-     *                      {"colName1":v1 ,"colName2":v2...}
-     *                      ,...
-     *                  ],
-     *                  ...
-     *              }
-     *
-     * */
-    public static String fillMultipleSheet(String template ,String outputFile ,Map<String,List<Map<String,Object>>> datas){
+     * <p>
+     * template 模板文件地址
+     * datas    待填充的数据集,数据格式如下
+     * {
+     * "SheetName1":[
+     * {"colName1":v1 ,"colName2":v2...},
+     * {"colName1":v1 ,"colName2":v2...}
+     * ,...
+     * ],
+     * "SheetName2":[
+     * {"colName1":v1 ,"colName2":v2...}
+     * {"colName1":v1 ,"colName2":v2...}
+     * ,...
+     * ],
+     * ...
+     * }
+     */
+    public static String fillMultipleSheet(String template, String outputFile, Map<String, List<Map<String, String>>> datas) {
 
         try (Workbook workbook = new XSSFWorkbook(new FileInputStream(template))) {
 
-            datas.forEach( (sheetName ,data)-> fill(workbook,sheetName,data) );//填充数据
+            datas.forEach((sheetName, data) -> fill(workbook, sheetName, data));//填充数据
             refreshFormula(workbook);//刷新公式
 
             try (FileOutputStream outputStream = new FileOutputStream(outputFile)) {
                 workbook.write(outputStream);
-            }catch (Exception e){
+            } catch (Exception e) {
                 throw new RuntimeException(e);
             }
 
-        }catch (IOException e){
+        } catch (IOException e) {
             throw new RuntimeException(e);
         }
 
         return outputFile;
     }
 
-    private static Workbook fill(Workbook workbook ,String sheetName ,List<Map<String,Object>> data) {
+    private static Workbook fill(Workbook workbook, String sheetName, List<Map<String, String>> data) {
 
         Sheet sheet = workbook.getSheet(sheetName);
         if (sheet == null) {
-            throw new RuntimeException(String.format("sheet [%s] does not exist.",sheetName));
+            throw new RuntimeException(String.format("sheet [%s] does not exist.", sheetName));
         }
 
         //找到所有的表达式单元格
-        Map<String,Cell> expressionCellMap = new HashMap<>();
-        for( int i = 0 ;i < sheet.getPhysicalNumberOfRows() ;i++){
+        List<Map<String, Object>> expList = new ArrayList<>();
+        for (int i = 0; i < sheet.getPhysicalNumberOfRows(); i++) {
             Row row = sheet.getRow(i);
-            for( int j = 0 ;j< row.getPhysicalNumberOfCells() ;j++){
+            for (int j = 0; j < row.getPhysicalNumberOfCells(); j++) {
                 Cell cell = row.getCell(j);
                 cell.setCellType(CellType.STRING);
-                if( !Objects.isNull(cell) && isFillExpression(cell.getStringCellValue()) ){//判断该单元格是否是填充公式
-                    expressionCellMap.put(getColNameFromEx(cell.getStringCellValue()),cell);
+                if (!Objects.isNull(cell)) {
+                    Pattern pattern = Pattern.compile(FILL_EXPRESSION_REGEX);
+                    Matcher matcher = pattern.matcher(cell.getStringCellValue());
+                    Map<String, Object> expressionCellMap = new HashMap<>();
+                    expressionCellMap.put(FILL_EXPRESSION_NAME, cell);
+                    while (matcher.find()) {
+                        String match = matcher.group();
+                        expressionCellMap.put(match, cell);
+                    }
+                    if (expressionCellMap.size() > 1) {
+                        expList.add(expressionCellMap);
+                    }
+
+
                 }
+
+                   /*     && isFillExpression(cell.getStringCellValue()) ){//判断该单元格是否是填充公式
+                    expressionCellMap.put(getColNameFromEx(cell.getStringCellValue()),cell);
+                }*/
             }
         }
 
         //填充数据
-        for(int i = 0 ;i< data.size() ;i++){
-            Map<String,Object> dataRow = data.get(i);
-            for (Map.Entry<String,Object> entry : dataRow.entrySet()){
-                String colName = entry.getKey();
-                Object value = entry.getValue();
-                if(expressionCellMap.containsKey(colName)){
-
-                    Cell cell = expressionCellMap.get(colName);//公式所在的单元格
+
+        for (Map<String, Object> stringObjectMap : expList) {
+            for (int i = 0; i < data.size(); i++) {
+                Map<String, String> dataRow = data.get(i);
+                for (Map<String, Object> objectMap : expList) {
+
+                    //String colName = entry.getKey();
+                    //Object value = entry.getValue();
+
+                    Cell cell = (Cell) objectMap.get(FILL_EXPRESSION_NAME);//公式所在的单元格
                     int rowID = cell.getRowIndex() + i;
                     int colId = cell.getColumnIndex();
-
                     Row fillRow = sheet.getRow(rowID);
                     fillRow = Objects.isNull(fillRow) ? sheet.createRow(rowID) : fillRow;
                     Cell fillCell = fillRow.getCell(colId);
                     //创建的新单元格需要复制公式单元格的格式
-                    fillCell = Objects.isNull(fillCell) ? CellUtil.createCell(fillRow,colId,"", cell.getCellStyle()) : fillCell;
-
-                    if ( value instanceof String){
-                        fillCell.setCellValue( String.valueOf(value) );
-                    }else if( value instanceof Number ){
-                        fillCell.setCellValue( ((Number)value).doubleValue() );
-                    }else{
-                        throw new RuntimeException(String.format("Unsupported data type [%s].",value.getClass().toString()));
+                    fillCell = Objects.isNull(fillCell) ? CellUtil.createCell(fillRow, colId, "", cell.getCellStyle()) : fillCell;
+                    //单元格里面的值
+                    String cellValue = cell.getStringCellValue();
+                    for (Map.Entry<String, Object> entrymap : objectMap.entrySet()) {
+                        if (!FILL_EXPRESSION_NAME.equals(entrymap.getKey())) {
+                            String str = (String) entrymap.getKey().substring(2, ((String) entrymap.getKey()).length() - 1);
+                            cellValue = cellValue.replace((String) entrymap.getKey(), (String) dataRow.get(str));
+                        }
                     }
-
+                    fillCell.setCellValue(String.valueOf(cellValue));
                 }
             }
         }
@@ -180,38 +201,53 @@ public class ExcelFillUtils {
         return workbook;
     }
 
-    private static void refreshFormula(Workbook workbook){
+    private static void refreshFormula(Workbook workbook) {
         FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
         evaluator.evaluateAll();
     }
 
-    private static boolean isFillExpression(String ex){
+    private static boolean isFillExpression(String ex) {
         if (ex.isEmpty()) return false;
-        return Pattern.matches(FILL_EXPRESSION_REGEX ,ex);
+        return Pattern.matches(FILL_EXPRESSION_REGEX, ex);
     }
 
-    private static String getColNameFromEx(String ex){
-        if (!isFillExpression(ex)) throw new RuntimeException("Illegal expression " + ex );
-        return ex.substring(2,ex.length() - 1);
+    private static String getColNameFromEx(String ex) {
+        if (!isFillExpression(ex)) throw new RuntimeException("Illegal expression " + ex);
+        return ex.substring(2, ex.length() - 1);
     }
 
+
     public static void main(String[] args) {
+
         String time = "2024-07-30 14:50:00";
         String timeData = time.split(" ")[0];
         System.out.println("生成文档路径:" + timeData);
         // 向列表中添加数据
-                /*list.add( Map.of("name","zou" ,"age" ,18) );
-                list.add( Map.of("name","li" ,"age" ,28) );
-                list.add( Map.of("name","wang" ,"age" ,15) );
-                list.add( Map.of("name","quan" ,"age" ,19) );
-                list.add( Map.of("name","zhao" ,"age" ,98) );*/
-        /*List<Map<String,Object>> list = new ArrayList<>();
-        Map<String,Object> map = new HashMap<>();
-        map.put("name","111");
-        map.put("name1","222");
-        map.put("name2","333");
-        map.put("name3","444");
-        map.put("name4","555");
+        List<Map<String, String>> list = new ArrayList<>();
+        Map<String, String> map = new HashMap<>();
+        //申请人名称
+        map.put("sqr", "1");
+        //公司住址
+        map.put("address", "2");
+        //家庭住址
+        map.put("fraddress", "3");
+        //申请金额
+        map.put("sqje", "4");
+        //申请期限
+        map.put("sqqx", "5");
+        //申请银行
+        map.put("bank", "6");
+        //还款方式
+        map.put("hkfs", "7");
+        map.put("year", "8");
+        map.put("month", "9");
+        map.put("day", "10");
+        //查询投票信息
+        map.put("ty", "11");
+        map.put("fj", "12");
+        map.put("qx", "13");
+        //贷款金额
+        map.put("je", "14");
         list.add(map);
         //fileName = FileUploadUtils.extractFilenameLoanApplicationNumberNoHzm("项目评审意见签批表");
         String fileName = "-项目评审意见签批表";
@@ -219,10 +255,12 @@ public class ExcelFillUtils {
         //String templatePath = RuoYiConfig.getProfile() + "/mb/项目评审意见签批表.xlsx";
         String templatePath = "D:\\ruoyi\\uploadPath\\mb\\项目评审意见签批表.xlsx";
         //String fileDir = RuoYiConfig.getProfile() + "/mb/temporarily/" + fileNameHz;
-        String fileDir = "D:\\ruoyi\\uploadPath\\mb\\temporarily\\"+ fileNameHz;
+        String fileDir = "D:\\ruoyi\\uploadPath\\mb\\temporarily\\" + fileNameHz;
         String sheet = ExcelFillUtils.fillOneSheet(templatePath, fileDir, "Sheet1", list);
-        System.out.println("生成文档路径:" + sheet);*/
+        System.out.println("生成文档路径:" + sheet);
+
     }
 
+
 }
 

+ 6 - 0
ruoyi-framework/pom.xml

@@ -71,6 +71,12 @@
             <scope>compile</scope>
         </dependency>
 
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 93 - 26
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/LoanApplicationServiceImpl.java

@@ -33,6 +33,7 @@ import com.ruoyi.system.domain.review.ReviewComments;
 import com.ruoyi.system.mapper.*;
 import com.ruoyi.system.service.ISysUserService;
 import com.ruoyi.system.service.loan.ILoanApplicationService;
+import lombok.SneakyThrows;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -1775,6 +1776,7 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
     /**
      * 导出模板附件
      */
+    @SneakyThrows
     @Override
     public AjaxResult exportMb(LoanApplication loanApplication) {
         Map<String, Object> map = new HashMap<>();
@@ -1806,7 +1808,7 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
         // 向word中添加数据
         Map<String, Object> params = new HashMap<>();
         // 向列表中添加数据
-        Map<String, Object> excelMap = new HashMap<>();
+        Map<String, String> excelMap = new HashMap<>();
         //获取当前年、月、日
         String year = DateUtils.getYear();
         String month = DateUtils.getMonth();
@@ -1859,7 +1861,7 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
         LoanApplicationFj loanApplicationFjTzs = new LoanApplicationFj();
 
         // 创建一个列表,用来存储要填充到Excel中的数据
-        List<Map<String, Object>> list = new ArrayList<>();
+        List<Map<String,String>> list = new ArrayList<>();
         switch (type) {
             case "1":
                 //params.put("enterpriseName", loanApplication.getEnterpriseName());
@@ -2095,17 +2097,30 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
                 //申请人名称
                 excelMap.put("sqr", loanApplication.getEnterpriseName() + "   " + loanApplication.getCorporationName());
                 //公司住址
-                excelMap.put("address", sysUserEnterprise.getEnterpriseAddress());
+                //公司住址
+                excelMap.put("address", "");
+                if(StringUtils.isNotEmpty(sysUserEnterprise.getEnterpriseAddress())){
+                    excelMap.put("address", sysUserEnterprise.getEnterpriseAddress());
+                }
                 //家庭住址
-                excelMap.put("fraddress", loanApplication.getCorporationAddress());
+                excelMap.put("fraddress", "");
+                if(StringUtils.isNotEmpty(loanApplication.getCorporationAddress())){
+                    excelMap.put("fraddress", loanApplication.getCorporationAddress());
+                }
                 //申请金额
-                excelMap.put("sqje", loanApplication.getApplicationAmount());
+                excelMap.put("sqje", Double.toString(loanApplication.getApplicationAmount()));
                 //申请期限
-                excelMap.put("sqqx", loanApplication.getUsagePeriod());
+                excelMap.put("sqqx", "");
+                if(StringUtils.isNotEmpty(loanApplication.getUsagePeriod())){
+                    excelMap.put("sqqx", loanApplication.getUsagePeriod());
+                }
                 //申请银行
                 excelMap.put("bank", loanApplication.getApplicationBank());
                 //还款方式
-                excelMap.put("hkfs", loanApplication.getRepaymentSource());
+                excelMap.put("hkfs", "");
+                if(StringUtils.isNotEmpty(loanApplication.getRepaymentSource())){
+                    excelMap.put("hkfs", loanApplication.getRepaymentSource());
+                }
                 //参会日期
                 String timeData = loanApplication.getReviewTime().split(" ")[0];
                 String[] split = timeData.split("-");
@@ -2133,12 +2148,12 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
                             qx++;
                         }
                     }
-                    excelMap.put("ty", ty);
-                    excelMap.put("fj", fj);
-                    excelMap.put("qx", qx);
+                    excelMap.put("ty", String.valueOf(ty));
+                    excelMap.put("fj", String.valueOf(fj));
+                    excelMap.put("qx", String.valueOf(qx));
                 }
                 //贷款金额
-                excelMap.put("je", loanApplication.getActuallyAmount());
+                excelMap.put("je", Double.toString(loanApplication.getActuallyAmount()));
                 //贷款期限
                 list.add(excelMap);
                 //fileName = FileUploadUtils.extractFilenameLoanApplicationNumberNoHzm("项目评审意见签批表");
@@ -2251,9 +2266,12 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
                 //申请人名称
                 excelMap.put("sqr", loanApplication.getEnterpriseName());
                 //申请金额
-                excelMap.put("sqje", loanApplication.getActuallyAmount());
+                excelMap.put("sqje", Double.toString(loanApplication.getActuallyAmount()));
                 //申请期限
-                excelMap.put("sqqx", loanApplication.getUsagePeriod());
+                excelMap.put("sqqx", "");
+                if(StringUtils.isNotEmpty(loanApplication.getUsagePeriod())){
+                    excelMap.put("sqqx", loanApplication.getUsagePeriod());
+                }
                 //申请银行
                 excelMap.put("bank", loanApplication.getApplicationBank());
                 list.add(excelMap);
@@ -2270,9 +2288,12 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
                 //申请人名称
                 excelMap.put("sqr", loanApplication.getEnterpriseName());
                 //申请金额
-                excelMap.put("sqje", loanApplication.getActuallyAmount());
+                excelMap.put("sqje", Double.toString(loanApplication.getActuallyAmount()));
                 //申请期限
-                excelMap.put("sqqx", loanApplication.getUsagePeriod());
+                excelMap.put("sqqx", "");
+                if(StringUtils.isNotEmpty(loanApplication.getUsagePeriod())){
+                    excelMap.put("sqqx", loanApplication.getUsagePeriod());
+                }
                 //申请银行
                 excelMap.put("bank", loanApplication.getApplicationBank());
                 list.add(excelMap);
@@ -2320,32 +2341,78 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
                     if (map != null || map.size() != 0) {
 
                         //分支行
-                        excelMap.put("fzh", imgMap.get("dkdw"));
+                        excelMap.put("fzh", (String) imgMap.get("dkdw"));
+                        System.out.println("111"+imgMap.get("dkdw"));
                         //总行
-                        excelMap.put("zh", imgMap.get("zh"));
+                        excelMap.put("zh", (String)imgMap.get("zh"));
+                        System.out.println("222"+imgMap.get("zh"));
                         //起始日期
-                        excelMap.put("qsrq", imgMap.get("qxr"));
+                        excelMap.put("qsrq", (String)imgMap.get("qxr"));
+                        System.out.println("333"+imgMap.get("qxr"));
                         //到期日期
-                        excelMap.put("dqrq", imgMap.get("dqr"));
+                        excelMap.put("dqrq", (String)imgMap.get("dqr"));
+                        System.out.println("444"+imgMap.get("dqr"));
                         //贷款利率
-                        excelMap.put("dklv", imgMap.get("dklv"));
+                        excelMap.put("dklv", (String)imgMap.get("dklv"));
+                        System.out.println("555"+imgMap.get("dklv"));
                     }
                 }
 
                 //所属行业
-                excelMap.put("sshy", loanApplication.getCategoryType());
+                if(StringUtils.isNotEmpty(loanApplication.getCategoryType())){
+                    excelMap.put("sshy", loanApplication.getCategoryType());
+                }
                 //主债权金额
                 //查询最新的一条投票数据
                 userConference = sysUserConferenceMapper.selectSysUserConferenceNew(loanApplication.getLoanApplicationId());
-
-                excelMap.put("zzqje", userConference.getLineGuarantee());
+                if(StringUtils.isNotEmpty(userConference.getLineGuarantee())){
+                    excelMap.put("zzqje", userConference.getLineGuarantee());
+                }
                 //债务人名称
-                excelMap.put("zwrmc", loanApplication.getEnterpriseName());
+                excelMap.put("zwrmc", "");
+                if(StringUtils.isNotEmpty(loanApplication.getEnterpriseName())){
+                    excelMap.put("zwrmc", loanApplication.getEnterpriseName());
+                }
                 //法定代表人姓名
-                excelMap.put("fddbrxm", loanApplication.getCorporationName());
+                excelMap.put("fddbrxm", "");
+                if(StringUtils.isNotEmpty(loanApplication.getCorporationName())){
+                    excelMap.put("fddbrxm", loanApplication.getCorporationName());
+                }
                 //法定代表人证件号码
-                excelMap.put("fddbrzjhm", loanApplication.getCorporationIdCard());
+                excelMap.put("fddbrzjhm", "");
+                if(StringUtils.isNotEmpty(loanApplication.getCorporationIdCard())){
+                    excelMap.put("fddbrzjhm", loanApplication.getCorporationIdCard());
+                }
+                //保证合同号
+                excelMap.put("bzhth", "");
+                //流动资金贷款合同
+                excelMap.put("ldzjdkhth", "");
+
+                //查询所有的其他附件
+                //判断附件存不存在
+                LoanApplicationFj loanApplicationFj = new LoanApplicationFj();
+                loanApplicationFj.setLoanApplicationId(loanApplication.getLoanApplicationId());
+                loanApplicationFj.setType("qtfj");
+                List<LoanApplicationFj> applicationFjList = loanApplicationFjMapper.selectLoanApplicationFjList(loanApplicationFj);
+                if(applicationFjList!=null && applicationFjList.size()>0){
+                    for (LoanApplicationFj applicationFj : applicationFjList) {
+                        if(applicationFj.getName().contains("保证合同")){
+                            //服务器路径
+                            String urlOnline = applicationFj.getUrl() + loanApplicationFjTzs.getUrl().replace("/profile/upload", "");
+                            String bzhth = IdCardUtil.accurateBasicCjpdf(urlOnline);
+                            excelMap.put("bzhth", bzhth);
+                            System.out.println("666"+bzhth);
+                        }
+                        if(applicationFj.getName().contains("流动资金贷款合同")){
+                            //服务器路径
+                            String urlOnline = applicationFj.getUrl() + loanApplicationFjTzs.getUrl().replace("/profile/upload", "");
+                            String ldzjdkhth = IdCardUtil.accurateBasicCjpdf(urlOnline);
+                            excelMap.put("ldzjdkhth", ldzjdkhth);
+                            System.out.println("777"+ldzjdkhth);
+                        }
 
+                    }
+                }
 
                 list.add(excelMap);
                 //fileName = FileUploadUtils.extractFilenameLoanApplicationNumberNoHzm("项目评审意见签批表");