ArrivedAMasterController.java 2.7 KB
package com.tianbo.analysis.controller;


import com.tianbo.analysis.model.AdvanceArrive;
import com.tianbo.analysis.model.BatchSend;
import com.tianbo.analysis.model.ResultJson;
import com.tianbo.analysis.service.ArriveMasterService;
import com.tianbo.analysis.tools.WaybillTools;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 运抵接口
 */
@RestController
@RequestMapping("/arrive/")
public class ArrivedAMasterController {

    @Autowired
    ArriveMasterService arriveMasterService;

    @ApiOperation(value = "提前运抵接口",notes = "接收卡口车辆过卡放行后的通知,车单数据")
    @PostMapping("forkako")
    public ResultJson applyfor(@RequestBody AdvanceArrive carAndWayBill){
        boolean result = arriveMasterService.arrivedAhead(carAndWayBill);
        return result? new ResultJson("200","处理完毕"):new ResultJson("处理失败");
    }

    @RequestMapping("check")
    public void check(@RequestParam String waybill){
        WaybillTools.checkWaybillFormat(waybill);
    }

    @ApiOperation(value = "提前运抵-接收申请数据通知接口",notes = "接收卡口进出场申请中的提前运抵运单数据,并更新到预配中")
    @PostMapping("prebill")
    public ResultJson acceptWaybill(@RequestBody AdvanceArrive preArrivedWaybillList){
        int result = arriveMasterService.updatePremasterArrivedHeadStatus(preArrivedWaybillList);
        return result>0? new ResultJson("200","提前运抵状态已更新"):new ResultJson("提前运抵状态更新失败");
    }

    @PostMapping("batchDel")
    public ResultJson batchDel(@RequestBody BatchSend batchSend, @CookieValue("username") String username, @CookieValue("userid") String userid){
        if (StringUtils.isEmpty(batchSend.businessAlterLog.getAlterReason())){
            return new ResultJson("400","未提交删除申请原因");
        }

        if (StringUtils.isEmpty(batchSend.businessAlterLog.getContantname())){
            return new ResultJson("400","未提交删除申请联系人或电话");
        }

        if (StringUtils.isEmpty(batchSend.businessAlterLog.getContenttel())){
            return new ResultJson("400","未提交删除申请电话");
        }

        if (batchSend.billListDes==null || batchSend.billListDes.isEmpty()){
            return new ResultJson("400","未选择运单");
        }

        boolean b = arriveMasterService.batchDel(batchSend, username);
        if (b){
            return new ResultJson("200","批量删除申请发送成功");
        }else {
            return new ResultJson("400","批量删除申请发送失败");
        }
    }

}