| | |
| | | docLog.setOperationDetail(operationDetail); |
| | | mapper.insert(docLog); |
| | | } |
| | | //下载专属日志记录 |
| | | public void recordOperationLogDownLoad(Long uId,String name, Integer operationType, Date operationTime, String terminalIp |
| | | , String operationMsg, String operationDetail,String oprateReason,String oprateInfo,String oprateVersion) { |
| | | DocLog docLog=new DocLog(); |
| | | docLog.setId(uId.intValue()); |
| | | docLog.setName(name); |
| | | docLog.setOprateType(operationType); |
| | | docLog.setOprateDay(operationTime); |
| | | docLog.setTerminalIp(terminalIp); |
| | | docLog.setOprateMsg(operationMsg); |
| | | docLog.setOperationDetail(operationDetail); |
| | | docLog.setOprateReason(oprateReason); |
| | | docLog.setOprateInfo(oprateInfo); |
| | | docLog.setOprateVersion(oprateVersion); |
| | | mapper.insert(docLog); |
| | | } |
| | | public PageInfo<DocLog> getPage(int pageNum, int pageSize, DocLog docLog) { |
| | | PageHelper.startPage(pageNum,pageSize,true); |
| | | //这个接口要兼容新老审计日志记录的查询 |
| | |
| | | ExcelUtil.exportExcel("UserLog-"+now,"测试sheet1",columnTitleArr,value,new HSSFWorkbook(),response); |
| | | } |
| | | |
| | | public void record(long uId, int operationType, String msg) { |
| | | public void record(long uId,String name, int operationType, String msg) { |
| | | DocLog docLog = new DocLog(); |
| | | docLog.setTerminalIp(ActionUtil.getRequest().getRemoteAddr()); |
| | | docLog.setOprateDay(new Date()); |
| | | docLog.setId((int)(uId)); |
| | | docLog.setName(name); |
| | | docLog.setOprateType(operationType); |
| | | docLog.setOprateMsg(msg); |
| | | mapper.insert(docLog); |
| | | } |
| | | |
| | | public void record(long uId, int operationType, String msg,String msgDetail) { |
| | | public void record(long uId,String name, int operationType, String msg,String msgDetail) { |
| | | DocLog docLog = new DocLog(); |
| | | docLog.setTerminalIp(ActionUtil.getRequest().getRemoteAddr()); |
| | | HttpServletRequest request = ActionUtil.getRequest(); |
| | | String remoteAddr; |
| | | if(request!=null) { |
| | | remoteAddr = request.getRemoteAddr(); |
| | | }else{ |
| | | remoteAddr = "127.0.0.1"; |
| | | } |
| | | docLog.setTerminalIp(remoteAddr); |
| | | docLog.setOprateDay(new Date()); |
| | | docLog.setId((int)(uId)); |
| | | docLog.setName(name); |
| | | docLog.setOprateType(operationType); |
| | | docLog.setOprateMsg(msg); |
| | | docLog.setOperationDetail(msgDetail); |
| | | mapper.insert(docLog); |
| | | } |
| | | |
| | | public void record2(HttpServletRequest request, long uId, int operationType, String msg, String msgDetail) { |
| | | public void record2(HttpServletRequest request,long uId, String name, int operationType, String msg, String msgDetail) { |
| | | DocLog docLog = new DocLog(); |
| | | docLog.setTerminalIp(request.getRemoteAddr()); |
| | | //userLog.setTerminalIp(request.getRemoteAddr()); |
| | | docLog.setOprateDay(new Date()); |
| | | docLog.setId((int)(uId)); |
| | | docLog.setName(name); |
| | | docLog.setOprateType(operationType); |
| | | docLog.setOprateMsg(msg); |
| | | docLog.setOperationDetail(msgDetail); |
| | |
| | | } |
| | | } |
| | | wrapper.ne("id", 0); |
| | | wrapper.ne("oprate_type",UserOperation.TYPE_EXCEPTION.getType()); |
| | | wrapper.orderByDesc("oprate_day"); |
| | | List<DocLog> list=mapper.selectList(wrapper); |
| | | list.stream().forEach(dlog->{ |
| | | dlog.setOperationTypeStr(UserOperation.getNameByType(dlog.getOprateType())); |
| | | }); |
| | | PageInfo pageInfo=new PageInfo(list); |
| | | return new Response().setII(1,list.size()>0?true:false,pageInfo,"数据返回"); |
| | | return new Response().setII(1,list.size()>0,pageInfo,"数据返回"); |
| | | } |
| | | //操作对应关系 |
| | | public Response getOperate() { |
| | | return new Response().setII(1,true,UserOperation.values(),"数据返回"); |
| | | } |
| | | //查询下载日志(DownLoadNew) |
| | | public Response getDownLoadNew(int type, String oprateInfo) { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.ne("id", 0); |
| | | wrapper.eq("oprate_type", type); |
| | | wrapper.eq("oprate_info", oprateInfo); |
| | | wrapper.orderByDesc("oprate_day"); |
| | | List<DocLog> list=mapper.selectList(wrapper); |
| | | list.stream().forEach(dlog->{ |
| | | dlog.setOperationTypeStr(UserOperation.getNameByType(dlog.getOprateType())); |
| | | }); |
| | | return new Response().setII(1,list.size()>0,list,"数据返回"); |
| | | } |
| | | } |