工作组变更

This commit is contained in:
梁琦涛
2021-09-17 13:34:25 +08:00
parent 182a19e5c5
commit 426c1543aa
4 changed files with 99 additions and 36 deletions
@@ -101,8 +101,19 @@ public class EmailSendMsgHandle implements ISendMsgHandle {
helper.setText(es_content, true);
for(String file :fileList) {
if(!StringUtils.isBlank(file)) {
FileSystemResource filePath = new FileSystemResource(new File(file));
helper.addAttachment(file, filePath);
File newFile = new File(file);
FileSystemResource filePath = new FileSystemResource(newFile);
String fileName = newFile.getName();
if(fileName.lastIndexOf(".") == -1 || fileName.lastIndexOf(".") == 0){
return;
}
if(fileName.contains("_")){
int a = fileName.lastIndexOf("_");
fileName = fileName.substring(0,a) + fileName.substring(fileName.lastIndexOf("."));
}else{
fileName = fileName.substring(fileName.lastIndexOf("."));
}
helper.addAttachment(fileName, filePath);
}
}
mailSender.send(message);
@@ -112,4 +123,15 @@ public class EmailSendMsgHandle implements ISendMsgHandle {
e.printStackTrace();
}
}
public static void main(String[] args) {
String str ="/a/b/c_daswqe.xml";
List<String> l = Arrays.asList(str.split("/"));
String f = l.get(l.size()-1);
System.out.println(f);
int a = f.lastIndexOf("_");
String f1 = f.substring(0,a);
System.out.println(f1);
}
}