|
@ -1,19 +1,56 @@ |
|
|
package com.bzgame.server.luigi.service.bo.response; |
|
|
package com.bzgame.server.luigi.service.bo.response; |
|
|
|
|
|
|
|
|
import com.bzgame.server.luigi.dao.domain.Poem; |
|
|
import com.bzgame.server.luigi.dao.domain.Poem; |
|
|
|
|
|
import com.google.gson.Gson; |
|
|
|
|
|
import com.google.gson.reflect.TypeToken; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @author nidaren |
|
|
* @author nidaren |
|
|
*/ |
|
|
*/ |
|
|
public class PoemBo extends Poem { |
|
|
public class PoemBo extends Poem { |
|
|
private String authorName; |
|
|
private String authorName; |
|
|
|
|
|
private List<Note> noteList; |
|
|
|
|
|
|
|
|
public PoemBo() { |
|
|
public PoemBo() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public PoemBo(Poem p) { |
|
|
public PoemBo(Poem p) { |
|
|
BeanUtils.copyProperties(p, this); |
|
|
BeanUtils.copyProperties(p, this); |
|
|
|
|
|
if (!StringUtils.hasText(p.getNote())) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
Gson g = new Gson(); |
|
|
|
|
|
try { |
|
|
|
|
|
noteList = g.fromJson(p.getNote(), new TypeToken<List<Note>>() { |
|
|
|
|
|
}.getType()); |
|
|
|
|
|
} catch (Exception ignored) { |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static class Note { |
|
|
|
|
|
private String citation; |
|
|
|
|
|
private String annotation; |
|
|
|
|
|
|
|
|
|
|
|
public String getCitation() { |
|
|
|
|
|
return citation; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setCitation(String citation) { |
|
|
|
|
|
this.citation = citation; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String getAnnotation() { |
|
|
|
|
|
return annotation; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setAnnotation(String annotation) { |
|
|
|
|
|
this.annotation = annotation; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public String getAuthorName() { |
|
|
public String getAuthorName() { |
|
@ -23,4 +60,22 @@ public class PoemBo extends Poem { |
|
|
public void setAuthorName(String authorName) { |
|
|
public void setAuthorName(String authorName) { |
|
|
this.authorName = authorName; |
|
|
this.authorName = authorName; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<Note> getNoteList() { |
|
|
|
|
|
if (noteList == null && StringUtils.hasText(getNote())) { |
|
|
|
|
|
Gson g = new Gson(); |
|
|
|
|
|
try { |
|
|
|
|
|
noteList = g.fromJson(getNote(), new TypeToken<List<Note>>() { |
|
|
|
|
|
}.getType()); |
|
|
|
|
|
} catch (Exception ignored) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
return noteList; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setNoteList(List<Note> noteList) { |
|
|
|
|
|
this.noteList = noteList; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|