|
@@ -1,87 +1,87 @@
|
|
|
-package com.simuwang;
|
|
|
-
|
|
|
-import cn.hutool.core.collection.ListUtil;
|
|
|
-import cn.hutool.core.date.DateUtil;
|
|
|
-import com.simuwang.base.common.conts.DateConst;
|
|
|
-import com.simuwang.base.common.util.DateUtils;
|
|
|
-import com.simuwang.base.pojo.dto.MailboxInfoDTO;
|
|
|
-import com.simuwang.daq.service.EmailParseApiService;
|
|
|
-import com.simuwang.daq.service.EmailParseService;
|
|
|
-import org.junit.jupiter.api.Test;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.boot.test.context.SpringBootTest;
|
|
|
-
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-
|
|
|
-@SpringBootTest(classes = Application.class)
|
|
|
-public class ApplicationTest {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private EmailParseService emailParseService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private EmailParseApiService emailParseApiService;
|
|
|
-
|
|
|
- @Test
|
|
|
- public void test() {
|
|
|
- MailboxInfoDTO emailInfoDTO = this.buildMailbox("", "");
|
|
|
+//package com.simuwang;
|
|
|
//
|
|
|
-// emailInfoDTO.setAccount("jjpj_test");
|
|
|
-// emailInfoDTO.setPassword("shzq#919");
|
|
|
-// emailInfoDTO.setHost("mail.shzq.com");
|
|
|
+//import cn.hutool.core.collection.ListUtil;
|
|
|
+//import cn.hutool.core.date.DateUtil;
|
|
|
+//import com.simuwang.base.common.conts.DateConst;
|
|
|
+//import com.simuwang.base.common.util.DateUtils;
|
|
|
+//import com.simuwang.base.pojo.dto.MailboxInfoDTO;
|
|
|
+//import com.simuwang.daq.service.EmailParseApiService;
|
|
|
+//import com.simuwang.daq.service.EmailParseService;
|
|
|
+//import org.junit.jupiter.api.Test;
|
|
|
+//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+//import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+//
|
|
|
+//import java.util.ArrayList;
|
|
|
+//import java.util.Date;
|
|
|
+//
|
|
|
+//@SpringBootTest(classes = Application.class)
|
|
|
+//public class ApplicationTest {
|
|
|
+//
|
|
|
+// @Autowired
|
|
|
+// private EmailParseService emailParseService;
|
|
|
+//
|
|
|
+// @Autowired
|
|
|
+// private EmailParseApiService emailParseApiService;
|
|
|
+//
|
|
|
+// @Test
|
|
|
+// public void test() {
|
|
|
+// MailboxInfoDTO emailInfoDTO = this.buildMailbox("", "");
|
|
|
+////
|
|
|
+//// emailInfoDTO.setAccount("jjpj_test");
|
|
|
+//// emailInfoDTO.setPassword("shzq#919");
|
|
|
+//// emailInfoDTO.setHost("mail.shzq.com");
|
|
|
+//// emailInfoDTO.setPort("993");
|
|
|
+//// emailInfoDTO.setProtocol("imap");
|
|
|
+//
|
|
|
+// Date startDate = DateUtil.parse("2024-10-10 15:00:00", DateConst.YYYY_MM_DD_HH_MM_SS);
|
|
|
+// Date endDate = DateUtil.parse("2024-10-10 16:40:00", DateConst.YYYY_MM_DD_HH_MM_SS);
|
|
|
+// try {
|
|
|
+// emailParseService.parseEmail(emailInfoDTO, startDate, endDate);
|
|
|
+// } catch (Exception e) {
|
|
|
+// throw new RuntimeException(e);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Test
|
|
|
+// public void reportTest() {
|
|
|
+// MailboxInfoDTO emailInfoDTO = this.buildMailbox("x", "x");
|
|
|
+// Date startDate = DateUtil.parse("2024-10-15 15:10:30", DateConst.YYYY_MM_DD_HH_MM_SS);
|
|
|
+// Date endDate = DateUtil.parse("2024-10-15 17:50:30", DateConst.YYYY_MM_DD_HH_MM_SS);
|
|
|
+// try {
|
|
|
+// emailParseService.parseEmail(emailInfoDTO, startDate, endDate);
|
|
|
+// } catch (Exception e) {
|
|
|
+// throw new RuntimeException(e);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Test
|
|
|
+// public void testReparseEmail() {
|
|
|
+// emailParseApiService.reparseEmail(593);
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Test
|
|
|
+// public void testReparseFile() {
|
|
|
+// emailParseApiService.reparseFile(ListUtil.toList(40, 43));
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Test
|
|
|
+// public void testDateFormat() {
|
|
|
+// ArrayList<String> list = ListUtil.toList("20240705", "2024年07月05日", "2024年7月5日", "2024-07-05", "2024-7-5", "2024/07/05", "2024/7/5", "20240712",
|
|
|
+// "2024年07月12日", "2024年7月12日", "2024-07-12", "2024-7-12", "2024/07/12", "2024/7/12", "20241005", "2024年10月05日", "2024年10月5日", "2024-10-05", "2024-10-5", "2024/10/05", "2024/10/5");
|
|
|
+// for (String dateString : list) {
|
|
|
+// String date = DateUtils.stringToDate(dateString);
|
|
|
+// System.out.println(dateString + ": -> " + date);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// private MailboxInfoDTO buildMailbox(String account, String pwd) {
|
|
|
+// MailboxInfoDTO emailInfoDTO = new MailboxInfoDTO();
|
|
|
+// emailInfoDTO.setUserId(1);
|
|
|
+// emailInfoDTO.setAccount(account);
|
|
|
+// emailInfoDTO.setPassword(pwd);
|
|
|
+// emailInfoDTO.setHost("imap.exmail.qq.com");
|
|
|
// emailInfoDTO.setPort("993");
|
|
|
// emailInfoDTO.setProtocol("imap");
|
|
|
-
|
|
|
- Date startDate = DateUtil.parse("2024-10-10 15:00:00", DateConst.YYYY_MM_DD_HH_MM_SS);
|
|
|
- Date endDate = DateUtil.parse("2024-10-10 16:40:00", DateConst.YYYY_MM_DD_HH_MM_SS);
|
|
|
- try {
|
|
|
- emailParseService.parseEmail(emailInfoDTO, startDate, endDate);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void reportTest() {
|
|
|
- MailboxInfoDTO emailInfoDTO = this.buildMailbox("x", "x");
|
|
|
- Date startDate = DateUtil.parse("2024-10-15 15:10:30", DateConst.YYYY_MM_DD_HH_MM_SS);
|
|
|
- Date endDate = DateUtil.parse("2024-10-15 17:50:30", DateConst.YYYY_MM_DD_HH_MM_SS);
|
|
|
- try {
|
|
|
- emailParseService.parseEmail(emailInfoDTO, startDate, endDate);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void testReparseEmail() {
|
|
|
- emailParseApiService.reparseEmail(593);
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void testReparseFile() {
|
|
|
- emailParseApiService.reparseFile(ListUtil.toList(40, 43));
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void testDateFormat() {
|
|
|
- ArrayList<String> list = ListUtil.toList("20240705", "2024年07月05日", "2024年7月5日", "2024-07-05", "2024-7-5", "2024/07/05", "2024/7/5", "20240712",
|
|
|
- "2024年07月12日", "2024年7月12日", "2024-07-12", "2024-7-12", "2024/07/12", "2024/7/12", "20241005", "2024年10月05日", "2024年10月5日", "2024-10-05", "2024-10-5", "2024/10/05", "2024/10/5");
|
|
|
- for (String dateString : list) {
|
|
|
- String date = DateUtils.stringToDate(dateString);
|
|
|
- System.out.println(dateString + ": -> " + date);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private MailboxInfoDTO buildMailbox(String account, String pwd) {
|
|
|
- MailboxInfoDTO emailInfoDTO = new MailboxInfoDTO();
|
|
|
- emailInfoDTO.setUserId(1);
|
|
|
- emailInfoDTO.setAccount(account);
|
|
|
- emailInfoDTO.setPassword(pwd);
|
|
|
- emailInfoDTO.setHost("imap.exmail.qq.com");
|
|
|
- emailInfoDTO.setPort("993");
|
|
|
- emailInfoDTO.setProtocol("imap");
|
|
|
- return emailInfoDTO;
|
|
|
- }
|
|
|
-}
|
|
|
+// return emailInfoDTO;
|
|
|
+// }
|
|
|
+//}
|