Commit 46be8b46 by guojuxing

日志接口添加

parent 8ea8b76e
...@@ -35,6 +35,21 @@ public class LogUtils { ...@@ -35,6 +35,21 @@ public class LogUtils {
* @return void
 * @return void


 */ 
 */
public static void createLog(String content, String operationObject) { public static void createLog(String content, String operationObject) {
doLog(content, operationObject, null, null);
}
/**
* 添加日志
* @param content 操作内容
* @param operationObject 操作对象
* @param relationId 菜单ID
* @param projectName 菜单名称
*/
public static void createLogForApp(String content, String operationObject, Integer relationId, String projectName) {
doLog(content, operationObject, relationId, projectName);
}
private static void doLog(String content, String operationObject, Integer relationId, String projectName) {
UserDetail userDetail = UserDetailUtils.getUserDetail(); UserDetail userDetail = UserDetailUtils.getUserDetail();
final SystemSetLogDTO logDTO = new SystemSetLogDTO(); final SystemSetLogDTO logDTO = new SystemSetLogDTO();
//操作时间 //操作时间
...@@ -50,6 +65,10 @@ public class LogUtils { ...@@ -50,6 +65,10 @@ public class LogUtils {
////操作对象 ////操作对象
logDTO.setBusinessName(operationObject); logDTO.setBusinessName(operationObject);
//操作模块 //操作模块
if (relationId != null) {
logDTO.setRelationId(Long.valueOf(relationId));
logDTO.setProject(projectName);
} else {
String moduleMenuName = (String) RequestContext.getContext().getRequest().getAttribute("moduleMenuName"); String moduleMenuName = (String) RequestContext.getContext().getRequest().getAttribute("moduleMenuName");
Integer moduleMenuId = (Integer) RequestContext.getContext().getRequest().getAttribute("moduleMenuId"); Integer moduleMenuId = (Integer) RequestContext.getContext().getRequest().getAttribute("moduleMenuId");
if (moduleMenuId != null) { if (moduleMenuId != null) {
...@@ -58,6 +77,7 @@ public class LogUtils { ...@@ -58,6 +77,7 @@ public class LogUtils {
} else { } else {
LOGGER.info("操作模块数据有误"); LOGGER.info("操作模块数据有误");
} }
}
//账号(手机号) //账号(手机号)
logDTO.setRemark1(userDetail.getUserInfo().getPhoneAreaCode()); logDTO.setRemark1(userDetail.getUserInfo().getPhoneAreaCode());
logDTO.setRemark2(userDetail.getUserInfo().getPhoneNumber()); logDTO.setRemark2(userDetail.getUserInfo().getPhoneNumber());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment