From 9c6507a7c9dc55548e496bb06a4c4a5c05b67679 Mon Sep 17 00:00:00 2001 From: YXY <932687738@qq.com> Date: Wed, 12 Apr 2023 21:09:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=82=AE=E7=AE=B1?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/flyingbook/mail/MailHttpHelper.java | 59 ++++++++++++++++--- 1 file changed, 50 insertions(+), 9 deletions(-) diff --git a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/mail/MailHttpHelper.java b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/mail/MailHttpHelper.java index ff73dbc..14a2feb 100644 --- a/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/mail/MailHttpHelper.java +++ b/ruoyi-flyingbook/src/main/java/com/ruoyi/flyingbook/mail/MailHttpHelper.java @@ -3,6 +3,8 @@ package com.ruoyi.flyingbook.mail; import com.ruoyi.flyingbook.domain.lark.LarkTableRequest; import com.ruoyi.flyingbook.mail.request.MailRequest; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.formula.functions.Index; import org.springframework.stereotype.Component; import javax.mail.*; @@ -24,9 +26,10 @@ public class MailHttpHelper extends MailHelper{ public static void main(String[] args) { MailHttpHelper mailHelper = new MailHttpHelper(); - MailRequest req = new MailRequest("xjia.synology.me",5000,"xjzsb","12345678"); - req = new MailRequest("xjia.synology.me",143,"xjzsb@xjia-edu.com","12345678"); - mailHelper.receiveMail(req,null); +// MailRequest req = new MailRequest("xjia.synology.me",5000,"xjzsb","12345678"); +// req = new MailRequest("xjia.synology.me",143,"xjzsb@xjia-edu.com","12345678"); +// mailHelper.receiveMail(req,null); + mailHelper.buildBody(null,"刘畅文祺 13996409399父亲微信同 重庆 高三作曲 英语120 文化一本线 意向美国伯克利 其他国家也可以考虑一下 费用没问题 了解过其他学校 过几天联系"); } public void receiveMail(MailRequest req, LarkTableRequest add){ @@ -87,21 +90,59 @@ public class MailHttpHelper extends MailHelper{ @Override protected Map buildBody(Message message,String content) { Map map = new HashMap<>(); - map.put("学生姓名",null); + Integer index = 0; + StringBuilder str = new StringBuilder(); + for (String s : content.split("")) { + if (StringUtils.isNotBlank(str) && s.equals(" ")){ + this.fillMap(map,str.toString(),index); + str = new StringBuilder(); + index ++; + continue; + } + if (s.equals(" ")){ + continue; + } + str.append(s); + } + map.put("意向度",null); - map.put("现有学历",null); map.put("报名时间",null); - map.put("手机号码",null); - map.put("省市",null); - map.put("备注",null); map.put("回放记录",null); map.put("业务员",null); map.put("信息完成度",null); map.put("数据来源",null); - map.put("目标国家",null); map.put("所属学校",null); map.put("邮箱来源",null); +// if (index > 6){ +// map.clear(); +// } map.put("原始线索",content); return map; } + private void fillMap(Map map,String msg,Integer index){ + switch (index){ + case 0: + map.put("学生姓名",msg); + break; + case 1: + map.put("省市",msg); + break; + case 2: + map.put("现有学历",msg); + break; + case 3: + map.put("手机号码",msg); + break; + case 4: + break; + case 5: + map.put("目标国家",msg); + break; + case 6: + map.put("备注",msg); + break; + default: + break; + } + } }