IClearApiHsCodeLogService.java
1.73 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com.erry.iclear.dateInterface.service;
import com.erry.iclear.dateInterface.api.request.Basfc;
import com.erry.iclear.dateInterface.api.request.Mawb;
import com.erry.iclear.dateInterface.common.Constant;
import com.erry.iclear.dateInterface.entity.IClearApiHsCodeLog;
import com.erry.iclear.dateInterface.entity.IClearApiLog;
import com.erry.iclear.dateInterface.repository.IClearApiHsCodeLogRepository;
import com.erry.iclear.dateInterface.repository.IClearApiLogRepository;
import com.erry.iclear.dateInterface.util.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
*
* hscode请求日志
* mt
* 2022年2月15日15:46:18
*/
@Service
@Slf4j
public class IClearApiHsCodeLogService {
@Autowired
private IClearApiHsCodeLogRepository iClearApiHsCodeLogRepository;
/**
* 保存日志
* @param iClearApiHsCodeLog
*/
public IClearApiHsCodeLog saveIClearApiHsCodeLog(IClearApiHsCodeLog iClearApiHsCodeLog){
try{
return iClearApiHsCodeLogRepository.save(iClearApiHsCodeLog);
}catch (Exception e){
log.error("IClearApiHsCodeLog() error:"+ e.getMessage());
}
return null;
}
/**
* 查询日志,最近10分钟如果有查询过全量hscode则返回true
* @return
*/
public boolean findIClearApiHsCodeLog(){
boolean rs = false;
try{
Long count = iClearApiHsCodeLogRepository.findIClearApiHsCodeLog(DateUtils.getAfter10());
if(count > 0){
rs = true;
}
}catch(Exception ex){
ex.printStackTrace();
}
return rs;
}
}