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);
|
}
|
}
|