yuan
3 天以前 7fc5bc0c6f92d65099397690128cbf218935972d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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);
    }
}