| | |
| | | if (value == null) { |
| | | value = ""; |
| | | } |
| | | // if ("lx_flow_opinion".equals(this.replaceKey) && "opinion".equals(fieldNames[j])) { |
| | | // //将流程节点处理人加到意见栏中 |
| | | // value = "[" + map.get("actual_person") + "] " + value; |
| | | // } |
| | | xwpfRun.setText(value.toString(), 0); |
| | | if ("lx_flow_opinion".equals(this.replaceKey) && "opinion".equals(fieldNames[j]) && !StringUtils.isEmpty(map.get("sign_attachment_uuid"))) { |
| | | //意见框 插入签名图片到单元格右下角位置 |
| | | xwpfParagraph = cell.addParagraph(); |
| | | xwpfParagraph.setAlignment(ParagraphAlignment.RIGHT); |
| | | XWPFRun run = xwpfParagraph.createRun(); |
| | | String signAttachmentBase64 = map.get("sign_attachment_uuid").toString(); |
| | | //将base64转换字节流 |
| | | byte[] bytes = Base64.getDecoder().decode(signAttachmentBase64.split(",")[1]); |
| | | //将字节流转换为输入流 |
| | | InputStream inputStream = new ByteArrayInputStream(bytes); |
| | | try { |
| | | //换行插入图片 |
| | | run.addPicture(inputStream, XWPFDocument.PICTURE_TYPE_PNG, "sign.png", Units.toEMU(50), Units.toEMU(20)); |
| | | inputStream.close(); |
| | | } catch (InvalidFormatException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | if ("lx_flow_opinion".equals(this.replaceKey) && "opinion".equals(fieldNames[j])) { |
| | | if (!StringUtils.isEmpty(map.get("sign_attachment_uuid"))) { |
| | | //意见框 插入签名图片到单元格右下角位置 |
| | | xwpfParagraph = cell.addParagraph(); |
| | | xwpfParagraph.setAlignment(ParagraphAlignment.RIGHT); |
| | | XWPFRun run = xwpfParagraph.createRun(); |
| | | String signAttachmentBase64 = map.get("sign_attachment_uuid").toString(); |
| | | //将base64转换字节流 |
| | | byte[] bytes = Base64.getDecoder().decode(signAttachmentBase64.split(",")[1]); |
| | | //将字节流转换为输入流 |
| | | InputStream inputStream = new ByteArrayInputStream(bytes); |
| | | try { |
| | | //换行插入图片 |
| | | run.addPicture(inputStream, XWPFDocument.PICTURE_TYPE_PNG, "sign.png", Units.toEMU(50), Units.toEMU(20)); |
| | | run.addBreak(); |
| | | run.setText("" + map.get("deal_time").toString().substring(0, 16)); |
| | | inputStream.close(); |
| | | } catch (InvalidFormatException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } else { |
| | | xwpfParagraph = cell.addParagraph(); |
| | | xwpfParagraph.setAlignment(ParagraphAlignment.RIGHT); |
| | | XWPFRun run = xwpfParagraph.createRun(); |
| | | run.setText((String) map.get("actual_person")); |
| | | run.addBreak(); |
| | | run.setText(map.get("deal_time").toString().substring(0, 16)); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |