提交内容:API映射公共单据

备注:关于日期字段修改
提交人:邹江涛
This commit is contained in:
zoujiangtao 2024-12-10 10:26:21 +08:00
parent c4ed69a7ba
commit 91f82c191d
1 changed files with 8 additions and 8 deletions

View File

@ -191,7 +191,7 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
} }
in.close(); in.close();
// 替换 \n 为实际的换行符 // 替换 \n 为实际的换行符
formattedContent = content.toString().replace("\\n", "\n").replace("\\",""); formattedContent = content.toString().replace("\\n", "\n").replace("\\", "");
} else { } else {
formattedContent = "响应失败"; formattedContent = "响应失败";
} }
@ -360,6 +360,12 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
} else { } else {
value = "2";//收入 value = "2";//收入
} }
} else if ("bizdate".equals(parts[0])) {
Date bizdate = billObject.getDate("bizdate");
// 创建一个SimpleDateFormat对象指定格式为"yyyy-MM-dd"
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// 格式化Date对象为字符串
value = sdf.format(bizdate);
} else { } else {
value = billObject.get(parts[0]); value = billObject.get(parts[0]);
} }
@ -399,14 +405,8 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
String tartype = dynamicObject.getString("shkd_tartype"); String tartype = dynamicObject.getString("shkd_tartype");
if ("String".equals(tartype)) { if ("String".equals(tartype) || "Date".equals(tartype)) {
jsonObject.put(key, value); jsonObject.put(key, value);
} else if ("Date".equals(tartype)) {
// 创建一个Date对象
Date date = new Date((Long) value);
// 创建一个SimpleDateFormat对象指定格式为"yyyy-MM-dd"
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
jsonObject.put(key, sdf.format(date));
} else if ("Integer".equals(tartype)) { } else if ("Integer".equals(tartype)) {
jsonObject.put(key, Integer.parseInt(value.toString())); jsonObject.put(key, Integer.parseInt(value.toString()));
} else if ("BigDecimal".equals(tartype)) { } else if ("BigDecimal".equals(tartype)) {