zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
commit | author | age
a18bfa 1 package com.changhong.epc.bean.form;
Z 2
3 import com.alibaba.fastjson.TypeReference;
4 import com.iemsoft.framework.cloud.core.tools.JSONTool;
5 import lombok.Data;
6
7 import java.io.Serializable;
8 import java.util.Date;
9 import java.util.List;
10 import java.util.Map;
11 import java.util.Objects;
12
13 import static com.changhong.epc.constter.system.businesscode.BudgetBusinessMeaningCode.ALIAS;
14 import static com.changhong.epc.constter.system.businesscode.BudgetBusinessMeaningCode.ASSETSTYPE;
15
16 /**
17  * 固定资产
18  * 对应表:formdata_13_baa0a8f0fc614f4766f9425f2ae3
19  */
20 @Data
21 public class Asset implements Serializable{
22     /**
23      * 
24      */
25     private static final long serialVersionUID = 1L;
26     
27     private String id;//DATAROWNUM
28     /**
29      * 折旧率
30      */
31     private Double depreciationRate;
32     /**
33      * 本期折旧额
34      */
35     private Double currentDepreciation;
36     /**
37      * 计提日期
38      */
39     private String calculationData;    
40     /**
41      * 计提状态
42      */
43     private String accountingState;
44     /**
45      * 计提期间
46      */
47     private String calculationPeriod;        
48     /**
49      *资产分类
50      */
51     private String assetsType;
52     /**
53      *资产编号
54      */
55     private String assetsCode;
56     /**
57      *资产名称
58      */
59     private String assetsName;
60     /**
61      *使用部门
62      */
63     private String useDepartment;
64     /**
65      *保管人
66      */
67     private String keepingUser;
68     /**
69      *计量单位
70      */
71     private String metering;
72     /**
73      *数量
74      */
75     private String count;
76     /**
77      *收获日期
78      */
79     private String takeGoodsDate;
80     /**
81      *资产化日期
82      */
83     private String capitalizationData;
84     /**
85      *规格型号
86      */
87     private String specifications;
88     /**
89      *预计使用年限
90      */
91     private String estimateTime;
92     /**
93      *已使用年限(月)
94      */
95     private String alreadyTime;
96     /**
97      *剩余使用年限(月)
98      */
99     private String surplusTime;
100     /**
101      *原值
102      */
103     private double originalMoney;
104
105     /**
106      * 控件累计折旧额 表单控件中的值
107      */
108     private double cpnCumulativeDepreciation;
109
110     /**
111      *累计折旧额 连查出的值
112      */
113     private double cumulativeDepreciation;
114     /**
115      *净残值
116      */
117     private double netMoney;
118     /**
119      *预计净产值率
120      */
121     private String estimateRate;
122     /**
123      *预计净残值
124      */
125     private String estimateValue;
126     /**
127      *是否折旧 0折旧 1 不折旧
128      */
129     private String depreciation;
130     /**
131      *折旧方法
132      */
133     private String depreciationMethod;
134     /**
135      *使用状态
136      */
137     private String state;
138     /**
139      *是否格式化 默认0 0未格式化  1已格式化
140      */
141     private String formatState;
142     /**
143      *
144      */
145     private String tenantId;
146     /**
147      *
148      */
149     private String parentDataRownum;
150     /**
151      *删除状态 0未删除  1删除
152      */
153     private String deletelg;
154     /**
155      *创建者
156      */
157     private String createuser;
158     /**
159      *创建时间
160      */
161     private Date createDateTime;
162     /**
163      *更改者
164      */
165     private String updateUser;
166     /**
167      *更改时间
168      */
169     private Date updateTime;
170     /**
171      *
172      */
173     private String processinstid;
174     /**
175      *
176      */
177     private String orderCode;
178     /**
179      *
180      */
181     private String orderStatus;
182
183     /**
184      * 固话数据
185      */
186     private String solidification;
187
188     private List<Map<String, Object>> solidificationObj;
189
190     public double getNetMoney() {
191         return this.originalMoney - this.cumulativeDepreciation;
192     }
193
194     public String getAssetsTypeName() {
195         return getSolidificationObj()
196                 .stream()
197                 .filter(line->Objects.equals(line.get(ALIAS), ASSETSTYPE))
198                 .findFirst()
199                 .map(line->line.get("name"))
200                 .map(line->{
201                     if(line instanceof List){
202                         return ((List)line).stream().findFirst().map(Object::toString).orElse("");
203                     }
204                     return line;
205                 })
206                 .map(Object::toString)
207                 .orElse("");
208     }
209
210     public List<Map<String, Object>> getSolidificationObj(){
211         if(solidificationObj == null){
212             solidificationObj = JSONTool.toObj(solidification, new TypeReference<List<Map<String, Object>>>(){}.getType());
213         }
214         return solidificationObj;
215     }
216     
217     public static void main(String... args){
218         Asset a = new Asset();
219         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\":[\"使用\"]}]");
220         System.out.println(a.getAssetsTypeName());
221     }
222
223     public String getKeepingUserName() {
224         return getSolidificationObj()
225                 .stream()
226                 .filter(line->Objects.equals(line.get(ALIAS), "keepingUser"))
227                 .findFirst()
228                 .map(line->line.get("name"))
229                 .map(line->{
230                     if(line instanceof List){
231                         return ((List)line).stream().findFirst().map(Object::toString).orElse("");
232                     }
233                     return line;
234                 })
235                 .map(Object::toString)
236                 .orElse("");
237     }
238 }