package com.changhong.epc.bean.form; import com.alibaba.fastjson.TypeReference; import com.iemsoft.framework.cloud.core.tools.JSONTool; import lombok.Data; import java.io.Serializable; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Objects; import static com.changhong.epc.constter.system.businesscode.BudgetBusinessMeaningCode.ALIAS; import static com.changhong.epc.constter.system.businesscode.BudgetBusinessMeaningCode.ASSETSTYPE; /** * 固定资产 * 对应表:formdata_13_baa0a8f0fc614f4766f9425f2ae3 */ @Data public class Asset implements Serializable{ /** * */ private static final long serialVersionUID = 1L; private String id;//DATAROWNUM /** * 折旧率 */ private Double depreciationRate; /** * 本期折旧额 */ private Double currentDepreciation; /** * 计提日期 */ private String calculationData; /** * 计提状态 */ private String accountingState; /** * 计提期间 */ private String calculationPeriod; /** *资产分类 */ private String assetsType; /** *资产编号 */ private String assetsCode; /** *资产名称 */ private String assetsName; /** *使用部门 */ private String useDepartment; /** *保管人 */ private String keepingUser; /** *计量单位 */ private String metering; /** *数量 */ private String count; /** *收获日期 */ private String takeGoodsDate; /** *资产化日期 */ private String capitalizationData; /** *规格型号 */ private String specifications; /** *预计使用年限 */ private String estimateTime; /** *已使用年限(月) */ private String alreadyTime; /** *剩余使用年限(月) */ private String surplusTime; /** *原值 */ private double originalMoney; /** * 控件累计折旧额 表单控件中的值 */ private double cpnCumulativeDepreciation; /** *累计折旧额 连查出的值 */ private double cumulativeDepreciation; /** *净残值 */ private double netMoney; /** *预计净产值率 */ private String estimateRate; /** *预计净残值 */ private String estimateValue; /** *是否折旧 0折旧 1 不折旧 */ private String depreciation; /** *折旧方法 */ private String depreciationMethod; /** *使用状态 */ private String state; /** *是否格式化 默认0 0未格式化 1已格式化 */ private String formatState; /** * */ private String tenantId; /** * */ private String parentDataRownum; /** *删除状态 0未删除 1删除 */ private String deletelg; /** *创建者 */ private String createuser; /** *创建时间 */ private Date createDateTime; /** *更改者 */ private String updateUser; /** *更改时间 */ private Date updateTime; /** * */ private String processinstid; /** * */ private String orderCode; /** * */ private String orderStatus; /** * 固话数据 */ private String solidification; private List> solidificationObj; public double getNetMoney() { return this.originalMoney - this.cumulativeDepreciation; } public String getAssetsTypeName() { return getSolidificationObj() .stream() .filter(line->Objects.equals(line.get(ALIAS), ASSETSTYPE)) .findFirst() .map(line->line.get("name")) .map(line->{ if(line instanceof List){ return ((List)line).stream().findFirst().map(Object::toString).orElse(""); } return line; }) .map(Object::toString) .orElse(""); } public List> getSolidificationObj(){ if(solidificationObj == null){ solidificationObj = JSONTool.toObj(solidification, new TypeReference>>(){}.getType()); } return solidificationObj; } public static void main(String... args){ Asset a = new Asset(); a.setSolidification("[{\"alias\":\"AssetsType\",\"tag_Id\":\"itemId_1\",\"tag_Type\":\"dropdownlist\",\"value\":[\"1000000\"],\"name\":[\"土地、房屋及构筑物\"]},{\"alias\":\"keepingUser\",\"tag_Id\":\"itemId_5\",\"tag_Type\":\"dropdownlist\",\"value\":[\"20192568\"],\"name\":[\"韩蓉\"]},{\"alias\":\"metering\",\"tag_Id\":\"itemId_6\",\"tag_Type\":\"dropdownlist\",\"value\":[\"34\"],\"name\":[\"棵\"]},{\"alias\":\"depreciation\",\"tag_Id\":\"itemId_19\",\"tag_Type\":\"dropdownlist\",\"value\":[\"F000001\"],\"name\":[\"是\"]},{\"alias\":\"depreciationMethod\",\"tag_Id\":\"itemId_20\",\"tag_Type\":\"dropdownlist\",\"value\":[\"F000001\"],\"name\":[\"年限平均法\"]},{\"alias\":\"state\",\"tag_Id\":\"itemId_21\",\"tag_Type\":\"dropdownlist\",\"value\":[\"0\"],\"name\":[\"使用\"]}]"); System.out.println(a.getAssetsTypeName()); } public String getKeepingUserName() { return getSolidificationObj() .stream() .filter(line->Objects.equals(line.get(ALIAS), "keepingUser")) .findFirst() .map(line->line.get("name")) .map(line->{ if(line instanceof List){ return ((List)line).stream().findFirst().map(Object::toString).orElse(""); } return line; }) .map(Object::toString) .orElse(""); } }