api次数修改日志增加客户昵称

This commit is contained in:
majintao
2024-09-02 14:08:27 +08:00
parent 6ce9094eba
commit 42d16cde8f
4 changed files with 33 additions and 15 deletions
@@ -98,16 +98,16 @@ public class ApiUserController {
ArrayList<QueryParam> queryParams = new ArrayList<QueryParam>();
if (model.getStatus() != null) {
queryParams.add(new QueryParam("status", model.getStatus()));
}else {
queryParams.add(new QueryParam("status",0));
} else {
queryParams.add(new QueryParam("status", 0));
}
if (model.getIsTest()!=null){
queryParams.add(new QueryParam("isTest",model.getIsTest()));
}else {
queryParams.add(new QueryParam("isTest",0));
if (model.getIsTest() != null) {
queryParams.add(new QueryParam("isTest", model.getIsTest()));
} else {
queryParams.add(new QueryParam("isTest", 0));
}
if (model.getPurpose()!=null){
queryParams.add(new QueryParam("purpose",model.getPurpose()));
if (model.getPurpose() != null) {
queryParams.add(new QueryParam("purpose", model.getPurpose()));
}
List<ApiUser> apiUsers = this.apiUserService.findApiUsersByParamsSortDate(queryParams);
List<ApiUserBo> apiUserBoList = new ArrayList<ApiUserBo>();
@@ -738,22 +738,27 @@ public class ApiUserController {
ApiCountLog apiCountLog = new ApiCountLog();
if (countMap != null && countMap.containsKey(model.getUri())) {
String bkoffUserId = (String) ThreadLocalData.getInstance().get(ThreadLocalKey.UserId);
User user = userService.findById(userId);
BkoffUsers bkoffUser = bkoffUsersService.findBkoffUsersById(bkoffUserId);
apiCountLog.setUserId(userId);
apiCountLog.setUserName(user.getDisplayName());
apiCountLog.setUri(model.getUri());
apiCountLog.setUriName(apiMap.get(model.getUri()));
apiCountLog.setOperator(bkoffUser.getRealName());
Integer oldCount = countMap.get(model.getUri());
apiCountLog.setOldCount(oldCount);
apiCountLog.setNewCount(count);
if (count >= oldCount){
apiCountLog.setOperate("增加"+(count-oldCount)+"次");
}else if (oldCount > count){
apiCountLog.setOperate("减少"+(oldCount-count)+"次");
if (count > oldCount) {
apiCountLog.setOperate("增加" + (count - oldCount) + "次");
} else if (oldCount > count) {
apiCountLog.setOperate("减少" + (oldCount - count) + "次");
}
apiCountLog.setOperateTime(new Date());
apiCountLogService.save(apiCountLog);
// 次数改变了再记录
if (!count.equals(oldCount)) {
apiCountLogService.save(apiCountLog);
}
}
totalCountMap.put(model.getUri(), count);
authority.setTotalCountMap(totalCountMap);
@@ -30,6 +30,7 @@
<table style="float:left;" name="reginTable" class="regionTab">
<tr>
<th>用户ID</th>
<th>用户昵称</th>
<th>uri</th>
<th>API名称</th>
<th>操作</th>
@@ -41,6 +42,7 @@
<#list apiCountLogList as it>
<tr>
<td>${it.userId!}</td>
<td>${it.userName!}</td>
<td>${it.uri!}</td>
<td>${it.uriName!}</td>
<td>${it.operate!}</td>
@@ -106,9 +106,9 @@
&nbsp;&nbsp;/
<#if bo.totalCountMap?? && bo.totalCountMap[bo.uri!]??>
<input type="text" value="${bo.totalCountMap[bo.uri!]}" name="sum" id="sum_${bo_index + 1}" style="width:80px;" ></input>
<input type="text" value="${bo.totalCountMap[bo.uri!]}" name="sum" id="sum_${bo_index + 1}" style="width:80px;" readonly ></input>
<#else>
<input type="text" value="" name="sum" id="sum_${bo_index + 1}" style="width:80px;" ></input>
<input type="text" value="" name="sum" id="sum_${bo_index + 1}" style="width:80px;" readonly></input>
</#if>
</td>
@@ -16,6 +16,8 @@ public class ApiCountLog implements MongoEntity {
private Long userId;
private String userName;
private String uri;
private String uriName;
@@ -113,4 +115,13 @@ public class ApiCountLog implements MongoEntity {
public void setNewCount(Integer newCount) {
this.newCount = newCount;
}
@Column(name = "user_name")
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}