package com.bs.tm.controller;

import cn.hutool.core.lang.Validator;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.bs.cw.domain.CwAmortizeCost;
import com.bs.cw.service.ICwAmortizeCostService;
import com.bs.tm.domain.TmCargoDetail;
import com.bs.tm.domain.TmCargoSource;
import com.bs.tm.domain.TmOrder;
import com.bs.tm.domain.TmOrderTransCargo;
import com.bs.tm.service.ITmCargoDetailService;
import com.bs.tm.service.ITmCargoSourceService;
import com.bs.tm.service.ITmOrderTransCargoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 托运订单Controller
 *
 * @author bs
 * @date 2024-02-07
 */
@Api(tags = "托运订单")
@RestController
@RequestMapping("/cargo/source")
public class TmCargoSourceController extends BaseController {
    @Resource
    private ITmCargoSourceService tmCargoSourceService;

    @Resource
    private ITmCargoDetailService tmCargoDetailService;
    @Resource
    private ICwAmortizeCostService cwAmortizeCostService;
    @Resource
    private ITmOrderTransCargoService tmOrderTransCargoService;


    /**
     * 分页查询托运订单列表
     */
    @ApiOperation("分页查询托运订单列表")
    @GetMapping("/pageList")
    public TableDataInfo pageList(TmCargoSource tmCargoSource) {
        startPage();
        QueryWrapper<TmCargoSource> queryWrapper = new QueryWrapper();
        condition(queryWrapper, tmCargoSource);
        List<TmCargoSource> list = tmCargoSourceService.selectOrderList(queryWrapper);
        return getDataTable(list);
    }

    /**
     * 查询托运订单列表
     */
    @ApiOperation("查询托运订单列表")
    @GetMapping("/list")
    public AjaxResult list(TmCargoSource tmCargoSource) {
        LambdaQueryWrapper<TmCargoSource> queryWrapper = new LambdaQueryWrapper();
        condition(queryWrapper, tmCargoSource);
        List<TmCargoSource> list = tmCargoSourceService.list(queryWrapper);
        return success(list);
    }

    /**
     * 导出托运订单列表
     */
    @ApiOperation("导出托运订单列表")
    @Log(title = "托运订单导出", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TmCargoSource tmCargoSource) {
        LambdaQueryWrapper<TmCargoSource> queryWrapper = new LambdaQueryWrapper();
        condition(queryWrapper, tmCargoSource);
        List<TmCargoSource> list = tmCargoSourceService.list(queryWrapper);
        ExcelUtil<TmCargoSource> util = new ExcelUtil<TmCargoSource>(TmCargoSource.class);
        util.exportExcel(response, list, "托运订单数据");
    }

    /**
     * 获取托运订单详细信息
     */
    @ApiOperation("获取托运订单详细信息")
    @GetMapping(value = "/{ID}")
    public AjaxResult getInfo(@PathVariable("ID") Long ID) {
        TmCargoSource tmCargoSource = tmCargoSourceService.selectOrderById(ID);
        List<TmCargoDetail> list = tmCargoDetailService.list(new LambdaQueryWrapper<TmCargoDetail>().eq(TmCargoDetail::getCargoId, tmCargoSource.getId()));
        tmCargoSource.setCargoList(list);
        return success(tmCargoSource);
    }

    /**
     * 新增托运订单
     */
    @ApiOperation("新增托运订单")
    @Log(title = "托运订单新增", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TmCargoSource tmCargoSource) {
        tmCargoSourceService.save(tmCargoSource);
        List<TmCargoDetail> cargoList = tmCargoSource.getCargoList();
        if (null != cargoList && cargoList.size() > 0) {
            cargoList.forEach(item -> {
                item.setCargoId(tmCargoSource.getId());
            });
            tmCargoDetailService.saveBatch(cargoList);
        }
        return success();
    }

    /**
     * 修改托运订单
     */
    @ApiOperation("修改托运订单")
    @Log(title = "托运订单修改", businessType = BusinessType.UPDATE)
    @PutMapping
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult edit(@RequestBody TmCargoSource tmCargoSource) {
        tmCargoSourceService.updateById(tmCargoSource);
        List<TmCargoDetail> cargoList = tmCargoSource.getCargoList();
        List<TmCargoDetail> lsInsert = new ArrayList<>();
        List<TmCargoDetail> lsUpdate = new ArrayList<>();
        List<Long> ids = new ArrayList<>();
        if (null != cargoList && cargoList.size() > 0) {
            cargoList.forEach(item -> {
                item.setCargoId(tmCargoSource.getId());
                if (Validator.isNotEmpty(item.getId())) {
                    lsUpdate.add(item);
                    ids.add(item.getId());
                } else {
                    lsInsert.add(item);
                }
            });
        }
        //获取id集合
        //List<Long> ids =  cargoList.stream().map(TmCargoDetail::getId).collect(Collectors.toList());
        tmCargoDetailService.remove(new LambdaQueryWrapper<TmCargoDetail>().notIn(ids.size() > 0, TmCargoDetail::getId, ids)
                .eq(TmCargoDetail::getCargoId, tmCargoSource.getId()));
        if (lsInsert.size() > 0) {
            tmCargoDetailService.saveBatch(lsInsert);
        }
        if (lsUpdate.size() > 0) {
            tmCargoDetailService.updateBatchById(lsUpdate);
        }
        /*
        tmCargoDetailService.saveOrUpdateBatch(cargoList);*/
        return success();
    }

    /**
     * 删除托运订单
     */
    @ApiOperation("删除托运订单")
    @Log(title = "托运订单删除", businessType = BusinessType.DELETE)
    @DeleteMapping("/{IDs}")
    public AjaxResult remove(@PathVariable List<Long> IDs) {
        return toAjax(tmCargoSourceService.removeBatchByIds(IDs));
    }

    @ApiOperation("撤销托运订单")
    @Log(title = "撤销托运订单", businessType = BusinessType.UPDATE)
    @PostMapping("/revokeOrder")
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult revoke(@RequestBody TmCargoSource tmCargoSource) {
        if (null != tmCargoSource && null != tmCargoSource.getId()) {
            List<CwAmortizeCost> lsCost = cwAmortizeCostService.list(new LambdaQueryWrapper<CwAmortizeCost>().eq(CwAmortizeCost::getOrderType, "0").eq(CwAmortizeCost::getOrderId, tmCargoSource.getId()));
            if (null != lsCost && lsCost.size() > 0) {
                return warn("该托运单已计算生成费用，不能撤销");
            } else {
                TmCargoSource source = tmCargoSourceService.getById(tmCargoSource.getId());
                source.setStatus("0");
                return success(tmCargoSourceService.updateById(source));
            }
        } else {
            return warn("请选择托运单!");
        }
    }

    /**
     * 条件设置
     */
    private void condition(LambdaQueryWrapper<TmCargoSource> queryWrapper, TmCargoSource tmCargoSource) {


        //id
        if (Validator.isNotEmpty(tmCargoSource.getId())) {
            queryWrapper.eq(TmCargoSource::getId, tmCargoSource.getId());
        }

        //客户id
        if (Validator.isNotEmpty(tmCargoSource.getCustId())) {
            queryWrapper.eq(TmCargoSource::getCustId, tmCargoSource.getCustId());
        }

        //发布时间
        if (Validator.isNotEmpty(tmCargoSource.getPublishTime())) {
            queryWrapper.eq(TmCargoSource::getPublishTime, tmCargoSource.getPublishTime());
        }

        //有效截止时间
        if (Validator.isNotEmpty(tmCargoSource.getValidTime())) {
            queryWrapper.eq(TmCargoSource::getValidTime, tmCargoSource.getValidTime());
        }

        //货物体积
        if (Validator.isNotEmpty(tmCargoSource.getCargoVol())) {
            queryWrapper.eq(TmCargoSource::getCargoVol, tmCargoSource.getCargoVol());
        }

        //货源类型
        if (Validator.isNotEmpty(tmCargoSource.getCargoType())) {
            queryWrapper.eq(TmCargoSource::getCargoType, tmCargoSource.getCargoType());
        }

        //货物信息
        if (Validator.isNotEmpty(tmCargoSource.getCargoInfo())) {
            queryWrapper.like(TmCargoSource::getCargoInfo, tmCargoSource.getCargoInfo());
        }

        //货物重量
        if (Validator.isNotEmpty(tmCargoSource.getCargoWeight())) {
            queryWrapper.eq(TmCargoSource::getCargoWeight, tmCargoSource.getCargoWeight());
        }

        //货物价值
        if (Validator.isNotEmpty(tmCargoSource.getCargoWorth())) {
            queryWrapper.eq(TmCargoSource::getCargoWorth, tmCargoSource.getCargoWorth());
        }

        //货物件数
        if (Validator.isNotEmpty(tmCargoSource.getCargoNum())) {
            queryWrapper.eq(TmCargoSource::getCargoNum, tmCargoSource.getCargoNum());
        }

        //货物外包装
        if (Validator.isNotEmpty(tmCargoSource.getCargoPack())) {
            queryWrapper.eq(TmCargoSource::getCargoPack, tmCargoSource.getCargoPack());
        }

        //发货人
        if (Validator.isNotEmpty(tmCargoSource.getDispatchUser())) {
            queryWrapper.eq(TmCargoSource::getDispatchUser, tmCargoSource.getDispatchUser());
        }

        //发货地
        if (Validator.isNotEmpty(tmCargoSource.getDispatchPlace())) {
            queryWrapper.eq(TmCargoSource::getDispatchPlace, tmCargoSource.getDispatchPlace());
        }

        //发货地编码
        if (Validator.isNotEmpty(tmCargoSource.getDispatchPlaceCode())) {
            queryWrapper.eq(TmCargoSource::getDispatchPlaceCode, tmCargoSource.getDispatchPlaceCode());
        }

        //发货详细地址
        if (Validator.isNotEmpty(tmCargoSource.getDispatchPlaceDetail())) {
            queryWrapper.eq(TmCargoSource::getDispatchPlaceDetail, tmCargoSource.getDispatchPlaceDetail());
        }

        //发货地位置
        if (Validator.isNotEmpty(tmCargoSource.getDispatchLocation())) {
            queryWrapper.eq(TmCargoSource::getDispatchLocation, tmCargoSource.getDispatchLocation());
        }

        //发货人固定电话
        if (Validator.isNotEmpty(tmCargoSource.getDispatchTel())) {
            queryWrapper.eq(TmCargoSource::getDispatchTel, tmCargoSource.getDispatchTel());
        }

        //发货人手机号码
        if (Validator.isNotEmpty(tmCargoSource.getDispatchMobile())) {
            queryWrapper.eq(TmCargoSource::getDispatchMobile, tmCargoSource.getDispatchMobile());
        }

        //发货单位id,便于后期扩展(发货单位选择控件,统计)
        if (Validator.isNotEmpty(tmCargoSource.getDispatchCustId())) {
            queryWrapper.eq(TmCargoSource::getDispatchCustId, tmCargoSource.getDispatchCustId());
        }

        //收货人
        if (Validator.isNotEmpty(tmCargoSource.getReceiveUser())) {
            queryWrapper.eq(TmCargoSource::getReceiveUser, tmCargoSource.getReceiveUser());
        }

        //收货地
        if (Validator.isNotEmpty(tmCargoSource.getReceivePlace())) {
            queryWrapper.eq(TmCargoSource::getReceivePlace, tmCargoSource.getReceivePlace());
        }

        //收货地编码
        if (Validator.isNotEmpty(tmCargoSource.getReceivePlaceCode())) {
            queryWrapper.eq(TmCargoSource::getReceivePlaceCode, tmCargoSource.getReceivePlaceCode());
        }

        //收货详细地址
        if (Validator.isNotEmpty(tmCargoSource.getReceivePlaceDetail())) {
            queryWrapper.eq(TmCargoSource::getReceivePlaceDetail, tmCargoSource.getReceivePlaceDetail());
        }

        //收货地位置
        if (Validator.isNotEmpty(tmCargoSource.getReceiveLocation())) {
            queryWrapper.eq(TmCargoSource::getReceiveLocation, tmCargoSource.getReceiveLocation());
        }

        //收货方手机号码
        if (Validator.isNotEmpty(tmCargoSource.getReceiveMobile())) {
            queryWrapper.eq(TmCargoSource::getReceiveMobile, tmCargoSource.getReceiveMobile());
        }

        //收货方固定电话
        if (Validator.isNotEmpty(tmCargoSource.getReceiveTel())) {
            queryWrapper.eq(TmCargoSource::getReceiveTel, tmCargoSource.getReceiveTel());
        }

        //收货方单位ID
        if (Validator.isNotEmpty(tmCargoSource.getReceiveCustId())) {
            queryWrapper.eq(TmCargoSource::getReceiveCustId, tmCargoSource.getReceiveCustId());
        }

        //运价
        if (Validator.isNotEmpty(tmCargoSource.getFreightRates())) {
            queryWrapper.eq(TmCargoSource::getFreightRates, tmCargoSource.getFreightRates());
        }

        //车长要求
        if (Validator.isNotEmpty(tmCargoSource.getVehicleLength())) {
            queryWrapper.eq(TmCargoSource::getVehicleLength, tmCargoSource.getVehicleLength());
        }

        //联系人
        if (Validator.isNotEmpty(tmCargoSource.getLinkMan())) {
            queryWrapper.eq(TmCargoSource::getLinkMan, tmCargoSource.getLinkMan());
        }

        //交易电话
        if (Validator.isNotEmpty(tmCargoSource.getMobileNumber())) {
            queryWrapper.eq(TmCargoSource::getMobileNumber, tmCargoSource.getMobileNumber());
        }

        //车辆结构
        if (Validator.isNotEmpty(tmCargoSource.getVehicleStucture())) {
            queryWrapper.eq(TmCargoSource::getVehicleStucture, tmCargoSource.getVehicleStucture());
        }

        //单位地址
        if (Validator.isNotEmpty(tmCargoSource.getCustAddr())) {
            queryWrapper.eq(TmCargoSource::getCustAddr, tmCargoSource.getCustAddr());
        }

        //状态
        if (Validator.isNotEmpty(tmCargoSource.getStatus())) {
            queryWrapper.eq(TmCargoSource::getStatus, tmCargoSource.getStatus());
        }

        //创建人
        if (Validator.isNotEmpty(tmCargoSource.getCreateBy())) {
            queryWrapper.eq(TmCargoSource::getCreateBy, tmCargoSource.getCreateBy());
        }

        //创建时间
        if (Validator.isNotEmpty(tmCargoSource.getCreateTime())) {
            queryWrapper.eq(TmCargoSource::getCreateTime, tmCargoSource.getCreateTime());
        }

        //修改人
        if (Validator.isNotEmpty(tmCargoSource.getUpdateBy())) {
            queryWrapper.eq(TmCargoSource::getUpdateBy, tmCargoSource.getUpdateBy());
        }

        //修改时间
        if (Validator.isNotEmpty(tmCargoSource.getUpdateTime())) {
            queryWrapper.eq(TmCargoSource::getUpdateTime, tmCargoSource.getUpdateTime());
        }

        //删除标志（0代表存在 2代表删除）
        if (Validator.isNotEmpty(tmCargoSource.getDelFlag())) {
            queryWrapper.eq(TmCargoSource::getDelFlag, tmCargoSource.getDelFlag());
        }

        //备注
        if (Validator.isNotEmpty(tmCargoSource.getRemark())) {
            queryWrapper.eq(TmCargoSource::getRemark, tmCargoSource.getRemark());
        }

        //是否定向发布
        if (Validator.isNotEmpty(tmCargoSource.getIsTarget())) {
            queryWrapper.eq(TmCargoSource::getIsTarget, tmCargoSource.getIsTarget());
        }

        //船舶名称
        if (Validator.isNotEmpty(tmCargoSource.getShipName())) {
            queryWrapper.eq(TmCargoSource::getShipName, tmCargoSource.getShipName());
        }

        //航次
        if (Validator.isNotEmpty(tmCargoSource.getVoyage())) {
            queryWrapper.eq(TmCargoSource::getVoyage, tmCargoSource.getVoyage());
        }

        //提单号
        if (Validator.isNotEmpty(tmCargoSource.getOrderNo())) {
            queryWrapper.like(TmCargoSource::getOrderNo, tmCargoSource.getOrderNo());
        }

        //作业号
        if (Validator.isNotEmpty(tmCargoSource.getJobNo())) {
            queryWrapper.eq(TmCargoSource::getJobNo, tmCargoSource.getJobNo());
        }

    }

    /**
     * 条件设置
     */
    private void condition(QueryWrapper<TmCargoSource> queryWrapper, TmCargoSource tmCargoSource) {

        if (Validator.isNotEmpty(tmCargoSource.getBeginDate())) {
            queryWrapper.ge("order_date",  tmCargoSource.getBeginDate());
        }

        if (Validator.isNotEmpty(tmCargoSource.getEndDate())) {
            queryWrapper.le("order_date", tmCargoSource.getEndDate());
        }

        //id
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getId()), "ID", tmCargoSource.getId());
        queryWrapper.eq( "a.del_flag", "0");

//客户id
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getCustId()), "CUST_ID", tmCargoSource.getCustId());

//发布时间
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getPublishTime()), "PUBLISH_TIME", tmCargoSource.getPublishTime());

//有效截止时间
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getValidTime()), "VALID_TIME", tmCargoSource.getValidTime());

//货物体积
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getCargoVol()), "CARGO_VOL", tmCargoSource.getCargoVol());

//货源类型
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getCargoType()), "CARGO_TYPE", tmCargoSource.getCargoType());

//货物信息
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getCargoInfo()), "CARGO_INFO", tmCargoSource.getCargoInfo());

//货物重量
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getCargoWeight()), "CARGO_WEIGHT", tmCargoSource.getCargoWeight());

//货物价值
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getCargoWorth()), "CARGO_WORTH", tmCargoSource.getCargoWorth());

//货物件数
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getCargoNum()), "CARGO_NUM", tmCargoSource.getCargoNum());

//货物外包装
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getCargoPack()), "CARGO_PACK", tmCargoSource.getCargoPack());

//发货人
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getDispatchUser()), "DISPATCH_USER", tmCargoSource.getDispatchUser());

//发货地
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getDispatchPlace()), "DISPATCH_PLACE", tmCargoSource.getDispatchPlace());

//发货地编码
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getDispatchPlaceCode()), "DISPATCH_PLACE_CODE", tmCargoSource.getDispatchPlaceCode());

//发货详细地址
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getDispatchPlaceDetail()), "DISPATCH_PLACE_DETAIL", tmCargoSource.getDispatchPlaceDetail());

//发货地位置
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getDispatchLocation()), "DISPATCH_LOCATION", tmCargoSource.getDispatchLocation());

//发货人固定电话
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getDispatchTel()), "DISPATCH_TEL", tmCargoSource.getDispatchTel());

//发货人手机号码
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getDispatchMobile()), "DISPATCH_MOBILE", tmCargoSource.getDispatchMobile());

//发货单位id
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getDispatchCustId()), "DISPATCH_CUST_ID", tmCargoSource.getDispatchCustId());

//收货人
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getReceiveUser()), "RECEIVE_USER", tmCargoSource.getReceiveUser());

//收货地
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getReceivePlace()), "RECEIVE_PLACE", tmCargoSource.getReceivePlace());

//收货地编码
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getReceivePlaceCode()), "RECEIVE_PLACE_CODE", tmCargoSource.getReceivePlaceCode());

//收货详细地址
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getReceivePlaceDetail()), "RECEIVE_PLACE_DETAIL", tmCargoSource.getReceivePlaceDetail());

//收货地位置
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getReceiveLocation()), "RECEIVE_LOCATION", tmCargoSource.getReceiveLocation());

//收货方手机号码
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getReceiveMobile()), "RECEIVE_MOBILE", tmCargoSource.getReceiveMobile());

//收货方固定电话
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getReceiveTel()), "RECEIVE_TEL", tmCargoSource.getReceiveTel());

//收货方单位ID
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getReceiveCustId()), "RECEIVE_CUST_ID", tmCargoSource.getReceiveCustId());

//运价
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getFreightRates()), "FREIGHT_RATES", tmCargoSource.getFreightRates());

//车长要求
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getVehicleLength()), "VEHICLE_LENGTH", tmCargoSource.getVehicleLength());

//联系人
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getLinkMan()), "LINK_MAN", tmCargoSource.getLinkMan());

//交易电话
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getMobileNumber()), "MOBILE_NUMBER", tmCargoSource.getMobileNumber());

//车辆结构
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getVehicleStucture()), "VEHICLE_STUCTURE", tmCargoSource.getVehicleStucture());

//单位地址
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getCustAddr()), "CUST_ADDR", tmCargoSource.getCustAddr());

//状态
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getStatus()), "a.STATUS", tmCargoSource.getStatus());

//创建人
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getCreateBy()), "CREATE_BY", tmCargoSource.getCreateBy());

//创建时间
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getCreateTime()), "CREATE_TIME", tmCargoSource.getCreateTime());

//修改人
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getUpdateBy()), "UPDATE_BY", tmCargoSource.getUpdateBy());

//修改时间
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getUpdateTime()), "UPDATE_TIME", tmCargoSource.getUpdateTime());

//删除标志
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getDelFlag()), "DEL_FLAG", tmCargoSource.getDelFlag());

//备注
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getRemark()), "REMARK", tmCargoSource.getRemark());

//是否定向发布
        queryWrapper.eq(Validator.isNotEmpty(tmCargoSource.getIsTarget()), "IS_TARGET", tmCargoSource.getIsTarget());

//船舶名称
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getShipName()), "SHIP_NAME", tmCargoSource.getShipName());

//航次
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getVoyage()), "VOYAGE", tmCargoSource.getVoyage());

//提单号
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getOrderNo()), "ORDER_NO", tmCargoSource.getOrderNo());

//作业号
        queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getJobNo()), "JOB_NO", tmCargoSource.getJobNo());
//货物名称
        //queryWrapper.like(Validator.isNotEmpty(tmCargoSource.getCargoInfo()), "CARGO_INFO", tmCargoSource.getCargoInfo());
    }

}
