|
|
@ -1,6 +1,7 @@
|
|
|
|
package au.com.royalpay.payment.manage.openim.core.impl;
|
|
|
|
package au.com.royalpay.payment.manage.openim.core.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
|
|
|
import au.com.royalpay.payment.manage.openim.beans.OpenimUserVO;
|
|
|
|
import au.com.royalpay.payment.manage.openim.beans.OpenimUserVO;
|
|
|
|
import au.com.royalpay.payment.manage.openim.core.CustomerServiceService;
|
|
|
|
import au.com.royalpay.payment.manage.openim.core.CustomerServiceService;
|
|
|
@ -33,20 +34,25 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
|
|
|
|
private ClientManager clientManager;
|
|
|
|
private ClientManager clientManager;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private ClientAccountMapper clientAccountMapper;
|
|
|
|
private ClientAccountMapper clientAccountMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private ManagerMapper managerMapper;
|
|
|
|
|
|
|
|
|
|
|
|
private final String password = "XXXXXX";
|
|
|
|
private final String password = "XXXXXX";
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkAndSave(JSONObject account) {
|
|
|
|
public void checkAndSave(JSONObject account) {
|
|
|
|
JSONObject client = clientManager.getClientInfo(account.getIntValue("client_id"));
|
|
|
|
JSONObject client = null;
|
|
|
|
|
|
|
|
boolean isPartner = true;
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(account.getString("account_id"))) {
|
|
|
|
|
|
|
|
client = clientManager.getClientInfo(account.getIntValue("client_id"));
|
|
|
|
if (client == null) {
|
|
|
|
if (client == null) {
|
|
|
|
throw new BadRequestException("Merchant Not Found");
|
|
|
|
throw new BadRequestException("Merchant Not Found");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
boolean isPartner = true;
|
|
|
|
account =clientAccountMapper.findById(account.getString("account_id"));
|
|
|
|
if (StringUtils.isNotEmpty(account.getString("account_id"))) {
|
|
|
|
|
|
|
|
isPartner = true;
|
|
|
|
isPartner = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotEmpty(account.getString("manager_id"))) {
|
|
|
|
if (StringUtils.isNotEmpty(account.getString("manager_id"))) {
|
|
|
|
|
|
|
|
account =managerMapper.findDetail(account.getString("manager_id"));
|
|
|
|
isPartner = false;
|
|
|
|
isPartner = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String uid = account.getString("username") + (isPartner ? "(" + client.getString("client_moniker") + ")" : "");
|
|
|
|
String uid = account.getString("username") + (isPartner ? "(" + client.getString("client_moniker") + ")" : "");
|
|
|
@ -86,14 +92,11 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<JSONObject> query(String clientMoniker, String userNames) {
|
|
|
|
public List<JSONObject> query(String clientMoniker, String userNames) {
|
|
|
|
if(StringUtils.isEmpty(clientMoniker) && StringUtils.isEmpty(userNames)){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
JSONObject queryParams = new JSONObject();
|
|
|
|
JSONObject queryParams = new JSONObject();
|
|
|
|
if (StringUtils.isNotEmpty(clientMoniker)) {
|
|
|
|
if (StringUtils.isNotEmpty(clientMoniker)) {
|
|
|
|
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
|
|
|
|
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
|
|
|
|
if (client == null) {
|
|
|
|
if (client == null) {
|
|
|
|
throw new BadRequestException("Merchant Not Found");
|
|
|
|
return Collections.EMPTY_LIST;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
queryParams.put("clientId", client.getIntValue("client_id"));
|
|
|
|
queryParams.put("clientId", client.getIntValue("client_id"));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -107,8 +110,8 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
|
|
|
|
List<JSONObject> result = new ArrayList<>(accounts.size());
|
|
|
|
List<JSONObject> result = new ArrayList<>(accounts.size());
|
|
|
|
accounts.forEach(p -> {
|
|
|
|
accounts.forEach(p -> {
|
|
|
|
JSONObject openimUser = new JSONObject();
|
|
|
|
JSONObject openimUser = new JSONObject();
|
|
|
|
openimUser.put("nick", p.getString("display_name"));
|
|
|
|
|
|
|
|
openimUser.put("userid", p.getString("username") + "(" + p.getString("client_moniker") + ")");
|
|
|
|
openimUser.put("userid", p.getString("username") + "(" + p.getString("client_moniker") + ")");
|
|
|
|
|
|
|
|
openimUser.put("nick", p.getString("username") + "(" + p.getString("client_moniker") + ")");
|
|
|
|
openimUser.put("headimg", p.getString("wechat_headimg"));
|
|
|
|
openimUser.put("headimg", p.getString("wechat_headimg"));
|
|
|
|
result.add(openimUser);
|
|
|
|
result.add(openimUser);
|
|
|
|
});
|
|
|
|
});
|
|
|
|