# HotelKpiWconnectFteServiceImpl.java

    package cloud.wconnect.workperformance.service.hotelkpi.impl;

    import cloud.wconnect.commonlib.cons.BaseErrorCodeEnum;
    import cloud.wconnect.commonlib.cons.CommonErrorI18nConstant;
    import cloud.wconnect.commonlib.exception.BadRequestException;
    import cloud.wconnect.commonlib.util.I18nMessageUtils;
    import cloud.wconnect.commonlib.util.JsonUtils;
    import cloud.wconnect.workperformance.cons.hotelkpi.HotelKpiI18nConstant;
    import cloud.wconnect.workperformance.pojo.dto.hotelkpi.datasourceconfig.HotelKpiFteDataSourceDTO;
    import cloud.wconnect.workperformance.service.hotelkpi.IHotelKpiWconnectFteService;
    import com.baomidou.dynamic.datasource.annotation.DS;
    import com.fasterxml.jackson.databind.ObjectMapper;
    import jakarta.annotation.Resource;
    import org.apache.commons.lang3.StringUtils;
    import org.springframework.stereotype.Service;

    /**
     * <p>
     * Hotel KPI wconnect FTE 数据 服务类
     * </p>
     *
     * @author zc
     * @since 2025-01-13
     */
    @Service
    @DS("work_performance")
    public class HotelKpiWconnectFteServiceImpl implements IHotelKpiWconnectFteService {

        @Resource
        private ObjectMapper objectMapper;
        @Resource
        private I18nMessageUtils i18nMessageUtils;

        /**
         * 检查数据源配置
         *
         * @param dataSource 数据源
         * @author zc
         * @date 2025/1/13
         */
        @Override
        public void checkDataSourceConfig(String dataSource) {
            if (StringUtils.isBlank(dataSource)) {
                throw new BadRequestException(CommonErrorI18nConstant.CANNOT_EMPTY,
                        i18nMessageUtils.getErrorParamMapNeedTranslate(HotelKpiI18nConstant.DATA_SOURCE),
                        BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                        "The dataSource cannot be blank.");
            }
            try {
                JsonUtils.convertStringToObject(objectMapper, dataSource, HotelKpiFteDataSourceDTO.class);
            } catch (Exception e) {
                throw new BadRequestException(CommonErrorI18nConstant.FORMAT_ERROR,
                        i18nMessageUtils.getErrorParamMapNeedTranslate(HotelKpiI18nConstant.DATA_SOURCE),
                        BaseErrorCodeEnum.DATA_VALIDATION_ERROR.getCode(),
                        "The dataSource is wrong format, exception:" + e.getMessage());
            }
        }

    }