package digital.laboratory.platform.inspection.controller;

import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.inspection.dto.ExportSewageAnalystReportsDTO;
import digital.laboratory.platform.inspection.dto.SewageDataDto;
import digital.laboratory.platform.inspection.dto.TaskInfoDto;
import digital.laboratory.platform.inspection.entity.TaskInfo;
import digital.laboratory.platform.inspection.entity.TestRecordSampleData;
import digital.laboratory.platform.inspection.service.SewageDrugInspectReportService;
import digital.laboratory.platform.inspection.service.TaskInfoService;
import digital.laboratory.platform.inspection.service.TestRecordSampleDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;

/**
 *@title TaskInfoController
 *@description
 *@author xy
 *@version 1.0
 *@create 2023/12/8 11:24
 */
@RestController
@RequestMapping("/sewageReport")
@Api(tags = "17-污水专项检测毒品分析报告", description = "污水专项检测毒品分析报告")
public class SewageDrugInspectReportController {
    @Resource
    private SewageDrugInspectReportService sewageDrugInspectReportService;

    @Resource
    private TestRecordSampleDataService testRecordSampleDataService;

    @ApiOperation(value = "导出污水专项检测毒品分析报告")
    @PostMapping("/exportSewageAnalystReports")
    public R exportSewageAnalystReports(@RequestBody ExportSewageAnalystReportsDTO dto){
        try {
            String reportWord = sewageDrugInspectReportService.generateSewageDrugInspectReportWord(dto);
            return R.ok(reportWord);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return R.failed();
    }
//
//    @ApiOperation(value = "更新数据")
//    @PostMapping("/updateData")
//    public R updateData(){
//        boolean update = testRecordSampleDataService
//                .update(Wrappers.<TestRecordSampleData>lambdaUpdate()
//                        .eq(TestRecordSampleData::getTestId, "BC4234B2FF08F7E8CE1ED881DB374EA8")
//                        .eq(TestRecordSampleData::getSampleConcentration, 0)
//                        .set(TestRecordSampleData::getSampleConcentration, 2.123));
//        return R.ok(update);
//    }


}
