add config operation log

master
wangning 7 years ago
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;
}
}

@ -1,14 +1,13 @@
package au.com.royalpay.payment.manage.logview.web; package au.com.royalpay.payment.manage.logview.web;
import au.com.royalpay.payment.manage.logview.beans.WechatMsgQueryBean; import au.com.royalpay.payment.manage.logview.core.OperationLogService;
import au.com.royalpay.payment.manage.logview.core.WechatMsgRepository;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -17,13 +16,15 @@ import javax.annotation.Resource;
* Created by Tayl0r on 2017/5/3. * Created by Tayl0r on 2017/5/3.
*/ */
@RestController @RestController
@ManagerMapping(value = "/sys_logs/config/operation", method = RequestMethod.GET, role = ManagerRole.ADMIN) @RequestMapping(value = "/sys_logs/config/operation")
public class ConfigOperationController { public class ConfigOperationController {
@Resource @Resource
private WechatMsgRepository wechatMsgRepository; private OperationLogService operationLogService;
@RequestMapping @RequestMapping(method = RequestMethod.GET)
public JSONObject listWechatMsgs(WechatMsgQueryBean wechatMsgQueryBean){ public JSONObject list(@RequestParam(required = false) String client_moniker,@RequestParam(defaultValue = "1") int page,@RequestParam(defaultValue = "10") int limit){
return wechatMsgRepository.listWechatMsgs(wechatMsgQueryBean); JSONObject params = new JSONObject();
params.put("client_moniker",client_moniker);
return operationLogService.query(params,new PageBounds(page,limit));
} }
} }

@ -144,6 +144,7 @@
INNER JOIN sys_clients c INNER JOIN sys_clients c
ON c.client_id = b.client_id AND b.start_date <= c.approve_time AND (b.end_date > c.approve_time OR b.end_date IS NULL) ON c.client_id = b.client_id AND b.start_date <= c.approve_time AND (b.end_date > c.approve_time OR b.end_date IS NULL)
WHERE c.approve_time >= #{begin} AND c.approve_time < #{end} AND c.is_valid = 1 AND c.approve_result = 1 WHERE c.approve_time >= #{begin} AND c.approve_time < #{end} AND c.is_valid = 1 AND c.approve_result = 1
and b.is_valid=1
]]> ]]>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if> <if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in <if test="org_ids!=null">and c.org_id in

@ -117,17 +117,17 @@ define(['angular', 'uiRouter'], function (angular) {
app.controller('configOperationLogCtrl', ['$scope', '$http', '$filter', function ($scope, $http, $filter) { app.controller('configOperationLogCtrl', ['$scope', '$http', '$filter', function ($scope, $http, $filter) {
$scope.pagination = {}; $scope.pagination = {};
$scope.params = {date: new Date()}; $scope.params = {};
$scope.listWechatMsgs = function (page) { $scope.listConfiglogs = function (page) {
var params = angular.copy($scope.params) || {}; var params = angular.copy($scope.params) || {};
params.page = page || $scope.pagination.page || 1; params.page = page || $scope.pagination.page || 1;
params.date = $filter('date')(params.date, 'yyyyMMdd'); params.date = $filter('date')(params.date, 'yyyyMMdd');
$http.get('/sys_logs/wechat_msg', {params: params}).then(function (resp) { $http.get('/sys_logs/config/operation', {params: params}).then(function (resp) {
$scope.wechatMsgs = resp.data.data; $scope.logs = resp.data.data;
$scope.pagination = resp.data.pagination; $scope.pagination = resp.data.pagination;
}); });
}; };
$scope.listWechatMsgs(); $scope.listConfiglogs();
}]); }]);
return app; return app;

@ -3,25 +3,7 @@
<div class="form-inline"> <div class="form-inline">
<div class="form-group"> <div class="form-group">
<label class="control-label" for="moniker-input">Client Moniker</label> <label class="control-label" for="moniker-input">Client Moniker</label>
<input class="form-control" size="5" id="moniker-input" ng-model="params.client_moniker" ng-enter="listClientLoginLogs(1)"> <input class="form-control" size="5" id="moniker-input" ng-model="params.client_moniker" ng-enter="listConfiglogs(1)">
</div>
<div class="form-group">
<label class="control-label" for="username-input">Username</label>
<input class="form-control" ng-model="params.username" id="username-input">
</div>
<div class="form-group">
<label class="control-label" for="date-from-input">From</label>
<input class="form-control" id="date-from-input" ng-model="params.begin"
uib-datepicker-popup size="10" placeholder="From"
is-open="dateBegin.open" ng-click="dateBegin.open=true"
datepicker-options="{maxDate:params.end||today}">
</div>
<div class="form-group">
<label class="control-label" for="date-to-input">To</label>
<input class="form-control" id="date-to-input" ng-model="params.end"
uib-datepicker-popup size="10" placeholder="To"
is-open="dateEnd.open" ng-click="dateEnd.open=true"
datepicker-options="{minDate:params.begin,maxDate:today}">
</div> </div>
<button class="btn btn-success" type="button" ng-click="listClientLoginLogs(1)"> <button class="btn btn-success" type="button" ng-click="listClientLoginLogs(1)">
<i class="fa fa-search"></i> Search <i class="fa fa-search"></i> Search
@ -32,20 +14,24 @@
<table class="table table-bordered table-hover table-striped"> <table class="table table-bordered table-hover table-striped">
<thead> <thead>
<tr> <tr>
<th>Time</th> <th>business</th>
<th>Client</th> <th>createTime</th>
<th>User</th> <th>newData</th>
<th>IP</th> <th>originData</th>
<th>Method</th> <th>userId</th>
<th>userName</th>
<th>userType</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="log in logs"> <tr ng-repeat="log in logs">
<td ng-bind="log.login_time"></td> <td ng-bind="log.business"></td>
<td ng-bind="log.short_name+'('+log.client_moniker+')'"></td> <td ng-bind="log.createTime"></td>
<td ng-bind="log.display_name"></td> <td ng-bind="log.newData"></td>
<td ng-bind="log.ip"></td> <td ng-bind="log.originData"></td>
<td ng-bind="log.method"></td> <td ng-bind="log.userId"></td>
<td ng-bind="log.userName"></td>
<td ng-bind="log.userType"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -57,7 +43,7 @@
ng-model="pagination.page" ng-model="pagination.page"
items-per-page="pagination.limit" items-per-page="pagination.limit"
max-size="10" max-size="10"
ng-change="listClientLoginLogs()" ng-change="listConfiglogs()"
previous-text="&lsaquo;" previous-text="&lsaquo;"
next-text="&rsaquo;" next-text="&rsaquo;"
first-text="&laquo;" first-text="&laquo;"

@ -23,6 +23,10 @@
<i class="fa fa-weixin"></i> <i class="fa fa-weixin"></i>
WeChat Messages WeChat Messages
</a> </a>
<!-- <a class="btn btn-app" role="button" ui-sref=".config_operation">
<i class="fa fa-weixin"></i>
Config Operation
</a>-->
</div> </div>
</div> </div>
</section> </section>

Loading…
Cancel
Save