Commit fa8471fb by xmh

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

1 parent ac310f68
......@@ -36,6 +36,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -363,7 +364,17 @@ public class PersonService {
p.setGender((String) source.get("gender"));
p.setChannelSerialNum((String) source.get("channelSerialNum"));
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.setPersonPoolId(item.getIndex());
persons.add(p);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!