package com.ruoyi.front.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.logistics.domain.BizWaybillCostDetails;
import com.ruoyi.logistics.domain.BizWaybillOrder;
import com.ruoyi.logistics.service.IBizWaybillCostDetailsService;
import com.ruoyi.logistics.service.IBizWaybillOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * WX-运单费用明细
 * 
 * @author RuiJing
 * @date 2026-01-29
 */
@RestController
@RequestMapping("/front/costDetails")
public class WaybillCostDetailsController extends BaseController
{
    @Autowired
    private IBizWaybillCostDetailsService bizWaybillCostDetailsService;
    @Autowired
    private IBizWaybillOrderService bizWaybillOrderService;
    /**
     * 查询运单明细列表 这个需要返回运单和费用列表
     */
    @GetMapping("/list")
    public AjaxResult list(BizWaybillCostDetails bizWaybillCostDetails)
    {
        Map result= new HashMap<>();
        List<BizWaybillCostDetails> list = bizWaybillCostDetailsService.selectBizWaybillCostDetailsListByWx(bizWaybillCostDetails);
        BizWaybillOrder orderInfo= bizWaybillOrderService.selectBizWaybillOrderByWaybillId(bizWaybillCostDetails.getWaybillId());
        result.put("feeList",list);
        result.put("orderInfo",orderInfo);
        return AjaxResult.success(result);
    }

    /**
     * 获取运单明细详细信息
     */
    @GetMapping(value = "/{waybillDetailId}")
    public AjaxResult getInfo(@PathVariable("waybillDetailId") Long waybillDetailId)
    {
        return success(bizWaybillCostDetailsService.selectBizWaybillCostDetailsByWaybillDetailId(waybillDetailId));
    }
}
