From 01c6cf1cdc467e3b8477a949aaabb254a1860dc2 Mon Sep 17 00:00:00 2001
From: "youHong.ai" <774495953@qq.com>
Date: Thu, 20 Apr 2023 15:19:49 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9float=E7=B2=BE=E5=BA=A6?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main/java/aiyh/utils/Util.java | 42 +++++
.../utils/recordset/FloatTypeHandler.java | 24 ++-
.../aiyh/utils/recordset/ResultMapper.java | 10 +-
.../config/service/DealWithMapping.java | 5 +-
.../sapdocking/VoucherPayableNewAction.java | 75 +++++++--
.../config/mapper/SapConfigMapper.java | 2 +-
.../config/service/SapConfigService.java | 8 +-
.../service/VoucherPayableService.java | 18 +--
.../cusgetvalue/ContentUrlEncodeGetValue.java | 30 ++++
.../cusgetvalue/FileToBase64CusGetValue.java | 7 +
.../youhong/ai/haripijiu/TestHaRiPiJiu.java | 123 ++++++++++++++
.../java/youhong/ai/utiltest/ExcelBody.java | 18 +++
.../java/youhong/ai/utiltest/ExcelCell.java | 23 +++
.../java/youhong/ai/utiltest/ExcelHead.java | 20 +++
.../java/youhong/ai/utiltest/ExcelPort.java | 104 ++++++++++++
.../java/youhong/ai/utiltest/ExcelRow.java | 23 +++
.../java/youhong/ai/utiltest/ExcelSheet.java | 22 +++
.../java/youhong/ai/utiltest/GenericTest.java | 151 ++++++++++++++++++
.../ai/utiltest/IExcelCellStyleCreator.java | 25 +++
19 files changed, 692 insertions(+), 38 deletions(-)
create mode 100644 src/main/java/weaver/youhong/ai/intellectualproperty/cusgetvalue/ContentUrlEncodeGetValue.java
create mode 100644 src/test/java/youhong/ai/utiltest/ExcelBody.java
create mode 100644 src/test/java/youhong/ai/utiltest/ExcelCell.java
create mode 100644 src/test/java/youhong/ai/utiltest/ExcelHead.java
create mode 100644 src/test/java/youhong/ai/utiltest/ExcelPort.java
create mode 100644 src/test/java/youhong/ai/utiltest/ExcelRow.java
create mode 100644 src/test/java/youhong/ai/utiltest/ExcelSheet.java
create mode 100644 src/test/java/youhong/ai/utiltest/IExcelCellStyleCreator.java
diff --git a/src/main/java/aiyh/utils/Util.java b/src/main/java/aiyh/utils/Util.java
index 0c9ad5f..61f38fc 100644
--- a/src/main/java/aiyh/utils/Util.java
+++ b/src/main/java/aiyh/utils/Util.java
@@ -17,6 +17,7 @@ import aiyh.utils.sqlUtil.builderSql.impl.BuilderSqlImpl;
import aiyh.utils.sqlUtil.whereUtil.Where;
import aiyh.utils.sqlUtil.whereUtil.impl.PrepWhereImpl;
import aiyh.utils.sqlUtil.whereUtil.impl.WhereImpl;
+import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
import aiyh.utils.zwl.common.ToolUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
@@ -28,6 +29,7 @@ import com.weaver.general.TimeUtil;
import org.apache.dubbo.common.utils.CollectionUtils;
import org.apache.log4j.*;
import org.h2.util.StringUtils;
+import org.jetbrains.annotations.NotNull;
import weaver.common.util.string.StringUtil;
import weaver.conn.RecordSet;
import weaver.docs.docs.DocImageManager;
@@ -61,6 +63,9 @@ import java.lang.reflect.*;
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.text.ParseException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
@@ -3952,4 +3957,41 @@ public class Util extends weaver.general.Util {
supportLanuage.append("`~`~");
return supportLanuage.toString();
}
+
+ /**
+ *
获取临时路径
+ *
+ * @param dir 临时路径名
+ * @param prefix 文件后缀
+ * @return 文件路径名
+ */
+ @NotNull
+ public static String getTempFilePath(String dir, String prefix) {
+ if (StrUtil.isBlank(dir)) {
+ dir = "temp";
+ }
+ if (StrUtil.isBlank(prefix)) {
+ throw new CustomerException("this prefix can not be null!");
+ }
+ String sysFilePath = GCONST.getSysFilePath();
+ String filePath = "";
+ if (sysFilePath.endsWith(File.separator)) {
+ filePath = sysFilePath + "cus_temp" + File.separator + dir + File.separator +
+ System.currentTimeMillis() + "-" + dir + "-" + UUID.randomUUID() + prefix;
+ } else {
+ filePath = sysFilePath + File.separator + "cus_temp" + File.separator + dir + File.separator +
+ System.currentTimeMillis() + "-" + dir + "-" + UUID.randomUUID() + prefix;
+ }
+ Path path = Paths.get(filePath);
+ if (!Files.exists(path)) {
+ Path parent = path.getParent();
+ try {
+ Files.createDirectories(parent);
+ } catch (IOException e) {
+ throw new CustomerException(Util.logStr("can not create file [{}]", filePath));
+ }
+ }
+ return filePath;
+ }
+
}
diff --git a/src/main/java/aiyh/utils/recordset/FloatTypeHandler.java b/src/main/java/aiyh/utils/recordset/FloatTypeHandler.java
index 46d0b99..0e7e65d 100644
--- a/src/main/java/aiyh/utils/recordset/FloatTypeHandler.java
+++ b/src/main/java/aiyh/utils/recordset/FloatTypeHandler.java
@@ -27,7 +27,11 @@ public class FloatTypeHandler implements TypeHandler {
}
return 0.0F;
}
- return Float.parseFloat(string);
+ float v = Float.parseFloat(string);
+ if (!string.equals(String.valueOf(v))) {
+ return Double.parseDouble(string);
+ }
+ return v;
}
@Override
@@ -41,7 +45,11 @@ public class FloatTypeHandler implements TypeHandler {
}
return 0.0F;
}
- return Float.parseFloat(string);
+ float v = Float.parseFloat(string);
+ if (!string.equals(String.valueOf(v))) {
+ return Double.parseDouble(string);
+ }
+ return v;
}
@Override
@@ -55,7 +63,11 @@ public class FloatTypeHandler implements TypeHandler {
}
return 0.0F;
}
- return Float.parseFloat(string);
+ float v = Float.parseFloat(string);
+ if (!string.equals(String.valueOf(v))) {
+ return Double.parseDouble(string);
+ }
+ return v;
}
@Override
@@ -69,7 +81,11 @@ public class FloatTypeHandler implements TypeHandler {
}
return 0.0F;
}
- return Float.parseFloat(string);
+ float v = Float.parseFloat(string);
+ if (!string.equals(String.valueOf(v))) {
+ return Double.parseDouble(string);
+ }
+ return v;
}
}
diff --git a/src/main/java/aiyh/utils/recordset/ResultMapper.java b/src/main/java/aiyh/utils/recordset/ResultMapper.java
index 7e6977d..0e3b2f3 100644
--- a/src/main/java/aiyh/utils/recordset/ResultMapper.java
+++ b/src/main/java/aiyh/utils/recordset/ResultMapper.java
@@ -473,15 +473,15 @@ public class ResultMapper {
}
if ("FLOAT".equalsIgnoreCase(columnType) || "DOUBLE".equalsIgnoreCase(columnType) || "DECIMAL".equalsIgnoreCase(columnType)) {
if (enable) {
- ((Map super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), rs.getFloat(i + 1));
+ ((Map super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), rs.getString(i + 1));
continue;
}
if (DBConstant.DB_TYPE_ORACLE.equals(rs.getDBType())) {
- ((Map super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), rs.getFloat(i + 1));
+ ((Map super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), rs.getString(i + 1));
}
- ((Map super Object, ? super Object>) o).put(columnName[i].toLowerCase(), rs.getFloat(i + 1));
- ((Map super Object, ? super Object>) o).put(columnName[i].toUpperCase(), rs.getFloat(i + 1));
- ((Map super Object, ? super Object>) o).put(columnName[i], rs.getFloat(i + 1));
+ ((Map super Object, ? super Object>) o).put(columnName[i].toLowerCase(), rs.getString(i + 1));
+ ((Map super Object, ? super Object>) o).put(columnName[i].toUpperCase(), rs.getString(i + 1));
+ ((Map super Object, ? super Object>) o).put(columnName[i], rs.getString(i + 1));
continue;
}
if (method.isAnnotationPresent(Associations.class)) {
diff --git a/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java b/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java
index 956879a..e673c4d 100644
--- a/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java
+++ b/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java
@@ -414,7 +414,6 @@ public class DealWithMapping extends ToolUtil {
}
// 6为List类型
else if (ParamTypeEnum.LIST == anEnum) {
- String childType = mappingDetail.getChildType();
List childList = mappingDetail.getChildList();
List