# RevenueAdrConfigServiceImpl.java

    package cloud.wconnect.rateshop.service.revenue.impl;

    import cloud.wconnect.commonlib.util.DateTimeUtils;
    import cloud.wconnect.rateshop.entity.revenue.RevenueAdrConfig;
    import cloud.wconnect.rateshop.mapper.revenue.RevenueAdrConfigMapper;
    import cloud.wconnect.rateshop.pojo.dto.revenue.AdrConfigDTO;
    import cloud.wconnect.rateshop.service.revenue.IRevenueAdrConfigService;
    import com.baomidou.dynamic.datasource.annotation.DS;
    import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
    import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
    import org.springframework.stereotype.Service;

    /**
     * <p>
     * adr 配置，导入报告时，根据当前配置规则来计算 adr 服务实现类
     * </p>
     *
     * @author yyt
     * @since 2023-10-26
     */
    @Service
    @DS("rate_shop")
    public class RevenueAdrConfigServiceImpl extends ServiceImpl<RevenueAdrConfigMapper, RevenueAdrConfig> implements IRevenueAdrConfigService {

        /**
         * 保存 adr 配置
         *
         * @param propertyId   资产 id
         * @param adrConfigDTO adr 配置
         * @param userId       操作人
         * @return
         * @author yyt
         * @date 2023/10/28
         */
        @Override
        public void save(Integer propertyId, AdrConfigDTO adrConfigDTO, int userId) {
            baseMapper.saveOrUpdate(new RevenueAdrConfig().setPropertyId(propertyId)
                    .setCheckTransientDeduct(adrConfigDTO.getCheckTransientDeduct())
                    .setCheckTransientNonDeduct(adrConfigDTO.getCheckTransientNonDeduct())
                    .setCheckGroupDeduct(adrConfigDTO.getCheckGroupDeduct())
                    .setCheckGroupNonDeduct(adrConfigDTO.getCheckGroupNonDeduct())
                    .setUpdatedBy(userId).setUpdatedTime(DateTimeUtils.nowTimestamp()));
        }

        /**
         * 获取 adr 配置规则
         *
         * @param propertyId 资产 id
         * @return adr 配置规则
         * @author yyt
         * @date 2023/10/30
         */
        @Override
        public RevenueAdrConfig get(Integer propertyId) {
            return getOne(new QueryWrapper<RevenueAdrConfig>().lambda().eq(RevenueAdrConfig::getPropertyId, propertyId));
        }

    }