package com.ssj.bean.weixin.story.bean;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.ssj.bean.common.framework.core.domain.BaseEntity;


/** 
 * @author  ZhangCaibao 
 * @version 2018年3月20日 下午5:01:42 
 * 类说明  古诗对应的练习题目
 */
@Entity
@Table(name = "tb_story_task_topic")
public class StoryTaskTopic extends BaseEntity{
    /**
	 * 
	 */
	private static final long serialVersionUID = 1581026404668058576L;
	/**
     * 古诗ID
     */
	private String storyTaskId;
	 /**
     * 古诗主题ID
     */
	private String storyId;
	/**
	 * 题目内容
	 */
	private String name;
	/**
	 * 答案选项
	 */
	private String opt;
	/**
	 * 答案
	 */
	private String answer;
	/**
	 * 解析
	 */
	private String resolve;
	/**
	 * 题目标签1记忆2文字3鉴赏4运用
	 */
	private Integer type;
	/**
	 * 创建时间
	 */
	private Date createTime;
	
	private List<String> optList = new ArrayList<String>();

	public String getStoryTaskId() {
		return storyTaskId;
	}

	public void setStoryTaskId(String storyTaskId) {
		this.storyTaskId = storyTaskId;
	}

	public String getStoryId() {
		return storyId;
	}

	public void setStoryId(String storyId) {
		this.storyId = storyId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getOpt() {
		return opt;
	}

	public void setOpt(String opt) {
		this.opt = opt;
	}

	public String getAnswer() {
		return answer;
	}

	public void setAnswer(String answer) {
		this.answer = answer;
	}

	public String getResolve() {
		return resolve;
	}

	public void setResolve(String resolve) {
		this.resolve = resolve;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	 @Transient
	public List<String> getOptList() {
		 if(optList!=null &&optList.size()>0){
			 return  optList;
		 }
		 if(opt!=null&&opt.length()>0){
			    String cut =	opt.substring(0,opt.indexOf("B"));
				String cut1 =	opt.substring(opt.indexOf("B"),opt.indexOf("C"));
				String cut2 =	opt.substring(opt.indexOf("C"),opt.indexOf("D"));
				String cut3 =	opt.substring(opt.indexOf("D"));
				optList.add(cut);
				optList.add(cut1);
				optList.add(cut2);
				optList.add(cut3);
		 }
		return optList;
	}

	public void setOptList(List<String> optList) {
		this.optList = optList;
	}
	
	
	
}
