NmmsImportController.java 1.8 KB
package com.tianbo.analysis.controller;

import com.tianbo.analysis.model.ORIGINMANIFESTMASTER;
import com.tianbo.analysis.model.Originmanifestsecondary;
import com.tianbo.analysis.model.ResultJson;
import com.tianbo.analysis.service.NmmsImportService;
import com.tianbo.analysis.service.OriginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author shenhl
 * <p>
 * 2022/2/14/11:22
 */
@RestController
@RequestMapping("/nmms/imp")
public class NmmsImportController {


    @Autowired
    OriginService originService;

    @Autowired
    NmmsImportService nmmsImportService;

    /**
     * awbhIds[] 分单id
     * 批量删除
     * @param originmanifestsecondary
     * @return
     */
    @RequestMapping(value = "/imp_removes")
    @ResponseBody
    public ResultJson antivirus_log_remove(@RequestBody Originmanifestsecondary originmanifestsecondary){
        int r = 0;
        List<String> awbhIds = originmanifestsecondary.getAwbhIds();
        for (int i=0; i< awbhIds.size(); i++){
            r += originService.deleteAwbh(awbhIds.get(i));
        }

        return r > 0 ? new ResultJson("200", "批量删除成功")
                : new ResultJson("201", "批量删除失败");
    }

    /**
     * awbhIds[] 分单id
     * flightDate 航班日期
     * flightno 航班号
     * @param originmanifestmaster
     * @return
     */
    @RequestMapping(value = "/mountAwbh")
    @ResponseBody
    public ResultJson antivirus_log_remove(@RequestBody ORIGINMANIFESTMASTER originmanifestmaster){

        return nmmsImportService.mountAwbh(originmanifestmaster) > 0 ? new ResultJson("200", "分单挂载成功")
                : new ResultJson("201", "分单挂载失败");
    }
}