# M3AccountSyncLogServiceImpl.java

    package cloud.wconnect.finance.service.pl.impl;

    import cloud.wconnect.commonlib.util.DateTimeUtils;
    import cloud.wconnect.finance.entity.pl.M3AccountSyncLog;
    import cloud.wconnect.finance.mapper.pl.M3AccountSyncLogMapper;
    import cloud.wconnect.finance.service.pl.IM3AccountSyncLogService;
    import com.baomidou.dynamic.datasource.annotation.DS;
    import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
    import com.baomidou.mybatisplus.core.mapper.BaseMapper;
    import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;

    import java.util.Objects;

    /**
     * <p>
     * 服务实现类
     * </p>
     *
     * @author lichen
     * @since 2025-09-25
     */
    @Service
    @DS("finance")
    public class M3AccountSyncLogServiceImpl extends ServiceImpl<M3AccountSyncLogMapper, M3AccountSyncLog> implements IM3AccountSyncLogService {

        /**
         * 更新资产M3 Account同步时间
         *
         * @param tenantId   租户id
         * @param propertyId 资产id
         * @return void
         * @author lichen
         * @date 2025/9/26
         */
        @Override
        public void updateSyncTime(Integer tenantId, int propertyId) {
            baseMapper.saveOrUpdateByUniqueKey(tenantId, propertyId, DateTimeUtils.nowTimestamp());
        }

        /**
         * 获取资产M3 Account同步时间
         *
         * @param propertyId 资产id
         * @return java.lang.Long
         * @author lichen
         * @date 2025/9/29
         */
        @Override
        public Long getLastSyncTime(int propertyId) {
            M3AccountSyncLog m3AccountSyncLog = getOne(new LambdaQueryWrapper<M3AccountSyncLog>().eq(M3AccountSyncLog::getPropertyId, propertyId));
            if (Objects.nonNull(m3AccountSyncLog)) return m3AccountSyncLog.getLastSyncTime();
            return null;
        }
    }