|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
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.ManagerMapper;
|
|
|
|
|
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.core.CustomerServiceService;
|
|
|
|
@ -33,20 +34,25 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
|
|
|
|
|
private ClientManager clientManager;
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientAccountMapper clientAccountMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private ManagerMapper managerMapper;
|
|
|
|
|
|
|
|
|
|
private final String password = "XXXXXX";
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void checkAndSave(JSONObject account) {
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(account.getIntValue("client_id"));
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new BadRequestException("Merchant Not Found");
|
|
|
|
|
}
|
|
|
|
|
JSONObject client = null;
|
|
|
|
|
boolean isPartner = true;
|
|
|
|
|
if (StringUtils.isNotEmpty(account.getString("account_id"))) {
|
|
|
|
|
client = clientManager.getClientInfo(account.getIntValue("client_id"));
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new BadRequestException("Merchant Not Found");
|
|
|
|
|
}
|
|
|
|
|
account =clientAccountMapper.findById(account.getString("account_id"));
|
|
|
|
|
isPartner = true;
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotEmpty(account.getString("manager_id"))) {
|
|
|
|
|
account =managerMapper.findDetail(account.getString("manager_id"));
|
|
|
|
|
isPartner = false;
|
|
|
|
|
}
|
|
|
|
|
String uid = account.getString("username") + (isPartner ? "(" + client.getString("client_moniker") + ")" : "");
|
|
|
|
@ -85,31 +91,28 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<JSONObject> query(String clientMoniker,String userNames) {
|
|
|
|
|
if(StringUtils.isEmpty(clientMoniker) && StringUtils.isEmpty(userNames)){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public List<JSONObject> query(String clientMoniker, String userNames) {
|
|
|
|
|
JSONObject queryParams = new JSONObject();
|
|
|
|
|
if(StringUtils.isNotEmpty(clientMoniker)) {
|
|
|
|
|
if (StringUtils.isNotEmpty(clientMoniker)) {
|
|
|
|
|
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
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"));
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isNotEmpty(userNames)) {
|
|
|
|
|
if (StringUtils.isNotEmpty(userNames)) {
|
|
|
|
|
queryParams.put("userNames", Arrays.asList(userNames.split(",")));
|
|
|
|
|
}
|
|
|
|
|
if(queryParams.size()<1){
|
|
|
|
|
if (queryParams.size() < 1) {
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
}
|
|
|
|
|
List<JSONObject> accounts = clientAccountMapper.query(queryParams);
|
|
|
|
|
List<JSONObject> result = new ArrayList<>(accounts.size());
|
|
|
|
|
accounts.forEach(p -> {
|
|
|
|
|
JSONObject openimUser = new JSONObject();
|
|
|
|
|
openimUser.put("nick", p.getString("display_name"));
|
|
|
|
|
openimUser.put("userid", p.getString("username") + "(" + p.getString("client_moniker") + ")");
|
|
|
|
|
openimUser.put("headimg",p.getString("wechat_headimg"));
|
|
|
|
|
openimUser.put("nick", p.getString("username") + "(" + p.getString("client_moniker") + ")");
|
|
|
|
|
openimUser.put("headimg", p.getString("wechat_headimg"));
|
|
|
|
|
result.add(openimUser);
|
|
|
|
|
});
|
|
|
|
|
return result;
|
|
|
|
|