From 7b76a4d2f752c5367eac177a566b87768fc6ad1a Mon Sep 17 00:00:00 2001 From: aipper Date: Tue, 18 Nov 2025 08:51:29 +0800 Subject: [PATCH] test dockerfile --- Dockerfile | 10 +- docker-compose.yml | 6 - .../controller/ArchivesUploadController.java | 613 +++- .../ArchivesUploadController.java.bak | 2702 +++++++++++++++++ src/main/resources/logback-spring.xml | 10 +- 5 files changed, 3280 insertions(+), 61 deletions(-) create mode 100644 src/main/java/com/point/strategy/oaDocking/controller/ArchivesUploadController.java.bak diff --git a/Dockerfile b/Dockerfile index 55a375b..bc43dd0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,12 +5,18 @@ FROM docker.aipper.de/eclipse-temurin:8-jre-alpine AS base # 设置维护者信息 LABEL maintainer="digital-archive-team" -# 使用阿里云镜像源并安装最小基础包 +# 使用阿里云镜像源并安装基础包(包含OCR和字体支持) RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \ apk add --no-cache \ ca-certificates \ curl \ + bash \ + ttf-dejavu \ + fontconfig \ tini \ + tesseract-ocr \ + tesseract-ocr-data-chi_sim \ + tesseract-ocr-data-eng \ && rm -rf /var/cache/apk/* # ===== Maven 构建阶段 ===== @@ -133,6 +139,8 @@ FROM base # 设置环境变量(优化内存使用) ENV JAVA_OPTS="-Xmx512m -Xms256m -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Djava.awt.headless=true -XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0" ENV SPRING_PROFILES_ACTIVE=prod +ENV TESSDATA_PREFIX=/usr/share/tessdata/ +ENV OCR_TESSPATH=/usr/bin/tesseract # 创建应用用户和目录 RUN addgroup -g 1001 app && \ diff --git a/docker-compose.yml b/docker-compose.yml index 7ed16fc..18c394e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,12 +33,6 @@ services: networks: - proxy restart: unless-stopped - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:9081/point-strategy/actuator/health"] - interval: 30s - timeout: 10s - retries: 3 - start_period: 60s networks: proxy: external: true diff --git a/src/main/java/com/point/strategy/oaDocking/controller/ArchivesUploadController.java b/src/main/java/com/point/strategy/oaDocking/controller/ArchivesUploadController.java index a498065..1b636ce 100644 --- a/src/main/java/com/point/strategy/oaDocking/controller/ArchivesUploadController.java +++ b/src/main/java/com/point/strategy/oaDocking/controller/ArchivesUploadController.java @@ -141,6 +141,117 @@ public class ArchivesUploadController { } } + // SQL 值格式化:数值型为空用 NULL;字符型加引号,空用 '' + private static String toSqlValue(Object value, boolean numeric) { + if (value == null) return numeric ? "NULL" : "''"; + if (numeric) return String.valueOf(value); + String s = String.valueOf(value).replace("'", "''"); + return "'" + s + "'"; + } + + // 在销/退出/进销存/终端建设 统一字段顺序(1-100)的数值型列索引,用于默认填充 + private static final java.util.Set SALES_NUMERIC_INDEX = new java.util.HashSet<>( + java.util.Arrays.asList( + 7,8,9,10,12,14,16,18,19,22,23,24, + 45,46,47,48,49,50,51,52,53,54,55,56,57, + 58,59,60,61,62,63,64,65,66,67,68,69,70, + 71,72,73,74,75,76 + ) + ); + + // 判断字符串是否为空白 + private static boolean isBlank(String s) { + return s == null || s.trim().isEmpty(); + } + + // 有值才放入(字符串非空白,数字非null) + private static void putIfHasData(java.util.Map m, String key, Object v) { + if (v == null) return; + if (v instanceof CharSequence) { + if (!isBlank(v.toString())) m.put(key, v.toString()); + } else { + // 数值/时间等非空即存 + m.put(key, v); + } + } + + // 根据实际表结构过滤后生成动态列/值并保存 + private void saveDynamicRow(String tempTableName, java.util.Map values) { + java.util.List struct = null; + try { + struct = danganguanliService.danganguanliMapper.selectTableStruct(tempTableName); + } catch (Throwable ignore) { + } + java.util.Set colSet = new java.util.HashSet<>(); + if (struct != null) { + for (com.point.strategy.bean.TtableStructDescription d : struct) { + if (d != null && d.getColumnName() != null) colSet.add(d.getColumnName().toLowerCase()); + } + } + + java.util.Map filtered = new java.util.LinkedHashMap<>(); + boolean hasMeta = !colSet.isEmpty(); + for (java.util.Map.Entry e : values.entrySet()) { + String col = e.getKey(); + Object v = e.getValue(); + if (hasMeta) { + if (colSet.contains(col.toLowerCase())) filtered.put(col, v); + } else { + // 无元数据时先不过滤,后续失败再按报错剔除 + filtered.put(col, v); + } + } + + if (filtered.isEmpty()) return; // 无有效字段则不写入 + + // 失败重试:若报列不存在,剔除该列重试(最多剔除10次,防止循环) + java.util.Map current = new java.util.LinkedHashMap<>(filtered); + for (int attempt = 0; attempt < 10 && !current.isEmpty(); attempt++) { + java.util.List fields = new java.util.ArrayList<>(); + java.util.List vals = new java.util.ArrayList<>(); + for (java.util.Map.Entry e : current.entrySet()) { + String col = e.getKey(); + Object v = e.getValue(); + fields.add("\"" + col + "\""); + boolean isNumeric = v instanceof java.lang.Number; + vals.add(toSqlValue(v, isNumeric)); + } + String fieldName = String.join(",", fields); + String valueName = String.join(",", vals); + java.util.Map mapTwo = new java.util.HashMap<>(); + mapTwo.put("tableName", tempTableName); + mapTwo.put("fieldName", fieldName); + mapTwo.put("valueName", valueName); + try { + danganguanliService.saveObject(mapTwo); + return; // 成功 + } catch (Throwable ex) { + String msg = ex.getMessage() != null ? ex.getMessage() : ""; + // 尝试解析缺失列名(兼容多种数据库报错格式) + String missing = null; + java.util.regex.Matcher m1 = java.util.regex.Pattern.compile("column \\\"([^\\\"]+)\\\" (does not exist|not found)", java.util.regex.Pattern.CASE_INSENSITIVE).matcher(msg); + if (m1.find()) missing = m1.group(1); + if (missing == null) { + java.util.regex.Matcher m2 = java.util.regex.Pattern.compile("column ([a-zA-Z0-9_]+) (does not exist|not found)", java.util.regex.Pattern.CASE_INSENSITIVE).matcher(msg); + if (m2.find()) missing = m2.group(1); + } + if (missing != null) { + // 按大小写不敏感从 current 中移除 + String keyToRemove = null; + for (String k : current.keySet()) { + if (k.equalsIgnoreCase(missing)) { keyToRemove = k; break; } + } + if (keyToRemove != null) { + current.remove(keyToRemove); + continue; // 重试 + } + } + // 其他错误或无法解析缺失列,直接抛出 + throw ex; + } + } + } + /** * 基于中文类型描述推断页码(公文用) */ @@ -1040,7 +1151,8 @@ public class ArchivesUploadController { // 使用统一的sales表 String tableName = "sales_20251019171058"; String tempTableName = tableName+"_temp"; - String fileTableName = tableName + "_file"; + // 与合同对接保持一致:原文写入临时原文表 + String fileTableName = tableName + "_temp_file"; // 统计四个表的总条数 String[] tableNames = {"cc_tbc_product_ez", "cc_tbc_drawout_ez", "scm_rpt_bizstordayreport_ez", "ec_exp_apply_accept_ez"}; @@ -1271,44 +1383,57 @@ public class ArchivesUploadController { out_begin_date = nvl(resultSet.getString("out_begin_date")); maintitle = product_name; + // 使用产品ID作为批次号,避免空串 + recordId = product_uuid; - valueName = "''," + - "'" + product_code + "'," + - "'" + product_name + "'," + - "'" + factory_simple_name + "'," + - "'" + brand_name + "'," + - "'" + is_abnormity + "'," + - (length != null ? length : "NULL") + "," + - (width != null ? width : "NULL") + "," + - (height != null ? height : "NULL") + "," + - (tar_qty != null ? tar_qty : "NULL") + "," + - "'" + bar_code + "'," + - (package_qty != null ? package_qty : "NULL") + "," + - "'" + bar_code2 + "'," + - (package_qty2 != null ? package_qty2 : "NULL") + "," + - "'" + bar_code3 + "'," + - (package_qty3 != null ? package_qty3 : "NULL") + "," + - "'" + price_type_code + "'," + - (direct_whole_price != null ? direct_whole_price : "NULL") + "," + - (direct_retail_price != null ? direct_retail_price : "NULL") + "," + - "'" + is_province + "'," + - "'" + is_seized + "'," + - (adjust_price != null ? adjust_price : "NULL") + "," + - (retail_price != null ? retail_price : "NULL") + "," + - (whole_sale_price != null ? whole_sale_price : "NULL") + "," + - "'" + in_begin_date + "'," + - "'" + sale_begin_date + "'," + - "'" + out_begin_date + "'," + - "'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''," + - "'" + fonds_no + "'," + - "'" + retention + "'," + - "'" + archive_ctg_no + "'," + - "'" + created_date + "'," + - "'" + maintitle + "'," + - "'" + responsibleby + "'," + - "'预归档未完成'," + - "'" + recordId + "'," + - "'" + sourceTable + "'"; + // 按字段顺序组装100列,严防列/值不匹配 + String[] valsP = new String[100]; + valsP[0] = toSqlValue(product_uuid, false); + valsP[1] = toSqlValue(product_code, false); + valsP[2] = toSqlValue(product_name, false); + valsP[3] = toSqlValue(factory_simple_name, false); + valsP[4] = toSqlValue(brand_name, false); + valsP[5] = toSqlValue(is_abnormity, false); + valsP[6] = toSqlValue(length, true); + valsP[7] = toSqlValue(width, true); + valsP[8] = toSqlValue(height, true); + valsP[9] = toSqlValue(tar_qty, true); + valsP[10] = toSqlValue(bar_code, false); + valsP[11] = toSqlValue(package_qty, true); + valsP[12] = toSqlValue(bar_code2, false); + valsP[13] = toSqlValue(package_qty2, true); + valsP[14] = toSqlValue(bar_code3, false); + valsP[15] = toSqlValue(package_qty3, true); + valsP[16] = toSqlValue(price_type_code, false); + valsP[17] = toSqlValue(direct_whole_price, true); + valsP[18] = toSqlValue(direct_retail_price, true); + valsP[19] = toSqlValue(is_province, false); + valsP[20] = toSqlValue(is_seized, false); + valsP[21] = toSqlValue(adjust_price, true); + valsP[22] = toSqlValue(retail_price, true); + valsP[23] = toSqlValue(whole_sale_price, true); + valsP[24] = toSqlValue(in_begin_date, false); + valsP[25] = toSqlValue(sale_begin_date, false); + valsP[26] = toSqlValue(out_begin_date, false); + // 元信息 92~100 + valsP[91] = toSqlValue(fonds_no, false); + valsP[92] = toSqlValue(retention, false); + valsP[93] = toSqlValue(archive_ctg_no, false); + valsP[94] = toSqlValue(created_date, false); + valsP[95] = toSqlValue(maintitle, false); + valsP[96] = toSqlValue(responsibleby, false); + valsP[97] = toSqlValue("预归档未完成", false); + valsP[98] = toSqlValue(recordId, false); + valsP[99] = toSqlValue(sourceTable, false); + + StringBuilder sbP = new StringBuilder(); + for (int i = 1; i <= 100; i++) { + String v = valsP[i - 1]; + if (v == null) v = SALES_NUMERIC_INDEX.contains(i) ? "NULL" : "''"; + if (i > 1) sbP.append(','); + sbP.append(v); + } + valueName = sbP.toString(); } else if ("cc_tbc_drawout_ez".equals(sourceTable)) { // 退出品规数据 @@ -1378,6 +1503,193 @@ public class ArchivesUploadController { "'" + recordId + "'," + "'" + sourceTable + "'"; + // 构造100列(进销存 36~76),覆盖上面的拼接 + { + String[] valsS = new String[100]; + valsS[35] = toSqlValue(biz_date, false); + valsS[36] = toSqlValue(manage_unit_uuid, false); + valsS[37] = toSqlValue(stor_uuid, false); + valsS[38] = toSqlValue(stor_name, false); + valsS[39] = toSqlValue(product_uuid2, false); + valsS[40] = toSqlValue(product_code2, false); + valsS[41] = toSqlValue(product_name, false); + valsS[42] = toSqlValue(unit_uuid, false); + valsS[43] = toSqlValue(unit_name, false); + valsS[44] = toSqlValue(last_qty, true); + valsS[45] = toSqlValue(last_amount, true); + valsS[46] = toSqlValue(buy_qty, true); + valsS[47] = toSqlValue(buy_notax_amount, true); + valsS[48] = toSqlValue(buy_amount, true); + valsS[49] = toSqlValue(movein_qty, true); + valsS[50] = toSqlValue(movein_notax_amount, true); + valsS[51] = toSqlValue(movein_amount, true); + valsS[52] = toSqlValue(movein_cost, true); + valsS[53] = toSqlValue(moveout_qty, true); + valsS[54] = toSqlValue(moveout_notax_amount, true); + valsS[55] = toSqlValue(moveout_amount, true); + valsS[56] = toSqlValue(moveout_cost, true); + valsS[57] = toSqlValue(sale_qty, true); + valsS[58] = toSqlValue(sale_notax_amount, true); + valsS[59] = toSqlValue(sale_amount, true); + valsS[60] = toSqlValue(sale_cost, true); + valsS[61] = toSqlValue(sale_gross_profit, true); + valsS[62] = toSqlValue(allot_qty, true); + valsS[63] = toSqlValue(allot_notax_amount, true); + valsS[64] = toSqlValue(allot_amount, true); + valsS[65] = toSqlValue(allot_cost, true); + valsS[66] = toSqlValue(allot_gross_profit, true); + valsS[67] = toSqlValue(dec_qty, true); + valsS[68] = toSqlValue(dec_notax_amount, true); + valsS[69] = toSqlValue(dec_amount, true); + valsS[70] = toSqlValue(inc_qty, true); + valsS[71] = toSqlValue(inc_notax_amount, true); + valsS[72] = toSqlValue(inc_amount, true); + valsS[73] = toSqlValue(rest_qty, true); + valsS[74] = toSqlValue(rest_amount, true); + valsS[75] = toSqlValue(cost_price, true); + valsS[91] = toSqlValue(fonds_no, false); + valsS[92] = toSqlValue(retention, false); + valsS[93] = toSqlValue(archive_ctg_no, false); + valsS[94] = toSqlValue(created_date, false); + valsS[95] = toSqlValue(maintitle, false); + valsS[96] = toSqlValue(responsibleby, false); + valsS[97] = toSqlValue("预归档未完成", false); + valsS[98] = toSqlValue(recordId, false); + valsS[99] = toSqlValue(sourceTable, false); + StringBuilder sbS = new StringBuilder(); + for (int i = 1; i <= 100; i++) { + String v = valsS[i - 1]; + if (v == null) v = SALES_NUMERIC_INDEX.contains(i) ? "NULL" : "''"; + if (i > 1) sbS.append(','); + sbS.append(v); + } + valueName = sbS.toString(); + } + + // 重新按位生成 100 列(终端建设 77~91),覆盖上面的拼接 + String[] valsE = new String[100]; + valsE[76] = toSqlValue(depart_uuid, false); + valsE[77] = toSqlValue(depart_name, false); + valsE[78] = toSqlValue(saler_dept_uuid, false); + valsE[79] = toSqlValue(license_code, false); + valsE[80] = toSqlValue(cust_name, false); + valsE[81] = toSqlValue(address, false); + valsE[82] = toSqlValue(manage_person_name, false); + valsE[83] = toSqlValue(cust_type_name, false); + valsE[84] = toSqlValue(busi_place_code, false); + valsE[85] = toSqlValue(terminal_level_before, false); + valsE[86] = toSqlValue(terminal_level_after, false); + valsE[87] = toSqlValue(apply_remark, false); + valsE[88] = toSqlValue(deal_remark, false); + valsE[89] = toSqlValue(accept_status, false); + valsE[90] = toSqlValue(updator_name, false); + valsE[91] = toSqlValue(fonds_no, false); + valsE[92] = toSqlValue(retention, false); + valsE[93] = toSqlValue(archive_ctg_no, false); + valsE[94] = toSqlValue(created_date, false); + valsE[95] = toSqlValue(maintitle, false); + valsE[96] = toSqlValue(responsibleby, false); + valsE[97] = toSqlValue("预归档未完成", false); + valsE[98] = toSqlValue(recordId, false); + valsE[99] = toSqlValue(sourceTable, false); + StringBuilder sbE = new StringBuilder(); + for (int i = 1; i <= 100; i++) { + String v = valsE[i - 1]; + if (v == null) v = SALES_NUMERIC_INDEX.contains(i) ? "NULL" : "''"; + if (i > 1) sbE.append(','); + sbE.append(v); + } + valueName = sbE.toString(); + + // 重新按位生成 100 列(进销存 36~76),覆盖上面的拼接 + String[] valsS = new String[100]; + valsS[35] = toSqlValue(biz_date, false); + valsS[36] = toSqlValue(manage_unit_uuid, false); + valsS[37] = toSqlValue(stor_uuid, false); + valsS[38] = toSqlValue(stor_name, false); + valsS[39] = toSqlValue(product_uuid2, false); + valsS[40] = toSqlValue(product_code2, false); + valsS[41] = toSqlValue(product_name, false); + valsS[42] = toSqlValue(unit_uuid, false); + valsS[43] = toSqlValue(unit_name, false); + valsS[44] = toSqlValue(last_qty, true); + valsS[45] = toSqlValue(last_amount, true); + valsS[46] = toSqlValue(buy_qty, true); + valsS[47] = toSqlValue(buy_notax_amount, true); + valsS[48] = toSqlValue(buy_amount, true); + valsS[49] = toSqlValue(movein_qty, true); + valsS[50] = toSqlValue(movein_notax_amount, true); + valsS[51] = toSqlValue(movein_amount, true); + valsS[52] = toSqlValue(movein_cost, true); + valsS[53] = toSqlValue(moveout_qty, true); + valsS[54] = toSqlValue(moveout_notax_amount, true); + valsS[55] = toSqlValue(moveout_amount, true); + valsS[56] = toSqlValue(moveout_cost, true); + valsS[57] = toSqlValue(sale_qty, true); + valsS[58] = toSqlValue(sale_notax_amount, true); + valsS[59] = toSqlValue(sale_amount, true); + valsS[60] = toSqlValue(sale_cost, true); + valsS[61] = toSqlValue(sale_gross_profit, true); + valsS[62] = toSqlValue(allot_qty, true); + valsS[63] = toSqlValue(allot_notax_amount, true); + valsS[64] = toSqlValue(allot_amount, true); + valsS[65] = toSqlValue(allot_cost, true); + valsS[66] = toSqlValue(allot_gross_profit, true); + valsS[67] = toSqlValue(dec_qty, true); + valsS[68] = toSqlValue(dec_notax_amount, true); + valsS[69] = toSqlValue(dec_amount, true); + valsS[70] = toSqlValue(inc_qty, true); + valsS[71] = toSqlValue(inc_notax_amount, true); + valsS[72] = toSqlValue(inc_amount, true); + valsS[73] = toSqlValue(rest_qty, true); + valsS[74] = toSqlValue(rest_amount, true); + valsS[75] = toSqlValue(cost_price, true); + valsS[91] = toSqlValue(fonds_no, false); + valsS[92] = toSqlValue(retention, false); + valsS[93] = toSqlValue(archive_ctg_no, false); + valsS[94] = toSqlValue(created_date, false); + valsS[95] = toSqlValue(maintitle, false); + valsS[96] = toSqlValue(responsibleby, false); + valsS[97] = toSqlValue("预归档未完成", false); + valsS[98] = toSqlValue(recordId, false); + valsS[99] = toSqlValue(sourceTable, false); + StringBuilder sbS = new StringBuilder(); + for (int i = 1; i <= 100; i++) { + String v = valsS[i - 1]; + if (v == null) v = SALES_NUMERIC_INDEX.contains(i) ? "NULL" : "''"; + if (i > 1) sbS.append(','); + sbS.append(v); + } + valueName = sbS.toString(); + + // 重新按位生成 100 列,覆盖上面的拼接,避免列数与值数不一致 + String[] valsD = new String[100]; + valsD[27] = toSqlValue(recordId, false); + valsD[28] = toSqlValue(org_name, false); + valsD[29] = toSqlValue(quit_uuid, false); + valsD[30] = toSqlValue(drawout_date, false); + valsD[31] = toSqlValue(quit_date, false); + valsD[32] = toSqlValue(comment, false); + valsD[33] = toSqlValue(creater_name, false); + valsD[34] = toSqlValue(syscreatedate, false); + valsD[91] = toSqlValue(fonds_no, false); + valsD[92] = toSqlValue(retention, false); + valsD[93] = toSqlValue(archive_ctg_no, false); + valsD[94] = toSqlValue(created_date, false); + valsD[95] = toSqlValue(maintitle, false); + valsD[96] = toSqlValue(responsibleby, false); + valsD[97] = toSqlValue("预归档未完成", false); + valsD[98] = toSqlValue(recordId, false); + valsD[99] = toSqlValue(sourceTable, false); + StringBuilder sbD = new StringBuilder(); + for (int i = 1; i <= 100; i++) { + String v = valsD[i - 1]; + if (v == null) v = SALES_NUMERIC_INDEX.contains(i) ? "NULL" : "''"; + if (i > 1) sbD.append(','); + sbD.append(v); + } + valueName = sbD.toString(); + } else if ("scm_rpt_bizstordayreport_ez".equals(sourceTable)) { // 月度进销存数据 recordId = String.valueOf(resultSet.getLong("id")); @@ -1480,14 +1792,46 @@ public class ArchivesUploadController { "'" + recordId + "'," + "'" + sourceTable + "'"; + // 严格按位填充 100 列(退出品规 28~34) + { + String[] valsD = new String[100]; + valsD[27] = toSqlValue(recordId, false); + valsD[28] = toSqlValue(org_name, false); + valsD[29] = toSqlValue(quit_uuid, false); + valsD[30] = toSqlValue(drawout_date, false); + valsD[31] = toSqlValue(quit_date, false); + valsD[32] = toSqlValue(comment, false); + valsD[33] = toSqlValue(creater_name, false); + valsD[34] = toSqlValue(syscreatedate, false); + valsD[91] = toSqlValue(fonds_no, false); + valsD[92] = toSqlValue(retention, false); + valsD[93] = toSqlValue(archive_ctg_no, false); + valsD[94] = toSqlValue(created_date, false); + valsD[95] = toSqlValue(maintitle, false); + valsD[96] = toSqlValue(responsibleby, false); + valsD[97] = toSqlValue("预归档未完成", false); + valsD[98] = toSqlValue(recordId, false); + valsD[99] = toSqlValue(sourceTable, false); + StringBuilder sbD = new StringBuilder(); + for (int i = 1; i <= 100; i++) { + String v = valsD[i - 1]; + if (v == null) v = SALES_NUMERIC_INDEX.contains(i) ? "NULL" : "''"; + if (i > 1) sbD.append(','); + sbD.append(v); + } + valueName = sbD.toString(); + } + } else if ("ec_exp_apply_accept_ez".equals(sourceTable)) { // 终端建设数据 recordId = nvl(resultSet.getString("accept_uuid")); org_name = nvl(resultSet.getString("org_name")); org_name2 = nvl(resultSet.getString("org_name2")); - depart_uuid = nvl(resultSet.getString("depart_uuid")); - depart_name = nvl(resultSet.getString("depart_name")); - saler_dept_uuid = nvl(resultSet.getString("saler_dept_uuid")); + // 源表 ec_exp_apply_accept_ez 不含 depart_uuid/depart_name/saler_dept_uuid(见 doc/1.md 的 DDL), + // 按合同对接一致逻辑,这些目标字段留空(由后续流程/映射补齐)。 + depart_uuid = ""; + depart_name = ""; + saler_dept_uuid = ""; license_code = nvl(resultSet.getString("license_code")); cust_name = nvl(resultSet.getString("cust_name")); address = nvl(resultSet.getString("address")); @@ -1509,6 +1853,7 @@ public class ArchivesUploadController { valueName = "'','','','','','','','','','','','','','','','','','','','','','','','',',," + // 在销品牌字段为空 "'','','','','',''," + "'','','','','','','','','','','','','',''," + + "'','','','','','','','','','','','','','','','','','','','','','','','',',',''," + "'" + depart_uuid + "'," + "'" + depart_name + "'," + "'" + saler_dept_uuid + "'," + @@ -1534,6 +1879,43 @@ public class ArchivesUploadController { "'预归档未完成'," + "'" + recordId + "'," + "'" + sourceTable + "'"; + + // 终端建设字段(77~91)按位填充 + { + String[] valsE = new String[100]; + valsE[76] = toSqlValue(depart_uuid, false); + valsE[77] = toSqlValue(depart_name, false); + valsE[78] = toSqlValue(saler_dept_uuid, false); + valsE[79] = toSqlValue(license_code, false); + valsE[80] = toSqlValue(cust_name, false); + valsE[81] = toSqlValue(address, false); + valsE[82] = toSqlValue(manage_person_name, false); + valsE[83] = toSqlValue(cust_type_name, false); + valsE[84] = toSqlValue(busi_place_code, false); + valsE[85] = toSqlValue(terminal_level_before, false); + valsE[86] = toSqlValue(terminal_level_after, false); + valsE[87] = toSqlValue(apply_remark, false); + valsE[88] = toSqlValue(deal_remark, false); + valsE[89] = toSqlValue(accept_status, false); + valsE[90] = toSqlValue(updator_name, false); + valsE[91] = toSqlValue(fonds_no, false); + valsE[92] = toSqlValue(retention, false); + valsE[93] = toSqlValue(archive_ctg_no, false); + valsE[94] = toSqlValue(created_date, false); + valsE[95] = toSqlValue(maintitle, false); + valsE[96] = toSqlValue(responsibleby, false); + valsE[97] = toSqlValue("预归档未完成", false); + valsE[98] = toSqlValue(recordId, false); + valsE[99] = toSqlValue(sourceTable, false); + StringBuilder sbE = new StringBuilder(); + for (int i = 1; i <= 100; i++) { + String v = valsE[i - 1]; + if (v == null) v = SALES_NUMERIC_INDEX.contains(i) ? "NULL" : "''"; + if (i > 1) sbE.append(','); + sbE.append(v); + } + valueName = sbE.toString(); + } } if (log.isInfoEnabled()) { @@ -1542,19 +1924,140 @@ public class ArchivesUploadController { // 幂等:优先检查是否已存在相同记录 Integer jhId; + boolean recordExists = false; String whereSql = " 1=1 and batch_id='" + recordId + "' and table_name='" + sourceTable + "'"; if (existsInTemp(tempTableName, whereSql)) { jhId = findSingleId(tempTableName, whereSql); + recordExists = true; if (log.isDebugEnabled()) { log.debug("[PRODUCT_SALES] 命中幂等: 复用已有记录 id={}, where={}", jhId, whereSql); } } else { - Map mapTwo = new HashMap(); - mapTwo.put("tableName", tempTableName); - mapTwo.put("fieldName", "product_uuid,product_code1,product_name1,factory_simple_name,brand_name,is_abnormity,length,width,height,tar_qty,bar_code,package_qty,bar_code2,package_qty2,bar_code3,package_qty3,price_type_code,direct_whole_price,direct_retail_price,is_province,is_seized,adjust_price,retail_price,whole_sale_price,in_begin_date,sale_begin_date,out_begin_date,drawout_uuid,org_name,quit_uuid,drawout_date,quit_date,comment,creater_name,syscreatedate,biz_date,manage_unit_uuid,stor_uuid,stor_name,product_uuid2,product_code2,product_name2,unit_uuid,unit_name,last_qty,last_amount,buy_qty,buy_notax_amount,buy_amount,movein_qty,movein_notax_amount,movein_amount,movein_cost,moveout_qty,moveout_notax_amount,moveout_amount,moveout_cost,sale_qty,sale_notax_amount,sale_amount,sale_cost,sale_gross_profit,allot_qty,allot_notax_amount,allot_amount,allot_cost,allot_gross_profit,dec_qty,dec_notax_amount,dec_amount,inc_qty,inc_notax_amount,inc_amount,rest_qty,rest_amount,cost_price,depart_uuid,depart_name,saler_dept_uuid,license_code,cust_name,address,manage_person_name,cust_type_name,busi_place_code,terminal_level_before,terminal_level_after,apply_remark,deal_remark,accept_status,syscreatedate,updator_name,fonds_no,retention,archive_ctg_no,created_date,maintitle,responsibleby,archive_flag,batch_id,table_name"); - mapTwo.put("valueName", valueName); - danganguanliService.saveObject(mapTwo); - jhId = Integer.parseInt(mapTwo.get("id").toString()); + // 动态构造:有数据才存 + 仅存存在于目标表的列 + Map values = new LinkedHashMap<>(); + // 在销品牌 + putIfHasData(values, "product_uuid", product_uuid); + putIfHasData(values, "product_code1", product_code); + putIfHasData(values, "product_name1", product_name); + putIfHasData(values, "factory_simple_name", factory_simple_name); + putIfHasData(values, "brand_name", brand_name); + putIfHasData(values, "is_abnormity", is_abnormity); + putIfHasData(values, "length", length); + putIfHasData(values, "width", width); + putIfHasData(values, "height", height); + putIfHasData(values, "tar_qty", tar_qty); + putIfHasData(values, "bar_code", bar_code); + putIfHasData(values, "package_qty", package_qty); + putIfHasData(values, "bar_code2", bar_code2); + putIfHasData(values, "package_qty2", package_qty2); + putIfHasData(values, "bar_code3", bar_code3); + putIfHasData(values, "package_qty3", package_qty3); + putIfHasData(values, "price_type_code", price_type_code); + putIfHasData(values, "direct_whole_price", direct_whole_price); + putIfHasData(values, "direct_retail_price", direct_retail_price); + putIfHasData(values, "is_province", is_province); + putIfHasData(values, "is_seized", is_seized); + putIfHasData(values, "adjust_price", adjust_price); + putIfHasData(values, "retail_price", retail_price); + putIfHasData(values, "whole_sale_price", whole_sale_price); + putIfHasData(values, "in_begin_date", in_begin_date); + putIfHasData(values, "sale_begin_date", sale_begin_date); + putIfHasData(values, "out_begin_date", out_begin_date); + // 退出品规 + putIfHasData(values, "drawout_uuid", "cc_tbc_drawout_ez".equals(sourceTable) ? recordId : ""); + putIfHasData(values, "org_name", org_name); + putIfHasData(values, "quit_uuid", quit_uuid); + putIfHasData(values, "drawout_date", drawout_date); + putIfHasData(values, "quit_date", quit_date); + putIfHasData(values, "comment", comment); + putIfHasData(values, "creater_name", creater_name); + putIfHasData(values, "syscreatedate", syscreatedate); + // 进销存 + putIfHasData(values, "biz_date", biz_date); + putIfHasData(values, "manage_unit_uuid", manage_unit_uuid); + putIfHasData(values, "stor_uuid", stor_uuid); + putIfHasData(values, "stor_name", stor_name); + putIfHasData(values, "product_uuid2", product_uuid2); + putIfHasData(values, "product_code2", product_code2); + putIfHasData(values, "product_name2", product_name); + putIfHasData(values, "unit_uuid", unit_uuid); + putIfHasData(values, "unit_name", unit_name); + putIfHasData(values, "last_qty", last_qty); + putIfHasData(values, "last_amount", last_amount); + putIfHasData(values, "buy_qty", buy_qty); + putIfHasData(values, "buy_notax_amount", buy_notax_amount); + putIfHasData(values, "buy_amount", buy_amount); + putIfHasData(values, "movein_qty", movein_qty); + putIfHasData(values, "movein_notax_amount", movein_notax_amount); + putIfHasData(values, "movein_amount", movein_amount); + putIfHasData(values, "movein_cost", movein_cost); + putIfHasData(values, "moveout_qty", moveout_qty); + putIfHasData(values, "moveout_notax_amount", moveout_notax_amount); + putIfHasData(values, "moveout_amount", moveout_amount); + putIfHasData(values, "moveout_cost", moveout_cost); + putIfHasData(values, "sale_qty", sale_qty); + putIfHasData(values, "sale_notax_amount", sale_notax_amount); + putIfHasData(values, "sale_amount", sale_amount); + putIfHasData(values, "sale_cost", sale_cost); + putIfHasData(values, "sale_gross_profit", sale_gross_profit); + putIfHasData(values, "allot_qty", allot_qty); + putIfHasData(values, "allot_notax_amount", allot_notax_amount); + putIfHasData(values, "allot_amount", allot_amount); + putIfHasData(values, "allot_cost", allot_cost); + putIfHasData(values, "allot_gross_profit", allot_gross_profit); + putIfHasData(values, "dec_qty", dec_qty); + putIfHasData(values, "dec_notax_amount", dec_notax_amount); + putIfHasData(values, "dec_amount", dec_amount); + putIfHasData(values, "inc_qty", inc_qty); + putIfHasData(values, "inc_notax_amount", inc_notax_amount); + putIfHasData(values, "inc_amount", inc_amount); + putIfHasData(values, "rest_qty", rest_qty); + putIfHasData(values, "rest_amount", rest_amount); + putIfHasData(values, "cost_price", cost_price); + // 终端建设 + putIfHasData(values, "depart_uuid", depart_uuid); + putIfHasData(values, "depart_name", depart_name); + putIfHasData(values, "saler_dept_uuid", saler_dept_uuid); + putIfHasData(values, "license_code", license_code); + putIfHasData(values, "cust_name", cust_name); + putIfHasData(values, "address", address); + putIfHasData(values, "manage_person_name", manage_person_name); + putIfHasData(values, "cust_type_name", cust_type_name); + putIfHasData(values, "busi_place_code", busi_place_code); + putIfHasData(values, "terminal_level_before", terminal_level_before); + putIfHasData(values, "terminal_level_after", terminal_level_after); + putIfHasData(values, "apply_remark", apply_remark); + putIfHasData(values, "deal_remark", deal_remark); + putIfHasData(values, "accept_status", accept_status); + putIfHasData(values, "updator_name", updator_name); + // 元信息:必须写入(即便为空字符串) + values.put("fonds_no", isBlank(fonds_no) ? "" : fonds_no); + values.put("retention", isBlank(retention) ? "" : retention); + values.put("archive_ctg_no", isBlank(archive_ctg_no) ? "" : archive_ctg_no); + values.put("created_date", isBlank(created_date) ? "" : created_date); + values.put("maintitle", isBlank(maintitle) ? "" : maintitle); + values.put("responsibleby", isBlank(responsibleby) ? "" : responsibleby); + values.put("archive_flag", "预归档未完成"); + values.put("batch_id", isBlank(recordId) ? "" : recordId); + values.put("table_name", sourceTable); + + // 终端建设表:为常用字段填充空串(即使源表无值),避免目标NOT NULL列报错 + if ("ec_exp_apply_accept_ez".equals(sourceTable)) { + String[] termCols = new String[]{ + "depart_uuid","depart_name","saler_dept_uuid", + "license_code","cust_name","address","manage_person_name", + "cust_type_name","busi_place_code","terminal_level_before", + "terminal_level_after","apply_remark","deal_remark", + "accept_status","updator_name" + }; + for (String c : termCols) { + if (!values.containsKey(c)) values.put(c, ""); + } + if (!values.containsKey("org_name")) values.put("org_name", ""); + } + + saveDynamicRow(tempTableName, values); + jhId = findSingleId(tempTableName, whereSql); if (log.isInfoEnabled()) { log.info("[PRODUCT_SALES] 新增主表记录 id={} (temp={})", jhId, tempTableName); } @@ -1567,8 +2070,8 @@ public class ArchivesUploadController { log.debug("[PRODUCT_SALES] 目标目录: {}", dir); } - //是否生成归档xml - if(archiveXMLGenerate){ + //是否生成归档xml - 仅在新记录时生成 + if(archiveXMLGenerate && !recordExists){ String head = ""; String xml = " <目录>" + " <来源表>" + xmlEscape(sourceTable) + "" + @@ -1692,6 +2195,18 @@ public class ArchivesUploadController { } } + // 仅对新记录更新原文数量 + if (!recordExists) { + Map map7=new HashMap<>(); + map7.put("tableName",tempTableName); + map7.put("tableName2",fileTableName); + map7.put("id",jhId); + danganguanliService.wsajmlTempCount(map7); + if (log.isDebugEnabled()) { + log.debug("[PRODUCT_SALES] 更新原文数量: id={}", jhId); + } + } + j++; //添加日志 diff --git a/src/main/java/com/point/strategy/oaDocking/controller/ArchivesUploadController.java.bak b/src/main/java/com/point/strategy/oaDocking/controller/ArchivesUploadController.java.bak new file mode 100644 index 0000000..426d222 --- /dev/null +++ b/src/main/java/com/point/strategy/oaDocking/controller/ArchivesUploadController.java.bak @@ -0,0 +1,2702 @@ +package com.point.strategy.oaDocking.controller; + + +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +import com.point.strategy.bean.OperLogger; +import com.point.strategy.common.*; +import com.point.strategy.dao.OperLoggerMapper; +import com.point.strategy.docTraditionArrange.docVolume.service.DanganguanliService; +import com.point.strategy.oaDocking.bean.UploadFileEntity; +import com.point.strategy.oaDocking.service.DocSimpleOaService; +import com.point.strategy.oaDocking.service.DocTraditionFileOaService; +import com.point.strategy.oaDocking.service.DocTraditionVolumeOaService; +import com.point.strategy.oaDocking.service.YcjSystemIntegration; +import com.point.strategy.oaDocking.service.CityBusinessSystemIntegration; +import com.point.strategy.oaDocking.util.FileUtils; +import com.point.strategy.service.OperLoggerService; +import com.point.strategy.user.bean.User; +import com.point.strategy.user.bean.UserRole; +import com.point.strategy.user.service.UserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.http.HttpStatus; +import org.apache.tools.zip.ZipEntry; +import org.apache.tools.zip.ZipFile; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.multipart.MultipartFile; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import javax.servlet.http.HttpServletRequest; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.*; +import java.math.BigDecimal; +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.sql.*; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.Date; +import java.util.logging.Level; +import java.util.zip.ZipInputStream; + +import static com.point.strategy.oaDocking.util.FileUtils.unzip; + + +/** + * oa对接controller + * + * */ +@RestController +@RequestMapping("/v/archives") +@Api(tags = "OA对接") +@Slf4j +public class ArchivesUploadController { + + //本地路径 + public static final String BASEPATH_LOCAL = "E:\\arc\\archives\\"; + + @Autowired + private DocSimpleOaService docSimpleService ; + + @Autowired + private DocTraditionFileOaService docTraditionFileService; + + @Autowired + private DocTraditionVolumeOaService docTraditionVolumeService; + + @Autowired + private DanganguanliService danganguanliService; + + @Autowired + private OperLoggerMapper operLoggerMapper; + + @Value("${img.upload}") + private String uploadPath; + + @Value("${archiveXML.generate}") + private Boolean archiveXMLGenerate; + + @Autowired + private UserService userService; + + @Autowired + private OperLoggerService operLoggerService; + + // ===== 以下为提取的私有工具方法(仅在本类内复用) ===== + + /** + * 空安全字符串 + */ + private static String nvl(String s) { + return s == null ? "" : s; + } + + /** + * 安全获取文件扩展名(小写,无扩展名返回空串) + */ + private static String safeExt(String fileName) { + if (StringUtils.isBlank(fileName)) return ""; + int lastSlash = Math.max(fileName.lastIndexOf('/'), fileName.lastIndexOf('\\')); + String base = lastSlash >= 0 ? fileName.substring(lastSlash + 1) : fileName; + int idx = base.lastIndexOf('.'); + if (idx <= 0 || idx == base.length() - 1) return ""; + return base.substring(idx + 1).toLowerCase(); + } + + /** + * 统一构建并确保目录存在 + */ + private Path ensureDir(String... parts) throws IOException { + Path p = Paths.get(parts[0], Arrays.copyOfRange(parts, 1, parts.length)); + Files.createDirectories(p); + return p; + } + + /** + * 将二进制流落盘 + */ + private void writeStreamToFile(InputStream in, Path target) throws IOException { + byte[] buffer = new byte[8192]; + try (InputStream src = in; FileOutputStream out = new FileOutputStream(target.toFile())) { + int len; + while ((len = src.read(buffer)) != -1) { + out.write(buffer, 0, len); + } + } + } + + /** + * 基于中文类型描述推断页码(公文用) + */ + private int inferPageNo(String fileTypeLabel) { + String t = nvl(fileTypeLabel); + if (t.contains("正文")) return 1; + if (t.contains("处理签")) return 2; + if (t.contains("底稿") || t.contains("稿纸")) return 3; + if (t.contains("其他")) return 4; + return 0; + } + + /** + * 写入文件表记录(最小侵入,仍复用 DanganguanliService 动态SQL) + */ + private void insertFileRecord(String fileTableName, int recId, String fileName, String fileNameServer, String filePath, String type, int pageNo, String dir) { + String fieldNameFile = "rec_id, file_name, file_name_server, file_path, file_type, page_no, file_des, file_status"; + String valueNameFile = recId + "," + + "'" + fileName + "'," + + "'" + fileNameServer + "'," + + "'" + filePath + "'," + + "'" + type + "'," + + pageNo + "," + + "'" + dir + "'," + + "1"; + Map mapFile = new HashMap<>(); + mapFile.put("tableName", fileTableName); + mapFile.put("fieldName", fieldNameFile); + mapFile.put("valueName", valueNameFile); + danganguanliService.saveObject(mapFile); + } + + /** + * 目标库幂等检查:判断某记录是否已存在 + */ + private boolean existsInTemp(String tempTableName, String whereSql) { + Map map = new HashMap<>(); + map.put("tableName", tempTableName); + map.put("conditionSql", whereSql); + Integer cnt = danganguanliService.selectObjectCount(map); + return cnt != null && cnt > 0; + } + + /** + * 目标库查询单条ID(便于复用已有记录追加文件) + */ + private Integer findSingleId(String tempTableName, String whereSql) { + Map map = new HashMap<>(); + map.put("tableName", tempTableName); + map.put("conditionSql", whereSql); + List> list = danganguanliService.selectObject(map); + if (CollectionUtils.isNotEmpty(list) && list.get(0).get("id") != null) { + return Integer.parseInt(String.valueOf(list.get(0).get("id"))); + } + return null; + } + + /** + * XML 文本内容转义 + */ + private static String xmlEscape(String s) { + if (s == null) return ""; + return s.replace("&", "&") + .replace("<", "<") + .replace(">", ">") + .replace("\"", """) + .replace("'", "'"); + } + + @RequestMapping(value="/documentDocking" , method= RequestMethod.POST) + @ApiOperation(value = "公文系统对接") + public AjaxJson documentDocking() { + AjaxJson json = new AjaxJson(); + if (log.isInfoEnabled()) { + log.info("[DOC] 公文对接开始, archiveXMLGenerate={}, uploadPath={}", archiveXMLGenerate, uploadPath); + } + //查询公文系统未归档数据 limit 10 + String sql = " select * from v_ez_zhengshifawen where ARCHIVING_STATUS = 0 "; + ResultSet resultSet = null; + ResultSet resultSetFile = null; + ResultSet resultSetDisposal = null; + ResultSet resultSetCount = null; + int j = 0; + int totalPending = 0; + String doc_no = ""; + try { + // 统计待处理条数 + String countSql = "select count(1) as CNT from v_ez_zhengshifawen where ARCHIVING_STATUS = 0"; + resultSetCount = YcjSystemIntegration.executeQuery(countSql); + if (resultSetCount.next()) { + totalPending = resultSetCount.getInt("CNT"); + } + if (log.isInfoEnabled()) { + log.info("[DOC] 待处理条数 totalPending={}", totalPending); + } + String tableName = "jhws_2016_20241228144818"; + String tempTableName = tableName + "_temp"; + String fileTableName = tableName + "_temp_file"; + if (log.isDebugEnabled()) { + log.debug("[DOC] 执行源库查询: {}", sql); + } + resultSet = YcjSystemIntegration.executeQuery(sql); + //把数据添加到简化表中 + String fieldName = "jigouwenti,created_date,filing_year,retention,archive_ctg_code,doc_no,fonds_no,maintitle,responsibleby,archive_flag,batch_id"; + String valueName = ""; + + String archive_ctg_code = "WS"; + + // 遍历结果集 + while (resultSet.next()) { + // 获取每一行的数据 wenyin_time cw_danwei qixian nianhao fenlei wenhao biaoti index_comment ARCHIVING_DATE + Timestamp wenyin_time = resultSet.getTimestamp("wenyin_time"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); // 定义格式为年月日时分 + String created_date = ""; + if(wenyin_time!=null){ + created_date = sdf.format(wenyin_time); + } + String cw_danwei = nvl(resultSet.getString("cw_danwei")); + String zhonglei = nvl(resultSet.getString("zhonglei")); + String zhusongdangwei = nvl(resultSet.getString("zhusongdanwei")); + String zhenwen = nvl(resultSet.getString("zhenwen")); + String zhutici = nvl(resultSet.getString("zhutici")); + String chaosongdanwei = nvl(resultSet.getString("chaosongdanwei")); + String jiaoxiao = nvl(resultSet.getString("jiaoxiao")); + String beizhu = nvl(resultSet.getString("beizhu")); + String miji = nvl(resultSet.getString("miji")); + int nianhao = resultSet.getInt("nianhao"); + String filing_year = ""; + if(nianhao != 0){ + filing_year = String.valueOf(nianhao); + } + String retention = nvl(resultSet.getString("qixian")); + String jigouwenti = nvl(resultSet.getString("fenlei")); + String fonds_no = nvl(resultSet.getString("FONDS_NO")); + fonds_no = "0240"; + int indexComment = resultSet.getInt("INDEX_COMMENT"); + doc_no = nvl(resultSet.getString("WENHAO")); + String maintitle = resultSet.getString("BIAOTI"); + String ARCHIVING_DATE = resultSet.getString("ARCHIVING_DATE"); + String responsibleby = resultSet.getString("RESPONSIBLEBY"); + valueName = "'" + jigouwenti + "'," + "'" + created_date + "'," + "'" + filing_year + "'," + "'" + retention + "'," + "'" + archive_ctg_code + "'," + "'" + doc_no + "'," + "'" + fonds_no + "'," + "'" + maintitle + "'," + "'" + responsibleby + "',"+ "'预归档未完成'" + "," + indexComment; + if (log.isInfoEnabled()) { + log.info("[DOC] 处理记录 indexComment={}, doc_no={}, title={}", indexComment, doc_no, maintitle); + } + + // 幂等:优先检查是否已存在相同 doc_no + batch_id 记录 + Integer jhId; + String whereSql = " 1=1 and doc_no='" + doc_no + "' and batch_id='" + indexComment + "' "; + if (existsInTemp(tempTableName, whereSql)) { + jhId = findSingleId(tempTableName, whereSql); + if (log.isDebugEnabled()) { + log.debug("[DOC] 命中幂等: 复用已有记录 id={}, where={}", jhId, whereSql); + } + } else { + Map mapTwo = new HashMap(); + mapTwo.put("tableName", tempTableName); + mapTwo.put("fieldName", fieldName); + mapTwo.put("valueName", valueName); + danganguanliService.saveObject(mapTwo); + jhId = Integer.parseInt(mapTwo.get("id").toString()); + if (log.isInfoEnabled()) { + log.info("[DOC] 新增主表记录 id={} (temp={})", jhId, tempTableName); + } + } + + String filePath = "uploadFile/" + fileTableName + "/" + jhId; + Path dirPath = ensureDir(uploadPath, filePath); + String dir = dirPath.toString(); + if (log.isDebugEnabled()) { + log.debug("[DOC] 目标目录: {}", dir); + } + //是否生成归档xml + if(archiveXMLGenerate){ + String head = ""; + String xml = " <目录>" + + " <成文单位>" + xmlEscape(cw_danwei) + "" + + " <种类>" + xmlEscape(zhonglei) + "" + + " <文号>" + xmlEscape(doc_no) + "" + + " <标题>" + xmlEscape(maintitle) + "" + + " <主送单位>" + xmlEscape(zhusongdangwei) + "" + + " <正文>" + xmlEscape(zhenwen) + "" + + " <主题词>" + xmlEscape(zhutici) + "" + + " <抄送单位>" + xmlEscape(chaosongdanwei) + "" + + " <文印日期>" + created_date + "" + + " <份数>" + "" + + " <档案签收>" + "" + + " <分类>" + jigouwenti + "" + + " <分类序号>" + "" + + " <文件页数>" + "" + + " <案卷页数>" + "" + + " <序号>" + "" + + " <卷号>" + "" + + " <年号>" + filing_year + "" + + " <期限>" + retention + "" + + " <查阅数>" + "" + + " <借阅数>" + "" + + " <出借标志>" + "" + + " <文件唯一号>" + "" + + " <件标示>" + "" + + " <件内序号>" + "" + + " <缴销>" + xmlEscape(jiaoxiao) + "" + + " <备注>" + xmlEscape(beizhu) + "" + + " <密级>" + xmlEscape(miji) + "" + + " <文件类型>" + "" + + " <文件编号>" + "" + + " <签发人>" + "" + + " <文种>" + "" + + " <承办部门>" + "" + + " <督办事项>" + "" + + " <归档份数>" + "" + + " <全文>" + "" + + " <收发类型>" + "" + + " <收文日期>" + "" + + " <收文编号>" + "" + + " <领导批示>" + "" + + " <办理结果>" + "" + + " <缓急度>" + "" + + " <标准文号>" + "" + + " <文件分类>" + "" + + " <全宗号>" + xmlEscape(fonds_no) + "" + + " <归档状态>" + "" + + " <归档时间>" + ARCHIVING_DATE + "" + + " <责任者>" + xmlEscape(responsibleby) + "" + + " "; + String content = head + xml; + String newContent = FileTool.formatXml(content); + FileTool.write(newContent, dirPath.resolve(indexComment + ".xml").toString()); + String fileName = indexComment + ".xml"; + String fileNameServer = indexComment + ".xml"; + String type = "xml"; + insertFileRecord(fileTableName, jhId, fileName, fileNameServer, filePath, type, 1, dir); + if (log.isInfoEnabled()) { + log.info("[CONTRACT] 生成XML文件并登记: {}", dirPath.resolve(fileName)); + } + if (log.isInfoEnabled()) { + log.info("[DOC] 生成XML文件并登记: {}", dirPath.resolve(fileName)); + } + + } + //查询公文文件表 + String sqlFile = " select * from fujian where fawen_index = " + indexComment; + // 打印fawen_index对应的记录数量 + String sqlCount = " select count(*) as record_count from fujian where fawen_index = " + indexComment; + ResultSet countResult = YcjSystemIntegration.executeQuery(sqlCount); + if (countResult.next()) { + int recordCount = countResult.getInt("record_count"); + if (log.isInfoEnabled()) { + log.info("[DOC] fawen_index={} 对应的记录数量: {}", indexComment, recordCount); + } + } + CityBusinessSystemIntegration.closeResources(null, null, countResult); + resultSetFile = YcjSystemIntegration.executeQuery(sqlFile); + + while (resultSetFile.next()) { + String fileName = resultSetFile.getString("file_path"); + // String[] split = file_path.split("/"); + // String fileName = split[split.length-1]; + String file_type = resultSetFile.getString("file_type"); + InputStream binaryStream = resultSetFile.getBinaryStream("sound_image"); + String myuuid = StringUtil.generaterUUID(); + String fileNameServer =myuuid + fileName; + Path target = dirPath.resolve(fileNameServer); + if(binaryStream != null){ + try { + writeStreamToFile(binaryStream, target); + String type = safeExt(fileName); + int pageNo = inferPageNo(nvl(file_type)); + // 避免重复文件记录:以rec_id+file_name去重 + if (!existsInTemp(fileTableName, " rec_id='" + jhId + "' and file_name='" + fileName + "' ")) { + insertFileRecord(fileTableName, jhId, fileName, fileNameServer, filePath, type, pageNo == 0 ? 1 : pageNo, dir); + if (log.isInfoEnabled()) { + log.info("[DOC] 保存附件: fileName={}, serverName={}, type={}, pageNo={}, path={}", + fileName, fileNameServer, type, (pageNo == 0 ? 1 : pageNo), target); + } + } else if (log.isDebugEnabled()) { + log.debug("[DOC] 跳过重复附件登记: rec_id={}, fileName={}", jhId, fileName); + } + if(type.equalsIgnoreCase("jpg")||type.equalsIgnoreCase("png") ){ + //生成一份pdf文件,用于归档章的操作 + + String newName_pdf=fileNameServer.replace("."+type,".pdf"); + PdfFileHelper.image2Pdf(dirPath.resolve(fileNameServer).toString(),dirPath.resolve(newName_pdf).toString()); + + String newName_pdf_original=newName_pdf.replace(".pdf","_original.pdf"); + FileTool.copyFile(dirPath.resolve(newName_pdf).toString(),dirPath.resolve(newName_pdf_original).toString()); + } + } catch (IOException e) { + log.error("[DOC] 保存附件失败 indexComment={}, fileName={}", indexComment, fileName, e); + e.printStackTrace(); + } finally { + binaryStream.close(); // 关闭流很重要,避免资源泄露 + } + } else { + if (log.isInfoEnabled()) { + log.info("[DOC] binaryStream为空,跳过文件处理: fawen_index={}, fileName={}", indexComment, fileName); + } + } + } + //更新原文数量 + Map map7=new HashMap<>(); + map7.put("tableName",tempTableName); + map7.put("tableName2",fileTableName); + map7.put("id",jhId); + danganguanliService.wsajmlTempCount(map7); + + //查询处置行为 + String sqlCZxw = " select * from chuzhixingwei where YW_ID = " + indexComment; + resultSetDisposal = YcjSystemIntegration.executeQuery(sqlCZxw); + while (resultSetDisposal.next()) { + String ACTIVITY = resultSetDisposal.getString("ACTIVITY"); + String DESCRIPTION = resultSetDisposal.getString("DESCRIPTION"); + String PROCESS_USER = resultSetDisposal.getString("PROCESS_USER"); + String PROCESS_TIME = resultSetDisposal.getString("PROCESS_TIME"); + OperLogger operLogger = new OperLogger(); + operLogger.setDescription(DESCRIPTION); + operLogger.setArgs(ACTIVITY); + operLogger.setOperatorChn(PROCESS_USER); + operLogger.setOperateDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(PROCESS_TIME)); + operLogger.setRecNums(String.valueOf(indexComment)); + operLoggerMapper.insertSelective(operLogger); + } + //最后更新归档状态 + String updateSql = "update v_ez_zhengshifawen set ARCHIVING_STATUS = 1 where index_comment = " + indexComment; + YcjSystemIntegration.executeUpdate(updateSql); + if (log.isInfoEnabled()) { + log.info("[DOC] 回写源库归档状态成功 indexComment={}", indexComment); + } + j++; + //添加日志 + ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + User user = null; + if (servletRequestAttributes != null) { + HttpServletRequest request = servletRequestAttributes.getRequest(); + UserRole userRole = userService.getUserRole(request); + if (userRole != null) user = userRole.getUser(); + } + if (user != null) { + //记录日志 + java.util.Date date = new Date(); + OperLogger entity = new OperLogger(); + entity.setLogType("7"); + entity.setOperator(user.getUsername()); + entity.setOperatorChn(user.getUserChnName()); + entity.setOperateDate(date); + entity.setDescription("公文系统成功归档"+doc_no+"的文号"); + entity.setArgs("公文系统成功归档"+doc_no+"的文号"); + operLoggerService.addEntity(entity); + } + } + if (log.isInfoEnabled()) log.info("[DOC] 公文对接完成, 待处理条数={}, 成功处理条数={}", totalPending, j); + json = AjaxJson.returnInfo("成功接收" + j + "条"); + } catch (Exception e) { + log.error("[DOC] 公文对接失败 doc_no={}", doc_no, e); + //添加日志 + ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + User user = null; + if (servletRequestAttributes != null) { + HttpServletRequest request = servletRequestAttributes.getRequest(); + UserRole userRole = userService.getUserRole(request); + if (userRole != null) user = userRole.getUser(); + } + if (user != null) { + //记录日志 + java.util.Date date = new Date(); + OperLogger entity = new OperLogger(); + entity.setLogType("7"); + entity.setOperator(user.getUsername()); + entity.setOperatorChn(user.getUserChnName()); + entity.setOperateDate(date); + entity.setDescription("公文系统失败归档"+doc_no+"的文号"); + entity.setArgs("公文系统失败归档"+e.toString()); + operLoggerService.addEntity(entity); + } + json = AjaxJson.returnExceptionInfo(e.toString()); + } finally { + CityBusinessSystemIntegration.closeResources(null, null, resultSet); + CityBusinessSystemIntegration.closeResources(null, null, resultSetFile); + CityBusinessSystemIntegration.closeResources(null, null, resultSetDisposal); + CityBusinessSystemIntegration.closeResources(null, null, resultSetCount); + } + + return json; + } + + + @RequestMapping(value="/contractDocking" , method= RequestMethod.POST) + @ApiOperation(value = "合同系统对接") + public AjaxJson contractDocking() { + AjaxJson json = new AjaxJson(); + if (log.isInfoEnabled()) { + log.info("[CONTRACT] 合同对接开始, archiveXMLGenerate={}, uploadPath={}", archiveXMLGenerate, uploadPath); + } + //查询公文系统未归档数据 limit 10 + String sql = " select * from v_ez_contract where ARCHIVING_STATUS = 0 "; + ResultSet resultSet = null; + ResultSet resultSetFile = null; + ResultSet resultSetDisposal = null; + ResultSet resultSetCount = null; + int j = 0; + int totalPending = 0; + String cont_no = ""; + try { + // 统计待处理条数 + String countSql = "select count(1) as CNT from v_ez_contract where ARCHIVING_STATUS = 0"; + resultSetCount = YcjSystemIntegration.executeQuery(countSql); + if (resultSetCount.next()) { + totalPending = resultSetCount.getInt("CNT"); + } + if (log.isInfoEnabled()) { + log.info("[CONTRACT] 待处理条数 totalPending={}", totalPending); + } + //鄂州合同档案表 + String tableName = "ht_table_20250403105425"; +// String tableName = "ht_table_20250403110716"; + String tempTableName = tableName + "_temp"; + String fileTableName = tableName + "_temp_file"; + if (log.isDebugEnabled()) { + log.debug("[CONTRACT] 执行源库查询: {}", sql); + } + resultSet = YcjSystemIntegration.executeQuery(sql); + //把数据添加到简化表中 + String fieldName = "cont_no,cont_name,cont_org_name,cont_type,cont_amount_type,cont_amount,cont_amt_description,cont_signing_date,cont_start_date,cont_end_date,cont_cooperate_name,cont_business_license,cont_registration_authority,cont_corp_type,cont_business_range,cont_registered_capital,cont_founted,cont_corp_address,cont_legal_representative,cont_contact_phone,cont_open_bank,cont_bank_amount,fonds_no,retention,archive_ctg_no,created_date,maintitle,responsibleby,archive_flag,batch_id"; + String valueName = ""; + // 遍历结果集 + while (resultSet.next()) { + // 获取每一行的数据 wenhao biaoti index_comment ARCHIVING_DATE + cont_no = resultSet.getString("CONT_NO"); + if (cont_no == null) { + cont_no = ""; + } + String cont_name = resultSet.getString("CONT_NAME"); + if (cont_name == null) { + cont_name = ""; + } + String cont_org_name = resultSet.getString("CONT_ORG_NAME"); + if (cont_org_name == null) { + cont_org_name = ""; + } + String cont_type = resultSet.getString("CONT_TYPE"); + if (cont_type == null) { + cont_type = ""; + }else{ + if(cont_type.equals("1")){ + cont_type = "采购合同"; + } + if(cont_type.equals("2")){ + cont_type = "非采购合同"; + } + if(cont_type.equals("3")){ + cont_type = "招标代理协议"; + } + if(cont_type.equals("4")){ + cont_type = "供应商入库协议"; + } + } + String cont_amount_type = resultSet.getString("CONT_AMOUNT_TYPE"); + if (cont_amount_type == null) { + cont_amount_type = ""; + }else{ + if(cont_amount_type.equals("1")){ + cont_amount_type = "其他合同"; + } + if(cont_amount_type.equals("2")){ + cont_amount_type = "总价合同"; + } + } + BigDecimal CONT_AMOUNT_bigDecimal = resultSet.getBigDecimal("CONT_AMOUNT"); + String cont_amount = ""; + if(CONT_AMOUNT_bigDecimal != null){ + cont_amount = CONT_AMOUNT_bigDecimal.toString(); + } + String cont_amt_description = resultSet.getString("CONT_AMT_DESCRIPTION"); + if (cont_amt_description == null) { + cont_amt_description = ""; + } + String cont_signing_date = resultSet.getString("CONT_SIGNING_DATE"); + if (cont_signing_date == null) { + cont_signing_date = ""; + } + String cont_start_date = resultSet.getString("CONT_START_DATE"); + if (cont_start_date == null) { + cont_start_date = ""; + } + String cont_end_date = resultSet.getString("CONT_END_DATE"); + if (cont_end_date == null) { + cont_end_date = ""; + } + String cont_cooperate_name = resultSet.getString("CONT_COOPERATE_NAME"); + if (cont_cooperate_name == null) { + cont_cooperate_name = ""; + } + String cont_business_license = resultSet.getString("CONT_BUSINESS_LICENSE"); + if (cont_business_license == null) { + cont_business_license = ""; + } + String cont_registration_authority = resultSet.getString("CONT_REGISTRATION_AUTHORITY"); + if (cont_registration_authority == null) { + cont_registration_authority = ""; + } + String cont_corp_type = resultSet.getString("CONT_CORP_TYPE"); + if (cont_corp_type == null) { + cont_corp_type = ""; + } + String cont_business_range = resultSet.getString("CONT_BUSINESS_RANGE"); + if (cont_business_range == null) { + cont_business_range = ""; + } + BigDecimal CONT_REGISTERED_CAPITAL_bigDecimal = resultSet.getBigDecimal("CONT_REGISTERED_CAPITAL"); + String cont_registered_capital = ""; + if(CONT_REGISTERED_CAPITAL_bigDecimal != null){ + cont_registered_capital = CONT_REGISTERED_CAPITAL_bigDecimal.toString(); + } + String cont_founted = resultSet.getString("CONT_FOUNTED"); + if (cont_founted == null) { + cont_founted = ""; + } + String cont_corp_address = resultSet.getString("CONT_CORP_ADDRESS"); + if (cont_corp_address == null) { + cont_corp_address = ""; + } + String cont_legal_representative = resultSet.getString("CONT_LEGAL_REPRESENTATIVE"); + if (cont_legal_representative == null) { + cont_legal_representative = ""; + } + String cont_contact_phone = resultSet.getString("CONT_CONTACT_PHONE"); + if (cont_contact_phone == null) { + cont_contact_phone = ""; + } + String cont_open_bank = resultSet.getString("CONT_OPEN_BANK"); + if (cont_open_bank == null) { + cont_open_bank = ""; + } + String cont_bank_amount = resultSet.getString("CONT_BANK_AMOUNT"); + if (cont_bank_amount == null) { + cont_bank_amount = ""; + } + String fonds_no = resultSet.getString("FONDS_NO"); + //固定的全宗号 + fonds_no = "0240"; + int indexComment = resultSet.getInt("ROW_ID"); + String maintitle = resultSet.getString("CONT_NAME"); + String retention = resultSet.getString("CONT_RETENTION_PERIOD"); + if(retention == null){ + retention = ""; + } + String archive_ctg_no = resultSet.getString("CONT_ARCHIVE_CLASSIFICATION"); + if(archive_ctg_no == null){ + archive_ctg_no = ""; + } + Timestamp archiving_date = resultSet.getTimestamp("ARCHIVING_DATE"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); // 定义格式为年月日时分 + String created_date = ""; + if(archiving_date!=null){ + created_date = sdf.format(archiving_date); + } + String responsibleby = resultSet.getString("CONT_RESPONSIBLE"); + if(responsibleby == null){ + responsibleby = ""; + } + valueName = "'" + cont_no + "'," + "'" + cont_name + "'," + "'" + cont_org_name + "'," + "'" + cont_type + "'," + "'" + cont_amount_type + "'," + "'" + cont_amount + "'," + "'" + cont_amt_description + "'," + "'" + cont_signing_date + "'," + "'" + cont_start_date + "'," + "'" + cont_end_date + "'," + "'" + cont_cooperate_name + "'," + "'" + cont_business_license + "'," + "'" + cont_registration_authority + "'," + "'" + cont_corp_type + "'," + "'" + cont_business_range + "'," + "'" + cont_registered_capital + "'," + "'" + cont_founted + "'," + "'" + cont_corp_address + "'," + "'" + cont_legal_representative + "'," + "'" + cont_contact_phone + "'," + "'" + cont_open_bank + "'," + "'" + cont_bank_amount + "'," + "'" + fonds_no + "'," + "'" + retention + "'," + "'" + archive_ctg_no + "'," + "'" + created_date + "'," + "'" + maintitle + "'," + "'" + responsibleby + "',"+ "'预归档未完成'" + "," + indexComment; + if (log.isInfoEnabled()) { + log.info("[CONTRACT] 处理记录 rowId={}, cont_no={}, name={}", indexComment, cont_no, maintitle); + } + // 幂等:优先检查 cont_no + batch_id + Integer jhId; + String whereSql = " 1=1 and cont_no='" + cont_no + "' and batch_id='" + indexComment + "' "; + if (existsInTemp(tempTableName, whereSql)) { + jhId = findSingleId(tempTableName, whereSql); + if (log.isDebugEnabled()) { + log.debug("[CONTRACT] 命中幂等: 复用已有记录 id={}, where={}", jhId, whereSql); + } + } else { + Map mapTwo = new HashMap(); + mapTwo.put("tableName", tempTableName); + mapTwo.put("fieldName", fieldName); + mapTwo.put("valueName", valueName); + danganguanliService.saveObject(mapTwo); + jhId = Integer.parseInt(mapTwo.get("id").toString()); + if (log.isInfoEnabled()) { + log.info("[CONTRACT] 新增主表记录 id={} (temp={})", jhId, tempTableName); + } + } + String filePath = "uploadFile/" + fileTableName + "/" + jhId; + Path dirPath = ensureDir(uploadPath, filePath); + String dir = dirPath.toString(); + if (log.isDebugEnabled()) { + log.debug("[CONTRACT] 目标目录: {}", dir); + } + //是否生成归档xml + if(archiveXMLGenerate){ + String head = ""; + String xml = " <目录>" + + " <自增行号>" + indexComment + "" + + " <合同编号>" + xmlEscape(cont_no) + "" + + " <合同名称>" + xmlEscape(cont_name) + "" + + " <甲方>" + xmlEscape(cont_org_name) + "" + + " <合同类型>" + xmlEscape(cont_type) + "" + + " <金额类别>" + xmlEscape(cont_amount_type) + "" + + " <合同金额>" + xmlEscape(cont_amount) + "" + + " <合同标的额备注>" + xmlEscape(cont_amt_description) + "" + + " <签订日期>" + cont_signing_date + "" + + " <合同履约起日期>" + cont_start_date + "" + + " <合同履约止日期>" + cont_end_date + "" + + " <合作方单位名称>" + xmlEscape(cont_cooperate_name) + "" + + " <营业执照号>" + xmlEscape(cont_business_license) + "" + + " <登记机关>" + xmlEscape(cont_registration_authority) + "" + + " <企业类型>" + xmlEscape(cont_corp_type) + "" + + " <经营范围>" + xmlEscape(cont_business_range) + "" + + " <注册资金>" + xmlEscape(cont_registered_capital) + "" + + " <成立时间>" + xmlEscape(cont_founted) + "" + + " <企业地址>" + xmlEscape(cont_corp_address) + "" + + " <法人代表>" + xmlEscape(cont_legal_representative) + "" + + " <法人联系电话>" + xmlEscape(cont_contact_phone) + "" + + " <企业账号开户银行>" + xmlEscape(cont_open_bank) + "" + + " <银行账号>" + xmlEscape(cont_bank_amount) + "" + + " <保管期限>" + xmlEscape(retention) + "" + + " <归档分类>" + xmlEscape(archive_ctg_no) + "" + + " <责任者>" + xmlEscape(responsibleby) + "" + + " <全宗号>" + xmlEscape(fonds_no) + "" + + " <归档状态>" + "已归档" + "" + + " <归档时间>" + created_date + "" + + " "; + String content = head + xml; + String newContent = FileTool.formatXml(content); + FileTool.write(newContent, dirPath.resolve(indexComment + ".xml").toString()); + String fileName = indexComment + ".xml"; + String fileNameServer = indexComment + ".xml"; + String type = "xml"; + insertFileRecord(fileTableName, jhId, fileName, fileNameServer, filePath, type, 1, dir); + + } + //查询公文文件表 + String sqlFile = " select * from fujian where fawen_index = " + indexComment; + // 打印fawen_index对应的记录数量 + String sqlCount = " select count(*) as record_count from fujian where fawen_index = " + indexComment; + ResultSet countResult = YcjSystemIntegration.executeQuery(sqlCount); + if (countResult.next()) { + int recordCount = countResult.getInt("record_count"); + if (log.isInfoEnabled()) { + log.info("[CONTRACT] fawen_index={} 对应的记录数量: {}", indexComment, recordCount); + } + } + CityBusinessSystemIntegration.closeResources(null, null, countResult); + resultSetFile = YcjSystemIntegration.executeQuery(sqlFile); + while (resultSetFile.next()) { + String fileName = resultSetFile.getString("file_path"); +// String[] split = file_path.split("/"); +// String fileName = split[split.length-1]; + String file_type = resultSetFile.getString("file_type"); + InputStream binaryStream = resultSetFile.getBinaryStream("sound_image"); + String fileBase64 = resultSetFile.getString("sound_image"); + String myuuid = StringUtil.generaterUUID(); + String fileNameServer =myuuid + fileName; + Path target = dirPath.resolve(fileNameServer); + //base64解析 +// if(StringUtils.isNotEmpty(fileBase64)){ +// Base64Utils.decode2(fileUrl,fileBase64); +// int i = 1; +// String[] strings = fileName.split("\\."); +// String type = strings[strings.length - 1].toLowerCase(); +// int pageNo = 0; +// if(file_type.contains("正文")){ +// pageNo = 1; +// } +// if(file_type.contains("处理签")){ +// pageNo = 2; +// } +// if(file_type.contains("稿纸")){ +// pageNo = 3; +// } +// if(file_type.contains("其他")){ +// pageNo = 4; +// } +// //把文件数据添加到file表中 +// String fieldNameFile = +// "rec_id, " + +// "file_name, " + +// "file_name_server, " + +// "file_path, " + +// "file_type," + +// +// "page_no," + +// "file_des," + +// "file_status"; +// String valueNameFile = +// "" + jhId + "," + +// "'" + fileName+ "'," + +// "'" + fileNameServer+ "'," + +// "'" + filePath + "'," + +// "'" + type + "'," + +// +// i + "," + +// "'" + dir + "'," + +// "1"; +// Map mapFile = new HashMap(); +// mapFile.put("tableName", fileTableName); +// //其实我们知道是哪些字段 +// mapFile.put("fieldName", fieldNameFile); +// mapFile.put("valueName", valueNameFile); +// danganguanliService.saveObject(mapFile); +// if(type.equals("jpg")||type.equals("png") ){ +// //生成一份pdf文件,用于归档章的操作 +// String newName_pdf=fileNameServer.replace("."+type,".pdf"); +// PdfFileHelper.image2Pdf(dir+File.separator+fileNameServer,dir+File.separator+newName_pdf); +// +// String newName_pdf_original=newName_pdf.replace(".pdf","_original.pdf"); +// FileTool.copyFile(dir+File.separator+newName_pdf,dir+File.separator+newName_pdf_original); +// } +// i++; +// } + if(binaryStream != null){ + try { + writeStreamToFile(binaryStream, target); + String type = safeExt(fileName); + // 避免重复文件记录:以rec_id+file_name去重 + if (!existsInTemp(fileTableName, " rec_id='" + jhId + "' and file_name='" + fileName + "' ")) { + insertFileRecord(fileTableName, jhId, fileName, fileNameServer, filePath, type, 1, dir); + if (log.isInfoEnabled()) { + log.info("[CONTRACT] 保存附件: fileName={}, serverName={}, type={}, path={}", fileName, fileNameServer, type, target); + } + } else if (log.isDebugEnabled()) { + log.debug("[CONTRACT] 跳过重复附件登记: rec_id={}, fileName={}", jhId, fileName); + } + if(type.equalsIgnoreCase("jpg")||type.equalsIgnoreCase("png") || type.equalsIgnoreCase("pdf") ){ + //生成一份pdf文件,用于归档章的操作 + String newName_pdf=fileNameServer.replace("."+type,".pdf"); + PdfFileHelper.image2Pdf(dirPath.resolve(fileNameServer).toString(),dirPath.resolve(newName_pdf).toString()); + + String newName_pdf_original=newName_pdf.replace(".pdf","_original.pdf"); + FileTool.copyFile(dirPath.resolve(newName_pdf).toString(),dirPath.resolve(newName_pdf_original).toString()); + if (log.isDebugEnabled()) { + log.debug("[CONTRACT] 生成PDF及原始副本: {}, {}", dirPath.resolve(newName_pdf), dirPath.resolve(newName_pdf_original)); + } + } + } catch (IOException e) { + log.error("[CONTRACT] 保存附件失败 rowId={}, fileName={}", indexComment, fileName, e); + e.printStackTrace(); + } finally { + binaryStream.close(); // 关闭流很重要,避免资源泄露 + } + } else { + if (log.isInfoEnabled()) { + log.info("[CONTRACT] binaryStream为空,跳过文件处理: fawen_index={}, fileName={}", indexComment, fileName); + } + } + } + //更新原文数量 + Map map7=new HashMap<>(); + map7.put("tableName",tempTableName); + map7.put("tableName2",fileTableName); + map7.put("id",jhId); + danganguanliService.wsajmlTempCount(map7); + + //查询处置行为 + String sqlCZxw = " select * from chuzhixingwei where YW_ID = " + indexComment; + resultSetDisposal = YcjSystemIntegration.executeQuery(sqlCZxw); + while (resultSetDisposal.next()) { + String ACTIVITY = resultSetDisposal.getString("ACTIVITY"); + String DESCRIPTION = resultSetDisposal.getString("DESCRIPTION"); + String PROCESS_USER = resultSetDisposal.getString("PROCESS_USER"); + String PROCESS_TIME = resultSetDisposal.getString("PROCESS_TIME"); + OperLogger operLogger = new OperLogger(); + operLogger.setDescription(DESCRIPTION); + operLogger.setArgs(ACTIVITY); + operLogger.setOperatorChn(PROCESS_USER); + operLogger.setOperateDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(PROCESS_TIME)); + operLogger.setRecNums(String.valueOf(indexComment)); + operLoggerMapper.insertSelective(operLogger); + } + //最后更新归档状态 + String updateSql = "update v_ez_contract set ARCHIVING_STATUS = 1 where ROW_ID = " + indexComment; + YcjSystemIntegration.executeUpdate(updateSql); + if (log.isInfoEnabled()) { + log.info("[CONTRACT] 回写源库归档状态成功 rowId={}", indexComment); + } + j++; + + //添加日志 + ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + User user = null; + if (servletRequestAttributes != null) { + HttpServletRequest request = servletRequestAttributes.getRequest(); + UserRole userRole = userService.getUserRole(request); + if (userRole != null) user = userRole.getUser(); + } + if (user != null) { + //记录日志 + java.util.Date date = new Date(); + OperLogger entity = new OperLogger(); + entity.setLogType("7"); + entity.setOperator(user.getUsername()); + entity.setOperatorChn(user.getUserChnName()); + entity.setOperateDate(date); + entity.setDescription("合同系统成功归档"+cont_no+"的合同号"); + entity.setArgs("合同系统成功归档"+cont_no+"的合同号"); + operLoggerService.addEntity(entity); + } + } + if (log.isInfoEnabled()) log.info("[CONTRACT] 合同对接完成, 待处理条数={}, 成功处理条数={}", totalPending, j); + json = AjaxJson.returnInfo("成功接收"+ j +"条"); + } catch (Exception e) { + log.error("[CONTRACT] 合同对接失败 cont_no={}", cont_no, e); + json = AjaxJson.returnExceptionInfo(e.toString()); + //添加日志 + ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + User user = null; + if (servletRequestAttributes != null) { + HttpServletRequest request = servletRequestAttributes.getRequest(); + UserRole userRole = userService.getUserRole(request); + if (userRole != null) user = userRole.getUser(); + } + if (user != null) { + //记录日志 + java.util.Date date = new Date(); + OperLogger entity = new OperLogger(); + entity.setLogType("7"); + entity.setOperator(user.getUsername()); + entity.setOperatorChn(user.getUserChnName()); + entity.setOperateDate(date); + entity.setDescription("合同系统失败归档"+cont_no+"的合同号"); + entity.setArgs("合同系统失败归档"+e.toString()); + operLoggerService.addEntity(entity); + } + } finally { + CityBusinessSystemIntegration.closeResources(null, null, resultSet); + CityBusinessSystemIntegration.closeResources(null, null, resultSetFile); + CityBusinessSystemIntegration.closeResources(null, null, resultSetDisposal); + CityBusinessSystemIntegration.closeResources(null, null, resultSetCount); + } + return json; + } + + @RequestMapping(value="/testConnection" , method= RequestMethod.POST) + @ApiOperation(value = "测试数据库连接") + public AjaxJson testConnection() { + AjaxJson json = new AjaxJson(); + try { + if (log.isInfoEnabled()) { + log.info("[TEST] 开始测试数据库连接..."); + } + + // 先测试网络连通性 + if (log.isInfoEnabled()) { + log.info("[TEST] 测试网络连通性..."); + } + try { + java.net.Socket socket = new java.net.Socket(); + socket.connect(new java.net.InetSocketAddress("localhost", 3306), 3000); + socket.close(); + if (log.isInfoEnabled()) { + log.info("[TEST] 网络连通性测试成功"); + } + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("[TEST] 网络连通性测试失败: {}", e.getMessage()); + } + return AjaxJson.returnExceptionInfo("网络连通性测试失败: " + e.getMessage()); + } + + // 测试JDBC连接 + if (log.isInfoEnabled()) { + log.info("[TEST] 测试JDBC连接..."); + } + String testSql = "SELECT 1 as test"; + ResultSet resultSet = CityBusinessSystemIntegration.executeQuery(testSql); + if (resultSet.next()) { + if (log.isInfoEnabled()) { + log.info("[TEST] 数据库连接测试成功"); + } + json = AjaxJson.returnInfo("数据库连接成功"); + } + CityBusinessSystemIntegration.closeResources(null, null, resultSet); + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("[TEST] 数据库连接测试失败: {}", e.getMessage(), e); + } + json = AjaxJson.returnExceptionInfo("数据库连接失败: " + e.getMessage()); + } + return json; + } + + @RequestMapping(value="/productSalesDocking" , method= RequestMethod.POST) + @ApiOperation(value = "在销品牌对接") + public AjaxJson productSalesDocking() { + AjaxJson json = new AjaxJson(); + if (log.isInfoEnabled()) { + log.info("[PRODUCT_SALES] 在销品牌对接开始, archiveXMLGenerate={}, uploadPath={}", archiveXMLGenerate, uploadPath); + } + + ResultSet resultSet = null; + ResultSet resultSetFile = null; + ResultSet resultSetCount = null; + int j = 0; + int totalPending = 0; + String recordId = ""; + try { + // 使用统一的sales表 + String tableName = "sales_20251019171058"; + String tempTableName = tableName+"_temp"; + String fileTableName = tableName + "_file"; + + // 统计四个表的总条数 + String[] tableNames = {"cc_tbc_product_ez", "cc_tbc_drawout_ez", "scm_rpt_bizstordayreport_ez", "ec_exp_apply_accept_ez"}; + + // 先测试数据库连接 + if (log.isInfoEnabled()) { + log.info("[PRODUCT_SALES] 测试数据库连接..."); + } + try { + String testSql = "SELECT 1 as test"; + resultSetCount = CityBusinessSystemIntegration.executeQuery(testSql); + if (resultSetCount.next()) { + if (log.isInfoEnabled()) { + log.info("[PRODUCT_SALES] 数据库连接测试成功"); + } + } + CityBusinessSystemIntegration.closeResources(null, null, resultSetCount); + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("[PRODUCT_SALES] 数据库连接测试失败: {}", e.getMessage(), e); + } + throw e; + } + + // 测试表是否存在 + if (log.isInfoEnabled()) { + log.info("[PRODUCT_SALES] 检查表是否存在..."); + } + for (String sourceTable : tableNames) { + try { + String tableTestSql = "SELECT 1 FROM " + sourceTable + " LIMIT 1"; + resultSetCount = CityBusinessSystemIntegration.executeQuery(tableTestSql); + if (resultSetCount.next()) { + if (log.isInfoEnabled()) { + log.info("[PRODUCT_SALES] 表 {} 存在且可访问", sourceTable); + } + } + CityBusinessSystemIntegration.closeResources(null, null, resultSetCount); + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("[PRODUCT_SALES] 表 {} 不存在或无法访问: {}", sourceTable, e.getMessage()); + } + } + } + totalPending = 0; + + if (log.isInfoEnabled()) { + log.info("[PRODUCT_SALES] 开始统计四个表的数据量..."); + } + + for (String sourceTable : tableNames) { + String countSql = "select count(1) as CNT from " + sourceTable + " where 1=1"; + if ("scm_rpt_bizstordayreport_ez".equals(sourceTable)) { + countSql = "select count(1) as CNT from " + sourceTable + " where biz_date >= '2025-01-01'"; + } + resultSetCount = CityBusinessSystemIntegration.executeQuery(countSql); + if (resultSetCount.next()) { + int tableCount = resultSetCount.getInt("CNT"); + totalPending += tableCount; + if (log.isInfoEnabled()) { + log.info("[PRODUCT_SALES] 表 {} 的数据量: {} 条", sourceTable, tableCount); + } + } + CityBusinessSystemIntegration.closeResources(null, null, resultSetCount); + } + + if (log.isInfoEnabled()) { + log.info("[PRODUCT_SALES] 四个表总条数 totalPending={}", totalPending); + } + + // 处理四个表的数据 + for (String sourceTable : tableNames) { + String sql = " select * from " + sourceTable; + if ("scm_rpt_bizstordayreport_ez".equals(sourceTable)) { + sql += " where biz_date >= '2025-01-01' order by biz_date LIMIT 10"; + } else { + sql += " LIMIT 10"; + } + + if (log.isDebugEnabled()) { + log.debug("[PRODUCT_SALES] 执行源库查询: {}", sql); + } + resultSet = CityBusinessSystemIntegration.executeQuery(sql); + + // 遍历结果集 + int recordCount = 0; + while (resultSet.next()) { + recordCount++; + // 每处理100条记录打印一次进度 + if (recordCount % 100 == 0) { + if (log.isInfoEnabled()) { + log.info("[PRODUCT_SALES] 已处理表{}的{}条记录", sourceTable, recordCount); + } + } + String valueName = ""; + String maintitle = ""; + String responsibleby = "系统管理员"; + String fonds_no = "0240"; + String retention = "永久"; + String archive_ctg_no = "CP"; + String created_date = new SimpleDateFormat("yyyyMMdd").format(new Date()); + + // 声明所有可能的变量,确保在XML生成部分可以访问 + String product_uuid = ""; + String product_code = ""; + String product_name = ""; + String factory_simple_name = ""; + String brand_name = ""; + String is_abnormity = ""; + BigDecimal length = null; + BigDecimal width = null; + BigDecimal height = null; + BigDecimal tar_qty = null; + String bar_code = ""; + BigDecimal package_qty = null; + String bar_code2 = ""; + BigDecimal package_qty2 = null; + String bar_code3 = ""; + BigDecimal package_qty3 = null; + String price_type_code = ""; + BigDecimal direct_whole_price = null; + BigDecimal direct_retail_price = null; + String is_province = ""; + String is_seized = ""; + BigDecimal adjust_price = null; + BigDecimal retail_price = null; + BigDecimal whole_sale_price = null; + String in_begin_date = ""; + String sale_begin_date = ""; + String out_begin_date = ""; + + String org_name = ""; + String quit_uuid = ""; + String drawout_date = ""; + String quit_date = ""; + String comment = ""; + String creater_name = ""; + String syscreatedate = ""; + + String biz_date = ""; + String manage_unit_uuid = ""; + String stor_uuid = ""; + String stor_name = ""; + String product_uuid2 = ""; + String product_code2 = ""; + String unit_uuid = ""; + String unit_name = ""; + BigDecimal last_qty = null; + BigDecimal buy_qty = null; + BigDecimal sale_qty = null; + BigDecimal dec_qty = null; + BigDecimal rest_qty = null; + BigDecimal last_amount = null; + BigDecimal buy_amount = null; + BigDecimal sale_amount = null; + BigDecimal dec_amount = null; + BigDecimal rest_amount = null; + String manage_unit_uuid2 = ""; + BigDecimal buy_notax_amount = null; + BigDecimal movein_qty = null; + BigDecimal movein_notax_amount = null; + BigDecimal movein_amount = null; + BigDecimal movein_cost = null; + BigDecimal moveout_qty = null; + BigDecimal moveout_notax_amount = null; + BigDecimal moveout_amount = null; + BigDecimal moveout_cost = null; + BigDecimal sale_notax_amount = null; + BigDecimal sale_cost = null; + BigDecimal sale_gross_profit = null; + BigDecimal allot_qty = null; + BigDecimal allot_notax_amount = null; + BigDecimal allot_amount = null; + BigDecimal allot_cost = null; + BigDecimal allot_gross_profit = null; + BigDecimal dec_notax_amount = null; + BigDecimal inc_qty = null; + BigDecimal inc_notax_amount = null; + BigDecimal inc_amount = null; + BigDecimal cost_price = null; + + String depart_uuid = ""; + String depart_name = ""; + String saler_dept_uuid = ""; + String license_code = ""; + String cust_name = ""; + String address = ""; + String manage_person_name = ""; + String cust_type_name = ""; + String busi_place_code = ""; + String terminal_level_before = ""; + String terminal_level_after = ""; + String apply_remark = ""; + String deal_remark = ""; + String accept_status = ""; + String syscreatedate2 = ""; + String updator_name = ""; + String org_name2 = ""; + + if ("cc_tbc_product_ez".equals(sourceTable)) { + // 在销品牌数据 + product_uuid = nvl(resultSet.getString("product_uuid")); + product_code = nvl(resultSet.getString("product_code")); + product_name = nvl(resultSet.getString("product_name")); + factory_simple_name = nvl(resultSet.getString("factory_simple_name")); + brand_name = nvl(resultSet.getString("brand_name")); + is_abnormity = nvl(resultSet.getString("is_abnormity")); + length = resultSet.getBigDecimal("length"); + width = resultSet.getBigDecimal("width"); + height = resultSet.getBigDecimal("height"); + tar_qty = resultSet.getBigDecimal("tar_qty"); + bar_code = nvl(resultSet.getString("bar_code")); + package_qty = resultSet.getBigDecimal("package_qty"); + bar_code2 = nvl(resultSet.getString("bar_code2")); + package_qty2 = resultSet.getBigDecimal("package_qty2"); + bar_code3 = nvl(resultSet.getString("bar_code3")); + package_qty3 = resultSet.getBigDecimal("package_qty3"); + price_type_code = nvl(resultSet.getString("price_type_code")); + direct_whole_price = resultSet.getBigDecimal("direct_whole_price"); + direct_retail_price = resultSet.getBigDecimal("direct_retail_price"); + is_province = nvl(resultSet.getString("is_province")); + is_seized = nvl(resultSet.getString("is_seized")); + adjust_price = resultSet.getBigDecimal("adjust_price"); + retail_price = resultSet.getBigDecimal("retail_price"); + whole_sale_price = resultSet.getBigDecimal("whole_sale_price"); + in_begin_date = nvl(resultSet.getString("in_begin_date")); + sale_begin_date = nvl(resultSet.getString("sale_begin_date")); + out_begin_date = nvl(resultSet.getString("out_begin_date")); + + maintitle = product_name; + + valueName = "''," + + "'" + product_code + "'," + + "'" + product_name + "'," + + "'" + factory_simple_name + "'," + + "'" + brand_name + "'," + + "'" + is_abnormity + "'," + + (length != null ? length : "NULL") + "," + + (width != null ? width : "NULL") + "," + + (height != null ? height : "NULL") + "," + + (tar_qty != null ? tar_qty : "NULL") + "," + + "'" + bar_code + "'," + + (package_qty != null ? package_qty : "NULL") + "," + + "'" + bar_code2 + "'," + + (package_qty2 != null ? package_qty2 : "NULL") + "," + + "'" + bar_code3 + "'," + + (package_qty3 != null ? package_qty3 : "NULL") + "," + + "'" + price_type_code + "'," + + (direct_whole_price != null ? direct_whole_price : "NULL") + "," + + (direct_retail_price != null ? direct_retail_price : "NULL") + "," + + "'" + is_province + "'," + + "'" + is_seized + "'," + + (adjust_price != null ? adjust_price : "NULL") + "," + + (retail_price != null ? retail_price : "NULL") + "," + + (whole_sale_price != null ? whole_sale_price : "NULL") + "," + + "'" + in_begin_date + "'," + + "'" + sale_begin_date + "'," + + "'" + out_begin_date + "'," + + "'','','','','','','','','','','','','','','','','','','','','','','','','','',''," + // 39个空值 + "'','','','','','','','','','','','','','','','','','','','','','','','',''," + // 23个空值,总共62个 + "'','','','','','','','','','','','','','','','','','','','','','','','',''," + // 23个空值,总共85个 + "'','','','','','','','','','','','','','',',',''," + // 15个空值,总共100个 + "'" + fonds_no + "'," + + "'" + retention + "'," + + "'" + archive_ctg_no + "'," + + "'" + created_date + "'," + + "'" + maintitle + "'," + + "'" + responsibleby + "'," + + "'预归档未完成'," + + "'" + recordId + "'," + + "'" + sourceTable + "'"; + + } else if ("cc_tbc_drawout_ez".equals(sourceTable)) { + // 退出品规数据 + recordId = nvl(resultSet.getString("drawout_uuid")); + org_name = nvl(resultSet.getString("org_name")); + quit_uuid = nvl(resultSet.getString("quit_uuid")); + drawout_date = nvl(resultSet.getString("drawout_date")); + quit_date = nvl(resultSet.getString("quit_date")); + comment = nvl(resultSet.getString("comment")); + creater_name = nvl(resultSet.getString("creater_name")); + syscreatedate = nvl(resultSet.getString("SYSCREATEDATE")); + + maintitle = "退出品规-" + quit_uuid; + responsibleby = creater_name; + + valueName = "'','','','','','','','','','','','','','','','','','','','','','','','','," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'','','','','','','','',''," + + "'" + recordId + "'," + + "'" + org_name + "'," + + "'" + quit_uuid + "'," + + "'" + drawout_date + "'," + + "'" + quit_date + "'," + + "'" + comment + "'," + + "'" + creater_name + "'," + + "'" + syscreatedate + "'," + + "'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''," + + "'','','','','','','','','','','','','','','','','','','','','','',''," + + "'" + fonds_no + "'," + + "'" + retention + "'," + + "'" + archive_ctg_no + "'," + + "'" + created_date + "'," + + "'" + maintitle + "'," + + "'" + responsibleby + "'," + + "'预归档未完成'," + + "'" + recordId + "'," + + "'" + sourceTable + "'"; + + } else if ("scm_rpt_bizstordayreport_ez".equals(sourceTable)) { + // 月度进销存数据 + recordId = String.valueOf(resultSet.getLong("id")); + biz_date = nvl(resultSet.getString("biz_date")); + manage_unit_uuid = nvl(resultSet.getString("manage_unit_uuid")); + stor_uuid = nvl(resultSet.getString("stor_uuid")); + stor_name = nvl(resultSet.getString("stor_name")); + product_uuid2 = nvl(resultSet.getString("product_uuid")); + product_code2 = nvl(resultSet.getString("product_code")); + product_name = nvl(resultSet.getString("product_name")); + unit_uuid = nvl(resultSet.getString("unit_uuid")); + unit_name = nvl(resultSet.getString("unit_name")); + last_qty = resultSet.getBigDecimal("last_qty"); + last_amount = resultSet.getBigDecimal("last_amount"); + buy_qty = resultSet.getBigDecimal("buy_qty"); + buy_notax_amount = resultSet.getBigDecimal("buy_notax_amount"); + buy_amount = resultSet.getBigDecimal("buy_amount"); + movein_qty = resultSet.getBigDecimal("movein_qty"); + movein_notax_amount = resultSet.getBigDecimal("movein_notax_amount"); + movein_amount = resultSet.getBigDecimal("movein_amount"); + movein_cost = resultSet.getBigDecimal("movein_cost"); + moveout_qty = resultSet.getBigDecimal("moveout_qty"); + moveout_notax_amount = resultSet.getBigDecimal("moveout_notax_amount"); + moveout_amount = resultSet.getBigDecimal("moveout_amount"); + moveout_cost = resultSet.getBigDecimal("moveout_cost"); + sale_qty = resultSet.getBigDecimal("sale_qty"); + sale_notax_amount = resultSet.getBigDecimal("sale_notax_amount"); + sale_amount = resultSet.getBigDecimal("sale_amount"); + sale_cost = resultSet.getBigDecimal("sale_cost"); + sale_gross_profit = resultSet.getBigDecimal("sale_gross_profit"); + allot_qty = resultSet.getBigDecimal("allot_qty"); + allot_notax_amount = resultSet.getBigDecimal("allot_notax_amount"); + allot_amount = resultSet.getBigDecimal("allot_amount"); + allot_cost = resultSet.getBigDecimal("allot_cost"); + allot_gross_profit = resultSet.getBigDecimal("allot_gross_profit"); + dec_qty = resultSet.getBigDecimal("dec_qty"); + dec_notax_amount = resultSet.getBigDecimal("dec_notax_amount"); + dec_amount = resultSet.getBigDecimal("dec_amount"); + inc_qty = resultSet.getBigDecimal("inc_qty"); + inc_notax_amount = resultSet.getBigDecimal("inc_notax_amount"); + inc_amount = resultSet.getBigDecimal("inc_amount"); + rest_qty = resultSet.getBigDecimal("rest_qty"); + rest_amount = resultSet.getBigDecimal("rest_amount"); + cost_price = resultSet.getBigDecimal("cost_price"); + + maintitle = stor_name + "-" + biz_date + "-" + product_name; + retention = "10年"; + + valueName = "'','','','','','','','','','','','','','','','','','','','','','','','',',," + // 在销品牌字段为空 + "'','','','','',''," + + "'" + biz_date + "'," + + "'" + manage_unit_uuid + "'," + + "'" + stor_uuid + "'," + + "'" + stor_name + "'," + + "'" + product_uuid2 + "'," + + "'" + product_code2 + "'," + + "'" + product_name + "'," + + "'" + unit_uuid + "'," + + "'" + unit_name + "'," + + (last_qty != null ? last_qty : "NULL") + "," + + (last_amount != null ? last_amount : "NULL") + "," + + (buy_qty != null ? buy_qty : "NULL") + "," + + (buy_notax_amount != null ? buy_notax_amount : "NULL") + "," + + (buy_amount != null ? buy_amount : "NULL") + "," + + (movein_qty != null ? movein_qty : "NULL") + "," + + (movein_notax_amount != null ? movein_notax_amount : "NULL") + "," + + (movein_amount != null ? movein_amount : "NULL") + "," + + (movein_cost != null ? movein_cost : "NULL") + "," + + (moveout_qty != null ? moveout_qty : "NULL") + "," + + (moveout_notax_amount != null ? moveout_notax_amount : "NULL") + "," + + (moveout_amount != null ? moveout_amount : "NULL") + "," + + (moveout_cost != null ? moveout_cost : "NULL") + "," + + (sale_qty != null ? sale_qty : "NULL") + "," + + (sale_notax_amount != null ? sale_notax_amount : "NULL") + "," + + (sale_amount != null ? sale_amount : "NULL") + "," + + (sale_cost != null ? sale_cost : "NULL") + "," + + (sale_gross_profit != null ? sale_gross_profit : "NULL") + "," + + (allot_qty != null ? allot_qty : "NULL") + "," + + (allot_notax_amount != null ? allot_notax_amount : "NULL") + "," + + (allot_amount != null ? allot_amount : "NULL") + "," + + (allot_cost != null ? allot_cost : "NULL") + "," + + (allot_gross_profit != null ? allot_gross_profit : "NULL") + "," + + (dec_qty != null ? dec_qty : "NULL") + "," + + (dec_notax_amount != null ? dec_notax_amount : "NULL") + "," + + (dec_amount != null ? dec_amount : "NULL") + "," + + (inc_qty != null ? inc_qty : "NULL") + "," + + (inc_notax_amount != null ? inc_notax_amount : "NULL") + "," + + (inc_amount != null ? inc_amount : "NULL") + "," + + (rest_qty != null ? rest_qty : "NULL") + "," + + (rest_amount != null ? rest_amount : "NULL") + "," + + (cost_price != null ? cost_price : "NULL") + "," + + "'','','','','','','','','','','','','','','','','','','','',''," + + "'" + fonds_no + "'," + + "'" + retention + "'," + + "'" + archive_ctg_no + "'," + + "'" + created_date + "'," + + "'" + maintitle + "'," + + "'" + responsibleby + "'," + + "'预归档未完成'," + + "'" + recordId + "'," + + "'" + sourceTable + "'"; + + } else if ("ec_exp_apply_accept_ez".equals(sourceTable)) { + // 终端建设数据 + recordId = nvl(resultSet.getString("accept_uuid")); + org_name = nvl(resultSet.getString("org_name")); + org_name2 = nvl(resultSet.getString("org_name2")); + depart_uuid = nvl(resultSet.getString("depart_uuid")); + depart_name = nvl(resultSet.getString("depart_name")); + saler_dept_uuid = nvl(resultSet.getString("saler_dept_uuid")); + license_code = nvl(resultSet.getString("license_code")); + cust_name = nvl(resultSet.getString("cust_name")); + address = nvl(resultSet.getString("address")); + manage_person_name = nvl(resultSet.getString("manage_person_name")); + cust_type_name = nvl(resultSet.getString("cust_type_name")); + busi_place_code = nvl(resultSet.getString("busi_place_code")); + terminal_level_before = nvl(resultSet.getString("terminal_level_before")); + terminal_level_after = nvl(resultSet.getString("terminal_level_after")); + apply_remark = nvl(resultSet.getString("apply_remark")); + deal_remark = nvl(resultSet.getString("deal_remark")); + accept_status = nvl(resultSet.getString("accept_status")); + syscreatedate2 = nvl(resultSet.getString("syscreatedate")); + updator_name = nvl(resultSet.getString("updator_name")); + + maintitle = cust_name + "-" + license_code + "-终端建设"; + responsibleby = syscreatedate2; + retention = "10年"; + + valueName = "'','','','','','','','','','','','','','','','','','','','','','','','',',," + // 在销品牌字段为空 + "'','','','','',''," + + "'','','','','','','','','','','','','',''," + + "'','','','','','','','','','','','','','','','','','','','','','','','',',',''," + + "'" + depart_uuid + "'," + + "'" + depart_name + "'," + + "'" + saler_dept_uuid + "'," + + "'" + license_code + "'," + + "'" + cust_name + "'," + + "'" + address + "'," + + "'" + manage_person_name + "'," + + "'" + cust_type_name + "'," + + "'" + busi_place_code + "'," + + "'" + terminal_level_before + "'," + + "'" + terminal_level_after + "'," + + "'" + apply_remark + "'," + + "'" + deal_remark + "'," + + "'" + accept_status + "'," + + "'" + syscreatedate2 + "'," + + "'" + updator_name + "'," + + "'" + fonds_no + "'," + + "'" + retention + "'," + + "'" + archive_ctg_no + "'," + + "'" + created_date + "'," + + "'" + maintitle + "'," + + "'" + responsibleby + "'," + + "'预归档未完成'," + + "'" + recordId + "'," + + "'" + sourceTable + "'"; + } + + if (log.isInfoEnabled()) { + log.info("[PRODUCT_SALES] 处理记录 sourceTable={}, recordId={}", sourceTable, recordId); + } + + // 幂等:优先检查是否已存在相同记录 + Integer jhId; + String whereSql = " 1=1 and batch_id='" + recordId + "' and table_name='" + sourceTable + "'"; + if (existsInTemp(tempTableName, whereSql)) { + jhId = findSingleId(tempTableName, whereSql); + if (log.isDebugEnabled()) { + log.debug("[PRODUCT_SALES] 命中幂等: 复用已有记录 id={}, where={}", jhId, whereSql); + } + } else { + Map mapTwo = new HashMap(); + mapTwo.put("tableName", tempTableName); + mapTwo.put("fieldName", "product_uuid,product_code1,product_name1,factory_simple_name,brand_name,is_abnormity,length,width,height,tar_qty,bar_code,package_qty,bar_code2,package_qty2,bar_code3,package_qty3,price_type_code,direct_whole_price,direct_retail_price,is_province,is_seized,adjust_price,retail_price,whole_sale_price,in_begin_date,sale_begin_date,out_begin_date,drawout_uuid,org_name,quit_uuid,drawout_date,quit_date,comment,creater_name,syscreatedate,biz_date,manage_unit_uuid,stor_uuid,stor_name,product_uuid2,product_code2,product_name2,unit_uuid,unit_name,last_qty,last_amount,buy_qty,buy_notax_amount,buy_amount,movein_qty,movein_notax_amount,movein_amount,movein_cost,moveout_qty,moveout_notax_amount,moveout_amount,moveout_cost,sale_qty,sale_notax_amount,sale_amount,sale_cost,sale_gross_profit,allot_qty,allot_notax_amount,allot_amount,allot_cost,allot_gross_profit,dec_qty,dec_notax_amount,dec_amount,inc_qty,inc_notax_amount,inc_amount,rest_qty,rest_amount,cost_price,depart_uuid,depart_name,saler_dept_uuid,license_code,cust_name,address,manage_person_name,cust_type_name,busi_place_code,terminal_level_before,terminal_level_after,apply_remark,deal_remark,accept_status,updator_name,fonds_no,retention,archive_ctg_no,created_date,maintitle,responsibleby,archive_flag,batch_id,table_name"); + mapTwo.put("valueName", valueName); + danganguanliService.saveObject(mapTwo); + jhId = Integer.parseInt(mapTwo.get("id").toString()); + if (log.isInfoEnabled()) { + log.info("[PRODUCT_SALES] 新增主表记录 id={} (temp={})", jhId, tempTableName); + } + } + + String filePath = "uploadFile/" + fileTableName + "/" + jhId; + Path dirPath = ensureDir(uploadPath, filePath); + String dir = dirPath.toString(); + if (log.isDebugEnabled()) { + log.debug("[PRODUCT_SALES] 目标目录: {}", dir); + } + + //是否生成归档xml + if(archiveXMLGenerate){ + String head = ""; + String xml = " <目录>" + + " <来源表>" + xmlEscape(sourceTable) + "" + + " <记录ID>" + xmlEscape(recordId) + "" + + " <标题>" + xmlEscape(maintitle) + "" + + " <全宗号>" + xmlEscape(fonds_no) + "" + + " <保管期限>" + xmlEscape(retention) + "" + + " <归档分类>" + xmlEscape(archive_ctg_no) + "" + + " <归档时间>" + created_date + "" + + " <责任者>" + xmlEscape(responsibleby) + ""; + + // 根据不同的表添加详细字段信息 + if ("cc_tbc_product_ez".equals(sourceTable)) { + xml += " <卷烟标识>" + xmlEscape(product_uuid) + "" + + " <卷烟编码>" + xmlEscape(product_code) + "" + + " <卷烟名称>" + xmlEscape(product_name) + "" + + " <厂家简称>" + xmlEscape(factory_simple_name) + "" + + " <品牌名称>" + xmlEscape(brand_name) + "" + + " <是否异形包装>" + xmlEscape(is_abnormity) + "" + + " <包装长度>" + (length != null ? length.toString() : "") + "" + + " <包装宽度>" + (width != null ? width.toString() : "") + "" + + " <包装高度>" + (height != null ? height.toString() : "") + "" + + " <焦油含量>" + (tar_qty != null ? tar_qty.toString() : "") + "" + + " <包条形码>" + xmlEscape(bar_code) + "" + + " <包包装支数>" + (package_qty != null ? package_qty.toString() : "") + "" + + " <条条形码>" + xmlEscape(bar_code2) + "" + + " <条包装支数>" + (package_qty2 != null ? package_qty2.toString() : "") + "" + + " <件条形码>" + xmlEscape(bar_code3) + "" + + " <件包装支数>" + (package_qty3 != null ? package_qty3.toString() : "") + "" + + " <卷烟价类>" + xmlEscape(price_type_code) + "" + + " <批发指导价>" + (direct_whole_price != null ? direct_whole_price.toString() : "") + "" + + " <零售指导价>" + (direct_retail_price != null ? direct_retail_price.toString() : "") + "" + + " <是否省内烟>" + xmlEscape(is_province) + "" + + " <是否查扣烟启用>" + xmlEscape(is_seized) + "" + + " <调剂价>" + (adjust_price != null ? adjust_price.toString() : "") + "" + + " <零售价>" + (retail_price != null ? retail_price.toString() : "") + "" + + " <批发价>" + (whole_sale_price != null ? whole_sale_price.toString() : "") + "" + + " <引入日期>" + xmlEscape(in_begin_date) + "" + + " <上市日期>" + xmlEscape(sale_begin_date) + "" + + " <退出日期>" + xmlEscape(out_begin_date) + ""; + } else if ("cc_tbc_drawout_ez".equals(sourceTable)) { + xml += " <退出标识>" + xmlEscape(recordId) + "" + + " <机构名称>" + xmlEscape(org_name) + "" + + " <退出品规标识>" + xmlEscape(quit_uuid) + "" + + " <退出日期>" + xmlEscape(drawout_date) + "" + + " <退出时间>" + xmlEscape(quit_date) + "" + + " <备注>" + xmlEscape(comment) + "" + + " <创建人>" + xmlEscape(creater_name) + "" + + " <系统创建时间>" + xmlEscape(syscreatedate) + ""; + } else if ("scm_rpt_bizstordayreport_ez".equals(sourceTable)) { + xml += " <日期>" + xmlEscape(biz_date) + "" + + " <管理单元标识>" + xmlEscape(manage_unit_uuid) + "" + + " <仓库标识>" + xmlEscape(stor_uuid) + "" + + " <仓库名称>" + xmlEscape(stor_name) + "" + + " <商品标识>" + xmlEscape(product_uuid2) + "" + + " <商品编码>" + xmlEscape(product_code2) + "" + + " <商品名称>" + xmlEscape(product_name) + "" + + " <计量单位标识>" + xmlEscape(unit_uuid) + "" + + " <计量单位名称>" + xmlEscape(unit_name) + "" + + " <期初数量>" + (last_qty != null ? last_qty.toString() : "") + "" + + " <期初金额>" + (last_amount != null ? last_amount.toString() : "") + "" + + " <购入数量>" + (buy_qty != null ? buy_qty.toString() : "") + "" + + " <购入不含税金额>" + (buy_notax_amount != null ? buy_notax_amount.toString() : "") + "" + + " <购入金额>" + (buy_amount != null ? buy_amount.toString() : "") + "" + + " <调入数量>" + (movein_qty != null ? movein_qty.toString() : "") + "" + + " <调入不含税金额>" + (movein_notax_amount != null ? movein_notax_amount.toString() : "") + "" + + " <调入金额>" + (movein_amount != null ? movein_amount.toString() : "") + "" + + " <调入成本>" + (movein_cost != null ? movein_cost.toString() : "") + "" + + " <调出数量>" + (moveout_qty != null ? moveout_qty.toString() : "") + "" + + " <调出不含税金额>" + (moveout_notax_amount != null ? moveout_notax_amount.toString() : "") + "" + + " <调出金额>" + (moveout_amount != null ? moveout_amount.toString() : "") + "" + + " <调出成本>" + (moveout_cost != null ? moveout_cost.toString() : "") + "" + + " <销售数量>" + (sale_qty != null ? sale_qty.toString() : "") + "" + + " <销售不含税金额>" + (sale_notax_amount != null ? sale_notax_amount.toString() : "") + "" + + " <销售金额>" + (sale_amount != null ? sale_amount.toString() : "") + "" + + " <销售成本>" + (sale_cost != null ? sale_cost.toString() : "") + "" + + " <销售毛利>" + (sale_gross_profit != null ? sale_gross_profit.toString() : "") + "" + + " <调拨数量>" + (allot_qty != null ? allot_qty.toString() : "") + "" + + " <调拨不含税金额>" + (allot_notax_amount != null ? allot_notax_amount.toString() : "") + "" + + " <调拨金额>" + (allot_amount != null ? allot_amount.toString() : "") + "" + + " <调拨成本>" + (allot_cost != null ? allot_cost.toString() : "") + "" + + " <调拨毛利>" + (allot_gross_profit != null ? allot_gross_profit.toString() : "") + "" + + " <报损数量>" + (dec_qty != null ? dec_qty.toString() : "") + "" + + " <报损不含税金额>" + (dec_notax_amount != null ? dec_notax_amount.toString() : "") + "" + + " <报损金额>" + (dec_amount != null ? dec_amount.toString() : "") + "" + + " <增加数量>" + (inc_qty != null ? inc_qty.toString() : "") + "" + + " <增加不含税金额>" + (inc_notax_amount != null ? inc_notax_amount.toString() : "") + "" + + " <增加金额>" + (inc_amount != null ? inc_amount.toString() : "") + "" + + " <期末数量>" + (rest_qty != null ? rest_qty.toString() : "") + "" + + " <期末金额>" + (rest_amount != null ? rest_amount.toString() : "") + "" + + " <成本价格>" + (cost_price != null ? cost_price.toString() : "") + ""; + } else if ("ec_exp_apply_accept_ez".equals(sourceTable)) { + xml += " <受理标识>" + xmlEscape(recordId) + "" + + " <机构名称>" + xmlEscape(org_name) + "" + + " <机构名称2>" + xmlEscape(org_name2) + "" + + " <许可证号码>" + xmlEscape(license_code) + "" + + " <客户名称>" + xmlEscape(cust_name) + "" + + " <经营地址>" + xmlEscape(address) + "" + + " <经营者>" + xmlEscape(manage_person_name) + "" + + " <客户档位名称>" + xmlEscape(cust_type_name) + "" + + " <经营业态>" + xmlEscape(busi_place_code) + "" + + " <当前终端层级>" + xmlEscape(terminal_level_before) + "" + + " <拟建设终端层级>" + xmlEscape(terminal_level_after) + "" + + " <申请说明>" + xmlEscape(apply_remark) + "" + + " <处理说明>" + xmlEscape(deal_remark) + "" + + " <受理状态>" + xmlEscape(accept_status) + "" + + " <系统创建时间>" + xmlEscape(syscreatedate2) + "" + + " <更新人名称>" + xmlEscape(updator_name) + ""; + } + + xml += " "; + String content = head + xml; + String newContent = FileTool.formatXml(content); + FileTool.write(newContent, dirPath.resolve(recordId + ".xml").toString()); + String fileName = recordId + ".xml"; + String fileNameServer = recordId + ".xml"; + String type = "xml"; + insertFileRecord(fileTableName, jhId, fileName, fileNameServer, filePath, type, 1, dir); + if (log.isInfoEnabled()) { + log.info("[PRODUCT_SALES] 生成XML文件并登记: {}", dirPath.resolve(fileName)); + } + } + + j++; + + //添加日志 + ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + User user = null; + if (servletRequestAttributes != null) { + HttpServletRequest request = servletRequestAttributes.getRequest(); + UserRole userRole = userService.getUserRole(request); + if (userRole != null) user = userRole.getUser(); + } + if (user != null) { + //记录日志 + java.util.Date date = new Date(); + OperLogger entity = new OperLogger(); + entity.setLogType("7"); + entity.setOperator(user.getUsername()); + entity.setOperatorChn(user.getUserChnName()); + entity.setOperateDate(date); + entity.setDescription("成功归档"+sourceTable+"的记录"+recordId); + entity.setArgs("成功归档"+sourceTable+"的记录"+recordId); + operLoggerService.addEntity(entity); + } + } + + CityBusinessSystemIntegration.closeResources(null, null, resultSet); + } + + if (log.isInfoEnabled()) log.info("[PRODUCT_SALES] 四个表对接完成, 总条数={}, 成功处理条数={}", totalPending, j); + json = AjaxJson.returnInfo("成功接收" + j + "条"); + } catch (Exception e) { + log.error("[PRODUCT_SALES] 四个表对接失败 recordId={}", recordId, e); + //添加日志 + ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + User user = null; + if (servletRequestAttributes != null) { + HttpServletRequest request = servletRequestAttributes.getRequest(); + UserRole userRole = userService.getUserRole(request); + if (userRole != null) user = userRole.getUser(); + } + if (user != null) { + //记录日志 + java.util.Date date = new Date(); + OperLogger entity = new OperLogger(); + entity.setLogType("7"); + entity.setOperator(user.getUsername()); + entity.setOperatorChn(user.getUserChnName()); + entity.setOperateDate(date); + entity.setDescription("四个表对接失败归档"+recordId+"的记录"); + entity.setArgs("四个表对接失败归档"+e.toString()); + operLoggerService.addEntity(entity); + } + json = AjaxJson.returnExceptionInfo(e.toString()); + } finally { + CityBusinessSystemIntegration.closeResources(null, null, resultSet); + CityBusinessSystemIntegration.closeResources(null, null, resultSetFile); + CityBusinessSystemIntegration.closeResources(null, null, resultSetCount); + } + + return json; + } + + + + + + + + @RequestMapping(value="/wsjhProject" , method= RequestMethod.POST) + @ApiOperation(value = "简化工程") + public AjaxJson wsjhProject() { + AjaxJson json = null; + String requestid = ""; + try { + String tableName = "zhgl_20220629162353"; + String tempTableName = tableName + "_temp"; + String fileTableName = tableName + "_temp_file"; + String resultStr = HttpUtil.get("https://oa.jztey.com/jzt/getArchive.jsp"); + Map map1 = JSON.parseObject(resultStr, new TypeReference>() {}); + List> list = (List>) map1.get("part"); + if(CollectionUtils.isNotEmpty(list)){ + for (Map map : list) { + //把数据添加到简化表中 + String fieldName = ""; + String valueName = ""; + List> fileList = null; + for(Map.Entry entry:map.entrySet()){ + + if(entry.getKey().equals("requestid")){ + requestid = entry.getValue().toString(); + } + + if (!entry.getKey().equals("damldm")&&!entry.getKey().equals("requestid")&&!entry.getKey().equals("fileList")){ + fieldName = fieldName + entry.getKey().toLowerCase() + ","; + valueName = valueName + "'" + entry.getValue() + "',"; + } + if (entry.getKey().equals("fileList")){ + fileList = (List>) entry.getValue(); + } + } + fieldName = fieldName + "archive_flag"; + valueName = valueName + "'预归档未完成'"; + Map mapTwo = new HashMap(); + mapTwo.put("tableName", tempTableName); + //其实我们知道是哪些字段 + mapTwo.put("fieldName", fieldName); + mapTwo.put("valueName", valueName); + danganguanliService.saveObject(mapTwo); + int jhId = Integer.parseInt(mapTwo.get("id").toString()); + + String filePath = "uploadFile/" + fileTableName + "/" + jhId; + String dir = uploadPath + File.separator + filePath; + + if(CollectionUtils.isNotEmpty(fileList)){ + for (Map mapList : fileList) { + String fileName = (String) mapList.get("fileName"); + String downloadAddress = (String) mapList.get("downloadAddress"); + String myuuid = StringUtil.generaterUUID(); + String fileNameServer =myuuid + fileName; + File fileOne = new File(dir); + if (!fileOne.exists()) { + fileOne.mkdirs(); + } + String fileUrl = dir+"/"+fileNameServer; + String str = HttpUtil.get(downloadAddress); + Map map2 = JSON.parseObject(str, new TypeReference>() {}); + String fileBase64 = (String) map2.get("fileBase64"); + Base64Utils.decode2(fileUrl,fileBase64); + int i = 1; + String[] strings = fileName.split("\\."); + String type = strings[strings.length - 1].toLowerCase(); + + //把文件数据添加到file表中 + String fieldNameFile = + "rec_id, " + + "file_name, " + + "file_name_server, " + + "file_path, " + + "file_type," + + + "page_no," + + "file_des," + + "file_status"; + String valueNameFile = + "" + jhId + "," + + "'" + fileName+ "'," + + "'" + fileNameServer+ "'," + + "'" + filePath + "'," + + "'" + type + "'," + + + i + "," + + "'" + dir + "'," + + "1"; + Map mapFile = new HashMap(); + mapFile.put("tableName", fileTableName); + //其实我们知道是哪些字段 + mapFile.put("fieldName", fieldNameFile); + mapFile.put("valueName", valueNameFile); + danganguanliService.saveObject(mapFile); + if(type.equals("jpg")||type.equals("png") ){ + //生成一份pdf文件,用于归档章的操作 + String newName_pdf=fileNameServer.replace("."+type,".pdf"); + PdfFileHelper.image2Pdf(dir+File.separator+fileNameServer,dir+File.separator+newName_pdf); + + String newName_pdf_original=newName_pdf.replace(".pdf","_original.pdf"); + FileTool.copyFile(dir+File.separator+newName_pdf,dir+File.separator+newName_pdf_original); + } + i++; + + } + //更新原文数量 + Map map7=new HashMap<>(); + map7.put("tableName",tempTableName); + map7.put("tableName2",fileTableName); + map7.put("id",jhId); + danganguanliService.wsajmlTempCount(map7); + } + + //处理结果成功反馈接口 + Map param = new HashMap<>(); + param.put("requestid",requestid); + param.put("messages","SUCCESS"); + String resultStr11 = HttpUtil.get("https://oa.jztey.com/jzt/getArchiveResult.jsp",param); + System.out.println(resultStr11); + } + } + + + json = new AjaxJson(); + + + }catch(Exception e) { + //处理结果失败反馈接口 + Map param = new HashMap<>(); + param.put("requestid",requestid); + param.put("messages",e.toString()); + String resultStr11 = HttpUtil.get("https://oa.jztey.com/jzt/getArchiveResult.jsp",param); + System.out.println(resultStr11); + json = AjaxJson.returnExceptionInfo("获取OA接口失败"+e); + } + return json; + } + + + + + + @PostMapping("/archives_upload") + public Object sp_drop_upload(MultipartFile archives) { + UploadFileEntity ufe = null; + + try { + //写文件到硬盘 + ufe = FileUtils.writeToHardDisk(archives, BASEPATH_LOCAL); + if(ufe.getFimeType().equalsIgnoreCase("zip")){ + unzip(ufe.getFileHardPath(),BASEPATH_LOCAL); + }else{ + System.out.println("非zip压缩包 不用解压"); + } + + } catch (IOException e) { + e.printStackTrace(); + } catch (Exception e1) { + e1.printStackTrace(); + } + return ufe; + } + + public static void main(String[] args) throws IOException { + String downloadAddress = "https://oa.jztey.com/jzt/file/5848cf88-ed9c-4c00-929a-6d64e2eec024.pdf"; + URL url1 = new URL(downloadAddress); + HttpURLConnection urlConnection = (HttpURLConnection)url1.openConnection(); + int status = urlConnection.getResponseCode(); + System.out.println(status); + urlConnection.getInputStream(); + } + + + + @RequestMapping(value="/receiveFiles" , method= RequestMethod.POST) + @ApiOperation(value = "接受zip文件流") + public AjaxJson receiveFiles(MultipartFile file,String classType) throws Exception{ + //怎么知道简化和传统对应的表 表写死 + //解析Base64文件流字符串转化为file +// @RequestBody Map param +// String classType = param.get("classType").toString(); +// String fileName = param.get("fileName").toString(); +// String receiveFileString = param.get("receiveFileString").toString(); + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); +// File file = FileUtils.base64ToFile(receiveFileString); + AjaxJson json = null; + InputStream inputStream = null; + try { + int page = 0; + ZipInputStream zipInputStream2 = new ZipInputStream(file.getInputStream(), Charset.forName("GBK")); + java.util.zip.ZipEntry zipEntry; + while ((zipEntry = zipInputStream2.getNextEntry()) != null) { + if(zipEntry.getName().contains("简化模板/电子文件/") && zipEntry.getName().length()>"简化模板/电子文件/".length()){ + page++; + } + } + //简化表id + Integer jhId = null; + //案件级档号 + Integer folderNo = null; + //存入对应的id和piece_no到map + Map map = new HashMap<>(); + ZipInputStream zipInputStream = new ZipInputStream(file.getInputStream(), Charset.forName("GBK")); + BufferedInputStream bs = new BufferedInputStream(zipInputStream); + java.util.zip.ZipEntry zipEntryTwo; + byte[] bytes = null; + while ((zipEntryTwo = zipInputStream.getNextEntry()) != null) { // 获取zip包中的每一个zip file entry + String zipFileName = zipEntryTwo.getName(); + //以/进行分割 + String[] ss = zipFileName.split("\\/"); + + if(ss[ss.length-1].equals("基本信息描述.xml")){ + bytes = new byte[(int) zipEntryTwo.getSize()]; + bs.read(bytes, 0, (int) zipEntryTwo.getSize()); + InputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + //1.创建DocumentBuilderFactory对象 + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + Document d = builder.parse(byteArrayInputStream); + NodeList list = d.getElementsByTagName("description"); + for (int i = 0; i mapTwo = new HashMap(); + mapTwo.put("tableName", "wsjh_table_20211224110000054_temp"); + //其实我们知道是哪些字段 + mapTwo.put("fieldName", fieldName); + mapTwo.put("valueName", valueName); + danganguanliService.saveObject(mapTwo); + jhId = (Integer) mapTwo.get("id"); + } + } + + } + +// ZipFile zipFile = new ZipFile(f,"gbk"); + //解压zip +// List zipEntrys = FileUtils.unzip(zipFile); + //获取图片数量 +// int page = 0; +// while ((zipEntry = zipInputStream.getNextEntry()) != null) { +// if(zipEntry.getName().contains("简化模板/电子文件/") && zipEntry.getName().length()>"简化模板/电子文件/".length()){ +// page++; +// } +// } + if(classType.equals("WSJH")){ + ZipInputStream zipInputStream1 = new ZipInputStream(file.getInputStream(), Charset.forName("GBK")); + BufferedInputStream bs1 = new BufferedInputStream(zipInputStream); + java.util.zip.ZipEntry zipEntry1; + byte[] bytes1 = null; + //文书简化 + while ((zipEntry1 = zipInputStream1.getNextEntry()) != null) { + String entryName = zipEntry1.getName(); + //以/进行分割 + String[] ss = entryName.split("\\/"); + //以点进行分割 + String[] spots = entryName.split("\\."); + if(ss[ss.length-1].equals("基本信息描述.xml")){ + + //解析xml + bytes1 = new byte[(int) zipEntry1.getSize()]; + bs1.read(bytes1, 0, (int) zipEntry1.getSize()); + InputStream byteArrayInputStream = new ByteArrayInputStream(bytes1); + //1.创建DocumentBuilderFactory对象 + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + Document d = builder.parse(byteArrayInputStream); + NodeList list = d.getElementsByTagName("description"); + for (int i = 0; i mapTwo = new HashMap(); + mapTwo.put("tableName", "wsjh_table_20220216102100040_temp"); + //其实我们知道是哪些字段 + mapTwo.put("fieldName", fieldName); + mapTwo.put("valueName", valueName); + danganguanliService.saveObject(mapTwo); + jhId = (Integer) map.get("id"); + } + } + } + while ((zipEntryTwo = zipInputStream.getNextEntry()) != null) { + String entryName = zipEntryTwo.getName(); + //以/进行分割Two +// String[] ss = entryName.split("\\/"); +// //以点进行分割 +// String[] spots = entryName.split("\\."); + if(entryName.contains("简化模板/电子文件/") && entryName.length()>"简化模板/电子文件/".length()&& jhId != null){ + //将文件属性存入对应的表字段然后存入文件表中 + bytes = new byte[(int) zipEntryTwo.getSize()]; + bs.read(bytes, 0, (int) zipEntryTwo.getSize()); + inputStream = new ByteArrayInputStream(bytes); + String myuuid = StringUtil.generaterUUID(); + String relative_path = "uploadFile/" + "wsjh_table_20220216102100040_temp_file/" + "/" + jhId; + String dir = request.getRealPath("/") + relative_path; + //原文图片也要添加到表中 + //把数据添加到表中 + String fieldNameFile = + "rec_id, " + + "file_name, " + + "file_name_server, " + + "file_path, " + + "file_type," + + "page_no," + + "file_des," + + "file_status"; + String valueNameFile = + "" + jhId + "," + + "'" + myuuid + ".jpg'," + + "'" + myuuid + ".jpg'," + + "'" + relative_path + "'," + + "'jpg'," + + "-1," + + "'" + dir + "'," + + "1"; + Map mapFile = new HashMap(); + mapFile.put("tableName", "wsjh_table_20220216102100040_temp_file"); + //其实我们知道是哪些字段 + mapFile.put("fieldName", fieldNameFile); + mapFile.put("valueName", valueNameFile); + danganguanliService.saveObject(mapFile); + String imgName = myuuid + ".jpg"; + File fileOne = new File(dir); + if (!fileOne.exists()) { + fileOne.mkdirs(); + } + //获取输出流 + OutputStream os= new FileOutputStream(dir+"/"+imgName); + byte [] bts = new byte [ 1024 ]; + //一个一个字节的读取并写入 + while (inputStream.read(bts)!=- 1 ) + { + os.write(bts); + } + os.flush(); + os.close(); + inputStream.close(); + + } + } + }else if(classType.equals("WSCT")){ + //文书传统 + + } +// for (ZipEntry zipEntry : zipEntrys) { +// String entryName = zipEntry.getName(); +// //以/进行分割 +// String[] ss = entryName.split("\\/"); +// //以点进行分割 +// String[] spots = entryName.split("\\."); +// +// if(classType.equals("WSJH")){ +// //文书简化 +// //获取xml名字,进行比较 +// if(ss[ss.length-1].equals("基本信息描述.xml")){ +// //解析xml +// inputStream = zipFile.getInputStream(zipEntry); +// //1.创建DocumentBuilderFactory对象 +// DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); +// DocumentBuilder builder = factory.newDocumentBuilder(); +// Document d = builder.parse(inputStream); +// NodeList list = d.getElementsByTagName("description"); +// for (int i = 0; i mapTwo = new HashMap(); +// mapTwo.put("tableName", "wsjh_table_20220216102100040_temp"); +// //其实我们知道是哪些字段 +// mapTwo.put("fieldName", fieldName); +// mapTwo.put("valueName", valueName); +// danganguanliService.saveObject(mapTwo); +// jhId = (Integer) map.get("id"); +// } +// } +// //简化对应的文件 +// else if(entryName.contains("简化模板/电子文件/") && entryName.length()>"简化模板/电子文件/".length()&& jhId != null){ +// //将文件属性存入对应的表字段然后存入文件表中 +//// DocOriginalOaEntity docOriginalEntity = new DocOriginalOaEntity(); +// inputStream = zipFile.getInputStream(zipEntry); +//// docOriginalEntity.setFileName(entryName); +//// docOriginalEntity.setRecid(jhId); +//// docOriginalEntity.setFileLen(Float.valueOf(inputStream.read())); +//// docSimpleService.saveDocOriginalEntity(docOriginalEntity); +// +// +// String myuuid = StringUtil.generaterUUID(); +// String relative_path = "uploadFile/" + "wsjh_table_20211224110000054_temp_file/" + "/" + jhId; +// String dir = request.getRealPath("/") + relative_path; +// //原文图片也要添加到表中 +// //把数据添加到表中 +// String fieldNameFile = +// "rec_id, " + +// "file_name, " + +// "file_name_server, " + +// "file_path, " + +// "file_type," + +// "page_no," + +// "file_des," + +// "file_status"; +// String valueNameFile = +// "" + jhId + "," + +// "'" + myuuid + ".jpg'," + +// "'" + myuuid + ".jpg'," + +// "'" + relative_path + "'," + +// "'jpg'," + +// "-1," + +// "'" + dir + "'," + +// "1"; +// Map mapFile = new HashMap(); +// mapFile.put("tableName", "wsjh_table_20211224110000054_temp_file"); +// //其实我们知道是哪些字段 +// mapFile.put("fieldName", fieldNameFile); +// mapFile.put("valueName", valueNameFile); +// danganguanliService.saveObject(mapFile); +// String imgName = myuuid + ".jpg"; +// File fileOne = new File(dir); +// if (!fileOne.exists()) { +// fileOne.mkdirs(); +// } +// //获取输出流 +// OutputStream os= new FileOutputStream(dir+"/"+imgName); +// byte [] bts = new byte [ 1024 ]; +// //一个一个字节的读取并写入 +// while (inputStream.read(bts)!=- 1 ) +// { +// os.write(bts); +// } +// os.flush(); +// os.close(); +// inputStream.close(); +// +// } +// +// } +// +// //案卷基本信息解析 +//// if(ss[ss.length-1].equals("案卷基本信息.xml")){ +//// //解析xml +//// inputStream = zipFile.getInputStream(zipEntry); +//// //1.创建DocumentBuilderFactory对象 +//// DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); +//// DocumentBuilder builder = factory.newDocumentBuilder(); +//// Document d = builder.parse(inputStream); +//// NodeList list = d.getElementsByTagName("description"); +//// for (int i = 0; i 0){ +//// json = new AjaxJson(); +//// }else { +//// json = AjaxJson.returnExceptionInfo("保存案卷信息失败"); +//// } +//// } +//// //卷内基本信息.xml 案件级档号folderNo进行关联案卷 +//// if(ss[ss.length-1].equals("卷内基本信息.xml") && folderNo != null){ +//// //解析xml +//// inputStream = zipFile.getInputStream(zipEntry); +//// //读取xml,封装对象 +//// SAXReader saxReader =new SAXReader(); +//// org.dom4j.Document doc = saxReader.read(inputStream); +//// //读取Iterator标签 +//// Iterator it=doc.getRootElement().elementIterator("part"); +//// while (it.hasNext()){ +//// Element elem = it.next(); +//// DocTraditionArrangeOaVolume docTraditionArrangeVolume = new DocTraditionArrangeOaVolume(); +//// docTraditionArrangeVolume.setFolderNo(String.valueOf(folderNo)); +//// docTraditionArrangeVolume.setFondsNo(elem.attributeValue("fonds_no")); +//// docTraditionArrangeVolume.setMaintitle(elem.attributeValue("maintitle")); +//// docTraditionArrangeVolume.setArchiveCtgNo(elem.attributeValue("archive_ctg_no")); +//// docTraditionArrangeVolume.setFilingYear(Integer.valueOf(elem.attributeValue("filing_year"))); +//// docTraditionArrangeVolume.setRetention(elem.attributeValue("retention")); +//// docTraditionArrangeVolume.setDamldm(elem.attributeValue("damldm")); +//// docTraditionArrangeVolume.setSecurityClass(elem.attributeValue("security_class")); +//// docTraditionArrangeVolume.setDocNo(elem.attributeValue("doc_no")); +//// docTraditionArrangeVolume.setResponsibleby(elem.attributeValue("responsibleby")); +//// Integer pieceNo = Integer.valueOf(elem.attributeValue("piece_no")); +//// docTraditionArrangeVolume.setPieceNo(pieceNo); +//// //将数据插入到卷内数据库里面 +//// int num = docTraditionVolumeService.saveDocVolume(docTraditionArrangeVolume); +//// if(num>0){ +//// Integer id = docTraditionArrangeVolume.getId(); +//// //将对应的id和piece_no存入map里面 +//// map.put(id,pieceNo); +//// json = new AjaxJson(); +//// }else { +//// json = AjaxJson.returnExceptionInfo("保存卷内信息失败"); +//// } +//// +//// } +//// } +//// //卷内相关文件 +//// for(Map.Entry entry:map.entrySet()){ +//// //文件夹为1对应的piece_no为1 +//// if(entry.getValue()==1 && entryName.indexOf("案卷模板/1/")!=-1 && entry.getKey()!=null){ +//// inputStream = zipFile.getInputStream(zipEntry); +//// DocVolumeOriginalOaEntity docVolumeOriginalEntity = new DocVolumeOriginalOaEntity(); +//// docVolumeOriginalEntity.setRecid(entry.getKey()); +//// docVolumeOriginalEntity.setFileName(entryName); +//// docVolumeOriginalEntity.setFileLen(Float.valueOf(inputStream.read())); +//// //插入卷内文件 +//// docTraditionVolumeService.saveDocVolumeOriginalEntity(docVolumeOriginalEntity); +//// } +//// //文件夹2对应piece_no为2的原文 +//// if(entry.getValue()==2 && entryName.indexOf("案卷模板/2/")!=-1 && entry.getKey()!=null){ +//// inputStream = zipFile.getInputStream(zipEntry); +//// DocVolumeOriginalOaEntity docVolumeOriginalEntity = new DocVolumeOriginalOaEntity(); +//// docVolumeOriginalEntity.setRecid(entry.getKey()); +//// docVolumeOriginalEntity.setFileName(entryName); +//// docVolumeOriginalEntity.setFileLen(Float.valueOf(inputStream.read())); +//// //插入卷内文件 +//// docTraditionVolumeService.saveDocVolumeOriginalEntity(docVolumeOriginalEntity); +//// } +//// System.out.println(entry.getKey()+"--->"+entry.getValue()); +//// } +// +// +// } + + }catch(Exception e) { + json = AjaxJson.returnExceptionInfo("保存信息失败"+e); + } + return json; + } + + + @RequestMapping(value="/test" , method= RequestMethod.POST) + @ApiOperation(value = "测试对接") + public void test(String classType) { + try { + if(classType.equals("WSJH")){ + String targetPath = "D:/arc/test1"; + String str = FileUtils.GetZipStr("D:/arc/archives/简化模板/简化模板.zip"); + System.out.println(str); + File file = FileUtils.base64ToFile(str); + String unzip = unzip(file, targetPath); + //然后挂接 + if(unzip.equals("success")){ + wsjhOa(targetPath); + } + }else if(classType.equals("WSCT")){ + String targetPath = "D:/arc/test2"; + String str = FileUtils.GetZipStr("D:/arc/archives/案卷模板/案卷模板.zip"); + System.out.println(str); + File file = FileUtils.base64ToFile(str); + String unzip = unzip(file, targetPath); + //然后挂接 + if(unzip.equals("success")){ + wsctOa(targetPath); + } + } + } catch (IOException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + + + } + + //解析OA简化 + @RequestMapping(value="/wsjhOa" , method= RequestMethod.POST) + @ApiOperation(value = "测试") + public void wsjhOa(String url) throws Exception { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + //文件解析 + File[] files = new File(url).listFiles(); + if(null == files || files.length < 1){ + System.out.println("文件路径错误或不存在"); +// return json = AjaxJson.returnExceptionInfo("文件路径错误或不存在"); + } + int jhId = 0; + int page = 0; + for (File file : files) { + if(file.isDirectory()){ + File[] files1 = file.listFiles(); + page = files1.length; + } + } + for (File file : files) { + if(file.getName().equals("基本信息描述.xml")){ + //1.创建DocumentBuilderFactory对象 + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + Document d = builder.parse(file); + NodeList list = d.getElementsByTagName("description"); + for (int i = 0; i mapTwo = new HashMap(); + mapTwo.put("tableName", "wsjh_table_20220216102100040_temp"); + //其实我们知道是哪些字段 + mapTwo.put("fieldName", fieldName); + mapTwo.put("valueName", valueName); + danganguanliService.saveObject(mapTwo); + jhId = (Integer) mapTwo.get("id"); + } + } + } + for (File file : files) { + if(file.isDirectory()){ + File[] files1 = file.listFiles(); + for (File file1 : files1) { + InputStream is =new FileInputStream(file1); + String myuuid = StringUtil.generaterUUID(); + String relative_path = "uploadFile/" + "wsjh_table_20220216102100040_temp_file/" + "/" + jhId; + String dir = request.getRealPath("/") + relative_path; + //原文图片也要添加到表中 + //把数据添加到表中 + String fieldNameFile = + "rec_id, " + + "file_name, " + + "file_name_server, " + + "file_path, " + + "file_type," + + "page_no," + + "file_des," + + "file_status"; + String valueNameFile = + "" + jhId + "," + + "'" + myuuid + ".jpg'," + + "'" + myuuid + ".jpg'," + + "'" + relative_path + "'," + + "'jpg'," + + "-1," + + "'" + dir + "'," + + "1"; + Map mapFile = new HashMap(); + mapFile.put("tableName", "wsjh_table_20220216102100040_temp_file"); + //其实我们知道是哪些字段 + mapFile.put("fieldName", fieldNameFile); + mapFile.put("valueName", valueNameFile); + danganguanliService.saveObject(mapFile); + String imgName = myuuid + ".jpg"; + File fileOne = new File(dir); + if (!fileOne.exists()) { + fileOne.mkdirs(); + } + //获取输出流 + OutputStream os= new FileOutputStream(dir+"/"+imgName); + byte [] bts = new byte [ 1024 ]; + //一个一个字节的读取并写入 + while (is.read(bts)!=- 1 ) + { + os.write(bts); + } + os.flush(); + os.close(); + is.close(); + String file_name_server = myuuid + ".jpg"; + //生成一份pdf文件,用于归档章的操作 + String newName_pdf=file_name_server.replace(".jpg",".pdf"); + PdfFileHelper.image2Pdf(dir+File.separator+file_name_server,dir+File.separator+newName_pdf); + + String newName_pdf_original=newName_pdf.replace(".pdf","_original.pdf"); + FileTool.copyFile(dir+File.separator+newName_pdf,dir+File.separator+newName_pdf_original); + } + } + } + System.out.println("成功"); + } + + //解析OA传统 + @RequestMapping(value="/wsctOa" , method= RequestMethod.POST) + @ApiOperation(value = "测试传统") + public void wsctOa(String url) throws Exception { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + //文件解析 + File[] files = new File(url).listFiles(); + if(null == files || files.length < 1){ + System.out.println("文件路径错误或不存在"); +// return json = AjaxJson.returnExceptionInfo("文件路径错误或不存在"); + } + int ajId = 0; +// int page = 0; + //图片文件 + List fileList = new ArrayList<>(); + //案卷xml + File ajFile = null; + //卷内xml + File jnFile = null; + for (File file : files) { + if(file.isDirectory()){ + fileList.add(file); + }else if(file.getName().equals("案卷基本信息.xml")){ + ajFile = file; + }else if (file.getName().equals("卷内基本信息.xml")){ + jnFile = file; + } + } + + //案卷 + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + Document d = builder.parse(ajFile); + NodeList list = d.getElementsByTagName("description"); + for (int i = 0; i mapTwo = new HashMap(); + mapTwo.put("tableName", "ct1_table_20220110105000015_temp"); + //其实我们知道是哪些字段 + mapTwo.put("fieldName", fieldName); + mapTwo.put("valueName", valueName); + danganguanliService.saveObject(mapTwo); + ajId = (Integer) mapTwo.get("id"); + } + + + //卷内 + Document jnd = builder.parse(jnFile); + NodeList jnList = jnd.getElementsByTagName("part"); + for (int i = 0; i mapTwo = new HashMap(); + mapTwo.put("tableName", "ct2_table_20220110105000016_temp"); + //其实我们知道是哪些字段 + mapTwo.put("fieldName", fieldName); + mapTwo.put("valueName", valueName); + danganguanliService.saveObject(mapTwo); + int jnId = (Integer) mapTwo.get("id"); + for (File file : fileList) { + if(Integer.parseInt(file.getName()) == pieceNo){ + File[] files1 = file.listFiles(); + for (File file1 : files1) { + InputStream is =new FileInputStream(file1); + String myuuid = StringUtil.generaterUUID(); + String relative_path = "uploadFile/" + "ct2_table_20220110105000016_temp_file/" + "/" + jnId; + String dir = request.getRealPath("/") + relative_path; + //原文图片也要添加到表中 + //把数据添加到表中 + String fieldNameFile = + "rec_id, " + + "file_name, " + + "file_name_server, " + + "file_path, " + + "file_type," + + "page_no," + + "file_des," + + "file_status"; + String valueNameFile = + "" + jnId + "," + + "'" + myuuid + ".jpg'," + + "'" + myuuid + ".jpg'," + + "'" + relative_path + "'," + + "'jpg'," + + "-1," + + "'" + dir + "'," + + "1"; + Map mapFile = new HashMap(); + mapFile.put("tableName", "ct2_table_20220110105000016_temp_file"); + //其实我们知道是哪些字段 + mapFile.put("fieldName", fieldNameFile); + mapFile.put("valueName", valueNameFile); + danganguanliService.saveObject(mapFile); + String imgName = myuuid + ".jpg"; + File fileOne = new File(dir); + if (!fileOne.exists()) { + fileOne.mkdirs(); + } + //获取输出流 + OutputStream os= new FileOutputStream(dir+"/"+imgName); + byte [] bts = new byte [ 1024 ]; + //一个一个字节的读取并写入 + while (is.read(bts)!=- 1 ) + { + os.write(bts); + } + os.flush(); + os.close(); + is.close(); + + String file_name_server = myuuid + ".jpg"; + //生成一份pdf文件,用于归档章的操作 + String newName_pdf=file_name_server.replace(".jpg",".pdf"); + PdfFileHelper.image2Pdf(dir+File.separator+file_name_server,dir+File.separator+newName_pdf); + + String newName_pdf_original=newName_pdf.replace(".pdf","_original.pdf"); + FileTool.copyFile(dir+File.separator+newName_pdf,dir+File.separator+newName_pdf_original); + + } + } + } + } + + System.out.println("成功"); + } + + + @RequestMapping(value = "/oaReceive", method = RequestMethod.POST) + @ApiOperation(value = "Oa对接") + public AjaxJson oaReceive(String classType, String fileName, String receiveFileString) throws Exception { + String base64 = Base64Utils.encode2(receiveFileString); + WebserviceClient.testSend1(classType,fileName,base64); + return new AjaxJson(); +// System.out.println(cc); + } + + +} diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 0eb8d1a..b37723c 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -15,7 +15,7 @@ - + @@ -170,10 +170,10 @@ - - - - + + + +