系统配置
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.njcn.cswarn.api;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.cswarn.api.fallback.CsEquipmentAlarmClientFallbackFactory;
|
||||
import com.njcn.cswarn.pojo.parm.CsEquipmentAlarmParm;
|
||||
import com.njcn.cswarn.pojo.vo.CsEquipmentAlarmVO;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_WARN_BOOT, path = "/EquipmentAlarm", fallbackFactory = CsEquipmentAlarmClientFallbackFactory.class,contextId = "equipmentalarm")
|
||||
public interface CsEquipmentAlarmFeignClient {
|
||||
|
||||
|
||||
@PostMapping("/queryList")
|
||||
HttpResult<List<CsEquipmentAlarmVO>> queryList(@RequestBody CsEquipmentAlarmParm csEquipmentAlarmParm);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.njcn.cswarn.api.fallback;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.cswarn.api.CsEquipmentAlarmFeignClient;
|
||||
import com.njcn.cswarn.pojo.parm.CsEquipmentAlarmParm;
|
||||
import com.njcn.cswarn.pojo.vo.CsEquipmentAlarmVO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CsEquipmentAlarmClientFallbackFactory implements FallbackFactory<CsEquipmentAlarmFeignClient> {
|
||||
@Override
|
||||
public CsEquipmentAlarmFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new CsEquipmentAlarmFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsEquipmentAlarmVO>> queryList(CsEquipmentAlarmParm csEquipmentAlarmParm) {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询设备警告接口异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,17 @@
|
||||
package com.njcn.cswarn.pojo.parm;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.web.constant.ValidMessage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@@ -17,16 +22,12 @@ import java.time.LocalDateTime;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class CsEquipmentAlarmPageParm {
|
||||
@NotNull(message="当前页不能为空!")
|
||||
@Min(value = 1, message = "当前页不能为0")
|
||||
@ApiModelProperty(value = "当前页",name = "pageNum",dataType ="Integer",required = true)
|
||||
private Integer pageNum;
|
||||
/**显示条数*/
|
||||
@NotNull(message="显示条数不能为空!")
|
||||
@ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true)
|
||||
private Integer pageSize;
|
||||
public class CsEquipmentAlarmParm {
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty(value = "工程id")
|
||||
private String engineerId;
|
||||
/**
|
||||
* 项目Id
|
||||
*/
|
||||
@@ -46,6 +47,9 @@ public class CsEquipmentAlarmPageParm {
|
||||
@ApiModelProperty(value = "告警级别")
|
||||
private String alarmLevel;
|
||||
|
||||
@ApiModelProperty(value = "处理状态")
|
||||
private String dealFlag;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@@ -62,5 +66,18 @@ public class CsEquipmentAlarmPageParm {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class CsEquipmentAlarmPageParm extends CsEquipmentAlarmParm {
|
||||
@NotNull(message="当前页不能为空!")
|
||||
@Min(value = 1, message = "当前页不能为0")
|
||||
@ApiModelProperty(value = "当前页",name = "pageNum",dataType ="Integer",required = true)
|
||||
private Integer pageNum;
|
||||
/**显示条数*/
|
||||
@NotNull(message="显示条数不能为空!")
|
||||
@ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true)
|
||||
private Integer pageSize;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,11 +3,17 @@ package com.njcn.cswarn.pojo.parm;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.w3c.dom.stylesheets.LinkStyle;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
@@ -17,15 +23,11 @@ import java.time.LocalDateTime;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class CsEventDetailPageParm {
|
||||
@NotNull(message="当前页不能为空!")
|
||||
@Min(value = 1, message = "当前页不能为0")
|
||||
@ApiModelProperty(value = "当前页",name = "pageNum",dataType ="Integer",required = true)
|
||||
private Integer pageNum;
|
||||
/**显示条数*/
|
||||
@NotNull(message="显示条数不能为空!")
|
||||
@ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true)
|
||||
private Integer pageSize;
|
||||
public class CsEventDetailParm {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "工程id")
|
||||
private String engineerId;
|
||||
|
||||
/**
|
||||
* 项目Id
|
||||
@@ -33,6 +35,13 @@ public class CsEventDetailPageParm {
|
||||
@ApiModelProperty(value = "项目Id")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty(value = "设备id")
|
||||
private String devId;
|
||||
|
||||
@ApiModelProperty(value = "监测点id")
|
||||
private String lineId;
|
||||
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@@ -49,6 +58,17 @@ public class CsEventDetailPageParm {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class CsEventDetailPageParm extends CsEventDetailParm {
|
||||
@NotNull(message="当前页不能为空!")
|
||||
@Min(value = 1, message = "当前页不能为0")
|
||||
@ApiModelProperty(value = "当前页",name = "pageNum",dataType ="Integer",required = true)
|
||||
private Integer pageNum;
|
||||
/**显示条数*/
|
||||
@NotNull(message="显示条数不能为空!")
|
||||
@ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true)
|
||||
private Integer pageSize;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -68,7 +68,11 @@ public class CsEquipmentAlarmPO extends BaseEntity {
|
||||
*/
|
||||
@TableField(value = "`status`")
|
||||
private String status;
|
||||
|
||||
/*
|
||||
* 处理状态(0:已处理 1:未处理)
|
||||
* */
|
||||
@TableField(value = "deal_flag")
|
||||
private String dealFlag;
|
||||
|
||||
|
||||
public static final String COL_ID = "id";
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.cswarn.pojo.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2023/5/16 16:25【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class CsEquipmentAlarmCountVO extends BaseEntity {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "报警设备数")
|
||||
private Integer alarmDevCount;
|
||||
private List<AlarmDevice> devDetail;
|
||||
@Data
|
||||
public static class AlarmDevice{
|
||||
private String devId;
|
||||
private String devName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -16,7 +16,6 @@ import java.time.LocalDateTime;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "cs_equipment_alarm")
|
||||
public class CsEquipmentAlarmVO extends BaseEntity {
|
||||
/**
|
||||
* id
|
||||
|
||||
Reference in New Issue
Block a user