package com.inkasso.factoring.acceptanceManagement.web;

import com.inkasso.auth.response.ResponseJson;
import com.inkasso.factoring.acceptanceManagement.entity.CAcceptancePriceAdjustInfo;
import com.inkasso.factoring.acceptanceManagement.service.ICAcceptanceBasicInfoService;
import com.inkasso.factoring.acceptanceManagement.service.ICAcceptancePriceAdjustInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Description 验收单单价调整controller
 * @Author Yafan Wang
 * @Date 2023/12/23 14:06
 */
@Controller
@RequestMapping("/acceptanceAdjust")
public class CAcceptanceAdjustController {

    @Autowired
    private ICAcceptanceBasicInfoService acceptanceBasicInfoService;
    @Autowired
    private ICAcceptancePriceAdjustInfoService acceptancePriceAdjustInfoService;

    /**
     * 下载货物信息
     * @param id
     * @param response
     */
    @GetMapping("/downLoadGoodsFiles")
    public void downLoadGoodsFiles(Long id , HttpServletResponse response){
        acceptanceBasicInfoService.downLoadGoodsFile(id,response);
    }


    /**
     *
     * @param id
     */
    @GetMapping("/getDetail")
    @ResponseBody
    public ResponseJson getDetail(Long id){
        return new ResponseJson(acceptancePriceAdjustInfoService.getDetail(id));
    }

    /**
     *
     * @param adjustInfo
     */
    @PostMapping("/doAdjust")
    @ResponseBody
    public ResponseJson doAdjust(@Validated @RequestBody CAcceptancePriceAdjustInfo adjustInfo){
        return acceptancePriceAdjustInfoService.doAdjust(adjustInfo);
    }






}
