FlightController.java 2.8 KB
package com.tianbo.analysis.controller;

import com.tianbo.analysis.dao.CUSTOMSMESSAGEMapper;
import com.tianbo.analysis.dao.ORIGINMANIFESTMASTERMapper;
import com.tianbo.analysis.model.CUSTOMSMESSAGE;
import com.tianbo.analysis.model.ResultJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

@RestController
@RequestMapping("/flight")
public class FlightController {

    @Autowired
    ORIGINMANIFESTMASTERMapper originmanifestmasterMapper;

    @Autowired
    CUSTOMSMESSAGEMapper customsmessageMapper;

    /**
     * 修改航班日期
     * @param currDate  修改前日期
     * @param flightNo  航班号
     * @param setDate   修改后日期
     */
    @PostMapping("/changeDate")
    public ResultJson changeFlightDate(@RequestParam(value = "currDate",required = true) String currDate,
                                 @RequestParam(value = "flightNo",required = true) String flightNo,
                                 @RequestParam(value = "setDate", required = true) String setDate
    ){
        HashMap<String ,String> map = new HashMap();
        map.put("currDate",currDate);
        map.put("flightNo",flightNo);
        map.put("setDate",setDate);
        int i = originmanifestmasterMapper.changeFlightDate(map);
        if (i>0)
        {
            return new ResultJson("200","更新成功",i);
//            return "航班日期更新成功"+i;
        }
        return new ResultJson("500","更新失败或航班信息不正确",i);
    }


    /**
     * 查询运单的回执状态,目前能查到出港运单的所有回执状态,进港不行
     * @param waybillno
     * @return 返回 业务类型、主单号、分单号、回执内容
     */
    @PostMapping("/customres")
    public ResultJson getCustomResponse(@RequestParam(value = "waybillno",required = true) String waybillno){
        waybillno = waybillno.replace("-","");
        List<CUSTOMSMESSAGE>  customsmessageList = customsmessageMapper.selectCustomResponse(waybillno);
        return new ResultJson(customsmessageList);
    }

    /**
     * 查询运单的回执状态,目前能查到出港运单 发送海关生成报文的messageId
     * @param waybillno
     * @return 返回 messageId,业务类型、主单号、分单号、回执内容
     */
    @PostMapping("/getmessageid")
    public ResultJson getCustomMessageId(@RequestParam(value = "waybillno",required = true) String waybillno){
        List<CUSTOMSMESSAGE>  customsmessageList = customsmessageMapper.selectCustomId(waybillno);
        return new ResultJson(customsmessageList);
    }
}