wuxw
2022-07-19 05683f2b2bdbdbe21cf17ad523c21ab338bd1c54
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
package com.java110.core.factory;
 
 
import com.java110.dto.machine.CarInoutDto;
import com.java110.dto.tempCarFeeConfig.TempCarFeeConfigAttrDto;
import com.java110.utils.util.DateUtil;
 
import java.text.ParseException;
import java.util.Date;
import java.util.List;
 
/**
 * 临时车 费用 工厂类
 */
public class TempCarFeeFactory {
 
    /**
     * 判断 用户是支付完成
     *
     * @param carInoutDto
     * @return
     */
    public static boolean judgeFinishPayTempCarFee(CarInoutDto carInoutDto) {
 
        //不是支付完成 状态
        if (!CarInoutDto.STATE_PAY.equals(carInoutDto.getState())) {
            return false;
        }
 
        //支付时间是否超过15分钟
        Date payTime = null;
        try {
            payTime = DateUtil.getDateFromString(carInoutDto.getPayTime(), DateUtil.DATE_FORMATE_STRING_A);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        Date nowTime = DateUtil.getCurrentDate();
        //支付完成超过15分钟
        if (nowTime.getTime() - payTime.getTime() > 15 * 60 * 1000) {
            return false;
        }
        return true;
    }
 
    /**
     * 判断 用户是支付完成
     *
     * @param carInoutDto
     * @return
     */
    public static long getTempCarMin(CarInoutDto carInoutDto) {
 
        //支付时间是否超过15分钟
        Date payTime = null;
        try {
            //不是支付完成 状态
            if (CarInoutDto.STATE_PAY.equals(carInoutDto.getState())) {
 
                try {
                    payTime = DateUtil.getDateFromString(carInoutDto.getPayTime(), DateUtil.DATE_FORMATE_STRING_A);
                } catch (ParseException e) {
                    e.printStackTrace();
                }
            } else {
                payTime = DateUtil.getDateFromString(carInoutDto.getInTime(), DateUtil.DATE_FORMATE_STRING_A);
            }
            Date nowTime = DateUtil.getCurrentDate();
            //支付完成超过15分钟
            return (nowTime.getTime() - payTime.getTime()) / (60 * 1000);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return 0;
    }
 
    public static double getAttrValueDouble(List<TempCarFeeConfigAttrDto> tempCarFeeConfigAttrDtos, String specCd) {
 
        for (TempCarFeeConfigAttrDto tempCarFeeConfigAttrDto : tempCarFeeConfigAttrDtos) {
            if (tempCarFeeConfigAttrDto.getSpecCd().equals(specCd)) {
                return Double.parseDouble(tempCarFeeConfigAttrDto.getValue());
            }
        }
 
        return 0.0;
    }
 
 
    public static String getAttrValueString(List<TempCarFeeConfigAttrDto> tempCarFeeConfigAttrDtos, String specCd) {
        for (TempCarFeeConfigAttrDto tempCarFeeConfigAttrDto : tempCarFeeConfigAttrDtos) {
            if (tempCarFeeConfigAttrDto.getSpecCd().equals(specCd)) {
                return tempCarFeeConfigAttrDto.getValue();
            }
        }
        return "";
    }
 
    public static int getAttrValueInt(List<TempCarFeeConfigAttrDto> tempCarFeeConfigAttrDtos, String specCd) {
        for (TempCarFeeConfigAttrDto tempCarFeeConfigAttrDto : tempCarFeeConfigAttrDtos) {
            if (tempCarFeeConfigAttrDto.getSpecCd().equals(specCd)) {
                return Integer.parseInt(tempCarFeeConfigAttrDto.getValue());
            }
        }
        return 0;
    }
}