|
@@ -2,9 +2,11 @@ package com.nokia.dingtalk_auto.service;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
+import java.text.DateFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Calendar;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
@@ -76,17 +78,68 @@ public class TslTaskService {
|
|
|
}
|
|
|
|
|
|
public void sendDingTalkMsg(String day) throws DingTalkApiException {
|
|
|
+ DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
String localPath = localDir + "/" + day;
|
|
|
File[] files = new File(localPath).listFiles();
|
|
|
+ StringBuffer stringBuffer = new StringBuffer();
|
|
|
+ // 分开发送,保证发送文件的顺序
|
|
|
+ for (File file : files) {
|
|
|
+ if (file.getName().toLowerCase().endsWith("-1-投诉率.png")) {
|
|
|
+ String mediaId = tslTaskDingTalkUtil.upload(file.getAbsolutePath(), "image");
|
|
|
+ tslTaskDingTalkUtil.sendImageMsgWithRobot(mediaId);
|
|
|
+ stringBuffer.append(dateFormat.format(new Date())).append(file.getName()).append("发送成功==");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (File file : files) {
|
|
|
+ if (file.getName().toLowerCase().endsWith("-2-重复投诉率.png")) {
|
|
|
+ String mediaId = tslTaskDingTalkUtil.upload(file.getAbsolutePath(), "image");
|
|
|
+ tslTaskDingTalkUtil.sendImageMsgWithRobot(mediaId);
|
|
|
+ stringBuffer.append(dateFormat.format(new Date())).append(file.getName()).append("发送成功==");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (File file : files) {
|
|
|
+ if (file.getName().toLowerCase().endsWith("-3-超时工单.png")) {
|
|
|
+ String mediaId = tslTaskDingTalkUtil.upload(file.getAbsolutePath(), "image");
|
|
|
+ tslTaskDingTalkUtil.sendImageMsgWithRobot(mediaId);
|
|
|
+ stringBuffer.append(dateFormat.format(new Date())).append(file.getName()).append("发送成功==");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (File file : files) {
|
|
|
+ if (file.getName().toLowerCase().endsWith("-4-处理时长.png")) {
|
|
|
+ String mediaId = tslTaskDingTalkUtil.upload(file.getAbsolutePath(), "image");
|
|
|
+ tslTaskDingTalkUtil.sendImageMsgWithRobot(mediaId);
|
|
|
+ stringBuffer.append(dateFormat.format(new Date())).append(file.getName()).append("发送成功==");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (File file : files) {
|
|
|
+ if (file.getName().toLowerCase().endsWith("-5-满意率.png")) {
|
|
|
+ String mediaId = tslTaskDingTalkUtil.upload(file.getAbsolutePath(), "image");
|
|
|
+ tslTaskDingTalkUtil.sendImageMsgWithRobot(mediaId);
|
|
|
+ stringBuffer.append(dateFormat.format(new Date())).append(file.getName()).append("发送成功==");
|
|
|
+ }
|
|
|
+ }
|
|
|
for (File file : files) {
|
|
|
- if (file.getName().toLowerCase().endsWith(".png")) {
|
|
|
+ if (file.getName().toLowerCase().endsWith("-6-解决率.png")) {
|
|
|
String mediaId = tslTaskDingTalkUtil.upload(file.getAbsolutePath(), "image");
|
|
|
tslTaskDingTalkUtil.sendImageMsgWithRobot(mediaId);
|
|
|
- } else if (file.getName().toLowerCase().equals("投诉清单各地市投诉率" + day + ".xlsx")) {
|
|
|
+ stringBuffer.append(dateFormat.format(new Date())).append(file.getName()).append("发送成功==");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (File file : files) {
|
|
|
+ if (file.getName().toLowerCase().endsWith("-7-响应率.png")) {
|
|
|
+ String mediaId = tslTaskDingTalkUtil.upload(file.getAbsolutePath(), "image");
|
|
|
+ tslTaskDingTalkUtil.sendImageMsgWithRobot(mediaId);
|
|
|
+ stringBuffer.append(dateFormat.format(new Date())).append(file.getName()).append("发送成功==");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (File file : files) {
|
|
|
+ if (file.getName().toLowerCase().equals("投诉清单各地市投诉率" + day + ".xlsx")) {
|
|
|
String mediaId = tslTaskDingTalkUtil.upload(file.getAbsolutePath(), "file");
|
|
|
tslTaskDingTalkUtil.sendFileMsgWithRobot(mediaId, file.getName());
|
|
|
+ stringBuffer.append(dateFormat.format(new Date())).append(file.getName()).append("发送成功==");
|
|
|
}
|
|
|
}
|
|
|
+ remindDingTalkUtil.sendTextMsgWithRobot(stringBuffer.toString());
|
|
|
}
|
|
|
|
|
|
/**
|