PREPAREMASTERController.java
2.2 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
package com.tianbo.analysis.controller;
import com.github.pagehelper.PageInfo;
import com.tianbo.analysis.dao.PREPAREMASTERMapper;
import com.tianbo.analysis.model.PREPAREMASTER;
import com.tianbo.analysis.model.ResultJson;
import com.tianbo.analysis.service.PREPARMASTERService;
import com.tianbo.util.Date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Date;
@Slf4j
@RestController
@RequestMapping("/premaster/")
public class PREPAREMASTERController {
@Autowired
PREPARMASTERService preparmasterService;
@RequestMapping("search")
public ResultJson search(@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "limit",defaultValue = "10") int limit,
@RequestParam(value = "flightNo",required = false) String flightNo,
@RequestParam(value = "flightDate",required = false) String flightDate,
@RequestParam(value = "waybillnomaster",required = false) String waybillnomaster,
@RequestParam(value = "customsCode",required = false) String customsCode
){
PREPAREMASTER preparemaster = new PREPAREMASTER();
preparemaster.setWaybillnomaster(waybillnomaster);
preparemaster.setCustomscode(customsCode);
if(StringUtils.isNotEmpty(flightNo)){
preparemaster.setFlightno(flightNo.substring(2));
preparemaster.setCarrier(flightNo.substring(0,2));
}
if(StringUtils.isNotEmpty(flightDate)){
Date flight_Date = DateUtil.parseDate(flightDate,"yyyyMMdd");
preparemaster.setFlightdate(flight_Date);
}
PageInfo<PREPAREMASTER> pageInfo= preparmasterService.search(preparemaster,page,limit);
return new ResultJson("200","OK",pageInfo);
}
}