Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e629c8b42c | |||
| 9f5c273180 | |||
| d84d91a241 | |||
| ff3341549f | |||
| 99fb7aab66 | |||
| e1d731c774 | |||
| bdfdc9e75c | |||
| d43e0dd661 | |||
| dbdf9ba000 | |||
| a27315075c | |||
| 6f66e1d336 | |||
| 57d5b159ef | |||
| de60b53dd1 | |||
| 870ace35cb | |||
| 9438f75c01 | |||
| d44b4f3576 | |||
| ad7835f0db | |||
| b2e9597839 | |||
| 95d9432298 | |||
| 689f9ee51c | |||
| 38be9f6839 | |||
| 85f0775c97 | |||
| 681ec99f23 | |||
| 16c0620dd3 |
@@ -3,8 +3,7 @@ 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.CsCommTerminalFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.api.fallback.CsDeviceUserClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -31,4 +30,7 @@ public interface CsCommTerminalFeignClient {
|
||||
|
||||
@GetMapping("getPqUserIdsByUser")
|
||||
HttpResult<List<String>> getPqUserIdsByUser(@RequestParam("userId") String userId);
|
||||
|
||||
@PostMapping("/getLedgerByLineId")
|
||||
HttpResult<List<DevDetailDTO>> getLedgerByLineId(@RequestBody List<String> list);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ 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
|
||||
*/
|
||||
@@ -17,4 +19,7 @@ public interface CsCommunicateFeignClient {
|
||||
|
||||
@PostMapping("/insertion")
|
||||
HttpResult<String> insertion(@RequestBody PqsCommunicateDto pqsCommunicateDto);
|
||||
|
||||
@PostMapping("/insertionList")
|
||||
HttpResult<String> insertionList(@RequestBody List<PqsCommunicateDto> list);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
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.CsDeviceRegistryFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceRegistry;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csDeviceRegistry", fallbackFactory = CsDeviceRegistryFallbackFactory.class,contextId = "csDeviceRegistry")
|
||||
public interface CsDeviceRegistryFeignClient {
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("批量新增设备注册记录")
|
||||
HttpResult<Boolean> add(@RequestBody @Validated List<CsDeviceRegistry> list);
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改设备注册记录")
|
||||
HttpResult<Boolean> update(@RequestBody @Validated CsDeviceRegistry csDeviceRegistry);
|
||||
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除设备注册记录")
|
||||
HttpResult<Boolean> delete(@RequestParam("id") String id);
|
||||
|
||||
@PostMapping("/queryByCurrentNdid")
|
||||
@ApiOperation("根据currentNdid查询设备注册记录")
|
||||
HttpResult<List<CsDeviceRegistry>> queryByCurrentNdid(@RequestParam("currentNdid") String currentNdid);
|
||||
|
||||
@PostMapping("/queryByCurrentNdidAndClDid")
|
||||
@ApiOperation("根据currentNdid和clDid查询设备注册记录")
|
||||
HttpResult<CsDeviceRegistry> queryByCurrentNdidAndClDid(@RequestParam("currentNdid") String currentNdid, @RequestParam("clDid") Integer clDid);
|
||||
|
||||
@PostMapping("/updateIsAccessByCurrentNdid")
|
||||
@ApiOperation("根据currentNdid修改isAccess")
|
||||
HttpResult<Boolean> updateIsAccessByCurrentNdid(@RequestParam("currentNdid") String currentNdid, @RequestParam("isAccess") Integer isAccess);
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
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.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
@@ -71,9 +72,9 @@ public interface CsLineFeignClient {
|
||||
@PostMapping("/getOverLimitDataByIds")
|
||||
HttpResult<List<Overlimit>> getOverLimitData(@RequestBody List<String> ids);
|
||||
|
||||
@PostMapping("/getLineBySensitiveUser")
|
||||
@ApiOperation("根据敏感用户查询监测点")
|
||||
HttpResult<List<CsLinePO>> getLineBySensitiveUser(@RequestBody List<String> list);
|
||||
@PostMapping("/getDevBySensitiveUser")
|
||||
@ApiOperation("根据敏感用户查询装置")
|
||||
HttpResult<List<CsEquipmentDeliveryPO>> getDevBySensitiveUser(@RequestBody List<String> list);
|
||||
|
||||
@PostMapping("/list")
|
||||
HttpResult<List<CsLinePO>> list(@RequestBody CsLinePO param);
|
||||
|
||||
@@ -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.CsCommTerminalFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -51,6 +52,12 @@ public class CsCommTerminalFeignClientFallbackFactory implements FallbackFactory
|
||||
log.error("{}异常,降级处理,异常为:{}","根据登录用户id获取电能质量用户id集合",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<DevDetailDTO>> getLedgerByLineId(List<String> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据监测点id集合获取所有台账信息异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
@@ -35,6 +37,12 @@ public class CsCommunicateFeignClientFallbackFactory implements FallbackFactory<
|
||||
log.error("{}异常,降级处理,异常为:{}","新增记录",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<String> insertionList(List<PqsCommunicateDto> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}","批量插入数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
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.CsDeviceRegistryFeignClient;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceRegistry;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CsDeviceRegistryFallbackFactory implements FallbackFactory<CsDeviceRegistryFeignClient> {
|
||||
@Override
|
||||
public CsDeviceRegistryFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new CsDeviceRegistryFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> add(List<CsDeviceRegistry> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}","批量新增设备注册记录异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> update(CsDeviceRegistry csDeviceRegistry) {
|
||||
log.error("{}异常,降级处理,异常为:{}","修改设备注册记录异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> delete(String id) {
|
||||
log.error("{}异常,降级处理,异常为:{}","删除设备注册记录异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsDeviceRegistry>> queryByCurrentNdid(String currentNdid) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据currentNdid查询设备注册记录异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<CsDeviceRegistry> queryByCurrentNdidAndClDid(String currentNdid, Integer clDid) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据currentNdid和clDid查询设备注册记录数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> updateIsAccessByCurrentNdid(String currentNdid, Integer isAccess) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据currentNdid修改isAccess异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ 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.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
@@ -117,7 +118,7 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsLinePO>> getLineBySensitiveUser(List<String> list) {
|
||||
public HttpResult<List<CsEquipmentDeliveryPO>> getDevBySensitiveUser(List<String> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据敏感用户查询监测点异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
package com.njcn.csdevice.pojo.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
@@ -76,8 +70,6 @@ public class CsEquipmentDeliveryDTO {
|
||||
*/
|
||||
private String debugPerson;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 合同号
|
||||
*/
|
||||
@@ -120,4 +112,5 @@ public class CsEquipmentDeliveryDTO {
|
||||
* 设备软件信息id
|
||||
*/
|
||||
private String softinfoId;
|
||||
|
||||
}
|
||||
@@ -19,7 +19,12 @@ public class CsLineDTO implements Serializable {
|
||||
private String deviceId;
|
||||
|
||||
/**
|
||||
* 装置id
|
||||
* 装置名称
|
||||
*/
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 装置类型
|
||||
*/
|
||||
private String deviceType;
|
||||
|
||||
|
||||
@@ -34,6 +34,12 @@ public class DevDetailDTO {
|
||||
@ApiModelProperty(value = "设备名称")
|
||||
private String equipmentName;
|
||||
|
||||
@ApiModelProperty(value = "监测点id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty(value = "监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty(value = "设备通讯状态")
|
||||
private Integer runStatus;
|
||||
|
||||
@@ -43,6 +49,12 @@ public class DevDetailDTO {
|
||||
@ApiModelProperty(value = "nDid")
|
||||
private String nDid;
|
||||
|
||||
@ApiModelProperty(value = "监测对象")
|
||||
private String objType;
|
||||
|
||||
// @ApiModelProperty(value = "设备治理方案")
|
||||
// private String governType;
|
||||
|
||||
@ApiModelProperty(value = "监测点id集合")
|
||||
private List<String> lineList;
|
||||
}
|
||||
|
||||
@@ -111,4 +111,13 @@ public class CsEquipmentDeliveryAddParm implements Serializable {
|
||||
|
||||
@ApiModelProperty(value="是否支持升级(0:否 1:是)")
|
||||
private Integer upgrade;
|
||||
|
||||
@ApiModelProperty(value="治理方法")
|
||||
private String governMethod;
|
||||
|
||||
@ApiModelProperty(value="敏感用户id")
|
||||
private String monitorUser;
|
||||
|
||||
@ApiModelProperty(value="治理类型(稳态:harmonic 暂态:event)")
|
||||
private String governType;
|
||||
}
|
||||
@@ -116,4 +116,13 @@ public class CsEquipmentDeliveryAuditParm {
|
||||
|
||||
@ApiModelProperty(value="是否支持升级(0:否 1:是)")
|
||||
private Integer upgrade;
|
||||
|
||||
@ApiModelProperty(value="治理方法")
|
||||
private String governMethod;
|
||||
|
||||
@ApiModelProperty(value="敏感用户id")
|
||||
private String monitorUser;
|
||||
|
||||
@ApiModelProperty(value="治理类型(稳态:harmonic 暂态:event)")
|
||||
private String governType;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.njcn.csdevice.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2026-06-17
|
||||
*/
|
||||
@Data
|
||||
@TableName("cs_device_registry")
|
||||
public class CsDeviceRegistry implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 监测点id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 当前设备NDID
|
||||
*/
|
||||
private String currentNdid;
|
||||
|
||||
/**
|
||||
* 老的设备NDID
|
||||
*/
|
||||
private String oldNdid;
|
||||
|
||||
/**
|
||||
* 逻辑子设备编号
|
||||
*/
|
||||
private Integer clDid;
|
||||
|
||||
/**
|
||||
* 首次接入时间
|
||||
*/
|
||||
private LocalDateTime firstSeenTime;
|
||||
|
||||
/**
|
||||
* 修改完mac是否完成首次接入(0:未接入 1:已接入)
|
||||
*/
|
||||
private Integer isAccess;
|
||||
|
||||
|
||||
}
|
||||
@@ -127,14 +127,7 @@ public class CsLinePO extends BaseEntity {
|
||||
*/
|
||||
@TableField(value = "monitor_obj")
|
||||
private String monitorObj;
|
||||
/**
|
||||
* 是否治理(0:未治理 1:已治理)
|
||||
*/
|
||||
@TableField(value = "is_govern")
|
||||
private Integer govern;
|
||||
|
||||
@TableField(value = "monitor_user")
|
||||
private String monitorUser;
|
||||
|
||||
/**
|
||||
* 短路容量
|
||||
|
||||
@@ -106,4 +106,7 @@ public class CsEquipmentDeliveryVO extends BaseEntity {
|
||||
@ApiModelProperty(value="所属项目名称")
|
||||
private String associatedProjectName;
|
||||
|
||||
@ApiModelProperty(value="修改完mac是否完成首次接入(0:未接入 1:已接入)")
|
||||
private Integer isAccess;
|
||||
|
||||
}
|
||||
@@ -75,6 +75,18 @@ public class CsLedgerVO implements Serializable {
|
||||
@ApiModelProperty(name = "devConType",value = "设备连接方式 MQTT || CLD")
|
||||
private String devConType;
|
||||
|
||||
@ApiModelProperty(name = "监测点关联用户id")
|
||||
private String sensitiveUserId;
|
||||
|
||||
@ApiModelProperty(name = "监测点关联用户名称")
|
||||
private String sensitiveUserName;
|
||||
|
||||
@ApiModelProperty(name = "治理方案名称")
|
||||
private String governPlanName;
|
||||
|
||||
@ApiModelProperty(name = "监测点线路号")
|
||||
private Integer lineNo;
|
||||
|
||||
@ApiModelProperty(name = "children",value = "子节点")
|
||||
private List<CsLedgerVO> children = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@@ -31,6 +30,9 @@ public class DataGroupEventVO {
|
||||
@ApiModelProperty("装置ID")
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty("设备网络码")
|
||||
private String nDid;
|
||||
|
||||
@ApiModelProperty("装置名称")
|
||||
private String devName;
|
||||
|
||||
@@ -65,9 +67,24 @@ public class DataGroupEventVO {
|
||||
private Double amplitude;
|
||||
|
||||
@ApiModelProperty("严重度")
|
||||
private String severity;
|
||||
private Double severity;
|
||||
|
||||
@ApiModelProperty("波形路径")
|
||||
private String wavePath;
|
||||
|
||||
@ApiModelProperty("事件落点")
|
||||
private String landPoint;
|
||||
|
||||
@ApiModelProperty("暂降原因")
|
||||
private String advanceReason;
|
||||
|
||||
@ApiModelProperty("暂降类型")
|
||||
private String advanceType;
|
||||
|
||||
@ApiModelProperty("暂降源与监测位置关系 0-未知、1-上游、2-下游")
|
||||
private String sagSource;
|
||||
|
||||
@ApiModelProperty("监测点电压等级")
|
||||
private Double lineVoltage;
|
||||
|
||||
}
|
||||
|
||||
@@ -62,5 +62,8 @@ public class DeviceManagerVO {
|
||||
|
||||
@ApiModelProperty(value = "数据类型 rt:实时数据 history:历史数据")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,17 +8,25 @@ import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class PqSensitiveUserLineVO {
|
||||
@ApiModelProperty("工程名称")
|
||||
private String engineeringName;
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
@ApiModelProperty("设备id")
|
||||
private String devId;
|
||||
@ApiModelProperty("设备名称")
|
||||
private String devName;
|
||||
@ApiModelProperty("治理对象")
|
||||
private String sensitiveUser;
|
||||
@ApiModelProperty("监测点ID")
|
||||
private String lineId;
|
||||
@ApiModelProperty("测点名称")
|
||||
private String lineName;
|
||||
@ApiModelProperty("是否治理")
|
||||
@ApiModelProperty("治理方案")
|
||||
private String govern;
|
||||
@ApiModelProperty("电压等级")
|
||||
private double volGrade;
|
||||
@ApiModelProperty("监测类型")
|
||||
@ApiModelProperty("监测位置")
|
||||
private String position;
|
||||
@ApiModelProperty("运行状态")
|
||||
private String runStatus;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -20,6 +21,9 @@ public class RecordAllDevTreeVo {
|
||||
@ApiModelProperty("设备名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("设备状态")
|
||||
private Integer runStatus;
|
||||
|
||||
@ApiModelProperty("线路")
|
||||
private List<RecordAllLineTreeVo> children;
|
||||
|
||||
|
||||
@@ -75,4 +75,13 @@ public class PqsCommunicateController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/insertionList")
|
||||
@ApiOperation("批量插入数据")
|
||||
public HttpResult<String> insertionList(@RequestBody List<PqsCommunicateDto> list) {
|
||||
String methodDescribe = getMethodDescribe("insertionList");
|
||||
pqsCommunicateCvtQuery.insertionList(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
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.po.CsDeviceRegistry;
|
||||
import com.njcn.csdevice.service.ICsDeviceRegistryService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 徐扬
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/csDeviceRegistry")
|
||||
@Api(tags = "设备注册台账记录表")
|
||||
@AllArgsConstructor
|
||||
public class CsDeviceRegistryController extends BaseController {
|
||||
|
||||
private final ICsDeviceRegistryService csDeviceRegistryService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("批量新增设备注册记录")
|
||||
@ApiImplicitParam(name = "list", value = "设备注册信息列表", required = true)
|
||||
public HttpResult<Boolean> add(@RequestBody @Validated List<CsDeviceRegistry> list) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
boolean result = csDeviceRegistryService.add(list);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改设备注册记录")
|
||||
@ApiImplicitParam(name = "csDeviceRegistry", value = "设备注册信息", required = true)
|
||||
public HttpResult<Boolean> update(@RequestBody @Validated CsDeviceRegistry csDeviceRegistry) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
boolean result = csDeviceRegistryService.update(csDeviceRegistry);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/updateBatch")
|
||||
@ApiOperation("批量修改设备注册记录")
|
||||
@ApiImplicitParam(name = "list", value = "设备注册信息列表", required = true)
|
||||
public HttpResult<Boolean> updateBatch(@RequestBody @Validated List<CsDeviceRegistry> list) {
|
||||
String methodDescribe = getMethodDescribe("updateBatch");
|
||||
boolean result = csDeviceRegistryService.updateBatch(list);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除设备注册记录")
|
||||
@ApiImplicitParam(name = "id", value = "监测点id", required = true)
|
||||
public HttpResult<Boolean> delete(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
boolean result = csDeviceRegistryService.delete(id);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/updateIsAccessByCurrentNdid")
|
||||
@ApiOperation("根据currentNdid修改isAccess")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "currentNdid", value = "当前设备NDID", required = true),
|
||||
@ApiImplicitParam(name = "isAccess", value = "接入状态(0:未接入 1:已接入)", required = true)
|
||||
})
|
||||
public HttpResult<Boolean> updateIsAccessByCurrentNdid(
|
||||
@RequestParam("currentNdid") String currentNdid,
|
||||
@RequestParam("isAccess") Integer isAccess) {
|
||||
String methodDescribe = getMethodDescribe("updateIsAccessByCurrentNdid");
|
||||
boolean result = csDeviceRegistryService.updateIsAccessByCurrentNdid(currentNdid, isAccess);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/deleteByCurrentNdid")
|
||||
@ApiOperation("根据currentNdid删除设备注册记录")
|
||||
@ApiImplicitParam(name = "currentNdid", value = "当前设备NDID", required = true)
|
||||
public HttpResult<List<CsDeviceRegistry>> deleteByCurrentNdid(@RequestParam("currentNdid") String currentNdid) {
|
||||
String methodDescribe = getMethodDescribe("deleteByCurrentNdid");
|
||||
csDeviceRegistryService.deleteByCurrentNdid(currentNdid);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryByCurrentNdid")
|
||||
@ApiOperation("根据currentNdid查询设备注册记录")
|
||||
@ApiImplicitParam(name = "currentNdid", value = "当前设备NDID", required = true)
|
||||
public HttpResult<List<CsDeviceRegistry>> queryByCurrentNdid(@RequestParam("currentNdid") String currentNdid) {
|
||||
String methodDescribe = getMethodDescribe("queryByCurrentNdid");
|
||||
List<CsDeviceRegistry> list = csDeviceRegistryService.queryByCurrentNdid(currentNdid);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getById")
|
||||
@ApiOperation("根据id查询设备注册记录")
|
||||
@ApiImplicitParam(name = "id", value = "监测点id", required = true)
|
||||
public HttpResult<CsDeviceRegistry> getById(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getById");
|
||||
CsDeviceRegistry csDeviceRegistry = csDeviceRegistryService.getById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csDeviceRegistry, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryByCurrentNdidAndClDid")
|
||||
@ApiOperation("根据currentNdid和clDid查询设备注册记录")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "currentNdid", value = "当前设备NDID", required = true),
|
||||
@ApiImplicitParam(name = "clDid", value = "逻辑子设备编号", required = true)
|
||||
})
|
||||
public HttpResult<CsDeviceRegistry> queryByCurrentNdidAndClDid(
|
||||
@RequestParam("currentNdid") String currentNdid,
|
||||
@RequestParam("clDid") Integer clDid) {
|
||||
String methodDescribe = getMethodDescribe("queryByCurrentNdidAndClDid");
|
||||
CsDeviceRegistry pojo = csDeviceRegistryService.queryByCurrentNdidAndClDid(currentNdid, clDid);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pojo, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
@@ -10,7 +9,6 @@ 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.po.CsEventSendMsg;
|
||||
import com.njcn.csdevice.pojo.po.CsLogsPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
||||
import com.njcn.csdevice.service.ICsEventSendMsgService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
|
||||
@@ -179,9 +179,5 @@ public class CsGroupController extends BaseController {
|
||||
Map<String,List<ThdDataVO>> result = csGroupService.sensitiveUserTrendData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class CsUpgradeLogsController extends BaseController {
|
||||
@GetMapping("/getByDevId")
|
||||
@ApiOperation("查询指定devId的所有升级日志")
|
||||
@ApiImplicitParam(name = "devId", value = "装置Id", required = true)
|
||||
public HttpResult<List<CsUpgradeLogs>> getByDevId(@RequestBody String devId) {
|
||||
public HttpResult<List<CsUpgradeLogs>> getByDevId(@RequestParam("devId") String devId) {
|
||||
String methodDescribe = getMethodDescribe("getByDevId");
|
||||
List<CsUpgradeLogs> result = csUpgradeLogsService.lambdaQuery().eq(CsUpgradeLogs::getDevId, devId).list();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.njcn.csdevice.enums.DeviceOperate;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.param.*;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLogsPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import com.njcn.csdevice.pojo.vo.DevVersionVO;
|
||||
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||
@@ -30,7 +29,6 @@ import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import com.njcn.web.advice.DeviceLog;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -1,39 +1,23 @@
|
||||
package com.njcn.csdevice.controller.ledger;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
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.mapper.PqsDeviceUnitMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.service.CsCommTerminalService;
|
||||
import com.njcn.csdevice.service.CsDeviceUserPOService;
|
||||
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.constant.UserType;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -108,11 +92,17 @@ public class CsCommTerminalController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据监测点id集合,获取所有台账信息
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLedgerByLineId")
|
||||
@ApiOperation("根据监测点id集合获取所有台账信息")
|
||||
@ApiImplicitParam(name = "list", value = "实体", required = true)
|
||||
public HttpResult<List<DevDetailDTO>> getLedgerByLineId(@RequestBody List<String> list) {
|
||||
String methodDescribe = getMethodDescribe("getLedgerByLineId");
|
||||
List<DevDetailDTO> result = commTerminalService.getLedgerByLineId(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -90,14 +90,14 @@ public class CsLedgerController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/objTree")
|
||||
@ApiOperation("三层对象用户树")
|
||||
public HttpResult<List<CsLedgerVO>> objTree(){
|
||||
String methodDescribe = getMethodDescribe("getProjectTree");
|
||||
List<CsLedgerVO> list = csLedgerService.objTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
// @PostMapping("/objTree")
|
||||
// @ApiOperation("三层对象用户树")
|
||||
// public HttpResult<List<CsLedgerVO>> objTree(){
|
||||
// String methodDescribe = getMethodDescribe("getProjectTree");
|
||||
// List<CsLedgerVO> list = csLedgerService.objTree();
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
// }
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/add")
|
||||
|
||||
@@ -9,6 +9,7 @@ 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.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||
@@ -29,6 +30,7 @@ import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
@@ -147,6 +149,9 @@ public class CslineController extends BaseController {
|
||||
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsLinePO::getLineId,lineId).eq(CsLinePO::getStatus,1);
|
||||
CsLinePO po = csLinePOService.getOne(queryWrapper);
|
||||
if (Objects.isNull(po.getLineNo())) {
|
||||
po.setLineNo(po.getClDid());
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -295,11 +300,11 @@ public class CslineController extends BaseController {
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLineBySensitiveUser")
|
||||
@ApiOperation("根据敏感用户查询监测点")
|
||||
public HttpResult<List<CsLinePO>> getLineBySensitiveUser(@RequestBody List<String> list) {
|
||||
String methodDescribe = getMethodDescribe("getLineBySensitiveUser");
|
||||
List<CsLinePO> result = csLinePOService.getLineBySensitiveUser(list);
|
||||
@PostMapping("/getDevBySensitiveUser")
|
||||
@ApiOperation("根据敏感用户查询装置")
|
||||
public HttpResult<List<CsEquipmentDeliveryPO>> getDevBySensitiveUser(@RequestBody List<String> list) {
|
||||
String methodDescribe = getMethodDescribe("getDevBySensitiveUser");
|
||||
List<CsEquipmentDeliveryPO> result = csLinePOService.getDevBySensitiveUser(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,10 @@ package com.njcn.csdevice.handler;
|
||||
|
||||
|
||||
import com.github.tocrhz.mqtt.annotation.MqttSubscribe;
|
||||
|
||||
import com.github.tocrhz.mqtt.annotation.Payload;
|
||||
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.csdevice.service.CsLogsPOService;
|
||||
|
||||
import com.njcn.cssystem.api.CsLogsFeignClient;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
@@ -25,8 +23,7 @@ import java.nio.charset.StandardCharsets;
|
||||
@AllArgsConstructor
|
||||
public class MqttMessageHandler {
|
||||
|
||||
|
||||
private final CsLogsPOService csLogsPOService;
|
||||
private final CsLogsFeignClient csLogsFeignClient;
|
||||
|
||||
/**
|
||||
* 插入devicelog
|
||||
@@ -34,7 +31,7 @@ public class MqttMessageHandler {
|
||||
@MqttSubscribe(value = "/deviceLog")
|
||||
public void responseRtData(String topic, MqttMessage message, @Payload String payload) {
|
||||
DeviceLogDTO deviceLogDTO = PubUtils.json2obj(new String(message.getPayload(), StandardCharsets.UTF_8),DeviceLogDTO.class);
|
||||
csLogsPOService.addLog(deviceLogDTO);
|
||||
csLogsFeignClient.addUserLog(deviceLogDTO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceRegistry;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2026-06-17
|
||||
*/
|
||||
public interface CsDeviceRegistryMapper extends BaseMapper<CsDeviceRegistry> {
|
||||
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.csdevice.pojo.po.CsEventSendMsg;
|
||||
import com.njcn.csdevice.pojo.po.CsLogsPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.csdevice.mapper.CsDeviceRegistryMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -57,7 +57,8 @@
|
||||
<select id="findLineList" resultType="com.njcn.csdevice.pojo.dto.CsLineDTO">
|
||||
SELECT
|
||||
t1.*,
|
||||
t2.dev_type deviceType
|
||||
t2.dev_type deviceType,
|
||||
t2.name deviceName
|
||||
FROM
|
||||
cs_line t1
|
||||
LEFT JOIN cs_equipment_delivery t2 ON t1.device_id = t2.id
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<select id="getRecordAll" resultType="com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo">
|
||||
<if test="wlRecordPageParam.isTrueFlag == 0">
|
||||
select a.dev_id as id,b.name as name from wl_record a
|
||||
select a.dev_id as id,b.name as name,b.run_status as runStatus from wl_record a
|
||||
left join cs_equipment_delivery b on a.dev_id = b.id
|
||||
where a.type=1 and a.state =1 and a.end_time is not null
|
||||
and
|
||||
@@ -31,7 +31,7 @@
|
||||
group by a.dev_id,b.name having a.dev_id is not null and b.name is not null
|
||||
</if>
|
||||
<if test="wlRecordPageParam.isTrueFlag == 1">
|
||||
select a.dev_id as id,b.name as name from wl_record a
|
||||
select a.dev_id as id,b.name as name,b.run_status as runStatus from wl_record a
|
||||
left join cs_equipment_delivery b on a.dev_id = b.id
|
||||
where a.type=1 and a.state =1 and a.end_time is not null
|
||||
and exists
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
|
||||
import java.util.List;
|
||||
@@ -14,4 +15,6 @@ public interface CsCommTerminalService {
|
||||
PqsDeviceUnit lineUnitDetail(String lineId);
|
||||
|
||||
List<String> commGetDevIds(String userId);
|
||||
|
||||
List<DevDetailDTO> getLedgerByLineId(List<String> id);
|
||||
}
|
||||
|
||||
@@ -5,13 +5,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.param.*;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLogsPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import com.njcn.csdevice.pojo.vo.DevVersionVO;
|
||||
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||
@@ -86,7 +87,7 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
||||
|
||||
List<CsLinePO> getSimpleLine();
|
||||
|
||||
List<CsLinePO> getLineBySensitiveUser(List<String> list);
|
||||
List<CsEquipmentDeliveryPO> getDevBySensitiveUser(List<String> list);
|
||||
|
||||
Page<PqSensitiveUserLineVO> getSensitiveUserLineList(BaseParam param);
|
||||
boolean uploadReport(MultipartFile file, String lineId);
|
||||
|
||||
@@ -45,4 +45,6 @@ public interface ICsCommunicateService {
|
||||
List<PqsCommunicateDto> getRawDataEnd(LineCountEvaluateParam lineParam);
|
||||
|
||||
void insertion(PqsCommunicateDto pqsCommunicateDto);
|
||||
|
||||
void insertionList(List<PqsCommunicateDto> list);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceRegistry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2026-06-17
|
||||
*/
|
||||
public interface ICsDeviceRegistryService extends IService<CsDeviceRegistry> {
|
||||
|
||||
boolean add(List<CsDeviceRegistry> list);
|
||||
|
||||
boolean update(CsDeviceRegistry csDeviceRegistry);
|
||||
|
||||
boolean updateBatch(List<CsDeviceRegistry> list);
|
||||
|
||||
boolean delete(String id);
|
||||
|
||||
boolean updateIsAccessByCurrentNdid(String currentNdid, Integer isAccess);
|
||||
|
||||
void deleteByCurrentNdid(String currentNdid);
|
||||
|
||||
List<CsDeviceRegistry> queryByCurrentNdid(String currentNdid);
|
||||
|
||||
CsDeviceRegistry queryByCurrentNdidAndClDid(String currentNdid, Integer clDid);
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
||||
List<CsLedgerVO> getztProjectTree();
|
||||
|
||||
|
||||
List<CsLedgerVO> objTree();
|
||||
// List<CsLedgerVO> objTree();
|
||||
|
||||
/**
|
||||
* 根据设备集合获取项目和工程
|
||||
@@ -97,4 +97,6 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
||||
|
||||
List<DevDetailDTO> getEngineeringHaveDevs(List<String> list);
|
||||
|
||||
List<CsLedger> queryByPid(String pid);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,10 +8,13 @@ import com.njcn.csdevice.mapper.PqsDeviceUnitMapper;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.CsMarketDataVO;
|
||||
import com.njcn.csdevice.pojo.vo.CsTouristDataParmVO;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.csharmonic.api.PqGovernPlanFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.PqGovernPlan;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
@@ -21,9 +24,7 @@ import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -43,6 +44,7 @@ public class CsCommTerminalServiceImpl implements CsCommTerminalService {
|
||||
private final CsMarketDataService csMarketDataService;
|
||||
private final ICsLedgerService csLedgerService;
|
||||
private final CsTouristDataPOService csTouristDataPOService;
|
||||
private final PqGovernPlanFeignClient pqGovernPlanFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -66,18 +68,15 @@ public class CsCommTerminalServiceImpl implements CsCommTerminalService {
|
||||
@Override
|
||||
public List<String> getPqUserIdsByUser(String userId) {
|
||||
List<String> result = new ArrayList<>();
|
||||
List<String> devIds = commGetDevIds(userId);
|
||||
if (CollUtil.isEmpty(devIds)) {
|
||||
List<String> lineIds = getLineIdsByUser(userId);
|
||||
if (CollUtil.isEmpty(lineIds)) {
|
||||
return result;
|
||||
}
|
||||
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(CsLinePO::getLineId, CsLinePO::getMonitorUser).in(CsLinePO::getDeviceId, devIds)
|
||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||
List<CsLinePO> poList =csLinePOMapper.selectList(lambdaQueryWrapper);
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
result = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
List<PqGovernPlan> governPlans = pqGovernPlanFeignClient.getListByMonitorPoint(lineIds).getData();
|
||||
if (CollUtil.isEmpty(governPlans)) {
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
return governPlans.stream().map(PqGovernPlan::getPid).distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -126,4 +125,90 @@ public class CsCommTerminalServiceImpl implements CsCommTerminalService {
|
||||
}
|
||||
return devIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevDetailDTO> getLedgerByLineId(List<String> id) {
|
||||
List<DevDetailDTO> result = new ArrayList<>();
|
||||
List<CsLedger> lineLedgers = csLedgerService.listByIds(id);
|
||||
Set<String> equipmentIds = new HashSet<>();
|
||||
Set<String> projectIds = new HashSet<>();
|
||||
Set<String> engineeringIds = new HashSet<>();
|
||||
|
||||
if (CollUtil.isEmpty(lineLedgers)) {
|
||||
return result;
|
||||
}
|
||||
for (CsLedger item : lineLedgers) {
|
||||
String pids = item.getPids();
|
||||
if (pids == null) {
|
||||
continue;
|
||||
}
|
||||
String[] pidArr = pids.split(",");
|
||||
if (pidArr.length < 4) {
|
||||
continue;
|
||||
}
|
||||
engineeringIds.add(pidArr[1]);
|
||||
projectIds.add(pidArr[2]);
|
||||
equipmentIds.add(pidArr[3]);
|
||||
}
|
||||
|
||||
Map<String, CsLinePO> csLinePoMap = csLinePOMapper.selectBatchIds(id)
|
||||
.stream().collect(Collectors.toMap(CsLinePO::getLineId, item -> item));
|
||||
Map<String, CsLedger> equipmentLedgerMap = csLedgerService.listByIds(equipmentIds)
|
||||
.stream().collect(Collectors.toMap(CsLedger::getId, item -> item));
|
||||
Map<String, CsEquipmentDeliveryPO> equipmentDeliveryMap = csEquipmentDeliveryService.listByIds(equipmentIds)
|
||||
.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, item -> item));
|
||||
Map<String, CsLedger> projectLedgerMap = csLedgerService.listByIds(projectIds)
|
||||
.stream().collect(Collectors.toMap(CsLedger::getId, item -> item));
|
||||
Map<String, CsLedger> engineeringLedgerMap = csLedgerService.listByIds(engineeringIds)
|
||||
.stream().collect(Collectors.toMap(CsLedger::getId, item -> item));
|
||||
|
||||
for (CsLedger item : lineLedgers) {
|
||||
String pids = item.getPids();
|
||||
if (pids == null) {
|
||||
continue;
|
||||
}
|
||||
String[] pidArr = pids.split(",");
|
||||
if (pidArr.length < 4) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String engineeringId = pidArr[1];
|
||||
String projectId = pidArr[2];
|
||||
String equipmentId = pidArr[3];
|
||||
|
||||
CsLedger engineeringLedger = engineeringLedgerMap.get(engineeringId);
|
||||
CsLedger projectLedger = projectLedgerMap.get(projectId);
|
||||
CsLedger equipmentLedger = equipmentLedgerMap.get(equipmentId);
|
||||
if (engineeringLedger == null || projectLedger == null || equipmentLedger == null) {
|
||||
continue;
|
||||
}
|
||||
DevDetailDTO dto = new DevDetailDTO();
|
||||
dto.setEngineeringid(engineeringId);
|
||||
dto.setEngineeringName(engineeringLedger.getName());
|
||||
dto.setProjectId(projectId);
|
||||
dto.setProjectName(projectLedger.getName());
|
||||
dto.setEquipmentId(equipmentId);
|
||||
dto.setEquipmentName(equipmentLedger.getName());
|
||||
dto.setLineId(item.getId());
|
||||
dto.setLineName(item.getName());
|
||||
dto.setObjType(csLinePoMap.get(item.getId()).getMonitorObj());
|
||||
|
||||
if (Objects.isNull(csLinePoMap.get(item.getId()).getRunStatus())) {
|
||||
CsEquipmentDeliveryPO delivery = equipmentDeliveryMap.get(equipmentId);
|
||||
if (delivery != null) {
|
||||
Integer runStatus = delivery.getRunStatus();
|
||||
if (runStatus == 1) {
|
||||
dto.setRunStatus(2);
|
||||
} else if (runStatus == 2) {
|
||||
dto.setRunStatus(0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dto.setRunStatus(csLinePoMap.get(item.getId()).getRunStatus());
|
||||
}
|
||||
result.add(dto);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,7 +60,10 @@ public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDat
|
||||
if (Objects.equals(eleEpdPqd.getPhase(),"T")){
|
||||
vo.setPhasic("/");
|
||||
} else {
|
||||
vo.setPhasic(entry.getValue().stream().map(EleEpdPqd::getPhase).collect(Collectors.joining(",")));
|
||||
vo.setPhasic(entry.getValue().stream()
|
||||
.map(EleEpdPqd::getPhase)
|
||||
.map(phase -> "T".equals(phase) ? "总" : phase)
|
||||
.collect(Collectors.joining(",")));
|
||||
}
|
||||
vo.setName(entry.getKey());
|
||||
vo.setType(eleEpdPqd.getType());
|
||||
|
||||
@@ -64,6 +64,7 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
|
||||
.eq(CsDataSet::getPid,modelId)
|
||||
.eq(CsDataSet::getClDev,clDev)
|
||||
.and(i->i.eq(CsDataSet::getDataType,"Rt").or().isNull(CsDataSet::getDataType))
|
||||
.eq(CsDataSet::getStoreFlag,0)
|
||||
.list();
|
||||
return list.stream().min(Comparator.comparingInt(CsDataSet::getIdx)).get();
|
||||
}
|
||||
@@ -73,7 +74,8 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
|
||||
LambdaQueryWrapper<CsDataSet> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CsDataSet::getPid,modelId)
|
||||
.eq(CsDataSet::getClDev,clDev)
|
||||
.and(i->i.eq(CsDataSet::getDataType,"Rt").or().isNull(CsDataSet::getDataType));
|
||||
.and(i->i.eq(CsDataSet::getDataType,"Rt").or().isNull(CsDataSet::getDataType))
|
||||
.eq(CsDataSet::getStoreFlag,0);
|
||||
//谐波电压含有率
|
||||
if (target == 0) {
|
||||
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$HarmV$0".concat(clDev.toString()));
|
||||
|
||||
@@ -1,25 +1,19 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsDevCapacityPOMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsDevCapacityPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.service.CsDevCapacityPOService;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -48,16 +42,13 @@ public class CsDevCapacityPOServiceImpl extends ServiceImpl<CsDevCapacityPOMappe
|
||||
|
||||
@Override
|
||||
public Double getDevCapacity(String id) {
|
||||
List<CsLinePO> csLinePOS = csLinePOService.queryByDevId(id);
|
||||
|
||||
//String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
||||
|
||||
//Optional.ofNullable(csLinePOS).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
|
||||
//List<CsLinePO> collect1 = csLinePOS.stream().filter(temp -> Objects.equals(areaId, temp.getPosition())).collect(Collectors.toList());
|
||||
List<CsLinePO> pos = csLinePOService.queryByDevId(id);
|
||||
/*治理侧监测点*/
|
||||
CsLinePO csLinePO = csLinePOS.get(0);
|
||||
CsDevCapacityPO one = this.lambdaQuery().eq(CsDevCapacityPO::getLineId, csLinePO.getLineId()).eq(CsDevCapacityPO::getCldid, 0).one();
|
||||
// Optional.ofNullable(one).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.DATA_MISSING));
|
||||
CsLinePO po = pos.stream().filter(item -> Objects.equals(item.getClDid(),0)).findFirst().orElse(null);
|
||||
if (po == null) {
|
||||
return 0.0;
|
||||
}
|
||||
CsDevCapacityPO one = this.lambdaQuery().eq(CsDevCapacityPO::getLineId, po.getLineId()).eq(CsDevCapacityPO::getCldid, 0).one();
|
||||
if(Objects.isNull(one)){
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsDeviceRegistryMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceRegistry;
|
||||
import com.njcn.csdevice.service.ICsDeviceRegistryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 徐扬
|
||||
*/
|
||||
@Service
|
||||
public class CsDeviceRegistryServiceImpl extends ServiceImpl<CsDeviceRegistryMapper, CsDeviceRegistry> implements ICsDeviceRegistryService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean add(List<CsDeviceRegistry> list) {
|
||||
return this.saveBatch(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(CsDeviceRegistry csDeviceRegistry) {
|
||||
return this.updateById(csDeviceRegistry);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateBatch(List<CsDeviceRegistry> list) {
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByCurrentNdid(String currentNdid) {
|
||||
LambdaQueryWrapper<CsDeviceRegistry> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceRegistry::getCurrentNdid, currentNdid);
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(String id) {
|
||||
return this.removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateIsAccessByCurrentNdid(String currentNdid, Integer isAccess) {
|
||||
LambdaUpdateWrapper<CsDeviceRegistry> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(CsDeviceRegistry::getCurrentNdid, currentNdid)
|
||||
.set(CsDeviceRegistry::getIsAccess, isAccess);
|
||||
return this.update(updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsDeviceRegistry> queryByCurrentNdid(String currentNdid) {
|
||||
LambdaQueryWrapper<CsDeviceRegistry> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceRegistry::getCurrentNdid, currentNdid);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CsDeviceRegistry queryByCurrentNdidAndClDid(String currentNdid, Integer clDid) {
|
||||
LambdaQueryWrapper<CsDeviceRegistry> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceRegistry::getCurrentNdid, currentNdid)
|
||||
.eq(CsDeviceRegistry::getClDid, clDid);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.CsDeviceUserPOMapper;
|
||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||
@@ -31,10 +32,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.Objects.isNull;
|
||||
@@ -61,6 +59,7 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
private final EventUserFeignClient eventUserFeignClient;
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final IMqttUserService mqttUserService;
|
||||
private final CsCommTerminalFeignClient commTerminalService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -157,6 +156,14 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
// 如果游客没有配置任何数据权限,返回空列表
|
||||
appLedger = new ArrayList<>();
|
||||
}
|
||||
} else {
|
||||
//根据用户获取所属的设备
|
||||
List<String> lineIds = commTerminalService.getLineIdsByUser(RequestUtil.getUserIndex()).getData();
|
||||
if (CollectionUtil.isEmpty(lineIds)) {
|
||||
return vo;
|
||||
}
|
||||
Set<String> targetLineIds = new HashSet<>(lineIds);
|
||||
appLedger = filterLedgerTree(appLedger, targetLineIds);
|
||||
}
|
||||
|
||||
if (CollectionUtil.isNotEmpty(appLedger)) {
|
||||
@@ -317,6 +324,40 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归过滤台账树,仅保留包含目标lineId的分支
|
||||
*/
|
||||
private List<CsLedgerVO> filterLedgerTree(List<CsLedgerVO> nodes, Set<String> targetLineIds) {
|
||||
if (CollectionUtils.isEmpty(nodes)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return nodes.stream()
|
||||
.filter(node -> isNodeRelevant(node, targetLineIds))
|
||||
.peek(node -> {
|
||||
// 递归过滤子节点,并重新设置过滤后的子列表
|
||||
if (CollectionUtil.isNotEmpty(node.getChildren())) {
|
||||
node.setChildren(filterLedgerTree(node.getChildren(), targetLineIds));
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前节点或其任意子孙节点是否包含目标lineId
|
||||
*/
|
||||
private boolean isNodeRelevant(CsLedgerVO node, Set<String> targetLineIds) {
|
||||
// 1. 当前节点本身就是目标监测点
|
||||
if (node.getId() != null && targetLineIds.contains(node.getId())) {
|
||||
return true;
|
||||
}
|
||||
// 2. 子孙节点中包含目标监测点
|
||||
if (CollectionUtil.isNotEmpty(node.getChildren())) {
|
||||
return node.getChildren().stream()
|
||||
.anyMatch(child -> isNodeRelevant(child, targetLineIds));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 判断当前用户是否是主用户 0-否1-是
|
||||
* @Param:
|
||||
|
||||
@@ -138,6 +138,7 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
||||
if(StringUtils.isNotBlank(csEngineeringAuditParm.getName())){
|
||||
csLedger1.setName(csEngineeringAuditParm.getName());
|
||||
}
|
||||
csLedger1.setSort(csEngineeringAuditParm.getSort());
|
||||
csLedgerMapper.updateById(csLedger1);
|
||||
List<CsEngineeringPO> list = this.lambdaQuery().eq(CsEngineeringPO::getName, csEngineeringAuditParm.getName()).eq(CsEngineeringPO::getStatus, "1").list();
|
||||
if(list.size()>1){
|
||||
|
||||
@@ -24,10 +24,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.access.api.AskDeviceDataFeignClient;
|
||||
import com.njcn.access.utils.MqttUtil;
|
||||
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||
import com.njcn.csdevice.api.CsLogsFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||
@@ -69,7 +67,10 @@ import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -98,6 +99,7 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliveryMapper, CsEquipmentDeliveryPO> implements CsEquipmentDeliveryService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CsEquipmentDeliveryServiceImpl.class);
|
||||
private final CsDevModelRelationService csDevModelRelationService;
|
||||
private final ICsDataSetService csDataSetService;
|
||||
private final ICsLedgerService csLedgerService;
|
||||
@@ -114,7 +116,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
private final RedisUtil redisUtil;
|
||||
private final CsSoftInfoMapper csSoftInfoMapper;
|
||||
private final MqttUtil mqttUtil;
|
||||
private final CsLogsFeignClient csLogsFeignClient;
|
||||
private final INodeService nodeService;
|
||||
private final CsDevModelService csDevModelService;
|
||||
private final CsLedgerMapper csLedgerMapper;
|
||||
@@ -130,6 +131,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
private final OverLimitWlMapper overLimitWlMapper;
|
||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||
private final CsHarmonicPlanLineFeignClient csHarmonicPlanLineFeignClient;
|
||||
private final ICsDeviceRegistryService csDeviceRegistryService;
|
||||
private final StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@Override
|
||||
public void refreshDeviceDataCache() {
|
||||
@@ -218,7 +221,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
overLimitWlMapper.deleteBatchIds(collect);
|
||||
//删除配置
|
||||
csHarmonicPlanLineFeignClient.deleteByLineIds(collect);
|
||||
|
||||
QueryWrapper<AppLineTopologyDiagramPO> appLineTopologyDiagramPOQueryWrapper = new QueryWrapper<>();
|
||||
appLineTopologyDiagramPOQueryWrapper.clear();
|
||||
appLineTopologyDiagramPOQueryWrapper.in("line_id", collect);
|
||||
@@ -246,6 +248,10 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
QueryWrapper<CsTouristDataPO> queryWrap = new QueryWrapper<>();
|
||||
queryWrap.eq("device_id", id);
|
||||
csTouristDataPOService.getBaseMapper().delete(queryWrap);
|
||||
//删除设备注册表
|
||||
if (po != null) {
|
||||
csDeviceRegistryService.deleteByCurrentNdid(po.getNdid());
|
||||
}
|
||||
if (update) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
@@ -260,12 +266,17 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
return result;
|
||||
}
|
||||
BeanUtils.copyProperties(csEquipmentDeliveryPO, result);
|
||||
BeanUtils.copyProperties(csEquipmentDeliveryPO, result);
|
||||
if (!Objects.isNull(csEquipmentDeliveryPO.getAssociatedEngineering()) && !Objects.equals(csEquipmentDeliveryPO.getAssociatedEngineering(), "")) {
|
||||
result.setAssociatedEngineeringName(csLedgerService.findDataById(csEquipmentDeliveryPO.getAssociatedEngineering()).getName());
|
||||
CsLedger csLedger = csLedgerService.findDataById(csEquipmentDeliveryPO.getAssociatedEngineering());
|
||||
if (!Objects.isNull(csLedger)) {
|
||||
result.setAssociatedEngineeringName(csLedger.getName());
|
||||
}
|
||||
}
|
||||
if (!Objects.isNull(csEquipmentDeliveryPO.getAssociatedProject()) && !Objects.equals(csEquipmentDeliveryPO.getAssociatedProject(), "")) {
|
||||
result.setAssociatedProjectName(csLedgerService.findDataById(csEquipmentDeliveryPO.getAssociatedProject()).getName());
|
||||
CsLedger csLedger = csLedgerService.findDataById(csEquipmentDeliveryPO.getAssociatedProject());
|
||||
if (!Objects.isNull(csLedger)) {
|
||||
result.setAssociatedProjectName(csLedger.getName());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -310,7 +321,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
//判断设备是否存在告警
|
||||
temp.setIsAlarm(CollectionUtil.isNotEmpty(eventMap.get(temp.getEquipmentId())));
|
||||
});
|
||||
|
||||
//获取用户置顶的设备
|
||||
List<CsUserPins> topList = csUserPinsService.getPinToTopList();
|
||||
List<String> targetIdList = topList.stream().filter(item -> Objects.equals(item.getTargetType(), 1)).map(CsUserPins::getTargetId).collect(Collectors.toList());
|
||||
@@ -338,50 +348,236 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
return list;
|
||||
}
|
||||
|
||||
// ... existing code ...
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateEquipmentDelivery(CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm) {
|
||||
StringUtil.containsSpecialCharacters(csEquipmentDeliveryAuditParm.getNdid());
|
||||
boolean result;
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid()).in(CsEquipmentDeliveryPO::getStatus, Arrays.asList(1, 2, 3)).ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
||||
int countByAccount = this.count(lambdaQueryWrapper);
|
||||
//大于等于1个则表示重复
|
||||
if (countByAccount >= 1) {
|
||||
public Boolean updateEquipmentDelivery(CsEquipmentDeliveryAuditParm auditParm) {
|
||||
StringUtil.containsSpecialCharacters(auditParm.getNdid());
|
||||
// 校验ndid不重复
|
||||
long ndidCount = this.count(new LambdaQueryWrapper<CsEquipmentDeliveryPO>()
|
||||
.eq(CsEquipmentDeliveryPO::getNdid, auditParm.getNdid())
|
||||
.in(CsEquipmentDeliveryPO::getStatus, Arrays.asList(1, 2, 3))
|
||||
.ne(CsEquipmentDeliveryPO::getId, auditParm.getId()));
|
||||
if (ndidCount > 0) {
|
||||
throw new BusinessException(AlgorithmResponseEnum.NDID_ERROR);
|
||||
}
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper2.eq(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
||||
CsEquipmentDeliveryPO po = this.baseMapper.selectOne(lambdaQueryWrapper2);
|
||||
List<CsEquipmentDeliveryPO> list = this.lambdaQuery().ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId()).ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid()).eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAuditParm.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
// 查询原记录
|
||||
CsEquipmentDeliveryPO po = this.getById(auditParm.getId());
|
||||
if (Objects.isNull(po)) {
|
||||
throw new BusinessException("设备不存在");
|
||||
}
|
||||
// 校验设备名称不重复
|
||||
long nameCount = this.lambdaQuery()
|
||||
.ne(CsEquipmentDeliveryPO::getId, auditParm.getId())
|
||||
.ne(CsEquipmentDeliveryPO::getNdid, auditParm.getNdid())
|
||||
.eq(CsEquipmentDeliveryPO::getName, auditParm.getName())
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus, 0)
|
||||
.eq(CsEquipmentDeliveryPO::getDevAccessMethod, "MQTT")
|
||||
.count();
|
||||
if (nameCount > 0) {
|
||||
throw new BusinessException("设备名称不能重复");
|
||||
}
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
||||
BeanUtils.copyProperties(csEquipmentDeliveryAuditParm, csEquipmentDeliveryPo);
|
||||
result = this.updateById(csEquipmentDeliveryPo);
|
||||
//如果是已经接入的设备需要修改台账树中的设备名称
|
||||
CsLedger csLedger = csLedgerService.findDataById(csEquipmentDeliveryAuditParm.getId());
|
||||
CsEquipmentDeliveryPO updatePo = new CsEquipmentDeliveryPO();
|
||||
// 修改了ndid时的联动处理
|
||||
if (!Objects.equals(po.getNdid(), auditParm.getNdid())) {
|
||||
handleNdidChange(po, auditParm, updatePo);
|
||||
}
|
||||
BeanUtils.copyProperties(auditParm, updatePo);
|
||||
updatePo.setMac(createPath(auditParm.getNdid()));
|
||||
// 更新台账树中的设备名称及工程/项目
|
||||
CsLedger csLedger = csLedgerService.findDataById(auditParm.getId());
|
||||
if (ObjectUtil.isNotNull(csLedger)) {
|
||||
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||
BeanUtils.copyProperties(csLedger, csLedgerParam);
|
||||
csLedgerParam.setName(csEquipmentDeliveryAuditParm.getName());
|
||||
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||
csLedger.setName(auditParm.getName());
|
||||
updateLedger(csLedger);
|
||||
handleEngineeringProjectChange(po, auditParm, csLedger);
|
||||
}
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
if (!Objects.equals(po.getUsageStatus(), csEquipmentDeliveryAuditParm.getUsageStatus())) {
|
||||
DeviceLogDTO dto = new DeviceLogDTO();
|
||||
dto.setUserName(RequestUtil.getUsername());
|
||||
dto.setOperate("设备使用状态被修改");
|
||||
dto.setResult(1);
|
||||
dto.setLoginName(RequestUtil.getLoginName());
|
||||
csLogsFeignClient.addUserLog(dto);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return this.updateById(updatePo);
|
||||
}
|
||||
|
||||
private void handleNdidChange(CsEquipmentDeliveryPO po, CsEquipmentDeliveryAuditParm auditParm, CsEquipmentDeliveryPO updatePo) {
|
||||
String oldNdid = po.getNdid();
|
||||
String newNdid = auditParm.getNdid();
|
||||
// 1、更新设备注册表信息记录
|
||||
List<CsDeviceRegistry> registryList = csDeviceRegistryService.queryByCurrentNdid(oldNdid);
|
||||
List<CsDeviceRegistry> updateList = registryList.stream().map(item -> {
|
||||
CsDeviceRegistry registry = new CsDeviceRegistry();
|
||||
registry.setId(item.getId());
|
||||
registry.setCurrentNdid(newNdid);
|
||||
registry.setOldNdid(oldNdid);
|
||||
registry.setClDid(item.getClDid());
|
||||
registry.setFirstSeenTime(item.getFirstSeenTime());
|
||||
registry.setIsAccess(0);
|
||||
return registry;
|
||||
}).collect(Collectors.toList());
|
||||
csDeviceRegistryService.updateBatch(updateList);
|
||||
// 2、迁移redis缓存
|
||||
transferRedisCache(AppRedisKey.MODEL, oldNdid, newNdid);
|
||||
transferRedisCache(AppRedisKey.LINE_POSITION, oldNdid, newNdid);
|
||||
// 3、修改设备状态为离线、已注册
|
||||
updatePo.setRunStatus(1);
|
||||
updatePo.setStatus(2);
|
||||
// 4、清空老mac的数据模板
|
||||
stringRedisTemplate.convertAndSend("model_cache_clear", "clear");
|
||||
// 5、修改二维码信息
|
||||
updatePo.setQrPath(this.createQr(newNdid));
|
||||
}
|
||||
|
||||
private void transferRedisCache(String keyPrefix, String oldNdid, String newNdid) {
|
||||
Object data = redisUtil.getObjectByKey(keyPrefix + oldNdid);
|
||||
if (data != null) {
|
||||
redisUtil.delete(keyPrefix + oldNdid);
|
||||
redisUtil.saveByKey(keyPrefix + newNdid, data);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleEngineeringProjectChange(CsEquipmentDeliveryPO po, CsEquipmentDeliveryAuditParm auditParm, CsLedger csLedger) {
|
||||
boolean engineeringChanged = !Objects.equals(po.getAssociatedEngineering(), auditParm.getAssociatedEngineering());
|
||||
boolean projectChanged = !Objects.equals(po.getAssociatedProject(), auditParm.getAssociatedProject());
|
||||
if (!engineeringChanged && !projectChanged) {
|
||||
return;
|
||||
}
|
||||
// 已接入过的设备,工程和项目不能为空
|
||||
if (!Objects.equals(po.getStatus(), 1)) {
|
||||
if (StringUtils.isBlank(auditParm.getAssociatedEngineering()) || StringUtils.isBlank(auditParm.getAssociatedProject())) {
|
||||
throw new BusinessException("装置已接入过,工程项目不可设置为空");
|
||||
}
|
||||
// 修改设备台账的pid和pids
|
||||
csLedger.setPid(auditParm.getAssociatedProject());
|
||||
String[] pidsParts = csLedger.getPids().split(",");
|
||||
pidsParts[1] = auditParm.getAssociatedEngineering();
|
||||
pidsParts[2] = auditParm.getAssociatedProject();
|
||||
csLedger.setPids(String.join(",", pidsParts));
|
||||
updateLedger(csLedger);
|
||||
// 修改监测点的pids
|
||||
List<CsLedger> lineLedgers = csLedgerService.queryByPid(po.getId());
|
||||
lineLedgers.forEach(item -> {
|
||||
String[] linePidsParts = item.getPids().split(",");
|
||||
linePidsParts[1] = auditParm.getAssociatedEngineering();
|
||||
linePidsParts[2] = auditParm.getAssociatedProject();
|
||||
item.setPids(String.join(",", linePidsParts));
|
||||
updateLedger(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLedger(CsLedger csLedger) {
|
||||
CsLedgerParam.Update updateParam = new CsLedgerParam.Update();
|
||||
BeanUtils.copyProperties(csLedger, updateParam);
|
||||
csLedgerService.updateLedgerTree(updateParam);
|
||||
}
|
||||
|
||||
// ... existing code ...
|
||||
|
||||
|
||||
// @Override
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
// public Boolean updateEquipmentDelivery(CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm) {
|
||||
// StringUtil.containsSpecialCharacters(csEquipmentDeliveryAuditParm.getNdid());
|
||||
// boolean result;
|
||||
// LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid()).in(CsEquipmentDeliveryPO::getStatus, Arrays.asList(1, 2, 3)).ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
||||
// int countByAccount = this.count(lambdaQueryWrapper);
|
||||
// //大于等于1个则表示重复
|
||||
// if (countByAccount >= 1) {
|
||||
// throw new BusinessException(AlgorithmResponseEnum.NDID_ERROR);
|
||||
// }
|
||||
// LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
|
||||
// lambdaQueryWrapper2.eq(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
||||
// CsEquipmentDeliveryPO po = this.baseMapper.selectOne(lambdaQueryWrapper2);
|
||||
// CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
||||
// //修改了mac地址
|
||||
// if (!Objects.equals(po.getNdid(), csEquipmentDeliveryAuditParm.getNdid())) {
|
||||
// List<CsDeviceRegistry> updateList = new ArrayList<>();
|
||||
// //1、更新设备注册表信息记录
|
||||
// List<CsDeviceRegistry> list = csDeviceRegistryService.queryByCurrentNdid(po.getNdid());
|
||||
// list.forEach(item->{
|
||||
// CsDeviceRegistry csDeviceRegistry = new CsDeviceRegistry();
|
||||
// csDeviceRegistry.setId(item.getId());
|
||||
// csDeviceRegistry.setCurrentNdid(csEquipmentDeliveryAuditParm.getNdid());
|
||||
// csDeviceRegistry.setOldNdid(po.getNdid());
|
||||
// csDeviceRegistry.setClDid(item.getClDid());
|
||||
// csDeviceRegistry.setFirstSeenTime(item.getFirstSeenTime());
|
||||
// csDeviceRegistry.setIsAccess(0);
|
||||
// updateList.add(csDeviceRegistry);
|
||||
// });
|
||||
// csDeviceRegistryService.updateBatch(updateList);
|
||||
// //2、修改redis的缓存信息
|
||||
// Object data1 = redisUtil.getObjectByKey(AppRedisKey.MODEL + po.getNdid());
|
||||
// Object data2 = redisUtil.getObjectByKey(AppRedisKey.LINE_POSITION + po.getNdid());
|
||||
// if (data1 != null) {
|
||||
// redisUtil.delete(AppRedisKey.MODEL + po.getNdid());
|
||||
// redisUtil.saveByKey(AppRedisKey.MODEL + csEquipmentDeliveryAuditParm.getNdid(), data1);
|
||||
// }
|
||||
// if (data2 != null) {
|
||||
// redisUtil.delete(AppRedisKey.LINE_POSITION + po.getNdid());
|
||||
// redisUtil.saveByKey(AppRedisKey.LINE_POSITION + csEquipmentDeliveryAuditParm.getNdid(), data2);
|
||||
// }
|
||||
// //3、修改设备状态,设备应该是离线 已注册
|
||||
// csEquipmentDeliveryPo.setRunStatus(1);
|
||||
// csEquipmentDeliveryPo.setStatus(2);
|
||||
// //4.清空老mac的数据模板
|
||||
// stringRedisTemplate.convertAndSend("model_cache_clear", "clear");
|
||||
// //5.修改二维码信息
|
||||
// String qr = this.createQr(csEquipmentDeliveryAuditParm.getNdid());
|
||||
// csEquipmentDeliveryPo.setQrPath(qr);
|
||||
// }
|
||||
// List<CsEquipmentDeliveryPO> list = this.lambdaQuery().ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId()).ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid()).eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAuditParm.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
||||
// if (!CollectionUtils.isEmpty(list)) {
|
||||
// throw new BusinessException("设备名称不能重复");
|
||||
// }
|
||||
// BeanUtils.copyProperties(csEquipmentDeliveryAuditParm, csEquipmentDeliveryPo);
|
||||
// csEquipmentDeliveryPo.setMac(csEquipmentDeliveryAuditParm.getNdid().replaceAll("(.{2})", "$1:").substring(0, 17));
|
||||
//
|
||||
// //如果是已经接入的设备需要修改台账树中的设备名称
|
||||
// CsLedger csLedger = csLedgerService.findDataById(csEquipmentDeliveryAuditParm.getId());
|
||||
// if (ObjectUtil.isNotNull(csLedger)) {
|
||||
// CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||
// BeanUtils.copyProperties(csLedger, csLedgerParam);
|
||||
// csLedgerParam.setName(csEquipmentDeliveryAuditParm.getName());
|
||||
// csLedgerService.updateLedgerTree(csLedgerParam);
|
||||
// }
|
||||
// //修改预设的工程和项目
|
||||
// //判断设备状态,如果已经接入过,那么工程项目就不能设置为null;如果没有接入过,没有限制
|
||||
// if (!Objects.equals(po.getAssociatedEngineering(), csEquipmentDeliveryAuditParm.getAssociatedEngineering())
|
||||
// || !Objects.equals(po.getAssociatedProject(), csEquipmentDeliveryAuditParm.getAssociatedProject())) {
|
||||
// if (po.getStatus() != 1) {
|
||||
// if (Objects.isNull(csEquipmentDeliveryAuditParm.getAssociatedEngineering()) || Objects.isNull(csEquipmentDeliveryAuditParm.getAssociatedProject())) {
|
||||
// throw new BusinessException("装置已接入过,工程项目不可设置为空");
|
||||
// } else {
|
||||
// //修改设备
|
||||
// CsLedger csLedger2 = csLedgerService.findDataById(csEquipmentDeliveryAuditParm.getId());
|
||||
// csLedger2.setPid(csEquipmentDeliveryAuditParm.getAssociatedProject());
|
||||
// String pidS = csLedger2.getPids();
|
||||
// String[] parts = pidS.split(",");
|
||||
// parts[1] = csEquipmentDeliveryAuditParm.getAssociatedEngineering();
|
||||
// parts[2] = csEquipmentDeliveryAuditParm.getAssociatedProject();
|
||||
// String newPidS = String.join(",", parts);
|
||||
// csLedger2.setPids(newPidS);
|
||||
// CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||
// BeanUtils.copyProperties(csLedger2, csLedgerParam);
|
||||
// csLedgerService.updateLedgerTree(csLedgerParam);
|
||||
// csEquipmentDeliveryPo.setAssociatedEngineering(csEquipmentDeliveryAuditParm.getAssociatedEngineering());
|
||||
// csEquipmentDeliveryPo.setAssociatedProject(csEquipmentDeliveryAuditParm.getAssociatedProject());
|
||||
// //修改监测点
|
||||
// List<CsLedger> csLedgers = csLedgerService.queryByPid(po.getId());
|
||||
// csLedgers.forEach(item->{
|
||||
// String linePidS = item.getPids();
|
||||
// String[] lineParts = linePidS.split(",");
|
||||
// lineParts[1] = csEquipmentDeliveryAuditParm.getAssociatedEngineering();
|
||||
// lineParts[2] = csEquipmentDeliveryAuditParm.getAssociatedProject();
|
||||
// String lineNewPidS = String.join(",", lineParts);
|
||||
// item.setPids(lineNewPidS);
|
||||
// CsLedgerParam.Update csLedgerParam2 = new CsLedgerParam.Update();
|
||||
// BeanUtils.copyProperties(item, csLedgerParam2);
|
||||
// csLedgerService.updateLedgerTree(csLedgerParam2);
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// result = this.updateById(csEquipmentDeliveryPo);
|
||||
// return result;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void updateStatusBynDid(String nDId, Integer status) {
|
||||
boolean result;
|
||||
@@ -401,6 +597,14 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
queryParam.setPageNum((queryParam.getPageNum() - 1) * queryParam.getPageSize());
|
||||
int total = this.baseMapper.getCounts(queryParam);
|
||||
if (total > 0) {
|
||||
//获取设备注册信息表数据
|
||||
List<CsDeviceRegistry> list = csDeviceRegistryService.list();
|
||||
Map<String, List<CsDeviceRegistry>> groupedMap;
|
||||
if (list == null || list.isEmpty()) {
|
||||
groupedMap = Collections.emptyMap();
|
||||
} else {
|
||||
groupedMap = list.stream().collect(Collectors.groupingBy(CsDeviceRegistry::getCurrentNdid));
|
||||
}
|
||||
List<CsEquipmentDeliveryVO> recordList = this.baseMapper.getList(queryParam);
|
||||
//新增逻辑(针对便携式设备、监测设备):修改设备中的未注册状态(status = 1)改为5(前端定义的字典也即未接入)
|
||||
for (CsEquipmentDeliveryVO csEquipmentDeliveryVO : recordList) {
|
||||
@@ -420,6 +624,10 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
} else {
|
||||
csEquipmentDeliveryVO.setConnectStatus("未连接");
|
||||
}
|
||||
List<CsDeviceRegistry> data = groupedMap.get(csEquipmentDeliveryVO.getNdid());
|
||||
if (data != null && !data.isEmpty()) {
|
||||
csEquipmentDeliveryVO.setIsAccess(data.get(0).getIsAccess());
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotNull(queryParam.getConnectStatus())) {
|
||||
recordList = recordList.stream().filter(item -> queryParam.getConnectStatus() == 0 ? "未连接".equals(item.getConnectStatus()) : "已连接".equals(item.getConnectStatus())).collect(Collectors.toList());
|
||||
@@ -511,6 +719,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
dataSetVO.setName(item.getAnotherName());
|
||||
dataSetVO.setType("rt");
|
||||
dataSetList.add(dataSetVO);
|
||||
dataSetVO.setSort(item.getIdx());
|
||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||
}
|
||||
} else {
|
||||
@@ -518,33 +727,38 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
boolean isPortableDevice = DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType());
|
||||
boolean isCLdDevice = DicDataEnum.DEV_CLD.getCode().equals(dictTreeFeignClient.queryById(csEquipmentDeliveryPo.getDevType()).getData().getCode());
|
||||
|
||||
addDataSet(dataSetList, item, "最新数据", "rt");
|
||||
addDataSet(dataSetList, item, "历史统计数据", "history");
|
||||
addDataSet(dataSetList, item, "历史趋势", "trenddata");
|
||||
addDataSet(dataSetList, item, "最新数据", "rt",0);
|
||||
if (item.getClDev() == 0 && item.getType() == 0) {
|
||||
//限制角色展示
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> strings = JSONArray.parseArray(role, String.class);
|
||||
if (strings.contains(AppRoleEnum.ENGINEERING_USER.getCode()) || strings.contains(AppRoleEnum.OPERATION_MANAGER.getCode()) || strings.contains(AppRoleEnum.ROOT.getCode())) {
|
||||
addDataSet(dataSetList, item, "模块数据", "moduleData");
|
||||
addDataSet(dataSetList, item, "模块数据", "moduleData",3);
|
||||
}
|
||||
addDataSet(dataSetList, item, "历史数据", "trenddata",2);
|
||||
addDataSet(dataSetList, item, "暂态数据", "event",4);
|
||||
addDataSet(dataSetList, item, "运行数据", "devRunTrend",5);
|
||||
} else {
|
||||
addDataSet(dataSetList, item, "电度数据", "kilowattHour");
|
||||
addDataSet(dataSetList, item, "历史数据", "trenddata",2);
|
||||
addDataSet(dataSetList, item, "暂态数据", "event",4);
|
||||
addDataSet(dataSetList, item, "运行数据", "devRunTrend",5);
|
||||
addDataSet(dataSetList, item, "电度数据", "kilowattHour",6);
|
||||
}
|
||||
if (isPortableDevice) {
|
||||
addDataSet(dataSetList, item, "实时数据", "realtimedata",1);
|
||||
// 便携式设备特有的数据集
|
||||
addDataSet(dataSetList, item, "实时数据", "realtimedata");
|
||||
addDataSet(dataSetList, item, "暂态事件", "event");
|
||||
addDataSet(dataSetList, item, "测试项日志", "items");
|
||||
addDataSet(dataSetList, item, "测试项数据", "items",7);
|
||||
}
|
||||
if (isCLdDevice) {
|
||||
// 云前置数据集
|
||||
addDataSet(dataSetList, item, "实时数据", "realtimedata");
|
||||
addDataSet(dataSetList, item, "暂态事件", "event");
|
||||
addDataSet(dataSetList, item, "实时数据", "realtimedata",1);
|
||||
}
|
||||
addDataSet(dataSetList, item, "运行趋势", "devRunTrend");
|
||||
|
||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||
}
|
||||
if (CollUtil.isNotEmpty(dataSetList)) {
|
||||
dataSetList.sort(Comparator.comparing(DeviceManagerVO.DataSetVO::getSort));
|
||||
}
|
||||
deviceManagerVo.setDataSetList(dataSetList);
|
||||
List<CsLinePO> csLinePOS = csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid());
|
||||
if (!csLinePOS.isEmpty()) {
|
||||
@@ -554,11 +768,12 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
}
|
||||
}
|
||||
|
||||
private void addDataSet(List<DeviceManagerVO.DataSetVO> dataSetList, CsDataSet item, String name, String type) {
|
||||
private void addDataSet(List<DeviceManagerVO.DataSetVO> dataSetList, CsDataSet item, String name, String type, Integer sort) {
|
||||
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVO.setId(item.getId());
|
||||
dataSetVO.setName(name);
|
||||
dataSetVO.setType(type);
|
||||
dataSetVO.setSort(sort);
|
||||
dataSetList.add(dataSetVO);
|
||||
}
|
||||
|
||||
@@ -578,6 +793,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
return this.lambdaQuery().eq(CsEquipmentDeliveryPO::getNdid, nDid).ne(CsEquipmentDeliveryPO::getRunStatus, 0).one();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<CsEquipmentDeliveryPO> importEquipment(MultipartFile file, HttpServletResponse response) {
|
||||
@@ -951,22 +1167,13 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
csTerminalLogs.setNodeProcess(one.getNodeProcess());
|
||||
csTerminalLogs.setDeviceName(one.getName());
|
||||
csTerminalLogsMapper.insert(csTerminalLogs);
|
||||
//删除设备注册表
|
||||
csDeviceRegistryService.deleteByCurrentNdid(one.getNdid());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateCldDev(CsEquipmentDeliveryAuditParm param) {
|
||||
// //云前置设备判断,修改云前置判断设备是否达到上限
|
||||
// if(ObjectUtil.isNotNull(param.getNodeId())){
|
||||
// Node node = nodeService.getNodeById(param.getNodeId());
|
||||
// List<CsEquipmentDeliveryPO> devList = getListByNodeId(param.getNodeId());
|
||||
// if (ObjectUtil.isNotEmpty(devList) && devList.size() >= node.getNodeDevNum()) {
|
||||
// throw new BusinessException (AlgorithmResponseEnum.OVER_MAX_DEV_COUNT);
|
||||
// }
|
||||
// //自动分配进程号
|
||||
// int process = findLeastFrequentProcess(devList,node.getMaxProcessNum());
|
||||
// param.setNodeProcess(process);
|
||||
// }
|
||||
StringUtil.containsSpecialCharacters(param.getNdid());
|
||||
boolean result;
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
@@ -979,14 +1186,28 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper2.eq(CsEquipmentDeliveryPO::getId, param.getId());
|
||||
CsEquipmentDeliveryPO po = this.baseMapper.selectOne(lambdaQueryWrapper2);
|
||||
if (!Objects.equals(po.getNdid(), param.getNdid())) {
|
||||
List<CsDeviceRegistry> updateList = new ArrayList<>();
|
||||
//修改了mac地址
|
||||
List<CsDeviceRegistry> list = csDeviceRegistryService.queryByCurrentNdid(po.getNdid());
|
||||
list.forEach(item->{
|
||||
CsDeviceRegistry csDeviceRegistry = new CsDeviceRegistry();
|
||||
csDeviceRegistry.setId(item.getId());
|
||||
csDeviceRegistry.setCurrentNdid(param.getNdid());
|
||||
csDeviceRegistry.setOldNdid(po.getNdid());
|
||||
csDeviceRegistry.setClDid(item.getClDid());
|
||||
csDeviceRegistry.setFirstSeenTime(item.getFirstSeenTime());
|
||||
updateList.add(csDeviceRegistry);
|
||||
});
|
||||
csDeviceRegistryService.updateBatch(updateList);
|
||||
}
|
||||
List<CsEquipmentDeliveryPO> list = this.lambdaQuery().ne(CsEquipmentDeliveryPO::getId, param.getId()).ne(CsEquipmentDeliveryPO::getNdid, param.getNdid()).eq(CsEquipmentDeliveryPO::getName, param.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
throw new BusinessException("设备名称不能重复");
|
||||
}
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
||||
BeanUtils.copyProperties(param, csEquipmentDeliveryPo);
|
||||
String path = this.createPath(param.getNdid());
|
||||
csEquipmentDeliveryPo.setMac(path);
|
||||
csEquipmentDeliveryPo.setMac(param.getNdid().replaceAll("(.{2})", "$1:").substring(0, 17));
|
||||
result = this.updateById(csEquipmentDeliveryPo);
|
||||
//修改台账树中的设备名称
|
||||
CsLedger csLedger = csLedgerService.findDataById(param.getId());
|
||||
@@ -994,19 +1215,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||
BeanUtils.copyProperties(csLedger, csLedgerParam);
|
||||
csLedgerParam.setName(param.getName());
|
||||
csLedgerParam.setSort(param.getSort());
|
||||
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||
}
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
if (!Objects.equals(po.getUsageStatus(), param.getUsageStatus())) {
|
||||
DeviceLogDTO dto = new DeviceLogDTO();
|
||||
dto.setUserName(RequestUtil.getUsername());
|
||||
dto.setOperate("设备使用状态被修改");
|
||||
dto.setResult(1);
|
||||
dto.setLoginName(RequestUtil.getLoginName());
|
||||
csLogsFeignClient.addUserLog(dto);
|
||||
}
|
||||
}
|
||||
//新增台账日志
|
||||
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||
csTerminalLogs.setDeviceId(csEquipmentDeliveryPo.getId());
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsEventSendMsgMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsEventSendMsg;
|
||||
import com.njcn.csdevice.pojo.po.CsLogsPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
||||
import com.njcn.csdevice.service.ICsEventSendMsgService;
|
||||
import com.njcn.cssystem.pojo.po.CsFeedbackChatPO;
|
||||
import com.njcn.system.api.EpdFeignClient;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
|
||||
@@ -25,20 +25,24 @@ import com.njcn.csdevice.mapper.CsDataSetMapper;
|
||||
import com.njcn.csdevice.mapper.CsGroArrMapper;
|
||||
import com.njcn.csdevice.mapper.CsGroupMapper;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.param.EnergyBaseParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsGroupVO;
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
|
||||
import com.njcn.csdevice.pojo.vo.EnergyTemplateVO;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||
import com.njcn.csdevice.service.ICsGroupService;
|
||||
import com.njcn.csdevice.service.ICsLedgerService;
|
||||
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||
import com.njcn.csdevice.utils.DataChangeUtil;
|
||||
import com.njcn.csharmonic.api.EventFeignClient;
|
||||
import com.njcn.csharmonic.api.PqGovernPlanFeignClient;
|
||||
import com.njcn.csharmonic.constant.HarmonicConstant;
|
||||
import com.njcn.csharmonic.param.*;
|
||||
import com.njcn.csharmonic.pojo.po.PqGovernPlan;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataTdVO;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||
import com.njcn.device.biz.mapper.OverLimitWlMapper;
|
||||
@@ -49,7 +53,6 @@ import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||
import com.njcn.influx.service.CommonService;
|
||||
import com.njcn.influx.service.EvtDataService;
|
||||
import com.njcn.system.api.*;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import com.njcn.system.pojo.po.EleEvtParm;
|
||||
import com.njcn.system.pojo.vo.CsStatisticalSetVO;
|
||||
@@ -109,6 +112,8 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
|
||||
private final String GRID_SIDE_DICT_CODE = "Grid_Side";
|
||||
private final String LOAD_SIDE_DICT_CODE = "Load_Side";
|
||||
private final CsLinePOService csLinePOService;
|
||||
private final PqGovernPlanFeignClient pqGovernPlanFeignClient;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -517,9 +522,24 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
csEventUserQueryPage.setLineId(commonStatisticalQueryParam.getLineId());
|
||||
csEventUserQueryPage.setStartTime(commonStatisticalQueryParam.getStartTime());
|
||||
csEventUserQueryPage.setEndTime(commonStatisticalQueryParam.getEndTime());
|
||||
csEventUserQueryPage.setEvtParamTmMin(commonStatisticalQueryParam.getEvtParamTmMin());
|
||||
csEventUserQueryPage.setEvtParamTmMax(commonStatisticalQueryParam.getEvtParamTmMax());
|
||||
csEventUserQueryPage.setFeatureAmplitudeMin(commonStatisticalQueryParam.getFeatureAmplitudeMin());
|
||||
csEventUserQueryPage.setFeatureAmplitudeMax(commonStatisticalQueryParam.getFeatureAmplitudeMax());
|
||||
csEventUserQueryPage.setSeverityMin(commonStatisticalQueryParam.getSeverityMin());
|
||||
csEventUserQueryPage.setSeverityMax(commonStatisticalQueryParam.getSeverityMax());
|
||||
csEventUserQueryPage.setTarget(commonStatisticalQueryParam.getTarget());
|
||||
csEventUserQueryPage.setFileFlag(commonStatisticalQueryParam.getFileFlag());
|
||||
Page<DataGroupEventVO> csEventVOPage = eventFeignClient.pageQueryByLineId(csEventUserQueryPage).getData();
|
||||
|
||||
//获取监测点电压等级
|
||||
List<CsLineDTO> list = csLinePOService.getAllLineDetail();
|
||||
Map<String, CsLineDTO> map = list.stream().collect(Collectors.toMap(CsLineDTO::getLineId, temp -> temp));
|
||||
csEventVOPage.getRecords().forEach(temp->{
|
||||
//监测点电压等级
|
||||
Double volGrade = map.get(temp.getLineId()).getVolGrade();
|
||||
if (!Objects.isNull(volGrade)) {
|
||||
temp.setLineVoltage(volGrade);
|
||||
}
|
||||
//事件描述、相别、暂降幅值,需要特殊处理赋值
|
||||
//事件描述
|
||||
CsLedger dataById = iCsLedgerService.findDataById(temp.getLineId());
|
||||
@@ -1137,7 +1157,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||
commonQueryParam.setLineId(finalCsLinePO.getLineId());
|
||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||
commonQueryParam.setColumnName(epdPqd.getName() + (StringUtils.isEmpty(param.getFrequency()) ? "" : "_" + param.getFrequency()));
|
||||
commonQueryParam.setColumnName(epdPqd.getOtherName() + (StringUtils.isEmpty(param.getFrequency()) ? "" : "_" + param.getFrequency()));
|
||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||
|
||||
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(fittingDataQueryParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
|
||||
@@ -1146,7 +1166,9 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
String dataType = param.getValueType();
|
||||
if (StrUtil.isEmpty(dataType)) {
|
||||
// 电能质量指标,取限值计算类型,判断是否越限
|
||||
dataType = epdPqd.getFormula();
|
||||
dataType = epdPqd.getFormula().toUpperCase();
|
||||
} else {
|
||||
dataType = dataType.toUpperCase();
|
||||
}
|
||||
commonQueryParam.setDataType(dataType);
|
||||
|
||||
@@ -1316,15 +1338,10 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
}
|
||||
result.put("before", new ArrayList<>());
|
||||
result.put("after", new ArrayList<>());
|
||||
String sensitiveUserId = param.getSensitiveUserId();
|
||||
List<CsLinePO> linePOList = csLineFeignClient.getLineBySensitiveUser(Collections.singletonList(sensitiveUserId)).getData();
|
||||
if (CollUtil.isEmpty(linePOList)) {
|
||||
PqGovernPlan plan = pqGovernPlanFeignClient.getById(param.getSensitiveUserId()).getData();
|
||||
if (Objects.isNull(plan)) {
|
||||
return result;
|
||||
}
|
||||
DictData loadSideDictData = dicDataFeignClient.getDicDataByCode(LOAD_SIDE_DICT_CODE).getData();
|
||||
DictData gridSideDictData = dicDataFeignClient.getDicDataByCode(GRID_SIDE_DICT_CODE).getData();
|
||||
CsLinePO gridSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(gridSideDictData.getId())).findFirst().orElse(null);
|
||||
CsLinePO loadSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(loadSideDictData.getId())).findFirst().orElse(null);
|
||||
TrendDataQueryParam trendDataQueryParam = new TrendDataQueryParam();
|
||||
trendDataQueryParam.setSearchBeginTime(param.getSearchBeginTime());
|
||||
trendDataQueryParam.setSearchEndTime(param.getSearchEndTime());
|
||||
@@ -1340,17 +1357,14 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
return queryParam;
|
||||
}).collect(Collectors.toList());
|
||||
trendDataQueryParam.setList(indexList);
|
||||
if (loadSideLine != null) {
|
||||
trendDataQueryParam.setLineId(loadSideLine.getLineId());
|
||||
List<ThdDataVO> thdDataList = this.trendData(trendDataQueryParam);
|
||||
result.put("before", thdDataList);
|
||||
}
|
||||
if (gridSideLine != null) {
|
||||
trendDataQueryParam.setLineId(gridSideLine.getLineId());
|
||||
List<ThdDataVO> thdDataList = this.trendData(trendDataQueryParam);
|
||||
result.put("after", thdDataList);
|
||||
}
|
||||
|
||||
//治理前
|
||||
trendDataQueryParam.setLineId(plan.getGovernBefore());
|
||||
List<ThdDataVO> thdDataList1 = this.trendData(trendDataQueryParam);
|
||||
result.put("before", thdDataList1);
|
||||
//治理后
|
||||
trendDataQueryParam.setLineId(plan.getGovernAfter());
|
||||
List<ThdDataVO> thdDataList2 = this.trendData(trendDataQueryParam);
|
||||
result.put("after", thdDataList2);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,14 +5,11 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||
import com.njcn.csdevice.api.CsMarketDataFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
@@ -22,7 +19,9 @@ import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.csharmonic.api.PqGovernPlanFeignClient;
|
||||
import com.njcn.csharmonic.api.PqSensitiveUserFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.PqGovernPlan;
|
||||
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
@@ -30,14 +29,12 @@ import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
import com.njcn.user.pojo.constant.UserType;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@@ -67,8 +64,8 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
private final ICsDataSetService csDataSetService;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
||||
private final PqGovernPlanFeignClient pqGovernPlanFeignClient;
|
||||
private final PqSensitiveUserFeignClient pqSensitiveUserFeignClient;
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final ICsUserPinsService csUserPinsService;
|
||||
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
||||
|
||||
@@ -165,27 +162,99 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
.filter(item -> Objects.equals(poMap.get(item.getId()).getUsageStatus(), 1))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<CsLedgerVO> finalLineList = allList.stream()
|
||||
.filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode()))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.peek(
|
||||
item -> {
|
||||
item.setType("line");
|
||||
String index = item.getId().substring(item.getId().length() - 1);
|
||||
if (Objects.equals(index, "0")) {
|
||||
item.setLineType(0);
|
||||
} else {
|
||||
item.setLineType(1);
|
||||
}
|
||||
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsLinePO::getLineId, item.getId()).eq(CsLinePO::getStatus, 1);
|
||||
CsLinePO po = csLinePOService.getOne(queryWrapper);
|
||||
item.setConType(po.getConType());
|
||||
}
|
||||
)
|
||||
//获取治理方案
|
||||
List<PqGovernPlan> governPlan = pqGovernPlanFeignClient.getListExcludeNull().getData();
|
||||
Map<String, PqGovernPlan> beforeMap = Optional.ofNullable(governPlan)
|
||||
.orElse(Collections.emptyList())
|
||||
.stream()
|
||||
.filter(p -> p.getGovernBefore() != null)
|
||||
.collect(Collectors.toMap(
|
||||
PqGovernPlan::getGovernBefore,
|
||||
Function.identity(),
|
||||
(v1, v2) -> v1
|
||||
));
|
||||
Map<String, PqGovernPlan> afterMap = Optional.ofNullable(governPlan)
|
||||
.orElse(Collections.emptyList())
|
||||
.stream()
|
||||
.filter(p -> p.getGovernAfter() != null)
|
||||
.collect(Collectors.toMap(
|
||||
PqGovernPlan::getGovernAfter,
|
||||
Function.identity(),
|
||||
(v1, v2) -> v1
|
||||
));
|
||||
//获取治理用户
|
||||
// 1. governPlan 防 null + 过滤掉 pid 为 null 的数据
|
||||
List<String> sensitiveUser = Optional.ofNullable(governPlan)
|
||||
.orElse(Collections.emptyList())
|
||||
.stream()
|
||||
.map(PqGovernPlan::getPid)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 2. 没有 id 就不调用远程接口,直接返回空 Map
|
||||
Map<String, PqSensitiveUser> sensitiveUserMap;
|
||||
if (CollectionUtils.isEmpty(sensitiveUser)) {
|
||||
sensitiveUserMap = Collections.emptyMap();
|
||||
} else {
|
||||
List<PqSensitiveUser> sensitiveUserList = pqSensitiveUserFeignClient
|
||||
.getListByIds(sensitiveUser)
|
||||
.getData();
|
||||
// 3. sensitiveUserList 防 null
|
||||
sensitiveUserMap = Optional.ofNullable(sensitiveUserList)
|
||||
.orElse(Collections.emptyList())
|
||||
.stream()
|
||||
.filter(u -> u != null && u.getId() != null)
|
||||
.collect(Collectors.toMap(
|
||||
PqSensitiveUser::getId,
|
||||
Function.identity(),
|
||||
(v1, v2) -> v1
|
||||
));
|
||||
}
|
||||
List<CsLedgerVO> finalLineList;
|
||||
//获取监测点数据
|
||||
Integer targetLevel = LineBaseEnum.LINE_LEVEL.getCode();
|
||||
List<String> lineIds = allList.stream()
|
||||
.filter(item -> item != null && targetLevel.equals(item.getLevel()))
|
||||
.map(CsLedgerVO::getId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(lineIds)) {
|
||||
List<CsLinePO> poList = csLinePOService.listByIds(lineIds);
|
||||
Map<String, CsLinePO> lineMap = poList.stream().collect(Collectors.toMap(CsLinePO::getLineId,Function.identity(),(v1, v2) -> v1));
|
||||
finalLineList = allList.stream()
|
||||
.filter(item -> item.getLevel().equals(targetLevel))
|
||||
.peek(
|
||||
item -> {
|
||||
PqGovernPlan beforePlan = beforeMap.get(item.getId());
|
||||
PqGovernPlan afterPlan = afterMap.get(item.getId());
|
||||
if (beforePlan != null) {
|
||||
PqSensitiveUser user = sensitiveUserMap.get(beforePlan.getPid());
|
||||
item.setSensitiveUserId(beforePlan.getPid());
|
||||
item.setSensitiveUserName(Objects.isNull(user) ? null : user.getName());
|
||||
item.setGovernPlanName(beforePlan.getGovernName());
|
||||
}
|
||||
if (afterPlan != null) {
|
||||
PqSensitiveUser user = sensitiveUserMap.get(afterPlan.getPid());
|
||||
item.setSensitiveUserId(afterPlan.getPid());
|
||||
item.setSensitiveUserName(Objects.isNull(user) ? null : user.getName());
|
||||
item.setGovernPlanName(afterPlan.getGovernName());
|
||||
}
|
||||
item.setType("line");
|
||||
CsLinePO po = lineMap.get(item.getId());
|
||||
item.setConType(po.getConType());
|
||||
if (Objects.isNull(po.getClDid())) {
|
||||
item.setSort(po.getLineNo());
|
||||
} else {
|
||||
item.setSort(po.getClDid());
|
||||
}
|
||||
item.setLineType(Objects.equals(po.getClDid(), 0) ? 0 : 1);
|
||||
}
|
||||
)
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort, Comparator.nullsLast(Comparator.naturalOrder())))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
finalLineList = allList;
|
||||
}
|
||||
checkDevSetData(deviceList);
|
||||
List<CsLedgerVO> engineeringList1 = new ArrayList<>();
|
||||
List<CsLedgerVO> projectList1 = new ArrayList<>();
|
||||
@@ -470,7 +539,9 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
}
|
||||
});
|
||||
|
||||
return new ArrayList<>(projectMap.values());
|
||||
List<CsLedgerVO> result = new ArrayList<>(projectMap.values());
|
||||
result.sort(Comparator.comparing(CsLedgerVO::getSort, Comparator.nullsLast(Comparator.naturalOrder())));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1058,88 +1129,88 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> objTree() {
|
||||
List<CsLedgerVO> result = new ArrayList<>();
|
||||
String userId = RequestUtil.getUserIndex();
|
||||
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||
List<String> devIds;
|
||||
if (userVO.getType().equals(UserType.SUPER_ADMINISTRATOR) || userVO.getType().equals(UserType.ADMINISTRATOR)) {
|
||||
devIds = csEquipmentDeliveryMapper.selectList(null).stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
} else {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(CsDeviceUserPO::getDeviceId)
|
||||
.and(w -> w.eq(CsDeviceUserPO::getPrimaryUserId, userId).or().eq(CsDeviceUserPO::getSubUserId, userId))
|
||||
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||
List<CsDeviceUserPO> devList = csDeviceUserPOMapper.selectList(lambdaQueryWrapper);
|
||||
devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
if (CollUtil.isEmpty(devIds)) {
|
||||
return result;
|
||||
}
|
||||
List<CsLinePO> poList = csLinePOService.lambdaQuery().in(CsLinePO::getDeviceId, devIds)
|
||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).ne(CsLinePO::getMonitorUser,"").isNotNull(CsLinePO::getMonitorUser).list();
|
||||
if (CollUtil.isEmpty(poList)) {
|
||||
return result;
|
||||
}
|
||||
List<String> objIds = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
List<String> lineIds = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
|
||||
List<PqSensitiveUser> pqSensitiveUserList = pqSensitiveUserFeignClient.getListByIds(objIds).getData();
|
||||
if (CollUtil.isEmpty(pqSensitiveUserList)) {
|
||||
return result;
|
||||
}
|
||||
Map<String,String> objMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
||||
|
||||
List<CsLedger> csLineList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, lineIds));
|
||||
Map<String,List<String>> lineMap = csLineList.stream().collect(Collectors.groupingBy(it->it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1],Collectors.mapping(CsLedger::getId,Collectors.toList())));
|
||||
|
||||
List<String> projectIds = csLineList.stream().map(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).distinct().collect(Collectors.toList());
|
||||
List<CsLedger> projectList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, projectIds));
|
||||
|
||||
List<CsLedgerVO> realProjectList = new ArrayList<>();
|
||||
projectList.forEach(pro->{
|
||||
CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||
csLedgerVO.setId(pro.getId());
|
||||
csLedgerVO.setPid(pro.getPid());
|
||||
csLedgerVO.setLevel(pro.getLevel());
|
||||
csLedgerVO.setName(pro.getName());
|
||||
|
||||
List<CsLedgerVO> temObjList = new ArrayList<>();
|
||||
if(lineMap.containsKey(pro.getId())){
|
||||
List<String> ids = lineMap.get(pro.getId());
|
||||
List<String> objTemIds = poList.stream().filter(it->ids.contains(it.getLineId())).map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(objTemIds)){
|
||||
objTemIds.forEach(it->{
|
||||
CsLedgerVO inner = new CsLedgerVO();
|
||||
inner.setName(objMap.getOrDefault(it,"未知异常用户"));
|
||||
inner.setId(it);
|
||||
inner.setLevel(2);
|
||||
temObjList.add(inner);
|
||||
});
|
||||
}
|
||||
}
|
||||
csLedgerVO.setChildren(temObjList);
|
||||
realProjectList.add(csLedgerVO);
|
||||
});
|
||||
|
||||
List<String> gcIds = projectList.stream().map(CsLedger::getPid).collect(Collectors.toList());
|
||||
List<CsLedger> gcList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, gcIds));
|
||||
|
||||
List<CsLedgerVO> realGcList = new ArrayList<>();
|
||||
gcList.forEach(gc->{
|
||||
CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||
csLedgerVO.setId(gc.getId());
|
||||
csLedgerVO.setPid(gc.getPid());
|
||||
csLedgerVO.setLevel(gc.getLevel());
|
||||
csLedgerVO.setName(gc.getName());
|
||||
|
||||
List<CsLedgerVO> proList = realProjectList.stream().filter(it->gc.getId().equals(it.getPid())).collect(Collectors.toList());
|
||||
csLedgerVO.setChildren(proList);
|
||||
realGcList.add(csLedgerVO);
|
||||
});
|
||||
return realGcList;
|
||||
}
|
||||
// @Override
|
||||
// public List<CsLedgerVO> objTree() {
|
||||
// List<CsLedgerVO> result = new ArrayList<>();
|
||||
// String userId = RequestUtil.getUserIndex();
|
||||
// UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||
// List<String> devIds;
|
||||
// if (userVO.getType().equals(UserType.SUPER_ADMINISTRATOR) || userVO.getType().equals(UserType.ADMINISTRATOR)) {
|
||||
// devIds = csEquipmentDeliveryMapper.selectList(null).stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
// } else {
|
||||
// LambdaQueryWrapper<CsDeviceUserPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// lambdaQueryWrapper.select(CsDeviceUserPO::getDeviceId)
|
||||
// .and(w -> w.eq(CsDeviceUserPO::getPrimaryUserId, userId).or().eq(CsDeviceUserPO::getSubUserId, userId))
|
||||
// .eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||
// List<CsDeviceUserPO> devList = csDeviceUserPOMapper.selectList(lambdaQueryWrapper);
|
||||
// devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
// }
|
||||
// if (CollUtil.isEmpty(devIds)) {
|
||||
// return result;
|
||||
// }
|
||||
// List<CsLinePO> poList = csLinePOService.lambdaQuery().in(CsLinePO::getDeviceId, devIds)
|
||||
// .eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).ne(CsLinePO::getMonitorUser,"").isNotNull(CsLinePO::getMonitorUser).list();
|
||||
// if (CollUtil.isEmpty(poList)) {
|
||||
// return result;
|
||||
// }
|
||||
// List<String> objIds = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
// List<String> lineIds = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
//
|
||||
// List<PqSensitiveUser> pqSensitiveUserList = pqSensitiveUserFeignClient.getListByIds(objIds).getData();
|
||||
// if (CollUtil.isEmpty(pqSensitiveUserList)) {
|
||||
// return result;
|
||||
// }
|
||||
// Map<String,String> objMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
||||
//
|
||||
// List<CsLedger> csLineList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, lineIds));
|
||||
// Map<String,List<String>> lineMap = csLineList.stream().collect(Collectors.groupingBy(it->it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1],Collectors.mapping(CsLedger::getId,Collectors.toList())));
|
||||
//
|
||||
// List<String> projectIds = csLineList.stream().map(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).distinct().collect(Collectors.toList());
|
||||
// List<CsLedger> projectList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, projectIds));
|
||||
//
|
||||
// List<CsLedgerVO> realProjectList = new ArrayList<>();
|
||||
// projectList.forEach(pro->{
|
||||
// CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||
// csLedgerVO.setId(pro.getId());
|
||||
// csLedgerVO.setPid(pro.getPid());
|
||||
// csLedgerVO.setLevel(pro.getLevel());
|
||||
// csLedgerVO.setName(pro.getName());
|
||||
//
|
||||
// List<CsLedgerVO> temObjList = new ArrayList<>();
|
||||
// if(lineMap.containsKey(pro.getId())){
|
||||
// List<String> ids = lineMap.get(pro.getId());
|
||||
// List<String> objTemIds = poList.stream().filter(it->ids.contains(it.getLineId())).map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
// if(CollUtil.isNotEmpty(objTemIds)){
|
||||
// objTemIds.forEach(it->{
|
||||
// CsLedgerVO inner = new CsLedgerVO();
|
||||
// inner.setName(objMap.getOrDefault(it,"未知异常用户"));
|
||||
// inner.setId(it);
|
||||
// inner.setLevel(2);
|
||||
// temObjList.add(inner);
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// csLedgerVO.setChildren(temObjList);
|
||||
// realProjectList.add(csLedgerVO);
|
||||
// });
|
||||
//
|
||||
// List<String> gcIds = projectList.stream().map(CsLedger::getPid).collect(Collectors.toList());
|
||||
// List<CsLedger> gcList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, gcIds));
|
||||
//
|
||||
// List<CsLedgerVO> realGcList = new ArrayList<>();
|
||||
// gcList.forEach(gc->{
|
||||
// CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||
// csLedgerVO.setId(gc.getId());
|
||||
// csLedgerVO.setPid(gc.getPid());
|
||||
// csLedgerVO.setLevel(gc.getLevel());
|
||||
// csLedgerVO.setName(gc.getName());
|
||||
//
|
||||
// List<CsLedgerVO> proList = realProjectList.stream().filter(it->gc.getId().equals(it.getPid())).collect(Collectors.toList());
|
||||
// csLedgerVO.setChildren(proList);
|
||||
// realGcList.add(csLedgerVO);
|
||||
// });
|
||||
// return realGcList;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> getProAndEngineer(List<String> id) {
|
||||
@@ -1171,60 +1242,33 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
public CsLedgerVO cldTree() {
|
||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
if (CollectionUtil.isEmpty(allList)) {
|
||||
CsLedgerVO government = new CsLedgerVO();
|
||||
government.setLevel(-1);
|
||||
government.setName("台账树");
|
||||
government.setPid("0");
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(new ArrayList<>());
|
||||
return government;
|
||||
return buildTreeRootNode(new ArrayList<>());
|
||||
}
|
||||
|
||||
List<CsLedgerVO> engineeringList = allList.stream()
|
||||
.filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode()))
|
||||
Map<Integer, List<CsLedgerVO>> levelMap = allList.stream()
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
.collect(Collectors.groupingBy(CsLedgerVO::getLevel));
|
||||
|
||||
List<CsLedgerVO> projectList = allList.stream()
|
||||
.filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode()))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<CsLedgerVO> deviceList = allList.stream()
|
||||
.filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode()))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<CsLedgerVO> lineList = allList.stream()
|
||||
.filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode()))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
List<CsLedgerVO> engineeringList = levelMap.getOrDefault(LineBaseEnum.ENGINEERING_LEVEL.getCode(), new ArrayList<>());
|
||||
List<CsLedgerVO> projectList = levelMap.getOrDefault(LineBaseEnum.PROJECT_LEVEL.getCode(), new ArrayList<>());
|
||||
List<CsLedgerVO> deviceList = levelMap.getOrDefault(LineBaseEnum.DEVICE_LEVEL.getCode(), new ArrayList<>());
|
||||
List<CsLedgerVO> lineList = levelMap.getOrDefault(LineBaseEnum.LINE_LEVEL.getCode(), new ArrayList<>());
|
||||
|
||||
if (CollectionUtil.isEmpty(deviceList)) {
|
||||
CsLedgerVO government = new CsLedgerVO();
|
||||
government.setLevel(-1);
|
||||
government.setName("台账树");
|
||||
government.setPid("0");
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(engineeringList);
|
||||
return government;
|
||||
Map<String, List<CsLedgerVO>> projectByPidMap = projectList.stream()
|
||||
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||
engineeringList.forEach(eng -> eng.setChildren(projectByPidMap.getOrDefault(eng.getId(), new ArrayList<>())));
|
||||
return buildTreeRootNode(engineeringList);
|
||||
}
|
||||
|
||||
// 批量查询设备交付信息
|
||||
List<String> devIds = deviceList.stream().map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryPO> devs = csEquipmentDeliveryMapper.selectBatchIds(devIds);
|
||||
Map<String, CsEquipmentDeliveryPO> devsMap = devs.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity()));
|
||||
Map<String, String> lineDevMap = lineList.stream().collect(Collectors.toMap(CsLedgerVO::getId, CsLedgerVO::getPid));
|
||||
|
||||
Set<String> cldDevIds = devs.stream()
|
||||
.map(CsEquipmentDeliveryPO::getId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Map<String, List<CsLedgerVO>> projectToDeviceMap = deviceList.stream()
|
||||
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||
|
||||
Map<String, List<CsLedgerVO>> deviceToLineMap = lineList.stream()
|
||||
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||
Map<String, CsEquipmentDeliveryPO> devsMap = devs.stream()
|
||||
.collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity()));
|
||||
Set<String> cldDevIds = devs.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toSet());
|
||||
|
||||
// 填充设备状态信息
|
||||
deviceList.forEach(device -> {
|
||||
CsEquipmentDeliveryPO dev = devsMap.get(device.getId());
|
||||
if (dev != null) {
|
||||
@@ -1233,6 +1277,9 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
}
|
||||
});
|
||||
|
||||
// 填充监测点状态信息
|
||||
Map<String, String> lineDevMap = lineList.stream()
|
||||
.collect(Collectors.toMap(CsLedgerVO::getId, CsLedgerVO::getPid));
|
||||
lineList.forEach(line -> {
|
||||
String devId = lineDevMap.get(line.getId());
|
||||
if (devId != null) {
|
||||
@@ -1243,39 +1290,48 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
}
|
||||
});
|
||||
|
||||
engineeringList.forEach(engineering -> {
|
||||
List<CsLedgerVO> sortedProjects = projectList.stream()
|
||||
.filter(project -> project.getPid().equals(engineering.getId()))
|
||||
.peek(project -> {
|
||||
List<CsLedgerVO> projectDevices = projectToDeviceMap.getOrDefault(project.getId(), new ArrayList<>());
|
||||
if (CollectionUtil.isNotEmpty(projectDevices)) {
|
||||
List<CsLedgerVO> sortedDevices = projectDevices.stream()
|
||||
.filter(device -> cldDevIds.contains(device.getId()))
|
||||
.peek(device -> {
|
||||
List<CsLedgerVO> sortedLines = deviceToLineMap.getOrDefault(device.getId(), new ArrayList<>())
|
||||
.stream()
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
device.setChildren(sortedLines);
|
||||
})
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
project.setChildren(sortedDevices);
|
||||
}
|
||||
})
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
engineering.setChildren(sortedProjects);
|
||||
// 预构建pid映射
|
||||
Map<String, List<CsLedgerVO>> projectByEngineeringMap = projectList.stream()
|
||||
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||
Map<String, List<CsLedgerVO>> deviceByProjectMap = deviceList.stream()
|
||||
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||
Map<String, List<CsLedgerVO>> lineByDeviceMap = lineList.stream()
|
||||
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||
|
||||
// 逐层构建树:设备 -> 监测点
|
||||
deviceList.forEach(device -> {
|
||||
if (cldDevIds.contains(device.getId())) {
|
||||
device.setChildren(lineByDeviceMap.getOrDefault(device.getId(), new ArrayList<>()));
|
||||
}
|
||||
});
|
||||
|
||||
CsLedgerVO government = new CsLedgerVO();
|
||||
government.setLevel(-1);
|
||||
government.setName("台账树");
|
||||
government.setPid("0");
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(engineeringList);
|
||||
// 项目 -> 设备(仅包含有交付记录的设备)
|
||||
projectList.forEach(project -> {
|
||||
List<CsLedgerVO> projectDevices = deviceByProjectMap.getOrDefault(project.getId(), new ArrayList<>());
|
||||
if (CollectionUtil.isNotEmpty(projectDevices)) {
|
||||
List<CsLedgerVO> validDevices = projectDevices.stream()
|
||||
.filter(device -> cldDevIds.contains(device.getId()))
|
||||
.collect(Collectors.toList());
|
||||
project.setChildren(validDevices);
|
||||
}
|
||||
});
|
||||
|
||||
return government;
|
||||
// 工程 -> 项目
|
||||
engineeringList.forEach(eng ->
|
||||
eng.setChildren(projectByEngineeringMap.getOrDefault(eng.getId(), new ArrayList<>()))
|
||||
);
|
||||
|
||||
return buildTreeRootNode(engineeringList);
|
||||
}
|
||||
|
||||
private CsLedgerVO buildTreeRootNode(List<CsLedgerVO> children) {
|
||||
CsLedgerVO root = new CsLedgerVO();
|
||||
root.setLevel(-1);
|
||||
root.setName("台账树");
|
||||
root.setPid("0");
|
||||
root.setId(IdUtil.simpleUUID());
|
||||
root.setChildren(children);
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1425,6 +1481,13 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLedger> queryByPid(String pid) {
|
||||
return this.list(new LambdaQueryWrapper<CsLedger>()
|
||||
.eq(CsLedger::getPid, pid)
|
||||
.eq(CsLedger::getState, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子节点
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.csdevice.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -10,12 +11,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.access.api.CsLineLatestDataFeignClient;
|
||||
import com.njcn.access.pojo.po.CsLineLatestData;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
@@ -23,11 +28,14 @@ import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||
import com.njcn.csdevice.service.CsDevModelService;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.csdevice.service.ICsDataSetService;
|
||||
import com.njcn.csdevice.service.ICsDeviceRegistryService;
|
||||
import com.njcn.csharmonic.api.CsHarmonicPlanFeignClient;
|
||||
import com.njcn.csharmonic.api.CsHarmonicPlanLineFeignClient;
|
||||
import com.njcn.csharmonic.api.PqGovernPlanFeignClient;
|
||||
import com.njcn.csharmonic.api.PqSensitiveUserFeignClient;
|
||||
import com.njcn.csharmonic.param.CsHarmonicPlanLineParam;
|
||||
import com.njcn.csharmonic.pojo.po.CsHarmonicPlan;
|
||||
import com.njcn.csharmonic.pojo.po.PqGovernPlan;
|
||||
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
@@ -47,6 +55,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -68,7 +77,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final CsTerminalLogsMapper csTerminalLogsMapper;
|
||||
private final PqSensitiveUserFeignClient pqSensitiveUserFeignClient;
|
||||
|
||||
private final PqGovernPlanFeignClient pqGovernPlanFeignClient;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||
@@ -76,7 +85,9 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final CsHarmonicPlanFeignClient csHarmonicPlanFeignClient;
|
||||
private final CsHarmonicPlanLineFeignClient csHarmonicPlanLineFeignClient;
|
||||
|
||||
private final CsLineLatestDataFeignClient csLineLatestDataFeignClient;
|
||||
private final CsCommTerminalFeignClient csCommTerminal;
|
||||
private final ICsDeviceRegistryService csDeviceRegistryService;
|
||||
|
||||
@Override
|
||||
public List<CsLinePO> getLineByDev(List<String> list) {
|
||||
@@ -142,13 +153,24 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CsLinePO addCldLine(CsLineParam param) {
|
||||
String lineId = param.getDevMac().replace(":","") + param.getLineNo();
|
||||
String lineId = IdUtil.fastSimpleUUID();
|
||||
String nDid = param.getDevMac().replace(":", "");
|
||||
List<CsDeviceRegistry> data = csDeviceRegistryService.queryByCurrentNdid(nDid);
|
||||
Map<Integer, String> clDidToIdMap;
|
||||
if (CollUtil.isNotEmpty(data)) {
|
||||
clDidToIdMap = data.stream().collect(Collectors.toMap(CsDeviceRegistry::getClDid, CsDeviceRegistry::getId, (a, b) -> a));
|
||||
} else {
|
||||
clDidToIdMap = new HashMap<>();
|
||||
}
|
||||
if (!Objects.isNull(clDidToIdMap.get(param.getLineNo()))) {
|
||||
lineId = clDidToIdMap.get(param.getLineNo());
|
||||
}
|
||||
CsLinePO po = new CsLinePO();
|
||||
//1.新增监测点信息
|
||||
BeanUtils.copyProperties(param,po);
|
||||
po.setStatus(1);
|
||||
po.setRunStatus(param.getRunStatus());
|
||||
po.setLineId(param.getDevMac().replace(":","") + param.getLineNo());
|
||||
po.setLineId(lineId);
|
||||
//模板id
|
||||
CsDevModelPO po1 = csDevModelService.getCldModel();
|
||||
po.setDataModelId(po1.getId());
|
||||
@@ -161,10 +183,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
}
|
||||
po.setClDid(param.getLineNo());
|
||||
//监测位置
|
||||
//DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.GRID_SIDE.getCode()).getData();
|
||||
po.setPosition(param.getPosition().isEmpty()?null:param.getPosition());
|
||||
this.save(po);
|
||||
|
||||
//2.新增台账树信息
|
||||
CsLedger csLedger = new CsLedger();
|
||||
csLedger.setId(lineId);
|
||||
@@ -175,7 +195,6 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
csLedger.setState(1);
|
||||
csLedger.setSort(0);
|
||||
csLedgerMapper.insert(csLedger);
|
||||
|
||||
//3.新增稳态事件指标配置
|
||||
csHarmonicPlanLineFeignClient.deleteByLineIds(Collections.singletonList(lineId));
|
||||
List<CsHarmonicPlan> planList = csHarmonicPlanFeignClient.getByName("通用方案").getData();
|
||||
@@ -186,6 +205,16 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
param1.setLineIds(Collections.singletonList(lineId));
|
||||
csHarmonicPlanLineFeignClient.savePlanLines(param1);
|
||||
}
|
||||
//4.新增装置注册表数据
|
||||
if (Objects.isNull(clDidToIdMap.get(param.getLineNo()))) {
|
||||
CsDeviceRegistry registry = new CsDeviceRegistry();
|
||||
registry.setId(lineId);
|
||||
registry.setCurrentNdid(nDid);
|
||||
registry.setOldNdid(nDid);
|
||||
registry.setClDid(param.getLineNo());
|
||||
registry.setFirstSeenTime(LocalDateTime.now());
|
||||
csDeviceRegistryService.add(Collections.singletonList(registry));
|
||||
}
|
||||
return po;
|
||||
}
|
||||
|
||||
@@ -220,9 +249,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
.set(CsLinePO::getShortCircuitCapacity,param.getShortCircuitCapacity())
|
||||
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
||||
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
||||
.set(CsLinePO::getGovern,param.getGovern())
|
||||
.set(CsLinePO::getPosition,param.getPosition())
|
||||
.set(CsLinePO::getMonitorUser,param.getMonitorUser())
|
||||
.set(CsLinePO::getLineLogLevel,param.getLineLogLevel())
|
||||
.set(CsLinePO::getIsImportant,param.getIsImportant());
|
||||
this.update(lambdaUpdateWrapper);
|
||||
@@ -234,30 +261,38 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
csLedger.setName(param.getName());
|
||||
csLedgerMapper.updateById(csLedger);
|
||||
|
||||
//新增台账日志
|
||||
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||
csTerminalLogs.setDeviceId(param.getDevId());
|
||||
csTerminalLogs.setOperateType(1);
|
||||
csTerminalLogs.setIsPush(0);
|
||||
csTerminalLogsMapper.insert(csTerminalLogs);
|
||||
//新增台账日志 1056协议记录,其他协议不记录
|
||||
String devId = param.getDevId();
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(devId);
|
||||
if (Objects.equals(po.getDevAccessMethod(), "CLD")) {
|
||||
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||
csTerminalLogs.setDeviceId(devId);
|
||||
csTerminalLogs.setOperateType(1);
|
||||
csTerminalLogs.setIsPush(0);
|
||||
csTerminalLogsMapper.insert(csTerminalLogs);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteCldLine(String id) {
|
||||
CsLinePO po = this.getById(id);
|
||||
|
||||
this.removeById(id);
|
||||
csLedgerMapper.deleteById(id);
|
||||
//删除稳态事件指标配置
|
||||
csHarmonicPlanLineFeignClient.deleteByLineIds(Collections.singletonList(id));
|
||||
|
||||
//新增台账日志
|
||||
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||
csTerminalLogs.setDeviceId(po.getDeviceId());
|
||||
csTerminalLogs.setOperateType(1);
|
||||
csTerminalLogs.setIsPush(0);
|
||||
csTerminalLogsMapper.insert(csTerminalLogs);
|
||||
//删除装置注册表数据
|
||||
csDeviceRegistryService.delete(id);
|
||||
//新增台账日志 1056协议记录,其他协议不记录
|
||||
String devId = po.getDeviceId();
|
||||
CsEquipmentDeliveryPO devPo = csEquipmentDeliveryMapper.selectById(devId);
|
||||
if (Objects.equals(devPo.getDevAccessMethod(), "CLD")) {
|
||||
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||
csTerminalLogs.setDeviceId(devId);
|
||||
csTerminalLogs.setOperateType(1);
|
||||
csTerminalLogs.setIsPush(0);
|
||||
csTerminalLogsMapper.insert(csTerminalLogs);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -322,11 +357,12 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLinePO> getLineBySensitiveUser(List<String> list) {
|
||||
return this.lambdaQuery()
|
||||
.in(CsLinePO::getMonitorUser,list)
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
.list();
|
||||
public List<CsEquipmentDeliveryPO> getDevBySensitiveUser(List<String> list) {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper
|
||||
// .in(CsEquipmentDeliveryPO::getMonitorUser,list)
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus, DataStateEnum.DELETED.getCode());
|
||||
return csEquipmentDeliveryMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -339,10 +375,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
List<CsLinePO> poList = getSimpleLine();
|
||||
// 构建基础查询条件
|
||||
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<CsLinePO>()
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
// 关联敏感用户
|
||||
//.isNotNull(CsLinePO::getMonitorUser)
|
||||
.orderByAsc(CsLinePO::getMonitorUser);
|
||||
.eq(CsLinePO::getStatus, 1);
|
||||
// 只有当lineList不为空时才添加in条件
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
List<String> lineList = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
@@ -357,32 +390,54 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
if (CollUtil.isEmpty(records)) {
|
||||
return result;
|
||||
}
|
||||
//获取用户id
|
||||
List<String> ids = records.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
List<PqGovernPlan> governPlans = pqGovernPlanFeignClient.getListByMonitorPoint(ids).getData();
|
||||
if (CollUtil.isEmpty(governPlans)) {
|
||||
return result;
|
||||
}
|
||||
Map<String, PqGovernPlan> lineMap1 = governPlans.stream().collect(Collectors.toMap(PqGovernPlan::getGovernBefore, item -> item));
|
||||
Map<String, PqGovernPlan> lineMap2 = governPlans.stream().collect(Collectors.toMap(PqGovernPlan::getGovernAfter, item -> item));
|
||||
|
||||
List<PqSensitiveUserLineVO> list = new ArrayList<>();
|
||||
List<String> sensitiveUserIds = list.stream().map(PqSensitiveUserLineVO::getSensitiveUser).distinct().collect(Collectors.toList());
|
||||
|
||||
List<String> sensitiveUserIds = governPlans.stream().map(PqGovernPlan::getPid).distinct().collect(Collectors.toList());
|
||||
Map<String, String> sensitiveUserNameMap = new HashMap<>();
|
||||
List<PqSensitiveUser> pqSensitiveUserList = pqSensitiveUserFeignClient.getListByIds(sensitiveUserIds).getData();
|
||||
if (CollUtil.isNotEmpty(pqSensitiveUserList)) {
|
||||
sensitiveUserNameMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
||||
}
|
||||
// 最新数据时间
|
||||
List<CsLineLatestData> lineLatestDataList = csLineLatestDataFeignClient.listData().getData();
|
||||
Map<String,CsLineLatestData> lineLatestDataMap = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(lineLatestDataList)) {
|
||||
lineLatestDataMap = lineLatestDataList.stream().collect(Collectors.toMap(CsLineLatestData::getLineId, item -> item));
|
||||
}
|
||||
|
||||
PqSensitiveUserLineVO sensitiveUserLineVO;
|
||||
|
||||
List<String> lineIds = records.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
List<DevDetailDTO> devDetailDTOList = csCommTerminal.getLedgerByLineId(lineIds).getData();
|
||||
Map<String, DevDetailDTO> devDetailDTOMap = devDetailDTOList.stream().collect(Collectors.toMap(DevDetailDTO::getLineId, item -> item));
|
||||
|
||||
List<PqSensitiveUserLineVO> list = new ArrayList<>();
|
||||
for (CsLinePO record : records) {
|
||||
sensitiveUserLineVO = new PqSensitiveUserLineVO();
|
||||
// 治理对象
|
||||
sensitiveUserLineVO.setSensitiveUser(sensitiveUserNameMap.getOrDefault(record.getMonitorUser(), null));
|
||||
sensitiveUserLineVO.setEngineeringName(devDetailDTOMap.get(record.getLineId()).getEngineeringName());
|
||||
sensitiveUserLineVO.setProjectName(devDetailDTOMap.get(record.getLineId()).getProjectName());
|
||||
sensitiveUserLineVO.setDevName(devDetailDTOMap.get(record.getLineId()).getEquipmentName());
|
||||
// 治理对象 && 是否治理
|
||||
PqGovernPlan plan1 = lineMap1.get(record.getLineId());
|
||||
if (!Objects.isNull(plan1)) {
|
||||
sensitiveUserLineVO.setSensitiveUser(sensitiveUserNameMap.getOrDefault(plan1.getPid(), null));
|
||||
sensitiveUserLineVO.setGovern(Objects.isNull(plan1.getGovernMethod()) ? "未治理" : plan1.getGovernMethod());
|
||||
}
|
||||
PqGovernPlan plan2 = lineMap2.get(record.getLineId());
|
||||
if (!Objects.isNull(plan2)) {
|
||||
sensitiveUserLineVO.setSensitiveUser(sensitiveUserNameMap.getOrDefault(plan2.getPid(), null));
|
||||
sensitiveUserLineVO.setGovern(Objects.isNull(plan2.getGovernMethod()) ? "未治理" : plan2.getGovernMethod());
|
||||
}
|
||||
// 测点名称
|
||||
sensitiveUserLineVO.setLineId(record.getLineId());
|
||||
sensitiveUserLineVO.setLineName(record.getName());
|
||||
// 是否治理
|
||||
if (ObjectUtil.isNotEmpty(record.getGovern())) {
|
||||
if (record.getGovern().equals(0)) {
|
||||
sensitiveUserLineVO.setGovern("未治理");
|
||||
}
|
||||
if (record.getGovern().equals(1)) {
|
||||
sensitiveUserLineVO.setGovern("已治理");
|
||||
}
|
||||
}
|
||||
// 监测类型
|
||||
if (ObjectUtil.isNotNull(record.getPosition())) {
|
||||
sensitiveUserLineVO.setPosition(record.getPosition());
|
||||
@@ -395,23 +450,12 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
if (ObjectUtil.isNotNull(record.getVolGrade())) {
|
||||
sensitiveUserLineVO.setVolGrade(record.getVolGrade());
|
||||
}
|
||||
// 运行状态
|
||||
if (ObjectUtil.isNotNull(record.getRunStatus())) {
|
||||
//获取设备状态
|
||||
int devRunStatus = csEquipmentDeliveryMapper.selectById(record.getDeviceId()).getRunStatus();
|
||||
sensitiveUserLineVO.setRunStatus(getRunStatusDescription(devRunStatus));
|
||||
}
|
||||
// 通讯状态
|
||||
sensitiveUserLineVO.setRunStatus(String.valueOf(devDetailDTOMap.get(record.getLineId()).getRunStatus()));
|
||||
// 报告文件
|
||||
sensitiveUserLineVO.setReportFilePath(record.getReportFilePath());
|
||||
// 最新数据时间
|
||||
// List<CsLineLatestData> lineLatestDataList = csLineLatestDataFeignClient.listData().getData();
|
||||
// if (CollUtil.isNotEmpty(lineLatestDataList)) {
|
||||
// sensitiveUserLineVO.setLatestTime(lineLatestDataList.stream()
|
||||
// .filter(item -> item.getLineId().equals(record.getLineId()))
|
||||
// .map(CsLineLatestData::getTimeId)
|
||||
// .max(LocalDateTime::compareTo)
|
||||
// .orElse(null));
|
||||
// }
|
||||
//最新数据时间
|
||||
sensitiveUserLineVO.setLatestTime(Objects.isNull(lineLatestDataMap.get(record.getLineId()))? null : lineLatestDataMap.get(record.getLineId()).getTimeId());
|
||||
list.add(sensitiveUserLineVO);
|
||||
}
|
||||
result.setRecords(list);
|
||||
@@ -459,15 +503,6 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
lineDetailDataVO.setBdName(csLedgerMapper.selectById(csLedger.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).getName());
|
||||
}
|
||||
lineDetailDataVO.setLineName(csLinePO.getName());
|
||||
//Device device = deviceMapper.selectById(devId);
|
||||
//lineDetailDataVO.setComFlag(PubUtils.comFlag(device.getComFlag()));
|
||||
//lineDetailDataVO.setRunFlag(PubUtils.lineRunFlag(lineDetail.getRunFlag()));
|
||||
//lineDetailDataVO.setIp(device.getIp());
|
||||
//lineDetailDataVO.setLoginTime(device.getLoginTime());
|
||||
//lineDetailDataVO.setDevId(device.getId());
|
||||
//lineDetailDataVO.setBusinessType(dicDataFeignClient.getDicDataById(lineDetail.getBusinessType()).getData().getName());
|
||||
//lineDetailDataVO.setLoadType(dicDataFeignClient.getDicDataById(lineDetail.getLoadType()).getData().getName());
|
||||
lineDetailDataVO.setObjName(csLinePO.getMonitorUser());
|
||||
lineDetailDataVO.setLineId(csLinePO.getLineId());
|
||||
lineDetailDataVO.setPtType(PubUtils.ptType(csLinePO.getConType()));
|
||||
lineDetailDataVO.setPt(csLinePO.getPtRatio() + "/" + (Objects.isNull(csLinePO.getPt2Ratio())?1.0:csLinePO.getPt2Ratio()));
|
||||
|
||||
@@ -184,7 +184,12 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
||||
, DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())));
|
||||
//排序
|
||||
queryWrapper.orderBy(true, false, "cs_terminal_reply.create_time");
|
||||
queryWrapper.in("cs_terminal_reply.code", Arrays.asList("allFile", "allEvent", "oneFile","harmonic"));
|
||||
//这边不想新建字段了,用SortBy代替补召类型
|
||||
if (Objects.equals(param.getSortBy(), "harmonic")) {
|
||||
queryWrapper.in("cs_terminal_reply.code", Collections.singletonList("harmonic"));
|
||||
} else {
|
||||
queryWrapper.in("cs_terminal_reply.code", Arrays.asList("allFile", "allEvent", "oneFile"));
|
||||
}
|
||||
Page<CsTerminalReply> csTerminalReplyPage = this.baseMapper.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), queryWrapper);
|
||||
|
||||
List<CsTerminalReply> records = csTerminalReplyPage.getRecords();
|
||||
@@ -202,19 +207,6 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
||||
cldLogsVo.setEngineeringName(ledgerMap.get(split[1]).getName());
|
||||
cldLogsVo.setProjectName(ledgerMap.get(split[2]).getName());
|
||||
cldLogsVo.setDeviceName(ledgerMap.get(item.getDeviceId()).getName());
|
||||
// String lineId = item.getLineId();
|
||||
// String[] lineSplit = lineId.split(",");
|
||||
// String result;
|
||||
// if (lineSplit.length == 1) {
|
||||
// result = ledgerMap.get(lineSplit[0]).getName();
|
||||
// } else {
|
||||
// result = Arrays.stream(lineSplit)
|
||||
// .map(ledgerMap::get)
|
||||
// .filter(Objects::nonNull)
|
||||
// .map(CsLedgerVO::getName)
|
||||
// .collect(Collectors.joining(","));
|
||||
// }
|
||||
// cldLogsVo.setLineName(result);
|
||||
cldLogsVo.setLineName(ledgerMap.get(param.getSearchValue()).getName());
|
||||
cldLogsVo.setLog(getLogDescription(item.getCode()));
|
||||
cldLogsVo.setLogTime(item.getCreateTime());
|
||||
|
||||
@@ -37,7 +37,6 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
private final AskDeviceDataFeignClient askDeviceDataFeignClient;
|
||||
private final RedisUtil redisUtil;
|
||||
private final ChannelObjectUtil channelObjectUtil;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final MqttUtil mqttUtil;
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@@ -51,11 +50,14 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
}
|
||||
redisUtil.delete(AppRedisKey.DEVICE_ROOT_PATH + nDid);
|
||||
askDeviceDataFeignClient.askDeviceRootPath(nDid);
|
||||
Thread.sleep(3000);
|
||||
Object object = redisUtil.getObjectByKey(AppRedisKey.DEVICE_ROOT_PATH + nDid);
|
||||
if (Objects.nonNull(object)) {
|
||||
makeUpVo.setPrjDataPath(object.toString());
|
||||
makeUpVo.setType("dir");
|
||||
for (int i = 0; i <= 3; i++) {
|
||||
Thread.sleep(1000);
|
||||
Object object = redisUtil.getObjectByKey(AppRedisKey.DEVICE_ROOT_PATH + nDid);
|
||||
if (Objects.nonNull(object)) {
|
||||
makeUpVo.setPrjDataPath(object.toString());
|
||||
makeUpVo.setType("dir");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
@@ -75,12 +77,15 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
redisUtil.delete(AppRedisKey.PROJECT_INFO + nDid);
|
||||
// 请求设备文件或目录信息
|
||||
askDeviceDataFeignClient.askDeviceFileOrDir(nDid, name);
|
||||
Thread.sleep(10000);
|
||||
// 从 Redis 获取对象
|
||||
Object object = redisUtil.getObjectByKey(AppRedisKey.PROJECT_INFO + nDid);
|
||||
if (object != null) {
|
||||
// 根据类型处理不同的数据
|
||||
processObject(result, object, type);
|
||||
for (int i = 0; i <= 10; i++) {
|
||||
Thread.sleep(1000);
|
||||
// 从 Redis 获取对象
|
||||
Object object = redisUtil.getObjectByKey(AppRedisKey.PROJECT_INFO + nDid);
|
||||
if (object != null) {
|
||||
// 根据类型处理不同的数据
|
||||
processObject(result, object, type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 捕获特定异常并抛出运行时异常
|
||||
|
||||
@@ -164,9 +164,8 @@ class IcdServiceImpl implements IcdService {
|
||||
}
|
||||
Integer level = csLedger.getLevel();
|
||||
String[] pids = csLedger.getPids().split(StrUtil.COMMA);
|
||||
Integer sort = csLedger.getSort();
|
||||
// 设置工程信息(所有级别都需要)
|
||||
setEngineeringInfo(vo, level, pids, id, sort);
|
||||
setEngineeringInfo(vo, level, pids, id);
|
||||
// 根据级别设置不同的业务数据
|
||||
switch (level) {
|
||||
case 0:
|
||||
@@ -328,7 +327,7 @@ class IcdServiceImpl implements IcdService {
|
||||
.collect(Collectors.toList());
|
||||
|
||||
event.setMonitorIdList(monitorIds);
|
||||
if (bzType == 0) {
|
||||
if (!Objects.isNull(bzType) && bzType == 0) {
|
||||
event.setDataType(0);
|
||||
} else {
|
||||
event.setDataType(1);
|
||||
@@ -371,7 +370,7 @@ class IcdServiceImpl implements IcdService {
|
||||
reply.setDeviceId(device.getId());
|
||||
reply.setLineId(lineId);
|
||||
reply.setIsReceived(0);
|
||||
if (bzType == 0) {
|
||||
if (!Objects.isNull(bzType) && bzType == 0) {
|
||||
reply.setCode("harmonic");
|
||||
} else {
|
||||
reply.setCode("allEvent");
|
||||
@@ -494,7 +493,7 @@ class IcdServiceImpl implements IcdService {
|
||||
/**
|
||||
* 设置工程信息
|
||||
*/
|
||||
private void setEngineeringInfo(CldLedgerVo vo, Integer level, String[] pids, String id, Integer sort) {
|
||||
private void setEngineeringInfo(CldLedgerVo vo, Integer level, String[] pids, String id) {
|
||||
String engineeringId;
|
||||
|
||||
if (level == 0) {
|
||||
@@ -513,7 +512,7 @@ class IcdServiceImpl implements IcdService {
|
||||
vo.setProvince(po.getProvince());
|
||||
vo.setCity(po.getCity());
|
||||
vo.setEngineeringDescription(po.getDescription());
|
||||
vo.setSort(sort);
|
||||
vo.setSort(po.getSort());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -535,6 +534,7 @@ class IcdServiceImpl implements IcdService {
|
||||
vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId());
|
||||
result.add(vo1);
|
||||
});
|
||||
result.sort(Comparator.comparingInt(ProjectVO::getSort));
|
||||
}
|
||||
vo.setProjectInfoList(result);
|
||||
}
|
||||
@@ -558,20 +558,13 @@ class IcdServiceImpl implements IcdService {
|
||||
vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId());
|
||||
result.add(vo1);
|
||||
});
|
||||
result.sort(Comparator.comparingInt(ProjectVO::getSort));
|
||||
}
|
||||
vo.setProjectInfoList(result);
|
||||
// 设置设备信息
|
||||
List<CsEquipmentDeliveryPO> devList = csEquipmentDeliveryService.getDevListByProjectId(id);
|
||||
devList.sort(Comparator.comparingInt(CsEquipmentDeliveryPO::getSort));
|
||||
vo.setDeviceInfoList(devList);
|
||||
// if (CollectionUtil.isNotEmpty(devList)) {
|
||||
// //如果不是监测设备,则不展示
|
||||
// DictTreeVO cldDict = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData();
|
||||
// String cldDevTypeId = cldDict.getId();
|
||||
// List<CsEquipmentDeliveryPO> cldDevIds = devList.stream()
|
||||
// .filter(item -> item.getDevType().equals(cldDevTypeId))
|
||||
// .collect(Collectors.toList());
|
||||
// vo.setDeviceInfoList(cldDevIds);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -595,11 +588,13 @@ class IcdServiceImpl implements IcdService {
|
||||
vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId());
|
||||
result.add(vo1);
|
||||
});
|
||||
result.sort(Comparator.comparingInt(ProjectVO::getSort));
|
||||
}
|
||||
vo.setProjectInfoList(result);
|
||||
}
|
||||
// 设置设备信息
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(Collections.singletonList(id));
|
||||
csEquipmentDeliveryPOS.sort(Comparator.comparingInt(CsEquipmentDeliveryPO::getSort));
|
||||
vo.setDeviceInfoList(csEquipmentDeliveryPOS);
|
||||
// 设置线路信息
|
||||
List<CsLinePO> list = csLinePOService.queryByDevId(id);
|
||||
@@ -612,13 +607,15 @@ class IcdServiceImpl implements IcdService {
|
||||
item.setCt2Ratio(1.0);
|
||||
}
|
||||
if (Objects.isNull(item.getLineNo())) {
|
||||
item.setLineNo(item.getClDid() == 0 ? null:item.getClDid());
|
||||
item.setLineNo(item.getClDid() == 0 ? 0:item.getClDid());
|
||||
}
|
||||
if (Objects.isNull(item.getRunStatus())) {
|
||||
item.setRunStatus(csEquipmentDeliveryPOS.get(0).getRunStatus());
|
||||
}
|
||||
});
|
||||
}
|
||||
list.sort(Comparator.comparingInt((CsLinePO cs) -> cs.getClDid() == null ? Integer.MAX_VALUE : cs.getClDid())
|
||||
.thenComparingInt(cs -> cs.getLineNo() == null ? Integer.MAX_VALUE : cs.getLineNo()));
|
||||
vo.setLineInfoList(list);
|
||||
}
|
||||
|
||||
@@ -643,6 +640,7 @@ class IcdServiceImpl implements IcdService {
|
||||
vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId());
|
||||
result.add(vo1);
|
||||
});
|
||||
result.sort(Comparator.comparingInt(ProjectVO::getSort));
|
||||
}
|
||||
vo.setProjectInfoList(result);
|
||||
}
|
||||
@@ -651,6 +649,7 @@ class IcdServiceImpl implements IcdService {
|
||||
if (pids.length > 3) {
|
||||
String deviceId = pids[3];
|
||||
csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(Collections.singletonList(deviceId));
|
||||
csEquipmentDeliveryPOS.sort(Comparator.comparingInt(CsEquipmentDeliveryPO::getSort));
|
||||
vo.setDeviceInfoList(csEquipmentDeliveryPOS);
|
||||
} else {
|
||||
csEquipmentDeliveryPOS = new ArrayList<>();
|
||||
@@ -658,17 +657,17 @@ class IcdServiceImpl implements IcdService {
|
||||
// 设置线路信息
|
||||
List<CsLinePO> line = csLinePOService.listByIds(Collections.singletonList(id));
|
||||
if (CollectionUtil.isNotEmpty(line)) {
|
||||
line.forEach(item->{
|
||||
if (Objects.isNull(item.getPt2Ratio())) {
|
||||
for (CsLinePO item : line) {
|
||||
if (item.getPt2Ratio() == null) {
|
||||
item.setPt2Ratio(1.0);
|
||||
}
|
||||
if (Objects.isNull(item.getCt2Ratio())) {
|
||||
if (item.getCt2Ratio() == null) {
|
||||
item.setCt2Ratio(1.0);
|
||||
}
|
||||
if (Objects.isNull(item.getLineNo())) {
|
||||
item.setLineNo(item.getClDid() == 0 ? null:item.getClDid());
|
||||
}
|
||||
});
|
||||
item.setLineNo(item.getClDid());
|
||||
}
|
||||
line.sort(Comparator.comparingInt((CsLinePO cs) -> cs.getClDid() == null ? Integer.MAX_VALUE : cs.getClDid())
|
||||
.thenComparingInt(cs -> cs.getLineNo() == null ? Integer.MAX_VALUE : cs.getLineNo()));
|
||||
}
|
||||
vo.setLineInfoList(line);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -321,6 +322,52 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertionList(List<PqsCommunicateDto> list) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
Map<String, List<PqsCommunicateDto>> groupByDevId = list.stream().collect(Collectors.groupingBy(PqsCommunicateDto::getDevId));
|
||||
List<String> lineProtocols = new ArrayList<>();
|
||||
groupByDevId.forEach((ndid, dtoList) -> {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid, ndid).ne(CsEquipmentDeliveryPO::getRunStatus, 0);
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectOne(lambdaQueryWrapper);
|
||||
if (po == null) {
|
||||
log.warn("未找到ndid={}对应的装置信息,跳过", ndid);
|
||||
return;
|
||||
}
|
||||
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
||||
influxQueryWrapper.eq(PqsCommunicate::getDevId, po.getId()).timeDesc().limit(1);
|
||||
List<PqsCommunicate> pqsCommunicates = pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
|
||||
Integer lastType = CollectionUtils.isEmpty(pqsCommunicates) ? null : pqsCommunicates.get(0).getType();
|
||||
|
||||
for (PqsCommunicateDto dto : dtoList) {
|
||||
if (lastType != null && Objects.equals(lastType, dto.getType())) {
|
||||
continue;
|
||||
}
|
||||
Map<String, String> tags = new HashMap<>();
|
||||
tags.put("dev_id", po.getId());
|
||||
Map<String, Object> fields = new HashMap<>();
|
||||
fields.put("type", dto.getType());
|
||||
fields.put("description", dto.getDescription());
|
||||
long time = LocalDateTime.parse(dto.getTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN))
|
||||
.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||
Point point = influxDbUtils.pointBuilder("pqs_communicate", time, TimeUnit.MILLISECONDS, tags, fields);
|
||||
BatchPoints batchPoints = BatchPoints.database(influxDbUtils.getDbName()).retentionPolicy("")
|
||||
.consistency(InfluxDB.ConsistencyLevel.ALL).build();
|
||||
batchPoints.point(point);
|
||||
lineProtocols.add(batchPoints.lineProtocol());
|
||||
lastType = dto.getType();
|
||||
}
|
||||
});
|
||||
if (!lineProtocols.isEmpty()) {
|
||||
influxDbUtils.batchInsert(influxDbUtils.getDbName(), "", InfluxDB.ConsistencyLevel.ALL, TimeUnit.MILLISECONDS, lineProtocols);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<PqsCommunicate> getPqsCommunicateData(LineCountEvaluateParam lineParam) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.njcn.csharmonic.offline.mincfg.vo.CmnModeCfg;
|
||||
import com.njcn.csharmonic.offline.vo.Response;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.event.common.mapper.WlRmpEventDetailMapper;
|
||||
import com.njcn.event.common.service.EventAnalysisService;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.influx.imapper.*;
|
||||
import com.njcn.influx.pojo.po.*;
|
||||
@@ -115,6 +116,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
private final CsLinePOService csLinePOService;
|
||||
private final WlRmpEventDetailMapper wlRmpEventDetailMapper;
|
||||
private final EventCauseFeignClient eventCauseFeignClient;
|
||||
private final EventAnalysisService eventAnalysisService;
|
||||
|
||||
@Override
|
||||
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
|
||||
@@ -195,7 +197,8 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsLinePO::getLineId,lineId).eq(CsLinePO::getStatus,1);
|
||||
CsLinePO po = csLinePOService.getOne(queryWrapper);
|
||||
String cdid = uploadDataParam.getLineId().substring(uploadDataParam.getLineId().length() - 1);
|
||||
//String cdid = uploadDataParam.getLineId().substring(uploadDataParam.getLineId().length() - 1);
|
||||
Integer cdid = po.getClDid();
|
||||
//第一步解析redcord.bin文件获取监测点序号做校验
|
||||
List<MultipartFile> record = uploadDataParam.getFiles().stream().filter(
|
||||
temp -> temp.getOriginalFilename().contains("record.bin"))
|
||||
@@ -213,7 +216,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
//监测点序号
|
||||
int lineIdx = cmnModeCfg.line_idx;
|
||||
|
||||
if(lineIdx!=Integer.valueOf(cdid)){
|
||||
if(lineIdx != cdid){
|
||||
throw new BusinessException(AlgorithmResponseEnum.LINE_NUM_MISMATCH);
|
||||
}
|
||||
|
||||
@@ -313,7 +316,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
|
||||
List<PqdData> pqdData = (List<PqdData>) response.getObj();
|
||||
pqdData.forEach(temp->{
|
||||
temp.setClDid(cdid);
|
||||
temp.setClDid(String.valueOf(cdid));
|
||||
temp.setIsAbnormal(0);
|
||||
temp.setProcess(data1.get(0).getProcess()+"");
|
||||
temp.setLineId(uploadDataParam.getLineId());
|
||||
@@ -464,24 +467,6 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
}
|
||||
}
|
||||
csEventPO.setWavePath(wavePath);
|
||||
if (Objects.equals(csEventPO.getTag(),DataParam.dipStrName)) {
|
||||
EventAnalysisDTO var1 = new EventAnalysisDTO();
|
||||
var1.setWlFilePath(wavePath);
|
||||
EventAnalysisDTO dto = eventCauseFeignClient.analysisCauseAndType(var1).getData();
|
||||
String id1 = list1.stream()
|
||||
.filter(item -> Objects.equals(item.getAlgoDescribe(), dto.getCause()))
|
||||
.map(DictData::getId)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
csEventPO.setAdvanceReason(id1);
|
||||
|
||||
String id2 = list2.stream()
|
||||
.filter(item -> Objects.equals(item.getAlgoDescribe(), dto.getType()))
|
||||
.map(DictData::getId)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
csEventPO.setAdvanceType(id2);
|
||||
}
|
||||
|
||||
//默认暂态事件
|
||||
csEventPO.setType(0);
|
||||
@@ -538,6 +523,35 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
csEventPO.setPhase(entData.getEvtParamPhase());
|
||||
csEventPO.setPersistTime(entData.getEvtParamTm());
|
||||
csEventPO.setAmplitude(entData.getEvtParamVVaDepth());
|
||||
|
||||
if (Objects.equals(csEventPO.getTag(),DataParam.dipStrName)) {
|
||||
//计算暂降原因和类型
|
||||
EventAnalysisDTO var1 = new EventAnalysisDTO();
|
||||
var1.setWlFilePath(wavePath);
|
||||
EventAnalysisDTO dto = eventCauseFeignClient.analysisCauseAndType(var1).getData();
|
||||
String id1 = list1.stream()
|
||||
.filter(item -> Objects.equals(item.getAlgoDescribe(), dto.getCause()))
|
||||
.map(DictData::getId)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
csEventPO.setAdvanceReason(id1);
|
||||
|
||||
String id2 = list2.stream()
|
||||
.filter(item -> Objects.equals(item.getAlgoDescribe(), dto.getType()))
|
||||
.map(DictData::getId)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
csEventPO.setAdvanceType(id2);
|
||||
if (!Objects.isNull(csEventPO.getAmplitude()) && !Objects.isNull(csEventPO.getPersistTime())) {
|
||||
//计算暂降严重度
|
||||
csEventPO.setSeverity(Double.valueOf(getYzd(csEventPO.getPersistTime()*1000,csEventPO.getAmplitude())));
|
||||
}
|
||||
}
|
||||
if (!Objects.isNull(csEventPO.getAmplitude()) && !Objects.isNull(csEventPO.getPersistTime())) {
|
||||
//计算落点
|
||||
String dropZone = eventAnalysisService.determineDropZone(String.valueOf(csEventPO.getAmplitude()),String.valueOf(csEventPO.getPersistTime()));
|
||||
csEventPO.setLandPoint(dropZone);
|
||||
}
|
||||
csEventPOS.add(csEventPO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -567,6 +581,30 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
portableOffMainLogService.save(portableOffMainLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取该事件的严重度
|
||||
*
|
||||
* @param persistTime 持续时间 ms单位
|
||||
* @param eventValue 暂降、暂升幅值
|
||||
*/
|
||||
public String getYzd(Double persistTime, Double eventValue) {
|
||||
Double yzd;
|
||||
// 格式化小数
|
||||
DecimalFormat df = new DecimalFormat("0.000");
|
||||
if (persistTime <= 20) {
|
||||
yzd = 1.0 - eventValue;
|
||||
} else if (persistTime > 20 && persistTime <= 200) {
|
||||
yzd = 2.0 * (1 - eventValue);
|
||||
} else if (persistTime > 200 && persistTime <= 500) {
|
||||
yzd = 3.3 * (1 - eventValue);
|
||||
} else if (persistTime > 500 && persistTime <= 10000) {
|
||||
yzd = 5.0 * (1 - eventValue);
|
||||
} else {
|
||||
yzd = 10.0 * (1 - eventValue);
|
||||
}
|
||||
return df.format(yzd);
|
||||
}
|
||||
|
||||
public void insertEvent(CsEventPO item) {
|
||||
RmpEventDetailPO rmpEventDetailPo = new RmpEventDetailPO();
|
||||
rmpEventDetailPo.setEventId(item.getId());
|
||||
@@ -576,11 +614,20 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
rmpEventDetailPo.setFeatureAmplitude(item.getAmplitude());
|
||||
rmpEventDetailPo.setDuration(item.getPersistTime());
|
||||
rmpEventDetailPo.setEventDescribe(getTag(item.getTag()));
|
||||
rmpEventDetailPo.setDealFlag(0);
|
||||
rmpEventDetailPo.setFileFlag(0);
|
||||
rmpEventDetailPo.setWavePath(item.getWavePath());
|
||||
if (!Objects.isNull(item.getWavePath())) {
|
||||
rmpEventDetailPo.setFileFlag(1);
|
||||
} else {
|
||||
rmpEventDetailPo.setFileFlag(0);
|
||||
}
|
||||
rmpEventDetailPo.setPhase(item.getPhase());
|
||||
rmpEventDetailPo.setAdvanceReason(item.getAdvanceReason());
|
||||
rmpEventDetailPo.setAdvanceType(item.getAdvanceType());
|
||||
if (!Objects.isNull(item.getAdvanceReason()) && !Objects.isNull(item.getAdvanceType())) {
|
||||
rmpEventDetailPo.setDealFlag(1);
|
||||
} else {
|
||||
rmpEventDetailPo.setDealFlag(0);
|
||||
}
|
||||
wlRmpEventDetailMapper.insert(rmpEventDetailPo);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ microservice:
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10220
|
||||
port: 20220
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
@@ -21,9 +21,13 @@ spring:
|
||||
discovery:
|
||||
ip: @service.server.url@
|
||||
server-addr: @nacos.url@
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
server-addr: @nacos.url@
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
namespace: @nacos.namespace@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
@@ -41,9 +45,10 @@ spring:
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&username=@nacos.username@&password=@nacos.password@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
# config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
root: warn
|
||||
|
||||
data:
|
||||
source:
|
||||
|
||||
@@ -3,12 +3,12 @@ package com.njcn;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import com.njcn.csdevice.CsDeviceBootApplication;
|
||||
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.influx.pojo.po.PqsCommunicate;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
import com.njcn.csdevice.service.DeviceFtpService;
|
||||
import com.njcn.csdevice.service.ICsCommunicateService;
|
||||
import com.njcn.csdevice.service.IRStatIntegrityDService;
|
||||
import com.njcn.csdevice.service.IRStatOnlineRateDService;
|
||||
import com.njcn.influx.utils.InfluxDbUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.influxdb.InfluxDB;
|
||||
@@ -20,12 +20,15 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@@ -37,7 +40,7 @@ import static org.junit.Assert.assertTrue;
|
||||
@WebAppConfiguration
|
||||
@SpringBootTest(classes = CsDeviceBootApplication.class)
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AppTest{
|
||||
|
||||
@Autowired
|
||||
@@ -46,9 +49,69 @@ public class AppTest{
|
||||
@Autowired
|
||||
private ICsCommunicateService csCommunicateService;
|
||||
|
||||
private final IRStatIntegrityDService statIntegrityDService;
|
||||
private final IRStatOnlineRateDService statOnlineRateDService;
|
||||
@Autowired
|
||||
private IRStatIntegrityDService statIntegrityDService;
|
||||
|
||||
@Autowired
|
||||
private IRStatOnlineRateDService statOnlineRateDService;
|
||||
|
||||
public static void main(String[] args) {
|
||||
String eventValue = "122.5493";
|
||||
String persistTime = "0.2410";
|
||||
String data = determineDropZone(eventValue, persistTime);
|
||||
System.out.println("data==:" + data);
|
||||
}
|
||||
|
||||
|
||||
public static String determineDropZone(String eventValue, String persistTime) {
|
||||
if (eventValue != null && !eventValue.trim().isEmpty() && persistTime != null && !persistTime.trim().isEmpty()) {
|
||||
BigDecimal vvm;
|
||||
BigDecimal vvtm;
|
||||
try {
|
||||
vvm = (new BigDecimal(eventValue.trim())).divide(new BigDecimal("100"), 6, RoundingMode.HALF_UP);
|
||||
vvtm = new BigDecimal(persistTime.trim());
|
||||
} catch (Exception var6) {
|
||||
Exception e = var6;
|
||||
log.error("判定压降落点区域入参解析失败,eventValue={}, persistTime={}", new Object[]{eventValue, persistTime, e});
|
||||
return null;
|
||||
}
|
||||
|
||||
if (vvtm.compareTo(new BigDecimal("0.001")) >= 0 && vvm.compareTo(BigDecimal.ZERO) != 0) {
|
||||
if (inRange(vvm, "0.9", "1") && inRange(vvtm, "0.001", "60")) {
|
||||
return "A区";
|
||||
} else if (inRange(vvm, "0", "0.9") && inRange(vvtm, "0.001", "0.05")) {
|
||||
return "A区";
|
||||
} else if (inRange(vvm, "0.5", "0.7") && inRange(vvtm, "0.05", "0.2")) {
|
||||
return "B区";
|
||||
} else if (inRange(vvm, "0.7", "0.8") && inRange(vvtm, "0.05", "0.5")) {
|
||||
return "B区";
|
||||
} else if (inRange(vvm, "0.8", "0.9") && inRange(vvtm, "0.05", "60")) {
|
||||
return "B区";
|
||||
} else if (inRange(vvm, "0", "0.5") && inRange(vvtm, "0.05", "1")) {
|
||||
return "C区";
|
||||
} else if (inRange(vvm, "0.5", "0.7") && inRange(vvtm, "0.2", "1")) {
|
||||
return "C区";
|
||||
} else if (inRange(vvm, "0.7", "0.8") && inRange(vvtm, "0.5", "1")) {
|
||||
return "C区";
|
||||
} else if (inRange(vvm, "0", "0.8") && inRange(vvtm, "1", "60")) {
|
||||
return "D区";
|
||||
} else {
|
||||
log.warn("压降落点区域未匹配任何规则,eventValue={}, persistTime={}", eventValue, persistTime);
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return "A区";
|
||||
}
|
||||
} else {
|
||||
log.warn("判定压降落点区域入参为空,eventValue={}, persistTime={}", eventValue, persistTime);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean inRange(BigDecimal value, String lowerInclusive, String upperExclusive) {
|
||||
return value.compareTo(new BigDecimal(lowerInclusive)) >= 0
|
||||
&& value.compareTo(new BigDecimal(upperExclusive)) < 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rigorous Test :-)
|
||||
@@ -59,7 +122,6 @@ public class AppTest{
|
||||
assertTrue( true );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试下载文件
|
||||
*/
|
||||
@@ -95,18 +157,76 @@ public class AppTest{
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
InfluxDbUtils influxDbUtils = new InfluxDbUtils("admin", "123456", "http://192.168.1.24:8086", "pqsbase_zl", "");
|
||||
|
||||
|
||||
public static void test2() {
|
||||
InfluxDbUtils influxDbUtils = new InfluxDbUtils("admin", "123456", "http://192.168.1.103:18086", "pqsbase", "");
|
||||
Map<String, String> tags = new HashMap<>();
|
||||
tags.put("dev_id","da7aa071bf89864bedea8833133676b7");
|
||||
tags.put("dev_id","0eb0262f706445ac9c69931a60357561");
|
||||
Map<String,Object> fields = new HashMap<>();
|
||||
fields.put("type",1);
|
||||
fields.put("description","通讯正常");
|
||||
long time = LocalDateTime.parse("2025-08-02 18:00:00", DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||
// fields.put("type",1);
|
||||
// fields.put("description","通讯正常");
|
||||
fields.put("type",0);
|
||||
fields.put("description","通讯中断");
|
||||
long time = LocalDateTime.parse("2024-01-06 06:00:00", DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||
Point point = influxDbUtils.pointBuilder("pqs_communicate", time, TimeUnit.MILLISECONDS, tags, fields);
|
||||
BatchPoints batchPoints = BatchPoints.database(influxDbUtils.getDbName()).retentionPolicy("").consistency(InfluxDB.ConsistencyLevel.ALL).build();
|
||||
batchPoints.point(point);
|
||||
influxDbUtils.batchInsert(influxDbUtils.getDbName(), "", InfluxDB.ConsistencyLevel.ALL, TimeUnit.MILLISECONDS, Collections.singletonList(batchPoints.lineProtocol()));
|
||||
|
||||
}
|
||||
|
||||
public static void test22() {
|
||||
InfluxDbUtils influxDbUtils = new InfluxDbUtils("admin", "123456", "http://192.168.1.103:18086", "pqsbase", "");
|
||||
Map<String, String> tags = new HashMap<>();
|
||||
tags.put("dev_id","0eb0262f706445ac9c69931a60357561");
|
||||
Map<String,Object> fields = new HashMap<>();
|
||||
fields.put("type",1);
|
||||
fields.put("description","通讯正常");
|
||||
// fields.put("type",0);
|
||||
// fields.put("description","通讯中断");
|
||||
long time = LocalDateTime.parse("2024-01-06 12:00:00", DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||
Point point = influxDbUtils.pointBuilder("pqs_communicate", time, TimeUnit.MILLISECONDS, tags, fields);
|
||||
BatchPoints batchPoints = BatchPoints.database(influxDbUtils.getDbName()).retentionPolicy("").consistency(InfluxDB.ConsistencyLevel.ALL).build();
|
||||
batchPoints.point(point);
|
||||
influxDbUtils.batchInsert(influxDbUtils.getDbName(), "", InfluxDB.ConsistencyLevel.ALL, TimeUnit.MILLISECONDS, Collections.singletonList(batchPoints.lineProtocol()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void test3() {
|
||||
InfluxDbUtils influxDbUtils = new InfluxDbUtils("admin", "123456", "http://192.168.1.103:18086", "pqsbase", "");
|
||||
Map<String, String> tags = new HashMap<>();
|
||||
tags.put("dev_id","0eb0262f706445ac9c69931a60357561");
|
||||
Map<String,Object> fields = new HashMap<>();
|
||||
fields.put("type",0);
|
||||
fields.put("description","通讯中断");
|
||||
// fields.put("type",1);
|
||||
// fields.put("description","通讯正常");
|
||||
long time = LocalDateTime.parse("2024-01-06 18:00:00", DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||
Point point = influxDbUtils.pointBuilder("pqs_communicate", time, TimeUnit.MILLISECONDS, tags, fields);
|
||||
BatchPoints batchPoints = BatchPoints.database(influxDbUtils.getDbName()).retentionPolicy("").consistency(InfluxDB.ConsistencyLevel.ALL).build();
|
||||
batchPoints.point(point);
|
||||
influxDbUtils.batchInsert(influxDbUtils.getDbName(), "", InfluxDB.ConsistencyLevel.ALL, TimeUnit.MILLISECONDS, Collections.singletonList(batchPoints.lineProtocol()));
|
||||
|
||||
}
|
||||
|
||||
public static void test33() {
|
||||
InfluxDbUtils influxDbUtils = new InfluxDbUtils("admin", "123456", "http://192.168.1.103:18086", "pqsbase", "");
|
||||
Map<String, String> tags = new HashMap<>();
|
||||
tags.put("dev_id","0eb0262f706445ac9c69931a60357561");
|
||||
Map<String,Object> fields = new HashMap<>();
|
||||
// fields.put("type",0);
|
||||
// fields.put("description","通讯中断");
|
||||
fields.put("type",1);
|
||||
fields.put("description","通讯正常");
|
||||
long time = LocalDateTime.parse("2024-01-06 22:00:00", DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||
Point point = influxDbUtils.pointBuilder("pqs_communicate", time, TimeUnit.MILLISECONDS, tags, fields);
|
||||
BatchPoints batchPoints = BatchPoints.database(influxDbUtils.getDbName()).retentionPolicy("").consistency(InfluxDB.ConsistencyLevel.ALL).build();
|
||||
batchPoints.point(point);
|
||||
influxDbUtils.batchInsert(influxDbUtils.getDbName(), "", InfluxDB.ConsistencyLevel.ALL, TimeUnit.MILLISECONDS, Collections.singletonList(batchPoints.lineProtocol()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
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.PqGovernPlanClientFallbackFactory;
|
||||
import com.njcn.csharmonic.pojo.po.PqGovernPlan;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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 = "/pqGovernPlan", fallbackFactory = PqGovernPlanClientFallbackFactory.class,contextId = "pqGovernPlan")
|
||||
|
||||
public interface PqGovernPlanFeignClient {
|
||||
|
||||
@GetMapping("/getListExcludeNull")
|
||||
@ApiOperation("查询所有治理方案(剔除治理前后监测点为空的数据)")
|
||||
HttpResult<List<PqGovernPlan>> getListExcludeNull();
|
||||
|
||||
@PostMapping("/getListByMonitorPoint")
|
||||
@ApiOperation("清空治理前后监测点数据")
|
||||
HttpResult<List<PqGovernPlan>> getListByMonitorPoint(@RequestBody List<String> ids);
|
||||
|
||||
@GetMapping("/getById")
|
||||
@ApiOperation("根据ID查询治理方案")
|
||||
HttpResult<PqGovernPlan> getById(@RequestParam("id") String id);
|
||||
|
||||
}
|
||||
@@ -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.PqGovernPlanFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.PqGovernPlan;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PqGovernPlanClientFallbackFactory implements FallbackFactory<PqGovernPlanFeignClient> {
|
||||
@Override
|
||||
public PqGovernPlanFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new PqGovernPlanFeignClient() {
|
||||
@Override
|
||||
public HttpResult<List<PqGovernPlan>> getListExcludeNull() {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询所有治理方案异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<PqGovernPlan>> getListByMonitorPoint(List<String> ids) {
|
||||
log.error("{}异常,降级处理,异常为:{}","清空治理前后监测点数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<PqGovernPlan> getById(String id) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据ID查询治理方案异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,25 @@
|
||||
package com.njcn.csharmonic.offline.log.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class NewTaglogbuffer implements Serializable {
|
||||
private NewHeadTaglogbuffer newHeadTaglogbuffer;
|
||||
private List<NewBodyTaglogbuffer> newBodyTaglogbuffers;
|
||||
private LocalDateTime start, end; //事件起始和结束时间
|
||||
private String path = ""; //事件对应波形文件名称
|
||||
//事件起始事件
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
|
||||
private LocalDateTime start;
|
||||
//事件结束时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
|
||||
private LocalDateTime end;
|
||||
//事件对应波形文件名称
|
||||
private String path = "";
|
||||
|
||||
public NewTaglogbuffer(NewHeadTaglogbuffer head, ArrayList<NewBodyTaglogbuffer> body) {
|
||||
newHeadTaglogbuffer = head;
|
||||
|
||||
@@ -23,10 +23,10 @@ public class CldEventParam implements Serializable {
|
||||
@ApiModelProperty("暂降触发时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty("幅值")
|
||||
@ApiModelProperty("幅值 没带百分比")
|
||||
private Double amplitude;
|
||||
|
||||
@ApiModelProperty("持续时间")
|
||||
@ApiModelProperty("持续时间 s")
|
||||
private Double duration;
|
||||
|
||||
@ApiModelProperty("暂态类型 0-未知 1-暂降 2-暂升 3-中断 4-瞬态")
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.csharmonic.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -52,4 +53,35 @@ public class CommonStatisticalQueryParam {
|
||||
@ApiModelProperty(value = "数据模型 0:全量查询 1:增量查询")
|
||||
private Integer dataModel;
|
||||
|
||||
@ApiModelProperty(value = "持续时间最小值",name = "evtParamTm")
|
||||
@Range(min = 0, max = 60, message = "持续时间范围应在0~60s之间")
|
||||
private Double evtParamTmMin;
|
||||
|
||||
@ApiModelProperty(value = "持续时间最大值",name = "evtParamTm")
|
||||
@Range(min = 0, max = 60, message = "持续时间范围应在0~60s之间")
|
||||
private Double evtParamTmMax;
|
||||
|
||||
@ApiModelProperty(value = "特征幅值最小值",name = "featureAmplitude")
|
||||
@Range(min = 0, max = 180, message = "特征幅值范围应在0~180%之间")
|
||||
private Double featureAmplitudeMin;
|
||||
|
||||
@ApiModelProperty(value = "特征幅值最大值",name = "featureAmplitude")
|
||||
@Range(min = 0, max = 180, message = "特征幅值范围应在0~180%之间")
|
||||
private Double featureAmplitudeMax;
|
||||
|
||||
@ApiModelProperty(value = "是否存在波形",name = "fileFlag")
|
||||
private Integer fileFlag;
|
||||
|
||||
@ApiModelProperty(value = "严重度最小值",name = "severityMin")
|
||||
@Range(min = 0, max = 10, message = "严重度范围应在0~10之间")
|
||||
private Double severityMin;
|
||||
|
||||
@ApiModelProperty(value = "严重度最大值",name = "severityMax")
|
||||
@Range(min = 0, max = 10, message = "严重度范围应在0~10之间")
|
||||
private Double severityMax;
|
||||
|
||||
@ApiModelProperty(value = "事件类型",name = "target")
|
||||
private List<String> target;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.csharmonic.param;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
@@ -28,6 +29,35 @@ public class CsEventUserQueryPage extends CsEventUserQueryParam{
|
||||
@ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true)
|
||||
private Integer pageSize;
|
||||
|
||||
@ApiModelProperty(value = "搜索内容",name = "searchValue")
|
||||
private String searchValue;
|
||||
|
||||
@ApiModelProperty(value = "持续时间最小值",name = "evtParamTm")
|
||||
@Range(min = 0, max = 60, message = "持续时间范围应在0~60s之间")
|
||||
private Double evtParamTmMin;
|
||||
|
||||
@ApiModelProperty(value = "持续时间最大值",name = "evtParamTm")
|
||||
@Range(min = 0, max = 60, message = "持续时间范围应在0~60s之间")
|
||||
private Double evtParamTmMax;
|
||||
|
||||
@ApiModelProperty(value = "特征幅值最小值",name = "featureAmplitude")
|
||||
@Range(min = 0, max = 180, message = "特征幅值范围应在0~180%之间")
|
||||
private Double featureAmplitudeMin;
|
||||
|
||||
@ApiModelProperty(value = "特征幅值最大值",name = "featureAmplitude")
|
||||
@Range(min = 0, max = 180, message = "特征幅值范围应在0~180%之间")
|
||||
private Double featureAmplitudeMax;
|
||||
|
||||
@ApiModelProperty(value = "是否存在波形",name = "fileFlag")
|
||||
private Integer fileFlag;
|
||||
|
||||
@ApiModelProperty(value = "严重度最小值",name = "severityMin")
|
||||
@Range(min = 0, max = 10, message = "严重度范围应在0~10之间")
|
||||
private Double severityMin;
|
||||
|
||||
@ApiModelProperty(value = "严重度最大值",name = "severityMax")
|
||||
@Range(min = 0, max = 10, message = "严重度范围应在0~10之间")
|
||||
private Double severityMax;
|
||||
|
||||
@ApiModelProperty(value = "设备类型名称(便携式,治理)")
|
||||
private String deviceTypeName;
|
||||
@@ -48,4 +78,7 @@ public class CsEventUserQueryPage extends CsEventUserQueryParam{
|
||||
|
||||
@ApiModelProperty(value = "排序字段 0:发生时间 1:幅值 2:持续时间")
|
||||
private Integer sortField;
|
||||
|
||||
@ApiModelProperty(value = "是否是dvr治理效果 0:否 1:是")
|
||||
private Integer isDvr;
|
||||
}
|
||||
@@ -45,6 +45,7 @@ public class CsEventUserQueryParam {
|
||||
private String status;
|
||||
|
||||
private String level;
|
||||
|
||||
@ApiModelProperty(value="起始时间")
|
||||
private String startTime;
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.njcn.csharmonic.param;
|
||||
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 徐扬
|
||||
*/
|
||||
@Data
|
||||
public class ItemParam extends BaseParam implements Serializable{
|
||||
|
||||
@ApiModelProperty("测试项id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "持续时间最小值",name = "evtParamTm")
|
||||
@Range(min = 0, max = 60, message = "持续时间范围应在0~60s之间")
|
||||
private Double evtParamTmMin;
|
||||
|
||||
@ApiModelProperty(value = "持续时间最大值",name = "evtParamTm")
|
||||
@Range(min = 0, max = 60, message = "持续时间范围应在0~60s之间")
|
||||
private Double evtParamTmMax;
|
||||
|
||||
@ApiModelProperty(value = "特征幅值最小值",name = "featureAmplitude")
|
||||
@Range(min = 0, max = 180, message = "特征幅值范围应在0~180%之间")
|
||||
private Double featureAmplitudeMin;
|
||||
|
||||
@ApiModelProperty(value = "特征幅值最大值",name = "featureAmplitude")
|
||||
@Range(min = 0, max = 180, message = "特征幅值范围应在0~180%之间")
|
||||
private Double featureAmplitudeMax;
|
||||
|
||||
@ApiModelProperty(value = "是否存在波形",name = "fileFlag")
|
||||
private Integer fileFlag;
|
||||
|
||||
@ApiModelProperty(value = "严重度最小值",name = "severityMin")
|
||||
@Range(min = 0, max = 10, message = "严重度范围应在0~10之间")
|
||||
private Double severityMin;
|
||||
|
||||
@ApiModelProperty(value = "严重度最大值",name = "severityMax")
|
||||
@Range(min = 0, max = 10, message = "严重度范围应在0~10之间")
|
||||
private Double severityMax;
|
||||
|
||||
@ApiModelProperty(value = "事件类型",name = "target")
|
||||
private List<String> target;
|
||||
|
||||
}
|
||||
@@ -26,6 +26,12 @@ public class EventStatisticParam extends BaseParam {
|
||||
@ApiModelProperty("暂态事件类型 0:全部 1:暂降 2:中断 3:暂升")
|
||||
private Integer eventType;
|
||||
|
||||
/**
|
||||
* 告警等级
|
||||
*/
|
||||
@ApiModelProperty("告警等级(1:Ⅰ级 2:Ⅱ级 3:Ⅲ级 4:DEBUG 5:NORMAL 6:WARN 7:ERROR)")
|
||||
private String level;
|
||||
|
||||
/**
|
||||
* 安装位置
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.njcn.csharmonic.pojo.param;
|
||||
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 治理方案参数类
|
||||
*
|
||||
* @author xy
|
||||
* @since 2026-06-16
|
||||
*/
|
||||
@Data
|
||||
public class PqGovernPlanParam {
|
||||
|
||||
@ApiModelProperty(value = "用户id(关联pq_sensitive_user的id)")
|
||||
@NotBlank(message = "用户id不能为空")
|
||||
private String pid;
|
||||
|
||||
@ApiModelProperty(value = "治理点名称")
|
||||
@NotBlank(message = "治理点名称不能为空")
|
||||
private String governName;
|
||||
|
||||
@ApiModelProperty(value = "治理类型(稳态:harmonic 暂态:event)")
|
||||
@NotBlank(message = "治理类型不能为空")
|
||||
private String governType;
|
||||
|
||||
@ApiModelProperty(value = "治理方法")
|
||||
private String governMethod;
|
||||
|
||||
@ApiModelProperty(value = "治理前-监测点id")
|
||||
private String governBefore;
|
||||
|
||||
@ApiModelProperty(value = "治理后-监测点id")
|
||||
private String governAfter;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 修改参数类
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class UpdatePqGovernPlanParam extends PqGovernPlanParam {
|
||||
@ApiModelProperty("ID")
|
||||
@NotBlank(message = "ID不能为空")
|
||||
private String id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询参数类
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class QueryParam extends BaseParam {
|
||||
@ApiModelProperty(value = "治理点名称")
|
||||
private String governName;
|
||||
|
||||
@ApiModelProperty(value = "治理类型(稳态:harmonic 暂态:event)")
|
||||
private String governType;
|
||||
|
||||
@ApiModelProperty(value = "用户id(关联pq_sensitive_user的id)")
|
||||
private String pid;
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -44,7 +43,7 @@ public class CsEventPO extends BaseEntity {
|
||||
/**
|
||||
* 事件时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(value = "start_time")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@@ -142,6 +141,21 @@ public class CsEventPO extends BaseEntity {
|
||||
@TableField(value = "advance_type")
|
||||
private String advanceType;
|
||||
|
||||
/**
|
||||
* 暂态事件落点(A区/B区/C区/D区;解析失败或未匹配返回 null)
|
||||
*/
|
||||
@TableField(value = "land_point")
|
||||
private String landPoint;
|
||||
|
||||
/**
|
||||
* 暂降源与监测位置关系 0-未知、1-上游、2-下游
|
||||
*/
|
||||
@TableField(value = "sag_source")
|
||||
private String sagSource;
|
||||
|
||||
/**
|
||||
* 暂降严重度
|
||||
*/
|
||||
@TableField(value = "severity")
|
||||
private Double severity;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.njcn.csharmonic.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2026-06-16
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@TableName("pq_govern_plan")
|
||||
public class PqGovernPlan extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户id(关联pq_sensitive_user的id)
|
||||
*/
|
||||
private String pid;
|
||||
|
||||
/**
|
||||
* 治理点名称
|
||||
*/
|
||||
private String governName;
|
||||
|
||||
/**
|
||||
* 治理类型(稳态:harmonic 暂态:event)
|
||||
*/
|
||||
private String governType;
|
||||
|
||||
/**
|
||||
* 治理方法
|
||||
*/
|
||||
private String governMethod;
|
||||
|
||||
/**
|
||||
* 治理前-监测点id
|
||||
*/
|
||||
private String governBefore;
|
||||
|
||||
/**
|
||||
* 治理后-监测点id
|
||||
*/
|
||||
private String governAfter;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
}
|
||||
@@ -28,6 +28,9 @@ public class AppLineDetailVo implements Serializable {
|
||||
@ApiModelProperty("监测点id")
|
||||
private String pointId;
|
||||
|
||||
@ApiModelProperty("监测点通讯状态 1:离线 2:在线")
|
||||
private Integer runStatus;
|
||||
|
||||
@ApiModelProperty("数据时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Instant dataTime;
|
||||
@@ -47,6 +50,12 @@ public class AppLineDetailVo implements Serializable {
|
||||
@ApiModelProperty("指标名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("指标别名")
|
||||
private String otherName;
|
||||
|
||||
@ApiModelProperty("指标别名单位")
|
||||
private String otherNameUnit;
|
||||
|
||||
@ApiModelProperty("单位")
|
||||
private String unit;
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.njcn.csharmonic.pojo.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年09月20日 15:57
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class CsEventLogsVo {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 监测点id
|
||||
*/
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 监测点名称
|
||||
*/
|
||||
private String lineName;
|
||||
|
||||
/**
|
||||
* 装置id
|
||||
*/
|
||||
private String deviceId;
|
||||
|
||||
/**
|
||||
* 装置名称
|
||||
*/
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 事件时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
/**
|
||||
* 事件描述
|
||||
*/
|
||||
private String event;
|
||||
|
||||
/**
|
||||
* 事件等级
|
||||
* 告警等级(1:Ⅰ级 2:Ⅱ级 3:Ⅲ级 4:DEBUG 5:NORMAL 6:WARN 7:ERROR)
|
||||
*/
|
||||
private Integer level;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.csharmonic.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年09月20日 15:57
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class CsEventReasonAndTypeVo {
|
||||
|
||||
@ApiModelProperty(value = "暂降原因")
|
||||
private List<EventReason> eventReason;
|
||||
|
||||
@ApiModelProperty(value = "暂降类型")
|
||||
private List<EventType> eventType;
|
||||
|
||||
@Data
|
||||
public static class EventReason implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "暂降原因id")
|
||||
private String eventReasonId;
|
||||
|
||||
@ApiModelProperty(value = "个数")
|
||||
private Integer eventReasonCount;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class EventType implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "暂降类型id")
|
||||
private String eventTypeId;
|
||||
|
||||
@ApiModelProperty(value = "个数")
|
||||
private Integer eventTypeCount;
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,9 @@ public class EventDetailVO {
|
||||
*/
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty(value = "设备网络id")
|
||||
private String nDid;
|
||||
|
||||
@ApiModelProperty(value = "设备类型")
|
||||
private String devType;
|
||||
|
||||
@@ -69,10 +72,19 @@ public class EventDetailVO {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private LocalDateTime startTime2;
|
||||
|
||||
/**
|
||||
* 事件字典id
|
||||
*/
|
||||
private String dictDataId;
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
private String tag;
|
||||
|
||||
/**
|
||||
* 事件名称
|
||||
*/
|
||||
private String showName;
|
||||
|
||||
/**
|
||||
@@ -98,9 +110,7 @@ public class EventDetailVO {
|
||||
* RMS波形图,存在多张的情况
|
||||
*/
|
||||
private String rmsPics;
|
||||
@ApiModelProperty(value = " /**\n" +
|
||||
" * 事件等级(1:Ⅰ级 2:Ⅱ级 3:Ⅲ级)\n" +
|
||||
" */")
|
||||
@ApiModelProperty(value = "事件等级(1:Ⅰ级||ERROR 2:Ⅱ级||WARN 3:Ⅲ级||(DEBUG&&NORMAL))")
|
||||
private String level;
|
||||
|
||||
/**
|
||||
@@ -139,4 +149,19 @@ public class EventDetailVO {
|
||||
@ApiModelProperty("事件落点")
|
||||
private String landPoint;
|
||||
|
||||
@ApiModelProperty("暂降原因")
|
||||
private String advanceReason;
|
||||
|
||||
@ApiModelProperty("暂降类型")
|
||||
private String advanceType;
|
||||
|
||||
@ApiModelProperty("暂降源与监测位置关系 0-未知、1-上游、2-下游")
|
||||
private String sagSource;
|
||||
|
||||
@ApiModelProperty("监测点电压等级")
|
||||
private Double lineVoltage;
|
||||
|
||||
@ApiModelProperty("事件严重度")
|
||||
private Double severity;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.njcn.csharmonic.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
public class FrontWarnVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("前置id")
|
||||
private String frontId;
|
||||
|
||||
@ApiModelProperty("前置ip")
|
||||
private String frontIp;
|
||||
|
||||
@ApiModelProperty("前置进程号")
|
||||
private Integer processNo;
|
||||
|
||||
@ApiModelProperty("事件发生时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty("告警描述")
|
||||
private String tag;
|
||||
|
||||
@ApiModelProperty("告警码")
|
||||
private Integer code;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.njcn.csharmonic.pojo.vo;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
public class FrontWarnVo implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 监测点id
|
||||
*/
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 装置id
|
||||
*/
|
||||
private String deviceId;
|
||||
|
||||
/**
|
||||
* 事件时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
private String tag;
|
||||
|
||||
/**
|
||||
* 暂态事件波形文件路
|
||||
*/
|
||||
private String wavePath;
|
||||
|
||||
/**
|
||||
* 瞬时波形图,存在多张的情况
|
||||
*/
|
||||
private String instantPics;
|
||||
|
||||
|
||||
/**
|
||||
* RMS波形图,存在多张的情况
|
||||
*/
|
||||
private String rmsPics;
|
||||
|
||||
|
||||
/**
|
||||
* 事件类型(0:暂态事件1:稳态事件 2:设备事
|
||||
* 件)
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 逻辑子设备id
|
||||
* 电能质量设备是监测点、治理设备是各个模块
|
||||
*/
|
||||
private Integer clDid;
|
||||
|
||||
/**
|
||||
* 事件等级(1:Ⅰ级 2:Ⅱ级 3:Ⅲ级)
|
||||
*/
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 发生位置 grid:电网侧,load:负载侧
|
||||
*/
|
||||
private String location;
|
||||
|
||||
/**
|
||||
* 流程信息(用于数据控制 1:设备登记,2:功能调试,3:出厂调试 4:设备投运)
|
||||
*/
|
||||
private Integer process;
|
||||
|
||||
/**
|
||||
* 告警故障编码(一般显示为Hex)
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 持续时间
|
||||
*/
|
||||
private Double persistTime;
|
||||
|
||||
/**
|
||||
* 暂降幅值
|
||||
*/
|
||||
private Double amplitude;
|
||||
|
||||
/**
|
||||
* 相别
|
||||
*/
|
||||
private String phase;
|
||||
|
||||
/**
|
||||
* 暂降原因
|
||||
*/
|
||||
private String advanceReason;
|
||||
|
||||
/**
|
||||
* 暂降类型
|
||||
*/
|
||||
private String advanceType;
|
||||
|
||||
/**
|
||||
* 暂态事件落点(A区/B区/C区/D区;解析失败或未匹配返回 null)
|
||||
*/
|
||||
private String landPoint;
|
||||
|
||||
/**
|
||||
* 暂降源与监测位置关系 0-未知、1-上游、2-下游
|
||||
*/
|
||||
private String sagSource;
|
||||
|
||||
/**
|
||||
* 暂降严重度
|
||||
*/
|
||||
private Double severity;
|
||||
}
|
||||
@@ -15,13 +15,13 @@ public class LimitExtentVO {
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("越限最大值")
|
||||
private float maxValue;
|
||||
private Float maxValue;
|
||||
|
||||
@ApiModelProperty("国际限值")
|
||||
private float internationalValue;
|
||||
private Float internationalValue;
|
||||
|
||||
@ApiModelProperty("越限程度")
|
||||
private float extent;
|
||||
private Float extent;
|
||||
|
||||
@ApiModelProperty("发生日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@@ -32,8 +32,24 @@ public class LimitExtentVO {
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty("工程名称")
|
||||
private String engineeringName;
|
||||
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("设备id")
|
||||
private String devId;
|
||||
|
||||
@ApiModelProperty("设备名称")
|
||||
private String devName;
|
||||
|
||||
|
||||
public Float getExtent() {
|
||||
if (internationalValue == null || maxValue == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public float getExtent() {
|
||||
if (internationalValue == 0) {
|
||||
return 0.00F;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,12 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MainLineStatLimitRateDetailsVO extends RStatLimitRateDPO {
|
||||
@ApiModelProperty("工程名称")
|
||||
private String engineeringName;
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
@ApiModelProperty("设备名称")
|
||||
private String devName;
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,14 @@ import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class MainLineVO implements Serializable {
|
||||
@ApiModelProperty("工程名称")
|
||||
private String engineeringName;
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
@ApiModelProperty("设备id")
|
||||
private String devId;
|
||||
@ApiModelProperty("设备名称")
|
||||
private String devName;
|
||||
@ApiModelProperty("监测点ID")
|
||||
private String lineId;
|
||||
@ApiModelProperty("监测点名称")
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.njcn.csharmonic.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class PqGovernPlanVo implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户id(关联pq_sensitive_user的id)
|
||||
*/
|
||||
private String pid;
|
||||
|
||||
/**
|
||||
* 治理点名称
|
||||
*/
|
||||
private String governName;
|
||||
|
||||
/**
|
||||
* 治理类型(稳态:harmonic 暂态:event)
|
||||
*/
|
||||
private String governType;
|
||||
|
||||
/**
|
||||
* 治理方法
|
||||
*/
|
||||
private String governMethod;
|
||||
|
||||
/**
|
||||
* 治理前-监测点id
|
||||
*/
|
||||
private String governBefore;
|
||||
|
||||
@ApiModelProperty("治理前台账")
|
||||
private String ledgerBefore;
|
||||
|
||||
/**
|
||||
* 治理后-监测点id
|
||||
*/
|
||||
private String governAfter;
|
||||
|
||||
@ApiModelProperty("治理后台账")
|
||||
private String ledgerAfter;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
}
|
||||
@@ -8,6 +8,18 @@ import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class TotalLimitStatisticsDetailsVO {
|
||||
@ApiModelProperty("工程名称")
|
||||
private String engineeringName;
|
||||
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("设备id")
|
||||
private String devId;
|
||||
|
||||
@ApiModelProperty("设备名称")
|
||||
private String devName;
|
||||
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
|
||||
@@ -7,7 +7,14 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class TotalLimitStatisticsVO extends TotalLimitTotalStatisticsVO {
|
||||
|
||||
@ApiModelProperty("工程名称")
|
||||
private String engineeringName;
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
@ApiModelProperty("设备id")
|
||||
private String devId;
|
||||
@ApiModelProperty("设备名称")
|
||||
private String devName;
|
||||
@ApiModelProperty("监测点ID")
|
||||
private String lineId;
|
||||
@ApiModelProperty("监测点名称")
|
||||
|
||||
@@ -17,6 +17,18 @@ public class EventStatisticVO {
|
||||
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("工程名称")
|
||||
private String engineeringName;
|
||||
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("设备id")
|
||||
private String devId;
|
||||
|
||||
@ApiModelProperty("设备名称")
|
||||
private String devName;
|
||||
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
|
||||
@@ -15,6 +15,15 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
public class F47Curve {
|
||||
|
||||
@ApiModelProperty(value = "工程名称")
|
||||
private String engineeringName;
|
||||
|
||||
@ApiModelProperty(value = "项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty(value = "设备名称")
|
||||
private String equipmentName;
|
||||
|
||||
@ApiModelProperty(name = "eventId", value = "暂降id")
|
||||
private String eventId;
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.njcn.csharmonic.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DataChangeUtil {
|
||||
|
||||
/**
|
||||
@@ -43,4 +46,34 @@ public class DataChangeUtil {
|
||||
return data;
|
||||
}
|
||||
|
||||
public static List<String> getTag(List<String> target) {
|
||||
List<String> tag = new ArrayList<>();
|
||||
target.forEach(temp -> {
|
||||
switch (temp) {
|
||||
case "暂降":
|
||||
tag.add("Evt_Sys_DipStr");
|
||||
break;
|
||||
case "中断":
|
||||
tag.add("Evt_Sys_IntrStr");
|
||||
break;
|
||||
case "暂升":
|
||||
tag.add("Evt_Sys_SwlStr");
|
||||
break;
|
||||
case "瞬态":
|
||||
tag.add("Evt_Sys_QitrV");
|
||||
tag.add("Evt_Sys_QitrA");
|
||||
tag.add("Transient");
|
||||
break;
|
||||
case "振荡":
|
||||
tag.add("Evt_Sys_PoscLowStr");
|
||||
tag.add("Evt_Sys_PoscSyncStr");
|
||||
tag.add("Evt_Sys_PoscWideStr");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
return tag;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.csharmonic.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
@@ -13,6 +14,8 @@ import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.param.DataParam;
|
||||
import com.njcn.csharmonic.pojo.param.EventStatisticParam;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsEventLogsVo;
|
||||
import com.njcn.csharmonic.pojo.vo.CsEventReasonAndTypeVo;
|
||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.csharmonic.service.CsEventPOService;
|
||||
@@ -198,5 +201,23 @@ public class CsEventController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getFrontDebugLogs")
|
||||
@ApiOperation("获取前置调试日志")
|
||||
@ApiImplicitParam(name = "param", value = "param", required = true)
|
||||
public HttpResult<IPage<CsEventLogsVo>> getEventByIdList(@RequestBody EventStatisticParam param) {
|
||||
String methodDescribe = getMethodDescribe("getEventByIdList");
|
||||
IPage<CsEventLogsVo> result = csEventPOService.getFrontDebugLogs(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/eventReasonAndTypeStatistics")
|
||||
@ApiOperation("暂降原因和暂降类型统计")
|
||||
@ApiImplicitParam(name = "param", value = "param", required = true)
|
||||
public HttpResult<CsEventReasonAndTypeVo> eventReasonAndTypeStatistics(@RequestBody EventStatisticParam param) {
|
||||
String methodDescribe = getMethodDescribe("eventReasonAndTypeStatistics");
|
||||
CsEventReasonAndTypeVo result = csEventPOService.eventReasonAndTypeStatistics(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||
import com.njcn.csdevice.pojo.vo.EachModuleVO;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import com.njcn.csharmonic.param.DataParam;
|
||||
import com.njcn.csharmonic.param.ItemParam;
|
||||
import com.njcn.csharmonic.pojo.vo.AppLineDetailVo;
|
||||
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
||||
import com.njcn.csharmonic.service.IDataService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -38,9 +38,9 @@ public class DataController extends BaseController {
|
||||
@PostMapping("/realTimeData")
|
||||
@ApiOperation("设备监控-》准实时数据")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<List<RealTimeDataVo>> realTimeData(@RequestBody DataParam param) {
|
||||
public HttpResult<List<AppLineDetailVo>> realTimeData(@RequestBody DataParam param) {
|
||||
String methodDescribe = getMethodDescribe("realTimeData");
|
||||
List<RealTimeDataVo> list = dataService.getRealTimeData(param);
|
||||
List<AppLineDetailVo> list = dataService.getRealTimeData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -57,10 +57,10 @@ public class DataController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEventByItem")
|
||||
@ApiOperation("方案数据-》根据测试项获取暂态事件")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||
public HttpResult<List<DataGroupEventVO>> getEventByItem(@RequestParam("id") String id) {
|
||||
@ApiImplicitParam(name = "param", value = "param", required = true)
|
||||
public HttpResult<List<DataGroupEventVO>> getEventByItem(@RequestBody ItemParam param) {
|
||||
String methodDescribe = getMethodDescribe("getEventByItem");
|
||||
List<DataGroupEventVO> list = dataService.getEventByItem(id);
|
||||
List<DataGroupEventVO> list = dataService.getEventByItem(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ 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.pojo.vo.FrontWarnVo;
|
||||
import com.njcn.csharmonic.pojo.vo.event.EventStatisticVO;
|
||||
import com.njcn.csharmonic.service.CsEventUserPOService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -89,9 +90,9 @@ public class EventUserController extends BaseController {
|
||||
@PostMapping("/frontWarnInfo")
|
||||
@ApiOperation("前置告警信息")
|
||||
@ApiImplicitParam(name = "baseParam", value = "基础查询数据", required = true)
|
||||
public HttpResult<Page<CsEventPO>> frontWarnInfo(@RequestBody CldWarnParam baseParam) {
|
||||
public HttpResult<Page<FrontWarnVo>> frontWarnInfo(@RequestBody CldWarnParam baseParam) {
|
||||
String methodDescribe = getMethodDescribe("frontWarnInfo");
|
||||
Page<CsEventPO> list = csEventUserPOService.getFrontWarnInfo(baseParam);
|
||||
Page<FrontWarnVo> list = csEventUserPOService.getFrontWarnInfo(baseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@ public class OfflineDataUploadController extends BaseController {
|
||||
@PostMapping(value = "/makeUpData")
|
||||
@ApiOperation("补招数据-界面")
|
||||
@ApiImplicitParam(name = "lineId", value = "监测点id", required = true)
|
||||
@Deprecated
|
||||
public HttpResult<List<MakeUpVo>> makeUpData(@RequestParam("lineId") String lineId){
|
||||
String methodDescribe = getMethodDescribe("makeUpData");
|
||||
List<MakeUpVo> list = offlineDataUploadService.getMakeUpData(lineId);
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
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.csharmonic.pojo.param.PqGovernPlanParam;
|
||||
import com.njcn.csharmonic.pojo.po.PqGovernPlan;
|
||||
import com.njcn.csharmonic.pojo.vo.PqGovernPlanVo;
|
||||
import com.njcn.csharmonic.service.IPqGovernPlanService;
|
||||
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 org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2026-06-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pqGovernPlan")
|
||||
@Api(tags = "治理方案管理")
|
||||
@AllArgsConstructor
|
||||
public class PqGovernPlanController extends BaseController {
|
||||
|
||||
private final IPqGovernPlanService pqGovernPlanService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/save")
|
||||
@ApiOperation("新增治理方案")
|
||||
public HttpResult<Boolean> save(@RequestBody @Validated PqGovernPlanParam param) {
|
||||
String methodDescribe = getMethodDescribe("save");
|
||||
boolean result = pqGovernPlanService.save(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改治理方案")
|
||||
public HttpResult<Boolean> update(@RequestBody @Validated PqGovernPlanParam.UpdatePqGovernPlanParam param) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
boolean result = pqGovernPlanService.update(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除治理方案")
|
||||
@ApiImplicitParam(name = "ids", value = "ID集合")
|
||||
public HttpResult<Boolean> delete(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
boolean result = pqGovernPlanService.delete(ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getById")
|
||||
@ApiOperation("根据ID查询治理方案")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true)
|
||||
public HttpResult<PqGovernPlan> getById(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getById");
|
||||
PqGovernPlan plan = pqGovernPlanService.getById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, plan, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getListByPid")
|
||||
@ApiOperation("根据pid查询所有治理方案")
|
||||
@ApiImplicitParam(name = "pid", value = "用户id(关联pq_sensitive_user的id)", required = true)
|
||||
public HttpResult<List<PqGovernPlanVo>> getListByPid(@RequestParam("pid") String pid) {
|
||||
String methodDescribe = getMethodDescribe("getListByPid");
|
||||
List<PqGovernPlanVo> list = pqGovernPlanService.getListByPid(pid);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getListExcludeNull")
|
||||
@ApiOperation("查询所有治理方案(剔除治理前后监测点为空的数据)")
|
||||
public HttpResult<List<PqGovernPlan>> getListExcludeNull() {
|
||||
String methodDescribe = getMethodDescribe("getListExcludeNull");
|
||||
List<PqGovernPlan> list = pqGovernPlanService.getListExcludeNull();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/clearGovernPoints")
|
||||
@ApiOperation("清空治理前后监测点数据")
|
||||
@ApiImplicitParam(name = "id", value = "治理方案ID", required = true)
|
||||
public HttpResult<Boolean> clearGovernPoints(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("clearGovernPoints");
|
||||
boolean result = pqGovernPlanService.clearGovernPoints(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getListByMonitorPoint")
|
||||
@ApiOperation("根据监测点查询方案数据")
|
||||
@ApiImplicitParam(name = "ids", value = "监测点id集合", required = true)
|
||||
public HttpResult<List<PqGovernPlan>> getListByMonitorPoint(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("clearGovernPoints");
|
||||
List<PqGovernPlan> result = pqGovernPlanService.getListByMonitorPoint(ids,null);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.njcn.csharmonic.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
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.constant.OperateType;
|
||||
@@ -10,9 +8,10 @@ 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.CsLineFeignClient;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csharmonic.pojo.param.PqSensitiveUserParam;
|
||||
import com.njcn.csharmonic.pojo.po.PqGovernPlan;
|
||||
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
|
||||
import com.njcn.csharmonic.service.IPqSensitiveUserService;
|
||||
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
||||
@@ -26,10 +25,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -47,7 +44,8 @@ import java.util.stream.Collectors;
|
||||
public class PqSensitiveUserController extends BaseController {
|
||||
|
||||
private final IPqSensitiveUserService pqSensitiveUserService;
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
||||
private final EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getList")
|
||||
@@ -76,26 +74,7 @@ public class PqSensitiveUserController extends BaseController {
|
||||
@ApiImplicitParam(name = "ids", value = "id集合")
|
||||
public HttpResult<List<PqSensitiveUser>> getListByIds(@RequestParam(name = "ids", required = false) List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getListByIds");
|
||||
List<PqSensitiveUser> list;
|
||||
//获取用户监测点
|
||||
List<String> keywordsLineIds = new ArrayList<>();
|
||||
List<CsLinePO> poList = csLineFeignClient.getSimpleLine().getData();
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
keywordsLineIds = poList.stream().map(CsLinePO::getMonitorUser).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
}
|
||||
if (CollUtil.isEmpty(keywordsLineIds)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
keywordsLineIds = ids;
|
||||
}
|
||||
}
|
||||
list = pqSensitiveUserService.list(
|
||||
new LambdaQueryWrapper<PqSensitiveUser>().in(PqSensitiveUser::getId, keywordsLineIds)
|
||||
);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
List<PqSensitiveUser> list = pqSensitiveUserService.getListByIds(ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -137,5 +116,18 @@ public class PqSensitiveUserController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 治理用户与设备关系树
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getUserDevTree")
|
||||
@ApiOperation("治理方案树(敏感用户+治理方案)")
|
||||
@ApiImplicitParam(name = "type", value = "治理类型(apf→稳态harmonic, 其他→暂态event)", required = true)
|
||||
public HttpResult<Map<String, List<PqGovernPlan>>> getUserDevTree(@RequestParam("type") String type) {
|
||||
String methodDescribe = getMethodDescribe("getUserDevTree");
|
||||
Map<String, List<PqGovernPlan>> tree = pqSensitiveUserService.getUserDevTree(type);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, tree, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -137,21 +137,19 @@ public class MqttMessageHandler {
|
||||
FrequencyStatisticalQueryParam frequencyStatisticalQueryParam = new FrequencyStatisticalQueryParam();
|
||||
frequencyStatisticalQueryParam.setDevId(devId);
|
||||
frequencyStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||
frequencyStatisticalQueryParam.setValueType("avg");
|
||||
frequencyStatisticalQueryParam.setValueType("AVG");
|
||||
frequencyStatisticalQueryParam.setFrequencyStart(temp.getHarmStart());
|
||||
frequencyStatisticalQueryParam.setFrequencyEnd(temp.getHarmEnd());
|
||||
List<ThdDataVO> thdDataVOList = stableDataService.QuerySqlData(frequencyStatisticalQueryParam);
|
||||
tempList.addAll(thdDataVOList);
|
||||
|
||||
} else {
|
||||
CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
|
||||
commonStatisticalQueryParam.setDevId(devId);
|
||||
commonStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||
commonStatisticalQueryParam.setValueType("avg");
|
||||
commonStatisticalQueryParam.setValueType("AVG");
|
||||
List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
|
||||
tempList.addAll(listFuture);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//过滤T相
|
||||
@@ -185,7 +183,7 @@ public class MqttMessageHandler {
|
||||
CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
|
||||
commonStatisticalQueryParam.setDevId(devId);
|
||||
commonStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||
commonStatisticalQueryParam.setValueType("avg");
|
||||
commonStatisticalQueryParam.setValueType("AVG");
|
||||
List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
|
||||
l1.addAll(listFuture);
|
||||
});
|
||||
@@ -224,7 +222,7 @@ public class MqttMessageHandler {
|
||||
CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
|
||||
commonStatisticalQueryParam.setDevId(devId);
|
||||
commonStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||
commonStatisticalQueryParam.setValueType("avg");
|
||||
commonStatisticalQueryParam.setValueType("AVG");
|
||||
List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
|
||||
l1.addAll(listFuture);
|
||||
});
|
||||
@@ -265,7 +263,7 @@ public class MqttMessageHandler {
|
||||
CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
|
||||
commonStatisticalQueryParam.setDevId(devId);
|
||||
commonStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||
commonStatisticalQueryParam.setValueType("avg");
|
||||
commonStatisticalQueryParam.setValueType("AVG");
|
||||
List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
|
||||
l1.addAll(listFuture);
|
||||
});
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.csharmonic.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsEventReasonAndTypeVo;
|
||||
import com.njcn.csharmonic.pojo.vo.CsWarnDescVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -17,4 +18,9 @@ import java.util.List;
|
||||
*/
|
||||
public interface CsEventPOMapper extends BaseMapper<CsEventPO> {
|
||||
List<CsWarnDescVO> getEventDesc(@Param("lineIdList")List<String> lineIdList, @Param("count")int count);
|
||||
|
||||
List<CsEventReasonAndTypeVo.EventReason> getReasonStatistics(@Param("begin") String begin, @Param("end") String end, @Param("otherId") String otherId);
|
||||
|
||||
List<CsEventReasonAndTypeVo.EventType> getTypeStatistics(@Param("begin") String begin, @Param("end") String end, @Param("otherId") String otherId);
|
||||
|
||||
}
|
||||
@@ -38,6 +38,8 @@ public interface CsEventUserPOMapper extends BaseMapper<CsEventUserPO> {
|
||||
|
||||
Page<EventDetailVO> queryEventPageWeb(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("devIds") List<String> collect);
|
||||
|
||||
Page<EventDetailVO> queryEventPageWebDvr(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("lineIds") List<String> collect);
|
||||
|
||||
//查询暂态事件(未读)
|
||||
List<String> queryTempEvent(@Param("userId") String userId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("ids") List<String> ids);
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.njcn.csharmonic.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csharmonic.pojo.po.PqGovernPlan;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2026-06-16
|
||||
*/
|
||||
@DS("sjzx")
|
||||
public interface PqGovernPlanMapper extends BaseMapper<PqGovernPlan> {
|
||||
|
||||
}
|
||||
@@ -42,4 +42,28 @@
|
||||
LIMIT 60
|
||||
</select>
|
||||
|
||||
<select id="getReasonStatistics" resultType="com.njcn.csharmonic.pojo.vo.CsEventReasonAndTypeVo$EventReason">
|
||||
SELECT
|
||||
IF(advance_reason IS NULL OR advance_reason = '', #{otherId}, advance_reason) AS eventReasonId,
|
||||
COUNT(*) AS eventReasonCount
|
||||
FROM cs_event
|
||||
WHERE type = 0
|
||||
AND tag = 'Evt_Sys_DipStr'
|
||||
AND start_time BETWEEN #{begin} AND #{end}
|
||||
GROUP BY IF(advance_reason IS NULL OR advance_reason = '', #{otherId}, advance_reason)
|
||||
ORDER BY eventReasonCount DESC
|
||||
</select>
|
||||
|
||||
<select id="getTypeStatistics" resultType="com.njcn.csharmonic.pojo.vo.CsEventReasonAndTypeVo$EventType">
|
||||
SELECT
|
||||
IF(advance_type IS NULL OR advance_type = '', #{otherId}, advance_type) AS eventTypeId,
|
||||
COUNT(*) AS eventTypeCount
|
||||
FROM cs_event
|
||||
WHERE type = 0
|
||||
AND tag = 'Evt_Sys_DipStr'
|
||||
AND start_time BETWEEN #{begin} AND #{end}
|
||||
GROUP BY IF(advance_type IS NULL OR advance_type = '', #{otherId}, advance_type)
|
||||
ORDER BY eventTypeCount DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -87,68 +87,6 @@
|
||||
|
||||
</select>
|
||||
|
||||
<!-- <select id="queryEventpage" resultType="com.njcn.csharmonic.pojo.vo.EventDetailVO">-->
|
||||
<!-- select DISTINCT a.event_id id,-->
|
||||
<!-- <if test="flag">-->
|
||||
<!-- a.status status,-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="!flag">-->
|
||||
<!-- 1 status,-->
|
||||
<!-- </if>-->
|
||||
<!-- b.device_id deviceId,b.line_id lineId,b.code code,b.start_time startTime,b.amplitude,b.persist_time,-->
|
||||
<!-- round(b.amplitude,2) evtParamVVaDepth,round(b.persist_time,2) evtParamTm,b.tag tag ,b.wave_path wavePath,b.phase evtParamPhase,b.location evtParamPosition,b.instant_pics,b.rms_pics , b.type type,b.level level,b.location location,d.name lineName-->
|
||||
<!-- from cs_event_user a inner join cs_event b on a.event_id=b.id inner join cs_equipment_delivery c on b.device_id=c.id inner join cs_line d on d.device_id=b.device_id and d.clDid=b.cl_did where 1=1-->
|
||||
<!-- and b.process=c.process-->
|
||||
<!-- <if test="csEventUserQueryPage!=null and csEventUserQueryPage.endTime != null and csEventUserQueryPage.endTime !=''">-->
|
||||
<!-- AND DATE(b.start_time) <= DATE(#{csEventUserQueryPage.endTime})-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="csEventUserQueryPage!=null and csEventUserQueryPage.startTime != null and csEventUserQueryPage.startTime !=''">-->
|
||||
<!-- AND DATE(b.start_time) >= DATE(#{csEventUserQueryPage.startTime})-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="csEventUserQueryPage!=null and csEventUserQueryPage.target != null and csEventUserQueryPage.target.size()>0">-->
|
||||
|
||||
<!-- and b.tag in-->
|
||||
<!-- <foreach collection="csEventUserQueryPage.target" index="index" item="item" open="(" separator="," close=")">-->
|
||||
<!-- #{item}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
<!-- and b.device_id in-->
|
||||
<!-- <foreach collection="devIds" index="index" item="item" open="(" separator="," close=")">-->
|
||||
<!-- #{item}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- <if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != null and csEventUserQueryPage.type !=''">-->
|
||||
<!-- AND b.type =#{ csEventUserQueryPage.type}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">-->
|
||||
<!-- AND b.level IN-->
|
||||
<!-- <foreach collection="csEventUserQueryPage.level.split(',')" item="level" open="(" separator="," close=")">-->
|
||||
<!-- #{level}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="csEventUserQueryPage!=null and csEventUserQueryPage.status != null and csEventUserQueryPage.status !=''">-->
|
||||
<!-- AND a.status =#{ csEventUserQueryPage.status}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="csEventUserQueryPage!=null and csEventUserQueryPage.userId != null and csEventUserQueryPage.userId !=''">-->
|
||||
<!-- and a.user_id=#{ csEventUserQueryPage.userId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="csEventUserQueryPage!=null and csEventUserQueryPage.sortField != null">-->
|
||||
<!-- <choose>-->
|
||||
<!-- <when test="csEventUserQueryPage.sortField == 0">-->
|
||||
<!-- order by b.start_time desc-->
|
||||
<!-- </when>-->
|
||||
<!-- <when test="csEventUserQueryPage.sortField == 1">-->
|
||||
<!-- order by b.amplitude desc-->
|
||||
<!-- </when>-->
|
||||
<!-- <when test="csEventUserQueryPage.sortField == 2">-->
|
||||
<!-- order by b.persist_time desc-->
|
||||
<!-- </when>-->
|
||||
<!-- <otherwise>-->
|
||||
<!-- order by b.start_time desc-->
|
||||
<!-- </otherwise>-->
|
||||
<!-- </choose>-->
|
||||
<!-- </if>-->
|
||||
<!-- </select>-->
|
||||
|
||||
<select id="queryEventpage" resultType="com.njcn.csharmonic.pojo.vo.EventDetailVO">
|
||||
SELECT DISTINCT b.id,
|
||||
b.device_id deviceId,
|
||||
@@ -166,10 +104,19 @@
|
||||
b.instant_pics,
|
||||
b.rms_pics,
|
||||
b.type type,
|
||||
b.LEVEL LEVEL,
|
||||
CASE
|
||||
WHEN b.level = 4 THEN 3
|
||||
WHEN b.level = 5 THEN 3
|
||||
WHEN b.level = 6 THEN 2
|
||||
WHEN b.level = 7 THEN 1
|
||||
ELSE b.LEVEL
|
||||
END AS level,
|
||||
b.location location,
|
||||
c.dev_type devType,
|
||||
b.land_point landPoint
|
||||
b.land_point landPoint,
|
||||
b.advance_reason advanceReason,
|
||||
b.advance_type advanceType,
|
||||
b.sag_source sagSource
|
||||
<if test="csEventUserQueryPage != null and csEventUserQueryPage.type != null and csEventUserQueryPage.type != '' and csEventUserQueryPage.type ==0">
|
||||
,d.NAME lineName
|
||||
</if>
|
||||
@@ -207,10 +154,15 @@
|
||||
</if>
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">
|
||||
AND b.level IN
|
||||
<foreach collection="csEventUserQueryPage.level.split(',')" item="level" open="(" separator="," close=")">
|
||||
#{level}
|
||||
</foreach>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level == 1 ">
|
||||
AND b.level IN (1,7)
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level == 2 ">
|
||||
AND b.level IN (2,6)
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level == 3 ">
|
||||
AND b.level IN (3)
|
||||
</if>
|
||||
</if>
|
||||
<choose>
|
||||
<when test="csEventUserQueryPage!=null and csEventUserQueryPage.sortField != null">
|
||||
@@ -239,11 +191,54 @@
|
||||
<select id="queryEventPageWeb" resultType="com.njcn.csharmonic.pojo.vo.EventDetailVO">
|
||||
select DISTINCT b.id id,
|
||||
b.device_id deviceId,b.line_id lineId,b.code code,
|
||||
b.start_time startTime,b.tag tag ,b.wave_path wavePath,b.instant_pics,b.rms_pics , b.type type,b.level level,b.location location,b.cl_did clDid
|
||||
,d.name lineName
|
||||
b.start_time startTime,b.tag tag ,b.wave_path wavePath,b.instant_pics,b.rms_pics , b.type type,
|
||||
CASE
|
||||
WHEN b.level = 4 THEN 3
|
||||
WHEN b.level = 5 THEN 3
|
||||
WHEN b.level = 6 THEN 2
|
||||
WHEN b.level = 7 THEN 1
|
||||
ELSE b.level
|
||||
END AS level,
|
||||
b.location location,b.cl_did clDid
|
||||
,d.name lineName,b.advance_reason advanceReason,b.advance_type advanceType,b.sag_source sagSource,e.dev_type devType,b.severity severity,e.ndid nDid
|
||||
from cs_event b
|
||||
left join cs_line d on d.line_id=b.line_id
|
||||
left join cs_equipment_delivery e on b.device_id = e.id
|
||||
where 1=1
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.evtParamTmMin != null and csEventUserQueryPage.evtParamTmMin !=''">
|
||||
AND b.persist_time > #{csEventUserQueryPage.evtParamTmMin}
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.evtParamTmMax != null and csEventUserQueryPage.evtParamTmMax !=''">
|
||||
AND b.persist_time < #{csEventUserQueryPage.evtParamTmMax}
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.featureAmplitudeMin != null and csEventUserQueryPage.featureAmplitudeMin !=''">
|
||||
AND b.amplitude > #{csEventUserQueryPage.featureAmplitudeMin}
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.featureAmplitudeMax != null and csEventUserQueryPage.featureAmplitudeMax !=''">
|
||||
AND b.amplitude < #{csEventUserQueryPage.featureAmplitudeMax}
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.severityMin != null and csEventUserQueryPage.severityMin !=''">
|
||||
AND b.severity > #{csEventUserQueryPage.severityMin}
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.severityMax != null and csEventUserQueryPage.severityMax !=''">
|
||||
AND b.severity < #{csEventUserQueryPage.severityMax}
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.searchValue != null and csEventUserQueryPage.searchValue !=''">
|
||||
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type == 3 ">
|
||||
AND e.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
||||
</if>
|
||||
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type != 3 ">
|
||||
AND d.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
||||
</if>
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag != null">
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag == 0 ">
|
||||
AND b.wave_path is null
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag == 1 ">
|
||||
AND b.wave_path is not null
|
||||
</if>
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.endTime != null and csEventUserQueryPage.endTime !=''">
|
||||
AND DATE(b.start_time) <= DATE(#{csEventUserQueryPage.endTime})
|
||||
</if>
|
||||
@@ -262,23 +257,121 @@
|
||||
</foreach>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != null and csEventUserQueryPage.type !=''">
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type == 3 ">
|
||||
AND b.type in(2,3)
|
||||
AND b.type in (2,3) and b.level in (1,2,3,6,7)
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != 3 ">
|
||||
AND b.type =#{ csEventUserQueryPage.type}
|
||||
AND b.type =#{ csEventUserQueryPage.type}
|
||||
</if>
|
||||
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">
|
||||
AND b.level IN
|
||||
<foreach collection="csEventUserQueryPage.level.split(',')" item="level" open="(" separator="," close=")">
|
||||
#{level}
|
||||
</foreach>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level == 1 ">
|
||||
AND b.level IN (1,7)
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level == 2 ">
|
||||
AND b.level IN (2,6)
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level == 3 ">
|
||||
AND b.level IN (3)
|
||||
</if>
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.eventType != null and csEventUserQueryPage.eventType !=''">
|
||||
AND b.tag = #{csEventUserQueryPage.eventType}
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.location != null and csEventUserQueryPage.location !=''">
|
||||
AND b.location = #{csEventUserQueryPage.location}
|
||||
</if>
|
||||
order by b.start_time desc
|
||||
</select>
|
||||
|
||||
<select id="queryEventPageWebDvr" resultType="com.njcn.csharmonic.pojo.vo.EventDetailVO">
|
||||
select DISTINCT b.id id,
|
||||
b.device_id deviceId,b.line_id lineId,b.code code,
|
||||
b.start_time startTime,b.tag tag ,b.wave_path wavePath,b.instant_pics,b.rms_pics , b.type type,
|
||||
CASE
|
||||
WHEN b.level = 4 THEN 3
|
||||
WHEN b.level = 5 THEN 3
|
||||
WHEN b.level = 6 THEN 2
|
||||
WHEN b.level = 7 THEN 1
|
||||
ELSE b.level
|
||||
END AS level,
|
||||
b.location location,b.cl_did clDid
|
||||
,d.name lineName,b.advance_reason advanceReason,b.advance_type advanceType,b.sag_source sagSource,e.dev_type devType,b.severity severity,e.ndid nDid
|
||||
from cs_event b
|
||||
left join cs_line d on d.line_id=b.line_id
|
||||
left join cs_equipment_delivery e on b.device_id = e.id
|
||||
where 1=1
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.evtParamTmMin != null and csEventUserQueryPage.evtParamTmMin !=''">
|
||||
AND b.persist_time > #{csEventUserQueryPage.evtParamTmMin}
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.evtParamTmMax != null and csEventUserQueryPage.evtParamTmMax !=''">
|
||||
AND b.persist_time < #{csEventUserQueryPage.evtParamTmMax}
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.featureAmplitudeMin != null and csEventUserQueryPage.featureAmplitudeMin !=''">
|
||||
AND b.amplitude > #{csEventUserQueryPage.featureAmplitudeMin}
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.featureAmplitudeMax != null and csEventUserQueryPage.featureAmplitudeMax !=''">
|
||||
AND b.amplitude < #{csEventUserQueryPage.featureAmplitudeMax}
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.severityMin != null and csEventUserQueryPage.severityMin !=''">
|
||||
AND b.severity > #{csEventUserQueryPage.severityMin}
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.severityMax != null and csEventUserQueryPage.severityMax !=''">
|
||||
AND b.severity < #{csEventUserQueryPage.severityMax}
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.searchValue != null and csEventUserQueryPage.searchValue !=''">
|
||||
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type == 3 ">
|
||||
AND e.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
||||
</if>
|
||||
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type != 3 ">
|
||||
AND d.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
|
||||
</if>
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag != null">
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag == 0 ">
|
||||
AND b.wave_path is null
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.fileFlag == 1 ">
|
||||
AND b.wave_path is not null
|
||||
</if>
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.endTime != null and csEventUserQueryPage.endTime !=''">
|
||||
AND DATE(b.start_time) <= DATE(#{csEventUserQueryPage.endTime})
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.startTime != null and csEventUserQueryPage.startTime !=''">
|
||||
AND DATE(b.start_time) >= DATE(#{csEventUserQueryPage.startTime})
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.target != null and csEventUserQueryPage.target.size()>0">
|
||||
and b.tag in
|
||||
<foreach collection="csEventUserQueryPage.target" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
and b.line_id in
|
||||
<foreach collection="lineIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != null and csEventUserQueryPage.type !=''">
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type == 3 ">
|
||||
AND b.type in (2,3) and b.level in (1,2,3,6,7)
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != 3 ">
|
||||
AND b.type =#{ csEventUserQueryPage.type}
|
||||
</if>
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level == 1 ">
|
||||
AND b.level IN (1,7)
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level == 2 ">
|
||||
AND b.level IN (2,6)
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level == 3 ">
|
||||
AND b.level IN (3)
|
||||
</if>
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.eventType != null and csEventUserQueryPage.eventType !=''">
|
||||
AND b.tag = #{csEventUserQueryPage.eventType}
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.location != null and csEventUserQueryPage.location !=''">
|
||||
AND b.location = #{csEventUserQueryPage.location}
|
||||
</if>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user