package core.process;

import core.operation.FillInformation;
import error.GExcptInit;
import gdms.Configuration;

import java.text.SimpleDateFormat;
import java.util.*;

public class C_MentorFillReview extends C_FillInformation {

    public String  graduationDesignId;
    public Map<String,String> vMap;
    private static String buttonName ="指导老师评阅";
    private static String targetURL="/home/mentor-fill-review";
    private static String iconURL="../cssFile/images/fill.png";
    private static String info = "";

    private static String table="graduation_design_finished_product_mentor_score";
    private static String fileds="finished_product_mentor_score_status";

    public void teacherTeamFillOpeningReportOpinion() throws Exception{
        if(!check()) throw new GExcptInit("MentorFillReview Attrs init error!");
        FillInformation fillInformation=new FillInformation();
        fillInformation.setOptions(new HashMap<>());
        fillInformation.addOptions("table",table);
        String date= Configuration.dateFormat.format(new Date());
        vMap.put("review_opinion_date",date);
        Map<String, String>limits = new HashMap<>();
        limits.put("id",this.getGraduationDesignId());
        fillInformation.addOptions("limits",limits);
        fillInformation.execute(null);
        updateStatus();
    }

    @Override
    protected boolean check() {
        if(this.getGraduationDesignId()==null||this.getVMap()==null)
        return false;
        else
            return true;
    }
    public String getGraduationDesignId() {
        return graduationDesignId;
    }

    public void setGraduationDesignId(String graduationDesignId) {
        this.graduationDesignId = graduationDesignId;
    }
    public void setVMap(Map<String, String> vMap) {
        this.vMap = vMap;
    }
    public Map<String, String> getVMap() {
        return vMap;
    }

    @Override
    public String getInfo() {
        return info;
    }

    @Override
    public String getTargetURL() {
        return targetURL;
    }

    @Override
    public String getIconURL() {
        return iconURL;
    }

    @Override
    public String getButtonName() {
        return buttonName;
    }

    public List<String> getInputName() {
        List<String> ls = new ArrayList<>();
        ls.add("review_opinion");
        ls.add("total_grade");
        return ls;
    }
}

