时间格式转换
continuous-integration/drone/push Build is passing Details

于相涌/mail
YXY 2 years ago
parent 6ec0e9ce29
commit a7bdc61546

@ -20,10 +20,9 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
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.util.*;
/**
@ -210,13 +209,24 @@ public class ApprovalCallbackOperate extends LarkAbstract {
} else if (k.startsWith("#")) {
k = k.replace("#", "");
record = record.getJSONObject(k);
} else {
} else if (k.endsWith("${time}")){
String time = record.getString(k.replace("${time}", "").trim());
if (time.contains("T")){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
return sdf.parse(time.replace("T", " ").substring(0, time.indexOf("+"))).getTime();
} catch (ParseException e) {
throw new RuntimeException(e.getMessage());
}
}
}else {
break;
}
}
return record.getString(split[index].trim());
}
protected void send(RequestVo request) {
Map<String, Object> body = getBody(request);
request.setOperateInfo(String.valueOf(body));

Loading…
Cancel
Save