From e22617082e598779a01b47946943167a00a608b6 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Tue, 5 Jun 2018 19:41:47 +0800 Subject: [PATCH] update --- .../merchants/core/impls/ClientManagerImpl.java | 12 +++++++++--- .../apps/core/impls/CustomerImpressionImplTest.java | 11 ++++++++--- 2 files changed, 17 insertions(+), 6 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 f36518499..c3c18aca2 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 @@ -633,8 +633,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid 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) { + if(sameMailClients.getJSONArray("data").size()<1) { mailGunService.updateClientOfMailList(updateInfo, client); + }else { + client.put("contact_email",updateInfo.getString("contact_email")); + mailGunService.addClientToMailList(client); } } clientInfoCacheSupport.clearClientCache(clientId); @@ -676,8 +679,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid 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) { + if(sameMailClients.getJSONArray("data").size()<1) { mailGunService.updateClientOfMailList(info, client); + }else { + client.put("contact_email",info.getString("contact_email")); + mailGunService.addClientToMailList(client); } } clientInfoCacheSupport.clearClientCache(clientId); @@ -2494,7 +2500,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid 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) { + if(sameMailClients.getJSONArray("data").size()<1) { mailGunService.removeMailList(client); } } diff --git a/src/test/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionImplTest.java b/src/test/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionImplTest.java index 1bf968cc9..1d4864e05 100644 --- a/src/test/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionImplTest.java +++ b/src/test/java/au/com/royalpay/payment/manage/apps/core/impls/CustomerImpressionImplTest.java @@ -8,6 +8,7 @@ import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.tools.mail.MailGunClient; import au.com.royalpay.payment.tools.mail.SendMail; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import org.apache.commons.codec.binary.Base64; @@ -38,7 +39,7 @@ import cn.yixblog.platform.http.HttpRequestResult; * Created by wangning on 05/01/2018. */ @SpringBootTest -@ActiveProfiles({ "dev", "alipay", "wechat", "jd", "bestpay" }) +@ActiveProfiles({ "local", "alipay", "wechat", "jd", "bestpay" }) @RunWith(SpringRunner.class) public class CustomerImpressionImplTest { @Resource @@ -191,8 +192,12 @@ public class CustomerImpressionImplTest { @Test public void fd(){ - JSONObject asd = clientManager.getByEmail("123@askdjh.com",1,1); - System.out.println(asd); + List asd12eq = new ArrayList<>(); + asd12eq.add("9"); + JSONObject asd = clientManager.getByEmail("164851225@qq.com",1,1,asd12eq); + JSONArray qwe = asd.getJSONArray("data"); + System.out.println(asd.getJSONArray("data")); + System.out.println(qwe); System.out.println(asd); System.out.println(asd); System.out.println(asd);