package com.ruoyi.http.service.impl; import com.ruoyi.http.mapper.TqdianbiaoSyncLogMapper; import com.ruoyi.http.pojo.TqdianbiaoSyncLog; import com.ruoyi.http.service.TqdianbiaoSyncLogService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @Service @RequiredArgsConstructor public class TqdianbiaoSyncLogServiceImpl implements TqdianbiaoSyncLogService { private final TqdianbiaoSyncLogMapper syncLogMapper; @Override public void logSuccess(String syncType, String windowStart, String windowEnd, int recordCount) { TqdianbiaoSyncLog log = new TqdianbiaoSyncLog(); log.setSyncType(syncType); log.setWindowStart(windowStart); log.setWindowEnd(windowEnd); log.setStatus("success"); log.setRecordCount(recordCount); log.setApiCallCount(1); syncLogMapper.insert(log); } @Override public void logFailure(String syncType, String windowStart, String windowEnd, String errorMsg) { TqdianbiaoSyncLog log = new TqdianbiaoSyncLog(); log.setSyncType(syncType); log.setWindowStart(windowStart); log.setWindowEnd(windowEnd); log.setStatus("fail"); log.setRecordCount(0); log.setApiCallCount(1); log.setErrorMsg(errorMsg != null && errorMsg.length() > 500 ? errorMsg.substring(0, 500) : errorMsg); syncLogMapper.insert(log); } }