diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsDeviceUserFeignClient.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsDeviceUserFeignClient.java index 68fcefc..82b96ec 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsDeviceUserFeignClient.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsDeviceUserFeignClient.java @@ -5,6 +5,8 @@ import com.njcn.common.pojo.response.HttpResult; import com.njcn.csdevice.api.fallback.CsDeviceUserClientFallbackFactory; import com.njcn.csdevice.pojo.param.UserDevParam; import com.njcn.csdevice.pojo.po.CsDeviceUserPO; +import com.njcn.csdevice.pojo.vo.DevUserVO; +import io.swagger.annotations.ApiOperation; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -29,4 +31,11 @@ public interface CsDeviceUserFeignClient { @PostMapping("/channelDevByUserId") HttpResult> channelDevByUserId(@RequestBody UserDevParam param); + + @PostMapping("/queryUserById") + HttpResult queryUserById(@RequestParam("devId") String devId); + + @PostMapping("/getList") + @ApiOperation("根据设备集合获取数据") + HttpResult> getList(@RequestBody UserDevParam param); } diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsLedgerFeignClient.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsLedgerFeignClient.java index c7f1b79..d18b2fb 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsLedgerFeignClient.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsLedgerFeignClient.java @@ -35,6 +35,10 @@ public interface CsLedgerFeignClient { @PostMapping("/queryDevDetail") HttpResult queryDevDetail(@RequestParam("devId") String devId); + @PostMapping("/lineTree") + @ApiOperation("五层设备树(监测点层,根节点为治理设备和便携式设备)") + HttpResult> lineTree(); + @PostMapping("/deviceTree") @ApiOperation("三层设备树(装置层)") HttpResult> getDeviceTree(); diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsLineFeignClient.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsLineFeignClient.java index 09759cc..47c267d 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsLineFeignClient.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsLineFeignClient.java @@ -1,8 +1,13 @@ 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.CsLineClientFallbackFactory; +import com.njcn.csdevice.pojo.dto.CsLineDTO; import com.njcn.csdevice.pojo.param.CsLineParam; import com.njcn.csdevice.pojo.po.CsLinePO; import com.njcn.csdevice.pojo.vo.LineDetailDataVO; @@ -64,6 +69,9 @@ public interface CsLineFeignClient { @PostMapping("/getAllLine") HttpResult> getAllLine(); + @PostMapping("/getAllLineDetail") + HttpResult> getAllLineDetail(); + @PostMapping("/getOverLimitDataByIds") HttpResult> getOverLimitData(@RequestBody List ids); diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsUserPinsFeignClient.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsUserPinsFeignClient.java new file mode 100644 index 0000000..8ea1dd5 --- /dev/null +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsUserPinsFeignClient.java @@ -0,0 +1,22 @@ +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.ProcessFeignClientFallbackFactory; +import com.njcn.csdevice.pojo.po.CsUserPins; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; + +/** + * @author xy + */ +@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csUserPins", fallbackFactory = ProcessFeignClientFallbackFactory.class,contextId = "csUserPins") + +public interface CsUserPinsFeignClient { + + @PostMapping("/getPinToTopList") + HttpResult> getPinToTopList(); + +} diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/EngineeringFeignClient.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/EngineeringFeignClient.java new file mode 100644 index 0000000..62a8ade --- /dev/null +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/EngineeringFeignClient.java @@ -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.AppProjectClientFallbackFactory; +import com.njcn.csdevice.pojo.param.CsEngineeringQueryParm; +import com.njcn.csdevice.pojo.vo.CsEngineeringVO; +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 java.util.List; + +/** + * @author xy + */ +@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/engineering", fallbackFactory = AppProjectClientFallbackFactory.class,contextId = "engineering") +public interface EngineeringFeignClient { + + @PostMapping("/queryEngineering") + HttpResult> queryEngineering(@Validated @RequestBody CsEngineeringQueryParm csEngineeringQueryParm); +} diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsDeviceUserClientFallbackFactory.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsDeviceUserClientFallbackFactory.java index 72831b5..1469ba5 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsDeviceUserClientFallbackFactory.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsDeviceUserClientFallbackFactory.java @@ -6,6 +6,7 @@ import com.njcn.common.pojo.response.HttpResult; import com.njcn.csdevice.api.CsDeviceUserFeignClient; import com.njcn.csdevice.pojo.param.UserDevParam; import com.njcn.csdevice.pojo.po.CsDeviceUserPO; +import com.njcn.csdevice.pojo.vo.DevUserVO; import feign.hystrix.FallbackFactory; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -51,6 +52,18 @@ public class CsDeviceUserClientFallbackFactory implements FallbackFactory queryUserById(String devId) { + log.error("{}异常,降级处理,异常为:{}","获取设备主/子用户数据异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + + @Override + public HttpResult> getList(UserDevParam param) { + log.error("{}异常,降级处理,异常为:{}","根据设备集合获取数据异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + }; } } diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsLedgerFeignClientFallbackFactory.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsLedgerFeignClientFallbackFactory.java index a0bd4a7..af5cae4 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsLedgerFeignClientFallbackFactory.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsLedgerFeignClientFallbackFactory.java @@ -57,6 +57,12 @@ public class CsLedgerFeignClientFallbackFactory implements FallbackFactory> lineTree() { + log.error("{}异常,降级处理,异常为:{}","查询监测点数数据异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + @Override public HttpResult> getDeviceTree() { log.error("{}异常,降级处理,异常为:{}","查询设备树",cause.toString()); diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsLineClientFallbackFactory.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsLineClientFallbackFactory.java index 8a8f1f1..591e978 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsLineClientFallbackFactory.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsLineClientFallbackFactory.java @@ -4,6 +4,7 @@ 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.CsLineFeignClient; +import com.njcn.csdevice.pojo.dto.CsLineDTO; import com.njcn.csdevice.pojo.param.CsLineParam; import com.njcn.csdevice.pojo.po.CsLinePO; import com.njcn.csdevice.pojo.vo.LineDetailDataVO; @@ -103,6 +104,12 @@ public class CsLineClientFallbackFactory implements FallbackFactory> getAllLineDetail() { + log.error("{}异常,降级处理,异常为:{}","获取系统中所有监测点id详情异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + @Override public HttpResult> getOverLimitData(List ids) { log.error("{}异常,降级处理,异常为:{}","根据监测点id集合获取国标限值异常",cause.toString()); diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsUserPinsFeignClientFallbackFactory.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsUserPinsFeignClientFallbackFactory.java new file mode 100644 index 0000000..807cc81 --- /dev/null +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsUserPinsFeignClientFallbackFactory.java @@ -0,0 +1,43 @@ +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.CsUserPinsFeignClient; +import com.njcn.csdevice.pojo.po.CsUserPins; +import com.njcn.csdevice.utils.CsDeviceEnumUtil; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * 类的介绍: + * + * @author xuyang + * @version 1.0.0 + * @createTime 2023/4/10 20:09 + */ +@Slf4j +@Component +public class CsUserPinsFeignClientFallbackFactory implements FallbackFactory { + @Override + public CsUserPinsFeignClient 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 CsUserPinsFeignClient() { + + @Override + public HttpResult> getPinToTopList() { + log.error("{}异常,降级处理,异常为:{}","获取用户置顶设备(工程)数据异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + }; + } +} diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/EngineeringClientFallbackFactory.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/EngineeringClientFallbackFactory.java new file mode 100644 index 0000000..cde1f11 --- /dev/null +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/EngineeringClientFallbackFactory.java @@ -0,0 +1,38 @@ +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.EngineeringFeignClient; +import com.njcn.csdevice.pojo.param.CsEngineeringQueryParm; +import com.njcn.csdevice.pojo.vo.CsEngineeringVO; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @author xy + */ +@Slf4j +@Component +public class EngineeringClientFallbackFactory implements FallbackFactory { + @Override + public EngineeringFeignClient create(Throwable cause) { + //判断抛出异常是否为解码器抛出的业务异常 + Enum exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK; + if (cause.getCause() instanceof BusinessException) { + BusinessException businessException = (BusinessException) cause.getCause(); + } + Enum finalExceptionEnum = exceptionEnum; + return new EngineeringFeignClient() { + + @Override + public HttpResult> queryEngineering(CsEngineeringQueryParm csEngineeringQueryParm) { + log.error("{}异常,降级处理,异常为:{}","查询工程列表接口异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + }; + } +} diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/param/CsUserPinsParam.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/param/CsUserPinsParam.java new file mode 100644 index 0000000..c20160b --- /dev/null +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/param/CsUserPinsParam.java @@ -0,0 +1,28 @@ +package com.njcn.csdevice.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @author xy + */ +@Data +public class CsUserPinsParam implements Serializable { + + @ApiModelProperty("用户id") + @NotBlank(message = "用户id") + private String userId; + + @ApiModelProperty("目标类型:1-设备,2-工程") + @NotNull(message = "目标类型:1-设备,2-工程") + private Integer targetType; + + @ApiModelProperty("目标ID(设备ID或工程ID)") + @NotBlank(message = "目标ID(设备ID或工程ID)") + private String targetId; + +} diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/CsLineDTO.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/CsLineDTO.java new file mode 100644 index 0000000..257f2c1 --- /dev/null +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/CsLineDTO.java @@ -0,0 +1,148 @@ +package com.njcn.csdevice.pojo.dto; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@Data +@NoArgsConstructor +public class CsLineDTO implements Serializable { + /** + * 监测点id + */ + private String lineId; + + /** + * 装置id + */ + private String deviceId; + + /** + * 装置id + */ + private String deviceType; + + + /** + * 监测点名称 + */ + private String name; + + /** + * 字典表:安装位置(负载侧,电网侧, 输出侧) + */ + private String position; + + /** + * 数据集id + */ + private String dataSetId; + + /** + * 模板id + */ + private String dataModelId; + + /** + * 电压等级 + */ + private Double volGrade; + + /** + * PT变比 + */ + private Double ptRatio; + + /** + * PT2次变比 + */ + private Double pt2Ratio; + + /** + * CT变比 + */ + private Double ctRatio; + + /** + * CT2变比 + */ + private Double ct2Ratio; + + /** + * 状态(0:删除 1:正常) + */ + private Integer status; + + /** + * 接线方式(0-星型 1-角型 2-V型) + */ + private Integer conType; + + /** + * 逻辑子设备id(与模板对应) + */ + private Integer clDid; + + + /** + * 监测点统计间隔 + */ + private Integer lineInterval; + + /** + * 运行状态 + */ + private Integer runStatus; + + /** + * 监测点线路号 + */ + private Integer lineNo; + /** + * 监测对象类型 + */ + private String monitorObj; + /** + * 是否治理(0:未治理 1:已治理) + */ + private Integer govern; + + private String monitorUser; + + /** + * 短路容量 + */ + private Double shortCircuitCapacity; + + /** + * 设备容量 + */ + private Double devCapacity; + + /** + * 基准容量 + */ + private Double basicCapacity; + + /** + * 协议容量 + */ + private Double protocolCapacity; + + /** + * 治理报告文件路径 + */ + private String reportFilePath; + + /** + * 日志等级(NORMAL、DEBUG、WARN、ERROR) + */ + private String lineLogLevel; + + /** + * 是否是主要监测点(0: 不是 1:是) + */ + + private Integer isImportant; +} \ No newline at end of file diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/DevDetailDTO.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/DevDetailDTO.java index 414c32f..c8d0227 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/DevDetailDTO.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/DevDetailDTO.java @@ -31,4 +31,10 @@ public class DevDetailDTO { @ApiModelProperty(value = "设备名称") private String equipmentName; + + @ApiModelProperty(value = "设备通讯状态") + private Integer runStatus; + + @ApiModelProperty(value = "设备MAC地址") + private String devMac; } diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/LineParamDTO.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/LineParamDTO.java index 7ade0d6..9d21bb4 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/LineParamDTO.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/LineParamDTO.java @@ -3,6 +3,8 @@ package com.njcn.csdevice.pojo.dto; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.List; + /** * Description: * Date: 2023/8/1 15:25【需求编号】 @@ -26,4 +28,29 @@ public class LineParamDTO { @ApiModelProperty(value = "监测点id") private String lineId; + + @ApiModelProperty(value = "时间类型 0:日报 1:月报") + private Integer timeType; + + @ApiModelProperty(value = "时间") + private String time; + + @ApiModelProperty(value = "起始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + @ApiModelProperty(value = "集合") + private List list; + + @Data + public static class DevParamDTO { + + @ApiModelProperty(value = "时间") + private String time; + + @ApiModelProperty(value = "设备id集合") + private List devList; + } } diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/po/CsUserPins.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/po/CsUserPins.java new file mode 100644 index 0000000..dea1c25 --- /dev/null +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/po/CsUserPins.java @@ -0,0 +1,44 @@ +package com.njcn.csdevice.pojo.po; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + +/** + *

+ * 用户置顶表 + *

+ * + * @author xy + * @since 2026-03-04 + */ +@Getter +@Setter +@TableName("cs_user_pins") +public class CsUserPins extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + private String id; + + /** + * 用户ID + */ + private String userId; + + /** + * 目标类型:1-设备,2-工程 + */ + private Integer targetType; + + /** + * 目标ID(设备ID或工程ID) + */ + private String targetId; +} diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsEngineeringVO.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsEngineeringVO.java index e4f2029..8979f72 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsEngineeringVO.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsEngineeringVO.java @@ -67,5 +67,6 @@ public class CsEngineeringVO extends BaseEntity { @ApiModelProperty(value = "状态") private String status; - + @ApiModelProperty(value = "排序") + private Integer sort; } \ No newline at end of file diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsLedgerVO.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsLedgerVO.java index 1a57ffe..61275ca 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsLedgerVO.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsLedgerVO.java @@ -69,6 +69,9 @@ public class CsLedgerVO implements Serializable { @ApiModelProperty(name = "process",value = "流程状态") private Integer process; + @ApiModelProperty(name = "isTop",value = "是否置顶,默认不置顶") + private Integer isTop = 0; + @ApiModelProperty(name = "children",value = "子节点") private List children = new ArrayList<>(); diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/EngineeringHomePageVO.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/EngineeringHomePageVO.java new file mode 100644 index 0000000..b127c7a --- /dev/null +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/EngineeringHomePageVO.java @@ -0,0 +1,41 @@ +package com.njcn.csdevice.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * 类的介绍: + * + * @author xuyang + * @version 1.0.0 + * @createTime 2026/3/5 + */ +@Data +public class EngineeringHomePageVO implements Serializable { + + @ApiModelProperty(name = "engineeringId",value = "工程id") + private String engineeringId; + + @ApiModelProperty(name = "engineeringName",value = "工程名称") + private String engineeringName; + + @ApiModelProperty(name = "devTotal",value = "设备总数") + private Integer devTotal; + + @ApiModelProperty(name = "onlineDevTotal",value = "在线设备数") + private Integer onlineDevTotal; + + @ApiModelProperty(name = "offlineDevTotal",value = "离线设备数") + private Integer offlineDevTotal; + + @ApiModelProperty(name = "alarmTotal",value = "告警数量(未读)") + private Integer alarmTotal; + + @ApiModelProperty(name = "isTop",value = "是否置顶 0:未置顶 1:已置顶") + private Integer isTop = 0; + + @ApiModelProperty(name = "sort",value = "排序") + private Integer sort; +} diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/ProjectEquipmentVO.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/ProjectEquipmentVO.java index bbfe538..3ad739b 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/ProjectEquipmentVO.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/ProjectEquipmentVO.java @@ -1,8 +1,11 @@ package com.njcn.csdevice.pojo.vo; +import com.njcn.csdevice.pojo.po.CsLinePO; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.List; + /** * * Description: @@ -54,4 +57,16 @@ public class ProjectEquipmentVO { @ApiModelProperty(value = "设备nDid") private String nDid; + @ApiModelProperty(value = "排序") + private Integer sort; + + @ApiModelProperty(value = "是否置顶(0:未置顶 1:置顶),默认是0") + private Integer isTop = 0; + + @ApiModelProperty(value = "设备类型(监测设备:DEV_CLD 治理设备:Direct_Connected_Device)") + private String devType; + + @ApiModelProperty(value = "监测点集合") + private List lineList; + } \ No newline at end of file diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/DeviceUserController.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/DeviceUserController.java index 1283a0a..f3757be 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/DeviceUserController.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/DeviceUserController.java @@ -161,4 +161,14 @@ public class DeviceUserController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getList") + @ApiOperation("根据设备集合获取数据") + @ApiImplicitParam(name = "param", value = "参数", required = true) + public HttpResult> getList(@RequestBody UserDevParam param){ + String methodDescribe = getMethodDescribe("getList"); + List list = csDeviceUserPOService.getList(param); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); + } + } diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/ledger/CsLedgerController.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/ledger/CsLedgerController.java index 9f7adf7..586642b 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/ledger/CsLedgerController.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/ledger/CsLedgerController.java @@ -54,18 +54,20 @@ public class CsLedgerController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/lineTree") @ApiOperation("五层设备树(监测点层,根节点为治理设备和便携式设备)") - public HttpResult> lineTree(){ + @ApiImplicitParam(name = "type", value = "台账树类型") + public HttpResult> lineTree(@RequestParam(required = false) @Validated String type){ String methodDescribe = getMethodDescribe("lineTree"); - List list = csLedgerService.getLineTree(); + List list = csLedgerService.getLineTree(type); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); } @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/deviceTree") @ApiOperation("四层设备树(装置层,根节点为治理设备和便携式设备)") - public HttpResult> getDeviceTree(){ + @ApiImplicitParam(name = "type", value = "台账树类型") + public HttpResult> getDeviceTree(@RequestParam(required = false) @Validated String type){ String methodDescribe = getMethodDescribe("getDeviceTree"); - List list = csLedgerService.getDeviceTree(); + List list = csLedgerService.getDeviceTree(type); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); } diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/line/CslineController.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/line/CslineController.java index d6f8e9d..e9a8cc8 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/line/CslineController.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/line/CslineController.java @@ -7,6 +7,7 @@ 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.pojo.dto.CsLineDTO; import com.njcn.csdevice.pojo.param.CsLineParam; import com.njcn.csdevice.pojo.po.CsLinePO; import com.njcn.csdevice.pojo.vo.LineDetailDataVO; @@ -254,6 +255,15 @@ public class CslineController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); } + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getAllLineDetail") + @ApiOperation("获取所有监测点id详情") + public HttpResult> getAllLineDetail(){ + String methodDescribe = getMethodDescribe("getAllLineDetail"); + List list = csLinePOService.getAllLineDetail(); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); + } + @OperateInfo(info = LogEnum.BUSINESS_COMMON) @GetMapping("/getSimpleLine") @ApiOperation("查询登录用户拥有的监测点台账") diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/project/CsUserPinsController.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/project/CsUserPinsController.java new file mode 100644 index 0000000..f331824 --- /dev/null +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/project/CsUserPinsController.java @@ -0,0 +1,61 @@ +package com.njcn.csdevice.controller.project; + + +import com.njcn.common.pojo.annotation.OperateInfo; +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.param.CsUserPinsParam; +import com.njcn.csdevice.pojo.po.CsUserPins; +import com.njcn.csdevice.service.ICsUserPinsService; +import com.njcn.web.controller.BaseController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +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.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + *

+ * 用户置顶表 前端控制器 + *

+ * + * @author xy + * @since 2026-03-04 + */ +@Slf4j +@RestController +@RequestMapping("/csUserPins") +@Api(tags = "置顶设备(工程)") +@AllArgsConstructor +public class CsUserPinsController extends BaseController { + + private final ICsUserPinsService csUserPinsService; + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/engineeringPinToTop") + @ApiOperation("用户置顶工程(取消置顶)") + public HttpResult engineeringPinToTop(@Validated @RequestBody CsUserPinsParam param){ + String methodDescribe = getMethodDescribe("engineeringPinToTop"); + Boolean result = csUserPinsService.engineeringPinToTop(param); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getPinToTopList") + @ApiOperation("获取用户置顶设备(工程)") + public HttpResult> getPinToTopList(){ + String methodDescribe = getMethodDescribe("getPinToTopList"); + List result = csUserPinsService.getPinToTopList(); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); + } + +} + diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/project/EngineeringController.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/project/EngineeringController.java index a9dae71..f98c9db 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/project/EngineeringController.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/project/EngineeringController.java @@ -103,4 +103,5 @@ public class EngineeringController extends BaseController { List result = csEngineeringService.getUnlinkedEngineering(userId); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); } + } diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/CsLinePOMapper.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/CsLinePOMapper.java index b30b576..4fdb0cc 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/CsLinePOMapper.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/CsLinePOMapper.java @@ -1,6 +1,7 @@ package com.njcn.csdevice.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.csdevice.pojo.dto.CsLineDTO; import com.njcn.csdevice.pojo.po.CsLinePO; import org.apache.ibatis.annotations.Param; @@ -21,4 +22,6 @@ public interface CsLinePOMapper extends BaseMapper { Map getCustomDetailByLineId(@Param("lineId")String lineId); + + List findLineList(); } \ No newline at end of file diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/CsUserPinsMapper.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/CsUserPinsMapper.java new file mode 100644 index 0000000..4c2498f --- /dev/null +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/CsUserPinsMapper.java @@ -0,0 +1,16 @@ +package com.njcn.csdevice.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.csdevice.pojo.po.CsUserPins; + +/** + *

+ * 用户置顶表 Mapper 接口 + *

+ * + * @author xy + * @since 2026-03-04 + */ +public interface CsUserPinsMapper extends BaseMapper { + +} diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/mapping/CsEquipmentDeliveryMapper.xml b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/mapping/CsEquipmentDeliveryMapper.xml index 4abdad8..8381dc9 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/mapping/CsEquipmentDeliveryMapper.xml +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/mapping/CsEquipmentDeliveryMapper.xml @@ -41,7 +41,9 @@ c.create_time createTime, c.run_status, c.mac mac, - c.process process + c.process process, + c.sort sort, + c.dev_type devType FROM (select * from cs_ledger where LEVEL = 0 and State =1 ) a, diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/mapping/CsLinePOMapper.xml b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/mapping/CsLinePOMapper.xml index b129d8f..9f3b5e6 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/mapping/CsLinePOMapper.xml +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/mapping/CsLinePOMapper.xml @@ -53,4 +53,15 @@ WHERE line.line_id = #{lineId} + + diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsDeviceUserPOService.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsDeviceUserPOService.java index 96dd638..39784b1 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsDeviceUserPOService.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsDeviceUserPOService.java @@ -53,4 +53,6 @@ public interface CsDeviceUserPOService extends IService{ List findDevByUserId(String userId); void channelDevByUserId(UserDevParam param); + + List getList(UserDevParam param); } diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsLinePOService.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsLinePOService.java index 27aebb1..1e3b6dc 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsLinePOService.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsLinePOService.java @@ -2,6 +2,7 @@ package com.njcn.csdevice.service; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.csdevice.pojo.dto.CsLineDTO; import com.njcn.csdevice.pojo.param.CsLineParam; import com.njcn.csdevice.pojo.po.CsLinePO; import com.njcn.csdevice.pojo.vo.LineDetailDataVO; @@ -81,6 +82,8 @@ public interface CsLinePOService extends IService{ List getAllLine(); + List getAllLineDetail(); + List getSimpleLine(); List getLineBySensitiveUser(List list); diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/ICsLedgerService.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/ICsLedgerService.java index 0df39c6..616fcfe 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/ICsLedgerService.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/ICsLedgerService.java @@ -29,13 +29,13 @@ public interface ICsLedgerService extends IService { * 获取终端台账树 * @return */ - List getLineTree(); + List getLineTree(String type); /** * 终端三层树 * @return */ - List getDeviceTree(); + List getDeviceTree(String type); /** * 新增台账数据 diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/ICsUserPinsService.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/ICsUserPinsService.java new file mode 100644 index 0000000..aa8b919 --- /dev/null +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/ICsUserPinsService.java @@ -0,0 +1,35 @@ +package com.njcn.csdevice.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.csdevice.param.CsUserPinsParam; +import com.njcn.csdevice.pojo.po.CsUserPins; +import com.njcn.csdevice.pojo.vo.CsLedgerVO; + +import java.util.List; + +/** + *

+ * 用户置顶表 服务类 + *

+ * + * @author xy + * @since 2026-03-04 + */ +public interface ICsUserPinsService extends IService { + + boolean engineeringPinToTop(CsUserPinsParam param); + + List getPinToTopList(); + + /** + * 针对台账树中存在置顶的数据进行排序 + * + * @param list 置顶数据 + * @param tree 台账树 + * @param level 树的层级 + * 如果第一层不是工程,并且是5层树,level = 5 ,5层树层级必须是 0:设备类型 1:工程 2:项目 3:设备 4:监测点 + * 如果第一层是工程,level = 4 ,4层树层级必须是 0:工程 1:项目 2:设备 3:监测点,其余层级的树也可以使用level = 4,只要是工程、项目、设备、监测点这样的结构就行 + */ + void channelTree(List list, List tree, Integer level); + +} diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsDeviceUserPOServiceImpl.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsDeviceUserPOServiceImpl.java index 690cbd3..701e0bb 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsDeviceUserPOServiceImpl.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsDeviceUserPOServiceImpl.java @@ -17,6 +17,7 @@ import com.njcn.csdevice.pojo.vo.CsLedgerVO; import com.njcn.csdevice.pojo.vo.DevCountVO; import com.njcn.csdevice.pojo.vo.DevUserVO; import com.njcn.csdevice.service.*; +import com.njcn.csdevice.utils.StringUtil; import com.njcn.csharmonic.api.EventUserFeignClient; import com.njcn.csharmonic.param.CsEventUserQueryParam; import com.njcn.csharmonic.pojo.vo.EventDetailVO; @@ -28,6 +29,7 @@ import com.njcn.user.enums.AppRoleEnum; import com.njcn.user.pojo.po.User; import com.njcn.web.utils.RequestUtil; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -156,7 +158,7 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl deviceTree = iCsLedgerService.getDeviceTree(); + List deviceTree = iCsLedgerService.getDeviceTree(null); //由于多加了一程便携式设备 List collect1 = deviceTree.stream() .map(CsLedgerVO::getChildren).flatMap(Collection::stream) @@ -406,7 +408,12 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl findDevByUserId(String userId) { List result = new ArrayList<>(); - List list = this.lambdaQuery().eq(CsDeviceUserPO::getPrimaryUserId,userId).list(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.and(wrapper -> + wrapper.eq(CsDeviceUserPO::getPrimaryUserId, userId) + .or() + .eq(CsDeviceUserPO::getSubUserId, userId)); + List list = this.list(queryWrapper); if (CollectionUtil.isNotEmpty(list)){ result = list.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList()); } @@ -416,8 +423,26 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId,param.getUserId()) - .in(CsDeviceUserPO::getDeviceId,param.getList()); + queryWrapper.and(wrapper -> + wrapper.eq(CsDeviceUserPO::getPrimaryUserId, param.getUserId()) + .or() + .eq(CsDeviceUserPO::getSubUserId, param.getUserId()) + ).in(CsDeviceUserPO::getDeviceId, param.getList()); this.remove(queryWrapper); } + + @Override + public List getList(UserDevParam param) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + if (StringUtils.isNotBlank(param.getUserId())) { + queryWrapper.and(wrapper -> + wrapper.eq(CsDeviceUserPO::getPrimaryUserId, param.getUserId()) + .or() + .eq(CsDeviceUserPO::getSubUserId, param.getUserId()) + ); + } + queryWrapper.in(CsDeviceUserPO::getDeviceId, param.getList()) + .eq(CsDeviceUserPO::getStatus, "1"); + return this.list(queryWrapper); + } } diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsEngineeringServiceImpl.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsEngineeringServiceImpl.java index 6b4643f..5a1e216 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsEngineeringServiceImpl.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsEngineeringServiceImpl.java @@ -165,7 +165,7 @@ public class CsEngineeringServiceImpl extends ServiceImpl csEngineeringPOS = this.getBaseMapper ( ).selectList (queryWrapper); csEngineeringVOList = csEngineeringPOS.stream ().map (temp->{ CsEngineeringVO vo = new CsEngineeringVO(); @@ -297,7 +297,6 @@ public class CsEngineeringServiceImpl extends ServiceImpl list = this.baseMapper.queryProjectEquipmentVO(returnpage,projectEquipmentQueryParm,device); - list.getRecords().stream().forEach(temp->{ + //根据设备id获取监测点id集合 + List lineIds = csLinePOService.getLineByDev(device); + + list.getRecords().forEach(temp->{ temp.setIsPrimaryUser(csDeviceUserPOService.isPrimaryUser(temp.getEquipmentId())); + //获取设备类型 + SysDicTreePO po = dictTreeFeignClient.queryById(temp.getDevType()).getData(); + temp.setDevType(po.getCode()); + temp.setLineList(lineIds.stream().filter(line -> line.getDevId().equals(temp.getEquipmentId())).sorted(Comparator.comparing(CsLinePO::getLineId)).collect(Collectors.toList())); }); + + List recordList = list.getRecords(); + //获取用户置顶的设备 + List topList = csUserPinsService.getPinToTopList(); + List targetIdList = topList.stream() + .filter(item -> Objects.equals(item.getTargetType(), 1)) + .map(CsUserPins::getTargetId) + .collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(targetIdList)) { + List matchedList = new ArrayList<>(); + List unmatchedList = new ArrayList<>(); + for (ProjectEquipmentVO node : recordList) { + if (targetIdList.contains(node.getEquipmentId())) { + node.setIsTop(1); + matchedList.add(node); + } else { + unmatchedList.add(node); + } + } + // 根据 targetIdList 的顺序对匹配的节点进行排序 + matchedList.sort(Comparator.comparingInt(node -> targetIdList.indexOf(node.getEquipmentId()))); + // 未匹配的节点按照原有的 sort 字段排序,处理 null 值情况 + unmatchedList.sort(Comparator.comparing(node -> node.getSort() != null ? node.getSort() : Integer.MAX_VALUE)); + // 清空原列表并添加排序后的数据 + recordList.clear(); + recordList.addAll(matchedList); + recordList.addAll(unmatchedList); + list.setRecords(recordList); + } return list; } @@ -385,7 +425,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl dataSet = new ArrayList<>(); List modelId = csDevModelRelationService.findModelByDevId(deviceId); if (CollUtil.isNotEmpty(modelId)){ @@ -394,6 +434,15 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl dataSet = new ArrayList<>(); + List modelId = csDevModelRelationService.findModelByDevId(deviceId); + if (CollUtil.isNotEmpty(modelId)){ + for (CsDevModelRelationPO item : modelId) { + dataSet.addAll(csDataSetService.findDataSetByModelId(item.getModelId(),1)); + } + setDataSetValues(csEquipmentDeliveryPo, dataSet, dataSetList, type, deviceManagerVo); + } } } return deviceManagerVo; @@ -733,9 +782,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl 0) { + //谁新建的设备,则认为是该设备的主用户,新建用户设备关系表数据 + boolean addUser = csDeviceUserPOService.add(csEquipmentDeliveryPo.getId()); + + if (result && ObjectUtil.isNotNull(relation) && addLedger > 0 && addUser) { refreshDeviceDataCache(); } return csEquipmentDeliveryPo; @@ -1037,6 +1090,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl idSet.contains(data.getId())) .collect(Collectors.toList()); + } else { + result.clear(); + return result; } } return result; diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsLedgerServiceImpl.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsLedgerServiceImpl.java index 34d3343..963f9b3 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsLedgerServiceImpl.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsLedgerServiceImpl.java @@ -21,7 +21,7 @@ import com.njcn.csdevice.pojo.po.*; import com.njcn.csdevice.pojo.vo.CsLedgerVO; import com.njcn.csdevice.service.*; import com.njcn.csharmonic.api.PqSensitiveUserFeignClient; -import com.njcn.csharmonic.pojo.po.PqSensitiveUser; +import com.njcn.device.biz.pojo.po.PqSensitiveUser; import com.njcn.redis.utils.RedisUtil; import com.njcn.system.api.AreaFeignClient; import com.njcn.system.api.DictTreeFeignClient; @@ -67,12 +67,12 @@ public class CsLedgerServiceImpl extends ServiceImpl i private final CsDeviceUserPOMapper csDeviceUserPOMapper; private final PqSensitiveUserFeignClient pqSensitiveUserFeignClient; private final UserFeignClient userFeignClient; - + private final ICsUserPinsService csUserPinsService; @Override public List getLedgerTree() { List list = new ArrayList<>(); - List engineeringList = getLineTree(); + List engineeringList = getLineTree(null); CsLedgerVO vo = new CsLedgerVO(); vo.setId("9999999"); vo.setLevel(0); @@ -85,7 +85,7 @@ public class CsLedgerServiceImpl extends ServiceImpl i } @Override - public List getLineTree() { + public List getLineTree(String type) { List engineeringList; List allList = this.baseMapper.getAll(); /*获取用户工程,设备信息过滤*/ @@ -267,18 +267,131 @@ public class CsLedgerServiceImpl extends ServiceImpl i cld.setChildren(engineeringList2); List tree = new ArrayList<>(); - if (CollUtil.isNotEmpty(portables)) { - tree.add(portable); - } - if (CollUtil.isNotEmpty(deviceList)) { - tree.add(government); - } - if (CollUtil.isNotEmpty(cldDeviceList)) { - tree.add(cld); + //获取置顶的工程 + List list = csUserPinsService.getPinToTopList(); + if (Objects.equals(type,"engineering")) { + + Map engineeringMap = new HashMap<>(); + + engineeringList1.forEach(eng -> { + CsLedgerVO existingEng = engineeringMap.get(eng.getId()); + if (existingEng == null) { + engineeringMap.put(eng.getId(), eng); + } else { + List mergedChildren = mergeProjectList(existingEng.getChildren(), eng.getChildren()); + existingEng.setChildren(mergedChildren); + } + }); + + engineeringList2.forEach(eng -> { + CsLedgerVO existingEng = engineeringMap.get(eng.getId()); + if (existingEng == null) { + engineeringMap.put(eng.getId(), eng); + } else { + List mergedChildren = mergeProjectList(existingEng.getChildren(), eng.getChildren()); + existingEng.setChildren(mergedChildren); + } + }); + + tree.addAll(new ArrayList<>(engineeringMap.values())); + + String id = IdUtil.simpleUUID(); + CsLedgerVO portable1 = new CsLedgerVO(); + portable1.setLevel(0); + portable1.setName("便携式工程"); + portable1.setPid("0"); + portable1.setId(id); + + CsLedgerVO portable2 = new CsLedgerVO(); + portable2.setLevel(1); + portable2.setName("便携式项目"); + portable2.setPid(id); + portable2.setId(IdUtil.simpleUUID()); + portable2.setChildren(portables); + + portable1.setChildren(Collections.singletonList(portable2)); + tree.add(portable1); + + if (CollectionUtil.isNotEmpty(list)) { + csUserPinsService.channelTree(list, tree, 4); + } + } else { + //按设备类型统计 + if (CollUtil.isNotEmpty(portables)) { + tree.add(portable); + } + if (CollUtil.isNotEmpty(deviceList)) { + tree.add(government); + } + if (CollUtil.isNotEmpty(cldDeviceList)) { + tree.add(cld); + } + + if (CollectionUtil.isNotEmpty(list)) { + csUserPinsService.channelTree(list, tree, 5); + } } return tree; } + /** + * 合并两个项目列表,根据项目 ID 去重并合并子节点 + */ + private List mergeProjectList(List list1, List list2) { + if (CollectionUtil.isEmpty(list1)) { + return list2 != null ? new ArrayList<>(list2) : new ArrayList<>(); + } + if (CollectionUtil.isEmpty(list2)) { + return new ArrayList<>(list1); + } + + Map projectMap = new HashMap<>(); + + list1.forEach(project -> { + projectMap.put(project.getId(), cloneProject(project)); + }); + + list2.forEach(project -> { + CsLedgerVO existingProject = projectMap.get(project.getId()); + if (existingProject == null) { + projectMap.put(project.getId(), cloneProject(project)); + } else { + List mergedDevices = new ArrayList<>(); + if (existingProject.getChildren() != null) { + mergedDevices.addAll(existingProject.getChildren()); + } + if (project.getChildren() != null) { + mergedDevices.addAll(project.getChildren()); + } + existingProject.setChildren(mergedDevices); + } + }); + + return new ArrayList<>(projectMap.values()); + } + + /** + * 克隆项目对象,避免引用问题 + */ + private CsLedgerVO cloneProject(CsLedgerVO project) { + CsLedgerVO cloned = new CsLedgerVO(); + cloned.setId(project.getId()); + cloned.setPid(project.getPid()); + cloned.setLevel(project.getLevel()); + cloned.setName(project.getName()); + cloned.setType(project.getType()); + cloned.setComFlag(project.getComFlag()); + cloned.setNDId(project.getNDId()); + cloned.setProcess(project.getProcess()); + cloned.setLineType(project.getLineType()); + cloned.setConType(project.getConType()); + cloned.setSort(project.getSort()); + if (project.getChildren() != null) { + cloned.setChildren(new ArrayList<>(project.getChildren())); + } + return cloned; + } + //剔除未接入的设备(根据status判断不太稳,所有这里直接判断该设备有没有对应的模板指标) private void checkDevSetData(List ledgerVOS) { Iterator iterator = ledgerVOS.iterator(); @@ -309,7 +422,7 @@ public class CsLedgerServiceImpl extends ServiceImpl i @Override - public List getDeviceTree() { + public List getDeviceTree(String type) { List engineeringList; List allList = this.baseMapper.getAll(); /*获取用户工程,设备信息过滤*/ @@ -471,14 +584,69 @@ public class CsLedgerServiceImpl extends ServiceImpl i cld.setChildren(engineeringList2); List tree = new ArrayList<>(); - if (CollUtil.isNotEmpty(portables)) { - tree.add(portable); + List list = csUserPinsService.getPinToTopList(); + if (Objects.equals(type,"engineering")) { + + Map engineeringMap = new HashMap<>(); + + engineeringList1.forEach(eng -> { + CsLedgerVO existingEng = engineeringMap.get(eng.getId()); + if (existingEng == null) { + engineeringMap.put(eng.getId(), eng); + } else { + List mergedChildren = mergeProjectList(existingEng.getChildren(), eng.getChildren()); + existingEng.setChildren(mergedChildren); + } + }); + + engineeringList2.forEach(eng -> { + CsLedgerVO existingEng = engineeringMap.get(eng.getId()); + if (existingEng == null) { + engineeringMap.put(eng.getId(), eng); + } else { + List mergedChildren = mergeProjectList(existingEng.getChildren(), eng.getChildren()); + existingEng.setChildren(mergedChildren); + } + }); + + tree.addAll(new ArrayList<>(engineeringMap.values())); + + String id = IdUtil.simpleUUID(); + CsLedgerVO portable1 = new CsLedgerVO(); + portable1.setLevel(0); + portable1.setName("便携式工程"); + portable1.setPid("0"); + portable1.setId(id); + + CsLedgerVO portable2 = new CsLedgerVO(); + portable2.setLevel(1); + portable2.setName("便携式项目"); + portable2.setPid(id); + portable2.setId(IdUtil.simpleUUID()); + portable2.setChildren(portables); + + List portable2List = new ArrayList<>(); + portable2List.add(portable2); + portable1.setChildren(portable2List); + tree.add(portable1); + + if (CollectionUtil.isNotEmpty(list)) { + csUserPinsService.channelTree(list, tree, 4); + } + } else { + //按设备类型统计 + if (CollUtil.isNotEmpty(portables)) { + tree.add(portable); + } + if (CollUtil.isNotEmpty(deviceList)) { + tree.add(government); + } + if (CollUtil.isNotEmpty(cldDevList)) { + tree.add(cld); + } } - if (CollUtil.isNotEmpty(deviceList)) { - tree.add(government); - } - if (CollUtil.isNotEmpty(cldDevList)) { - tree.add(cld); + if (CollectionUtil.isNotEmpty(list)) { + csUserPinsService.channelTree(list, tree, 5); } return tree; } @@ -575,10 +743,14 @@ public class CsLedgerServiceImpl extends ServiceImpl i public DevDetailDTO queryDevDetail(String devId) { DevDetailDTO device = new DevDetailDTO(); CsLedger dev = this.findDataById(devId); + //获取设备mac + CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(devId); + //如果是便携式设备,pid为0,项目,工程都设置为/ if (Objects.equals(dev.getPid(), "0")) { device.setEquipmentName(dev.getName()); device.setEquipmentId(devId); + device.setDevMac(po.getMac()); device.setProjectId("/"); device.setProjectName("/"); device.setEngineeringid("/"); @@ -586,11 +758,11 @@ public class CsLedgerServiceImpl extends ServiceImpl i } else { device.setEquipmentName(dev.getName()); device.setEquipmentId(devId); + device.setDevMac(po.getMac()); CsLedger project = this.findDataById(dev.getPid()); if (ObjectUtil.isNotNull(project)) { device.setProjectId(project.getId()); device.setProjectName(project.getName()); - CsLedger engineer = this.findDataById(project.getPid()); if (ObjectUtil.isNotNull(engineer)) { device.setEngineeringid(engineer.getId()); @@ -972,100 +1144,210 @@ public class CsLedgerServiceImpl extends ServiceImpl i @Override public CsLedgerVO cldTree() { - - List engineerTree = new ArrayList<>(); - List projectTree = new ArrayList<>(); - List deviceTree = new ArrayList<>(); - List lineTree = new ArrayList<>(); - List allList = this.baseMapper.getAll(); - if (CollectionUtil.isNotEmpty(allList)) { - //工程集合 - List tree1 = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode())).collect(Collectors.toList()); - //项目集合 - List tree2 = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).collect(Collectors.toList()); - //设备集合 - List tree3 = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode())).collect(Collectors.toList()); - //监测点集合 - List tree4 = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(allList)) { + CsLedgerVO government = new CsLedgerVO(); + government.setLevel(0); + government.setName(DataParam.cldDev); + government.setPid("0"); + government.setId(IdUtil.simpleUUID()); + government.setChildren(new ArrayList<>()); + return government; + } - //筛选出云前置设备 - if (CollectionUtil.isNotEmpty(tree3)) { - Set list1 = new HashSet<>(); - List devList = tree3.stream().map(CsLedgerVO::getId).collect(Collectors.toList()); - List devs = csEquipmentDeliveryMapper.selectBatchIds(devList); - Map devsMap = devs.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity())); - DictTreeVO vo1 = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData(); + DictTreeVO cldDict = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData(); + String cldDevTypeId = cldDict.getId(); - //list1是 cld设备 - devs.forEach(item -> { - if (item.getDevType().equals(vo1.getId())) { - list1.add(item.getId()); - } - }); - //list2是 非cld设备 - Set list2 = devList.stream().filter(item -> !list1.contains(item)).collect(Collectors.toSet()); - List tree5 = tree3.stream().filter(vo -> list2.contains(vo.getId())).collect(Collectors.toList()); - Set list3 = tree5.stream().map(CsLedgerVO::getPid).collect(Collectors.toSet()); - projectTree = tree2.stream().filter(vo -> !list3.contains(vo.getId())).collect(Collectors.toList()); + List engineeringList = allList.stream() + .filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode())) + .collect(Collectors.toList()); - List tree6 = tree2.stream().filter(vo -> list3.contains(vo.getId())).collect(Collectors.toList()); - Set proList = tree6.stream().map(CsLedgerVO::getPid).collect(Collectors.toSet()); - engineerTree = tree1.stream().filter(vo -> !proList.contains(vo.getId())).collect(Collectors.toList()); + List projectList = allList.stream() + .filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())) + .collect(Collectors.toList()); - if (CollectionUtil.isNotEmpty(list1)) { - deviceTree = tree3.stream() - .filter(vo -> list1.contains(vo.getId())) - .peek(item -> { - CsEquipmentDeliveryPO dev = devsMap.get(item.getId()); - if (dev != null) { - item.setComFlag(dev.getRunStatus()); - } - }) - .collect(Collectors.toList()); + List deviceList = allList.stream() + .filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode())) + .collect(Collectors.toList()); - lineTree = tree4.stream() - .filter(vo -> list1.contains(vo.getPid())) - .peek(item -> { - CsEquipmentDeliveryPO dev = devsMap.get(item.getId()); - if (dev != null) { - item.setComFlag(dev.getRunStatus()); - } - }) - .collect(Collectors.toList()); + List lineList = allList.stream() + .filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())) + .collect(Collectors.toList()); + + if (CollectionUtil.isEmpty(deviceList)) { + CsLedgerVO government = new CsLedgerVO(); + government.setLevel(0); + government.setName(DataParam.cldDev); + government.setPid("0"); + government.setId(IdUtil.simpleUUID()); + government.setChildren(engineeringList); + return government; + } + + List devIds = deviceList.stream().map(CsLedgerVO::getId).collect(Collectors.toList()); + List devs = csEquipmentDeliveryMapper.selectBatchIds(devIds); + Map devsMap = devs.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity())); + Map lineDevMap = lineList.stream().collect(Collectors.toMap(CsLedgerVO::getId, CsLedgerVO::getPid)); + + Set cldDevIds = devs.stream() + .filter(item -> item.getDevType().equals(cldDevTypeId)) + .map(CsEquipmentDeliveryPO::getId) + .collect(Collectors.toSet()); + + Map> projectToDeviceMap = deviceList.stream() + .collect(Collectors.groupingBy(CsLedgerVO::getPid)); + + Map> deviceToLineMap = lineList.stream() + .collect(Collectors.groupingBy(CsLedgerVO::getPid)); + + deviceList.forEach(device -> { + CsEquipmentDeliveryPO dev = devsMap.get(device.getId()); + if (dev != null) { + device.setComFlag(dev.getRunStatus()); + } + }); + + lineList.forEach(line -> { + String devId = lineDevMap.get(line.getId()); + if (devId != null) { + CsEquipmentDeliveryPO dev = devsMap.get(devId); + if (dev != null) { + line.setComFlag(dev.getRunStatus()); } } - } + }); - if (CollectionUtil.isNotEmpty(deviceTree)) { - List finalLineTree = lineTree; - deviceTree.forEach(item -> { - item.setChildren(getChildren(item, finalLineTree)); - }); - } - if (CollectionUtil.isNotEmpty(projectTree)) { - List finalDeviceTree = deviceTree; - projectTree.forEach(item -> { - item.setChildren(getChildren(item, finalDeviceTree)); - }); - } - if (CollectionUtil.isNotEmpty(engineerTree)) { - List finalProjectTree = projectTree; - engineerTree.forEach(item -> { - item.setChildren(getChildren(item, finalProjectTree)); - }); - } + engineeringList.forEach(engineering -> { + List projectChildren = new ArrayList<>(); + for (CsLedgerVO project : projectList) { + if (project.getPid().equals(engineering.getId())) { + List projectDevices = projectToDeviceMap.getOrDefault(project.getId(), new ArrayList<>()); + if (CollectionUtil.isNotEmpty(projectDevices)) { + List deviceChildren = new ArrayList<>(); + for (CsLedgerVO device : projectDevices) { + if (cldDevIds.contains(device.getId())) { + List lineChildren = deviceToLineMap.getOrDefault(device.getId(), new ArrayList<>()); + device.setChildren(lineChildren); + deviceChildren.add(device); + } + } + project.setChildren(deviceChildren); + } + projectChildren.add(project); + } + } + engineering.setChildren(projectChildren); + }); CsLedgerVO government = new CsLedgerVO(); government.setLevel(0); government.setName(DataParam.cldDev); government.setPid("0"); government.setId(IdUtil.simpleUUID()); - government.setChildren(engineerTree); + government.setChildren(engineeringList); return government; } + + + +// @Override +// public CsLedgerVO cldTree() { +// +// List engineerTree = new ArrayList<>(); +// List projectTree = new ArrayList<>(); +// List deviceTree = new ArrayList<>(); +// List lineTree = new ArrayList<>(); +// +// List allList = this.baseMapper.getAll(); +// if (CollectionUtil.isNotEmpty(allList)) { +// //工程集合 +// List tree1 = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode())).collect(Collectors.toList()); +// //项目集合 +// List tree2 = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).collect(Collectors.toList()); +// //设备集合 +// List tree3 = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode())).collect(Collectors.toList()); +// //监测点集合 +// List tree4 = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())).collect(Collectors.toList()); +// +// //筛选出云前置设备 +// if (CollectionUtil.isNotEmpty(tree3)) { +// Set list1 = new HashSet<>(); +// List devList = tree3.stream().map(CsLedgerVO::getId).collect(Collectors.toList()); +// List devs = csEquipmentDeliveryMapper.selectBatchIds(devList); +// Map devsMap = devs.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity())); +// DictTreeVO vo1 = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData(); +// +// //list1是 cld设备 +// devs.forEach(item -> { +// if (item.getDevType().equals(vo1.getId())) { +// list1.add(item.getId()); +// } +// }); +// //list2是 非cld设备 +// Set list2 = devList.stream().filter(item -> !list1.contains(item)).collect(Collectors.toSet()); +// List tree5 = tree3.stream().filter(vo -> list2.contains(vo.getId())).collect(Collectors.toList()); +// Set list3 = tree5.stream().map(CsLedgerVO::getPid).collect(Collectors.toSet()); +// projectTree = tree2.stream().filter(vo -> !list3.contains(vo.getId())).collect(Collectors.toList()); +// +// List tree6 = tree2.stream().filter(vo -> list3.contains(vo.getId())).collect(Collectors.toList()); +// Set proList = tree6.stream().map(CsLedgerVO::getPid).collect(Collectors.toSet()); +// engineerTree = tree1.stream().filter(vo -> !proList.contains(vo.getId())).collect(Collectors.toList()); +// +// if (CollectionUtil.isNotEmpty(list1)) { +// deviceTree = tree3.stream() +// .filter(vo -> list1.contains(vo.getId())) +// .peek(item -> { +// CsEquipmentDeliveryPO dev = devsMap.get(item.getId()); +// if (dev != null) { +// item.setComFlag(dev.getRunStatus()); +// } +// }) +// .collect(Collectors.toList()); +// +// lineTree = tree4.stream() +// .filter(vo -> list1.contains(vo.getPid())) +// .peek(item -> { +// CsEquipmentDeliveryPO dev = devsMap.get(item.getId()); +// if (dev != null) { +// item.setComFlag(dev.getRunStatus()); +// } +// }) +// .collect(Collectors.toList()); +// } +// } +// } +// +// if (CollectionUtil.isNotEmpty(deviceTree)) { +// List finalLineTree = lineTree; +// deviceTree.forEach(item -> { +// item.setChildren(getChildren(item, finalLineTree)); +// }); +// } +// if (CollectionUtil.isNotEmpty(projectTree)) { +// List finalDeviceTree = deviceTree; +// projectTree.forEach(item -> { +// item.setChildren(getChildren(item, finalDeviceTree)); +// }); +// } +// if (CollectionUtil.isNotEmpty(engineerTree)) { +// List finalProjectTree = projectTree; +// engineerTree.forEach(item -> { +// item.setChildren(getChildren(item, finalProjectTree)); +// }); +// } +// +// CsLedgerVO government = new CsLedgerVO(); +// government.setLevel(0); +// government.setName(DataParam.cldDev); +// government.setPid("0"); +// government.setId(IdUtil.simpleUUID()); +// government.setChildren(engineerTree); +// +// return government; +// } + @Override public List getInfoByIds(List list) { List details = new ArrayList<>(); @@ -1100,20 +1382,47 @@ public class CsLedgerServiceImpl extends ServiceImpl i @Override public List getDevInfoByEngineerIds(List list) { List details = new ArrayList<>(); + + //工程 + LambdaQueryWrapper queryWrapper0 = new LambdaQueryWrapper<>(); + queryWrapper0.in(CsLedger::getId, list); + List engineering = this.list(queryWrapper0); + Map engineeringMap = engineering.stream().collect(Collectors.toMap(CsLedger::getId, item -> item)); + + //项目 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.in(CsLedger::getPid, list); List project = this.list(queryWrapper); - //工程id + Map projectMap = project.stream().collect(Collectors.toMap(CsLedger::getId, item -> item)); + + //设备 List projectIds = project.stream().map(CsLedger::getId).collect(Collectors.toList()); LambdaQueryWrapper queryWrapper2 = new LambdaQueryWrapper<>(); queryWrapper2.in(CsLedger::getPid, projectIds); List dev = this.list(queryWrapper2); - dev.forEach(item -> { - DevDetailDTO detail = new DevDetailDTO(); - detail.setEquipmentName(item.getName()); - detail.setEquipmentId(item.getId()); - details.add(detail); - }); + + if (CollectionUtil.isNotEmpty(dev)) { + List devIds = dev.stream().map(CsLedger::getId).collect(Collectors.toList()); + List devs = csEquipmentDeliveryMapper.selectBatchIds(devIds); + Map devsMap = devs.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, item -> item)); + + dev.forEach(item -> { + DevDetailDTO detail = new DevDetailDTO(); + detail.setEquipmentName(item.getName()); + detail.setEquipmentId(item.getId()); + + CsLedger csLedger = projectMap.get(item.getPid()); + detail.setProjectId(csLedger.getId()); + detail.setProjectName(csLedger.getName()); + + CsLedger csLedger1 = engineeringMap.get(csLedger.getPid()); + detail.setEngineeringid(csLedger1.getId()); + detail.setEngineeringName(csLedger1.getName()); + detail.setRunStatus(devsMap.get(item.getId()).getRunStatus()); + + details.add(detail); + }); + } return details; } diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsLinePOServiceImpl.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsLinePOServiceImpl.java index e697ce9..91a612c 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsLinePOServiceImpl.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsLinePOServiceImpl.java @@ -16,6 +16,7 @@ import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.utils.PubUtils; import com.njcn.csdevice.enums.LineBaseEnum; import com.njcn.csdevice.mapper.*; +import com.njcn.csdevice.pojo.dto.CsLineDTO; import com.njcn.csdevice.pojo.param.CsLineParam; import com.njcn.csdevice.pojo.po.*; import com.njcn.csdevice.pojo.vo.LineDetailDataVO; @@ -24,7 +25,7 @@ import com.njcn.csdevice.service.CsDevModelService; import com.njcn.csdevice.service.CsLinePOService; import com.njcn.csdevice.service.ICsDataSetService; import com.njcn.csharmonic.api.PqSensitiveUserFeignClient; -import com.njcn.csharmonic.pojo.po.PqSensitiveUser; +import com.njcn.device.biz.pojo.po.PqSensitiveUser; import com.njcn.oss.constant.OssPath; import com.njcn.oss.utils.FileStorageUtil; import com.njcn.system.api.DicDataFeignClient; @@ -153,8 +154,8 @@ public class CsLinePOServiceImpl extends ServiceImpl i List list = csDataSetService.findDataSetByModelId(po1.getId()); if (CollectionUtil.isNotEmpty(list)) { po.setDataSetId(list.get(0).getId()); - po.setClDid(list.get(0).getClDev()); } + po.setClDid(param.getLineNo()); //监测位置 //DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.GRID_SIDE.getCode()).getData(); po.setPosition(param.getPosition()); @@ -270,6 +271,11 @@ public class CsLinePOServiceImpl extends ServiceImpl i .collect(Collectors.toList()); } + @Override + public List getAllLineDetail() { + return this.baseMapper.findLineList(); + } + @Override public List getSimpleLine() { List devIds = commGetDevIds(RequestUtil.getUserIndex()); diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsUserPinsServiceImpl.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsUserPinsServiceImpl.java new file mode 100644 index 0000000..dc74fd3 --- /dev/null +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsUserPinsServiceImpl.java @@ -0,0 +1,184 @@ +package com.njcn.csdevice.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.csdevice.mapper.CsUserPinsMapper; +import com.njcn.csdevice.param.CsUserPinsParam; +import com.njcn.csdevice.pojo.po.CsUserPins; +import com.njcn.csdevice.pojo.vo.CsLedgerVO; +import com.njcn.csdevice.service.ICsUserPinsService; +import com.njcn.web.utils.RequestUtil; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + *

+ * 用户置顶表 服务实现类 + *

+ * + * @author xy + * @since 2026-03-04 + */ +@Service +public class CsUserPinsServiceImpl extends ServiceImpl implements ICsUserPinsService { + + @Override + public boolean engineeringPinToTop(CsUserPinsParam param) { + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.eq(CsUserPins::getUserId, param.getUserId()) + .eq(CsUserPins::getTargetId, param.getTargetId()) + .eq(CsUserPins::getTargetType, param.getTargetType()); + CsUserPins csUserPins = this.getOne(wrapper); + //为空,则是置顶 + if (Objects.isNull(csUserPins)) { + CsUserPins po = new CsUserPins(); + BeanUtils.copyProperties(param, po); + this.save(po); + } + //有数据则是取消置顶 + else { + this.removeById(csUserPins.getId()); + } + return true; + } + + @Override + public List getPinToTopList() { + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.eq(CsUserPins::getUserId, RequestUtil.getUserIndex()) + .orderByDesc(CsUserPins::getCreateTime); + return this.list(wrapper); + } + + @Override + public void channelTree(List list, List tree, Integer level) { + List targetIdList = new ArrayList<>(); + List devList = new ArrayList<>(); + switch (level) { + case 1: + break; + case 2: + break; + case 3: + break; + case 4: + // 处理工程置顶(第一层) + targetIdList = list.stream() + .filter(item -> Objects.equals(item.getTargetType(), 2)) + .map(CsUserPins::getTargetId) + .collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(targetIdList)) { + sortByTargetList(tree, targetIdList); + } + + // 处理设备置顶(第三层) + devList = list.stream() + .filter(item -> Objects.equals(item.getTargetType(), 1)) + .map(CsUserPins::getTargetId) + .collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(devList)) { + // 遍历 tree,找到第三层的数据进行排序 + for (CsLedgerVO firstLevelNode : tree) { + if (firstLevelNode.getLevel() == 0 && CollectionUtil.isNotEmpty(firstLevelNode.getChildren())) { + // 第二层 + for (CsLedgerVO secondLevelNode : firstLevelNode.getChildren()) { + if (CollectionUtil.isNotEmpty(secondLevelNode.getChildren())) { + // 第三层 + sortByTargetList(secondLevelNode.getChildren(), devList); + } + } + } + } + } + break; + case 5: + // 处理工程置顶(第二层,因为最上面加了一层) + targetIdList = list.stream() + .filter(item -> Objects.equals(item.getTargetType(), 2)) + .map(CsUserPins::getTargetId) + .collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(targetIdList)) { + sortSecondLevelByTargetList(tree, targetIdList); + } + // 处理设备置顶(第四层) + devList = list.stream() + .filter(item -> Objects.equals(item.getTargetType(), 1)) + .map(CsUserPins::getTargetId) + .collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(devList)) { + sortFourthLevelByDevList(tree, devList); + } + break; + default: + break; + + } + } + + /** + * 根据目标 ID 列表对节点列表进行排序 + * @param nodeList 需要排序的节点列表 + * @param targetIdList 目标 ID 列表(决定排序顺序) + */ + private void sortByTargetList(List nodeList, List targetIdList) { + // 分离出匹配 targetIdList 的节点和未匹配的节点 + List matchedList = new ArrayList<>(); + List unmatchedList = new ArrayList<>(); + for (CsLedgerVO node : nodeList) { + if (targetIdList.contains(node.getId())) { + node.setIsTop(1); + matchedList.add(node); + } else { + unmatchedList.add(node); + } + } + // 根据 targetIdList 的顺序对匹配的节点进行排序 + matchedList.sort(Comparator.comparingInt(node -> targetIdList.indexOf(node.getId()))); + // 未匹配的节点按照原有的 sort 字段排序,处理 null 值情况 + unmatchedList.sort(Comparator.comparing(node -> node.getSort() != null ? node.getSort() : Integer.MAX_VALUE)); + // 清空原列表并添加排序后的数据 + nodeList.clear(); + nodeList.addAll(matchedList); + nodeList.addAll(unmatchedList); + } + + /** + * 根据目标 ID 列表对第二层节点进行排序(因为最上面加了一层) + */ + private void sortSecondLevelByTargetList(List tree, List targetIdList) { + for (CsLedgerVO firstLevelNode : tree) { + if (CollectionUtil.isNotEmpty(firstLevelNode.getChildren())) { + sortByTargetList(firstLevelNode.getChildren(), targetIdList); + } + } + } + + /** + * 根据设备 ID 列表对第四层节点进行排序 + */ + private void sortFourthLevelByDevList(List tree, List devList) { + for (CsLedgerVO firstLevelNode : tree) { + if (CollectionUtil.isNotEmpty(firstLevelNode.getChildren())) { + for (CsLedgerVO secondLevelNode : firstLevelNode.getChildren()) { + if (CollectionUtil.isNotEmpty(secondLevelNode.getChildren())) { + for (CsLedgerVO thirdLevelNode : secondLevelNode.getChildren()) { + if (CollectionUtil.isNotEmpty(thirdLevelNode.getChildren())) { + // 第四层 + sortByTargetList(thirdLevelNode.getChildren(), devList); + } + } + } + } + } + } + } + + +} diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/IcdServiceImpl.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/IcdServiceImpl.java index 8004ec8..7472266 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/IcdServiceImpl.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/IcdServiceImpl.java @@ -31,8 +31,10 @@ import com.njcn.mq.message.BZEventMessage; import com.njcn.mq.template.BZEventMessageTemplate; import com.njcn.redis.pojo.enums.AppRedisKey; import com.njcn.redis.utils.RedisUtil; +import com.njcn.system.api.DictTreeFeignClient; import com.njcn.system.enums.DicDataEnum; import com.njcn.system.pojo.po.SysDicTreePO; +import com.njcn.system.pojo.vo.DictTreeVO; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; @@ -63,6 +65,7 @@ class IcdServiceImpl implements IcdService { private final ICsTerminalLogsService csTerminalLogsService; private final ICsTerminalReplyService csTerminalReplyService; private final OverLimitWlMapper overLimitWlMapper; + private final DictTreeFeignClient dictTreeFeignClient; private final DateTimeFormatter microsecondFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS"); @Override @@ -537,7 +540,13 @@ class IcdServiceImpl implements IcdService { // 设置设备信息 List devList = csEquipmentDeliveryService.getDevListByProjectId(id); if (CollectionUtil.isNotEmpty(devList)) { - vo.setDeviceInfoList(devList); + //如果不是监测设备,则不展示 + DictTreeVO cldDict = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData(); + String cldDevTypeId = cldDict.getId(); + List cldDevIds = devList.stream() + .filter(item -> item.getDevType().equals(cldDevTypeId)) + .collect(Collectors.toList()); + vo.setDeviceInfoList(cldDevIds); } } diff --git a/cs-harmonic/cs-harmonic-api/pom.xml b/cs-harmonic/cs-harmonic-api/pom.xml index e201c4e..807ec7b 100644 --- a/cs-harmonic/cs-harmonic-api/pom.xml +++ b/cs-harmonic/cs-harmonic-api/pom.xml @@ -62,6 +62,11 @@ common-poi ${project.version} + + com.njcn + harmonic-common + ${project.version} + UTF-8 diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/CsAlarmFeignClient.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/CsAlarmFeignClient.java new file mode 100644 index 0000000..06407d2 --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/CsAlarmFeignClient.java @@ -0,0 +1,42 @@ +package com.njcn.csharmonic.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.response.HttpResult; +import com.njcn.csharmonic.api.fallback.CsAlarmFeignClientFallbackFactory; +import com.njcn.csharmonic.pojo.po.CsAlarm; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import org.springframework.cloud.openfeign.FeignClient; +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_HARMONIC_BOOT, path = "/csAlarm", fallbackFactory = CsAlarmFeignClientFallbackFactory.class,contextId = "csAlarm") +public interface CsAlarmFeignClient { + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/addList") + @ApiOperation("批量写入数据") + @ApiImplicitParam(name = "list", value = "参数", required = true) + HttpResult addList(@RequestBody List list); + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/queryListByTime") + @ApiOperation("按日期查询数据") + @ApiImplicitParam(name = "time", value = "时间", required = true) + HttpResult> queryListByTime(@RequestParam("time") String time); + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/deleteListByTime") + @ApiOperation("按日期删除数据") + @ApiImplicitParam(name = "time", value = "时间", required = true) + HttpResult deleteListByTime(@RequestParam("time") String time); + +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/CsHarmonicFeignClient.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/CsHarmonicFeignClient.java new file mode 100644 index 0000000..99315e4 --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/CsHarmonicFeignClient.java @@ -0,0 +1,34 @@ +package com.njcn.csharmonic.api; + +import com.njcn.common.pojo.constant.ServerInfo; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.csharmonic.api.fallback.CsHarmonicFeignClientFallbackFactory; +import com.njcn.csharmonic.pojo.po.CsHarmonic; +import io.swagger.annotations.ApiOperation; +import org.springframework.cloud.openfeign.FeignClient; +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_HARMONIC_BOOT, path = "/csHarmonic", fallbackFactory = CsHarmonicFeignClientFallbackFactory.class,contextId = "csHarmonic") +public interface CsHarmonicFeignClient { + + @PostMapping("/addList") + @ApiOperation("批量写入数据") + HttpResult addList(@RequestBody List list); + + @PostMapping("/queryListByTime") + @ApiOperation("按日期查询数据") + HttpResult> queryListByTime(@RequestParam(value = "time") String time); + + + @PostMapping("/deleteListByTime") + @ApiOperation("按日期删除数据") + HttpResult deleteListByTime(@RequestParam(value = "time") String time); + +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/EventFeignClient.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/EventFeignClient.java index 5f84903..108e766 100644 --- a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/EventFeignClient.java +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/EventFeignClient.java @@ -1,19 +1,13 @@ package com.njcn.csharmonic.api; 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.enums.response.CommonResponseEnum; import com.njcn.common.pojo.response.HttpResult; -import com.njcn.common.utils.HttpResultUtil; import com.njcn.csdevice.pojo.vo.DataGroupEventVO; import com.njcn.csharmonic.api.fallback.EventFeignClientFallbackFactory; import com.njcn.csharmonic.param.CsEventUserQueryPage; +import com.njcn.csharmonic.param.CsEventUserQueryParam; import com.njcn.csharmonic.pojo.po.CsEventPO; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -40,4 +34,11 @@ public interface EventFeignClient { @PostMapping("/getEventByTime") HttpResult> getEventByTime(@RequestParam(name = "lineList", required = false) List lineList,@RequestParam("startTime") String startTime,@RequestParam("endTime") String endTime); + + @PostMapping("/getDevAlarmList") + HttpResult> getDevAlarmList(@RequestBody CsEventUserQueryParam param); + + @PostMapping("/getEventByIdList") + HttpResult> getEventByIdList(@RequestBody List list); + } diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/EventUserFeignClient.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/EventUserFeignClient.java index 48a63eb..40373f6 100644 --- a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/EventUserFeignClient.java +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/EventUserFeignClient.java @@ -4,6 +4,7 @@ import com.njcn.common.pojo.constant.ServerInfo; import com.njcn.common.pojo.response.HttpResult; import com.njcn.csharmonic.api.fallback.EventUserFeignClientFallbackFactory; import com.njcn.csharmonic.param.CsEventUserQueryParam; +import com.njcn.csharmonic.pojo.po.CsEventUserPO; import com.njcn.csharmonic.pojo.vo.EventDetailVO; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; @@ -20,4 +21,10 @@ public interface EventUserFeignClient { @PostMapping("/queryEventList") HttpResult> queryEventList(@RequestBody CsEventUserQueryParam csEventUserQueryParam) ; + + @PostMapping("/addUserEventList") + HttpResult addUserEventList(@RequestBody List list); + + @PostMapping("/deleteByIds") + HttpResult deleteByIds(@RequestBody List eventList); } diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/PqSensitiveUserFeignClient.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/PqSensitiveUserFeignClient.java index 852e912..865935e 100644 --- a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/PqSensitiveUserFeignClient.java +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/PqSensitiveUserFeignClient.java @@ -3,7 +3,7 @@ package com.njcn.csharmonic.api; import com.njcn.common.pojo.constant.ServerInfo; import com.njcn.common.pojo.response.HttpResult; import com.njcn.csharmonic.api.fallback.EventUserFeignClientFallbackFactory; -import com.njcn.csharmonic.pojo.po.PqSensitiveUser; +import com.njcn.device.biz.pojo.po.PqSensitiveUser; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/RStatLimitRateDFeignClient.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/RStatLimitRateDFeignClient.java new file mode 100644 index 0000000..f62592c --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/RStatLimitRateDFeignClient.java @@ -0,0 +1,36 @@ +package com.njcn.csharmonic.api; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.csharmonic.api.fallback.RStatLimitRateDClientFallbackFactory; +import com.njcn.csharmonic.pojo.param.RStatLimitQueryParam; +import com.njcn.csharmonic.pojo.param.StatSubstationBizBaseParam; +import com.njcn.csharmonic.pojo.po.RStatLimitRateDPO; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + +/** + * @author xy + */ +@FeignClient(value = ServerInfo.CS_HARMONIC_BOOT, path = "", fallbackFactory = RStatLimitRateDClientFallbackFactory.class,contextId = "") + +public interface RStatLimitRateDFeignClient { + + @PostMapping("/limitRateD/monitorIdsGetLimitRateInfo") + HttpResult> monitorIdsGetLimitRateInfo(@RequestBody RStatLimitQueryParam rStatLimitQueryParam); + + @PostMapping("/harmonic/getLinesRate") + HttpResult> getLinesRate(@RequestBody StatSubstationBizBaseParam param); + +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/SysExcelFeignClient.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/SysExcelFeignClient.java new file mode 100644 index 0000000..2b30f11 --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/SysExcelFeignClient.java @@ -0,0 +1,24 @@ +package com.njcn.csharmonic.api; + +import com.njcn.common.pojo.constant.ServerInfo; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.csharmonic.api.fallback.SysExcelClientFallbackFactory; +import com.njcn.harmonic.pojo.po.excel.SysExcel; +import io.swagger.annotations.ApiOperation; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; + +/** + * @author xy + */ +@FeignClient(value = ServerInfo.CS_HARMONIC_BOOT, path = "/sysExcel", fallbackFactory = SysExcelClientFallbackFactory.class,contextId = "sysExcel") + +public interface SysExcelFeignClient { + + @PostMapping("/querySysExcel") + @ApiOperation("查询") + HttpResult> querySysExcel(); + +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/SysExcelRelationFeignClient.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/SysExcelRelationFeignClient.java new file mode 100644 index 0000000..0d3ec58 --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/SysExcelRelationFeignClient.java @@ -0,0 +1,23 @@ +package com.njcn.csharmonic.api; + +import com.njcn.common.pojo.constant.ServerInfo; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.csharmonic.api.fallback.SysExcelRelationClientFallbackFactory; +import com.njcn.harmonic.common.pojo.vo.ReportTemplateVO; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +/** + * @author xy + */ +@FeignClient(value = ServerInfo.CS_HARMONIC_BOOT, path = "/sysExcelRelation", fallbackFactory = SysExcelRelationClientFallbackFactory.class,contextId = "sysExcelRelation") + +public interface SysExcelRelationFeignClient { + + @PostMapping("/queryList") + HttpResult> queryList(@RequestParam("id") String id); + +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/CsAlarmFeignClientFallbackFactory.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/CsAlarmFeignClientFallbackFactory.java new file mode 100644 index 0000000..1a3594f --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/CsAlarmFeignClientFallbackFactory.java @@ -0,0 +1,49 @@ +package com.njcn.csharmonic.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.csharmonic.api.CsAlarmFeignClient; +import com.njcn.csharmonic.pojo.po.CsAlarm; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @author xy + */ +@Slf4j +@Component +public class CsAlarmFeignClientFallbackFactory implements FallbackFactory { + @Override + public CsAlarmFeignClient create(Throwable cause) { + //判断抛出异常是否为解码器抛出的业务异常 + Enum exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK; + if (cause.getCause() instanceof BusinessException) { + BusinessException businessException = (BusinessException) cause.getCause(); + } + Enum finalExceptionEnum = exceptionEnum; + return new CsAlarmFeignClient() { + + @Override + public HttpResult addList(List list) { + log.error("{}异常,降级处理,异常为:{}","批量写入数据异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + + @Override + public HttpResult> queryListByTime(String time) { + log.error("{}异常,降级处理,异常为:{}","按日期查询数据异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + + @Override + public HttpResult deleteListByTime(String time) { + log.error("{}异常,降级处理,异常为:{}","按日期删除数据异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + }; + } +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/CsHarmonicFeignClientFallbackFactory.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/CsHarmonicFeignClientFallbackFactory.java new file mode 100644 index 0000000..da024cd --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/CsHarmonicFeignClientFallbackFactory.java @@ -0,0 +1,48 @@ +package com.njcn.csharmonic.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.csharmonic.api.CsHarmonicFeignClient; +import com.njcn.csharmonic.pojo.po.CsHarmonic; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @author xy + */ +@Slf4j +@Component +public class CsHarmonicFeignClientFallbackFactory implements FallbackFactory { + @Override + public CsHarmonicFeignClient create(Throwable cause) { + //判断抛出异常是否为解码器抛出的业务异常 + Enum exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK; + if (cause.getCause() instanceof BusinessException) { + BusinessException businessException = (BusinessException) cause.getCause(); + } + Enum finalExceptionEnum = exceptionEnum; + return new CsHarmonicFeignClient() { + @Override + public HttpResult addList(List list) { + log.error("{}异常,降级处理,异常为:{}","批量写入数据异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + + @Override + public HttpResult> queryListByTime(String time) { + log.error("{}异常,降级处理,异常为:{}","按日期查询数据异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + + @Override + public HttpResult deleteListByTime(String time) { + log.error("{}异常,降级处理,异常为:{}","按日期删除数据异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + }; + } +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/EventFeignClientFallbackFactory.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/EventFeignClientFallbackFactory.java index ef7c9e0..82c0f91 100644 --- a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/EventFeignClientFallbackFactory.java +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/EventFeignClientFallbackFactory.java @@ -7,6 +7,7 @@ import com.njcn.common.pojo.response.HttpResult; import com.njcn.csdevice.pojo.vo.DataGroupEventVO; import com.njcn.csharmonic.api.EventFeignClient; import com.njcn.csharmonic.param.CsEventUserQueryPage; +import com.njcn.csharmonic.param.CsEventUserQueryParam; import com.njcn.csharmonic.pojo.po.CsEventPO; import feign.hystrix.FallbackFactory; import lombok.extern.slf4j.Slf4j; @@ -58,6 +59,18 @@ public class EventFeignClientFallbackFactory implements FallbackFactory> getDevAlarmList(CsEventUserQueryParam param) { + log.error("{}异常,降级处理,异常为:{}","获取设备运行告警事件数据异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + + @Override + public HttpResult> getEventByIdList(List list) { + log.error("{}异常,降级处理,异常为:{}","根据事件id集合获取事件详情异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } }; } } diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/EventUserFeignClientFallbackFactory.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/EventUserFeignClientFallbackFactory.java index 2eec495..793c852 100644 --- a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/EventUserFeignClientFallbackFactory.java +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/EventUserFeignClientFallbackFactory.java @@ -5,6 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.response.HttpResult; import com.njcn.csharmonic.api.EventUserFeignClient; import com.njcn.csharmonic.param.CsEventUserQueryParam; +import com.njcn.csharmonic.pojo.po.CsEventUserPO; import com.njcn.csharmonic.pojo.vo.EventDetailVO; import feign.hystrix.FallbackFactory; import lombok.extern.slf4j.Slf4j; @@ -32,6 +33,18 @@ public class EventUserFeignClientFallbackFactory implements FallbackFactory addUserEventList(List list) { + log.error("{}异常,降级处理,异常为:{}","新增数据异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + + @Override + public HttpResult deleteByIds(List eventList) { + log.error("{}异常,降级处理,异常为:{}","根据id删除数据异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } }; } } diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/PqSensitiveUserFeignClientFallbackFactory.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/PqSensitiveUserFeignClientFallbackFactory.java index 1afc17c..6b4474c 100644 --- a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/PqSensitiveUserFeignClientFallbackFactory.java +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/PqSensitiveUserFeignClientFallbackFactory.java @@ -5,7 +5,7 @@ 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.csharmonic.api.PqSensitiveUserFeignClient; -import com.njcn.csharmonic.pojo.po.PqSensitiveUser; +import com.njcn.device.biz.pojo.po.PqSensitiveUser; import feign.hystrix.FallbackFactory; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/RStatLimitRateDClientFallbackFactory.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/RStatLimitRateDClientFallbackFactory.java new file mode 100644 index 0000000..70d2c18 --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/RStatLimitRateDClientFallbackFactory.java @@ -0,0 +1,44 @@ +package com.njcn.csharmonic.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.csharmonic.api.RStatLimitRateDFeignClient; +import com.njcn.csharmonic.pojo.param.RStatLimitQueryParam; +import com.njcn.csharmonic.pojo.param.StatSubstationBizBaseParam; +import com.njcn.csharmonic.pojo.po.RStatLimitRateDPO; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @author xy + */ +@Slf4j +@Component +public class RStatLimitRateDClientFallbackFactory implements FallbackFactory { + @Override + public RStatLimitRateDFeignClient create(Throwable cause) { + //判断抛出异常是否为解码器抛出的业务异常 + Enum exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK; + if (cause.getCause() instanceof BusinessException) { + BusinessException businessException = (BusinessException) cause.getCause(); + } + Enum finalExceptionEnum = exceptionEnum; + return new RStatLimitRateDFeignClient() { + @Override + public HttpResult> monitorIdsGetLimitRateInfo(RStatLimitQueryParam rStatLimitQueryParam) { + log.error("{}异常,降级处理,异常为:{}","获取指定日期超标监测点详细信息数据异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + + @Override + public HttpResult> getLinesRate(StatSubstationBizBaseParam param) { + log.error("{}异常,降级处理,异常为:{}","获取越限监测点越限次数异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + }; + } +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/SysExcelClientFallbackFactory.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/SysExcelClientFallbackFactory.java new file mode 100644 index 0000000..2036141 --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/SysExcelClientFallbackFactory.java @@ -0,0 +1,37 @@ +package com.njcn.csharmonic.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.csharmonic.api.SysExcelFeignClient; +import com.njcn.harmonic.pojo.po.excel.SysExcel; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @author xy + */ +@Slf4j +@Component +public class SysExcelClientFallbackFactory implements FallbackFactory { + @Override + public SysExcelFeignClient create(Throwable cause) { + //判断抛出异常是否为解码器抛出的业务异常 + Enum exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK; + if (cause.getCause() instanceof BusinessException) { + BusinessException businessException = (BusinessException) cause.getCause(); + } + Enum finalExceptionEnum = exceptionEnum; + return new SysExcelFeignClient() { + + @Override + public HttpResult> querySysExcel() { + log.error("{}异常,降级处理,异常为:{}","查询模板信息异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + }; + } +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/SysExcelRelationClientFallbackFactory.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/SysExcelRelationClientFallbackFactory.java new file mode 100644 index 0000000..9c30d29 --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/api/fallback/SysExcelRelationClientFallbackFactory.java @@ -0,0 +1,37 @@ +package com.njcn.csharmonic.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.csharmonic.api.SysExcelRelationFeignClient; +import com.njcn.harmonic.common.pojo.vo.ReportTemplateVO; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @author xy + */ +@Slf4j +@Component +public class SysExcelRelationClientFallbackFactory implements FallbackFactory { + @Override + public SysExcelRelationFeignClient create(Throwable cause) { + //判断抛出异常是否为解码器抛出的业务异常 + Enum exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK; + if (cause.getCause() instanceof BusinessException) { + BusinessException businessException = (BusinessException) cause.getCause(); + } + Enum finalExceptionEnum = exceptionEnum; + return new SysExcelRelationFeignClient() { + + @Override + public HttpResult> queryList(String id) { + log.error("{}异常,降级处理,异常为:{}","查询模板关系数据异常",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + }; + } +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/param/CsEventUserQueryPage.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/param/CsEventUserQueryPage.java index 9f6e0f0..e9493c0 100644 --- a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/param/CsEventUserQueryPage.java +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/param/CsEventUserQueryPage.java @@ -45,4 +45,7 @@ public class CsEventUserQueryPage extends CsEventUserQueryParam{ @ApiModelProperty(value = "测点id") private String lineId; + + @ApiModelProperty(value = "排序字段 0:发生时间 1:幅值 2:持续时间") + private Integer sortField; } \ No newline at end of file diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/dto/PhaseData.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/dto/PhaseData.java new file mode 100644 index 0000000..d007d60 --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/dto/PhaseData.java @@ -0,0 +1,16 @@ +package com.njcn.csharmonic.pojo.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class PhaseData implements Serializable { + + public String time; + public String value; + public String phasic; + public String valueType; + public double overLimitValue; + +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/dto/UnReadEventDto.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/dto/UnReadEventDto.java new file mode 100644 index 0000000..a924e15 --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/dto/UnReadEventDto.java @@ -0,0 +1,17 @@ +package com.njcn.csharmonic.pojo.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author xy + */ +@Data +public class UnReadEventDto implements Serializable { + + private String deviceId; + + private Integer count; + +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/po/CsAlarm.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/po/CsAlarm.java new file mode 100644 index 0000000..0f4d021 --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/po/CsAlarm.java @@ -0,0 +1,51 @@ +package com.njcn.csharmonic.pojo.po; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.time.LocalDate; + +/** + *

+ * + *

+ * + * @author xy + * @since 2026-03-16 + */ +@Getter +@Setter +@TableName("cs_alarm") +public class CsAlarm implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 告警事件id + */ + private String id; + + /** + * 设备id集合 + */ + private String devList; + + /** + * 发生时间 + */ + private LocalDate time; + + /** + * 中断事件描述 + */ + private String interruptEvent; + + /** + * 中断事件描述 + */ + private String alarmEvent; + + +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/po/CsHarmonic.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/po/CsHarmonic.java new file mode 100644 index 0000000..3a9c530 --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/po/CsHarmonic.java @@ -0,0 +1,46 @@ +package com.njcn.csharmonic.pojo.po; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.time.LocalDate; + +/** + *

+ * + *

+ * + * @author xy + * @since 2026-03-13 + */ +@Getter +@Setter +@TableName("cs_harmonic") +public class CsHarmonic implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 稳态事件id + */ + private String id; + + /** + * 监测点id + */ + private String lineId; + + /** + * 发生时间 + */ + private LocalDate time; + + /** + * 事件描述 + */ + private String tag; + + +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/po/PqSensitiveUser.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/po/PqSensitiveUser.java index 168c6e7..6a4454e 100644 --- a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/po/PqSensitiveUser.java +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/po/PqSensitiveUser.java @@ -12,7 +12,7 @@ import static com.baomidou.mybatisplus.annotation.IdType.ASSIGN_ID; /** *

- * + * 该实体类已废弃,使用com.njcn.device.biz.pojo.po包下的PqSensitiveUser *

* * @author xy @@ -21,6 +21,7 @@ import static com.baomidou.mybatisplus.annotation.IdType.ASSIGN_ID; @Getter @Setter @TableName("pq_sensitive_user") +@Deprecated public class PqSensitiveUser extends BaseEntity implements Serializable{ private static final long serialVersionUID = 1L; diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/vo/AlarmVO.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/vo/AlarmVO.java new file mode 100644 index 0000000..d31aa52 --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/vo/AlarmVO.java @@ -0,0 +1,70 @@ +package com.njcn.csharmonic.pojo.vo; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +/** + * @author xy + */ +@Data +public class AlarmVO implements Serializable { + + @ApiModelProperty(value = "事件id") + private String eventId; + + @ApiModelProperty(value = "时间") + private String date; + + @ApiModelProperty(value = "告警设备台数") + private Integer warnNums; + + @ApiModelProperty(value = "告警设备id集合") + private List devIds; + + @ApiModelProperty(value = "是否读取 0:未读取 1:读取") + private Integer isRead; + + @Data + public static class AlarmDetail implements Serializable { + + @ApiModelProperty(value = "工程名称") + private String engineeringName; + + @ApiModelProperty(value = "项目名称") + private String projectName; + + @ApiModelProperty(value = "设备名称") + private String devName; + + @ApiModelProperty(value = "告警次数") + private Integer warnCounts = 0; + + @ApiModelProperty(value = "告警详情") + private List warnDetails = new ArrayList<>(); + + @ApiModelProperty(value = "中断次数") + private Integer interruptCounts = 0; + + @ApiModelProperty(value = "中断详情") + private List interruptDetails = new ArrayList<>(); + + @Data + public static class WarnDetail implements Serializable { + + @ApiModelProperty(value = "告警事件时间") + private String warnEventTime; + + @ApiModelProperty(value = "告警事件描述") + private String warnEventDesc; + } + + } + + +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/vo/HarmonicDetailVO.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/vo/HarmonicDetailVO.java new file mode 100644 index 0000000..4f3307d --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/vo/HarmonicDetailVO.java @@ -0,0 +1,54 @@ +package com.njcn.csharmonic.pojo.vo; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDate; +import java.util.List; + +/** + * @author xy + */ +@Data +public class HarmonicDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "指标") + private String targetName; + + @ApiModelProperty(value = "越限详情") + private List harmDetailList; + + + @Data + public static class HarmDetail implements Serializable { + + @ApiModelProperty(value = "越限时间") + private String statisticsTime; + + @ApiModelProperty(value = "数据类型") + private String valueType; + + @ApiModelProperty(value = "A相数据") + private String dataA; + + @ApiModelProperty(value = "B相数据") + private String dataB; + + @ApiModelProperty(value = "C相数据") + private String dataC; + + @ApiModelProperty(value = "总相数据") + private String dataT; + + @ApiModelProperty(value = "限值") + private Double overLimitData; + + @ApiModelProperty(value = "是否有T相") + private Boolean hasT; + } + +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/vo/HarmonicVO.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/vo/HarmonicVO.java new file mode 100644 index 0000000..ced7f1b --- /dev/null +++ b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/pojo/vo/HarmonicVO.java @@ -0,0 +1,63 @@ +package com.njcn.csharmonic.pojo.vo; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +/** + * @author xy + */ +@Data +public class HarmonicVO implements Serializable { + + @ApiModelProperty(value = "稳态数量") + private Integer harmonicNums = 0; + + @ApiModelProperty(value = "越限天数") + private Integer overDays = 0; + + @ApiModelProperty(value = "越限监测点数") + private Integer overLineNums = 0; + + @ApiModelProperty(value = "越限监测点数") + private List list = new ArrayList<>(); + + @Data + public static class LineHarmonicDetail implements Serializable { + + @ApiModelProperty(value = "事件id") + private String eventId; + + @ApiModelProperty(value = "工程名称") + private String engineeringName; + + @ApiModelProperty(value = "项目名称") + private String projectName; + + @ApiModelProperty(value = "设备名称") + private String devName; + + @ApiModelProperty(value = "统计日期") + private LocalDate statisticsDate; + + @ApiModelProperty(value = "监测点id") + private String lineId; + + @ApiModelProperty(value = "监测点名称") + private String lineName; + + @ApiModelProperty(value = "越限描述") + private String overLimitDesc; + + @ApiModelProperty(value = "是否读取 0:未读取 1:读取") + private Integer isRead; + + } + + +} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/utils/report/ClearPathUtil.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/utils/report/ClearPathUtil.java deleted file mode 100644 index 58c3e58..0000000 --- a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/utils/report/ClearPathUtil.java +++ /dev/null @@ -1,142 +0,0 @@ -//package com.njcn.csharmonic.utils.report; -// -///** -// * @author hongawen -// * @date: 2020/8/20 13:36 -// */ -//public class ClearPathUtil { -// -// /** -// * 针对漏洞,新增的特殊字符替换的扫描方法 -// */ -// public static String cleanString(String str) { -// if (str == null) { -// return null; -// } -// StringBuilder sb = new StringBuilder(); -// for (int i = 0; i < str.length(); ++i) { -// sb.append(cleanChar(str.charAt(i))); -// } -// return sb.toString(); -// } -// -// private static char cleanChar(char ch) { -// -// // 0 - 9 -// for (int i = 48; i < 58; ++i) { -// if (ch == i) { -// return (char) i; -// } -// } -// -// // 'A' - 'Z' -// for (int i = 65; i < 91; ++i) { -// if (ch == i) { -// return (char) i; -// } -// } -// -// // 'a' - 'z' -// for (int i = 97; i < 123; ++i) { -// if (ch == i) { -// return (char) i; -// } -// } -// -// // other valid characters -// switch (ch) { -// case '/': -// return '/'; -// case '.': -// return '.'; -// case '-': -// return '-'; -// case '_': -// return '_'; -// case ',': -// return ','; -// case ' ': -// return ' '; -// case '!': -// return '!'; -// case '@': -// return '@'; -// case '#': -// return '#'; -// case '$': -// return '$'; -// case '%': -// return '%'; -// case '^': -// return '^'; -// case '&': -// return '&'; -// case '*': -// return '*'; -// case '(': -// return '('; -// case ')': -// return ')'; -// case '+': -// return '+'; -// case '=': -// return '='; -// case ':': -// return ':'; -// case ';': -// return ';'; -// case '?': -// return '?'; -// case '"': -// return '"'; -// case '<': -// return '<'; -// case '>': -// return '>'; -// case '`': -// return '`'; -// case '\\': -// return '/'; -// case 'I': -// return 'I'; -// case 'Ⅱ': -// return 'Ⅱ'; -// case 'Ⅲ': -// return 'Ⅲ'; -// case 'Ⅳ': -// return 'Ⅳ'; -// case 'Ⅴ': -// return 'Ⅴ'; -// case 'Ⅵ': -// return 'Ⅵ'; -// case 'Ⅶ': -// return 'Ⅶ'; -// case 'Ⅷ': -// return 'Ⅷ'; -// case 'Ⅸ': -// return 'Ⅸ'; -// -// case 'V': -// return 'V'; -// case 'X': -// return 'X'; -// case 'Ⅹ': -// return 'Ⅹ'; -// default: -// if (isChineseChar(ch)) { -// return ch; -// } -// return '%'; -// } -// } -// -// // 根据Unicode编码判断中文汉字和符号 -// private static boolean isChineseChar(char c) { -// Character.UnicodeBlock ub = Character.UnicodeBlock.of(c); -// return ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS -// || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B -// || ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS -// || ub == Character.UnicodeBlock.GENERAL_PUNCTUATION; -// } -// -//} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/utils/report/CustomXWPFDocument.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/utils/report/CustomXWPFDocument.java deleted file mode 100644 index c8645bc..0000000 --- a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/utils/report/CustomXWPFDocument.java +++ /dev/null @@ -1,83 +0,0 @@ -//package com.njcn.csharmonic.utils.report; -// -//import lombok.extern.slf4j.Slf4j; -//import org.apache.poi.openxml4j.opc.OPCPackage; -//import org.apache.poi.xwpf.usermodel.XWPFDocument; -//import org.apache.poi.xwpf.usermodel.XWPFParagraph; -//import org.apache.xmlbeans.XmlException; -//import org.apache.xmlbeans.XmlToken; -//import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps; -//import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D; -//import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTInline; -// -//import java.io.IOException; -//import java.io.InputStream; -// -//@Slf4j -//public class CustomXWPFDocument extends XWPFDocument { -// // 日志记录 -// public CustomXWPFDocument(InputStream in) throws IOException { -// super(in); -// } -// -// public CustomXWPFDocument() { -// super(); -// } -// -// public CustomXWPFDocument(OPCPackage pkg) throws IOException { -// super(pkg); -// } -// -// /** -// * @param id -// * @param width -// * 宽 -// * @param height -// * 高 -// * @param paragraph -// * 段落 -// */ -// public void createPicture(int id, int width, int height,String blipId, XWPFParagraph paragraph) { -// final int EMU = 9525; -// width *= EMU; -// height *= EMU; -//// String blipId = getAllPictures().get(id).getPackageRelationship().getId(); -// CTInline inline = paragraph.createRun().getCTR().addNewDrawing().addNewInline(); -// String picXml = "" + "" -// + " " -// + " " -// + " " + " " -// + " " + " " + " " -// + " " -// + " " + " " + " " -// + " " + " " + " " -// + " " + " " + " " + " " -// + " " + " " + " " -// + " " + " " + ""; -// -// inline.addNewGraphic().addNewGraphicData(); -// XmlToken xmlToken = null; -// try { -// xmlToken = XmlToken.Factory.parse(picXml); -// } catch (XmlException xe) { -// log.error("生成报表发生异常,异常是"+xe.getMessage()); -// } -// inline.set(xmlToken); -// -// inline.setDistT(0); -// inline.setDistB(0); -// inline.setDistL(0); -// inline.setDistR(0); -// -// CTPositiveSize2D extent = inline.addNewExtent(); -// extent.setCx(width); -// extent.setCy(height); -// -// CTNonVisualDrawingProps docPr = inline.addNewDocPr(); -// docPr.setId(id); -// docPr.setName("图片" + id); -// docPr.setDescr("测试"); -// } -//} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/utils/report/FloatUtils.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/utils/report/FloatUtils.java deleted file mode 100644 index de04db4..0000000 --- a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/utils/report/FloatUtils.java +++ /dev/null @@ -1,28 +0,0 @@ -//package com.njcn.csharmonic.utils.report; -// -//import java.math.BigDecimal; -// -///** -// * @author hongawen(创建) -----denghuajun(移植使用) -// * @Date: 2018/8/27 11:29 -// */ -//public class FloatUtils { -// -// -// /** -// * 保留传入进来的float的两位小数,四舍五入的方式 -// * -// * @param data Float参数 -// */ -// public static float get2Float(Float data) { -// if (data == null || data.isNaN() || data.isInfinite()) { -// return 0f; -// } -// int scale = 2;//设置位数 -// int roundingMode = 4;//表示四舍五入,可以选择其他舍值方式,例如去尾,等等. -// BigDecimal bd = new BigDecimal(data); -// bd = bd.setScale(scale, roundingMode); -// data = bd.floatValue(); -// return data; -// } -//} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/utils/report/PubUtils.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/utils/report/PubUtils.java deleted file mode 100644 index 6737fc7..0000000 --- a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/utils/report/PubUtils.java +++ /dev/null @@ -1,224 +0,0 @@ -//package com.njcn.csharmonic.utils.report; -// -//import cn.hutool.core.util.ObjectUtil; -//import lombok.SneakyThrows; -//import lombok.extern.slf4j.Slf4j; -// -//import java.io.File; -//import java.io.IOException; -//import java.io.InputStream; -//import java.text.SimpleDateFormat; -//import java.util.*; -// -///** -// * @author wr -// * @description -// * @date 2023/4/10 17:39 -// */ -//@Slf4j -//public class PubUtils { -// public static boolean createFile(String destFileName) { -// File file = new File(destFileName); -// if (file.exists()) { -// log.warn("创建单个文件" + destFileName + "失败,目标文件已存在!"); -// return false; -// } -// if (destFileName.endsWith(File.separator)) { -// log.warn("创建单个文件" + destFileName + "失败,目标文件不能为目录!"); -// return false; -// } -// //判断目标文件所在的目录是否存在 -// if (!file.getParentFile().exists()) { -// //如果目标文件所在的目录不存在,则创建父目录 -// log.warn("目标文件所在目录不存在,准备创建它!"); -// if (!file.getParentFile().mkdirs()) { -// log.warn("创建目标文件所在目录失败!"); -// return false; -// } -// } -// //创建目标文件 -// try { -// if (file.createNewFile()) { -// log.warn("创建单个文件" + destFileName + "成功!"); -// return true; -// } else { -// log.warn("创建单个文件" + destFileName + "失败!"); -// return false; -// } -// } catch (IOException e) { -// log.warn("创建单个文件" + destFileName + "失败!" + e.getMessage()); -// return false; -// } -// } -// -// /** -// * 读取配置文件 -// * -// * @param cl 类名字 -// * @param strPropertiesName 配置文件名称 -// */ -// public static Properties readProperties(ClassLoader cl, String strPropertiesName) { -// Properties pros = new Properties(); -// InputStream in = null; -// try { -// in = cl.getResourceAsStream(strPropertiesName); -// pros.load(in); -// } catch (Exception e) { -// log.error("读取配置文件失败失败:" + e.getMessage()); -// } finally { -// if (in != null) { -// PubUtils.safeClose(in, "安全关闭读取配置文件失败,异常为:"); -// } -// } -// return pros; -// } -// -// /** -// * 安全关闭InputStream -// * -// * @param s -// */ -// public static void safeClose(InputStream s, String strError) { -// if (s != null) { -// try { -// s.close(); -// } catch (IOException e) { -// log.error(strError + e.toString()); -// } -// } -// } -// -// public static Double dataLimits(Double data) { -// if (ObjectUtil.isNotNull(data)) { -// return data > 100 ? 100 : data; -// } -// return data; -// } -// -// @SneakyThrows -// public static List getIntervalTime(String startTime, String endTime) { -// List times = new ArrayList<>(); -// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); -// Date start = sdf.parse(startTime); -// Date end = sdf.parse(endTime); -// // 同月 -// if (start.getTime() == end.getTime()) { -// String time = startTime.substring(0, 7); -// times.add(time); -// } else if (start.getYear() == end.getYear()) { -// // 同年 -// int startM = start.getMonth() + 1; -// int endM = end.getMonth() + 1; -// int temp = endM - startM; -// for (int i = 0; i <= temp; i++) { -// String time = start.getYear() + 1900 + ""; -// int month = startM + i; -// if (month < 10) { -// time = time + "-0" + month; -// } else { -// time = time + "-" + month; -// } -// times.add(time); -// } -// } else { -// // 不同年!!!!这里忽略了年份之间跨年的情况 -// int startY = start.getYear() + 1900; -// int startM = start.getMonth() + 1; -// int endY = end.getYear() + 1900; -// int endM = end.getMonth() + 1; -// int tempS = 12 - startM; -// // 连续的年份 -// if (endY - startY == 1) { -// // 第一年的时间获取 -// for (int i = 0; i <= tempS; i++) { -// int month = startM + i; -// String time = startY + "-"; -// if (month < 10) { -// time = time + "0" + month; -// } else { -// time = time + month; -// } -// times.add(time); -// } -// // 第二年的时间获取 -// -// for (int i = 1; i <= endM; i++) { -// String time = endY + "-"; -// if (i < 10) { -// time = time + "0" + i; -// } else { -// time = time + i; -// } -// times.add(time); -// } -// } else { -// // 不连续的年份 -// // 第一年的时间获取 -// for (int i = 0; i <= tempS; i++) { -// int month = startM + i; -// String time = startY + "-"; -// if (month < 10) { -// time = time + "0" + month; -// } else { -// time = time + month; -// } -// times.add(time); -// } -// int tempY = endY - startY; -// // 中间年份的时间 -// for (int i = 1; i < tempY; i++) { -// for (int j = 1; j <= 12; j++) { -// String time = startY + i + "-"; -// if (j < 10) { -// time = time + "0" + j; -// } else { -// time = time + j; -// } -// times.add(time); -// } -// } -// // 最后一年的时间获取 -// for (int i = 1; i <= endM; i++) { -// String time = endY + "-"; -// if (i < 10) { -// time = time + "0" + i; -// } else { -// time = time + i; -// } -// times.add(time); -// } -// } -// -// } -// return times; -// } -// -// @SneakyThrows -// public static List getIntervalDateTime(Integer startTime, int beginDay, Integer endTime, Integer dd) { -// List list = new ArrayList<>(); -// Calendar calendar = Calendar.getInstance(Locale.CHINA); -// calendar.set(startTime, endTime - 1, 1); -// //年份 -// int year = calendar.get(Calendar.YEAR); -// //月份 -// int month = calendar.get(Calendar.MONTH) + 1; -// for (int i = beginDay; i <= dd; i++) { -// String date = null; -// if (month < 10 && i < 10) { -// date = year + "-0" + month + "-0" + i; -// } -// if (month < 10 && i >= 10) { -// date = year + "-0" + month + "-" + i; -// } -// if (month >= 10 && i < 10) { -// date = year + "-" + month + "-0" + i; -// } -// if (month >= 10 && i >= 10) { -// date = year + "-" + month + "-" + i; -// } -// -// list.add(date); -// } -// return list; -// } -//} diff --git a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/utils/report/PublicDataUtils.java b/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/utils/report/PublicDataUtils.java deleted file mode 100644 index 376bb28..0000000 --- a/cs-harmonic/cs-harmonic-api/src/main/java/com/njcn/csharmonic/utils/report/PublicDataUtils.java +++ /dev/null @@ -1,30 +0,0 @@ -//package com.njcn.csharmonic.utils.report; -// -///** -// * 数据公共工具类 -// * -// * @author qijian -// * @version 1.0.0 -// * @createTime 2022/10/14 - 10:07 -// */ -//public class PublicDataUtils { -// /** -// * 功能:下划线命名转驼峰命名 -// * 将下划线替换为空格,将字符串根据空格分割成数组,再将每个单词首字母大写 -// * @param s -// * @return -// */ -// public static String underCamel(String s) -// { -// String separator = "_"; -// String under=""; -// s = s.toLowerCase().replace(separator, " "); -// String sarr[]=s.split(" "); -// for(int i=0;i params, String fileName,List> tableList, HttpServletResponse response) -// throws Exception { -// byte[] docBytes = null; -// -// path = ClearPathUtil.cleanString(path); -// InputStream is = null; -// CustomXWPFDocument doc = null; -// //读取报告模板 -// try { -// Resource resource = resourceLoader.getResource("classpath:" + path); -// if (!resource.exists()) { -// throw new FileNotFoundException("模板文件未找到: " + path); -// } -// is = resource.getInputStream(); -// doc = new CustomXWPFDocument(is); -// if(CollUtil.isNotEmpty(tableList)){ -// this.replaceInTable(doc, params,tableList); -// }else{ -// this.replaceInTable(doc, params); -// } -// // 替换表格里面的变量 -// this.replaceInPara(doc, params); // 替换文本里面的变量 -// } catch (IOException e) { -// getError("获取报告模板异常,原因为:" + e); -// } finally { -// if (null != is) { -// is.close(); -// } -// } -// try { -// ServletOutputStream outputStream = response.getOutputStream(); -// response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); -// response.setContentType("application/octet-stream;charset=UTF-8"); -// doc.write(outputStream); -// outputStream.close(); -// } catch (Exception e) { -// getError("输出稳态报告异常,原因为:" + e); -// } finally { -// if (doc != null) { -// doc.close(); -// } -// } -// } -// -// -// -// -// // 辅助方法:字节数组转十六进制(便于打印排查) -// private static String bytesToHex(byte[] bytes) { -// StringBuilder sb = new StringBuilder(); -// for (byte b : bytes) { -// sb.append(String.format("%02X ", b)); -// } -// return sb.toString().trim(); -// } -// -// -// -// -// public InputStream getReportFile(String path, Map params, List> tableList) -// throws Exception { -// path = ClearPathUtil.cleanString(path); -// InputStream inStream = null,in = null; -// CustomXWPFDocument doc = null; -// //读取报告模板 -// try { -// inStream = new ClassPathResource(path).getInputStream(); -// doc = new CustomXWPFDocument(inStream); -// this.replaceInTable(doc,params,tableList); -// this.replaceInPara(doc, params); -// } catch (IOException e) { -// getError("获取报告模板异常,原因为:" + e); -// } finally { -// if (null != inStream) { -// inStream.close(); -// } -// } -// try { -// //临时缓冲区 -// ByteArrayOutputStream out = new ByteArrayOutputStream(); -// doc.write(out); -// byte[] docByteAry = out.toByteArray(); -// in = new ByteArrayInputStream(docByteAry); -// out.close(); -// } catch (Exception e) { -// getError("输出稳态报告异常,原因为:" + e); -// } finally { -// if (doc != null) { -// doc.close(); -// } -// } -// return in; -// } -// -// -// -// public String getReportFileUrl(String path,String fileName,List> tableList, Map params) -// throws Exception { -// path = ClearPathUtil.cleanString(path); -// InputStream inStream = null,in = null; -// CustomXWPFDocument doc = null; -// //读取报告模板 -// try { -// inStream = new ClassPathResource(path).getInputStream();; -// doc = new CustomXWPFDocument(inStream); -// if(CollUtil.isNotEmpty(tableList)){ -// this.replaceInTable(doc, params,tableList); -// }else{ -// this.replaceInTable(doc, params); -// } -// this.replaceInPara(doc, params); // 替换文本里面的变量 -// //临时缓冲区 -// ByteArrayOutputStream out = new ByteArrayOutputStream(); -// doc.write(out); -// byte[] docByteAry = out.toByteArray(); -// in = new ByteArrayInputStream(docByteAry); -// out.close(); -// } catch (IOException e) { -// getError("获取报告模板异常,原因为:" + e); -// } finally { -// if (null != inStream) { -// inStream.close(); -// } -// if (doc != null) { -// doc.close(); -// } -// } -// //上传文件服务器 -// return fileStorageUtil.uploadStreamSpecifyName(in, OssPath.ONLINE_REPORT, fileName); -// } -// -// -// private static void getError(String e) { -// log.error(e); -// } -// /** -// * 替换段落里面的变量 -// * -// * @param doc 要替换的文档 -// * @param params 参数 -// */ -// private void replaceInPara(CustomXWPFDocument doc, Map params) { -// Iterator iterator = doc.getParagraphsIterator(); -// List paragraphList = new ArrayList<>(); -// XWPFParagraph para; -// while (iterator.hasNext()) { -// para = iterator.next(); -// paragraphList.add(para); -// } -// processParagraphs(paragraphList, params, doc); -// } -// -// private void replaceInTable(CustomXWPFDocument doc, Map params) { -// Iterator it = doc.getTablesIterator(); -// while (it.hasNext()) { -// XWPFTable table = it.next(); -// List rows = table.getRows(); -// for (XWPFTableRow row : rows) { -// List cells = row.getTableCells(); -// for (XWPFTableCell cell : cells) { -// List paragraphListTable = cell.getParagraphs(); -// processParagraphs(paragraphListTable, params, doc); -// } -// } -// } -// } -// -// public static void processParagraphs(List paragraphList, Map param, -// CustomXWPFDocument doc) { -// if (paragraphList != null && paragraphList.size() > 0) { -// for (XWPFParagraph paragraph : paragraphList) { -// List runs = paragraph.getRuns(); -// if (runs.size() > 0) { -// for (XWPFRun run : runs) { -// String bflag = ""; -// String text = run.getText(0); -// if (text != null) { -// boolean isSetText = false; -// for (Entry entry : param.entrySet()) { -// String key = entry.getKey(); -// if (text.indexOf(key) != -1) { -// isSetText = true; -// Object value = entry.getValue(); -// if (value instanceof String) {// 文本替换 -// text = text.replace(key, value.toString()); -// } else if (value instanceof Map) {// 图片替换 -// text = text.replace(key, ""); -// Map pic = (Map) value; -// int width = Integer.parseInt(pic.get("width").toString()); -// int height = Integer.parseInt(pic.get("height").toString()); -// int picType = getPictureType(pic.get("type").toString()); -// byte[] byteArray = (byte[]) pic.get("content"); -// ByteArrayInputStream byteInputStream = new ByteArrayInputStream(byteArray); -// try { -// String s = doc.addPictureData(byteInputStream, picType); -// -// doc.createPicture(doc.getAllPictures().size() - 1, width, height, -// s,paragraph); -// bflag = "break"; -// } catch (Exception e) { -// getError("文本替换发生异常,异常是" + e.getMessage()); -// } -// } -// } -// } -// if (isSetText) { -// run.setText(text, 0); -// } -// } -// if (bflag == "break") { -// break; -// } -// } -// } -// } -// } -// } -// -// /** -// * 替换段落里面的变量 -// * -// * @param para 要替换的段落 -// * @param params 参数 -// */ -// private void replaceInPara(XWPFParagraph para, Map params, CustomXWPFDocument doc) { -// List runs; -// Matcher matcher; -// // if (this.matcher(para.getParagraphText()).find()) { -// runs = para.getRuns(); -// int start = -1; -// int end = -1; -// String str = ""; -// for (int i = 0; i < runs.size(); i++) { -// XWPFRun run = runs.get(i); -// String runText = run.toString(); -// if ('$' == runText.charAt(0) && '{' == runText.charAt(1)) { -// start = i; -// } -// if ((start != -1)) { -// str += runText; -// } -// if ('}' == runText.charAt(runText.length() - 1)) { -// if (start != -1) { -// end = i; -// break; -// } -// } -// } -// -// for (int i = start; i <= end; i++) { -// para.removeRun(i); -// i--; -// end--; -// } -// -// for (Entry entry : params.entrySet()) { -// String key = entry.getKey(); -// if (str.indexOf(key) != -1) { -// Object value = entry.getValue(); -// if (value instanceof String) { -// str = str.replace(key, value.toString()); -// para.createRun().setText(str, 0); -// break; -// } else if (value instanceof Map) { -// str = str.replace(key, ""); -// Map pic = (Map) value; -// int width = Integer.parseInt(pic.get("width").toString()); -// int height = Integer.parseInt(pic.get("height").toString()); -// int picType = getPictureType(pic.get("type").toString()); -// byte[] byteArray = (byte[]) pic.get("content"); -// ByteArrayInputStream byteInputStream = new ByteArrayInputStream(byteArray); -// try { -// // int ind = doc.addPicture(byteInputStream,picType); -// // doc.createPicture(ind, width , height,para); -// String s = doc.addPictureData(byteInputStream, picType); -// doc.createPicture(doc.getAllPictures().size() - 1, width, height,s, para); -// para.createRun().setText(str, 0); -// break; -// } catch (Exception e) { -// getError("文件替换发生异常,异常是" + e.getMessage()); -// } -// } -// } -// } -// // } -// } -// -// /** -// * 为表格插入数据,行数不够添加新行 -// * -// * @param table 需要插入数据的表格 -// * @param tableList 插入数据集合 -// */ -// private static void insertTable(XWPFTable table, List tableList) { -// //删除占位符行数 -// table.removeRow(1); -// if (CollUtil.isNotEmpty(tableList)) { -// // 创建行,根据需要插入的数据添加新行,不处理表头 -// for (int i = 0; i < tableList.size(); i++) { -// XWPFTableRow row = table.createRow(); -// List cells = row.getTableCells(); -// for (int j = 0; j < cells.size(); j++) { -// String s = tableList.get(i)[j]; -// XWPFTableCell cell = cells.get(j); -// cell.removeParagraph(0); -// XWPFParagraph paragraph = cell.addParagraph(); -// paragraph.setAlignment(ParagraphAlignment.CENTER); -// // 在段落中添加文本 -// XWPFRun run = paragraph.createRun(); -// run.setText(s); -// } -// } -// } -// } -// -// /** -// * 替换表格里面的变量 -// * -// * @param doc 要替换的文档 -// * @param tableList 存放数据顺序要与表格一致 -// * @param params 参数 -// */ -// private void replaceInTable(CustomXWPFDocument doc, Map params, List> tableList) { -// Iterator iterator = doc.getTablesIterator(); -// XWPFTable table; -// List rows; -// List cells; -// List paras; -// Integer num=0; -// while (iterator.hasNext()) { -// table = iterator.next(); -// if (table.getRows().size() > 1) { -// // 判断表格是需要替换还是需要插入,判断逻辑有$为替换,表格无$为插入 -// if (this.matcher(table.getText()).find()||this.matcherS(table.getText()).find()) { -// rows = table.getRows(); -// for (XWPFTableRow row : rows) { -// cells = row.getTableCells(); -// for (XWPFTableCell cell : cells) { -// List paragraphListTable = cell.getParagraphs(); -// processParagraphs(paragraphListTable, params, doc); -// } -// } -// }else { -// if (CollUtil.isNotEmpty(tableList.get(num))){ -// insertTable(table, tableList.get(num)); // 插入数据 -// } -// num++; -// } -// } -// } -// } -// -// /** -// * 正则匹配字符串 -// * -// * @param str -// * @return -// */ -// private Matcher matcher(String str) { -// Pattern pattern = Pattern.compile("\\$\\{(.+?)\\}", Pattern.CASE_INSENSITIVE); -// Matcher matcher = pattern.matcher(str); -// return matcher; -// } -// private Matcher matcherS(String str) { -// Pattern pattern = Pattern.compile("\\$(.*?)\\$"); -// Matcher matcher = pattern.matcher(str); -// return matcher; -// } -// -// /** -// * 根据图片类型,取得对应的图片类型代码 -// * -// * @param picType -// * @return int -// */ -// private static int getPictureType(String picType) { -// int res = CustomXWPFDocument.PICTURE_TYPE_PICT; -// if (picType != null) { -// if (picType.equalsIgnoreCase("image/png")) { -// res = CustomXWPFDocument.PICTURE_TYPE_PNG; -// } else if (picType.equalsIgnoreCase("image/dib")) { -// res = CustomXWPFDocument.PICTURE_TYPE_DIB; -// } else if (picType.equalsIgnoreCase("image/emf")) { -// res = CustomXWPFDocument.PICTURE_TYPE_EMF; -// } else if (picType.equalsIgnoreCase("image/jpg") || picType.equalsIgnoreCase("image/jpeg")) { -// res = CustomXWPFDocument.PICTURE_TYPE_JPEG; -// } else if (picType.equalsIgnoreCase("image/wmf")) { -// res = CustomXWPFDocument.PICTURE_TYPE_WMF; -// } -// } -// return res; -// } -// -//} diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CsAlarmController.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CsAlarmController.java new file mode 100644 index 0000000..5acb1e8 --- /dev/null +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CsAlarmController.java @@ -0,0 +1,96 @@ +package com.njcn.csharmonic.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.njcn.common.pojo.annotation.OperateInfo; +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.pojo.dto.LineParamDTO; +import com.njcn.csharmonic.pojo.po.CsAlarm; +import com.njcn.csharmonic.pojo.vo.AlarmVO; +import com.njcn.csharmonic.service.ICsAlarmService; +import com.njcn.web.controller.BaseController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author xy + * @since 2026-03-16 + */ +@Slf4j +@RestController +@RequestMapping("/csAlarm") +@Api(tags = "运行告警事件") +@AllArgsConstructor +public class CsAlarmController extends BaseController { + + private final ICsAlarmService csAlarmService; + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/queryAlarmList") + @ApiOperation("运行告警事件列表(app)") + @ApiImplicitParam(name = "param", value = "事件查询参数", required = true) + public HttpResult> queryAlarmList(@RequestBody LineParamDTO param) { + String methodDescribe = getMethodDescribe("queryAlarmList"); + List result = csAlarmService.queryAlarmList(param); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/queryAlarmDetail") + @ApiOperation("运行告警事件详情(app)") + @ApiImplicitParam(name = "param", value = "事件查询参数", required = true) + public HttpResult> queryAlarmDetail(@RequestBody LineParamDTO.DevParamDTO param) { + String methodDescribe = getMethodDescribe("queryAlarmDetail"); + List result = csAlarmService.queryAlarmDetail(param); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/addList") + @ApiOperation("批量写入数据") + @ApiImplicitParam(name = "list", value = "参数", required = true) + public HttpResult addList(@RequestBody List list) { + String methodDescribe = getMethodDescribe("addList"); + boolean result = csAlarmService.saveOrUpdateBatch(list); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/queryListByTime") + @ApiOperation("按日期查询数据") + @ApiImplicitParam(name = "time", value = "时间", required = true) + public HttpResult> queryListByTime(@RequestParam String time) { + String methodDescribe = getMethodDescribe("queryListByTime"); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(CsAlarm::getTime, time); + List list = csAlarmService.list(wrapper); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/deleteListByTime") + @ApiOperation("按日期删除数据") + @ApiImplicitParam(name = "time", value = "时间", required = true) + public HttpResult deleteListByTime(@RequestParam String time) { + String methodDescribe = getMethodDescribe("deleteListByTime"); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(CsAlarm::getTime, time); + boolean result = csAlarmService.remove(wrapper); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); + } + +} + diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CsEventController.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CsEventController.java index bcbcca6..82a9d3b 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CsEventController.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CsEventController.java @@ -176,5 +176,25 @@ public class CsEventController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); } + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getDevAlarmList") + @ApiOperation("获取设备运行告警事件") + @ApiImplicitParam(name = "param", value = "事件信息", required = true) + public HttpResult> getDevAlarmList(@RequestBody CsEventUserQueryParam param) { + String methodDescribe = getMethodDescribe("getDevAlarmList"); + List list = csEventPOService.getDevAlarmList(param); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getEventByIdList") + @ApiOperation("根据事件id获取事件详情") + @ApiImplicitParam(name = "list", value = "id集合", required = true) + public HttpResult> getEventByIdList(@RequestBody List list) { + String methodDescribe = getMethodDescribe("getEventByIdList"); + List result = csEventPOService.listByIds(list); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); + } + } diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CsHarmonicController.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CsHarmonicController.java new file mode 100644 index 0000000..a319f66 --- /dev/null +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CsHarmonicController.java @@ -0,0 +1,97 @@ +package com.njcn.csharmonic.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.njcn.common.pojo.annotation.OperateInfo; +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.pojo.dto.LineParamDTO; +import com.njcn.csharmonic.pojo.po.CsHarmonic; +import com.njcn.csharmonic.pojo.vo.HarmonicDetailVO; +import com.njcn.csharmonic.pojo.vo.HarmonicVO; +import com.njcn.csharmonic.service.ICsHarmonicService; +import com.njcn.web.controller.BaseController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author xy + * @since 2026-03-13 + */ +@Slf4j +@RestController +@RequestMapping("/csHarmonic") +@Api(tags = "稳态事件") +@AllArgsConstructor +public class CsHarmonicController extends BaseController { + + private final ICsHarmonicService csHarmonicService; + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/queryHarmonicList") + @ApiOperation("稳态事件列表(app)") + @ApiImplicitParam(name = "param", value = "暂降事件查询参数", required = true) + public HttpResult queryHarmonicList(@RequestBody LineParamDTO param) { + String methodDescribe = getMethodDescribe("queryHarmonicList"); + HarmonicVO vo = csHarmonicService.queryAppList(param); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/queryHarmonicDetail") + @ApiOperation("稳态事件详情(app)") + @ApiImplicitParam(name = "param", value = "暂降事件查询参数", required = true) + public HttpResult> queryHarmonicDetail(@RequestBody LineParamDTO param) { + String methodDescribe = getMethodDescribe("queryHarmonicDetail"); + List vo = csHarmonicService.queryHarmonicDetail(param); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/addList") + @ApiOperation("批量写入数据") + @ApiImplicitParam(name = "list", value = "暂降事件查询参数", required = true) + public HttpResult addList(@RequestBody List list) { + String methodDescribe = getMethodDescribe("addList"); + boolean result = csHarmonicService.saveOrUpdateBatch(list); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/queryListByTime") + @ApiOperation("按日期查询数据") + @ApiImplicitParam(name = "time", value = "时间", required = true) + public HttpResult> queryListByTime(@RequestParam String time) { + String methodDescribe = getMethodDescribe("queryListByTime"); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(CsHarmonic::getTime, time); + List list = csHarmonicService.list(wrapper); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/deleteListByTime") + @ApiOperation("按日期删除数据") + @ApiImplicitParam(name = "time", value = "时间", required = true) + public HttpResult deleteListByTime(@RequestParam String time) { + String methodDescribe = getMethodDescribe("deleteListByTime"); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(CsHarmonic::getTime, time); + boolean result = csHarmonicService.remove(wrapper); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); + } + +} + diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CustomReportController.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CustomReportController.java index c48152d..a249adc 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CustomReportController.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/CustomReportController.java @@ -26,6 +26,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; import java.util.List; /** @@ -44,9 +45,6 @@ public class CustomReportController extends BaseController { private final CustomReportService customReportService; - - - /** * 替换报表数据并返回 * @author qijian diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/EventUserController.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/EventUserController.java index 199b646..3c1973e 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/EventUserController.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/EventUserController.java @@ -1,5 +1,6 @@ package com.njcn.csharmonic.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.enums.common.LogEnum; @@ -10,6 +11,7 @@ import com.njcn.csharmonic.param.CldWarnParam; import com.njcn.csharmonic.param.CsEventUserQueryPage; import com.njcn.csharmonic.param.CsEventUserQueryParam; import com.njcn.csharmonic.pojo.po.CsEventPO; +import com.njcn.csharmonic.pojo.po.CsEventUserPO; import com.njcn.csharmonic.pojo.vo.EventDetailVO; import com.njcn.csharmonic.service.CsEventUserPOService; import com.njcn.web.controller.BaseController; @@ -98,4 +100,24 @@ public class EventUserController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); } + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/addUserEventList") + @ApiOperation("新增数据") + public HttpResult addUserEventList(@RequestBody List list) { + String methodDescribe = getMethodDescribe("addUserEventList"); + Boolean result = csEventUserPOService.saveBatch(list); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/deleteByIds") + @ApiOperation("根据id删除数据") + public HttpResult deleteByIds(@RequestBody List eventList) { + String methodDescribe = getMethodDescribe("deleteByIds"); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(CsEventUserPO::getEventId, eventList); + Boolean result = csEventUserPOService.remove(wrapper); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); + } + } diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/HomePageController.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/HomePageController.java new file mode 100644 index 0000000..1dcb26d --- /dev/null +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/HomePageController.java @@ -0,0 +1,42 @@ +package com.njcn.csharmonic.controller; + +import com.njcn.common.pojo.annotation.OperateInfo; +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.pojo.vo.EngineeringHomePageVO; +import com.njcn.csharmonic.service.HomePageService; +import com.njcn.web.controller.BaseController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author xy + */ +@Slf4j +@RestController +@RequestMapping("/homePage") +@Api(tags = "app首页") +@AllArgsConstructor +public class HomePageController extends BaseController { + + private final HomePageService homePageService; + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getEngineeringHomePage") + @ApiOperation("工程用户首页") + public HttpResult> getEngineeringHomePage(){ + String methodDescribe = getMethodDescribe("getEngineeringHomePage"); + List result = homePageService.getEngineeringHomePage(); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); + } + +} diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/PqSensitiveUserController.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/PqSensitiveUserController.java index e0b7930..951bc93 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/PqSensitiveUserController.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/controller/PqSensitiveUserController.java @@ -13,9 +13,9 @@ import com.njcn.common.utils.HttpResultUtil; import com.njcn.csdevice.api.CsLineFeignClient; import com.njcn.csdevice.pojo.po.CsLinePO; import com.njcn.csharmonic.pojo.param.PqSensitiveUserParam; -import com.njcn.csharmonic.pojo.po.PqSensitiveUser; import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo; import com.njcn.csharmonic.service.IPqSensitiveUserService; +import com.njcn.device.biz.pojo.po.PqSensitiveUser; import com.njcn.web.controller.BaseController; import com.njcn.web.pojo.param.BaseParam; import io.swagger.annotations.Api; diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/handler/MqttMessageHandler.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/handler/MqttMessageHandler.java index d23c19a..2852aa1 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/handler/MqttMessageHandler.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/handler/MqttMessageHandler.java @@ -83,7 +83,7 @@ public class MqttMessageHandler { public void responseRtData(String topic, @NamedValue("pageId") String pageId, MqttMessage message, @Payload String payload) { List list = lineTargetService.getLineData(pageId); Gson gson = new Gson(); - publisher.send("/zl/rtData/" + pageId, gson.toJson(list), 1, false); + publisher.send("/zl/rtData/" + pageId, gson.toJson(list), 1, false); } @MqttSubscribe(value = "/zl/askTemperData/{devId}", qos = 1) diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/CsAlarmMapper.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/CsAlarmMapper.java new file mode 100644 index 0000000..847d59f --- /dev/null +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/CsAlarmMapper.java @@ -0,0 +1,16 @@ +package com.njcn.csharmonic.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.csharmonic.pojo.po.CsAlarm; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xy + * @since 2026-03-16 + */ +public interface CsAlarmMapper extends BaseMapper { + +} diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/CsEventUserPOMapper.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/CsEventUserPOMapper.java index de72aeb..90cd93e 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/CsEventUserPOMapper.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/CsEventUserPOMapper.java @@ -4,11 +4,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.njcn.csharmonic.param.CsEventUserQueryPage; import com.njcn.csharmonic.param.CsEventUserQueryParam; +import com.njcn.csharmonic.pojo.dto.UnReadEventDto; import com.njcn.csharmonic.pojo.po.CsEventUserPO; import com.njcn.csharmonic.pojo.vo.EventDetailVO; import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; /** * @@ -21,6 +23,8 @@ import java.util.List; public interface CsEventUserPOMapper extends BaseMapper { Integer queryEventCount(@Param("csEventUserQueryParam") CsEventUserQueryParam csEventUserQueryParam); + List queryEngineeringEventCount(@Param("userIndex") String userIndex); + List queryUserEventList(@Param("csEventUserQueryParam") CsEventUserQueryParam csEventUserQueryParam, @Param("devIds") List devIds, @Param("flag") Boolean flag); Page queryEventpage(Page returnpage, @Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage, @Param("devIds") List devIds, @Param("flag") Boolean flag); diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/CsHarmonicMapper.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/CsHarmonicMapper.java new file mode 100644 index 0000000..0d2a74a --- /dev/null +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/CsHarmonicMapper.java @@ -0,0 +1,16 @@ +package com.njcn.csharmonic.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.csharmonic.pojo.po.CsHarmonic; + +/** + *

+ * Mapper 接口 + *

+ * + * @author xy + * @since 2026-03-13 + */ +public interface CsHarmonicMapper extends BaseMapper { + +} diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/PqSensitiveUserMapper.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/PqSensitiveUserMapper.java index 8108559..6559154 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/PqSensitiveUserMapper.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/PqSensitiveUserMapper.java @@ -1,16 +1,16 @@ -package com.njcn.csharmonic.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.njcn.csharmonic.pojo.po.PqSensitiveUser; - -/** - *

- * Mapper 接口 - *

- * - * @author xy - * @since 2025-11-17 - */ -public interface PqSensitiveUserMapper extends BaseMapper { - -} +//package com.njcn.csharmonic.mapper; +// +//import com.baomidou.mybatisplus.core.mapper.BaseMapper; +//import com.njcn.csharmonic.pojo.po.PqSensitiveUser; +// +///** +// *

+// * Mapper 接口 +// *

+// * +// * @author xy +// * @since 2025-11-17 +// */ +//public interface PqSensitiveUserMapper extends BaseMapper { +// +//} diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/mapping/CsEventUserPOMapper.xml b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/mapping/CsEventUserPOMapper.xml index 3cc9329..1d4231d 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/mapping/CsEventUserPOMapper.xml +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/mapper/mapping/CsEventUserPOMapper.xml @@ -28,6 +28,19 @@ + +