|
|
@@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
23
|
23
|
|
|
24
|
24
|
import com.alibaba.fastjson.JSONObject;
|
|
25
|
25
|
import com.chinaitop.depot.system.model.SystemLog;
|
|
26
|
|
-import com.chinaitop.depot.system.model.UserOperationlog;
|
|
|
26
|
+import com.chinaitop.depot.system.model.SystemLogExample;
|
|
27
|
27
|
import com.chinaitop.depot.system.service.UserOperationlogService;
|
|
28
|
28
|
import com.github.pagehelper.PageHelper;
|
|
29
|
29
|
import com.github.pagehelper.PageInfo;
|
|
|
@@ -42,7 +42,7 @@ import io.swagger.annotations.ApiOperation;
|
|
42
|
42
|
@RequestMapping(value="/systemLog")
|
|
43
|
43
|
@Api(description = "系统日志控制类")
|
|
44
|
44
|
public class SystemLogController {
|
|
45
|
|
-
|
|
|
45
|
+
|
|
46
|
46
|
@Resource
|
|
47
|
47
|
private UserOperationlogService userOperationlogService;
|
|
48
|
48
|
|
|
|
@@ -59,17 +59,40 @@ public class SystemLogController {
|
|
59
|
59
|
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query"),
|
|
60
|
60
|
@ApiImplicitParam(name = "username", value = "真实姓名", paramType = "query")
|
|
61
|
61
|
})
|
|
62
|
|
- public PageInfo<UserOperationlog> getSystemLog(HttpServletRequest request, Integer pageNum,
|
|
|
62
|
+ public PageInfo<SystemLog> getSystemLog(HttpServletRequest request, Integer pageNum,
|
|
63
|
63
|
Integer pageSize, String username) {
|
|
64
|
64
|
|
|
65
|
65
|
if (pageNum!=null && pageSize!=null) {
|
|
66
|
66
|
PageHelper.startPage(pageNum, pageSize);
|
|
67
|
67
|
}
|
|
68
|
|
-
|
|
69
|
|
- HashMap<Object, Object> map = new HashMap<Object, Object>();
|
|
70
|
|
- map.put("username", username);
|
|
71
|
|
- List<UserOperationlog> listAll=userOperationlogService.queryAll(map);
|
|
72
|
|
- PageInfo<UserOperationlog> pageInfo = new PageInfo<UserOperationlog>(listAll);
|
|
|
68
|
+
|
|
|
69
|
+ SystemLogExample example = new SystemLogExample();
|
|
|
70
|
+ SystemLogExample.Criteria criteria = example.createCriteria();
|
|
|
71
|
+ if (null != username && !"".equals(username)) {
|
|
|
72
|
+ criteria.andUserNameLike("%"+username+"%");
|
|
|
73
|
+ }
|
|
|
74
|
+ example.setOrderByClause("operation_time desc");
|
|
|
75
|
+
|
|
|
76
|
+ List<SystemLog> list = userOperationlogService.findSystemLogCondition(example);
|
|
|
77
|
+ if (null != list && list.size() > 0) {
|
|
|
78
|
+ SystemLog log = null;
|
|
|
79
|
+ String parameter = "";
|
|
|
80
|
+ int parameter_length = 0;
|
|
|
81
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
82
|
+ log = list.get(i);
|
|
|
83
|
+ parameter = log.getParameter();
|
|
|
84
|
+ if (null != parameter && !"".equals(parameter)) {
|
|
|
85
|
+ parameter_length = parameter.length();
|
|
|
86
|
+ if (parameter_length > 50) {
|
|
|
87
|
+ parameter = parameter.substring(0, 50)+"......";
|
|
|
88
|
+ log.setParameter(parameter);
|
|
|
89
|
+ }
|
|
|
90
|
+ }
|
|
|
91
|
+ }
|
|
|
92
|
+ }
|
|
|
93
|
+
|
|
|
94
|
+ PageInfo<SystemLog> pageInfo = new PageInfo<SystemLog>(list);
|
|
|
95
|
+
|
|
73
|
96
|
return pageInfo;
|
|
74
|
97
|
}
|
|
75
|
98
|
|
|
|
@@ -104,7 +127,7 @@ public class SystemLogController {
|
|
104
|
127
|
|
|
105
|
128
|
String enumid = ObjectUtils.toString(orginfo.get("areaCode"), "0");
|
|
106
|
129
|
if (!"0".equals(enumid)) {
|
|
107
|
|
- String httpurl = "http://"+device_ip+":9022/Enum/findByEnum?id="+Integer.parseInt(enumid);
|
|
|
130
|
+ String httpurl = "http://localhost:9022/Enum/findByEnum?id="+Integer.parseInt(enumid);
|
|
108
|
131
|
String strResult = doGet(httpurl);
|
|
109
|
132
|
if (!"".equals(strResult)) {
|
|
110
|
133
|
JSONObject enum_obj = JSONObject.parseObject(strResult);
|