Commit fa8471fb by xmh

修复当返回值没有counttime时的报错

1 parent ac310f68
...@@ -36,6 +36,7 @@ import org.springframework.stereotype.Service; ...@@ -36,6 +36,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -363,7 +364,17 @@ public class PersonService { ...@@ -363,7 +364,17 @@ public class PersonService {
p.setGender((String) source.get("gender")); p.setGender((String) source.get("gender"));
p.setChannelSerialNum((String) source.get("channelSerialNum")); p.setChannelSerialNum((String) source.get("channelSerialNum"));
p.setBodyType((Integer) source.get("body_type")); p.setBodyType((Integer) source.get("body_type"));
p.setCounttime(Constant.DATE_FORMAT.get().parse((String) source.get("counttime")));
p.setCounttime(Optional.ofNullable((String) source.get("counttime"))
.map(x -> {
try {
return Constant.DATE_FORMAT.get().parse(x);
} catch (ParseException ignore) {
}
return null;
})
.orElse(null));
p.setScore((int) item.getScore()); p.setScore((int) item.getScore());
p.setPersonPoolId(item.getIndex()); p.setPersonPoolId(item.getIndex());
persons.add(p); persons.add(p);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!