INPORTALLOCATE.java 5.2 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.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;

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

@Data
@Slf4j
public class INPORTALLOCATE extends WlptBaseModel {
    private String id;

    private Date createdate;

    private String waybillno;

    private String carrier;

    private String flightno;

    private Date flightdate;

    private String customos;

    private String tallypieces;

    private String tallyweight;

    private String allocatepieces;

    private String allocateweight;

    private String allocatedestination;

    private String trailernumber;

    private String status;

    private String receiptinformation;

    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 getWaybillno() {
        return waybillno;
    }

    public void setWaybillno(String waybillno) {
        this.waybillno = waybillno == null ? null : waybillno.trim();
    }

    public String getCarrier() {
        return carrier;
    }

    public void setCarrier(String carrier) {
        this.carrier = carrier == null ? null : carrier.trim();
    }

    public String getFlightno() {
        return flightno;
    }

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

    public Date getFlightdate() {
        return flightdate;
    }

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

    public String getCustomos() {
        return customos;
    }

    public void setCustomos(String customos) {
        this.customos = customos == null ? null : customos.trim();
    }

    public String getTallypieces() {
        return tallypieces;
    }

    public void setTallypieces(String tallypieces) {
        this.tallypieces = tallypieces == null ? null : tallypieces.trim();
    }

    public String getTallyweight() {
        return tallyweight;
    }

    public void setTallyweight(String tallyweight) {
        this.tallyweight = tallyweight == null ? null : tallyweight.trim();
    }

    public String getAllocatepieces() {
        return allocatepieces;
    }

    public void setAllocatepieces(String allocatepieces) {
        this.allocatepieces = allocatepieces == null ? null : allocatepieces.trim();
    }

    public String getAllocateweight() {
        return allocateweight;
    }

    public void setAllocateweight(String allocateweight) {
        this.allocateweight = allocateweight == null ? null : allocateweight.trim();
    }

    public String getAllocatedestination() {
        return allocatedestination;
    }

    public void setAllocatedestination(String allocatedestination) {
        this.allocatedestination = allocatedestination == null ? null : allocatedestination.trim();
    }

    public String getTrailernumber() {
        return trailernumber;
    }

    public void setTrailernumber(String trailernumber) {
        this.trailernumber = trailernumber == null ? null : trailernumber.trim();
    }

    public String getStatus() {
        return status;
    }

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

    public String getReceiptinformation() {
        return receiptinformation;
    }

    public void setReceiptinformation(String receiptinformation) {
        this.receiptinformation = receiptinformation == null ? null : receiptinformation.trim();
    }

    public INPORTALLOCATE() {
    }
    public INPORTALLOCATE(CustomReception customReception) {
        this.waybillno = customReception.getWayBillMaster();
        String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
        this.setFlightno(flightInfo[1]);
        this.setCarrier(flightInfo[0]);
        if (!StringUtils.isEmpty(customReception.getFlightDate())) {
            this.setFlightdate(DateUtil.formatByyyyyMMdd(customReception.getFlightDate()));
        }
        this.status = AWBTools.transCusRspCode(customReception.getResponseCode());
        this.receiptinformation = customReception.getResponseText();
    }

    @Override
    public int masterAnalysisReception() {
        int i = inportallocateMapper.updateRECEIPTION(this);

        List<INPORTALLOCATE> arrivedmasterList = inportallocateMapper.selectAutoIdByAwb(this);
        if(!arrivedmasterList.isEmpty()){
            INPORTALLOCATE departuresloading1 = arrivedmasterList.get(0);
            String autoId = departuresloading1.getId();

            //插入sendlog记录表
            log.info("即将插入回执日志运单号为:"+waybillno+"->autoid="+autoId);
            int ii =sendLogService.insertSendlog("MT6202",receiptinformation,autoId);

            if (i>0 && ii>0 ){
                log.info("运单号 {} 分拨申请回执更新成功",waybillno);
                return 1;
            }
        }
        return 0;
    }
}