日期时间转换

SimpleDateFormat

//会议日期.value[0]是long型的时间戳,如 1591234574420l
日期=new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date(会议日期.value[0])).toString()
//System.out.println(日期); //2020-06-04T09:36:14.000+0800

java8 LocalDateTime

//会议日期.value[0]是long型的时间戳,如 1591234574420l
long ts = (long) ( 会议日期.value[0]/ 1000);
java.time.LocalDateTime 日期1 = java.time.LocalDateTime.ofEpochSecond(ts, 0, java.time.ZoneOffset.ofHours(8));
java.time.ZonedDateTime zd = java.time.ZonedDateTime.of(日期1, java.time.ZoneId.of("Asia/Shanghai"));
String 日期 = zd.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ"));
//System.out.println(日期); //2020-06-04T09:36:14.000+0800

解析时间槽位的时分秒

//解析时间槽位的时分秒
system_时间.H
system_时间.M
system_时间.S

接口调用

方法 1 NetUtil.getResponseForGet

//中文需要编码
query = "q="+ URLEncoder.encode(sentence);
jsonStrRes=com.rsvp.api.util.NetUtil.getResponseForGet("https://dev-env.rsvp.ai/docs/logistic.json?"+query);
jsonObj=com.alibaba.fastjson.JSONObject.parseObject(jsonStrRes);
//jsonObj.getString("address")

方法 2 ApiForTDE

//设置接口URL
api = new com.rsvp.context.util.ApiForTDE("https://dev-env.rsvp.ai/test/meetingroom-new/add");
//设置请求参数
api.callApi("date", 日期, "end", 结束, "begin", 开始, "amount", 人数, "topic", 主题, "uid", 用户);
//获取返回结果里的字段(返回结果是json)
message = api.getVariable("message");

正则表达式

NumberMatcher=/([Ee]\d{20,26})/
def numMatcherResult = sentence =~ NumberMatcher
if (numMatcherResult.find()) {
单号=numMatcherResult.group(0)
}

json 组织

actions =new com.alibaba.fastjson.JSONArray();
action = new com.alibaba.fastjson.JSONObject();
action.put('action', 'actionName')
action.put('target', 'targetId')
action.put('finish', true)
actions.add(actionx)