From f32e2205fbd5d2882847e0496fdba2891dd9648a Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Tue, 15 May 2018 19:36:29 +0800 Subject: [PATCH] update --- .../manage/mappers/system/MailSendMapper.java | 5 +++ .../manage/merchants/core/ClientManager.java | 2 ++ .../core/impls/ClientManagerImpl.java | 34 +++++++++++++++++++ .../system/core/impl/MailGunServiceImpl.java | 4 +++ .../manage/task/PartnerInitEmailChecker.java | 1 + 5 files changed, 46 insertions(+) diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/MailSendMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/MailSendMapper.java index 1f2151837..5d98a5880 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/MailSendMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/MailSendMapper.java @@ -2,6 +2,8 @@ package au.com.royalpay.payment.manage.mappers.system; import com.alibaba.fastjson.JSONObject; +import java.util.List; + import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; import cn.yixblog.support.mybatis.autosql.annotations.SqlType; @@ -16,4 +18,7 @@ public interface MailSendMapper { @AutoSql(type = SqlType.UPDATE) void update(JSONObject record); + + @AutoSql(type = SqlType.SELECT) + JSONObject find(String emailId, String contact_email); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index dd3a36ba7..a9e1b0313 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -71,6 +71,8 @@ public interface ClientManager { void checkEmailStatus(); + void newCheckEmailStatus(); + @Transactional void switchPermission(JSONObject manager, String clientMoniker, String permissionKey, boolean allow); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index c878d5739..cdce87701 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -29,6 +29,7 @@ import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper; import au.com.royalpay.payment.manage.mappers.system.ClientsContractMapper; import au.com.royalpay.payment.manage.mappers.system.CommoditiesMapper; +import au.com.royalpay.payment.manage.mappers.system.MailSendMapper; import au.com.royalpay.payment.manage.mappers.system.ManagerMapper; import au.com.royalpay.payment.manage.mappers.system.OrgMapper; import au.com.royalpay.payment.manage.mappers.system.SysWxMerchantApplyMapper; @@ -266,6 +267,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private MongoTemplate mongoTemplate; @Resource private MailGunService mailGunService; + @Resource + private MailSendMapper mailSendMapper; private static final String SOURCE_AGREE_FILE = "source_agree_file"; private static final String CLIENT_BANK_FILE = "client_bank_file"; @@ -935,6 +938,37 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } + @Override + public void newCheckEmailStatus() { + List clients = clientMapper.listClientsWithEmailNotVerify(); + for (JSONObject client : clients) { + try { + String emailId = client.getString("approve_email_id"); + JSONObject status = mailSendMapper.find(emailId,client.getString("contact_email")); + if (status!=null) { + int statusNo = status.getIntValue("status"); + logger.debug("get mail status:" + emailId + "--" + statusNo); + int mailStatus = 3; + switch (statusNo) { + case 1: + mailStatus = 1; + break; + case 2: + mailStatus = 2; + break; + } + updateClientApproveEmailStatus(mailStatus, null, client.getString("client_moniker")); + } else { + logger.debug("get mail status:" + emailId + "-- none"); + // updateClientApproveEmailStatus(client.getIntValue("client_id"), 0); + } + + } catch (Exception e) { + logger.error("check email status failed", e); + } + } + } + @Override public void switchPermission(JSONObject manager, String clientMoniker, String permissionKey, boolean allow) { JSONObject client = getClientInfoByMoniker(clientMoniker); diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/MailGunServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/MailGunServiceImpl.java index cc100462d..f326e209f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/MailGunServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/MailGunServiceImpl.java @@ -1,5 +1,6 @@ package au.com.royalpay.payment.manage.system.core.impl; +import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.mappers.system.MailSendMapper; import au.com.royalpay.payment.manage.system.core.MailGunService; import au.com.royalpay.payment.tools.mail.MailGunClient; @@ -29,6 +30,9 @@ public class MailGunServiceImpl implements MailGunService { @Resource private MailGunClient mailGunClient; + @Resource + private ClientMapper clientMapper; + @Value("${mail.mailgun.default.merchantlist}") private String mailListDefault; diff --git a/src/main/java/au/com/royalpay/payment/manage/task/PartnerInitEmailChecker.java b/src/main/java/au/com/royalpay/payment/manage/task/PartnerInitEmailChecker.java index fd0acb9c6..60906f85f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/task/PartnerInitEmailChecker.java +++ b/src/main/java/au/com/royalpay/payment/manage/task/PartnerInitEmailChecker.java @@ -22,6 +22,7 @@ public class PartnerInitEmailChecker { public void checkEmailStatus(){ if (PlatformEnvironment.getEnv().taskEnabled()) { clientManager.checkEmailStatus(); + clientManager.newCheckEmailStatus(); } } }