| | |
| | | package com.whyc.aop; |
| | | |
| | | import com.whyc.constant.OperationLogEnum; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.service.OperationLogService; |
| | | import com.whyc.util.UserUtil; |
| | |
| | | //类名 |
| | | // e.g: CKPowerDevRtSetController |
| | | String classNameTrue = fullClassNameSplit[fullClassNameSplit.length - 1]; |
| | | Integer operationType = 0; |
| | | String operationTypeName = null; |
| | | Integer type1 = 0; |
| | | Integer type2 = 0; |
| | | String operationTypeName = ""; |
| | | |
| | | //系统级 |
| | | if (classNameTrue.equals("UserInfController")) { |
| | | if(methodName.contains("add")){ //用户新增 |
| | | //TODO |
| | | type1 = OperationLogEnum.TYPE_1_SYS.getType(); |
| | | type2 = OperationLogEnum.TYPE_2_USER_ADD.getType(); |
| | | operationTypeName = OperationLogEnum.TYPE_2_USER_ADD.getName(); |
| | | |
| | | }else if(methodName.contains("update")){ //用户修改 |
| | | //TODO |
| | | type1 = OperationLogEnum.TYPE_1_SYS.getType(); |
| | | type2 = OperationLogEnum.TYPE_2_USER_UPDATE.getType(); |
| | | operationTypeName = OperationLogEnum.TYPE_2_USER_UPDATE.getName(); |
| | | }else if(methodName.contains("delete")){ //用户删除 |
| | | //TODO |
| | | }else if(methodName.contains("update")){ //密码重置 TODO |
| | | //TODO |
| | | type1 = OperationLogEnum.TYPE_1_SYS.getType(); |
| | | type2 = OperationLogEnum.TYPE_2_USER_DELETE.getType(); |
| | | operationTypeName = OperationLogEnum.TYPE_2_USER_DELETE.getName(); |
| | | }else if(methodName.contains("updatePassword")){ //密码重置 TODO |
| | | type1 = OperationLogEnum.TYPE_1_SYS.getType(); |
| | | type2 = OperationLogEnum.TYPE_2_USER_UPDATE_PASSWORD.getType(); |
| | | operationTypeName = OperationLogEnum.TYPE_2_USER_UPDATE_PASSWORD.getName(); |
| | | } |
| | | |
| | | }else if(classNameTrue.equals("LoginController")){ |
| | | if(methodName.equals("login")){ |
| | | if((boolean) response.getData()){ //用户登录 |
| | | //TODO |
| | | type1 = OperationLogEnum.TYPE_1_SYS.getType(); |
| | | type2 = OperationLogEnum.TYPE_2_LOGIN.getType(); |
| | | operationTypeName = OperationLogEnum.TYPE_2_LOGIN.getName(); |
| | | }else { //用户登录失败 |
| | | //TODO |
| | | type1 = OperationLogEnum.TYPE_1_SYS.getType(); |
| | | type2 = OperationLogEnum.TYPE_2_LOGIN_FAIL.getType(); |
| | | operationTypeName = OperationLogEnum.TYPE_2_LOGIN_FAIL.getName(); |
| | | } |
| | | }else if(methodName.equals("logout")){ //用户退出 |
| | | //TODO |
| | | type1 = OperationLogEnum.TYPE_1_SYS.getType(); |
| | | type2 = OperationLogEnum.TYPE_2_LOGOUT.getType(); |
| | | operationTypeName = OperationLogEnum.TYPE_2_LOGOUT.getName(); |
| | | } |
| | | } |
| | | //业务级 |
| | | else if(classNameTrue.equals("CKPowerDevSignalSetController") |
| | | ||classNameTrue.equals("CKPowerDevRtSetController")){ //电源设备设置 |
| | | if(methodName.startsWith("update")){ |
| | | //TODO |
| | | type1 = OperationLogEnum.TYPE_1_SERVICE.getType(); |
| | | type2 = OperationLogEnum.TYPE_2_POWER_UPDATE.getType(); |
| | | operationTypeName = OperationLogEnum.TYPE_2_POWER_UPDATE.getName(); |
| | | } |
| | | }else if(classNameTrue.equals("CKPowerDevBattRtStateSetController")){ //核容装置设置 |
| | | if(methodName.startsWith("update")){ |
| | | //TODO |
| | | type1 = OperationLogEnum.TYPE_1_SERVICE.getType(); |
| | | type2 = OperationLogEnum.TYPE_2_BATTERY_UPDATE.getType(); |
| | | operationTypeName = OperationLogEnum.TYPE_2_BATTERY_UPDATE.getName(); |
| | | } |
| | | }else if(classNameTrue.contains("Alarm") |
| | | ||classNameTrue.contains("Alm")){ //告警设置 |
| | | if(methodName.startsWith("update")){ |
| | | //TODO |
| | | type1 = OperationLogEnum.TYPE_1_SERVICE.getType(); |
| | | type2 = OperationLogEnum.TYPE_2_ALARM.getType(); |
| | | operationTypeName = OperationLogEnum.TYPE_2_ALARM.getName(); |
| | | } |
| | | } |
| | | // TODO else if() |
| | | |
| | | |
| | | |
| | | String module = "模块"; |
| | | String className = classNameTrue.replace("Controller:", module); |
| | | |
| | | //操作时间 |
| | | /* //操作时间 |
| | | Date operationTime = new Date(); |
| | | //客户端ip |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); |
| | | String terminalIp = request.getRemoteAddr(); |
| | | String terminalIp = request.getRemoteAddr();*/ |
| | | |
| | | //操作信息 |
| | | //获取切点方法信息 |
| | |
| | | String operationMsg = "执行了" + className + "的" + operationTypeName + "操作."; |
| | | String operationDetail = "具体调用方法为:" + methodName + ",具体参数为:" + map.toString(); |
| | | |
| | | //service.record(uId, operationType, operationTime, terminalIp, operationMsg, operationDetail, operationMsgEnUs, operationDetailEnUs); |
| | | service.record(uId, type1, type2, operationMsg, operationDetail); |
| | | |
| | | } |
| | | |