class AlertDefineAbstractImExportServiceImpl implements AlertDefineImExportService {
    @Resource
    @Lazy
    private AlertDefineService alertDefineService;

    @Override
    public void importConfig(InputStream is) {<FILL_FUNCTION_BODY>}

    @Override
    public void exportConfig(OutputStream os, List<Long> configList) {
        var monitorList = configList.stream()
                .map(it -> alertDefineService.getAlertDefine(it))
                .map(this::convert)
                .collect(Collectors.toUnmodifiableList());
        writeOs(monitorList, os);
    }


    /**
     * Parsing an input stream into a form
     *
     * @param is input stream
     * @return form list
     */
    abstract List<ExportAlertDefineDTO> parseImport(InputStream is);

    /**
     * Export Configuration to Output Stream
     * @param exportAlertDefineList configuration list
     * @param os          output stream
     */
    abstract void writeOs(List<ExportAlertDefineDTO> exportAlertDefineList, OutputStream os);


    private ExportAlertDefineDTO convert(AlertDefine alertDefine) {
        var exportAlertDefine = new ExportAlertDefineDTO();
        var alertDefineDTO = new AlertDefineDTO();
        BeanUtils.copyProperties(alertDefine, alertDefineDTO);
        exportAlertDefine.setAlertDefine(alertDefineDTO);
        return exportAlertDefine;
    }

    private AlertDefine convert(ExportAlertDefineDTO exportAlertDefineDTO) {
        var alertDefine = new AlertDefine();
        var alertDefineDTO = exportAlertDefineDTO.getAlertDefine();
        BeanUtils.copyProperties(alertDefineDTO, alertDefine);
        return alertDefine;
    }

    protected String fileNamePrefix() {
        return "hertzbeat_alertDefine_" + LocalDate.now();
    }

    /**
     * Export data transfer objects for alert configurations
     */
    @Data
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonIgnoreProperties(ignoreUnknown = true)
    @ExcelTarget(value = "ExportAlertDefineDTO")
    protected static class ExportAlertDefineDTO {
        @Excel(name = "AlertDefine")
        private AlertDefineDTO alertDefine;
    }

    /**
     * Data transfer object for alert configuration
     */
    @Data
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonIgnoreProperties(ignoreUnknown = true)
    @ExcelTarget(value = "AlertDefineDTO")
    protected static class AlertDefineDTO {
        @Excel(name = "App")
        private String app;
        @Excel(name = "Metric")
        private String metric;
        @Excel(name = "Field")
        private String field;
        @Excel(name = "Preset")
        private Boolean preset;
        @Excel(name = "Expr")
        private String expr;
        @Excel(name = "Priority")
        private Byte priority;
        @Excel(name = "Times")
        private Integer times;
        @Excel(name = "Tags")
        private List<TagItem> tags;
        @Excel(name = "Enable")
        private Boolean enable;
        @Excel(name = "RecoverNotice")
        private Boolean recoverNotice;
        @Excel(name = "Template")
        private String template;
    }
}

        var formList = parseImport(is)
                .stream()
                .map(this::convert)
                .collect(Collectors.toUnmodifiableList());
        if (!CollectionUtils.isEmpty(formList)) {
            formList.forEach(alertDefine -> {
                alertDefineService.validate(alertDefine, false);
                alertDefineService.addAlertDefine(alertDefine);
            });
        }
    
<no_super_class>