From 4647ad692af384ab08bb0eb4e4ba51a0b6d2371f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=96?= Date: Wed, 15 May 2024 18:15:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E8=B5=84=E4=BA=A7=E6=8E=A5?= =?UTF-8?q?=E5=8F=A30.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/SaveFaAssetCardApiSavePlugin.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/shkd-cosmic-debug/src/main/java/shkd/fi/fa/plugin/SaveFaAssetCardApiSavePlugin.java b/shkd-cosmic-debug/src/main/java/shkd/fi/fa/plugin/SaveFaAssetCardApiSavePlugin.java index b3e3a7b..d719ee0 100644 --- a/shkd-cosmic-debug/src/main/java/shkd/fi/fa/plugin/SaveFaAssetCardApiSavePlugin.java +++ b/shkd-cosmic-debug/src/main/java/shkd/fi/fa/plugin/SaveFaAssetCardApiSavePlugin.java @@ -15,27 +15,27 @@ public class SaveFaAssetCardApiSavePlugin implements ApiSavePlugin { List> finentryList = null; Map finentry = null; Map tempNumber = null; - for(Map temp1 : reqData) { + for (Map temp1 : reqData) { // 核算组织.编码 默认值 B-021B-061 - if(!temp1.containsKey("org")) { + if (!temp1.containsKey("org")) { tempNumber = new HashMap(); tempNumber.put("number", "B-021B-061"); temp1.put("org", tempNumber); } // 资产组织.编码 默认值 B-021B-061 - if(!temp1.containsKey("assetunit")){ + if (!temp1.containsKey("assetunit")) { tempNumber = new HashMap(); tempNumber.put("number", "B-021B-061"); temp1.put("assetunit", tempNumber); } // 来源方式.编码 默认值 01.01 购入 - if(!temp1.containsKey("originmethod")){ + if (!temp1.containsKey("originmethod")) { tempNumber = new HashMap(); tempNumber.put("number", "01.01"); temp1.put("originmethod", tempNumber); } // 存放地点.编码 默认值 021 上海 - if(!temp1.containsKey("storeplace")){ + if (!temp1.containsKey("storeplace")) { tempNumber = new HashMap(); tempNumber.put("number", "021"); temp1.put("storeplace", tempNumber); @@ -49,9 +49,16 @@ public class SaveFaAssetCardApiSavePlugin implements ApiSavePlugin { tempNumber.put("number", "16002062"); temp1.put("headusedept", tempNumber); // 资产数量 - Integer assetamount = (Integer)temp1.get("assetamount"); + Integer assetamount = (Integer) temp1.get("assetamount"); // 财务分录 - finentry = ((List>)temp1.get("finentry")).get(0); + finentryList = (List>) temp1.get("finentry"); + if(finentryList == null){ + finentry = new HashMap(); + finentry.put("fin_originalval", temp1.get("price")); + } else { + finentry = finentryList.get(0); + } + finentry.put("seq", 1); // seq // 财务分录.预计寿命 默认1 finentry.put("fin_preusingamount", BigDecimal.ONE); @@ -66,7 +73,7 @@ public class SaveFaAssetCardApiSavePlugin implements ApiSavePlugin { // 财务分录.财务入账日期 默认:启用日期 finentry.put("fin_finaccountdate", temp1.get("realaccountdate")); //资产原值 - BigDecimal originalval = (BigDecimal)finentry.get("fin_originalval"); + BigDecimal originalval = (BigDecimal) finentry.get("fin_originalval"); BigDecimal originalval3 = BigDecimal.ZERO; // 资产原值 除 资产数量 = 资产原值单价 BigDecimal originalval2 = originalval.divide(BigDecimal.valueOf(assetamount), 2, BigDecimal.ROUND_DOWN); @@ -82,13 +89,14 @@ public class SaveFaAssetCardApiSavePlugin implements ApiSavePlugin { temp2.put("finentry", finentryList); // 资产数量. 默认1(接口因为需求定义为int,系统默认BigDecimal类型,否则按String类型处理) temp2.put("assetamount", 1); + temp2.remove("price"); reqData2.add(temp2); originalval3 = originalval3.add(originalval2); } // 分割前后的资产原值不一致的情况,差额添加到最后一件上 - if(!originalval.equals(originalval3)) { + if (!originalval.equals(originalval3)) { BigDecimal originalval4 = originalval2.add((originalval.subtract(originalval3))); - ((List>)reqData2.get((reqData2.size() - 1)).get("finentry")) + ((List>) reqData2.get((reqData2.size() - 1)).get("finentry")) .get(0).put("fin_originalval", originalval4); } }