feat: There is no way the task exec
This commit is contained in:
@@ -2,11 +2,16 @@ package com.ydw.bat.wkflow.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description: TODO
|
||||
@@ -15,6 +20,49 @@ import java.util.Map;
|
||||
*/
|
||||
public class Utils {
|
||||
|
||||
public static int subDayNum(String endTime){
|
||||
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDate startDate = LocalDate.parse(new SimpleDateFormat("yyyy-MM-dd").format(new Date()),fmt);
|
||||
LocalDate endDate = LocalDate.parse(endTime,fmt);
|
||||
int days = (int) startDate.until(endDate, ChronoUnit.DAYS);
|
||||
return days;
|
||||
}
|
||||
|
||||
public static String interceptTime(String timeStr) {
|
||||
if (StringUtils.isNotBlank(timeStr)) {
|
||||
System.out.println(timeStr.length());
|
||||
if (timeStr.contains("T")) {
|
||||
DateTimeFormatter df20 = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ENGLISH);
|
||||
DateTimeFormatter df24 = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH);
|
||||
LocalDateTime ldt = LocalDateTime.parse(timeStr, timeStr.length() > 20 ? df24:df20);
|
||||
ZoneId currentZone = ZoneId.of("UTC");
|
||||
ZoneId newZone = ZoneId.of("Asia/Shanghai");
|
||||
timeStr = ldt.atZone(currentZone).withZoneSameInstant(newZone).toLocalDateTime().toString();
|
||||
}
|
||||
if (timeStr.length() >= 10) {
|
||||
return timeStr.substring(0, 10);
|
||||
}
|
||||
}
|
||||
return timeStr;
|
||||
}
|
||||
|
||||
public static String subDay(String date, Integer dayInt) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date today = null;
|
||||
try {
|
||||
today = sdf.parse(date);
|
||||
} catch (ParseException e) {
|
||||
}
|
||||
String endDate = sdf.format(today);//当前日期
|
||||
Calendar theCa = Calendar.getInstance();
|
||||
theCa.setTime(today);
|
||||
theCa.add(theCa.DATE, -dayInt);//最后一个数字30可改,30天的意思
|
||||
Date start = theCa.getTime();
|
||||
String startDate = sdf.format(start);//三十天之前日期
|
||||
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public static Map<String, JSONArray> jsonArrGroup(JSONArray arr, String groupName, String sGroupName) {
|
||||
Map<String, JSONArray> map = new HashMap<>();
|
||||
String tempIdStr = "";
|
||||
|
||||
Reference in New Issue
Block a user