固定资产接口0.2
This commit is contained in:
		
							parent
							
								
									ae0c658e08
								
							
						
					
					
						commit
						4647ad692a
					
				| 
						 | 
					@ -15,27 +15,27 @@ public class SaveFaAssetCardApiSavePlugin implements ApiSavePlugin {
 | 
				
			||||||
        List<Map<String, Object>> finentryList = null;
 | 
					        List<Map<String, Object>> finentryList = null;
 | 
				
			||||||
        Map<String, Object> finentry = null;
 | 
					        Map<String, Object> finentry = null;
 | 
				
			||||||
        Map<String, Object> tempNumber = null;
 | 
					        Map<String, Object> tempNumber = null;
 | 
				
			||||||
        for(Map<String, Object> temp1 : reqData) {
 | 
					        for (Map<String, Object> temp1 : reqData) {
 | 
				
			||||||
            // 核算组织.编码 默认值 B-021B-061
 | 
					            // 核算组织.编码 默认值 B-021B-061
 | 
				
			||||||
            if(!temp1.containsKey("org")) {
 | 
					            if (!temp1.containsKey("org")) {
 | 
				
			||||||
                tempNumber = new HashMap<String, Object>();
 | 
					                tempNumber = new HashMap<String, Object>();
 | 
				
			||||||
                tempNumber.put("number", "B-021B-061");
 | 
					                tempNumber.put("number", "B-021B-061");
 | 
				
			||||||
                temp1.put("org", tempNumber);
 | 
					                temp1.put("org", tempNumber);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            // 资产组织.编码 默认值 B-021B-061
 | 
					            // 资产组织.编码 默认值 B-021B-061
 | 
				
			||||||
            if(!temp1.containsKey("assetunit")){
 | 
					            if (!temp1.containsKey("assetunit")) {
 | 
				
			||||||
                tempNumber = new HashMap<String, Object>();
 | 
					                tempNumber = new HashMap<String, Object>();
 | 
				
			||||||
                tempNumber.put("number", "B-021B-061");
 | 
					                tempNumber.put("number", "B-021B-061");
 | 
				
			||||||
                temp1.put("assetunit", tempNumber);
 | 
					                temp1.put("assetunit", tempNumber);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            // 来源方式.编码 默认值 01.01 购入
 | 
					            // 来源方式.编码 默认值 01.01 购入
 | 
				
			||||||
            if(!temp1.containsKey("originmethod")){
 | 
					            if (!temp1.containsKey("originmethod")) {
 | 
				
			||||||
                tempNumber = new HashMap<String, Object>();
 | 
					                tempNumber = new HashMap<String, Object>();
 | 
				
			||||||
                tempNumber.put("number", "01.01");
 | 
					                tempNumber.put("number", "01.01");
 | 
				
			||||||
                temp1.put("originmethod", tempNumber);
 | 
					                temp1.put("originmethod", tempNumber);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            // 存放地点.编码 默认值 021 上海
 | 
					            // 存放地点.编码 默认值 021 上海
 | 
				
			||||||
            if(!temp1.containsKey("storeplace")){
 | 
					            if (!temp1.containsKey("storeplace")) {
 | 
				
			||||||
                tempNumber = new HashMap<String, Object>();
 | 
					                tempNumber = new HashMap<String, Object>();
 | 
				
			||||||
                tempNumber.put("number", "021");
 | 
					                tempNumber.put("number", "021");
 | 
				
			||||||
                temp1.put("storeplace", tempNumber);
 | 
					                temp1.put("storeplace", tempNumber);
 | 
				
			||||||
| 
						 | 
					@ -49,9 +49,16 @@ public class SaveFaAssetCardApiSavePlugin implements ApiSavePlugin {
 | 
				
			||||||
            tempNumber.put("number", "16002062");
 | 
					            tempNumber.put("number", "16002062");
 | 
				
			||||||
            temp1.put("headusedept", tempNumber);
 | 
					            temp1.put("headusedept", tempNumber);
 | 
				
			||||||
            // 资产数量
 | 
					            // 资产数量
 | 
				
			||||||
            Integer assetamount = (Integer)temp1.get("assetamount");
 | 
					            Integer assetamount = (Integer) temp1.get("assetamount");
 | 
				
			||||||
            // 财务分录
 | 
					            // 财务分录
 | 
				
			||||||
            finentry = ((List<Map<String, Object>>)temp1.get("finentry")).get(0);
 | 
					            finentryList = (List<Map<String, Object>>) temp1.get("finentry");
 | 
				
			||||||
 | 
					            if(finentryList == null){
 | 
				
			||||||
 | 
					                finentry = new HashMap<String, Object>();
 | 
				
			||||||
 | 
					                finentry.put("fin_originalval", temp1.get("price"));
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                finentry = finentryList.get(0);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            finentry.put("seq", 1); // seq
 | 
					            finentry.put("seq", 1); // seq
 | 
				
			||||||
            // 财务分录.预计寿命 默认1
 | 
					            // 财务分录.预计寿命 默认1
 | 
				
			||||||
            finentry.put("fin_preusingamount", BigDecimal.ONE);
 | 
					            finentry.put("fin_preusingamount", BigDecimal.ONE);
 | 
				
			||||||
| 
						 | 
					@ -66,7 +73,7 @@ public class SaveFaAssetCardApiSavePlugin implements ApiSavePlugin {
 | 
				
			||||||
            // 财务分录.财务入账日期 默认:启用日期
 | 
					            // 财务分录.财务入账日期 默认:启用日期
 | 
				
			||||||
            finentry.put("fin_finaccountdate", temp1.get("realaccountdate"));
 | 
					            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 originalval3 = BigDecimal.ZERO;
 | 
				
			||||||
            // 资产原值 除 资产数量 = 资产原值单价
 | 
					            // 资产原值 除 资产数量 = 资产原值单价
 | 
				
			||||||
            BigDecimal originalval2 = originalval.divide(BigDecimal.valueOf(assetamount), 2, BigDecimal.ROUND_DOWN);
 | 
					            BigDecimal originalval2 = originalval.divide(BigDecimal.valueOf(assetamount), 2, BigDecimal.ROUND_DOWN);
 | 
				
			||||||
| 
						 | 
					@ -82,13 +89,14 @@ public class SaveFaAssetCardApiSavePlugin implements ApiSavePlugin {
 | 
				
			||||||
                temp2.put("finentry", finentryList);
 | 
					                temp2.put("finentry", finentryList);
 | 
				
			||||||
                // 资产数量. 默认1(接口因为需求定义为int,系统默认BigDecimal类型,否则按String类型处理)
 | 
					                // 资产数量. 默认1(接口因为需求定义为int,系统默认BigDecimal类型,否则按String类型处理)
 | 
				
			||||||
                temp2.put("assetamount", 1);
 | 
					                temp2.put("assetamount", 1);
 | 
				
			||||||
 | 
					                temp2.remove("price");
 | 
				
			||||||
                reqData2.add(temp2);
 | 
					                reqData2.add(temp2);
 | 
				
			||||||
                originalval3 = originalval3.add(originalval2);
 | 
					                originalval3 = originalval3.add(originalval2);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            // 分割前后的资产原值不一致的情况,差额添加到最后一件上
 | 
					            // 分割前后的资产原值不一致的情况,差额添加到最后一件上
 | 
				
			||||||
            if(!originalval.equals(originalval3)) {
 | 
					            if (!originalval.equals(originalval3)) {
 | 
				
			||||||
                BigDecimal originalval4 = originalval2.add((originalval.subtract(originalval3)));
 | 
					                BigDecimal originalval4 = originalval2.add((originalval.subtract(originalval3)));
 | 
				
			||||||
                ((List<Map<String, Object>>)reqData2.get((reqData2.size() - 1)).get("finentry"))
 | 
					                ((List<Map<String, Object>>) reqData2.get((reqData2.size() - 1)).get("finentry"))
 | 
				
			||||||
                        .get(0).put("fin_originalval", originalval4);
 | 
					                        .get(0).put("fin_originalval", originalval4);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue