package com.zt.plat.module.qms.business.bus.controller.admin;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayTaskAnalysisSampleProjectRespVO;
import com.zt.plat.module.qms.business.bus.service.SampleAnalysisService;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;

import static com.zt.plat.framework.common.pojo.CommonResult.success;

/**
 * 样品分析
 */
@Tag(name = "管理后台 - 样品分析")
@RestController
@RequestMapping("/qms/bus/sample/analysis")
@Validated
public class SampleAnalysisController {
	
	@Resource
	private SampleAnalysisService sampleAnalysisService ;
	
	@GetMapping("/batchSampleAnalysisByTaskId")
	public CommonResult<?> batchSampleAnalysisByTaskId(Long businessAssayTaskId) {
		BusinessAssayTaskAnalysisSampleProjectRespVO businessAssayTaskAnalysisSampleProject = sampleAnalysisService.batchSampleAnalysisByTaskId(businessAssayTaskId);
		return success(businessAssayTaskAnalysisSampleProject);
	}
	
	@PostMapping("/saveBatchSampleAnalysis")
	public CommonResult<?> saveBatchSampleAnalysis(@RequestBody BusinessAssayTaskAnalysisSampleProjectRespVO vo) {
		sampleAnalysisService.saveBatchSampleAnalysis(vo);
		return success("成功");
	}
	
	
	@PostMapping("/submitSampleAnalysisByTaskId")
	public CommonResult<?> submitSampleAnalysisByTaskId(Long businessAssayTaskId) {
		sampleAnalysisService.submitSampleAnalysisByTaskId(businessAssayTaskId);
		return success("成功");
	}

}
