Commit cd6b5cda by xmh

修复一个错误,添加人员时如果没有传时间会导致空指针异常

1 parent fa8471fb
......@@ -182,7 +182,7 @@ public class PersonService {
IndexRequest indexRequest = new IndexRequest(poolId)
.source(XContentType.JSON, "personId", personId,
"data", feature, "fid", fid, "age", age, "gender", gender, "body_type", bodyType,
"counttime", Constant.DATE_FORMAT.get().format(counttime), "channelSerialNum", channelSerialNum);
"counttime", counttime == null ? null : Constant.DATE_FORMAT.get().format(counttime), "channelSerialNum", channelSerialNum);
bulkRequest.add(indexRequest);
}
}
......@@ -206,7 +206,7 @@ public class PersonService {
IndexRequest indexRequest = new IndexRequest(poolId)
.source(XContentType.JSON, "personId", personId,
"body", feature, "fid", fid, "age", age, "gender", gender, "body_type", bodyType,
"counttime", Constant.DATE_FORMAT.get().format(counttime), "channelSerialNum", channelSerialNum);
"counttime", counttime == null ? null : Constant.DATE_FORMAT.get().format(counttime), "channelSerialNum", channelSerialNum);
bulkRequest.add(indexRequest);
}
}
......@@ -364,7 +364,7 @@ public class PersonService {
p.setGender((String) source.get("gender"));
p.setChannelSerialNum((String) source.get("channelSerialNum"));
p.setBodyType((Integer) source.get("body_type"));
p.setCounttime(Optional.ofNullable((String) source.get("counttime"))
.map(x -> {
try {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!