package com.changhong.epc.form.service.budget.department.model; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; import com.changhong.epc.constter.system.businesscode.BudgetBusinessMeaningCode; import lombok.Data; @Data public class BudgetRow implements BudgetBusinessMeaningCode{ private Integer dataRowNumber; private String costType; private String department; private String money; private String balance; private String superMoney; private String superDepartement; private String hideInfo; private String tenantId; private List rowIds; private List supperBudgetRows; public BudgetRow(Map map){ mapToBudgetRow(this,map); List> supperRows = (List>) map.get(SUPPER_BUDGET_ROWS); supperBudgetRows = new ArrayList<>(); supperRows.forEach(o->supperBudgetRows.add(mapToBudgetRow(new BudgetRow(),o))); } public BudgetRow(){ } BudgetRow mapToBudgetRow(BudgetRow budgetRow,Map map){ budgetRow.dataRowNumber = Integer.valueOf(Objects.toString(map.get(DATAROWNUMBER), "-1")); budgetRow.costType = Objects.toString(map.get(BUDGET_ITEM_COST_TYPE), ""); budgetRow.department = Objects.toString(map.get(BUDGET_ITEM_DEPARTMENT), ""); budgetRow.money = money(map);//Objects.toString(map.get(BUDGET_ITEM_MONEY), ""); budgetRow.balance = Objects.toString(map.get(BUDGET_ITEM_BALANCE), ""); budgetRow.superMoney = Objects.toString(map.get(BUDGET_SUPER_MONEY), ""); budgetRow.superDepartement = Objects.toString(map.get(BUDGET_SUPER_DEPARTEMENT), ""); budgetRow.hideInfo = Objects.toString(map.get(BUDGET_HIDE_INFO), ""); budgetRow.rowIds = (List) map.get(ROW_IDS); budgetRow.tenantId = Objects.toString(map.get("TENANTID"), ""); return budgetRow; } private static String money(Map map){ Object ysm = map.get(BUDGET_ITEM_MONEY); if(ysm != null) return Objects.toString(ysm,"0"); ysm = map.get(APPLY_USE_MONEY); if(ysm != null) return Objects.toString(ysm,"0"); ysm = map.get(EXPEND_USE_MONEY); if(ysm != null) return Objects.toString(ysm,"0"); return "0"; } }