zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
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<Map<String, Object>> 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<Map<String, Object>> getSolidificationObj(){
        if(solidificationObj == null){
            solidificationObj = JSONTool.toObj(solidification, new TypeReference<List<Map<String, Object>>>(){}.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("");
    }
}