|
|
|
@ -598,6 +598,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public void updateClientRegisterInfo(JSONObject manager, String clientMoniker, ClientRegisterInfo info) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
Assert.notNull(client);
|
|
|
|
@ -629,21 +630,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
clientMapper.update(updateInfo);
|
|
|
|
|
if (!client.getString("contact_email").equals(updateInfo.getString("contact_email"))) {
|
|
|
|
|
List<String> exceptClientIds = new ArrayList<>();
|
|
|
|
|
exceptClientIds.add(String.valueOf(clientId));
|
|
|
|
|
JSONObject sameMailClients = getByEmail(client.getString("contact_email"),1,1,exceptClientIds);
|
|
|
|
|
if(sameMailClients.getJSONArray("data").size()<1) {
|
|
|
|
|
mailGunService.updateClientOfMailList(updateInfo, client);
|
|
|
|
|
}else {
|
|
|
|
|
client.put("contact_email",updateInfo.getString("contact_email"));
|
|
|
|
|
mailGunService.addClientToMailList(client);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
saveOrUpdateMailList(updateInfo, client);
|
|
|
|
|
clientInfoCacheSupport.clearClientCache(clientId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public void updateClientRegisterInfoV2(JSONObject manager, String clientMoniker, JSONObject info) {
|
|
|
|
|
JSONObject client = getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
Assert.notNull(client);
|
|
|
|
@ -675,18 +667,22 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
clientMapper.update(info);
|
|
|
|
|
if (!client.getString("contact_email").equals(info.getString("contact_email"))) {
|
|
|
|
|
saveOrUpdateMailList(info, client);
|
|
|
|
|
clientInfoCacheSupport.clearClientCache(clientId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void saveOrUpdateMailList(JSONObject newClient, JSONObject oldClient) {
|
|
|
|
|
if (!oldClient.getString("contact_email").equals(newClient.getString("contact_email"))) {
|
|
|
|
|
List<String> exceptClientIds = new ArrayList<>();
|
|
|
|
|
exceptClientIds.add(String.valueOf(clientId));
|
|
|
|
|
JSONObject sameMailClients = getByEmail(client.getString("contact_email"),1,1,exceptClientIds);
|
|
|
|
|
exceptClientIds.add(newClient.getString("client_id"));
|
|
|
|
|
JSONObject sameMailClients = getByEmail(oldClient.getString("contact_email"),1,1,exceptClientIds);
|
|
|
|
|
if(sameMailClients.getJSONArray("data").size()<1) {
|
|
|
|
|
mailGunService.updateClientOfMailList(info, client);
|
|
|
|
|
mailGunService.updateClientOfMailList(newClient, oldClient);
|
|
|
|
|
}else {
|
|
|
|
|
client.put("contact_email",info.getString("contact_email"));
|
|
|
|
|
mailGunService.addClientToMailList(client);
|
|
|
|
|
oldClient.put("contact_email",newClient.getString("contact_email"));
|
|
|
|
|
mailGunService.addClientToMailList(oldClient);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
clientInfoCacheSupport.clearClientCache(clientId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|