TTInfoDetailService.java 5.25 KB
package com.bsth.service.schedule;

import com.bsth.entity.schedule.TTInfoDetail;
import com.bsth.service.schedule.exception.ScheduleException;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by xu on 16/7/2.
 */
public interface TTInfoDetailService extends BService<TTInfoDetail, Long> {

    /**
     * 发车信息内部类。
     */
    public static class FcInfo {
        /** 时刻明细id */
        private Long ttdid;
        /** 发车时间 */
        private String fcsj;
        /** 班次类型 */
        private String bc_type;
        /** 线路上下行 */
        private String xldir;
        /** 是偶分班 */
        private Boolean isfb;

        /** 起点站 */
        private Integer qdz;
        /** 终点站 */
        private Integer zdz;
        /** 停车场 */
        private Integer tcc;

        public FcInfo() {
        }

        public FcInfo(
                String ttdid_str,
                String bc_type,
                String fcsj,
                String xldir,
                String isfb,
                String qdz,
                String zdz,
                String tcc) {
            this.ttdid = StringUtils.isEmpty(ttdid_str) ? null : Long.valueOf(ttdid_str);
            this.bc_type = bc_type;
            this.fcsj = fcsj;
            this.xldir = xldir;
            if ("N".equals(isfb))
                this.isfb = false;
            else if ("Y".equals(isfb) || "true".equals(isfb))
                this.isfb = true;
            else
                this.isfb = false;

            if (StringUtils.isNotEmpty(qdz) && !"null".equals(qdz)) {
                this.qdz = Integer.valueOf(qdz);
            }
            if (StringUtils.isNotEmpty(zdz) && !"null".equals(zdz)) {
                this.zdz = Integer.valueOf(zdz);
            }
            if (StringUtils.isNotEmpty(tcc) && !"null".equals(tcc)) {
                this.tcc = Integer.valueOf(tcc);
            }

        }

        public Long getTtdid() {
            return ttdid;
        }

        public void setTtdid(Long ttdid) {
            this.ttdid = ttdid;
        }

        public String getFcsj() {
            return fcsj;
        }

        public void setFcsj(String fcsj) {
            this.fcsj = fcsj;
        }

        public String getBc_type() {
            return bc_type;
        }

        public void setBc_type(String bc_type) {
            this.bc_type = bc_type;
        }

        public String getXldir() {
            return xldir;
        }

        public void setXldir(String xldir) {
            this.xldir = xldir;
        }

        public Boolean getIsfb() {
            return isfb;
        }

        public void setIsfb(Boolean isfb) {
            this.isfb = isfb;
        }

        public Integer getQdz() {
            return qdz;
        }

        public void setQdz(Integer qdz) {
            this.qdz = qdz;
        }

        public Integer getZdz() {
            return zdz;
        }

        public void setZdz(Integer zdz) {
            this.zdz = zdz;
        }

        public Integer getTcc() {
            return tcc;
        }

        public void setTcc(Integer tcc) {
            this.tcc = tcc;
        }
    }

    /**
     * 时刻表编辑用的返回数据。
     */
    public static class EditInfo {
        /** 标题数据 */
        private List<String> header = new ArrayList<>();
        /** 内容数据 */
        private List<List<FcInfo>> contents = new ArrayList<>();

        /** 营运描述 */
        private String yy_desc;

        public List<String> getHeader() {
            return header;
        }

        public void setHeader(List<String> header) {
            this.header = header;
        }

        public List<List<FcInfo>> getContents() {
            return contents;
        }

        public void setContents(List<List<FcInfo>> contents) {
            this.contents = contents;
        }

        public String getYy_desc() {
            return yy_desc;
        }

        public void setYy_desc(String yy_desc) {
            this.yy_desc = yy_desc;
        }
    }

    /**
     * 获取待编辑的数据。
     * @param xlid 线路id
     * @param ttid 时刻表id
     * @return
     */
    EditInfo getEditInfo(Integer xlid, Long ttid) throws ScheduleException;

    /**
     * 验证sheet(以后放到规则引擎里去做)。
     * @param filename excel文件全路径名
     * @param sheetname sheet名字
     * @param lineid 线路id
     */
    void validateExcelSheet(
            String filename,
            String sheetname,
            Integer lineid,
            String linename) throws ScheduleException;

    /**
     * 验证关联的线路标准信息(以后放到规则引擎里去做)。
     * @param lineinfoid 线路id
     */
    void validateAssoLineInfo(Integer lineinfoid) throws ScheduleException;

    // TODO:这个方法可以用通用方法解决,以后改
    List<TTInfoDetail> findBcdetails(Integer xlId, Long ttinfoId, Long lpId);

    Map<String, Object> skbDetailMxSave(Map<String, Object> map);
}