package com.ruoyi.project.sems.controller;

import com.alibaba.fastjson.JSON;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.ExcelUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.config.RuoYiConfig;
import com.ruoyi.framework.interceptor.annotation.RepeatSubmit;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.sems.domain.ParamData;
import com.ruoyi.project.sems.domain.TReportThird;
import com.ruoyi.project.sems.domain.TReportYlgd;
import com.ruoyi.project.sems.mapper.TReportYlgdMapper;
import com.ruoyi.project.sems.service.ITReportThirdService;
import com.ruoyi.project.sems.service.ITReportYlgdService;
import com.ruoyi.project.system.domain.SysDictData;
import com.ruoyi.project.system.service.ISysDictTypeService;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * 压力管道年检报告Controller
 *
 * @author ruoyi
 * @date 2021-09-02
 */
@RestController
@RequestMapping("/sems/reportYlgd")
public class TReportYlgdController extends BaseController {

    @Autowired
    private ITReportYlgdService tReportYlgdService;

    @Autowired
    private ITReportThirdService itReportYlrqThirdService;
    @Resource
    private TReportYlgdMapper tReportYlgdMapper;
    @Autowired
    private ISysDictTypeService iSysDictTypeService;

    /**
     * 导出选中设备
     *
     * @param params
     * @return
     * @throws IOException
     */
    @PostMapping("/exportSelected")
    @RepeatSubmit
    public AjaxResult exportSelected(@RequestBody ParamData params) throws IOException {
        logger.info(JSON.toJSONString(params));
        String id = params.getIds();
        String[] ids = id.split(",");
        List<TReportYlgd> list = new ArrayList<>();
        for (String i : ids
        ) {
            TReportYlgd reportYlrqEntity = tReportYlgdService.selectTReportYlgdById(Long.parseLong(i));
            list.add(reportYlrqEntity);
        }
        SXSSFWorkbook wb = new SXSSFWorkbook(1000);
        CellStyle wrapStyle = wb.createCellStyle();
        wrapStyle.setWrapText(true);    //设置自动换行
        //创建sheet页
        Sheet sheet = wb.createSheet("sheet1");
        //设置列的宽度，第一个参数为列的序号，从0开始，第二参数为列宽，单位1/256个字节
        for (int i = 0; i < 27; i++) {
            if (i == 0 || i == 1 || i == 2 || i == 20 || i == 21 || i == 22 || i == 23 || i == 24 || i == 25 || i == 26) {
                sheet.setColumnWidth(i, 20 * 256);
            } else {
                sheet.setColumnWidth(i, 10 * 256);
            }
        }
        //设置开始行和开始列
        Row row0 = sheet.createRow(0);
        CellStyle styleGrey = wb.createCellStyle();
        Font headerFont = wb.createFont();
        headerFont.setBold(true);
        headerFont.setColor(IndexedColors.BLACK.getIndex());
        styleGrey.setFont(headerFont);
        styleGrey.setBorderBottom(BorderStyle.THIN); //下边框
        styleGrey.setBorderLeft(BorderStyle.THIN);//左边框
        styleGrey.setBorderTop(BorderStyle.THIN);//上边框
        styleGrey.setBorderRight(BorderStyle.THIN);//右边框
        styleGrey.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
        styleGrey.setFillPattern(FillPatternType.SOLID_FOREGROUND);
        CellStyle styleYellow = wb.createCellStyle();
        styleYellow.setFont(headerFont);
        styleYellow.setBorderBottom(BorderStyle.THIN); //下边框
        styleYellow.setBorderLeft(BorderStyle.THIN);//左边框
        styleYellow.setBorderTop(BorderStyle.THIN);//上边框
        styleYellow.setBorderRight(BorderStyle.THIN);//右边框
        styleYellow.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
        styleYellow.setFillPattern(FillPatternType.SOLID_FOREGROUND);
        Cell cell0 = row0.createCell(0);
        row0.createCell(0).setCellValue("使用证");
        row0.createCell(1).setCellValue("注册编号");
        row0.createCell(2).setCellValue("位号");
        row0.createCell(3).setCellValue("1安全管理情况");
        row0.createCell(4).setCellValue("2设计图纸文档、维修记录、质量证明等资料");
        row0.createCell(5).setCellValue("3作业人员定期培训情况");
        row0.createCell(6).setCellValue("4管道本体及支架");
        row0.createCell(7).setCellValue("5管道运行情况");
        row0.createCell(8).setCellValue("安全附件仪表及检查情况");
        row0.createCell(9);
        row0.createCell(10);
        row0.createCell(11);
        row0.createCell(12);
        row0.createCell(13);
        row0.createCell(14).setCellValue("12电阻值测量");
        row0.createCell(15).setCellValue("13壁厚测定");
        row0.createCell(16).setCellValue("14");
        row0.createCell(17).setCellValue("15");
        row0.createCell(18).setCellValue("16");
        row0.createCell(19).setCellValue("17");
        row0.createCell(20).setCellValue("备注");
        row0.createCell(21).setCellValue("检查日期");
        row0.createCell(22).setCellValue("下次年度检查日期");
        row0.createCell(23).setCellValue("问题及处理");
        row0.createCell(24).setCellValue("检查结论");
        row0.createCell(25).setCellValue("年检报告编号");
        row0.createCell(26).setCellValue("检查结论备注");
        Row row1 = sheet.createRow(1);
        row1.createCell(0);
        row1.createCell(1);
        row1.createCell(2);
        row1.createCell(3);
        row1.createCell(4);
        row1.createCell(5);
        row1.createCell(6);
        row1.createCell(7);
        row1.createCell(8).setCellValue("6安全阀");
        row1.createCell(9).setCellValue("7爆破片装置");
        row1.createCell(10).setCellValue("8阻火器装置");
        row1.createCell(11).setCellValue("9紧急切断阀");
        row1.createCell(12).setCellValue("10压力表");
        row1.createCell(13).setCellValue("11测温仪表");
        row1.createCell(14);
        row1.createCell(15);
        row1.createCell(16);
        row1.createCell(17);
        row1.createCell(18);
        row1.createCell(19);
        row1.createCell(20);
        row1.createCell(21);
        row1.createCell(22);
        row1.createCell(23);
        row1.createCell(24);
        row1.createCell(25);
        row1.createCell(26);
        Row row2 = sheet.createRow(2);
        for (int i = 0; i < 27; i++) {
            row2.createCell(i);
            if (i == 26) row2.createCell(i).setCellValue("1：符合要求");
        }
        Row row3 = sheet.createRow(3);
        for (int i = 0; i < 27; i++) {
            row3.createCell(i);
            if (i == 26) row3.createCell(i).setCellValue("2：基本符合要求");
        }
        Row row4 = sheet.createRow(4);
        for (int i = 0; i < 27; i++) {
            row4.createCell(i);
            if (i == 26) row4.createCell(i).setCellValue("3：不符合要求");
        }
        // 合并单元格
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, 0));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 1, 1));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 2, 2));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 3, 3));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 4, 4));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 5, 5));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 6, 6));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 7, 7));
        sheet.addMergedRegion(new CellRangeAddress(0, 0, 8, 13));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 14, 14));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 15, 15));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 16, 16));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 17, 17));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 18, 18));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 19, 19));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 20, 20));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 21, 21));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 22, 22));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 23, 23));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 24, 24));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 25, 25));
        sheet.addMergedRegion(new CellRangeAddress(0, 1, 26, 26));
        // 表头样式
        for (int i = 0; i < 26; i++) {
            if (i < 3) {
                row0.getCell(i).setCellStyle(styleGrey);
                row1.getCell(i).setCellStyle(styleGrey);
            } else {
                row0.getCell(i).setCellStyle(styleYellow);
                row1.getCell(i).setCellStyle(styleYellow);
            }
        }
        //填充数据
        int rowIndex = 2;
        for (TReportYlgd t : list
        ) {
            if (rowIndex == 2 || rowIndex == 3 || rowIndex == 4) {
                sheet.getRow(rowIndex).getCell(0).setCellValue(t.getUseno());
                sheet.getRow(rowIndex).getCell(1).setCellValue(t.getRegno());
                sheet.getRow(rowIndex).getCell(2).setCellValue(t.getDevno());
                sheet.getRow(rowIndex).getCell(3).setCellValue(t.getPj1());
                sheet.getRow(rowIndex).getCell(4).setCellValue(t.getPj2());
                sheet.getRow(rowIndex).getCell(5).setCellValue(t.getPj3());
                sheet.getRow(rowIndex).getCell(6).setCellValue(t.getPj4());
                sheet.getRow(rowIndex).getCell(7).setCellValue(t.getPj5());
                sheet.getRow(rowIndex).getCell(8).setCellValue(t.getPj6());
                sheet.getRow(rowIndex).getCell(9).setCellValue(t.getPj7());
                sheet.getRow(rowIndex).getCell(10).setCellValue(t.getPj8());
                sheet.getRow(rowIndex).getCell(11).setCellValue(t.getPj9());
                sheet.getRow(rowIndex).getCell(12).setCellValue(t.getPj10());
                sheet.getRow(rowIndex).getCell(13).setCellValue(t.getPj11());
                sheet.getRow(rowIndex).getCell(14).setCellValue(t.getPj12());
                sheet.getRow(rowIndex).getCell(15).setCellValue(t.getPj13());
                sheet.getRow(rowIndex).getCell(16).setCellValue(t.getPj14());
                sheet.getRow(rowIndex).getCell(17).setCellValue(t.getPj15());
                sheet.getRow(rowIndex).getCell(18).setCellValue(t.getPj16());
                sheet.getRow(rowIndex).getCell(19).setCellValue(t.getPj17());
                sheet.getRow(rowIndex).getCell(20).setCellValue(t.getRemarks());
                if (t.getCheckDate() != null) {
                    sheet.getRow(rowIndex).getCell(21).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getCheckDate()));
                }
                if (t.getNextCheckDate() != null) {
                    sheet.getRow(rowIndex).getCell(22).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getNextCheckDate()));
                }
                sheet.getRow(rowIndex).getCell(23).setCellValue(t.getProblem());
                sheet.getRow(rowIndex).getCell(24).setCellValue(t.getCon());
                sheet.getRow(rowIndex).getCell(25).setCellValue(t.getYearReportNo());
            } else {
                Row row = sheet.createRow(rowIndex);
                row.createCell(0).setCellValue(t.getUseno());
                row.createCell(1).setCellValue(t.getRegno());
                row.createCell(2).setCellValue(t.getDevno());
                row.createCell(3).setCellValue(t.getPj1());
                row.createCell(4).setCellValue(t.getPj2());
                row.createCell(5).setCellValue(t.getPj3());
                row.createCell(6).setCellValue(t.getPj4());
                row.createCell(7).setCellValue(t.getPj5());
                row.createCell(8).setCellValue(t.getPj6());
                row.createCell(9).setCellValue(t.getPj7());
                row.createCell(10).setCellValue(t.getPj8());
                row.createCell(11).setCellValue(t.getPj9());
                row.createCell(12).setCellValue(t.getPj10());
                row.createCell(13).setCellValue(t.getPj11());
                row.createCell(14).setCellValue(t.getPj12());
                row.createCell(15).setCellValue(t.getPj13());
                row.createCell(16).setCellValue(t.getPj14());
                row.createCell(17).setCellValue(t.getPj15());
                row.createCell(18).setCellValue(t.getPj16());
                row.createCell(19).setCellValue(t.getPj17());
                row.createCell(20).setCellValue(t.getRemarks());
                if (t.getCheckDate() != null) {
                    row.createCell(21).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getCheckDate()));
                }
                if (t.getNextCheckDate() != null) {
                    row.createCell(22).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getNextCheckDate()));
                }
                row.createCell(23).setCellValue(t.getProblem());
                row.createCell(24).setCellValue(t.getCon());
                row.createCell(25).setCellValue(t.getYearReportNo());
            }
            rowIndex++;
        }

        OutputStream out = null;
        String filename = ExcelUtil.encodingFilename("压力管道年检报告批量更新");
        out = new FileOutputStream(ExcelUtil.getAbsoluteFile(filename));
        wb.write(out);
        wb.close();
        out.close();
        return AjaxResult.success(filename);
    }

    /**
     * 同步数据
     */
    @GetMapping("/sync")
    public AjaxResult syncData() {
        this.tReportYlgdService.deleteTReportYlgdByIds();
        this.tReportYlgdService.insertByTSpecdevYlgd();
        this.tReportYlgdService.updateByTSpecdevYlgd();
        return AjaxResult.success();
    }

    /**
     * 第三方数据导入
     *
     * @param file 导入文件
     * @return
     * @throws IOException
     */
    @PostMapping("/importForThird")
    public AjaxResult importForThird(@RequestParam("file") MultipartFile file, @RequestParam("plantCode") String plantCode,
                                     @RequestParam("year") String year) throws IOException, ParseException {
        //获取操作人员ID
        Long userId = getUserId();
        //文件保存至服务器下
        String fileName = file.getOriginalFilename();
        //文件存放路径
        String filePath = RuoYiConfig.getProfile() + "/sems/reportYlrqThird";
        String upload = FileUploadUtils.upload(filePath, file);
        // 文件路径保存至数据库
        TReportThird tReportThird = new TReportThird();
        tReportThird.setPlantCode(plantCode);
        tReportThird.setYear(year);
        tReportThird.setFileName(fileName);
        tReportThird.setFilePath(upload);
        tReportThird.setCreateBy(userId + "");
        tReportThird.setCreateTime(new Date());
        tReportThird.setType("2");
        int i = this.itReportYlrqThirdService.insertTReportThird(tReportThird);
        return AjaxResult.success(i);
    }

    /**
     * 查询压力管道年检报告列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TReportYlgd tReportYlgd) {
        startPage();
        List<TReportYlgd> list = tReportYlgdService.selectTReportYlgdList(tReportYlgd);
        return getDataTable(list);
    }

    /**
     * 导出压力管道年检报告列表
     */
    @PreAuthorize("@ss.hasPermi('sems:reportYlgd:export')")
    @Log(title = "压力管道年检报告", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TReportYlgd tReportYlgd) {
        List<TReportYlgd> list = tReportYlgdService.selectTReportYlgdList(tReportYlgd);
        ExcelUtil<TReportYlgd> util = new ExcelUtil<TReportYlgd>(TReportYlgd.class);
        return util.exportExcel(list, "reportYlgd");
    }

    /**
     * 获取压力管道年检报告详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(tReportYlgdService.selectTReportYlgdById(id));
    }

    /**
     * 新增压力管道年检报告
     */
    @PreAuthorize("@ss.hasPermi('sems:reportYlgd:add')")
    @Log(title = "压力管道年检报告", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TReportYlgd tReportYlgd) {
        return toAjax(tReportYlgdService.insertTReportYlgd(tReportYlgd));
    }

    /**
     * 修改压力管道年检报告
     */
    @PreAuthorize("@ss.hasPermi('sems:reportYlgd:edit')")
    @Log(title = "压力管道年检报告", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TReportYlgd tReportYlgd) {
        tReportYlgdService.updateTReportYlgd(tReportYlgd);
        new Thread(() -> {
            sysnReport(String.valueOf(tReportYlgd.getId()));
        }, "压力管道年检报告修改同步").start();
        return AjaxResult.success();
    }

    /**
     * 同步数据
     *
     * @param ids
     */
    public void sysnReport(Object[] ids) {
        List<SysDictData> con = iSysDictTypeService.selectDictDataByType("REPORT_CON");
        for (Object id : ids
        ) {
            TReportYlgd tReportYlgd = tReportYlgdService.selectTReportYlgdById(Long.parseLong(id.toString()));
            if (StringUtils.isNotEmpty(tReportYlgd.getCon())) {
                for (SysDictData c : con) {
                    if (tReportYlgd.getCon().equals(c.getDictValue())) {
                        tReportYlgd.setCon(c.getDictLabel());
                    }
                }
            }
            tReportYlgdMapper.sysnReport(tReportYlgd);
        }
    }

    /**
     * 同步数据
     *
     * @param id
     */
    public void sysnReport(String id) {
        List<SysDictData> con = iSysDictTypeService.selectDictDataByType("REPORT_CON");

        TReportYlgd tReportYlgd = tReportYlgdService.selectTReportYlgdById(Long.parseLong(id));
        if (StringUtils.isNotEmpty(tReportYlgd.getCon())) {
            for (SysDictData c : con) {
                if (tReportYlgd.getCon().equals(c.getDictValue())) {
                    tReportYlgd.setCon(c.getDictLabel());
                }
            }
        }
        tReportYlgdMapper.sysnReport(tReportYlgd);
    }

    /**
     * 删除压力管道年检报告
     */
    @PreAuthorize("@ss.hasPermi('sems:reportYlgd:remove')")
    @Log(title = "压力管道年检报告", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(tReportYlgdService.deleteTReportYlgdByIds(ids));
    }

    /**
     * 批量导入
     */
    @Log(title = "压力容器批量导入更新", businessType = BusinessType.INSERT)
    @PostMapping("/importForUpdate")
    public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException {
        //获取操作人员ID
        Long userId = getUserId();
        //报错行数统计
        List<Integer> failRow = new ArrayList<Integer>();
        Workbook workbook = ExcelUtils.getWorkBook(file);
        Sheet sheet = workbook.getSheetAt(0);
        List<TReportYlgd> list = new ArrayList<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

        int rowNum = sheet.getPhysicalNumberOfRows();
        int failNumber = 0;
        for (int i = 2; i < rowNum; i++) {
            try {
                logger.info("读取行数：" + i);
                Row row = sheet.getRow(i);
                int cellNum = row.getLastCellNum();
                TReportYlgd entity = new TReportYlgd();
                for (int j = 0; j < cellNum; j++) {
                    Cell cell = row.getCell(j);
                    if (cell == null) {
                        continue;
                    }
                    String cellValue = ExcelUtils.getCellValue(cell);
                    logger.info("cellValue:" + cellValue);
                    if (j == 0) {
                        //使用证
                        entity.setUseno(cellValue);
                    } else if (j == 1) {
                        //注册编号
                        entity.setRegno(cellValue);
                    } else if (j == 2) {
                        //位号
                        entity.setDevno(cellValue);
                    } else if (j == 3) {
                        //1
                        entity.setPj1(cellValue);
                    } else if (j == 4) {
                        //2
                        entity.setPj2(cellValue);
                    } else if (j == 5) {
                        //3
                        entity.setPj3(cellValue);
                    } else if (j == 6) {
                        //4
                        entity.setPj4(cellValue);
                    } else if (j == 7) {
                        //5
                        entity.setPj5(cellValue);
                    } else if (j == 8) {
                        //安全附件仪表及检查情况6
                        entity.setPj6(cellValue);
                    } else if (j == 9) {
                        //安全附件仪表及检查情况7
                        entity.setPj7(cellValue);
                    } else if (j == 10) {
                        //安全附件仪表及检查情况8
                        entity.setPj8(cellValue);
                    } else if (j == 11) {
                        //安全附件仪表及检查情况9
                        entity.setPj9(cellValue);
                    } else if (j == 12) {
                        //安全附件仪表及检查情况10
                        entity.setPj10(cellValue);
                    } else if (j == 13) {
                        //安全附件仪表及检查情况11
                        entity.setPj11(cellValue);
                    } else if (j == 14) {
                        //12
                        entity.setPj12(cellValue);
                    } else if (j == 15) {
                        //13
                        entity.setPj13(cellValue);
                    } else if (j == 16) {
                        //14
                        entity.setPj14(cellValue);
                    } else if (j == 17) {
                        //15
                        entity.setPj15(cellValue);
                    } else if (j == 18) {
                        //16
                        entity.setPj16(cellValue);
                    } else if (j == 19) {
                        //17
                        entity.setPj17(cellValue);
                    } else if (j == 20) {
                        //备注
                        entity.setRemarks(cellValue);
                    } else if (j == 21) {
                        //检查日期
                        entity.setCheckDate(cellValue != null ? new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue) : null);
                    } else if (j == 22) {
                        //下次年度检查日期
                        entity.setNextCheckDate(cellValue != null ? new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue) : null);
                    } else if (j == 23) {
                        //问题及处理
                        entity.setProblem(cellValue);
                    } else if (j == 24) {
                        //检查结论
                        entity.setCon(cellValue);
                    } else if (j == 25) {
                        //年检报告编号
                        entity.setYearReportNo(cellValue);
                    }
                }
                entity.setCreaterCode(userId);
                logger.info("entity:" + entity);
                list.add(entity);
            } catch (Exception e) {
                failNumber++;
                logger.info("e:" + JSON.toJSONString(e));
                failRow.add(i + 1);
            }
        }
        int successNumber = 0;
        int failNum = 0;
        CopyOnWriteArrayList<String> ids = new CopyOnWriteArrayList();
        for (TReportYlgd t : list
        ) {
            failNum++;
            try {
                //根据使用证、注册编号、位号，进行数据更新
                this.tReportYlgdService.updateForImport(t);
                successNumber++;
                ids.add(t.getId().toString());
            } catch (Exception e) {
                failNumber++;
                logger.info("e:" + e);
                failRow.add(failNum + 1);
            }
        }
        new Thread(() -> {
            sysnReport(ids.toArray());
        }, "压力管道年检报告修改同步").start();
        logger.info("list:" + JSON.toJSONString(list));
        logger.info("successNumber:" + String.valueOf(successNumber));
        logger.info("failNumber:" + String.valueOf(failNumber));
        logger.info("failRow:" + String.valueOf(failRow));
        return AjaxResult.success(String.valueOf(successNumber), failRow);
    }
}
