工作组变更
This commit is contained in:
+24
-2
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user