From 3b9038eab6119b65ae4c9b215f110a200abef5f5 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Tue, 5 Jun 2018 19:01:46 +0800 Subject: [PATCH 1/2] update --- .../manage/merchants/core/impls/ClientManagerImpl.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 0d791915d..74a4bc28f 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 @@ -630,7 +630,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } clientMapper.update(updateInfo); if (!client.getString("contact_email").equals(updateInfo.getString("contact_email"))) { - mailGunService.updateClientOfMailList(updateInfo, client); + JSONObject sameMailClients = getByEmail(client.getString("contact_email"),1,1); + if(sameMailClients.getJSONObject("data").size()<1) { + mailGunService.updateClientOfMailList(updateInfo, client); + } } clientInfoCacheSupport.clearClientCache(clientId); } @@ -668,7 +671,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } clientMapper.update(info); if (!client.getString("contact_email").equals(info.getString("contact_email"))) { - mailGunService.updateClientOfMailList(info, client); + JSONObject sameMailClients = getByEmail(client.getString("contact_email"),1,1); + if(sameMailClients.getJSONObject("data").size()<1) { + mailGunService.updateClientOfMailList(info, client); + } } clientInfoCacheSupport.clearClientCache(clientId); } From 4651e63a0a2f8dd226d5164bc61bf0ecb9b7723e Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Tue, 5 Jun 2018 19:18:08 +0800 Subject: [PATCH 2/2] update --- .../manage/merchants/core/ClientManager.java | 2 +- .../merchants/core/impls/ClientManagerImpl.java | 15 +++++++++++---- .../manage/mappers/system/ClientMapper.xml | 8 ++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) 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 a6451d991..83c17c860 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 @@ -304,6 +304,6 @@ public interface ClientManager { JSONObject simpleQuery(JSONObject param, int page,int limit); - JSONObject getByEmail(String email, int page, int limit); + JSONObject getByEmail(String email, int page, int limit,List ExceptClientIds); } 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 74a4bc28f..f36518499 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 @@ -630,7 +630,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } clientMapper.update(updateInfo); if (!client.getString("contact_email").equals(updateInfo.getString("contact_email"))) { - JSONObject sameMailClients = getByEmail(client.getString("contact_email"),1,1); + List exceptClientIds = new ArrayList<>(); + exceptClientIds.add(String.valueOf(clientId)); + JSONObject sameMailClients = getByEmail(client.getString("contact_email"),1,1,exceptClientIds); if(sameMailClients.getJSONObject("data").size()<1) { mailGunService.updateClientOfMailList(updateInfo, client); } @@ -671,7 +673,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } clientMapper.update(info); if (!client.getString("contact_email").equals(info.getString("contact_email"))) { - JSONObject sameMailClients = getByEmail(client.getString("contact_email"),1,1); + List exceptClientIds = new ArrayList<>(); + exceptClientIds.add(String.valueOf(clientId)); + JSONObject sameMailClients = getByEmail(client.getString("contact_email"),1,1,exceptClientIds); if(sameMailClients.getJSONObject("data").size()<1) { mailGunService.updateClientOfMailList(info, client); } @@ -2487,7 +2491,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject client = clientDetail(manager, clientMoniker); Assert.notEmpty(client); clientModifySupport.processClientModify(new DisableModify(manager, clientMoniker, false)); - JSONObject sameMailClients = getByEmail(client.getString("contact_email"),1,1); + List exceptClientIds = new ArrayList<>(); + exceptClientIds.add(client.getString("client_id")); + JSONObject sameMailClients = getByEmail(client.getString("contact_email"),1,1,exceptClientIds); if(sameMailClients.getJSONObject("data").size()<1) { mailGunService.removeMailList(client); } @@ -3521,9 +3527,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public JSONObject getByEmail(String email, int page, int limit) { + public JSONObject getByEmail(String email, int page, int limit,List exceptClientIds) { JSONObject param = new JSONObject(); param.put("contact_email",email); + param.put("except_client_ids",exceptClientIds); return PageListUtils.buildPageListResult(clientMapper.simpleQuery(param,new PageBounds(page, limit))); } } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml index a70b85bb1..0e88bbea9 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml @@ -322,5 +322,13 @@ and contact_email = #{contact_email} + + and client_id not in ( + + #{item} + + ) + + \ No newline at end of file