parent
d639c584fb
commit
0d9612e587
@ -0,0 +1,20 @@
|
|||||||
|
package au.com.royalpay.payment.manage.logview.core;
|
||||||
|
|
||||||
|
import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kira
|
||||||
|
* @date 2018/6/15
|
||||||
|
*/
|
||||||
|
public interface OperationLogService {
|
||||||
|
|
||||||
|
List<ClientConfigLog> query(JSONObject params);
|
||||||
|
|
||||||
|
JSONObject query(JSONObject params, PageBounds pageBounds);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package au.com.royalpay.payment.manage.logview.core.impl;
|
||||||
|
|
||||||
|
import au.com.royalpay.payment.manage.logview.core.OperationLogService;
|
||||||
|
import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog;
|
||||||
|
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||||
|
import com.github.miemiedev.mybatis.paginator.domain.Paginator;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||||
|
import org.springframework.data.mongodb.core.query.Criteria;
|
||||||
|
import org.springframework.data.mongodb.core.query.Query;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kira
|
||||||
|
* @date 2018/6/15
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OperationLogServiceImpl implements OperationLogService {
|
||||||
|
@Resource
|
||||||
|
private MongoTemplate mongoTemplate;
|
||||||
|
@Resource
|
||||||
|
private ClientManager clientManager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject query(JSONObject params, PageBounds pageBounds) {
|
||||||
|
if (StringUtils.isNotEmpty(params.getString("client_moniker"))) {
|
||||||
|
JSONObject client = clientManager.getClientInfoByMoniker(params.getString("client_moniker"));
|
||||||
|
if(client!=null) {
|
||||||
|
params.put("client_id", client.getIntValue("client_id"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Query query = new Query();
|
||||||
|
if (params.getIntValue("client_id") != 0) {
|
||||||
|
query.addCriteria(Criteria.where("clientId").is(params.getIntValue("client_id")));
|
||||||
|
}
|
||||||
|
List<ClientConfigLog> clientConfigLogList = mongoTemplate.find(query, ClientConfigLog.class);
|
||||||
|
return buildPageListResult(clientConfigLogList,
|
||||||
|
new Paginator(pageBounds.getPage(), pageBounds.getLimit(), (int) mongoTemplate.count(query, ClientConfigLog.class)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ClientConfigLog> query(JSONObject params) {
|
||||||
|
Query query = new Query();
|
||||||
|
query.addCriteria(Criteria.where("clientId").is(params.getIntValue("client_id")));
|
||||||
|
List<ClientConfigLog> clientConfigLogList = mongoTemplate.find(query, ClientConfigLog.class);
|
||||||
|
Paginator paginator = new Paginator(1, 1, 1);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONObject buildPageListResult(List datas, Paginator paginator) {
|
||||||
|
JSONObject res = new JSONObject();
|
||||||
|
res.put("data", datas);
|
||||||
|
res.put("pagination", paginator);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue