MANIFESTLOAD.java 4.8 KB
package com.tianbo.analysis.model;

import com.tianbo.analysis.bean.WlptBaseModel;
import com.tianbo.analysis.tools.AWBTools;
import com.tianbo.util.Date.DateUtil;
import lombok.extern.slf4j.Slf4j;

import java.util.Date;
import java.util.List;

@Slf4j
public class MANIFESTLOAD extends WlptBaseModel {
    private String id;

    private Date createdate;

    private String flightno;

    private String waybillnomaster;

    private Date flightdate;

    private String waybillnosecondary;

    private String remark;

    private String status;

    private String receiption;

    private String customcode;

    private String reason;

    private String contactname;

    private String contacttel;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id == null ? null : id.trim();
    }

    public Date getCreatedate() {
        return createdate;
    }

    public void setCreatedate(Date createdate) {
        this.createdate = createdate;
    }

    public String getFlightno() {
        return flightno;
    }

    public void setFlightno(String flightno) {
        this.flightno = flightno == null ? null : flightno.trim();
    }

    public String getWaybillnomaster() {
        return waybillnomaster;
    }

    public void setWaybillnomaster(String waybillnomaster) {
        this.waybillnomaster = waybillnomaster == null ? null : waybillnomaster.trim();
    }

    public Date getFlightdate() {
        return flightdate;
    }

    public void setFlightdate(Date flightdate) {
        this.flightdate = flightdate;
    }

    public String getWaybillnosecondary() {
        return waybillnosecondary;
    }

    public void setWaybillnosecondary(String waybillnosecondary) {
        this.waybillnosecondary = waybillnosecondary == null ? null : waybillnosecondary.trim();
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark == null ? null : remark.trim();
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status == null ? null : status.trim();
    }

    public String getReceiption() {
        return receiption;
    }

    public void setReceiption(String receiption) {
        this.receiption = receiption == null ? null : receiption.trim();
    }

    public String getCustomcode() {
        return customcode;
    }

    public void setCustomcode(String customcode) {
        this.customcode = customcode == null ? null : customcode.trim();
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason == null ? null : reason.trim();
    }

    public String getContactname() {
        return contactname;
    }

    public void setContactname(String contactname) {
        this.contactname = contactname == null ? null : contactname.trim();
    }

    public String getContacttel() {
        return contacttel;
    }

    public void setContacttel(String contacttel) {
        this.contacttel = contacttel == null ? null : contacttel.trim();
    }

    public MANIFESTLOAD() {

    }

    public MANIFESTLOAD(CustomReception customReception) {

        this.waybillnomaster = AWBTools.awbFormat(customReception.getWayBillMaster());


        //取分单号
        if(!customReception.getWayBillSecond().isEmpty()){
            String[] awbhArr = customReception.getWayBillSecond().split("_");
            this.waybillnosecondary = awbhArr[1];
        }

        this.flightno = customReception.getFlightNo();
        this.flightdate = DateUtil.formatByyyyyMMdd(customReception.getFlightDate());

        this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
        this.receiption = customReception.getResponseText();
    }

    @Override
    public int secondAnalysisReception(){

        //更新分单回执
        int i = manifestloadMapper.updateRECEIPTION(this);
        //获取分单autoid
        List<MANIFESTLOAD> secondaryList = manifestloadMapper.selectAutoIdByawbAawbH(this);
        if(!secondaryList.isEmpty()){
            MANIFESTLOAD arrivedSecond = secondaryList.get(0);
            String autoId =  arrivedSecond.getId();
            //插入sendlog记录表
            log.info("即将插入回执日志运单号为:{}{},->autoid={}",waybillnomaster,waybillnosecondary,autoId);
            int ii = sendLogService.insertSendlog("MT8202",receiption,autoId);

            //todo:同时更新发送日志表的回执信息


            if (i>0 && ii>0 ){
                log.info("运单号 {} 落装分单回执更新成功",waybillnosecondary);
                return 1;
            }
        }else {
            //todo:如果都没适配到的话,要从发送日志表里面通过回执中的messageid 找到发送信息,适配回执
        }
        return 0;
    }
}