admin
2025-02-25 30d8e227e8d823b6c38c3b9c90ac2df03b63befe
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
package com.yeshi.fanli.util.order;
 
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
 
import com.yeshi.fanli.entity.order.CommonOrder;
 
public class CommonOrderUtil {
 
    /**
     * 就算收益
     * @Title: computeIncome
     * @Description: 
     * @param orderList
     * @return 
     * BigDecimal 返回类型
     * @throws
     */
    public static BigDecimal computeIncome(List<CommonOrder> orderList) {
        if (orderList == null || orderList.size() == 0)
            return null;
        BigDecimal money = new BigDecimal(0);
        for (CommonOrder commonOrder : orderList)
            if (commonOrder.getState() != CommonOrder.STATE_SX && commonOrder.geteIncome() != null)
                money = money.add(commonOrder.geteIncome());
        return money;
    }
 
    /**
     * 计算预估收益
     * @Title: computeEstimate
     * @Description: 
     * @param orderList
     * @return 
     * BigDecimal 返回类型
     * @throws
     */
    public static BigDecimal computeEstimate(List<CommonOrder> orderList) {
        if (orderList == null || orderList.size() == 0)
            return null;
        BigDecimal money = new BigDecimal(0);
        for (CommonOrder commonOrder : orderList)
            if (commonOrder.getState() != CommonOrder.STATE_SX && commonOrder.getEstimate() != null)
                money = money.add(commonOrder.getEstimate());
        return money;
    }
 
    public static Integer getState(List<CommonOrder> orderList) {
        if (orderList == null || orderList.size() == 0)
            return null;
        int sxCount = 0;
        int wqCount = 0;
        int fkCount = 0;
        int jsCount = 0;
        for (CommonOrder order : orderList) {
            switch (order.getState()) {
            case CommonOrder.STATE_FK:
                fkCount++;
                break;
            case CommonOrder.STATE_JS:
                jsCount++;
                break;
            case CommonOrder.STATE_SX:
                sxCount++;
                break;
            case CommonOrder.STATE_WQ:
                wqCount++;
                break;
            }
        }
 
        if (sxCount == orderList.size())
            return CommonOrder.STATE_SX;
 
        if (wqCount + sxCount == orderList.size())
            return CommonOrder.STATE_WQ;
 
        if (wqCount + sxCount + jsCount == orderList.size())
            return CommonOrder.STATE_JS;
 
        return CommonOrder.STATE_FK;
    }
 
    public static Date getSettlementTime(List<CommonOrder> orderList) {
        if (orderList == null)
            return null;
        for (CommonOrder order : orderList) {
            switch (order.getState()) {
 
            case CommonOrder.STATE_JS:
            case CommonOrder.STATE_WQ:
                return order.getSettleTime();
            }
        }
        return null;
    }
 
}