治理设备新增模块状态查询功能

This commit is contained in:
xy
2025-07-03 08:58:12 +08:00
parent cd07f8bee3
commit 4ee41b833b
52 changed files with 2088 additions and 51 deletions

View File

@@ -0,0 +1,20 @@
package com.njcn.csdevice.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.csdevice.api.fallback.CsCommunicateFeignClientFallbackFactory;
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* @author xy
*/
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/pqsCommunicate", fallbackFactory = CsCommunicateFeignClientFallbackFactory.class,contextId = "pqsCommunicate")
public interface CsCommunicateFeignClient {
@PostMapping("/insertion")
HttpResult<String> insertion(@RequestBody PqsCommunicateDto pqsCommunicateDto);
}

View File

@@ -1,11 +1,16 @@
package com.njcn.csdevice.api;
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.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.csdevice.api.fallback.EquipmentFeignClientFallbackFactory;
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -56,4 +61,7 @@ public interface EquipmentFeignClient {
@PostMapping("/judgeDevModel")
HttpResult<Boolean> judgeDevModel(@RequestParam("nDid") String nDid);
@PostMapping("/getDevByLineId")
HttpResult<CsEquipmentDeliveryPO> getDevByLineId(@RequestParam("lineId") String lineId);
}

View File

@@ -0,0 +1,23 @@
package com.njcn.csdevice.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.csdevice.api.fallback.IntegrityClientFallbackFactory;
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
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.RequestParam;
import java.util.List;
/**
* @author xy
*/
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/rStatIntegrityD", fallbackFactory = IntegrityClientFallbackFactory.class,contextId = "rStatIntegrityD")
public interface IntegrityFeignClient {
@PostMapping("/list")
HttpResult<List<RStatIntegrityD>> list(@Validated @RequestParam("list") List<String> list, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);
}

View File

@@ -0,0 +1,23 @@
package com.njcn.csdevice.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.csdevice.api.fallback.onlineRateClientFallbackFactory;
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
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.RequestParam;
import java.util.List;
/**
* @author xy
*/
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/rStatOnlineRateD", fallbackFactory = onlineRateClientFallbackFactory.class,contextId = "rStatOnlineRateD")
public interface OnlineRateFeignClient {
@PostMapping("/list")
HttpResult<List<RStatOnlineRateD>> list(@Validated @RequestParam("list") List<String> list, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);
}

View File

@@ -0,0 +1,40 @@
package com.njcn.csdevice.api.fallback;
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.csdevice.api.CsCommunicateFeignClient;
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
import com.njcn.csdevice.utils.CsDeviceEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* 类的介绍:
*
* @author xuyang
* @version 1.0.0
* @createTime 2023/4/10 20:09
*/
@Slf4j
@Component
public class CsCommunicateFeignClientFallbackFactory implements FallbackFactory<CsCommunicateFeignClient> {
@Override
public CsCommunicateFeignClient create(Throwable cause) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (cause.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) cause.getCause();
exceptionEnum = CsDeviceEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new CsCommunicateFeignClient() {
@Override
public HttpResult<String> insertion(PqsCommunicateDto pqsCommunicateDto) {
log.error("{}异常,降级处理,异常为:{}","新增记录",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -83,6 +83,12 @@ public class EquipmentFeignClientFallbackFactory implements FallbackFactory<Equi
log.error("{}异常,降级处理,异常为:{}","判断设备型号",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<CsEquipmentDeliveryPO> getDevByLineId(String lineId) {
log.error("{}异常,降级处理,异常为:{}","根据监测点id查询装置信息",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,37 @@
package com.njcn.csdevice.api.fallback;
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.csdevice.api.IntegrityFeignClient;
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author xy
*/
@Slf4j
@Component
public class IntegrityClientFallbackFactory implements FallbackFactory<IntegrityFeignClient> {
@Override
public IntegrityFeignClient create(Throwable cause) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (cause.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) cause.getCause();
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new IntegrityFeignClient() {
@Override
public HttpResult<List<RStatIntegrityD>> list(List<String> list, String startTime, String endTime) {
log.error("{}异常,降级处理,异常为:{}","查询数据异常",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,37 @@
package com.njcn.csdevice.api.fallback;
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.csdevice.api.OnlineRateFeignClient;
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author xy
*/
@Slf4j
@Component
public class onlineRateClientFallbackFactory implements FallbackFactory<OnlineRateFeignClient> {
@Override
public OnlineRateFeignClient create(Throwable cause) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (cause.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) cause.getCause();
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new OnlineRateFeignClient() {
@Override
public HttpResult<List<RStatOnlineRateD>> list(List<String> list, String startTime, String endTime) {
log.error("{}异常,降级处理,异常为:{}","查询数据异常",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,70 @@
package com.njcn.csdevice.param;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* 监测点有效数值统计数据评估入参
*
* @author hongawen
* @version 1.0
* @data 2024/11/6 20:36
*/
@Data
public class LineCountEvaluateParam implements Serializable {
/**
* 监测点编号集合
*/
private List<String> lineId;
/**
* 表名
*/
private String tableName;
/**
* 相别集合
*/
private List<String> phasicType;
/**
* 值类型
*/
private List<String> valueType;
/**
* 异常数据时间集合
* Map<String,List<String>> key:监测点id value:异常时间集合
*/
private Map<String, List<String>> abnormalTime;
/**
* 列名
*/
private String columnName;
/**
* 最小值 >=
*/
private String ge;
/**
* 最大值 <=
*/
private String lt;
/**
* 数据类型 判断获取数据是否排除暂态异常数据
*/
private Boolean dataType = true;
private String startTime;
private String endTime;
}

View File

@@ -0,0 +1,24 @@
package com.njcn.csdevice.pojo.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @Description:
* @Author: wr
* @Date: 2025/3/10 10:01
*/
@Data
public class PqsCommunicateDto implements Serializable {
private String time;
private String devId;
private String description;
private Integer type;
}

View File

@@ -34,4 +34,7 @@ public class CsEquipmentDeliveryQueryParm extends BaseParam {
@ApiModelProperty("运行状态 1:离线 2:在线")
private Integer runStatus;
@ApiModelProperty("流程步骤")
private Integer process;
}

View File

@@ -0,0 +1,35 @@
package com.njcn.csdevice.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDate;
/**
* <p>
* 数据完整性日表
* </p>
*
* @author xy
* @since 2025-06-23
*/
@Data
@TableName("r_stat_integrity_d")
public class RStatIntegrityD implements Serializable {
private static final long serialVersionUID = 1L;
@MppMultiId
private LocalDate timeId;
@MppMultiId
private String lineIndex;
private Integer dueTime;
private Integer realTime;
}

View File

@@ -0,0 +1,35 @@
package com.njcn.csdevice.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDate;
/**
* <p>
* 在线率日表
* </p>
*
* @author xy
* @since 2025-06-23
*/
@Data
@TableName("r_stat_onlinerate_d")
public class RStatOnlineRateD implements Serializable {
private static final long serialVersionUID = 1L;
@MppMultiId
private LocalDate timeId;
@MppMultiId
private String devIndex;
private Integer onlineMin;
private Integer offlineMin;
}

View File

@@ -0,0 +1,44 @@
package com.njcn.csdevice.pojo.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author xy
*/
@Data
public class EachModuleVO implements Serializable {
@ApiModelProperty("模块名称")
private String moduleName;
@ApiModelProperty("模块状态")
private String moduleState;
List<harmonicVo> dataList;
@Data
public static class harmonicVo implements Serializable {
@ApiModelProperty("稳态数据时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime time;
@ApiModelProperty("模块状态 0-离线1-运行2-停止3-故障")
private String stateDesc;
@ApiModelProperty("数据类型 0-稳态数据 1-事件数据 2-主动触发")
private Integer dataType;
@ApiModelProperty("事件code")
private String eventCode;
@ApiModelProperty("事件名称")
private String eventName;
}
}