异常事件展示
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
package com.njcn.zlevent.pojo.param;
|
||||||
|
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ErrorEventParam extends BaseParam {
|
||||||
|
|
||||||
|
private String nDid;
|
||||||
|
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,19 +1,24 @@
|
|||||||
package com.njcn.zlevent.controller;
|
package com.njcn.zlevent.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.common.utils.LogUtil;
|
||||||
import com.njcn.mq.message.AppEventMessage;
|
import com.njcn.mq.message.AppEventMessage;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import com.njcn.zlevent.pojo.param.ErrorEventParam;
|
||||||
|
import com.njcn.zlevent.pojo.po.CsDevErrEvt;
|
||||||
import com.njcn.zlevent.service.ICsDevErrEvtService;
|
import com.njcn.zlevent.service.ICsDevErrEvtService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -46,5 +51,16 @@ public class CsDevErrEvtController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ApiOperation("查询异常事件列表分页")
|
||||||
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
|
public HttpResult<Page<CsDevErrEvt>> getList(@RequestBody @Validated ErrorEventParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("getList");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||||
|
Page<CsDevErrEvt> list = csDevErrEvtService.getList(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
package com.njcn.zlevent.mapper;
|
package com.njcn.zlevent.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.user.pojo.vo.RoleVO;
|
||||||
import com.njcn.zlevent.pojo.po.CsDevErrEvt;
|
import com.njcn.zlevent.pojo.po.CsDevErrEvt;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -13,4 +17,6 @@ import com.njcn.zlevent.pojo.po.CsDevErrEvt;
|
|||||||
*/
|
*/
|
||||||
public interface CsDevErrEvtMapper extends BaseMapper<CsDevErrEvt> {
|
public interface CsDevErrEvtMapper extends BaseMapper<CsDevErrEvt> {
|
||||||
|
|
||||||
|
Page<CsDevErrEvt> page(@Param("page")Page<CsDevErrEvt> page, @Param("ew") QueryWrapper<CsDevErrEvt> queryWrapper);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.njcn.zlevent.mapper.CsDevErrEvtMapper">
|
||||||
|
<select id="page" resultType="CsDevErrEvt">
|
||||||
|
SELECT
|
||||||
|
evt.*
|
||||||
|
FROM cs_dev_err_evt evt
|
||||||
|
WHERE ${ew.sqlSegment}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.njcn.zlevent.service;
|
package com.njcn.zlevent.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.mq.message.AppEventMessage;
|
import com.njcn.mq.message.AppEventMessage;
|
||||||
|
import com.njcn.zlevent.pojo.param.ErrorEventParam;
|
||||||
import com.njcn.zlevent.pojo.po.CsDevErrEvt;
|
import com.njcn.zlevent.pojo.po.CsDevErrEvt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20,4 +22,6 @@ public interface ICsDevErrEvtService extends IService<CsDevErrEvt> {
|
|||||||
*/
|
*/
|
||||||
void insertErrorEvent(AppEventMessage appEventMessage);
|
void insertErrorEvent(AppEventMessage appEventMessage);
|
||||||
|
|
||||||
|
Page<CsDevErrEvt> getList(ErrorEventParam param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,23 @@
|
|||||||
package com.njcn.zlevent.service.impl;
|
package com.njcn.zlevent.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
|
import com.njcn.db.constant.DbConstant;
|
||||||
import com.njcn.mq.message.AppEventMessage;
|
import com.njcn.mq.message.AppEventMessage;
|
||||||
|
import com.njcn.user.pojo.vo.RoleVO;
|
||||||
|
import com.njcn.web.factory.PageFactory;
|
||||||
import com.njcn.zlevent.mapper.CsDevErrEvtMapper;
|
import com.njcn.zlevent.mapper.CsDevErrEvtMapper;
|
||||||
|
import com.njcn.zlevent.pojo.param.ErrorEventParam;
|
||||||
import com.njcn.zlevent.pojo.po.CsDevErrEvt;
|
import com.njcn.zlevent.pojo.po.CsDevErrEvt;
|
||||||
import com.njcn.zlevent.service.ICsDevErrEvtService;
|
import com.njcn.zlevent.service.ICsDevErrEvtService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -38,6 +48,23 @@ public class CsDevErrEvtServiceImpl extends ServiceImpl<CsDevErrEvtMapper, CsDev
|
|||||||
this.saveBatch(list);
|
this.saveBatch(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<CsDevErrEvt> getList(ErrorEventParam param) {
|
||||||
|
// 构造时间字符串
|
||||||
|
QueryWrapper<CsDevErrEvt> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.between("evt.evt_time",param.getStartTime() + " 00:00:00",param.getEndTime() + " 23:59:59");
|
||||||
|
queryWrapper.orderBy(true, false, "evt.evt_time");
|
||||||
|
if (ObjectUtil.isNotNull(param)) {
|
||||||
|
//查询参数不为空,进行条件填充
|
||||||
|
if (StrUtil.isNotBlank(param.getSearchValue())) {
|
||||||
|
//用户表提供用户名、登录名 模糊查询
|
||||||
|
queryWrapper
|
||||||
|
.and(par -> par.like("evt.ndid", param.getSearchValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 时间转换
|
* 时间转换
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user