审查视图

src/main/java/com/tianbo/analysis/controller/MT8204Controller.java 4.0 KB
1 2 3
package com.tianbo.analysis.controller;

import com.github.pagehelper.PageInfo;
4 5 6
import com.tianbo.analysis.annotation.UserPermissionCheck;
import com.tianbo.analysis.controller.bean.ResponseReason;
7 8 9
import com.tianbo.analysis.model.MANIFEST_AIR_CHANGE;
import com.tianbo.analysis.model.ResultJson;
import com.tianbo.analysis.service.MT8204Service;
10
11
import com.tianbo.util.Date.DateUtil;
12
import io.swagger.annotations.ApiOperation;
13
import lombok.extern.slf4j.Slf4j;
14
15 16 17
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
18 19 20 21 22 23 24 25 26 27 28 29 30
import org.springframework.web.bind.annotation.*;


import org.xml.sax.SAXException;

import javax.xml.XMLConstants;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import java.io.File;

import java.io.IOException;
31
import java.util.Date;
32
import java.util.List;
33
34
35 36
@Slf4j
@RestController
37
@RequestMapping("/mt8204/")
38 39 40 41 42
public class MT8204Controller {

    @Autowired
    MT8204Service mt8204Service;
43
    @GetMapping("/index")
44 45
    public ResultJson index(@RequestParam(value = "page",defaultValue = "1") int page,
                            @RequestParam(value = "limit",defaultValue = "10") int limit,
46
                            @RequestParam(value = "flightno",required = false) String flightNo,
47
                            @RequestParam(value = "flightDate",required = false) String flightDate,
48
                            @RequestParam(value = "waybillnomaster",required = false) String waybillNo){
49 50
        MANIFEST_AIR_CHANGE manifest_air_change = new MANIFEST_AIR_CHANGE();
        if(StringUtils.isNotEmpty(flightDate)){
51
           Date flight_Date = DateUtil.parseDate(flightDate,"yyyyMMdd");
52 53 54 55 56 57 58
           manifest_air_change.setFlightDate(flight_Date);
        }
        manifest_air_change.setFlightno(flightNo);
        manifest_air_change.setWaybillnomaster(waybillNo);
        PageInfo<MANIFEST_AIR_CHANGE> result =  mt8204Service.selectList(manifest_air_change,page,limit);
        return new ResultJson("200","success",result);
    }
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88

    @ApiOperation(value = "添加直接改配申请接口")
    @PostMapping("add")
    public ResultJson add(@RequestBody  MANIFEST_AIR_CHANGE manifest_air_change){
       return mt8204Service.add(manifest_air_change) ? new ResultJson(ResponseReason.MT8204_SUCCESS) :  new ResultJson(ResponseReason.MT8204_ADD_ERR);
    }

    @ApiOperation(value = "编辑直接改配申请接口")
    @PostMapping("edit")
    public ResultJson edit(@RequestBody  MANIFEST_AIR_CHANGE manifest_air_change){
        manifest_air_change.setChangetime(new Date());
        return mt8204Service.edit(manifest_air_change) ? new ResultJson(ResponseReason.MT8204_SUCCESS) :  new ResultJson(ResponseReason.MT8204_EDIT_ERR);
    }

    @ApiOperation(value = "删除直接改配申请接口")
    @UserPermissionCheck
    @PostMapping("del")
    public ResultJson del(@RequestBody  MANIFEST_AIR_CHANGE manifest_air_change,@CookieValue("username") String username,@CookieValue("userid") String userid){
        manifest_air_change.setChangetime(new Date());
        return mt8204Service.del(manifest_air_change) ? new ResultJson(ResponseReason.MT8204_SUCCESS) :  new ResultJson(ResponseReason.MT8204_DEL_ERR);
    }

    @ApiOperation(value = "发送直接改配申请接口")
    @UserPermissionCheck
    @PostMapping("send")
    public ResultJson send(@RequestBody  MANIFEST_AIR_CHANGE manifest_air_change,@CookieValue("username") String username,@CookieValue("userid") String userid){
        return  mt8204Service.send(manifest_air_change,username) ? new ResultJson(ResponseReason.MT8204_SUCCESS) :  new ResultJson(ResponseReason.MT8204_SEND_ERR);
    }

    @PostMapping("batchSend")
89 90 91 92
    public ResultJson batchSend(@RequestBody List<String> autoIDlist, @CookieValue("username") String username, @CookieValue("userid") String userid){
        ResultJson resultJson = mt8204Service.batchSend(autoIDlist,username);
        return  resultJson;
//        :  new ResultJson(ResponseReason.MT8204_SEND_ERR);
93
    }
94
}