| | |
| | | package com.yuanchu.mom.utils; |
| | | |
| | | import cn.hutool.core.lang.UUID; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.config.Configure; |
| | | import com.deepoove.poi.config.ConfigureBuilder; |
| | |
| | | import com.yuanchu.mom.exception.ErrorException; |
| | | import com.yuanchu.mom.mapper.InsOrderFileMapper; |
| | | import com.yuanchu.mom.mapper.InsOrderMapper; |
| | | import com.yuanchu.mom.mapper.InsSampleMapper; |
| | | import com.yuanchu.mom.pojo.InsOrder; |
| | | import com.yuanchu.mom.pojo.InsOrderFile; |
| | | import com.yuanchu.mom.pojo.InsSample; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.openxml4j.util.ZipSecureFile; |
| | |
| | | |
| | | @Resource |
| | | InsOrderMapper insOrderMapper; |
| | | |
| | | @Resource |
| | | InsSampleMapper insSampleMapper; |
| | | |
| | | public void getFuSheWord1(String sonLaboratory, InsOrderFile insOrderFile) { |
| | | //读取excel文件内容 |
| | |
| | | default: |
| | | System.out.print("NULL\t"); |
| | | } |
| | | } |
| | | else { |
| | | } else { |
| | | switch (cell.getCellType()) { |
| | | case STRING: |
| | | if (StringUtils.isNotEmpty(s)) { |
| | |
| | | } |
| | | // 输出到文件 |
| | | try { |
| | | InsOrder insOrder = insOrderMapper.selectById(insOrderFile.getInsOrderId()); |
| | | InsSample insSample = insSampleMapper.selectById(insOrderFile.getInsSampleId()); |
| | | String[] split = insOrderFile.getFileName().split("\\."); |
| | | String name = insOrderFile.getFileName().substring(0, (insOrderFile.getFileName().length() - split[split.length - 1].length())); |
| | | FileOutputStream out = new FileOutputStream(wordUrl + "/" + insOrder.getEntrustCode() + "&" + sonLaboratory + name + "解析的辐射站点报告.docx"); |
| | | FileOutputStream out = new FileOutputStream(wordUrl + "/" + UUID.randomUUID() + "_" + insSample.getSampleCode() + "&" + sonLaboratory + name + "解析的辐射站点报告.docx"); |
| | | document.write(out); |
| | | out.close(); |
| | | document.close(); |
| | | InsOrderFile orderFile = new InsOrderFile(); |
| | | orderFile.setInsOrderId(insOrderFile.getInsOrderId()); |
| | | orderFile.setFileUrl(insOrder.getEntrustCode() + "&" + sonLaboratory + name + "解析的辐射站点报告.docx"); |
| | | orderFile.setInsSampleId(insOrderFile.getInsSampleId()); |
| | | orderFile.setFileUrl(UUID.randomUUID() + "_" + insSample.getSampleCode() + "&" + sonLaboratory + name + "解析的辐射站点报告.docx"); |
| | | orderFile.setType(2); |
| | | orderFile.setFileName(insOrder.getEntrustCode() + "&" + sonLaboratory + name + "解析的辐射站点报告.docx"); |
| | | orderFile.setFileName(insSample.getSampleCode() + "&" + sonLaboratory + name + "解析的辐射站点报告.docx"); |
| | | orderFile.setSonLaboratory(sonLaboratory); |
| | | insOrderFileMapper.insert(orderFile); |
| | | } catch (IOException e) { |
| | |
| | | XWPFParagraph paragraph18 = table1.getRow(1).getCell(0).getParagraphArray(0); |
| | | XWPFRun run18 = paragraph18.createRun(); |
| | | run18.setText("频段: "+result1+"MHz "+"下倾角"+result); |
| | | |
| | | |
| | | |
| | | List<String> collect = Arrays.stream(split).collect(Collectors.toList()); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | XWPFParagraph paragraph3 = table.getRow(0).getCell(3).getParagraphArray(0); |
| | | XWPFRun run3 = paragraph3.createRun(); |
| | | run3.setText(bz.get(s2).toString()); |
| | |
| | | |
| | | // 输出到文件 |
| | | try { |
| | | InsOrder insOrder = insOrderMapper.selectById(insOrderFile.getInsOrderId()); |
| | | InsSample insSample = insSampleMapper.selectById(insOrderFile.getInsSampleId()); |
| | | String[] split = insOrderFile.getFileName().split("\\."); |
| | | String name = insOrderFile.getFileName().replace("#","&").substring(0, (insOrderFile.getFileName().length() - split[split.length - 1].length())); |
| | | FileOutputStream out = new FileOutputStream(wordUrl + "/" + insOrder.getEntrustCode() + "&" + sonLaboratory + name + "解析的辐射站点报告.docx"); |
| | | FileOutputStream out = new FileOutputStream(wordUrl + "/" + UUID.randomUUID() + "_" + insSample.getSampleCode() + "&" + sonLaboratory + name + "解析的辐射站点报告.docx"); |
| | | document.write(out); |
| | | out.close(); |
| | | document.close(); |
| | | InsOrderFile orderFile = new InsOrderFile(); |
| | | orderFile.setInsOrderId(insOrderFile.getInsOrderId()); |
| | | orderFile.setFileUrl(insOrder.getEntrustCode() + "&" + sonLaboratory + name + "解析的辐射站点报告.docx"); |
| | | orderFile.setInsSampleId(insOrderFile.getInsSampleId()); |
| | | orderFile.setFileUrl(UUID.randomUUID() + "_" + insSample.getSampleCode() + "&" + sonLaboratory + name + "解析的辐射站点报告.docx"); |
| | | orderFile.setType(2); |
| | | orderFile.setFileName(insOrder.getEntrustCode() + "&" + sonLaboratory + name + "解析的辐射站点报告.docx"); |
| | | orderFile.setFileName(insSample.getSampleCode() + "&" + sonLaboratory + name + "解析的辐射站点报告.docx"); |
| | | orderFile.setSonLaboratory(sonLaboratory); |
| | | insOrderFileMapper.insert(orderFile); |
| | | } catch (IOException e) { |