| | |
| | | import cn.hutool.core.lang.UUID; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.SignatureImageUtil; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.inspect.util.HackLoopTableRenderPolicy; |
| | | import com.ruoyi.process.dto.ProcessReportDto; |
| | |
| | | import com.ruoyi.process.service.ProcessReportService; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.xwpf.usermodel.*; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Resource |
| | | private ProcessReportMapper processReportMapper; |
| | | @Value("${file.path}") |
| | | private String imgUrl; |
| | | |
| | | @Resource |
| | | private UserMapper userMapper; |
| | | |
| | | @Override |
| | | public IPage<ProcessReport> pageProcessReport(Page page, ProcessReport processReport) { |
| | | IPage<ProcessReport> processReportIPage = processReportMapper.pageProcessReport(page, QueryWrappers.queryWrappers(processReport)); |
| | | public IPage<ProcessReportDto> pageProcessReport(Page page, ProcessReportDto processReport) { |
| | | IPage<ProcessReportDto> processReportIPage = processReportMapper.pageProcessReport(page, QueryWrappers.queryWrappers(processReport)); |
| | | |
| | | return processReportIPage; |
| | | } |
| | | |
| | | @Override |
| | | public void exportProcessReport(ProcessReportDto dto, HttpServletResponse response) { |
| | | List<ProcessReport> processReports = processReportMapper.exportProcessReport(); |
| | | List<ProcessReportDto> processReports = processReportMapper.exportProcessReport(); |
| | | for (ProcessReportDto processReport : processReports) { |
| | | // 发送人生成签名图片 |
| | | processReport.setSendUserRender(StringUtils.isNotBlank(processReport.getSendUserUrl()) |
| | | ? Pictures.ofLocal(imgUrl + "/" + processReport.getSendUserUrl()).create() : null); |
| | | |
| | | // 签收人生成图片 |
| | | processReport.setSignatoryRender(StringUtils.isNotBlank(processReport.getSignatory()) |
| | | ? Pictures.ofStream(SignatureImageUtil.saveImageToFile(processReport.getSignatory())).create() : null); |
| | | } |
| | | |
| | | // 获取路径 |
| | | InputStream inputStream = this.getClass().getResourceAsStream("/static/report-deal.docx"); |
| | | Configure configure = Configure.builder() |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导出失败"); |