HsCodeInterface.java
1.7 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
package com.erry.iclear.dateInterface.api;
import com.erry.iclear.dateInterface.api.request.HsCodeParam;
import com.erry.iclear.dateInterface.api.response.ResultHsCode;
import com.erry.iclear.dateInterface.service.HsCodeService;
import com.erry.iclear.dateInterface.util.StringUtil;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
* @author Administrator
*/
@RestController
@RequestMapping("/hscode")
@Slf4j
public class HsCodeInterface {
@Autowired
HsCodeService hsCodeService;
@ApiOperation(value = "接收HsCode临时数据", httpMethod = "POST", notes = "ex: http://192.168.1.71:8080/hscode/hscodeRequest")
@PostMapping("/hscodeRequest")
@ResponseBody
public ResultHsCode hscodeRequest(HttpServletRequest request
, @RequestBody HsCodeParam hscode) {
log.info("接收到请求数据hscode:【"+hscode.getHscode()+"】");
String appId = (String) request.getHeader("Appid");
String appkey = (String) request.getHeader("Appkey");
String timeStamp = (String) request.getHeader("TimeStamp");
String token = (String) request.getHeader("token");
if(!StringUtil.isEmpty(hscode.getHscode())){
ResultHsCode resultHsCode = hsCodeService.findHsCodeListByCode(hscode.getHscode());
return resultHsCode;
}else{
//如果没有传hscode需要限制10分钟只能只能查询一次
ResultHsCode resultHsCode = hsCodeService.findAllHsCodeList();
return resultHsCode;
}
}
}