Browse Source

日志管理修改

wangli 4 years ago
parent
commit
f742a1cb0c

+ 3 - 3
smart-city-platform/src/main/java/com/bz/smart_city/advice/LogAdvice.java

@@ -82,10 +82,10 @@ public class LogAdvice {
 				sysLogs.setRemark(e.getMessage());
 				throw e;
 			} finally {
-//				if (sysLogs.getUserId() != null) {
+				if (sysLogs.getUserId() != null) {
 				sysLogs.setCreateTime(LocalDateTime.now());
-//					sysLogsService.insertSelective(sysLogs);
-//				}
+					sysLogsService.insertSelective(sysLogs);
+				}
 			}
 		}else {
 			return joinPoint.proceed();

+ 3 - 6
smart-city-platform/src/main/java/com/bz/smart_city/controller/system/OperationLogController.java

@@ -34,7 +34,6 @@ public class OperationLogController {
     @ApiOperation(value = "查询操作日志分页")
     public AjaxMessage<Pagination<OperationLog>> getPage(
             @ApiParam(value = "用户名", required = false) @RequestParam(required = false) String username,
-            @ApiParam(value = "操作名称", required = false) @RequestParam(required = false) String operationName,
             @ApiParam(value = "操作内容", required = false) @RequestParam(required = false) String content,
             @ApiParam(value = "手机号", required = false) @RequestParam(required = false) String mobilephone,
             @ApiParam(value = "开始时间 格式:yyyyMMddHHmmss", required = false) @RequestParam(required = false) @DateTimeFormat(pattern = "yyyyMMddHHmmss") LocalDateTime startDate,
@@ -42,7 +41,7 @@ public class OperationLogController {
             @ApiParam(value = "页数,非必传,默认第一页", required = false, defaultValue = "1") @RequestParam(required = false, defaultValue = "1") int pageNum,
             @ApiParam(value = "条数,非必传,默认15条", required = false, defaultValue = "15") @RequestParam(required = false, defaultValue = "15") int pageSize
     ){
-        Pagination<OperationLog> pageInfo = operationLogService.getPage(username, operationName,content, startDate, endDate, pageNum, pageSize,mobilephone);
+        Pagination<OperationLog> pageInfo = operationLogService.getPage(username,content, startDate, endDate, pageNum, pageSize,mobilephone);
         return new AjaxMessage<>(ResultStatus.OK, pageInfo);
     }
 
@@ -60,27 +59,25 @@ public class OperationLogController {
     @ApiOperation(value = "操作日志导出excel")
     public void getExcel(
             @ApiParam(value = "用户名", required = false) @RequestParam(required = false) String username,
-            @ApiParam(value = "操作名称", required = false) @RequestParam(required = false) String operationName,
             @ApiParam(value = "操作内容", required = false) @RequestParam(required = false) String content,
             @ApiParam(value = "手机号码", required = false) @RequestParam(required = false) String mobilephone,
             @ApiParam(value = "开始时间 格式:yyyyMMddHHmmss", required = false) @RequestParam(required = false) @DateTimeFormat(pattern = "yyyyMMddHHmmss") LocalDateTime startDate,
             @ApiParam(value = "开始时间 格式:yyyyMMddHHmmss", required = false) @RequestParam(required = false) @DateTimeFormat(pattern = "yyyyMMddHHmmss") LocalDateTime endDate,
             HttpServletResponse httpServletResponse
     ) {
-        operationLogService.getExcel(username, operationName,content, startDate, endDate, mobilephone, httpServletResponse);
+        operationLogService.getExcel(username,content, startDate, endDate, mobilephone, httpServletResponse);
     }
 
     @GetMapping("/getPayfeeExcel")
     @ApiOperation(value = "缴费操作日志导出excel")
     public void getPayfeeExcel(
             @ApiParam(value = "用户名", required = false) @RequestParam(required = false) String username,
-            @ApiParam(value = "操作名称", required = false) @RequestParam(required = false) String operationName,
             @ApiParam(value = "操作内容", required = false) @RequestParam(required = false) String content,
             @ApiParam(value = "手机号码", required = false) @RequestParam(required = false) String mobilephone,
             @ApiParam(value = "开始时间 格式:yyyyMMddHHmmss", required = false) @RequestParam(required = false) @DateTimeFormat(pattern = "yyyyMMddHHmmss") LocalDateTime startDate,
             @ApiParam(value = "开始时间 格式:yyyyMMddHHmmss", required = false) @RequestParam(required = false) @DateTimeFormat(pattern = "yyyyMMddHHmmss") LocalDateTime endDate,
             HttpServletResponse httpServletResponse
     ) {
-        operationLogService.getPayfeeExcel(username, operationName,content, startDate, endDate, mobilephone, httpServletResponse);
+        operationLogService.getPayfeeExcel(username,content, startDate, endDate, mobilephone, httpServletResponse);
     }
 }

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/dao/OperationLogMapper.java

@@ -15,6 +15,6 @@ public interface OperationLogMapper {
     int updateByPrimaryKeySelective(OperationLog record);
 
     List<OperationLog> getList(@Param("siteId") Integer siteId, @Param("programItems") List<ProgramItem> programItems,
-                               @Param("username") String username, @Param("operationName") String operationName, @Param("content") String content,
+                               @Param("username") String username,  @Param("content") String content,
                                @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate,@Param("mobilephone")String mobilephone);
 }

+ 3 - 3
smart-city-platform/src/main/java/com/bz/smart_city/service/OperationLogService.java

@@ -13,16 +13,16 @@ public interface OperationLogService {
 
     int updateByPrimaryKeySelective(OperationLog record);
 
-    Pagination<OperationLog> getPage(String username, String operationName, String content, LocalDateTime startDate,
+    Pagination<OperationLog> getPage(String username,  String content, LocalDateTime startDate,
                                      LocalDateTime endDate, int pageNum, int pageSize,String mobilephone);
 
     void add(OperationLog operationLog);
 
-    void getExcel(String username, String operationName, String content, LocalDateTime startDate, LocalDateTime endDate,String mobilephone, HttpServletResponse httpServletResponse);
+    void getExcel(String username,  String content, LocalDateTime startDate, LocalDateTime endDate,String mobilephone, HttpServletResponse httpServletResponse);
 
     void addMobileOperationLog(OperationLog operationLog);
 
-    void getPayfeeExcel(String username, String operationName, String content, LocalDateTime startDate, LocalDateTime endDate,String mobilephone, HttpServletResponse httpServletResponse);
+    void getPayfeeExcel(String username, String content, LocalDateTime startDate, LocalDateTime endDate,String mobilephone, HttpServletResponse httpServletResponse);
 
 }
 

+ 6 - 6
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/OperationLogServiceImpl.java

@@ -47,12 +47,12 @@ public class OperationLogServiceImpl implements OperationLogService {
     }
 
     @Override
-    public Pagination<OperationLog> getPage(String username, String operationName, String content,
+    public Pagination<OperationLog> getPage(String username,  String content,
                                             LocalDateTime startDate, LocalDateTime endDate, int pageNum, int pageSize,String mobilephone) {
         LoginUser loginUser = UserUtil.getCurrentUser();
         PageHelper.startPage(pageNum, pageSize);
         List<OperationLog> list = operationLogMapper.getList(loginUser.getSiteId(), UserUtil.getCurrentSiteProgramItems(loginUser), username,
-                operationName, content, startDate, endDate,mobilephone);
+                 content, startDate, endDate,mobilephone);
         return new Pagination<>(list);
     }
 
@@ -94,9 +94,9 @@ public class OperationLogServiceImpl implements OperationLogService {
     }
 
     @Override
-    public void getExcel(String username, String operationName, String content, LocalDateTime startDate, LocalDateTime endDate,String mobilephone, HttpServletResponse httpServletResponse) {
+    public void getExcel(String username,  String content, LocalDateTime startDate, LocalDateTime endDate,String mobilephone, HttpServletResponse httpServletResponse) {
         LoginUser loginUser = UserUtil.getCurrentUser();
-        List<OperationLog> list = operationLogMapper.getList(loginUser.getSiteId(), UserUtil.getCurrentSiteProgramItems(loginUser), username, operationName, content, startDate, endDate,mobilephone);
+        List<OperationLog> list = operationLogMapper.getList(loginUser.getSiteId(), UserUtil.getCurrentSiteProgramItems(loginUser), username, content, startDate, endDate,mobilephone);
         String title = "操作日志";
         String[] rowsName = new String[]{"序号", "时间", "用户名","手机号", "操作", "操作前", "操作后"};
         List<Object[]> dataList = newArrayList();
@@ -122,9 +122,9 @@ public class OperationLogServiceImpl implements OperationLogService {
         }
     }
 
-    public void getPayfeeExcel(String username, String operationName, String content, LocalDateTime startDate, LocalDateTime endDate,String mobilephone, HttpServletResponse httpServletResponse) {
+    public void getPayfeeExcel(String username, String content, LocalDateTime startDate, LocalDateTime endDate,String mobilephone, HttpServletResponse httpServletResponse) {
         LoginUser loginUser = UserUtil.getCurrentUser();
-        List<OperationLog> list = operationLogMapper.getList(loginUser.getSiteId(), UserUtil.getCurrentSiteProgramItems(loginUser), username, operationName, content, startDate, endDate,mobilephone);
+        List<OperationLog> list = operationLogMapper.getList(loginUser.getSiteId(), UserUtil.getCurrentSiteProgramItems(loginUser), username, content, startDate, endDate,mobilephone);
         String title = "操作日志";
         String[] rowsName = new String[]{"序号", "操作时间", "用户名","手机号", "操作内容"};
         List<Object[]> dataList = newArrayList();

+ 2 - 2
smart-city-platform/src/main/resources/mapper/OperationLogMapper.xml

@@ -156,8 +156,8 @@
           </foreach>
         </if>
         <if test="username != null and username != ''"> AND sol.username LIKE concat('%',#{username},'%')</if>
-        <if test="operationName != null and operationName != ''"> AND sol.operation_name LIKE concat('%',#{operationName},'%')</if>
-        <if test="content != null and content != ''"> AND (sol.old_data LIKE concat('%',#{content},'%') or sol.new_data LIKE concat('%',#{content},'%'))</if>
+        <if test="content != null and content != ''"> AND (sol.operation_name LIKE concat('%',#{content},'%')
+         or (sol.old_data LIKE concat('%',#{content},'%') or sol.new_data LIKE concat('%',#{content},'%')))</if>
         <if test="startDate != null"> and sol.create_date <![CDATA[ >= ]]> #{startDate}</if>
         <if test="endDate != null"> and sol.create_date <![CDATA[ <= ]]> #{endDate}</if>
          <if test="mobilephone != null and mobilephone != ''">AND sol.mobilephone LIKE concat('%',#{mobilephone},'%')</if>