old mode 100644
new mode 100755
| | |
| | | import com.genersoft.iot.vmp.storager.dao.dto.LogDto; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| | | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| | | import com.github.pagehelper.PageInfo; |
| | | |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.ParseException; |
| | | |
| | | @Tag(name = "日志管理") |
| | | @CrossOrigin |
| | | |
| | | @RestController |
| | | @RequestMapping("/api/log") |
| | | public class LogController { |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/all") |
| | | @Operation(summary = "分页查询报警") |
| | | @Operation(summary = "分页查询日志") |
| | | @Parameter(name = "query", description = "查询内容", required = true) |
| | | @Parameter(name = "page", description = "当前页", required = true) |
| | | @Parameter(name = "count", description = "每页查询数量", required = true) |
| | |
| | | if (ObjectUtils.isEmpty(query)) { |
| | | query = null; |
| | | } |
| | | if (ObjectUtils.isEmpty(startTime)) { |
| | | startTime = null; |
| | | } |
| | | if (ObjectUtils.isEmpty(endTime)) { |
| | | endTime = null; |
| | | } |
| | | if (!userSetting.getLogInDatebase()) { |
| | | |
| | | if (!userSetting.getLogInDatabase()) { |
| | | logger.warn("自动记录日志功能已关闭,查询结果可能不完整。"); |
| | | } |
| | | |
| | | if (!DateUtil.verification(startTime, DateUtil.formatter) || !DateUtil.verification(endTime, DateUtil.formatter)){ |
| | | throw new ControllerException(ErrorCode.ERROR400); |
| | | if (ObjectUtils.isEmpty(startTime)) { |
| | | startTime = null; |
| | | }else if (!DateUtil.verification(startTime, DateUtil.formatter) ){ |
| | | throw new ControllerException(ErrorCode.ERROR400.getCode(), "startTime格式为" + DateUtil.PATTERN); |
| | | } |
| | | |
| | | if (ObjectUtils.isEmpty(endTime)) { |
| | | endTime = null; |
| | | }else if (!DateUtil.verification(endTime, DateUtil.formatter) ){ |
| | | throw new ControllerException(ErrorCode.ERROR400.getCode(), "endTime格式为" + DateUtil.PATTERN); |
| | | } |
| | | |
| | | return logService.getAll(page, count, query, type, startTime, endTime); |
| | |
| | | * 清空日志 |
| | | * |
| | | */ |
| | | @Operation(summary = "停止视频回放") |
| | | @Operation(summary = "清空日志") |
| | | @DeleteMapping("/clear") |
| | | public void clear() { |
| | | logService.clear(); |