ALLOCATEARRIVALServiceImp.java 2.1 KB
package com.tianbo.analysis.service.imp;

import com.tianbo.analysis.dao.ALLOCATEARRIVALMapper;
import com.tianbo.analysis.model.ALLOCATEARRIVAL;
import com.tianbo.analysis.service.ALLOCATEARRIVALService;
import com.tianbo.analysis.model.NmmsBase;
import com.tianbo.analysis.tools.AWBTools;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: shenhl
 * @Date: 2019/8/28 11:08
 */
@Service
@Slf4j
@Async
public class ALLOCATEARRIVALServiceImp extends NmmsBase implements ALLOCATEARRIVALService {

    @Autowired
    ALLOCATEARRIVALMapper allocatearrivalMapper;


    @Override
    public int master() {
        //设置主单回执、航班号、航班日期
        ALLOCATEARRIVAL allocatearrival = new ALLOCATEARRIVAL();
        allocatearrival.setReceiptinformation(reception);
        String[] flightInfo = AWBTools.splitFlight(customReception.getFlightNo());
        allocatearrival.setFlightno(flightInfo[1]);
        allocatearrival.setCarrier(flightInfo[0]);
        allocatearrival.setFlightdate(flightDate);
        //设置主分单的 主单号
        allocatearrival.setWaybillno(awbA);
        allocatearrival.setStatus(nmsStatusCode);
        //更新主单回执
        int i = allocatearrivalMapper.updateRECEIPTION(allocatearrival);
        //获取分单autoid
        List<ALLOCATEARRIVAL> arrivedmasterList = allocatearrivalMapper.selectAutoIdByAwb(allocatearrival);
        if(!arrivedmasterList.isEmpty()){
            ALLOCATEARRIVAL departuresloading1 = arrivedmasterList.get(0);
            String autoId = departuresloading1.getId();

            //插入sendlog记录表
            log.info("即将插入日志运单号为:"+awbA+"->autoid="+autoId);
            int ii =coustomAnalysisServiceImp.insertSendlog("MT3202",reception,autoId);

            int iii = shareServiceImp.updateMessages(customReception);
            if (i>0 && ii>0 && iii > 0){
                return 1;
            }
        }
        return 0;
    }
}