DEPARTURESLOADINGServiceImp.java 2.2 KB
package com.tianbo.analysis.service.imp;

import com.tianbo.analysis.dao.DEPARTURESLOADINGMapper;
import com.tianbo.analysis.model.DEPARTURESLOADING;
import com.tianbo.analysis.service.DEPARTURESLOADINGService;
import com.tianbo.analysis.model.NmmsBase;
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/26 10:24
 */
@Service
@Slf4j
@Async
public class DEPARTURESLOADINGServiceImp extends NmmsBase implements DEPARTURESLOADINGService{

    @Autowired
    DEPARTURESLOADINGMapper departuresloadingMapper;

    /**
     * 入库分单回执信息
     * @return 成功返回1,失败返回0。
     */
    @Override
    public int master() {
        //设置主单回执、航班号、航班日期
        DEPARTURESLOADING departuresloading = new DEPARTURESLOADING();
        departuresloading.setReceiption(reception);
        departuresloading.setFlightno(customReception.getFlightNo());
        departuresloading.setFlightdate(flightDate);
        departuresloading.setStatus(nmsStatusCode);
        //设置主分单的 主单号
        departuresloading.setWaybillno(awbA);
        //更新主单回执
        int i = departuresloadingMapper.updateRECEIPTION(departuresloading);
        //获取分单autoid
        List<DEPARTURESLOADING> arrivedmasterList = departuresloadingMapper.selectAutoIdByAwb(departuresloading);
        if(!arrivedmasterList.isEmpty()){
            DEPARTURESLOADING departuresloading1 = arrivedmasterList.get(0);
            String autoId = departuresloading1.getId();

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

            int iii = shareServiceImp.updateMessages(customReception);
            if (i>0 && ii>0){
                log.info("运单号 {} 装载回执更新成功",awbA);
                return 1;
            }
            if (iii > 0){
                return 1;
            }
        }
        return 0;
    }
}