package com.yuanchu.mom.service.impl;
import cn.hutool.core.lang.UUID;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.config.ConfigureBuilder;
import com.deepoove.poi.data.*;
import com.deepoove.poi.data.style.*;
import com.yuanchu.mom.common.PrintChina;
import com.yuanchu.mom.exception.ErrorException;
import com.yuanchu.mom.mapper.ManageRecordIntervalsTotalMapper;
import com.yuanchu.mom.pojo.*;
import com.yuanchu.mom.mapper.ManageRecordIntervalsMapper;
import com.yuanchu.mom.service.ManageRecordIntervalsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.utils.QueryWrappers;
import org.apache.commons.io.IOUtils;
import org.apache.poi.openxml4j.util.ZipSecureFile;
import org.apache.poi.xwpf.usermodel.*;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STMerge;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
/**
*
* 文件定期审查记录 服务实现类
*
*
* @author
* @since 2024-11-13 10:54:31
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class ManageRecordIntervalsServiceImpl extends ServiceImpl implements ManageRecordIntervalsService {
@Resource
private ManageRecordIntervalsMapper manageRecordIntervalsMapper;
@Resource
private ManageRecordIntervalsTotalMapper manageRecordIntervalsTotalMapper;
@Value("${wordUrl}")
private String wordUrl;
@Override
public Map pageManageRecordIntervals(Page page, ManageRecordIntervals manageRecordIntervals) {
Map map = new HashMap<>();
map.put("head", PrintChina.printChina(ManageRecordIntervals.class));
map.put("body", manageRecordIntervalsMapper.pageManageRecordIntervals(page, QueryWrappers.queryWrappers(manageRecordIntervals)));
return map;
}
@Override
public String exportOutManageRecordIntervals(ManageRecordIntervals manageRecordIntervals, HttpServletResponse response) {
List manageRecordIntervalsList = manageRecordIntervalsMapper.pageManageRecordIntervals(new Page(-1, -1), QueryWrappers.queryWrappers(manageRecordIntervals)).getRecords();
//生成检验报告发放登记表
InputStream inputStream = this.getClass().getResourceAsStream("/static/intervals-deal.docx");
ConfigureBuilder builder = Configure.builder();
builder.useSpringEL(true);
List