PREPAREMASTERController.java
3.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package com.tianbo.analysis.controller;
import com.github.pagehelper.PageInfo;
import com.tianbo.analysis.dao.PREPAREMASTERMapper;
import com.tianbo.analysis.model.BatchSend;
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.*;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@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);
}
@PostMapping("batchDel")
public ResultJson batchDel(@RequestBody BatchSend batchSend,@CookieValue("username") String username,@CookieValue("userid") String userid){
if (StringUtils.isEmpty(batchSend.businessAlterLog.getAlterReason())){
return new ResultJson("400","未提交删除申请原因");
}
if (StringUtils.isEmpty(batchSend.businessAlterLog.getContantname())){
return new ResultJson("400","未提交删除申请联系人或电话");
}
if (StringUtils.isEmpty(batchSend.businessAlterLog.getContenttel())){
return new ResultJson("400","未提交删除申请电话");
}
if (batchSend.billListDes==null || batchSend.billListDes.isEmpty()){
return new ResultJson("400","未选择运单");
}
boolean b = preparmasterService.batchDel(batchSend, username);
if (b){
return new ResultJson("200","批量删除申请发送成功");
}else {
return new ResultJson("400","批量删除申请发送失败");
}
}
}