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

import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.framework.config.InterceptorConfig;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.base.service.BaseAreaService;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.service.MatterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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

/**
 * 基础事项
 *
 * @author zxfei
 * @date 2022-01-20
 */
@RestController
@RequestMapping("matter")
public class MatterController extends BaseCRUDJsonBodyMappingController<MatterService, MatterEntity, Long> {

    @Autowired
    private ParamService paramService;
    @Autowired
    private InterceptorConfig interceptorConfig;
    @Autowired
    private MatterService matterService;
    @Autowired
    private BaseAreaService baseAreaService;

    public MatterController() {
        super.setModuleDesc("基础事项");
    }

    /**
     * @param query
     * @param model
     * @param context
     * @throws AppException
     */
    @Override
    protected void doListBefore(MatterEntity query, Map<String, Object> model, Context context) throws AppException {
        if (ObjectUtils.isEmpty(query.getEventTypeShowNotList())) {
            ArrayList<String> notList = new ArrayList<>();
            notList.add("行政处罚");
            query.setEventTypeShowNotList(notList);
        }

        super.doListBefore(query, model, context);
    }

    @Override
    protected void init(Map<String, Object> model, Context context) {
        this.addDict(model, "appoveObjectShow", paramService.getParamBySecondOrganize("Matter", "appoveObjectShow"));
        this.addDict(model, "operatScopeShow", paramService.getParamBySecondOrganize("Matter", "operatScopeShow"));
        this.addDict(model, "appoveTimeLimitShow", paramService.getParamBySecondOrganize("Matter", "appoveTimeLimitShow"));
        this.addDict(model, "handleType", paramService.getParamBySecondOrganize("Matter", "handleType"));
        this.addDict(model, "isChargesShow", paramService.getParamBySecondOrganize("Matter", "isChargesShow"));
        this.addDict(model, "certificationLevelsShow", paramService.getParamBySecondOrganize("Matter", "certificationLevelsShow"));
        this.addDict(model, "windowToTheSceneNum", paramService.getParamBySecondOrganize("Matter", "windowToTheSceneNum"));
        this.addDict(model, "isOnlineSubscribeShow", paramService.getParamBySecondOrganize("Matter", "isOnlineSubscribeShow"));
        this.addDict(model, "isExpressTakeShow", paramService.getParamBySecondOrganize("Matter", "isExpressTakeShow"));
        this.addDict(model, "isProvinceAcquisitionShow", paramService.getParamBySecondOrganize("Matter", "isProvinceAcquisitionShow"));
        this.addDict(model, "isApplyProvinceShow", paramService.getParamBySecondOrganize("Matter", "isApplyProvinceShow"));
        this.addDict(model, "onlineType", paramService.getParamBySecondOrganize("Matter", "onlineType"));
        this.addDict(model, "onlineToTheSceneNum", paramService.getParamBySecondOrganize("Matter", "onlineToTheSceneNum"));
        this.addDict(model, "onlineOperatDeep", paramService.getParamBySecondOrganize("Matter", "onlineOperatDeep"));
        this.addDict(model, "isExpressTakeOnlineShow", paramService.getParamBySecondOrganize("Matter", "isExpressTakeOnlineShow"));
        this.addDict(model, "isDoorTakeShow", paramService.getParamBySecondOrganize("Matter", "isDoorTakeShow"));
        this.addDict(model, "eventTypeShow", paramService.getParamBySecondOrganize("Matter", "eventTypeShow"));
        this.addDict(model, "performHierarchyShow", paramService.getParamBySecondOrganize("Matter", "performHierarchyShow"));
        this.addDict(model, "powerSourceShow", paramService.getParamBySecondOrganize("Matter", "powerSourceShow"));
        this.addDict(model, "performDeptTypeShow", paramService.getParamBySecondOrganize("Matter", "performDeptTypeShow"));
        this.addDict(model, "goveServiceCenterShow", paramService.getParamBySecondOrganize("Matter", "goveServiceCenterShow"));
        this.addDict(model, "isConvenientCenterShow", paramService.getParamBySecondOrganize("Matter", "isConvenientCenterShow"));
        this.addDict(model, "terminalHandle", paramService.getParamBySecondOrganize("Matter", "terminalHandle"));
        this.addDict(model, "isOnline", paramService.getParamBySecondOrganize("Matter", "isOnline"));
        this.addDict(model, "isOnlinePayShow", paramService.getParamBySecondOrganize("Matter", "isOnlinePayShow"));
        this.addDict(model, "entrustmentDepartmen", paramService.getParamBySecondOrganize("Matter", "entrustmentDepartmen"));
        this.addDict(model, "matterStatus", paramService.getParamBySecondOrganize("Matter", "matterStatus"));
        this.addDict(model, "type", paramService.getParamBySecondOrganize("Matter", "type"));
        this.addDict(model, "mattertype", paramService.getParamBySecondOrganize("Matter", "mattertype"));
        this.addDict(model, "eventType", paramService.getParamBySecondOrganize("Matter", "eventType"));
        this.addDict(model, "parson", paramService.getParamBySecondOrganize("Matter", "parson"));
        this.addDict(model, "lengal", paramService.getParamBySecondOrganize("Matter", "lengal"));
        this.addDict(model, "source", paramService.getParamBySecondOrganize("Matter", "source"));

        super.init(model, context);
    }


}