提交 bc3b3633 作者: 洪东保

debug

父级 e75633ba
...@@ -74,6 +74,7 @@ public class MeetingInfoController { ...@@ -74,6 +74,7 @@ public class MeetingInfoController {
/** /**
* 重新生成 * 重新生成
*
* @param vo * @param vo
* @return * @return
*/ */
...@@ -99,7 +100,7 @@ public class MeetingInfoController { ...@@ -99,7 +100,7 @@ public class MeetingInfoController {
String recordXml = vo.getRecordXml(); String recordXml = vo.getRecordXml();
String recordContent = vo.getRecordContent(); String recordContent = vo.getRecordContent();
try { try {
if(StringUtils.isNotEmpty(recordXml)){ if (StringUtils.isNotEmpty(recordXml)) {
//xml转json,用于前端的表单回显 //xml转json,用于前端的表单回显
String xml = minioUtils.getFileText(recordXml); String xml = minioUtils.getFileText(recordXml);
String json = convertXmlToJSON(xml); String json = convertXmlToJSON(xml);
...@@ -109,8 +110,8 @@ public class MeetingInfoController { ...@@ -109,8 +110,8 @@ public class MeetingInfoController {
e.printStackTrace(); e.printStackTrace();
} }
try { try {
if(StringUtils.isNotEmpty(recordContent)){ if (StringUtils.isNotEmpty(recordContent)) {
vo.setRecordContent(minioUtils.getFileText(recordContent.replaceAll(fileDownloadPath,""))); vo.setRecordContent(minioUtils.getFileText(recordContent.replaceAll(fileDownloadPath, "")));
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -122,7 +123,7 @@ public class MeetingInfoController { ...@@ -122,7 +123,7 @@ public class MeetingInfoController {
* 导出转写原文 * 导出转写原文
*/ */
@PostMapping("/exportMeetingRecord") @PostMapping("/exportMeetingRecord")
public void exportMeetingRecord(@RequestBody MeetingInfoVO vo, HttpServletResponse response){ public void exportMeetingRecord(@RequestBody MeetingInfoVO vo, HttpServletResponse response) {
try { try {
MeetingInfo meetingInfo = meetingInfoService.getById(vo.getId()); MeetingInfo meetingInfo = meetingInfoService.getById(vo.getId());
String content = minioUtils.getFileText(meetingInfo.getRecordContent()); String content = minioUtils.getFileText(meetingInfo.getRecordContent());
...@@ -157,19 +158,19 @@ public class MeetingInfoController { ...@@ -157,19 +158,19 @@ public class MeetingInfoController {
* 导出会议纪要(本地下载) * 导出会议纪要(本地下载)
*/ */
@PostMapping("/downloadMeetingMinutes") @PostMapping("/downloadMeetingMinutes")
public void downloadMeetingMinutes(@RequestBody MeetingInfoVO vo, HttpServletResponse response){ public void downloadMeetingMinutes(@RequestBody MeetingInfoVO vo, HttpServletResponse response) {
try { try {
MeetingInfo meetingInfo = meetingInfoService.getById(vo.getId()); MeetingInfo meetingInfo = meetingInfoService.getById(vo.getId());
String xml = minioUtils.getFileText(meetingInfo.getRecordXml()); String xml = minioUtils.getFileText(meetingInfo.getRecordXml());
Map<String, Object> dataModel = convertXmlToMap(xml); Map<String, Object> dataModel = convertXmlToMap(xml);
//追加参会人员信息 //追加参会人员信息
Map<String,Object> participantsMap = new ConcurrentHashMap<>(); Map<String, Object> participantsMap = new ConcurrentHashMap<>();
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String meetingDate = meetingInfo.getStartTime().toLocalDate().format(df); String meetingDate = meetingInfo.getStartTime().toLocalDate().format(df);
participantsMap.put("meeting_date",meetingDate); participantsMap.put("meeting_date", meetingDate);
participantsMap.put("meeting_location","线上腾讯会议"); participantsMap.put("meeting_location", "线上腾讯会议");
participantsMap.put("meeting_participants", meetingInfo.getParticipantUsers()); participantsMap.put("meeting_participants", meetingInfo.getParticipantUsers());
participantsMap.put("meeting_host",meetingInfo.getHost()); participantsMap.put("meeting_host", meetingInfo.getHost());
dataModel.putAll(participantsMap); dataModel.putAll(participantsMap);
MeetingRecordTemplate meetingRecordTemplate = meetingRecordTemplateMapper.selectById(meetingInfo.getTemplateId()); MeetingRecordTemplate meetingRecordTemplate = meetingRecordTemplateMapper.selectById(meetingInfo.getTemplateId());
...@@ -180,7 +181,7 @@ public class MeetingInfoController { ...@@ -180,7 +181,7 @@ public class MeetingInfoController {
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "utf8")); response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "utf8"));
XWPFTemplate template; XWPFTemplate template;
try (InputStream is = minioUtils.getFile(meetingRecordTemplate.getTemplate());OutputStream os = response.getOutputStream()) { try (InputStream is = minioUtils.getFile(meetingRecordTemplate.getTemplate()); OutputStream os = response.getOutputStream()) {
template = XWPFTemplate.compile(is).render(dataModel); template = XWPFTemplate.compile(is).render(dataModel);
template.write(os); template.write(os);
} catch (IOException e) { } catch (IOException e) {
...@@ -198,25 +199,25 @@ public class MeetingInfoController { ...@@ -198,25 +199,25 @@ public class MeetingInfoController {
* 导出会议纪要(推送邮件) * 导出会议纪要(推送邮件)
*/ */
@PostMapping("/pushMeetingMinutes") @PostMapping("/pushMeetingMinutes")
public R exportMeetingMinutes(@RequestBody MeetingInfoVO vo, HttpServletResponse response){ public R exportMeetingMinutes(@RequestBody MeetingInfoVO vo, HttpServletResponse response) {
try { try {
MeetingInfo meetingInfo = meetingInfoService.getById(vo.getId()); MeetingInfo meetingInfo = meetingInfoService.getById(vo.getId());
String xml = minioUtils.getFileText(meetingInfo.getRecordXml()); String xml = minioUtils.getFileText(meetingInfo.getRecordXml());
Map<String, Object> dataModel = convertXmlToMap(xml); Map<String, Object> dataModel = convertXmlToMap(xml);
//追加参会人员信息 //追加参会人员信息
Map<String,Object> participantsMap = new ConcurrentHashMap<>(); Map<String, Object> participantsMap = new ConcurrentHashMap<>();
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String meetingDate = meetingInfo.getStartTime().toLocalDate().format(df); String meetingDate = meetingInfo.getStartTime().toLocalDate().format(df);
participantsMap.put("meeting_date",meetingDate); participantsMap.put("meeting_date", meetingDate);
participantsMap.put("meeting_location","线上腾讯会议"); participantsMap.put("meeting_location", "线上腾讯会议");
participantsMap.put("meeting_participants", meetingInfo.getParticipantUsers()); participantsMap.put("meeting_participants", meetingInfo.getParticipantUsers());
participantsMap.put("meeting_host",meetingInfo.getHost()); participantsMap.put("meeting_host", meetingInfo.getHost());
dataModel.putAll(participantsMap); dataModel.putAll(participantsMap);
MeetingRecordTemplate meetingRecordTemplate = meetingRecordTemplateMapper.selectById(meetingInfo.getTemplateId()); MeetingRecordTemplate meetingRecordTemplate = meetingRecordTemplateMapper.selectById(meetingInfo.getTemplateId());
XWPFTemplate template; XWPFTemplate template;
byte[] meetingMinutesBytes; byte[] meetingMinutesBytes;
try (InputStream is = minioUtils.getFile(meetingRecordTemplate.getTemplate());ByteArrayOutputStream baos = new ByteArrayOutputStream()) { try (InputStream is = minioUtils.getFile(meetingRecordTemplate.getTemplate()); ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
template = XWPFTemplate.compile(is).render(dataModel); template = XWPFTemplate.compile(is).render(dataModel);
template.write(baos); template.write(baos);
meetingMinutesBytes = baos.toByteArray(); meetingMinutesBytes = baos.toByteArray();
...@@ -226,7 +227,7 @@ public class MeetingInfoController { ...@@ -226,7 +227,7 @@ public class MeetingInfoController {
List<EmailPush.Attachment> attachments = new ArrayList<>(); List<EmailPush.Attachment> attachments = new ArrayList<>();
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMdd"); DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMdd");
EmailPush.Attachment attachment = EmailPush.Attachment.builder().name(meetingInfo.getSubject()+"会议纪要_" + fmt.format(meetingInfo.getStartTime())).bytes(meetingMinutesBytes).build(); EmailPush.Attachment attachment = EmailPush.Attachment.builder().name(meetingInfo.getSubject() + "会议纪要_" + fmt.format(meetingInfo.getStartTime())).bytes(meetingMinutesBytes).build();
attachments.add(attachment); attachments.add(attachment);
String hostUid = meetingInfo.getHostUid(); String hostUid = meetingInfo.getHostUid();
String userCode = userIdMapper.getWidByTid(hostUid); String userCode = userIdMapper.getWidByTid(hostUid);
...@@ -261,10 +262,10 @@ public class MeetingInfoController { ...@@ -261,10 +262,10 @@ public class MeetingInfoController {
Map<?, ?> xmlMap = xmlMapper.readValue(xml, Map.class); Map<?, ?> xmlMap = xmlMapper.readValue(xml, Map.class);
// 转换为更标准的 Map<String, Object> // 转换为更标准的 Map<String, Object>
Map<String,Object> map = objectMapper.convertValue(xmlMap, Map.class); Map<String, Object> map = objectMapper.convertValue(xmlMap, Map.class);
//特殊处理map格式 //特殊处理map格式
for (Map.Entry<String, Object> entry : map.entrySet()) { for (Map.Entry<String, Object> entry : map.entrySet()) {
Map<String,Object> value = (Map<String, Object>) entry.getValue(); Map<String, Object> value = (Map<String, Object>) entry.getValue();
Object realValue = value.get(""); Object realValue = value.get("");
entry.setValue(realValue); entry.setValue(realValue);
} }
...@@ -280,15 +281,15 @@ public class MeetingInfoController { ...@@ -280,15 +281,15 @@ public class MeetingInfoController {
// 正确获取节点和属性的方式 // 正确获取节点和属性的方式
List<Map> list = new ArrayList<>(); List<Map> list = new ArrayList<>();
Iterator<String> iterator = rootNode.fieldNames(); Iterator<String> iterator = rootNode.fieldNames();
while (iterator.hasNext()){ while (iterator.hasNext()) {
String tagName = iterator.next(); String tagName = iterator.next();
JsonNode subNode = rootNode.path(tagName); JsonNode subNode = rootNode.path(tagName);
String displayName = subNode.path("label").asText(); String displayName = subNode.path("label").asText();
String content = subNode.path("").asText(); String content = subNode.path("").asText();
list.add(new HashMap(){{ list.add(new HashMap() {{
put("key",tagName); put("key", tagName);
put("keyName",displayName); put("keyName", displayName);
put("value",content); put("value", content);
}}); }});
} }
// 构建JSON对象 // 构建JSON对象
......
...@@ -243,12 +243,14 @@ public class EmailSender { ...@@ -243,12 +243,14 @@ public class EmailSender {
processLogService.log(meetingId,subMeetingId,"【邮件推送异常】:收件人工号不能为空"); processLogService.log(meetingId,subMeetingId,"【邮件推送异常】:收件人工号不能为空");
continue; continue;
} }
// TODO
String email_content_template = String.valueOf(redisUtils.get("EMAIL_CONTENT_TEMPLATE")); String email_content_template = String.valueOf(redisUtils.get("EMAIL_CONTENT_TEMPLATE"));
long expireTimestamp = ZonedDateTime.now().plusDays(2).toInstant().toEpochMilli(); long expireTimestamp = ZonedDateTime.now().plusDays(2).toInstant().toEpochMilli();
body.content = MessageFormat.format(email_content_template,meetingInstanceId,toUserCode,String.valueOf(expireTimestamp)); body.content = MessageFormat.format(email_content_template,meetingInstanceId,toUserCode,String.valueOf(expireTimestamp));
}else{ }else{
isSent = false; isSent = false;
processLogService.log(meetingId,subMeetingId,"【邮件推送异常】:邮件模板未设置"); processLogService.log(meetingId,subMeetingId,"【邮件推送异常】:邮件模板未设置");
retryCount.getAndIncrement();
continue; continue;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论