地质所 沉降监测网建设项目
chenhuan
2024-05-20 c6f79f5720c5d4a700b8b759a93393559409fd1c
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
package com.javaweb.geo.utils;
 
import com.javaweb.common.utils.DateUtils;
import com.javaweb.common.utils.NumberUtils;
import com.javaweb.geo.domain.HoleYantu;
 
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
 
public class ExceptionTimeUtils {
 
 
    private static String expLevel(List<HoleYantu> holeYantuList) {
        Double max = 0D;
        // 计数
        int count = 0;
        for (int i = 1; i < holeYantuList.size(); i++) {
            //计算速度
        }
        return "等级";
    }
 
 
    /**
     * 计算两条数据之间的速度  (depth2-depth1)/(satrt2-start)  m/h
     *
     * @param start  第一个对象的gps时间
     * @param depth1 第一个对象的endDepth
     * @param satrt2 第二个对象的gps时间
     * @param depth2 第二个对象的endDepth
     * @return
     */
    public static Double spead(Date start, Double depth1, Date satrt2, Double depth2) {
        if (depth1 == null || depth2 == null) {
            return null;
        }
        Double hour = hour(start, satrt2);
        if (hour == null ) {
            return null;
        }
        try{
            Double d = (depth2 - depth1) / hour;
            return NumberUtils.div(d ,1,2);
        }catch (Exception e){
            return null;
        }
 
    }
 
    private static Double hour(Date start, Date satrt2) {
        try {
            long a = (satrt2.getTime() - start.getTime()) / 1000;
            //计算小时数
            BigDecimal b = new BigDecimal((double) a / 3600);
 
            Double hour = b.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
            return hour;
        } catch (Exception e) {
            return null;
        }
    }
 
    public static void main(String[] args) {
        //2022-03-05 13:43:03    5.4
 
        //2022-03-05 14:05:11    6.5
 
//        Date date1 = DateUtils.parseDate("2022-03-05 13:43:03");
//        Date date2 = DateUtils.parseDate("2022-03-05 14:05:11");
//        Double spead = spead(date1,5.4d,date2,6.5d);
 
        String s1 = "000019";
        int a = Integer.parseInt(s1) + 1;
        System.out.println(a);
    }
}