处理空指针
This commit is contained in:
@@ -140,6 +140,9 @@ public class TmOdsImRealtimeMessageCurServiceImpl extends ServiceImpl<TmOdsImRea
|
||||
// 组装语料信息
|
||||
StringBuffer chatList = new StringBuffer();
|
||||
contetnList.forEach(contentItem -> {
|
||||
if (item.getMsgTimestamp() == null) {
|
||||
item.setMsgTimestamp(endTime);
|
||||
}
|
||||
String title = "";
|
||||
if(ImCustomTypeEnums.CUSTOMER.getCode().equals(contentItem.getCustomerType())){
|
||||
title="客户:";
|
||||
@@ -158,7 +161,7 @@ public class TmOdsImRealtimeMessageCurServiceImpl extends ServiceImpl<TmOdsImRea
|
||||
inputMap.put("chat", chatList.toString());
|
||||
inputMap.put("businessType", BusinessTypeEnum.IM_CORPUS_ANALYSIS.getCode());
|
||||
inputMap.put("sourceCorpusId", item.getSessionId());
|
||||
inputMap.put("sourceCorpusTime", timeStampToLocalDateTime(item.getMsgTimestamp(), formatter));
|
||||
inputMap.put("sourceCorpusTime", item.getMsgTimestamp() != null ? timeStampToLocalDateTime(item.getMsgTimestamp(), formatter) : null);
|
||||
|
||||
DiFyReq diFyImageReq = new DiFyReq();
|
||||
diFyImageReq.setUser(ConstantStr.corpus_user);
|
||||
@@ -194,6 +197,9 @@ public class TmOdsImRealtimeMessageCurServiceImpl extends ServiceImpl<TmOdsImRea
|
||||
* @return
|
||||
*/
|
||||
private Long stringTimeToTimeStamp(String stringTime, DateTimeFormatter formatter) {
|
||||
if (StringUtils.isBlank(stringTime)) {
|
||||
return null;
|
||||
}
|
||||
LocalDateTime localDateTime = LocalDateTime.parse(stringTime, formatter);
|
||||
|
||||
// 转换为秒级时间戳
|
||||
@@ -207,6 +213,9 @@ public class TmOdsImRealtimeMessageCurServiceImpl extends ServiceImpl<TmOdsImRea
|
||||
* @return
|
||||
*/
|
||||
private String timeStampToLocalDateTime(Long timeStamp, DateTimeFormatter formatter) {
|
||||
if (timeStamp == null) {
|
||||
return null;
|
||||
}
|
||||
Instant instant = Instant.ofEpochSecond(timeStamp);
|
||||
LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
|
||||
return localDateTime.format(formatter);
|
||||
|
||||
Reference in New Issue
Block a user