package com.mortals.xhx.module.matter.web;

import com.mortals.framework.model.Context;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.MatterSourceEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.Constant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.xhx.module.matter.model.MatterDatumEntity;
import com.mortals.xhx.module.matter.service.MatterDatumService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;


/**
* <p>Title: 事项申请材料</p>
* <p>Description: MatterDatumController  </p>
* <p>Copyright: Copyright &reg;  </p>
* <p>Company: </p>
* @author zxfei
* @version 1.0.0
*/
@RestController
@RequestMapping("matter/datum")
public class MatterDatumController extends BaseCRUDJsonMappingController<MatterDatumService,MatterDatumForm,MatterDatumEntity,Long> {

    @Autowired
    private ParamService paramService;
    public MatterDatumController(){
        super.setFormClass(MatterDatumForm.class);
        super.setModuleDesc("事项申请材料");
    }


    @Override
    protected void init(HttpServletRequest request, HttpServletResponse response, MatterDatumForm form, Map<String, Object> model, Context context) {

        this.addDict(model, "isMust", paramService.getParamByFirstOrganize(Constant.Param_isMust));
        this.addDict(model, "iszzsb", YesNoEnum.getEnumMap());
        this.addDict(model, "isjianm", YesNoEnum.getEnumMap());
        this.addDict(model, "isLack", YesNoEnum.getEnumMap());
        this.addDict(model, "materialProperty", paramService.getParamByFirstOrganize(Constant.Param_materialProperty));
        this.addDict(model, "materialType", paramService.getParamByFirstOrganize(Constant.Param_materialType));
        this.addDict(model, "electronicgs", paramService.getParamByFirstOrganize(Constant.Param_electronicgs));
        this.addDict(model, "materialSource", paramService.getParamByFirstOrganize(Constant.Param_materialSource));
        this.addDict(model, "paperGg", paramService.getParamByFirstOrganize(Constant.Param_paperGg));
        this.addDict(model, "jianmMs", paramService.getParamByFirstOrganize(Constant.Param_jianmMs));
        this.addDict(model, "sealWay", paramService.getParamByFirstOrganize(Constant.Param_sealWay));

        this.addDict(model, "source", MatterSourceEnum.getEnumMap());
        super.init(request, response, form, model, context);
    }
}