Compare commits
29 Commits
6bb9d932b8
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 16c0620dd3 | |||
| cf691db0a6 | |||
| a6f424025a | |||
| f81be47e5f | |||
| 202888ca14 | |||
| 94929e66d5 | |||
| 4d5950d5ad | |||
| ff7b05bbb6 | |||
| ea2962840c | |||
| 1d8d714d66 | |||
| 23574f0819 | |||
| a82ea6b217 | |||
| 16724d7d79 | |||
| aa36c077f2 | |||
| 82e5d6c8e2 | |||
| 76000e4fff | |||
| 57cb6a2900 | |||
| 3990ad2b9a | |||
| a054a20e8a | |||
| db2821347d | |||
|
|
058229e8c4 | ||
| 13b9981c72 | |||
| e364ca1cae | |||
| 8b183d84e9 | |||
|
|
895755b7e1 | ||
|
|
87b91382a8 | ||
|
|
3df7d91e4c | ||
|
|
ae220ceeea | ||
|
|
00ccff18c0 |
@@ -59,6 +59,11 @@
|
|||||||
<version>4.4.0</version>
|
<version>4.4.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.paho</groupId>
|
||||||
|
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||||
|
<version>1.2.5</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import com.njcn.csdevice.api.fallback.CsEdDataFeignClientFallbackFactory;
|
|||||||
import com.njcn.csdevice.pojo.po.CsEdDataPO;
|
import com.njcn.csdevice.pojo.po.CsEdDataPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
|
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
@@ -14,7 +16,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* @author xy
|
* @author xy
|
||||||
*/
|
*/
|
||||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/edData", fallbackFactory = CsEdDataFeignClientFallbackFactory.class,contextId = "edData")
|
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/edData", fallbackFactory = CsEdDataFeignClientFallbackFactory.class, contextId = "edData")
|
||||||
public interface CsEdDataFeignClient {
|
public interface CsEdDataFeignClient {
|
||||||
|
|
||||||
@PostMapping("/findByDevTypeId")
|
@PostMapping("/findByDevTypeId")
|
||||||
@@ -22,4 +24,7 @@ public interface CsEdDataFeignClient {
|
|||||||
|
|
||||||
@PostMapping("/getAll")
|
@PostMapping("/getAll")
|
||||||
HttpResult<List<CsEdDataPO>> getAll(@RequestParam("devType") String devType);
|
HttpResult<List<CsEdDataPO>> getAll(@RequestParam("devType") String devType);
|
||||||
|
|
||||||
|
@GetMapping("/getById")
|
||||||
|
HttpResult<CsEdDataPO> getById(@RequestParam("id") String id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
package com.njcn.csdevice.api;
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
|
||||||
import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
||||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
|
|||||||
@@ -4,9 +4,12 @@ import com.njcn.common.pojo.constant.ServerInfo;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.fallback.CsLineTopologyClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.CsLineTopologyClientFallbackFactory;
|
||||||
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -19,4 +22,8 @@ public interface CsLineTopologyFeignClient {
|
|||||||
@PostMapping("/addList")
|
@PostMapping("/addList")
|
||||||
HttpResult<String> addList(@RequestBody List<AppLineTopologyDiagramPO> list);
|
HttpResult<String> addList(@RequestBody List<AppLineTopologyDiagramPO> list);
|
||||||
|
|
||||||
|
@PostMapping("/queryTopologyDiagram")
|
||||||
|
@ApiOperation("查询装置拓扑图")
|
||||||
|
HttpResult<AppTopologyDiagramVO> queryTopologyDiagram(@RequestParam(value="devId") String devId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.api.fallback.CsUpgradeLogsClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsUpgradeLogs;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2026-04-23
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csUpgradeLogs", fallbackFactory = CsUpgradeLogsClientFallbackFactory.class,contextId = "csSoftInfo")
|
||||||
|
public interface CsUpgradeLogsFeignClient {
|
||||||
|
@PostMapping("/add")
|
||||||
|
HttpResult add(@RequestBody CsUpgradeLogs csUpgradeLogs);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import com.njcn.common.pojo.constant.ServerInfo;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.fallback.DeviceMessageClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.DeviceMessageClientFallbackFactory;
|
||||||
import com.njcn.csdevice.param.DeviceMessageParam;
|
import com.njcn.csdevice.param.DeviceMessageParam;
|
||||||
|
import com.njcn.csdevice.param.LineInfoParam;
|
||||||
import com.njcn.user.pojo.po.User;
|
import com.njcn.user.pojo.po.User;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
@@ -29,6 +30,6 @@ public interface DeviceMessageFeignClient {
|
|||||||
|
|
||||||
@PostMapping("/getLineInfo")
|
@PostMapping("/getLineInfo")
|
||||||
@ApiOperation("获取监测点信息")
|
@ApiOperation("获取监测点信息")
|
||||||
HttpResult<String> getLineInfo(@RequestParam("id") String id);
|
HttpResult<String> getLineInfo(@RequestBody LineInfoParam param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
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.SmsSendClientFallbackFactory;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xy
|
|
||||||
*/
|
|
||||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/sms", fallbackFactory = SmsSendClientFallbackFactory.class,contextId = "sms")
|
|
||||||
public interface SmsSendFeignClient {
|
|
||||||
|
|
||||||
@PostMapping("/send/simple")
|
|
||||||
@ApiOperation("发送短信(简化参数)")
|
|
||||||
HttpResult<String> sendSmsSimple(@RequestParam("receiver") String receiver
|
|
||||||
, @RequestParam("content") String content
|
|
||||||
, @RequestParam("messageType") String messageType);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -39,6 +39,12 @@ public class CsEdDataFeignClientFallbackFactory implements FallbackFactory<CsEdD
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据装置型号获取装置类型",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据装置型号获取装置类型",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<CsEdDataPO> getById(String id) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据id获取装置类型",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.CsLineTopologyFeignClient;
|
import com.njcn.csdevice.api.CsLineTopologyFeignClient;
|
||||||
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -33,6 +34,12 @@ public class CsLineTopologyClientFallbackFactory implements FallbackFactory<CsLi
|
|||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<AppTopologyDiagramVO> queryTopologyDiagram(String devId) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","查询装置拓扑图异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,30 +3,32 @@ package com.njcn.csdevice.api.fallback;
|
|||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.SmsSendFeignClient;
|
import com.njcn.csdevice.api.CsUpgradeLogsFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsUpgradeLogs;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xy
|
* @author caozehui
|
||||||
|
* @data 2026-04-23
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class SmsSendClientFallbackFactory implements FallbackFactory<SmsSendFeignClient> {
|
public class CsUpgradeLogsClientFallbackFactory implements FallbackFactory<CsUpgradeLogsFeignClient> {
|
||||||
@Override
|
@Override
|
||||||
public SmsSendFeignClient create(Throwable cause) {
|
public CsUpgradeLogsFeignClient create(Throwable cause) {
|
||||||
//判断抛出异常是否为解码器抛出的业务异常
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
if (cause.getCause() instanceof BusinessException) {
|
if (cause.getCause() instanceof BusinessException) {
|
||||||
BusinessException businessException = (BusinessException) cause.getCause();
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
}
|
}
|
||||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
return new SmsSendFeignClient() {
|
|
||||||
|
|
||||||
|
return new CsUpgradeLogsFeignClient() {
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<String> sendSmsSimple(String receiver, String content, String messageType) {
|
public HttpResult add(CsUpgradeLogs csUpgradeLogs) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","发送短信(简化参数)数据异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}", "新增升级日志异常", cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -5,6 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.DeviceMessageFeignClient;
|
import com.njcn.csdevice.api.DeviceMessageFeignClient;
|
||||||
import com.njcn.csdevice.param.DeviceMessageParam;
|
import com.njcn.csdevice.param.DeviceMessageParam;
|
||||||
|
import com.njcn.csdevice.param.LineInfoParam;
|
||||||
import com.njcn.user.pojo.po.User;
|
import com.njcn.user.pojo.po.User;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -41,7 +42,7 @@ public class DeviceMessageClientFallbackFactory implements FallbackFactory<Devic
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<String> getLineInfo(String id) {
|
public HttpResult<String> getLineInfo(LineInfoParam param) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","获取监测点信息数据异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","获取监测点信息数据异常",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,4 +21,7 @@ public class IcdBzParam implements Serializable {
|
|||||||
@ApiModelProperty("结束时间")
|
@ApiModelProperty("结束时间")
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("补召类型 0:稳态 1:暂态事件 2:波形)")
|
||||||
|
private Integer bzType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.csdevice.param;
|
||||||
|
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LineInfoParam {
|
||||||
|
|
||||||
|
@ApiModelProperty("nDid")
|
||||||
|
private String nDid;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点集合")
|
||||||
|
List<CsLinePO> list;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.njcn.csdevice.pojo.dto;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author caozehui
|
|
||||||
* @data 2026-03-31
|
|
||||||
*/
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统凭证请求 DTO
|
|
||||||
*
|
|
||||||
* @author msgpush
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class CredentialReqDTO implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上游系统名称
|
|
||||||
*/
|
|
||||||
@NotEmpty(message = "上游系统名称不能为空")
|
|
||||||
private String systemName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 密钥(用于生成凭证)
|
|
||||||
*/
|
|
||||||
@NotEmpty(message = "密钥不能为空")
|
|
||||||
private String secretKey;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -115,4 +115,9 @@ public class CsEquipmentDeliveryDTO {
|
|||||||
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
|
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
|
||||||
*/
|
*/
|
||||||
private String devLogLevel;
|
private String devLogLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备软件信息id
|
||||||
|
*/
|
||||||
|
private String softinfoId;
|
||||||
}
|
}
|
||||||
@@ -40,6 +40,9 @@ public class DevDetailDTO {
|
|||||||
@ApiModelProperty(value = "设备MAC地址")
|
@ApiModelProperty(value = "设备MAC地址")
|
||||||
private String devMac;
|
private String devMac;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "nDid")
|
||||||
|
private String nDid;
|
||||||
|
|
||||||
@ApiModelProperty(value = "监测点id集合")
|
@ApiModelProperty(value = "监测点id集合")
|
||||||
private List<String> lineList;
|
private List<String> lineList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,5 +44,6 @@ public class AppLineTopologyDiagramParm extends BaseEntity {
|
|||||||
|
|
||||||
private Double lat;
|
private Double lat;
|
||||||
|
|
||||||
|
private String target;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -106,4 +106,9 @@ public class CsEquipmentDeliveryAddParm implements Serializable {
|
|||||||
@ApiModelProperty(value="所属项目")
|
@ApiModelProperty(value="所属项目")
|
||||||
private String associatedProject;
|
private String associatedProject;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="icd")
|
||||||
|
private String icd;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="是否支持升级(0:否 1:是)")
|
||||||
|
private Integer upgrade;
|
||||||
}
|
}
|
||||||
@@ -110,4 +110,10 @@ public class CsEquipmentDeliveryAuditParm {
|
|||||||
|
|
||||||
@ApiModelProperty(value="所属项目")
|
@ApiModelProperty(value="所属项目")
|
||||||
private String associatedProject;
|
private String associatedProject;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="icd")
|
||||||
|
private String icd;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="是否支持升级(0:否 1:是)")
|
||||||
|
private Integer upgrade;
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.pojo.param;
|
|||||||
|
|
||||||
import com.njcn.web.pojo.param.BaseParam;
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@@ -40,4 +41,9 @@ public class CsEquipmentDeliveryQueryParm extends BaseParam {
|
|||||||
@ApiModelProperty("物联通讯状态 0:未连接 1:已连接")
|
@ApiModelProperty("物联通讯状态 0:未连接 1:已连接")
|
||||||
private Integer connectStatus;
|
private Integer connectStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty("ICD")
|
||||||
|
private String icd;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否支持升级(0:否 1:是)")
|
||||||
|
private Integer upgrade;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.njcn.csdevice.pojo.param;
|
||||||
|
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2026-04-07
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class DevVersionParam extends BaseParam {
|
||||||
|
private String keyword;
|
||||||
|
}
|
||||||
@@ -45,5 +45,7 @@ public class AppLineTopologyDiagramPO extends BaseEntity {
|
|||||||
@TableField(value = "lat")
|
@TableField(value = "lat")
|
||||||
private Double lat;
|
private Double lat;
|
||||||
|
|
||||||
|
@TableField(value = "target")
|
||||||
|
private String target;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.csdevice.pojo.po;
|
package com.njcn.csdevice.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.njcn.db.bo.BaseEntity;
|
import com.njcn.db.bo.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -43,6 +44,12 @@ public class CsDataArray extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String anotherName;
|
private String anotherName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* influxdb 存储的名称
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String influxDbName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典序号
|
* 字典序号
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ import com.njcn.db.bo.BaseEntity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Description:
|
* Description:
|
||||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
* Date: 2023/4/7 11:29【需求编号】
|
* Date: 2023/4/7 11:29【需求编号】
|
||||||
@@ -62,7 +61,7 @@ public class CsEdDataPO extends BaseEntity {
|
|||||||
* 版本日期
|
* 版本日期
|
||||||
*/
|
*/
|
||||||
@TableField(value = "version_date")
|
@TableField(value = "version_date")
|
||||||
private Date versionDate;
|
private LocalDateTime versionDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述
|
* 描述
|
||||||
@@ -95,5 +94,4 @@ public class CsEdDataPO extends BaseEntity {
|
|||||||
private String crc;
|
private String crc;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -148,4 +148,14 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
|
|||||||
@TableField(value = "associated_project")
|
@TableField(value = "associated_project")
|
||||||
private String associatedProject;
|
private String associatedProject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* icd模型
|
||||||
|
*/
|
||||||
|
@TableField(value = "icd")
|
||||||
|
private String icd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否支持升级(0:否 1:是)
|
||||||
|
*/
|
||||||
|
private Integer upgrade;
|
||||||
}
|
}
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
package com.njcn.csdevice.pojo.po;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@TableName("cs_sms_send_record")
|
|
||||||
public class CsSmsSendRecord implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
private String receiver;
|
|
||||||
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
private String messageType;
|
|
||||||
|
|
||||||
private String credentialToken;
|
|
||||||
|
|
||||||
private Integer sendStatus;
|
|
||||||
|
|
||||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
|
||||||
private String failReason;
|
|
||||||
|
|
||||||
private Integer retryCount;
|
|
||||||
|
|
||||||
private Integer maxRetry;
|
|
||||||
|
|
||||||
private Long responseTime;
|
|
||||||
|
|
||||||
private LocalDateTime sendTime;
|
|
||||||
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
private LocalDateTime updateTime;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.njcn.csdevice.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2026-04-23
|
||||||
|
* @description 设备升级日志
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "cs_upgrade_logs")
|
||||||
|
public class CsUpgradeLogs {
|
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
@TableField(value = "dev_id")
|
||||||
|
private String devId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号
|
||||||
|
*/
|
||||||
|
@TableField(value = "version_no")
|
||||||
|
private String versionNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 升级结果(0:失败 1:成功)
|
||||||
|
*/
|
||||||
|
private Integer result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "user_name")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "login_name")
|
||||||
|
private String loginName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建用户
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT, insertStrategy = FieldStrategy.IGNORED)
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT, insertStrategy = FieldStrategy.IGNORED)
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE, insertStrategy = FieldStrategy.IGNORED)
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE, insertStrategy = FieldStrategy.IGNORED)
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.njcn.csdevice.pojo.vo;
|
package com.njcn.csdevice.pojo.vo;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.njcn.db.bo.BaseEntity;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,5 +41,6 @@ public class AppLineTopologyDiagramVO {
|
|||||||
|
|
||||||
private String linePostion;
|
private String linePostion;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="绑定的指标")
|
||||||
|
private String target;
|
||||||
}
|
}
|
||||||
@@ -70,12 +70,11 @@ public class CsEdDataVO extends BaseEntity {
|
|||||||
@ApiModelProperty(value = "版本类型")
|
@ApiModelProperty(value = "版本类型")
|
||||||
private String versionType;
|
private String versionType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "crc信息")
|
|
||||||
private String crcInfo;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = ".bin文件")
|
@ApiModelProperty(value = ".bin文件")
|
||||||
private String filePath;
|
private String filePath;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "CRC校验")
|
||||||
|
private String crc;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -71,4 +71,7 @@ public class DevCountVO implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "反馈数")
|
@ApiModelProperty(value = "反馈数")
|
||||||
private Integer feedBackCount = 0;
|
private Integer feedBackCount = 0;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "当前工程监测点数")
|
||||||
|
private Integer lineCount = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
package com.njcn.csdevice.pojo.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2026-04-07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DevVersionVO {
|
||||||
|
/**
|
||||||
|
* 设备Id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号
|
||||||
|
*/
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 协议版本号
|
||||||
|
*/
|
||||||
|
private String protocolVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime versionDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备型号
|
||||||
|
*/
|
||||||
|
private String devModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型名称
|
||||||
|
*/
|
||||||
|
private String devModelName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* icd型号
|
||||||
|
*/
|
||||||
|
private String icd;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属工程
|
||||||
|
*/
|
||||||
|
private String associatedEngineering;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属项目
|
||||||
|
*/
|
||||||
|
private String associatedProject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置启用状态(0:停用 1:启用)
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人员
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人名称
|
||||||
|
*/
|
||||||
|
private String updateByName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备运行状态(0:删除 1:离线 2:在线)
|
||||||
|
*/
|
||||||
|
private Integer runStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否支持升级(0:否 1:是)
|
||||||
|
*/
|
||||||
|
private Integer upgrade;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备与MQTT服务器连接状态 (0:未连接 1:已连接)
|
||||||
|
*/
|
||||||
|
private Integer connectStatus;
|
||||||
|
}
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package com.njcn.csdevice.pojo.vo;
|
|
||||||
|
|
||||||
import cn.hutool.core.lang.RegexPool;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.Pattern;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author caozehui
|
|
||||||
* @data 2026-02-27
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Schema(description = "管理后台 - 消息记录发送 Request VO")
|
|
||||||
public class MessageRecordReqVO {
|
|
||||||
|
|
||||||
private String channel;
|
|
||||||
|
|
||||||
@Schema(description = "消息类型", example = "verify_code/order_notify/marketing/system_notify")
|
|
||||||
@NotBlank(message = "消息类型不能为空")
|
|
||||||
private String messageType;
|
|
||||||
|
|
||||||
@Schema(description = "接收者")
|
|
||||||
@NotBlank(message = "接收者不能为空")
|
|
||||||
@Pattern(regexp = RegexPool.EMAIL + "|" + RegexPool.MOBILE, message = "必须是有效的邮箱或手机号格式")
|
|
||||||
private String receiver;
|
|
||||||
|
|
||||||
@Schema(description = "标题")
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
@Schema(description = "消息内容")
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
@Schema(description = "模板编码")
|
|
||||||
private String templateCode;
|
|
||||||
|
|
||||||
@Schema(description = "模板参数")
|
|
||||||
private String templateParams;
|
|
||||||
}
|
|
||||||
@@ -167,6 +167,11 @@
|
|||||||
<artifactId>message-api</artifactId>
|
<artifactId>message-api</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>event-common</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -101,7 +100,6 @@ public class CsDataArrayController extends BaseController {
|
|||||||
@PostMapping("/findListByParam")
|
@PostMapping("/findListByParam")
|
||||||
@ApiOperation("根据条件查询详细数据")
|
@ApiOperation("根据条件查询详细数据")
|
||||||
@ApiImplicitParam(name = "param", value = "参数集合", required = true)
|
@ApiImplicitParam(name = "param", value = "参数集合", required = true)
|
||||||
@ApiIgnore
|
|
||||||
public HttpResult<List<CsDataArray>> findListByParam(@RequestBody DataArrayParam param){
|
public HttpResult<List<CsDataArray>> findListByParam(@RequestBody DataArrayParam param){
|
||||||
String methodDescribe = getMethodDescribe("findListByParam");
|
String methodDescribe = getMethodDescribe("findListByParam");
|
||||||
List<CsDataArray> list = csDataArrayService.findListByParam(param);
|
List<CsDataArray> list = csDataArrayService.findListByParam(param);
|
||||||
|
|||||||
@@ -66,7 +66,5 @@ public class CsSoftInfoController extends BaseController {
|
|||||||
csSoftInfoService.removeById(id);
|
csSoftInfoService.removeById(id);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.njcn.csdevice.controller.equipment;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
|
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.CsUpgradeLogs;
|
||||||
|
import com.njcn.csdevice.service.CsUpgradeLogsService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import com.njcn.web.utils.RequestUtil;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2026-04-23
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/csUpgradeLogs")
|
||||||
|
@Api(tags = "装置升级日志")
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Validated
|
||||||
|
public class CsUpgradeLogsController extends BaseController {
|
||||||
|
private final CsUpgradeLogsService csUpgradeLogsService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ApiOperation("新增升级日志")
|
||||||
|
@ApiImplicitParam(name = "csUpgradeLogs", value = "日志参数", required = true)
|
||||||
|
public HttpResult add(@RequestBody CsUpgradeLogs csUpgradeLogs) {
|
||||||
|
csUpgradeLogs.setUserName(RequestUtil.getUsername());
|
||||||
|
csUpgradeLogs.setLoginName(RequestUtil.getLoginName());
|
||||||
|
String methodDescribe = getMethodDescribe("add");
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(csUpgradeLogsService.save(csUpgradeLogs) ? CommonResponseEnum.SUCCESS : CommonResponseEnum.FAIL, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||||
|
@GetMapping("/getByDevId")
|
||||||
|
@ApiOperation("查询指定devId的所有升级日志")
|
||||||
|
@ApiImplicitParam(name = "devId", value = "装置Id", required = true)
|
||||||
|
public HttpResult<List<CsUpgradeLogs>> getByDevId(@RequestBody String devId) {
|
||||||
|
String methodDescribe = getMethodDescribe("getByDevId");
|
||||||
|
List<CsUpgradeLogs> result = csUpgradeLogsService.lambdaQuery().eq(CsUpgradeLogs::getDevId, devId).list();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,6 +23,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description:
|
* Description:
|
||||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
@@ -45,9 +47,9 @@ public class DevModelController extends BaseController {
|
|||||||
@ApiOperation("新增设备模板")
|
@ApiOperation("新增设备模板")
|
||||||
@ApiImplicitParam(name = "csDevModelAddParm", value = "新增设备模板参数", required = true)
|
@ApiImplicitParam(name = "csDevModelAddParm", value = "新增设备模板参数", required = true)
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public HttpResult<CsDevModelPO> addDevModel(@RequestBody @Validated CsDevModelAddParm csDevModelAddParm){
|
public HttpResult<CsDevModelPO> addDevModel(@RequestBody @Validated CsDevModelAddParm csDevModelAddParm) {
|
||||||
String methodDescribe = getMethodDescribe("addDevModel");
|
String methodDescribe = getMethodDescribe("addDevModel");
|
||||||
CsDevModelPO flag = csDevModelService.addDevModel (csDevModelAddParm);
|
CsDevModelPO flag = csDevModelService.addDevModel(csDevModelAddParm);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +58,7 @@ public class DevModelController extends BaseController {
|
|||||||
@PostMapping("/AuditDevModel")
|
@PostMapping("/AuditDevModel")
|
||||||
@ApiOperation("更新/删除设备模板参数")
|
@ApiOperation("更新/删除设备模板参数")
|
||||||
@ApiImplicitParam(name = "csDevModelAuditParm", value = "更新/删除设备模板参数", required = true)
|
@ApiImplicitParam(name = "csDevModelAuditParm", value = "更新/删除设备模板参数", required = true)
|
||||||
public HttpResult<Boolean> AuditDevModel(@RequestBody @Validated CsDevModelAuditParm csDevModelAuditParm ){
|
public HttpResult<Boolean> AuditDevModel(@RequestBody @Validated CsDevModelAuditParm csDevModelAuditParm) {
|
||||||
String methodDescribe = getMethodDescribe("AuditDevModel");
|
String methodDescribe = getMethodDescribe("AuditDevModel");
|
||||||
|
|
||||||
Boolean flag = csDevModelService.AuditDevModel(csDevModelAuditParm);
|
Boolean flag = csDevModelService.AuditDevModel(csDevModelAuditParm);
|
||||||
@@ -64,15 +66,14 @@ public class DevModelController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/queryDevModelPage")
|
@PostMapping("/queryDevModelPage")
|
||||||
@ApiOperation("设备模板分页查询")
|
@ApiOperation("设备模板分页查询")
|
||||||
@ApiImplicitParam(name = "csDevModelQueryParm", value = "设备模板查询参数", required = true)
|
@ApiImplicitParam(name = "csDevModelQueryParm", value = "设备模板查询参数", required = true)
|
||||||
public HttpResult<IPage<CsDevModelPageVO>> queryDevModelPage(@RequestBody @Validated CsDevModelQueryParm csDevModelQueryParm ){
|
public HttpResult<IPage<CsDevModelPageVO>> queryDevModelPage(@RequestBody @Validated CsDevModelQueryParm csDevModelQueryParm) {
|
||||||
String methodDescribe = getMethodDescribe("queryDevModelPage");
|
String methodDescribe = getMethodDescribe("queryDevModelPage");
|
||||||
|
|
||||||
IPage<CsDevModelPageVO> page = csDevModelService.queryPage (csDevModelQueryParm);
|
IPage<CsDevModelPageVO> page = csDevModelService.queryPage(csDevModelQueryParm);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +81,7 @@ public class DevModelController extends BaseController {
|
|||||||
@PostMapping("/queryDevModelOne")
|
@PostMapping("/queryDevModelOne")
|
||||||
@ApiOperation("设备模板查询")
|
@ApiOperation("设备模板查询")
|
||||||
@ApiImplicitParam(name = "csDevModelQueryListParm", value = "设备模板信息", required = true)
|
@ApiImplicitParam(name = "csDevModelQueryListParm", value = "设备模板信息", required = true)
|
||||||
public HttpResult<CsDevModelPageVO> queryDevModelOne(@RequestBody CsDevModelQueryListParm csDevModelQueryListParm){
|
public HttpResult<CsDevModelPageVO> queryDevModelOne(@RequestBody CsDevModelQueryListParm csDevModelQueryListParm) {
|
||||||
String methodDescribe = getMethodDescribe("queryDevModelOne");
|
String methodDescribe = getMethodDescribe("queryDevModelOne");
|
||||||
|
|
||||||
CsDevModelPageVO csDevModelPageVO = csDevModelService.queryDevModelOne(csDevModelQueryListParm);
|
CsDevModelPageVO csDevModelPageVO = csDevModelService.queryDevModelOne(csDevModelQueryListParm);
|
||||||
@@ -95,9 +96,9 @@ public class DevModelController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "version", value = "版本", required = true),
|
@ApiImplicitParam(name = "version", value = "版本", required = true),
|
||||||
@ApiImplicitParam(name = "time", value = "时间", required = true)
|
@ApiImplicitParam(name = "time", value = "时间", required = true)
|
||||||
})
|
})
|
||||||
public HttpResult<CsDevModelPO> findModel(@RequestParam("devType") String devType,@RequestParam("version") String version,@RequestParam("time") String time){
|
public HttpResult<CsDevModelPO> findModel(@RequestParam("devType") String devType, @RequestParam("version") String version, @RequestParam("time") String time) {
|
||||||
String methodDescribe = getMethodDescribe("findModel");
|
String methodDescribe = getMethodDescribe("findModel");
|
||||||
CsDevModelPO csDevModelPo = csDevModelService.findModel(devType,version,time);
|
CsDevModelPO csDevModelPo = csDevModelService.findModel(devType, version, time);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csDevModelPo, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csDevModelPo, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,10 +106,9 @@ public class DevModelController extends BaseController {
|
|||||||
@PostMapping("/getModelById")
|
@PostMapping("/getModelById")
|
||||||
@ApiOperation("根据模板Id获取模板数据")
|
@ApiOperation("根据模板Id获取模板数据")
|
||||||
@ApiImplicitParam(name = "id", value = "模板id", required = true)
|
@ApiImplicitParam(name = "id", value = "模板id", required = true)
|
||||||
public HttpResult<CsDevModelPO> getModelById(@RequestParam("id") String id){
|
public HttpResult<CsDevModelPO> getModelById(@RequestParam("id") String id) {
|
||||||
String methodDescribe = getMethodDescribe("getModelById");
|
String methodDescribe = getMethodDescribe("getModelById");
|
||||||
CsDevModelPO po = csDevModelService.getModelById(id);
|
CsDevModelPO po = csDevModelService.getModelById(id);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ import com.njcn.csdevice.enums.DeviceOperate;
|
|||||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.param.*;
|
import com.njcn.csdevice.pojo.param.*;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
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.CsEquipmentDeliveryVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DevVersionVO;
|
||||||
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||||
import com.njcn.csdevice.service.CsDevModelRelationService;
|
import com.njcn.csdevice.service.CsDevModelRelationService;
|
||||||
@@ -28,6 +30,7 @@ import com.njcn.system.enums.DicDataTypeEnum;
|
|||||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||||
import com.njcn.web.advice.DeviceLog;
|
import com.njcn.web.advice.DeviceLog;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -46,6 +49,7 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description:
|
* Description:
|
||||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
@@ -70,13 +74,13 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@ApiOperation("新增出厂设备")
|
@ApiOperation("新增出厂设备")
|
||||||
@ApiImplicitParam(name = "csEquipmentDeliveryAddParm", value = "新增项目参数", required = true)
|
@ApiImplicitParam(name = "csEquipmentDeliveryAddParm", value = "新增项目参数", required = true)
|
||||||
@DeviceLog(operateType = DeviceOperate.ADD)
|
@DeviceLog(operateType = DeviceOperate.ADD)
|
||||||
public HttpResult<CsEquipmentDeliveryPO> addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm){
|
public HttpResult<CsEquipmentDeliveryPO> addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||||
String methodDescribe = getMethodDescribe("addEquipmentDelivery");
|
String methodDescribe = getMethodDescribe("addEquipmentDelivery");
|
||||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.save(csEquipmentDeliveryAddParm);
|
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.save(csEquipmentDeliveryAddParm);
|
||||||
if (Objects.nonNull(po)){
|
if (Objects.nonNull(po)) {
|
||||||
//查询mqtt用户名和密码是否存在
|
//查询mqtt用户名和密码是否存在
|
||||||
boolean result = mqttUserService.findMqttUser(csEquipmentDeliveryAddParm.getNdid());
|
boolean result = mqttUserService.findMqttUser(csEquipmentDeliveryAddParm.getNdid());
|
||||||
if (result){
|
if (result) {
|
||||||
//初始化装置mqtt连接信息(使用sha256加密)
|
//初始化装置mqtt连接信息(使用sha256加密)
|
||||||
mqttUserService.insertMqttUser(csEquipmentDeliveryAddParm.getNdid());
|
mqttUserService.insertMqttUser(csEquipmentDeliveryAddParm.getNdid());
|
||||||
}
|
}
|
||||||
@@ -88,7 +92,7 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@PostMapping("/AuditEquipmentDelivery")
|
@PostMapping("/AuditEquipmentDelivery")
|
||||||
@ApiOperation("删除出厂设备")
|
@ApiOperation("删除出厂设备")
|
||||||
@DeviceLog(operateType = DeviceOperate.DELETE)
|
@DeviceLog(operateType = DeviceOperate.DELETE)
|
||||||
public HttpResult<Boolean> AuditEquipmentDelivery(@RequestParam("id")String id ){
|
public HttpResult<Boolean> AuditEquipmentDelivery(@RequestParam("id") String id) {
|
||||||
String methodDescribe = getMethodDescribe("AuditEquipmentDelivery");
|
String methodDescribe = getMethodDescribe("AuditEquipmentDelivery");
|
||||||
Boolean flag = csEquipmentDeliveryService.AuditEquipmentDelivery(id);
|
Boolean flag = csEquipmentDeliveryService.AuditEquipmentDelivery(id);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
@@ -99,13 +103,13 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@ApiOperation("修改出厂设备")
|
@ApiOperation("修改出厂设备")
|
||||||
@DeviceLog(operateType = DeviceOperate.UPDATE)
|
@DeviceLog(operateType = DeviceOperate.UPDATE)
|
||||||
@ApiImplicitParam(name = "csEquipmentDeliveryAuditParm", value = "新增项目参数", required = true)
|
@ApiImplicitParam(name = "csEquipmentDeliveryAuditParm", value = "新增项目参数", required = true)
|
||||||
public HttpResult<Boolean> updateEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm ){
|
public HttpResult<Boolean> updateEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm) {
|
||||||
String methodDescribe = getMethodDescribe("updateEquipmentDelivery");
|
String methodDescribe = getMethodDescribe("updateEquipmentDelivery");
|
||||||
Boolean flag = csEquipmentDeliveryService.updateEquipmentDelivery(csEquipmentDeliveryAuditParm);
|
Boolean flag = csEquipmentDeliveryService.updateEquipmentDelivery(csEquipmentDeliveryAuditParm);
|
||||||
if (flag){
|
if (flag) {
|
||||||
//查询mqtt用户名和密码是否存在
|
//查询mqtt用户名和密码是否存在
|
||||||
boolean result = mqttUserService.findMqttUser(csEquipmentDeliveryAuditParm.getNdid());
|
boolean result = mqttUserService.findMqttUser(csEquipmentDeliveryAuditParm.getNdid());
|
||||||
if (result){
|
if (result) {
|
||||||
//初始化装置mqtt连接信息(使用sha256加密)
|
//初始化装置mqtt连接信息(使用sha256加密)
|
||||||
mqttUserService.insertMqttUser(csEquipmentDeliveryAuditParm.getNdid());
|
mqttUserService.insertMqttUser(csEquipmentDeliveryAuditParm.getNdid());
|
||||||
}
|
}
|
||||||
@@ -117,9 +121,9 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@PostMapping("/queryEquipmentByndid")
|
@PostMapping("/queryEquipmentByndid")
|
||||||
@ApiOperation("通过ndid查询出厂设备")
|
@ApiOperation("通过ndid查询出厂设备")
|
||||||
@ApiImplicitParam(name = "ndid", value = "网关识别码", required = true)
|
@ApiImplicitParam(name = "ndid", value = "网关识别码", required = true)
|
||||||
public HttpResult<CsEquipmentDeliveryVO> queryEquipmentByndid(@RequestParam("ndid")String ndid){
|
public HttpResult<CsEquipmentDeliveryVO> queryEquipmentByndid(@RequestParam("ndid") String ndid) {
|
||||||
String methodDescribe = getMethodDescribe("queryEquipmentByndid");
|
String methodDescribe = getMethodDescribe("queryEquipmentByndid");
|
||||||
CsEquipmentDeliveryVO csEquipmentDeliveryVO = csEquipmentDeliveryService.queryEquipmentByndid (ndid);
|
CsEquipmentDeliveryVO csEquipmentDeliveryVO = csEquipmentDeliveryService.queryEquipmentByndid(ndid);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csEquipmentDeliveryVO, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csEquipmentDeliveryVO, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +131,7 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@PostMapping("/queryEquipmentByProject")
|
@PostMapping("/queryEquipmentByProject")
|
||||||
@ApiOperation("通过项目查询出厂设备")
|
@ApiOperation("通过项目查询出厂设备")
|
||||||
@ApiImplicitParam(name = "projectEquipmentQueryParm", value = "项目信息", required = true)
|
@ApiImplicitParam(name = "projectEquipmentQueryParm", value = "项目信息", required = true)
|
||||||
public HttpResult<IPage<ProjectEquipmentVO>> queryEquipmentByProject(@RequestBody ProjectEquipmentQueryParm projectEquipmentQueryParm){
|
public HttpResult<IPage<ProjectEquipmentVO>> queryEquipmentByProject(@RequestBody ProjectEquipmentQueryParm projectEquipmentQueryParm) {
|
||||||
String methodDescribe = getMethodDescribe("queryEquipmentByProject");
|
String methodDescribe = getMethodDescribe("queryEquipmentByProject");
|
||||||
IPage<ProjectEquipmentVO> projectEquipmentVos = csEquipmentDeliveryService.queryEquipmentByProject(projectEquipmentQueryParm);
|
IPage<ProjectEquipmentVO> projectEquipmentVos = csEquipmentDeliveryService.queryEquipmentByProject(projectEquipmentQueryParm);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, projectEquipmentVos, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, projectEquipmentVos, methodDescribe);
|
||||||
@@ -141,9 +145,9 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "status", value = "状态", required = true)
|
@ApiImplicitParam(name = "status", value = "状态", required = true)
|
||||||
})
|
})
|
||||||
@DeviceLog(operateType = DeviceOperate.UPDATESTATUSBYNDID)
|
@DeviceLog(operateType = DeviceOperate.UPDATESTATUSBYNDID)
|
||||||
public HttpResult<Boolean> updateStatusBynDid(@RequestParam("nDId") String nDid,@RequestParam("status") Integer status){
|
public HttpResult<Boolean> updateStatusBynDid(@RequestParam("nDId") String nDid, @RequestParam("status") Integer status) {
|
||||||
String methodDescribe = getMethodDescribe("updateStatusBynDid");
|
String methodDescribe = getMethodDescribe("updateStatusBynDid");
|
||||||
csEquipmentDeliveryService.updateStatusBynDid(nDid,status);
|
csEquipmentDeliveryService.updateStatusBynDid(nDid, status);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +155,7 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@PostMapping("/queryEquipmentById")
|
@PostMapping("/queryEquipmentById")
|
||||||
@ApiOperation("设备查询通过id获取")
|
@ApiOperation("设备查询通过id获取")
|
||||||
@ApiImplicitParam(name = "ids", value = "设备id集合", required = true)
|
@ApiImplicitParam(name = "ids", value = "设备id集合", required = true)
|
||||||
public HttpResult<List<CsEquipmentDeliveryDTO>> queryEquipmentById(@RequestParam List<String> ids){
|
public HttpResult<List<CsEquipmentDeliveryDTO>> queryEquipmentById(@RequestParam List<String> ids) {
|
||||||
String methodDescribe = getMethodDescribe("queryEquipmentById");
|
String methodDescribe = getMethodDescribe("queryEquipmentById");
|
||||||
if (CollectionUtil.isEmpty(ids)) {
|
if (CollectionUtil.isEmpty(ids)) {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
@@ -171,7 +175,7 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ApiOperation("出厂设备列表")
|
@ApiOperation("出厂设备列表")
|
||||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
public HttpResult<Page<CsEquipmentDeliveryVO>> list(@RequestBody CsEquipmentDeliveryQueryParm param){
|
public HttpResult<Page<CsEquipmentDeliveryVO>> list(@RequestBody CsEquipmentDeliveryQueryParm param) {
|
||||||
String methodDescribe = getMethodDescribe("list");
|
String methodDescribe = getMethodDescribe("list");
|
||||||
Page<CsEquipmentDeliveryVO> page = csEquipmentDeliveryService.list(param);
|
Page<CsEquipmentDeliveryVO> page = csEquipmentDeliveryService.list(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
@@ -185,9 +189,9 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "type", value = "类型", required = true),
|
@ApiImplicitParam(name = "type", value = "类型", required = true),
|
||||||
@ApiImplicitParam(name = "lineId", value = "监测点id", required = false)
|
@ApiImplicitParam(name = "lineId", value = "监测点id", required = false)
|
||||||
})
|
})
|
||||||
public HttpResult<DeviceManagerVO> getDeviceData(@RequestParam String deviceId,@RequestParam String type,@RequestParam String lineId){
|
public HttpResult<DeviceManagerVO> getDeviceData(@RequestParam String deviceId, @RequestParam String type, @RequestParam String lineId) {
|
||||||
String methodDescribe = getMethodDescribe("getDeviceData");
|
String methodDescribe = getMethodDescribe("getDeviceData");
|
||||||
DeviceManagerVO vo = csEquipmentDeliveryService.getDeviceData(deviceId,type,lineId);
|
DeviceManagerVO vo = csEquipmentDeliveryService.getDeviceData(deviceId, type, lineId);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,9 +204,9 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "module", value = "模块个数", required = true)
|
@ApiImplicitParam(name = "module", value = "模块个数", required = true)
|
||||||
})
|
})
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public HttpResult<Boolean> updateSoftInfoBynDid(@RequestParam("nDId") String nDid,@RequestParam("id") String id,@RequestParam("module") Integer module){
|
public HttpResult<Boolean> updateSoftInfoBynDid(@RequestParam("nDId") String nDid, @RequestParam("id") String id, @RequestParam("module") Integer module) {
|
||||||
String methodDescribe = getMethodDescribe("updateSoftInfoBynDid");
|
String methodDescribe = getMethodDescribe("updateSoftInfoBynDid");
|
||||||
csEquipmentDeliveryService.updateSoftInfoBynDid(nDid,id,module);
|
csEquipmentDeliveryService.updateSoftInfoBynDid(nDid, id, module);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,7 +214,7 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@PostMapping("/findDevByNDid")
|
@PostMapping("/findDevByNDid")
|
||||||
@ApiOperation("通过nDid查询设备信息")
|
@ApiOperation("通过nDid查询设备信息")
|
||||||
@ApiImplicitParam(name = "nDid", value = "网关识别码", required = true)
|
@ApiImplicitParam(name = "nDid", value = "网关识别码", required = true)
|
||||||
public HttpResult<CsEquipmentDeliveryPO> findDevByNDid(@RequestParam("nDid")String nDid){
|
public HttpResult<CsEquipmentDeliveryPO> findDevByNDid(@RequestParam("nDid") String nDid) {
|
||||||
String methodDescribe = getMethodDescribe("findDevByNDid");
|
String methodDescribe = getMethodDescribe("findDevByNDid");
|
||||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.findDevByNDid(nDid);
|
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.findDevByNDid(nDid);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||||
@@ -225,13 +229,13 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
exportParams.setStyle(ExcelStyleUtil.class);
|
exportParams.setStyle(ExcelStyleUtil.class);
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, DeviceExcelTemplete.class, new ArrayList<DeviceExcelTemplete>());
|
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, DeviceExcelTemplete.class, new ArrayList<DeviceExcelTemplete>());
|
||||||
List<SysDicTreePO> deviceType = dictTreeFeignClient.queryByCodeList(DicDataTypeEnum.DEVICE_TYPE.getCode()).getData();
|
List<SysDicTreePO> deviceType = dictTreeFeignClient.queryByCodeList(DicDataTypeEnum.DEVICE_TYPE.getCode()).getData();
|
||||||
if(!CollectionUtils.isEmpty(deviceType)){
|
if (!CollectionUtils.isEmpty(deviceType)) {
|
||||||
List<String> collect = deviceType.get(0).getChildren().stream().map(SysDicTreePO::getName).collect(Collectors.toList());
|
List<String> collect = deviceType.get(0).getChildren().stream().map(SysDicTreePO::getName).collect(Collectors.toList());
|
||||||
ExcelUtil.selectList(workbook, 2, 2, collect.toArray(new String[]{}));
|
ExcelUtil.selectList(workbook, 2, 2, collect.toArray(new String[]{}));
|
||||||
List<String> collect2 = deviceType.get(0).getChildren().stream().map(SysDicTreePO::getChildren).flatMap(Collection::stream).map(SysDicTreePO::getName).collect(Collectors.toList());
|
List<String> collect2 = deviceType.get(0).getChildren().stream().map(SysDicTreePO::getChildren).flatMap(Collection::stream).map(SysDicTreePO::getName).collect(Collectors.toList());
|
||||||
ExcelUtil.selectList(workbook, 3, 3, collect2.toArray(new String[]{}));
|
ExcelUtil.selectList(workbook, 3, 3, collect2.toArray(new String[]{}));
|
||||||
}
|
}
|
||||||
ExcelUtil.selectList(workbook, 4, 4, Stream.of("MQTT","CLD").collect(Collectors.toList()).toArray(new String[]{}));
|
ExcelUtil.selectList(workbook, 4, 4, Stream.of("MQTT", "CLD").collect(Collectors.toList()).toArray(new String[]{}));
|
||||||
String fileName = "设备模板.xlsx";
|
String fileName = "设备模板.xlsx";
|
||||||
ExportParams exportExcel = new ExportParams("设备模板", "设备模板");
|
ExportParams exportExcel = new ExportParams("设备模板", "设备模板");
|
||||||
PoiUtil.exportFileByWorkbook(workbook, fileName, response);
|
PoiUtil.exportFileByWorkbook(workbook, fileName, response);
|
||||||
@@ -244,11 +248,11 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
public HttpResult<String> importEquipment(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) {
|
public HttpResult<String> importEquipment(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) {
|
||||||
String methodDescribe = getMethodDescribe("importEquipment");
|
String methodDescribe = getMethodDescribe("importEquipment");
|
||||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.importEquipment(file, response);
|
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.importEquipment(file, response);
|
||||||
if (!CollectionUtils.isEmpty(csEquipmentDeliveryPOS)){
|
if (!CollectionUtils.isEmpty(csEquipmentDeliveryPOS)) {
|
||||||
csEquipmentDeliveryPOS.forEach(temp->{
|
csEquipmentDeliveryPOS.forEach(temp -> {
|
||||||
//查询mqtt用户名和密码是否存在
|
//查询mqtt用户名和密码是否存在
|
||||||
boolean result = mqttUserService.findMqttUser(temp.getNdid());
|
boolean result = mqttUserService.findMqttUser(temp.getNdid());
|
||||||
if (result){
|
if (result) {
|
||||||
//初始化装置mqtt连接信息(使用sha256加密)
|
//初始化装置mqtt连接信息(使用sha256加密)
|
||||||
mqttUserService.insertMqttUser(temp.getNdid());
|
mqttUserService.insertMqttUser(temp.getNdid());
|
||||||
}
|
}
|
||||||
@@ -260,18 +264,18 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
@ApiOperation("联调完成")
|
@ApiOperation("联调完成")
|
||||||
@PostMapping(value = "testcompletion")
|
@PostMapping(value = "testcompletion")
|
||||||
public HttpResult<String> testCompletion(@RequestParam("deviceId") String deviceId,@RequestParam("type") Integer type,@RequestParam("remark") String remark){
|
public HttpResult<String> testCompletion(@RequestParam("deviceId") String deviceId, @RequestParam("type") Integer type, @RequestParam("remark") String remark) {
|
||||||
String methodDescribe = getMethodDescribe("testCompletion");
|
String methodDescribe = getMethodDescribe("testCompletion");
|
||||||
csEquipmentDeliveryService.testCompletion(deviceId,type, remark);
|
csEquipmentDeliveryService.testCompletion(deviceId, type, remark);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@ApiOperation("取消联调")
|
@ApiOperation("取消联调")
|
||||||
@PostMapping(value = "deleteTest")
|
@PostMapping(value = "deleteTest")
|
||||||
public HttpResult<String> deleteTest(@RequestParam("deviceId") String deviceId,@RequestParam("type") Integer type,@RequestParam("remark") String remark){
|
public HttpResult<String> deleteTest(@RequestParam("deviceId") String deviceId, @RequestParam("type") Integer type, @RequestParam("remark") String remark) {
|
||||||
String methodDescribe = getMethodDescribe("deleteTest");
|
String methodDescribe = getMethodDescribe("deleteTest");
|
||||||
csEquipmentDeliveryService.deleteTest(deviceId,type, remark);
|
csEquipmentDeliveryService.deleteTest(deviceId, type, remark);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,9 +287,9 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "id", value = "软件信息id", required = true)
|
@ApiImplicitParam(name = "id", value = "软件信息id", required = true)
|
||||||
})
|
})
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
public HttpResult<String> updateSoftInfo(@RequestParam("nDid") String nDid,@RequestParam("id") String id){
|
public HttpResult<String> updateSoftInfo(@RequestParam("nDid") String nDid, @RequestParam("id") String id) {
|
||||||
String methodDescribe = getMethodDescribe("updateSoftInfo");
|
String methodDescribe = getMethodDescribe("updateSoftInfo");
|
||||||
csEquipmentDeliveryService.updateSoftInfo(nDid,id);
|
csEquipmentDeliveryService.updateSoftInfo(nDid, id);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,9 +301,9 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "number", value = "模块个数", required = true)
|
@ApiImplicitParam(name = "number", value = "模块个数", required = true)
|
||||||
})
|
})
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
public HttpResult<String> updateModuleNumber(@RequestParam("nDid") String nDid,@RequestParam("number") Integer number){
|
public HttpResult<String> updateModuleNumber(@RequestParam("nDid") String nDid, @RequestParam("number") Integer number) {
|
||||||
String methodDescribe = getMethodDescribe("updateModuleNumber");
|
String methodDescribe = getMethodDescribe("updateModuleNumber");
|
||||||
csEquipmentDeliveryService.updateModuleNumber(nDid,number);
|
csEquipmentDeliveryService.updateModuleNumber(nDid, number);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +311,7 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@PostMapping("/rebootDevice")
|
@PostMapping("/rebootDevice")
|
||||||
@ApiOperation("重启设备")
|
@ApiOperation("重启设备")
|
||||||
@ApiImplicitParam(name = "nDid", value = "nDid", required = true)
|
@ApiImplicitParam(name = "nDid", value = "nDid", required = true)
|
||||||
public HttpResult<String> rebootDevice(@RequestParam("nDid") String nDid){
|
public HttpResult<String> rebootDevice(@RequestParam("nDid") String nDid) {
|
||||||
String methodDescribe = getMethodDescribe("rebootDevice");
|
String methodDescribe = getMethodDescribe("rebootDevice");
|
||||||
boolean result = csEquipmentDeliveryService.rebootDevice(nDid);
|
boolean result = csEquipmentDeliveryService.rebootDevice(nDid);
|
||||||
if (result) {
|
if (result) {
|
||||||
@@ -320,7 +324,7 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getAll")
|
@PostMapping("/getAll")
|
||||||
@ApiOperation("获取所有装置")
|
@ApiOperation("获取所有装置")
|
||||||
public HttpResult<List<CsEquipmentDeliveryPO>> getAll(){
|
public HttpResult<List<CsEquipmentDeliveryPO>> getAll() {
|
||||||
String methodDescribe = getMethodDescribe("getAll");
|
String methodDescribe = getMethodDescribe("getAll");
|
||||||
List<CsEquipmentDeliveryPO> result = csEquipmentDeliveryService.getAll();
|
List<CsEquipmentDeliveryPO> result = csEquipmentDeliveryService.getAll();
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
@@ -329,7 +333,7 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/judgeDevModel")
|
@PostMapping("/judgeDevModel")
|
||||||
@ApiOperation("判断设备型号")
|
@ApiOperation("判断设备型号")
|
||||||
public HttpResult<Boolean> judgeDevModel(@RequestParam("nDid") String nDid){
|
public HttpResult<Boolean> judgeDevModel(@RequestParam("nDid") String nDid) {
|
||||||
String methodDescribe = getMethodDescribe("judgeDevModel");
|
String methodDescribe = getMethodDescribe("judgeDevModel");
|
||||||
boolean result = csEquipmentDeliveryService.judgeDevModel(nDid);
|
boolean result = csEquipmentDeliveryService.judgeDevModel(nDid);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
@@ -338,7 +342,7 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getDevByLineId")
|
@PostMapping("/getDevByLineId")
|
||||||
@ApiOperation("根据监测点id查询装置信息")
|
@ApiOperation("根据监测点id查询装置信息")
|
||||||
public HttpResult<CsEquipmentDeliveryPO> getDevByLineId(@RequestParam("lineId") String lineId){
|
public HttpResult<CsEquipmentDeliveryPO> getDevByLineId(@RequestParam("lineId") String lineId) {
|
||||||
String methodDescribe = getMethodDescribe("getDevByLineId");
|
String methodDescribe = getMethodDescribe("getDevByLineId");
|
||||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.getDevByLineId(lineId);
|
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.getDevByLineId(lineId);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||||
@@ -349,7 +353,7 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@ApiOperation("新增云前置设备")
|
@ApiOperation("新增云前置设备")
|
||||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
@DeviceLog(operateType = DeviceOperate.ADD)
|
@DeviceLog(operateType = DeviceOperate.ADD)
|
||||||
public HttpResult<CsEquipmentDeliveryPO> addCldDev(@RequestBody @Validated CsEquipmentDeliveryAddParm param){
|
public HttpResult<CsEquipmentDeliveryPO> addCldDev(@RequestBody @Validated CsEquipmentDeliveryAddParm param) {
|
||||||
String methodDescribe = getMethodDescribe("addCldDev");
|
String methodDescribe = getMethodDescribe("addCldDev");
|
||||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.saveCld(param);
|
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.saveCld(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||||
@@ -360,7 +364,7 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@ApiOperation("删除云前置设备")
|
@ApiOperation("删除云前置设备")
|
||||||
@ApiImplicitParam(name = "id", value = "id", required = true)
|
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||||
@DeviceLog(operateType = DeviceOperate.DELETE)
|
@DeviceLog(operateType = DeviceOperate.DELETE)
|
||||||
public HttpResult<Boolean> delCldDev(@RequestParam("id") String id){
|
public HttpResult<Boolean> delCldDev(@RequestParam("id") String id) {
|
||||||
String methodDescribe = getMethodDescribe("delCldDev");
|
String methodDescribe = getMethodDescribe("delCldDev");
|
||||||
boolean result = csEquipmentDeliveryService.delCldDev(id);
|
boolean result = csEquipmentDeliveryService.delCldDev(id);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
@@ -371,7 +375,7 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@ApiOperation("修改云前置设备")
|
@ApiOperation("修改云前置设备")
|
||||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
@DeviceLog(operateType = DeviceOperate.UPDATE)
|
@DeviceLog(operateType = DeviceOperate.UPDATE)
|
||||||
public HttpResult<Boolean> updateCldDev(@RequestBody @Validated CsEquipmentDeliveryAuditParm param){
|
public HttpResult<Boolean> updateCldDev(@RequestBody @Validated CsEquipmentDeliveryAuditParm param) {
|
||||||
String methodDescribe = getMethodDescribe("updateCldDev");
|
String methodDescribe = getMethodDescribe("updateCldDev");
|
||||||
boolean result = csEquipmentDeliveryService.updateCldDev(param);
|
boolean result = csEquipmentDeliveryService.updateCldDev(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
@@ -385,9 +389,9 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "processNo", value = "进程号", required = true)
|
@ApiImplicitParam(name = "processNo", value = "进程号", required = true)
|
||||||
})
|
})
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
public HttpResult<Boolean> updateCldDevStatus(@RequestParam("nodeId") String nodeId, @RequestParam("processNo") Integer processNo){
|
public HttpResult<Boolean> updateCldDevStatus(@RequestParam("nodeId") String nodeId, @RequestParam("processNo") Integer processNo) {
|
||||||
String methodDescribe = getMethodDescribe("updateCldDevStatus");
|
String methodDescribe = getMethodDescribe("updateCldDevStatus");
|
||||||
csEquipmentDeliveryService.updateCldDevStatus(nodeId,processNo);
|
csEquipmentDeliveryService.updateCldDevStatus(nodeId, processNo);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -400,9 +404,9 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "status", value = "状态", required = true)
|
@ApiImplicitParam(name = "status", value = "状态", required = true)
|
||||||
})
|
})
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
public HttpResult<Boolean> flipCldDevStatus(@RequestParam("date") String date, @RequestParam("devId") String devId, @RequestParam("status") Integer status){
|
public HttpResult<Boolean> flipCldDevStatus(@RequestParam("date") String date, @RequestParam("devId") String devId, @RequestParam("status") Integer status) {
|
||||||
String methodDescribe = getMethodDescribe("flipCldDevStatus");
|
String methodDescribe = getMethodDescribe("flipCldDevStatus");
|
||||||
csEquipmentDeliveryService.flipCldDevStatus(date,devId,status);
|
csEquipmentDeliveryService.flipCldDevStatus(date, devId, status);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,10 +414,22 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@PostMapping("/getRunPortableDev")
|
@PostMapping("/getRunPortableDev")
|
||||||
@ApiOperation("获取用户未绑定的在运的便携式设备")
|
@ApiOperation("获取用户未绑定的在运的便携式设备")
|
||||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||||
public HttpResult<List<CsEquipmentDeliveryPO>> getRunPortableDev(@RequestParam("userId") String userId){
|
public HttpResult<List<CsEquipmentDeliveryPO>> getRunPortableDev(@RequestParam("userId") String userId) {
|
||||||
String methodDescribe = getMethodDescribe("getRunPortableDev");
|
String methodDescribe = getMethodDescribe("getRunPortableDev");
|
||||||
List<CsEquipmentDeliveryPO> result = csEquipmentDeliveryService.getRunPortableDev(userId);
|
List<CsEquipmentDeliveryPO> result = csEquipmentDeliveryService.getRunPortableDev(userId);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/version/page")
|
||||||
|
@ApiOperation("查询设备版本信息")
|
||||||
|
@ApiImplicitParam(name = "baseParam", value = "查询日志参数", required = true)
|
||||||
|
public HttpResult<IPage<DevVersionVO>> versionPage(@RequestBody CsEquipmentDeliveryQueryParm baseParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("versionPage");
|
||||||
|
|
||||||
|
IPage<DevVersionVO> list = csEquipmentDeliveryService.versionPage(baseParam);
|
||||||
|
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ public class CsLedgerController extends BaseController {
|
|||||||
@PostMapping("/AppLineTree")
|
@PostMapping("/AppLineTree")
|
||||||
@ApiOperation("app端监测点树")
|
@ApiOperation("app端监测点树")
|
||||||
public HttpResult<List<CsLedgerVO>> appLineTree(){
|
public HttpResult<List<CsLedgerVO>> appLineTree(){
|
||||||
String methodDescribe = getMethodDescribe("AppLineTree");
|
String methodDescribe = getMethodDescribe("appLineTree");
|
||||||
List<CsLedgerVO> list = csLedgerService.appLineTree();
|
List<CsLedgerVO> list = csLedgerService.appLineTree();
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,8 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.param.DeviceMessageParam;
|
import com.njcn.csdevice.param.DeviceMessageParam;
|
||||||
import com.njcn.csdevice.pojo.param.DataArrayParam;
|
import com.njcn.csdevice.param.LineInfoParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
|
||||||
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
|
||||||
import com.njcn.csdevice.pojo.vo.DeviceManagerDetailVO;
|
|
||||||
import com.njcn.csdevice.service.DeviceMessageService;
|
import com.njcn.csdevice.service.DeviceMessageService;
|
||||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
|
||||||
import com.njcn.user.pojo.po.User;
|
import com.njcn.user.pojo.po.User;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -22,7 +18,6 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -48,7 +43,7 @@ public class DeviceMessageController extends BaseController {
|
|||||||
@ApiOperation("根据设备获取需要推送的用户id")
|
@ApiOperation("根据设备获取需要推送的用户id")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "devId", value = "设备id", required = true, paramType = "query"),
|
@ApiImplicitParam(name = "devId", value = "设备id", required = true, paramType = "query"),
|
||||||
@ApiImplicitParam(name = "isAdmin", value = "是否需要推送给管理员", required = true, paramType = "query")
|
@ApiImplicitParam(name = "isAdmin", value = "是否需要推送给普通用户", required = true, paramType = "query")
|
||||||
})
|
})
|
||||||
public HttpResult<List<String>> getEventUserByDeviceId(@RequestParam("devId") String devId, @RequestParam("isAdmin") Boolean isAdmin){
|
public HttpResult<List<String>> getEventUserByDeviceId(@RequestParam("devId") String devId, @RequestParam("isAdmin") Boolean isAdmin){
|
||||||
String methodDescribe = getMethodDescribe("getEventUserByDeviceId");
|
String methodDescribe = getMethodDescribe("getEventUserByDeviceId");
|
||||||
@@ -69,10 +64,10 @@ public class DeviceMessageController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getLineInfo")
|
@PostMapping("/getLineInfo")
|
||||||
@ApiOperation("获取监测点信息")
|
@ApiOperation("获取监测点信息")
|
||||||
@ApiImplicitParam(name = "id", value = "参数", required = true, paramType = "query")
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
public HttpResult<String> getLineInfo(@RequestParam("id") String id){
|
public HttpResult<String> getLineInfo(@RequestBody LineInfoParam param){
|
||||||
String methodDescribe = getMethodDescribe("getLineInfo");
|
String methodDescribe = getMethodDescribe("getLineInfo");
|
||||||
deviceMessageService.getLineInfo(id);
|
deviceMessageService.getLineInfo(param.getNDid(),param.getList());
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "success", methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "success", methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
package com.njcn.csdevice.controller.message;
|
|
||||||
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
|
||||||
import com.njcn.csdevice.pojo.vo.MessageRecordReqVO;
|
|
||||||
import com.njcn.csdevice.service.ISmsSendService;
|
|
||||||
import com.njcn.web.controller.BaseController;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xy
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/sms")
|
|
||||||
@Api(tags = "短信发送管理")
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class SmsSendController extends BaseController {
|
|
||||||
|
|
||||||
private final ISmsSendService smsSendService;
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
@PostMapping("/send")
|
|
||||||
@ApiOperation("发送短信(同步,包含重试)")
|
|
||||||
public HttpResult<String> sendSms(@RequestBody MessageRecordReqVO vo) {
|
|
||||||
String methodDescribe = getMethodDescribe("sendSms");
|
|
||||||
|
|
||||||
try {
|
|
||||||
smsSendService.sendSmsWithRetry(vo);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(
|
|
||||||
CommonResponseEnum.SUCCESS,
|
|
||||||
"短信发送成功",
|
|
||||||
methodDescribe
|
|
||||||
);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("短信发送失败", e);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(
|
|
||||||
CommonResponseEnum.FAIL,
|
|
||||||
e.getMessage(),
|
|
||||||
methodDescribe
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
@PostMapping("/send/simple")
|
|
||||||
@ApiOperation("发送短信(简化参数)")
|
|
||||||
public HttpResult<String> sendSmsSimple(
|
|
||||||
@RequestParam String receiver,
|
|
||||||
@RequestParam String content,
|
|
||||||
@RequestParam(defaultValue = "verify_code") String messageType) {
|
|
||||||
String methodDescribe = getMethodDescribe("sendSmsSimple");
|
|
||||||
|
|
||||||
try {
|
|
||||||
smsSendService.sendSmsWithRetry(receiver, content, messageType);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(
|
|
||||||
CommonResponseEnum.SUCCESS,
|
|
||||||
"短信发送成功",
|
|
||||||
methodDescribe
|
|
||||||
);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("短信发送失败", e);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(
|
|
||||||
CommonResponseEnum.FAIL,
|
|
||||||
e.getMessage(),
|
|
||||||
methodDescribe
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,6 +9,7 @@ import com.njcn.common.utils.HttpResultUtil;
|
|||||||
import com.njcn.csdevice.pojo.param.CsEdDataAddParm;
|
import com.njcn.csdevice.pojo.param.CsEdDataAddParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsEdDataAuditParm;
|
import com.njcn.csdevice.pojo.param.CsEdDataAuditParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsEdDataQueryParm;
|
import com.njcn.csdevice.pojo.param.CsEdDataQueryParm;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEdDataPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
|
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
|
||||||
import com.njcn.csdevice.service.CsEdDataService;
|
import com.njcn.csdevice.service.CsEdDataService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -79,4 +80,14 @@ public class CsEdDataController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/getById")
|
||||||
|
@ApiOperation("根据id查询")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||||
|
public HttpResult<CsEdDataPO> getById(@Validated @RequestParam("id") String id){
|
||||||
|
String methodDescribe = getMethodDescribe("getById");
|
||||||
|
CsEdDataPO dataPO = csEdDataService.getById(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, dataPO, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
package com.njcn.csdevice.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.njcn.csdevice.pojo.po.CsSmsSendRecord;
|
|
||||||
|
|
||||||
public interface CsSmsSendRecordMapper extends BaseMapper<CsSmsSendRecord> {
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.njcn.csdevice.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsUpgradeLogs;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2026-04-23
|
||||||
|
*/
|
||||||
|
public interface CsUpgradeLogsMapper extends BaseMapper<CsUpgradeLogs> {
|
||||||
|
}
|
||||||
@@ -105,7 +105,6 @@
|
|||||||
t0.ndid = #{param.id}
|
t0.ndid = #{param.id}
|
||||||
and t1.did = #{param.did}
|
and t1.did = #{param.did}
|
||||||
and t3.cl_dev = #{param.cldId}
|
and t3.cl_dev = #{param.cldId}
|
||||||
and (t3.data_type = 'Stat' or t3.data_type is NULL)
|
|
||||||
and t3.idx = #{param.idx}
|
and t3.idx = #{param.idx}
|
||||||
and t4.stat_method = #{param.statMethod}
|
and t4.stat_method = #{param.statMethod}
|
||||||
order by t4.sort
|
order by t4.sort
|
||||||
|
|||||||
@@ -14,7 +14,8 @@
|
|||||||
where
|
where
|
||||||
pid = #{modelId}
|
pid = #{modelId}
|
||||||
and cl_dev = #{clDev}
|
and cl_dev = #{clDev}
|
||||||
and (data_type = 'Stat' or data_type IS NULL)
|
-- and (data_type = 'Stat' or data_type IS NULL)
|
||||||
|
and store_flag = 1
|
||||||
order by type,cl_dev
|
order by type,cl_dev
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
t1.*
|
t1.*
|
||||||
from
|
from
|
||||||
cs_equipment_delivery t0
|
cs_equipment_delivery t0
|
||||||
left join cs_line t1 on
|
right join cs_line t1 on
|
||||||
t0.id = t1.device_id
|
t0.id = t1.device_id
|
||||||
where
|
where
|
||||||
t0.ndid = #{id}
|
t0.ndid = #{id}
|
||||||
|
|||||||
@@ -55,4 +55,10 @@ public interface CsDeviceUserPOService extends IService<CsDeviceUserPO>{
|
|||||||
void channelDevByUserId(UserDevParam param);
|
void channelDevByUserId(UserDevParam param);
|
||||||
|
|
||||||
List<CsDeviceUserPO> getList(UserDevParam param);
|
List<CsDeviceUserPO> getList(UserDevParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户设备关系表数据 新增主用户信息 && 新增已关联工程的用户的设备关系
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean addRelation(UserDevParam param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,5 +48,13 @@ public interface CsEdDataService extends IService<CsEdDataPO> {
|
|||||||
* @author: xuyang
|
* @author: xuyang
|
||||||
*/
|
*/
|
||||||
CsEdDataVO findByDevTypeId(String devType);
|
CsEdDataVO findByDevTypeId(String devType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 根据装置型号和版本号获取装置类型
|
||||||
|
* @param devTypeId 装置型号
|
||||||
|
* @param versionNo 版本号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CsEdDataPO findByDevTypeIdAndVersionNo(String devTypeId, String versionNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,15 @@ package com.njcn.csdevice.service;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAddParm;
|
import com.njcn.csdevice.pojo.param.*;
|
||||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAuditParm;
|
|
||||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryQueryParm;
|
|
||||||
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
|
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
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.CsEquipmentDeliveryVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DevVersionVO;
|
||||||
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
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 org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -195,4 +196,5 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
|||||||
|
|
||||||
List<CsEquipmentDeliveryPO> getRunPortableDev(String userId);
|
List<CsEquipmentDeliveryPO> getRunPortableDev(String userId);
|
||||||
|
|
||||||
|
IPage<DevVersionVO> versionPage(CsEquipmentDeliveryQueryParm baseParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsUpgradeLogs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2026-04-23
|
||||||
|
*/
|
||||||
|
public interface CsUpgradeLogsService extends IService<CsUpgradeLogs> {
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.csdevice.service;
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
import com.njcn.csdevice.param.DeviceMessageParam;
|
import com.njcn.csdevice.param.DeviceMessageParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.user.pojo.po.User;
|
import com.njcn.user.pojo.po.User;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -14,6 +15,6 @@ public interface DeviceMessageService {
|
|||||||
|
|
||||||
List<User> getSendUserByType(DeviceMessageParam param);
|
List<User> getSendUserByType(DeviceMessageParam param);
|
||||||
|
|
||||||
void getLineInfo(String id);
|
void getLineInfo(String id,List<CsLinePO> list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.njcn.csdevice.service;
|
|||||||
|
|
||||||
import com.njcn.csdevice.param.LineCountEvaluateParam;
|
import com.njcn.csdevice.param.LineCountEvaluateParam;
|
||||||
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||||
|
import com.njcn.influx.pojo.po.PqsCommunicate;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -20,6 +21,13 @@ public interface ICsCommunicateService {
|
|||||||
*/
|
*/
|
||||||
List<PqsCommunicateDto> getRawDataLatest(LineCountEvaluateParam lineParam);
|
List<PqsCommunicateDto> getRawDataLatest(LineCountEvaluateParam lineParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取出第一条装置数据
|
||||||
|
* @param lineParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PqsCommunicateDto> getRawDataOne(LineCountEvaluateParam lineParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取时间范围数据
|
* 获取时间范围数据
|
||||||
* @param lineParam
|
* @param lineParam
|
||||||
@@ -27,6 +35,8 @@ public interface ICsCommunicateService {
|
|||||||
*/
|
*/
|
||||||
List<PqsCommunicateDto> getRawData(LineCountEvaluateParam lineParam);
|
List<PqsCommunicateDto> getRawData(LineCountEvaluateParam lineParam);
|
||||||
|
|
||||||
|
List<PqsCommunicateDto> getRawData2(LineCountEvaluateParam lineParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*是否有当天最后一条数据
|
*是否有当天最后一条数据
|
||||||
* @param lineParam
|
* @param lineParam
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
|
import com.njcn.influx.pojo.po.cs.PqdData;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PqdData数据拆分服务
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
* @since 2026-05-22
|
||||||
|
*/
|
||||||
|
public interface IPqdDataSplitService {
|
||||||
|
|
||||||
|
Map<String, Object> splitPqdData(List<PqdData> pqdDataList);
|
||||||
|
}
|
||||||
@@ -16,6 +16,19 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface IRStatOnlineRateDService extends IService<RStatOnlineRateD> {
|
public interface IRStatOnlineRateDService extends IService<RStatOnlineRateD> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.查询该设备当前计算周期是否存在上下线记录
|
||||||
|
* 2.
|
||||||
|
* a.存在记录,如果只有1条数据,则根据这一条记录的状态计算在线时长;如果是多条数据,则根据上下线时间计算在线时长;
|
||||||
|
* b.不存在记录,则需要借助历史记录判断:
|
||||||
|
* 1) 先查询设备第一条记录时间
|
||||||
|
* - 如果统计日期 < 第一条记录时间 → 设备未上线 → 离线
|
||||||
|
* 2) 再查询最新记录时间和状态
|
||||||
|
* - 如果统计日期 > 最新记录时间 → 延续最新状态
|
||||||
|
* * 最新是在线 → 全天在线
|
||||||
|
* * 最新是离线 → 全天离线
|
||||||
|
* @param param
|
||||||
|
*/
|
||||||
void addData(StatisticsDataParam param);
|
void addData(StatisticsDataParam param);
|
||||||
|
|
||||||
List<RStatOnlineRateD> getData(List<String> list, String startTime, String endTime);
|
List<RStatOnlineRateD> getData(List<String> list, String startTime, String endTime);
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
package com.njcn.csdevice.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.njcn.csdevice.pojo.po.CsSmsSendRecord;
|
|
||||||
import com.njcn.csdevice.pojo.vo.MessageRecordReqVO;
|
|
||||||
|
|
||||||
public interface ISmsSendService extends IService<CsSmsSendRecord> {
|
|
||||||
|
|
||||||
void sendSmsWithRetry(String receiver, String content, String messageType);
|
|
||||||
|
|
||||||
void sendSmsWithRetry(MessageRecordReqVO messageRecordReqVO);
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.mapper.AppLineTopologyDiagramMapper;
|
import com.njcn.csdevice.mapper.AppLineTopologyDiagramMapper;
|
||||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
|
||||||
import com.njcn.csdevice.pojo.param.AppTopologyDiagramQueryParm;
|
import com.njcn.csdevice.pojo.param.AppTopologyDiagramQueryParm;
|
||||||
import com.njcn.csdevice.pojo.param.LinePostionParam;
|
import com.njcn.csdevice.pojo.param.LinePostionParam;
|
||||||
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||||
@@ -13,11 +12,14 @@ import com.njcn.csdevice.pojo.po.CsLedger;
|
|||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.AppLineTopologyDiagramVO;
|
import com.njcn.csdevice.pojo.vo.AppLineTopologyDiagramVO;
|
||||||
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsLineTopologyTemplateVO;
|
|
||||||
import com.njcn.csdevice.service.AppLineTopologyDiagramService;
|
import com.njcn.csdevice.service.AppLineTopologyDiagramService;
|
||||||
import com.njcn.csdevice.service.AppTopologyDiagramService;
|
import com.njcn.csdevice.service.AppTopologyDiagramService;
|
||||||
import com.njcn.csdevice.service.CsLinePOService;
|
import com.njcn.csdevice.service.CsLinePOService;
|
||||||
import com.njcn.csdevice.service.ICsLedgerService;
|
import com.njcn.csdevice.service.ICsLedgerService;
|
||||||
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
|
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -41,6 +43,9 @@ public class AppLineTopologyDiagramServiceImpl extends ServiceImpl<AppLineTopolo
|
|||||||
private final CsLinePOService csLinePOService;
|
private final CsLinePOService csLinePOService;
|
||||||
private final AppTopologyDiagramService appTopologyDiagramService;
|
private final AppTopologyDiagramService appTopologyDiagramService;
|
||||||
private final ICsLedgerService iCsLedgerService;
|
private final ICsLedgerService iCsLedgerService;
|
||||||
|
private final RedisUtil redisUtil;
|
||||||
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AppTopologyDiagramVO query(String devId) {
|
public AppTopologyDiagramVO query(String devId) {
|
||||||
CsLedger one = iCsLedgerService.lambdaQuery().eq(CsLedger::getId, devId).eq(CsLedger::getState,1).one();
|
CsLedger one = iCsLedgerService.lambdaQuery().eq(CsLedger::getId, devId).eq(CsLedger::getState,1).one();
|
||||||
@@ -73,7 +78,7 @@ public class AppLineTopologyDiagramServiceImpl extends ServiceImpl<AppLineTopolo
|
|||||||
}
|
}
|
||||||
public List<AppLineTopologyDiagramVO> queryByLineIds(List<String> lineIds) {
|
public List<AppLineTopologyDiagramVO> queryByLineIds(List<String> lineIds) {
|
||||||
List<AppLineTopologyDiagramVO> result = new ArrayList<>();
|
List<AppLineTopologyDiagramVO> result = new ArrayList<>();
|
||||||
if (lineIds != null && lineIds.size() > 0) {
|
if (lineIds != null && !lineIds.isEmpty()) {
|
||||||
result = this.getBaseMapper().queryByLineIds( lineIds);
|
result = this.getBaseMapper().queryByLineIds( lineIds);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -83,15 +88,22 @@ public class AppLineTopologyDiagramServiceImpl extends ServiceImpl<AppLineTopolo
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void auditList(LinePostionParam linePostionParam) {
|
public void auditList(LinePostionParam linePostionParam) {
|
||||||
|
|
||||||
|
|
||||||
linePostionParam.getPointList().forEach(temp->{
|
linePostionParam.getPointList().forEach(temp->{
|
||||||
csLinePOService.lambdaUpdate().eq(CsLinePO::getLineId,temp.getLineId()).set(CsLinePO::getName,temp.getName()).set(CsLinePO::getPosition,temp.getLinePostion()).update();
|
csLinePOService.lambdaUpdate().eq(CsLinePO::getLineId,temp.getLineId()).set(CsLinePO::getName,temp.getName()).set(CsLinePO::getPosition,temp.getLinePostion()).update();
|
||||||
this.lambdaUpdate().eq(AppLineTopologyDiagramPO::getId,temp.getId()).
|
this.lambdaUpdate().eq(AppLineTopologyDiagramPO::getId,temp.getId()).
|
||||||
eq(AppLineTopologyDiagramPO::getLineId,temp.getLineId()).set(AppLineTopologyDiagramPO::getLat,temp.getLat()).
|
eq(AppLineTopologyDiagramPO::getLineId,temp.getLineId()).set(AppLineTopologyDiagramPO::getLat,temp.getLat()).
|
||||||
set(AppLineTopologyDiagramPO::getLng,temp.getLng()).set(AppLineTopologyDiagramPO::getId,linePostionParam.getId()).update();
|
set(AppLineTopologyDiagramPO::getLng,temp.getLng()).set(AppLineTopologyDiagramPO::getId,linePostionParam.getId())
|
||||||
|
.set(AppLineTopologyDiagramPO::getTarget,temp.getTarget())
|
||||||
|
.update();
|
||||||
iCsLedgerService.lambdaUpdate().eq(CsLedger::getId,temp.getLineId()).set(CsLedger::getName,temp.getName()).update();
|
iCsLedgerService.lambdaUpdate().eq(CsLedger::getId,temp.getLineId()).set(CsLedger::getName,temp.getName()).update();
|
||||||
});
|
});
|
||||||
|
//修改指标后,删除缓存数据
|
||||||
|
String deviceId = csLinePOService.getById(linePostionParam.getPointList().get(0).getLineId()).getDeviceId();
|
||||||
|
DictTreeVO dictTreeVO = dictTreeFeignClient.queryByCode("baseData").getData();
|
||||||
|
String key = deviceId + "#";
|
||||||
|
if (dictTreeVO != null) {
|
||||||
|
key = deviceId + "#" + dictTreeVO.getId();
|
||||||
|
}
|
||||||
|
redisUtil.delete(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,26 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.csdevice.mapper.CsDataArrayMapper;
|
import com.njcn.csdevice.mapper.CsDataArrayMapper;
|
||||||
import com.njcn.csdevice.pojo.dto.DataArrayDTO;
|
import com.njcn.csdevice.pojo.dto.DataArrayDTO;
|
||||||
import com.njcn.csdevice.pojo.param.DataArrayParam;
|
import com.njcn.csdevice.pojo.param.DataArrayParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
|
||||||
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
||||||
import com.njcn.csdevice.pojo.vo.DeviceManagerDetailVO;
|
import com.njcn.csdevice.pojo.vo.DeviceManagerDetailVO;
|
||||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||||
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.api.EpdFeignClient;
|
import com.njcn.system.api.EpdFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@@ -33,6 +37,7 @@ import java.util.stream.Collectors;
|
|||||||
public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDataArray> implements ICsDataArrayService {
|
public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDataArray> implements ICsDataArrayService {
|
||||||
|
|
||||||
private final EpdFeignClient epdFeignClient;
|
private final EpdFeignClient epdFeignClient;
|
||||||
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsDataArray> getArrayBySet(String dataSet) {
|
public List<CsDataArray> getArrayBySet(String dataSet) {
|
||||||
@@ -52,7 +57,7 @@ public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDat
|
|||||||
for (Map.Entry<String, List<EleEpdPqd>> entry : map.entrySet()) {
|
for (Map.Entry<String, List<EleEpdPqd>> entry : map.entrySet()) {
|
||||||
DeviceManagerDetailVO vo = new DeviceManagerDetailVO();
|
DeviceManagerDetailVO vo = new DeviceManagerDetailVO();
|
||||||
EleEpdPqd eleEpdPqd = entry.getValue().get(0);
|
EleEpdPqd eleEpdPqd = entry.getValue().get(0);
|
||||||
if (Objects.equals(eleEpdPqd.getPhase(),"M")){
|
if (Objects.equals(eleEpdPqd.getPhase(),"T")){
|
||||||
vo.setPhasic("/");
|
vo.setPhasic("/");
|
||||||
} else {
|
} else {
|
||||||
vo.setPhasic(entry.getValue().stream().map(EleEpdPqd::getPhase).collect(Collectors.joining(",")));
|
vo.setPhasic(entry.getValue().stream().map(EleEpdPqd::getPhase).collect(Collectors.joining(",")));
|
||||||
@@ -104,7 +109,7 @@ public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDat
|
|||||||
DataArrayTreeVO vo3 = new DataArrayTreeVO();
|
DataArrayTreeVO vo3 = new DataArrayTreeVO();
|
||||||
vo3.setId(item.getDataSetId() + item.getDataArrayName()+item2);
|
vo3.setId(item.getDataSetId() + item.getDataArrayName()+item2);
|
||||||
vo3.setName(item2);
|
vo3.setName(item2);
|
||||||
if (Objects.equals(item2,"M")){
|
if (Objects.equals(item2,"T")){
|
||||||
vo3.setShowName("无相别");
|
vo3.setShowName("无相别");
|
||||||
} else {
|
} else {
|
||||||
vo3.setShowName(item2);
|
vo3.setShowName(item2);
|
||||||
@@ -173,7 +178,34 @@ public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDat
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsDataArray> findListByParam(DataArrayParam param) {
|
public List<CsDataArray> findListByParam(DataArrayParam param) {
|
||||||
return this.baseMapper.findListByParam(param);
|
List<CsDataArray> list = this.baseMapper.findListByParam(param);
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
DictData pqd = dicDataFeignClient.getDicDataByCode(DicDataEnum.PQD.getCode()).getData();
|
||||||
|
if (ObjectUtil.isNotNull(pqd) && ObjectUtil.isNotNull(pqd.getId())) {
|
||||||
|
List<EleEpdPqd> epdList = epdFeignClient.dictMarkByDataType(pqd.getId()).getData();
|
||||||
|
if (!CollectionUtils.isEmpty(epdList)) {
|
||||||
|
Map<String, EleEpdPqd> epdPqdMap = epdList.stream().collect(Collectors.toMap(EleEpdPqd::getId, Function.identity()));
|
||||||
|
list.forEach(item->{
|
||||||
|
EleEpdPqd epdPqd = epdPqdMap.get(item.getDataId());
|
||||||
|
if (!Objects.isNull(epdPqd)) {
|
||||||
|
if (epdPqd.getOtherName() == null || epdPqd.getOtherName().isEmpty()) {
|
||||||
|
item.setInfluxDbName(epdPqd.getName());
|
||||||
|
} else {
|
||||||
|
String[] parts = item.getName().split("_");
|
||||||
|
String lastPart = parts[parts.length - 1];
|
||||||
|
boolean isLastNumeric = lastPart.matches("\\d+");
|
||||||
|
if (isLastNumeric) {
|
||||||
|
item.setInfluxDbName(epdPqd.getOtherName() + "_" + lastPart);
|
||||||
|
} else {
|
||||||
|
item.setInfluxDbName(epdPqd.getOtherName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
|
|||||||
.eq(CsDataSet::getPid,modelId)
|
.eq(CsDataSet::getPid,modelId)
|
||||||
.in(CsDataSet::getType, Arrays.asList(0,2))
|
.in(CsDataSet::getType, Arrays.asList(0,2))
|
||||||
.eq(CsDataSet::getStoreFlag,1)
|
.eq(CsDataSet::getStoreFlag,1)
|
||||||
.and(i->i.eq(CsDataSet::getDataType,"Stat").or().isNull(CsDataSet::getDataType))
|
// .and(i->i.eq(CsDataSet::getDataType,"Stat").or().isNull(CsDataSet::getDataType))
|
||||||
.orderByAsc(CsDataSet::getIdx)
|
.orderByAsc(CsDataSet::getIdx)
|
||||||
.list();
|
.list();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -234,6 +234,7 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//note 当前工程数据
|
//note 当前工程数据
|
||||||
|
vo.setLineCount(0);
|
||||||
//当前工程id
|
//当前工程id
|
||||||
vo.setCurrentId(id);
|
vo.setCurrentId(id);
|
||||||
//设备集合
|
//设备集合
|
||||||
@@ -286,6 +287,7 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
}
|
}
|
||||||
//获取未读事件数量
|
//获取未读事件数量
|
||||||
if (CollectionUtil.isNotEmpty(currentLineIds)) {
|
if (CollectionUtil.isNotEmpty(currentLineIds)) {
|
||||||
|
vo.setLineCount(currentLineIds.size());
|
||||||
CsEventUserQueryParam param1 = new CsEventUserQueryParam();
|
CsEventUserQueryParam param1 = new CsEventUserQueryParam();
|
||||||
param1.setUserId(RequestUtil.getUserIndex());
|
param1.setUserId(RequestUtil.getUserIndex());
|
||||||
param1.setStartTime(PublicDataUtils.calculateMonthStart(time));
|
param1.setStartTime(PublicDataUtils.calculateMonthStart(time));
|
||||||
@@ -545,4 +547,59 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
queryWrapper.eq(CsDeviceUserPO::getStatus, "1");
|
queryWrapper.eq(CsDeviceUserPO::getStatus, "1");
|
||||||
return this.list(queryWrapper);
|
return this.list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param userId 这边放设备id
|
||||||
|
* @param list 这边放用户id集合
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean addRelation(UserDevParam param) {
|
||||||
|
String userIndex;
|
||||||
|
CsDeviceUserPO existingRecord = this.lambdaQuery()
|
||||||
|
.eq(CsDeviceUserPO::getDeviceId, param.getUserId())
|
||||||
|
.one();
|
||||||
|
|
||||||
|
if (existingRecord != null && Objects.equals(existingRecord.getPrimaryUserId(), existingRecord.getSubUserId())) {
|
||||||
|
userIndex = existingRecord.getPrimaryUserId();
|
||||||
|
} else {
|
||||||
|
userIndex = RequestUtil.getUserIndex();
|
||||||
|
if (userIndex == null) {
|
||||||
|
throw new IllegalArgumentException("当前用户信息获取失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
CsDeviceUserPO mainDeviceRelation = new CsDeviceUserPO();
|
||||||
|
mainDeviceRelation.setDeviceId(param.getUserId());
|
||||||
|
mainDeviceRelation.setPrimaryUserId(userIndex);
|
||||||
|
mainDeviceRelation.setSubUserId(userIndex);
|
||||||
|
mainDeviceRelation.setStatus("1");
|
||||||
|
boolean mainSaveSuccess = this.save(mainDeviceRelation);
|
||||||
|
if (!mainSaveSuccess) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtil.isNotEmpty(param.getList())) {
|
||||||
|
List<CsDeviceUserPO> batchRecords = param.getList().stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(item -> !Objects.equals(item, userIndex))
|
||||||
|
.map(item -> {
|
||||||
|
CsDeviceUserPO relation = new CsDeviceUserPO();
|
||||||
|
relation.setDeviceId(param.getUserId());
|
||||||
|
relation.setPrimaryUserId(userIndex);
|
||||||
|
relation.setSubUserId(item);
|
||||||
|
relation.setStatus("1");
|
||||||
|
return relation;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (!batchRecords.isEmpty()) {
|
||||||
|
return this.saveBatch(batchRecords);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -40,33 +41,35 @@ public class CsEdDataServiceImpl extends ServiceImpl<CsEdDataMapper, CsEdDataPO>
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public boolean addEdData(CsEdDataAddParm csEdDataAddParm) {
|
public boolean addEdData(CsEdDataAddParm csEdDataAddParm) {
|
||||||
CsEdDataPO csEdDataPO = new CsEdDataPO ();
|
CsEdDataPO csEdDataPO = new CsEdDataPO();
|
||||||
BeanUtils.copyProperties (csEdDataAddParm, csEdDataPO);
|
BeanUtils.copyProperties(csEdDataAddParm, csEdDataPO);
|
||||||
String filePath = fileStorageUtil.uploadMultipart (csEdDataAddParm.getFile (), OssPath.EDDATA);
|
String remoteDir = StrUtil.SLASH + OssPath.EDDATA + csEdDataAddParm.getDevTypeName() + StrUtil.SLASH + csEdDataAddParm.getVersionNo() + StrUtil.SLASH;
|
||||||
csEdDataPO.setFilePath (filePath);
|
String filePath = fileStorageUtil.uploadMultipart(csEdDataAddParm.getFile(), remoteDir, true);
|
||||||
csEdDataPO.setStatus ("1");
|
csEdDataPO.setCrc(csEdDataAddParm.getCrcInfo());
|
||||||
boolean save = this.save (csEdDataPO);
|
csEdDataPO.setFilePath(filePath);
|
||||||
|
csEdDataPO.setStatus("1");
|
||||||
|
boolean save = this.save(csEdDataPO);
|
||||||
return save;
|
return save;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public Boolean auditEdData(CsEdDataAuditParm csEdDataAuditParm) {
|
public Boolean auditEdData(CsEdDataAuditParm csEdDataAuditParm) {
|
||||||
CsEdDataPO csEdDataPO = new CsEdDataPO ();
|
CsEdDataPO csEdDataPO = new CsEdDataPO();
|
||||||
BeanUtils.copyProperties (csEdDataAuditParm, csEdDataPO);
|
BeanUtils.copyProperties(csEdDataAuditParm, csEdDataPO);
|
||||||
if(!Objects.isNull (csEdDataAuditParm.getFile ())){
|
if (!Objects.isNull(csEdDataAuditParm.getFile())) {
|
||||||
String filePath = fileStorageUtil.uploadMultipart (csEdDataAuditParm.getFile (), OssPath.EDDATA);
|
String filePath = fileStorageUtil.uploadMultipart(csEdDataAuditParm.getFile(), StrUtil.SLASH + OssPath.EDDATA + csEdDataAuditParm.getDevTypeName() + StrUtil.SLASH + csEdDataAuditParm.getVersionNo() + StrUtil.SLASH, true);
|
||||||
csEdDataPO.setFilePath (filePath);
|
csEdDataPO.setFilePath(filePath);
|
||||||
}
|
}
|
||||||
boolean b = this.updateById (csEdDataPO);
|
boolean b = this.updateById(csEdDataPO);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<CsEdDataVO> queryEdDataPage(CsEdDataQueryParm csEdDataQueryParm) {
|
public IPage<CsEdDataVO> queryEdDataPage(CsEdDataQueryParm csEdDataQueryParm) {
|
||||||
Page<CsEdDataVO> returnpage = new Page<> (csEdDataQueryParm.getPageNum ( ), csEdDataQueryParm.getPageSize ( ));
|
Page<CsEdDataVO> returnpage = new Page<>(csEdDataQueryParm.getPageNum(), csEdDataQueryParm.getPageSize());
|
||||||
|
|
||||||
returnpage = this.getBaseMapper ().getPage(returnpage,csEdDataQueryParm);
|
returnpage = this.getBaseMapper().getPage(returnpage, csEdDataQueryParm);
|
||||||
return returnpage;
|
return returnpage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,15 +77,21 @@ public class CsEdDataServiceImpl extends ServiceImpl<CsEdDataMapper, CsEdDataPO>
|
|||||||
public CsEdDataVO findByDevTypeId(String devType) {
|
public CsEdDataVO findByDevTypeId(String devType) {
|
||||||
CsEdDataPO csEdDataPo = new CsEdDataPO();
|
CsEdDataPO csEdDataPo = new CsEdDataPO();
|
||||||
LambdaQueryWrapper<CsEdDataPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEdDataPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEdDataPO::getDevType,devType);
|
lambdaQueryWrapper.eq(CsEdDataPO::getDevType, devType);
|
||||||
lambdaQueryWrapper.eq(CsEdDataPO::getStatus,1);
|
lambdaQueryWrapper.eq(CsEdDataPO::getStatus, 1);
|
||||||
List<CsEdDataPO> list = this.baseMapper.selectList(lambdaQueryWrapper);
|
List<CsEdDataPO> list = this.baseMapper.selectList(lambdaQueryWrapper);
|
||||||
if (!CollectionUtils.isEmpty(list)){
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
csEdDataPo = list.get(0);
|
csEdDataPo = list.get(0);
|
||||||
}
|
}
|
||||||
CsEdDataVO csEdDataVo = new CsEdDataVO();
|
CsEdDataVO csEdDataVo = new CsEdDataVO();
|
||||||
BeanUtils.copyProperties(csEdDataPo,csEdDataVo);
|
BeanUtils.copyProperties(csEdDataPo, csEdDataVo);
|
||||||
return csEdDataVo;
|
return csEdDataVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CsEdDataPO findByDevTypeIdAndVersionNo(String devTypeId, String versionNo) {
|
||||||
|
return this.lambdaQuery().eq(CsEdDataPO::getDevType, devTypeId)
|
||||||
|
.eq(CsEdDataPO::getVersionNo, versionNo)
|
||||||
|
.eq(CsEdDataPO::getStatus, 1).one();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -65,11 +65,8 @@ import java.math.BigDecimal;
|
|||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.temporal.ChronoUnit;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -316,24 +313,28 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||||
}
|
}
|
||||||
Double ct = finalCsLinePOList.get(0).getCtRatio();
|
Double ct = finalCsLinePOList.get(0).getCtRatio() / (Objects.isNull(finalCsLinePOList.get(0).getCt2Ratio())?1.0:finalCsLinePOList.get(0).getCt2Ratio());
|
||||||
Double pt = finalCsLinePOList.get(0).getPtRatio();
|
Double pt = finalCsLinePOList.get(0).getPtRatio() / (Objects.isNull(finalCsLinePOList.get(0).getPt2Ratio())?1.0:finalCsLinePOList.get(0).getPt2Ratio());
|
||||||
if(CollectionUtil.isNotEmpty(commonStatisticalQueryParam.getList())){
|
if(CollectionUtil.isNotEmpty(commonStatisticalQueryParam.getList())){
|
||||||
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
||||||
|
|
||||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(param.getStatisticalId())).getData();
|
||||||
eleEpdPqds.forEach(epdPqd->{
|
eleEpdPqds.forEach(epdPqd->{
|
||||||
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
|
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
|
||||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
commonQueryParam.setLineId(temp.getLineId());
|
commonQueryParam.setLineId(temp.getLineId());
|
||||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||||
|
if (epdPqd.getName() == null || epdPqd.getName().isEmpty()) {
|
||||||
commonQueryParam.setColumnName(epdPqd.getName()+ (StringUtils.isEmpty(param.getFrequency()) ? "":"_"+param.getFrequency()));
|
commonQueryParam.setColumnName(epdPqd.getName()+ (StringUtils.isEmpty(param.getFrequency()) ? "":"_"+param.getFrequency()));
|
||||||
|
} else {
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getOtherName()+ (StringUtils.isEmpty(param.getFrequency()) ? "":"_"+param.getFrequency()));
|
||||||
|
}
|
||||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||||
|
|
||||||
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(commonStatisticalQueryParam.getStartTime(),DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
|
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(commonStatisticalQueryParam.getStartTime(),DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
commonQueryParam.setEndTime(DateUtil.format(DateUtil.endOfDay(DateUtil.parse(commonStatisticalQueryParam.getEndTime(),DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN));
|
commonQueryParam.setEndTime(DateUtil.format(DateUtil.endOfDay(DateUtil.parse(commonStatisticalQueryParam.getEndTime(),DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
|
||||||
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType());
|
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType().toUpperCase());
|
||||||
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||||
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
||||||
return commonQueryParam;
|
return commonQueryParam;
|
||||||
@@ -343,7 +344,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
String unit;
|
String unit;
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
vo.setPhase(Objects.equals("T",temp.getPhaseType())?null:temp.getPhaseType());
|
||||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
vo.setPosition(position);
|
vo.setPosition(position);
|
||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
@@ -451,21 +452,6 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
vo.setAnotherName(epdPqd.getShowName());
|
vo.setAnotherName(epdPqd.getShowName());
|
||||||
return vo;
|
return vo;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
//长时闪变
|
|
||||||
if (Objects.equals(epdPqd.getOtherName(), "plt")) {
|
|
||||||
List<Instant> timeInstants = getTimeInstants(commonStatisticalQueryParam.getStartTime(), commonStatisticalQueryParam.getEndTime(), 2, ChronoUnit.HOURS, DEFAULT_ZONE);
|
|
||||||
collect1 = collect1.stream()
|
|
||||||
.filter(vo -> timeInstants.contains(vo.getTime()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
//短时闪变 || 电压波动
|
|
||||||
else if (Objects.equals(epdPqd.getOtherName(), "pst") || Objects.equals(epdPqd.getOtherName(), "fluc")) {
|
|
||||||
List<Instant> timeInstants = getTimeInstants(commonStatisticalQueryParam.getStartTime(), commonStatisticalQueryParam.getEndTime(), 10, ChronoUnit.MINUTES, DEFAULT_ZONE);
|
|
||||||
collect1 = collect1.stream()
|
|
||||||
.filter(vo -> timeInstants.contains(vo.getTime()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
result.addAll(collect1);
|
result.addAll(collect1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -493,8 +479,13 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
commonQueryParam.setLineId(temp.getLineId());
|
commonQueryParam.setLineId(temp.getLineId());
|
||||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||||
commonQueryParam.setColumnName(epdPqd.getName()+ finalFrequency);
|
commonQueryParam.setColumnName(epdPqd.getName()+ finalFrequency);
|
||||||
|
if (epdPqd.getName() == null || epdPqd.getName().isEmpty()) {
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getName()+ finalFrequency);
|
||||||
|
} else {
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getOtherName()+ finalFrequency);
|
||||||
|
}
|
||||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||||
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType() == null ? DataParam.portableDevStatisticalMethods:commonStatisticalQueryParam.getValueType());
|
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType() == null ? DataParam.portableDevStatisticalMethods.toUpperCase():commonStatisticalQueryParam.getValueType().toUpperCase());
|
||||||
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||||
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
||||||
return commonQueryParam;
|
return commonQueryParam;
|
||||||
@@ -503,7 +494,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
vo.setPhase(Objects.equals("T",temp.getPhaseType())?null:temp.getPhaseType());
|
||||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
vo.setPosition(position);
|
vo.setPosition(position);
|
||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
@@ -579,22 +570,163 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return csEventVOPage;
|
return csEventVOPage;
|
||||||
|
} else if ("4".equals(type)) {
|
||||||
|
formatQueryParamList(commonStatisticalQueryParam);
|
||||||
|
List<ThdDataVO> result = new ArrayList<>();
|
||||||
|
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Collections.singletonList(commonStatisticalQueryParam.getLineId())).getData();
|
||||||
|
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId, finalCsLinePOList.get(0).getDataSetId()));
|
||||||
|
if (Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())) {
|
||||||
|
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||||
}
|
}
|
||||||
return null;
|
Double ct = finalCsLinePOList.get(0).getCtRatio() / (Objects.isNull(finalCsLinePOList.get(0).getCt2Ratio()) ? 1.0 : finalCsLinePOList.get(0).getCt2Ratio());
|
||||||
|
Double pt = finalCsLinePOList.get(0).getPtRatio() / (Objects.isNull(finalCsLinePOList.get(0).getPt2Ratio()) ? 1.0 : finalCsLinePOList.get(0).getPt2Ratio());
|
||||||
|
if (CollectionUtil.isNotEmpty(commonStatisticalQueryParam.getList())) {
|
||||||
|
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()) {
|
||||||
|
|
||||||
|
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(param.getStatisticalId())).getData();
|
||||||
|
eleEpdPqds.forEach(epdPqd -> {
|
||||||
|
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
|
||||||
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
|
commonQueryParam.setLineId(temp.getLineId());
|
||||||
|
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||||
|
if (epdPqd.getName() == null || epdPqd.getName().isEmpty()) {
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getName() + (StringUtils.isEmpty(param.getFrequency()) ? "" : "_" + param.getFrequency()));
|
||||||
|
} else {
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getOtherName() + (StringUtils.isEmpty(param.getFrequency()) ? "" : "_" + param.getFrequency()));
|
||||||
|
}
|
||||||
|
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||||
|
|
||||||
|
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(commonStatisticalQueryParam.getStartTime(), DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
commonQueryParam.setEndTime(DateUtil.format(DateUtil.endOfDay(DateUtil.parse(commonStatisticalQueryParam.getEndTime(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
|
||||||
|
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
||||||
|
return commonQueryParam;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
List<StatisticalDataDTO> deviceRtData;
|
||||||
|
if (commonStatisticalQueryParam.getDataModel() == 0) {
|
||||||
|
deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
||||||
|
} else {
|
||||||
|
deviceRtData = commonService.getDianDuData(commonQueryParams);
|
||||||
|
}
|
||||||
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
|
String unit;
|
||||||
|
ThdDataVO vo = new ThdDataVO();
|
||||||
|
vo.setLineId(temp.getLineId());
|
||||||
|
vo.setPhase(Objects.equals("T", temp.getPhaseType()) ? null : temp.getPhaseType());
|
||||||
|
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
|
vo.setPosition(position);
|
||||||
|
vo.setTime(temp.getTime());
|
||||||
|
vo.setStatMethod(temp.getValueType());
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
|
if (temp.getValue() != null) {
|
||||||
|
double re = 0;
|
||||||
|
if (Objects.equals("Primary", commonStatisticalQueryParam.getDataLevel())) {
|
||||||
|
if (Objects.equals("Primary", csDataSet.getDataLevel())) {
|
||||||
|
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||||
|
re = Objects.isNull(temp.getValue()) ? 3.14159 : Double.parseDouble(df.format(temp.getValue()));
|
||||||
|
vo.setStatisticalData(re);
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
} else {
|
||||||
|
vo.setStatisticalData(Objects.isNull(temp.getValue()) ? 3.14159 : Double.parseDouble(df.format(temp.getValue())));
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Objects.nonNull(epdPqd.getPrimaryFormula())) {
|
||||||
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
|
re = temp.getValue() * pt;
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
re = temp.getValue() * ct;
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
re = temp.getValue() * pt * ct;
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
re = temp.getValue();
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
} else {
|
||||||
|
re = temp.getValue();
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Instant> getTimeInstants(String startDateStr, String endDateStr, long interval, ChronoUnit unit, ZoneId zone) {
|
|
||||||
List<Instant> instants = new ArrayList<>();
|
|
||||||
LocalDate startDate = LocalDate.parse(startDateStr, DATE_FORMATTER);
|
|
||||||
LocalDate endDate = LocalDate.parse(endDateStr, DATE_FORMATTER);
|
|
||||||
// 转换为指定时区的 ZonedDateTime
|
|
||||||
ZonedDateTime current = startDate.atStartOfDay(zone);
|
|
||||||
ZonedDateTime endDateTime = endDate.atTime(23, 59, 59).atZone(zone);
|
|
||||||
while (!current.isAfter(endDateTime)) {
|
|
||||||
instants.add(current.toInstant());
|
|
||||||
current = current.plus(interval, unit);
|
|
||||||
}
|
}
|
||||||
return instants;
|
} else {
|
||||||
|
if (Objects.equals("Primary", csDataSet.getDataLevel())) {
|
||||||
|
if (Objects.nonNull(epdPqd.getPrimaryFormula())) {
|
||||||
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
|
re = temp.getValue() / pt;
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
re = temp.getValue() / ct;
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
re = temp.getValue() / pt / ct;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
re = temp.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
} else {
|
||||||
|
re = temp.getValue();
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
|
}
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vo.setStatisticalData(null);
|
||||||
|
if (Objects.equals("Primary", commonStatisticalQueryParam.getDataLevel())) {
|
||||||
|
if (Objects.equals("Primary", csDataSet.getDataLevel())) {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
} else {
|
||||||
|
if (Objects.nonNull(epdPqd.getPrimaryFormula())) {
|
||||||
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vo.setUnit(unit);
|
||||||
|
vo.setStatisticalIndex(epdPqd.getId());
|
||||||
|
vo.setStatisticalName(epdPqd.getName());
|
||||||
|
vo.setAnotherName(epdPqd.getShowName());
|
||||||
|
return vo;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
result.addAll(collect1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void formatQueryParamList(CommonStatisticalQueryParam commonStatisticalQueryParam){
|
private void formatQueryParamList(CommonStatisticalQueryParam commonStatisticalQueryParam){
|
||||||
@@ -659,7 +791,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
vo.setPhase(Objects.equals("T",temp.getPhaseType())?null:temp.getPhaseType());
|
||||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
vo.setPosition(position);
|
vo.setPosition(position);
|
||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
@@ -736,7 +868,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(commonStatisticalQueryParam.getLineId())).getData();
|
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(commonStatisticalQueryParam.getLineId())).getData();
|
||||||
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
|
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
|
||||||
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
||||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(param.getStatisticalId())).getData();
|
||||||
ThdDataTdVO.ThdDataSpectrumVOData thdDataSpectrumVOData = new ThdDataTdVO.ThdDataSpectrumVOData();
|
ThdDataTdVO.ThdDataSpectrumVOData thdDataSpectrumVOData = new ThdDataTdVO.ThdDataSpectrumVOData();
|
||||||
List<ThdDataVO> result = new ArrayList();
|
List<ThdDataVO> result = new ArrayList();
|
||||||
eleEpdPqds.forEach(epdPqd->{
|
eleEpdPqds.forEach(epdPqd->{
|
||||||
@@ -759,7 +891,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
vo.setPhase(Objects.equals("T",temp.getPhaseType())?null:temp.getPhaseType());
|
||||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
vo.setPosition(position);
|
vo.setPosition(position);
|
||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
@@ -838,23 +970,25 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())) {
|
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())) {
|
||||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||||
}
|
}
|
||||||
Double ct = finalCsLinePO.getCtRatio();
|
Double ct = finalCsLinePO.getCtRatio() / (Objects.isNull(finalCsLinePO.getCt2Ratio())?1.0:finalCsLinePO.getCt2Ratio());
|
||||||
Double pt = finalCsLinePO.getPtRatio();
|
Double pt = finalCsLinePO.getPtRatio() / (Objects.isNull(finalCsLinePO.getPt2Ratio())?1.0:finalCsLinePO.getPt2Ratio());
|
||||||
if(CollectionUtil.isNotEmpty(trendDataQueryParam.getList())) {
|
if(CollectionUtil.isNotEmpty(trendDataQueryParam.getList())) {
|
||||||
for (TrendDataQueryParam param : trendDataQueryParam.getList()) {
|
for (TrendDataQueryParam param : trendDataQueryParam.getList()) {
|
||||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(param.getStatisticalId())).getData();
|
||||||
for (EleEpdPqd epdPqd : eleEpdPqds) {
|
for (EleEpdPqd epdPqd : eleEpdPqds) {
|
||||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
commonQueryParam.setLineId(finalCsLinePO.getLineId());
|
commonQueryParam.setLineId(finalCsLinePO.getLineId());
|
||||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||||
commonQueryParam.setColumnName(epdPqd.getName() + (StringUtils.isEmpty(param.getFrequency()) ? "" : "_" + param.getFrequency()));
|
if (epdPqd.getName() == null || epdPqd.getName().isEmpty()) {
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getName()+ (StringUtils.isEmpty(param.getFrequency()) ? "":"_"+param.getFrequency()));
|
||||||
|
} else {
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getOtherName()+ (StringUtils.isEmpty(param.getFrequency()) ? "":"_"+param.getFrequency()));
|
||||||
|
}
|
||||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||||
|
|
||||||
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(trendDataQueryParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
|
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(trendDataQueryParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
commonQueryParam.setEndTime(DateUtil.format(DateUtil.endOfDay(DateUtil.parse(trendDataQueryParam.getSearchEndTime(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN));
|
commonQueryParam.setEndTime(DateUtil.format(DateUtil.endOfDay(DateUtil.parse(trendDataQueryParam.getSearchEndTime(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
commonQueryParam.setDataType(trendDataQueryParam.getValueType().toUpperCase());
|
||||||
commonQueryParam.setDataType(trendDataQueryParam.getValueType());
|
|
||||||
|
|
||||||
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(finalCsLinePO.getLineId()));
|
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(finalCsLinePO.getLineId()));
|
||||||
|
|
||||||
List<StatisticalDataDTO> deviceRtData = commonService.getNewDeviceRtDataByTime(Collections.singletonList(commonQueryParam));
|
List<StatisticalDataDTO> deviceRtData = commonService.getNewDeviceRtDataByTime(Collections.singletonList(commonQueryParam));
|
||||||
@@ -862,7 +996,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
String unit;
|
String unit;
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(Objects.equals("M", temp.getPhaseType()) ? null : temp.getPhaseType());
|
vo.setPhase(Objects.equals("T", temp.getPhaseType()) ? null : temp.getPhaseType());
|
||||||
String position = finalCsLinePO.getPosition();
|
String position = finalCsLinePO.getPosition();
|
||||||
vo.setPosition(position);
|
vo.setPosition(position);
|
||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
@@ -970,21 +1104,6 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
vo.setAnotherName(epdPqd.getShowName());
|
vo.setAnotherName(epdPqd.getShowName());
|
||||||
return vo;
|
return vo;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
//长时闪变
|
|
||||||
if (Objects.equals(epdPqd.getOtherName(), "plt")) {
|
|
||||||
List<Instant> timeInstants = getTimeInstants(trendDataQueryParam.getSearchBeginTime(), trendDataQueryParam.getSearchEndTime(), 2, ChronoUnit.HOURS, DEFAULT_ZONE);
|
|
||||||
collect1 = collect1.stream()
|
|
||||||
.filter(vo -> timeInstants.contains(vo.getTime()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
//短时闪变 || 电压波动
|
|
||||||
else if (Objects.equals(epdPqd.getOtherName(), "pst") || Objects.equals(epdPqd.getOtherName(), "fluc")) {
|
|
||||||
List<Instant> timeInstants = getTimeInstants(trendDataQueryParam.getSearchBeginTime(), trendDataQueryParam.getSearchEndTime(), 10, ChronoUnit.MINUTES, DEFAULT_ZONE);
|
|
||||||
collect1 = collect1.stream()
|
|
||||||
.filter(vo -> timeInstants.contains(vo.getTime()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
result.addAll(collect1);
|
result.addAll(collect1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1000,8 +1119,9 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||||
}
|
}
|
||||||
Double ct = finalCsLinePO.getCtRatio();
|
Double ct = finalCsLinePO.getCtRatio() / (Objects.isNull(finalCsLinePO.getCt2Ratio())?1.0:finalCsLinePO.getCt2Ratio());
|
||||||
Double pt = finalCsLinePO.getPtRatio();
|
Double pt = finalCsLinePO.getPtRatio() / (Objects.isNull(finalCsLinePO.getPt2Ratio())?1.0:finalCsLinePO.getPt2Ratio());
|
||||||
|
|
||||||
// String position = finalCsLinePO.getPosition();
|
// String position = finalCsLinePO.getPosition();
|
||||||
Overlimit overlimit = overLimitWlMapper.selectById(finalCsLinePO.getLineId());
|
Overlimit overlimit = overLimitWlMapper.selectById(finalCsLinePO.getLineId());
|
||||||
if (Objects.isNull(overlimit)) {
|
if (Objects.isNull(overlimit)) {
|
||||||
@@ -1011,7 +1131,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
if(CollectionUtil.isNotEmpty(fittingDataQueryParam.getList())) {
|
if(CollectionUtil.isNotEmpty(fittingDataQueryParam.getList())) {
|
||||||
for (FittingDataQueryParam param : fittingDataQueryParam.getList()) {
|
for (FittingDataQueryParam param : fittingDataQueryParam.getList()) {
|
||||||
String dictCode = dictTreeFeignClient.queryById(param.getStatisticalId()).getData().getCode();
|
String dictCode = dictTreeFeignClient.queryById(param.getStatisticalId()).getData().getCode();
|
||||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(param.getStatisticalId())).getData();
|
||||||
List<ThdDataVO> dataList = new ArrayList<>();
|
List<ThdDataVO> dataList = new ArrayList<>();
|
||||||
for (EleEpdPqd epdPqd : eleEpdPqds) {
|
for (EleEpdPqd epdPqd : eleEpdPqds) {
|
||||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
@@ -1038,7 +1158,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
// vo.setLineName(finalCsLinePO.getName());
|
// vo.setLineName(finalCsLinePO.getName());
|
||||||
vo.setPhase(Objects.equals("M", temp.getPhaseType()) ? null : temp.getPhaseType());
|
vo.setPhase(Objects.equals("T", temp.getPhaseType()) ? null : temp.getPhaseType());
|
||||||
// vo.setPosition(position);
|
// vo.setPosition(position);
|
||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
vo.setStatMethod(commonQueryParam.getDataType());
|
vo.setStatMethod(commonQueryParam.getDataType());
|
||||||
@@ -1208,7 +1328,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
TrendDataQueryParam trendDataQueryParam = new TrendDataQueryParam();
|
TrendDataQueryParam trendDataQueryParam = new TrendDataQueryParam();
|
||||||
trendDataQueryParam.setSearchBeginTime(param.getSearchBeginTime());
|
trendDataQueryParam.setSearchBeginTime(param.getSearchBeginTime());
|
||||||
trendDataQueryParam.setSearchEndTime(param.getSearchEndTime());
|
trendDataQueryParam.setSearchEndTime(param.getSearchEndTime());
|
||||||
trendDataQueryParam.setValueType(param.getValueType());
|
trendDataQueryParam.setValueType(param.getValueType().toUpperCase());
|
||||||
trendDataQueryParam.setDataLevel(param.getDataLevel());
|
trendDataQueryParam.setDataLevel(param.getDataLevel());
|
||||||
List<SensitiveUserTrendDataQueryParam> paramList = param.getList();
|
List<SensitiveUserTrendDataQueryParam> paramList = param.getList();
|
||||||
List<TrendDataQueryParam> indexList = paramList.stream().map(item -> {
|
List<TrendDataQueryParam> indexList = paramList.stream().map(item -> {
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
private final UserFeignClient userFeignClient;
|
private final UserFeignClient userFeignClient;
|
||||||
private final ICsUserPinsService csUserPinsService;
|
private final ICsUserPinsService csUserPinsService;
|
||||||
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
||||||
private final CsMarketDataFeignClient csMarketDataFeignClient;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -291,6 +290,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
|
|
||||||
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(portables)) {
|
||||||
String id = IdUtil.simpleUUID();
|
String id = IdUtil.simpleUUID();
|
||||||
CsLedgerVO portable1 = new CsLedgerVO();
|
CsLedgerVO portable1 = new CsLedgerVO();
|
||||||
portable1.setLevel(0);
|
portable1.setLevel(0);
|
||||||
@@ -307,6 +307,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
|
|
||||||
portable1.setChildren(Collections.singletonList(portable2));
|
portable1.setChildren(Collections.singletonList(portable2));
|
||||||
tree.add(portable1);
|
tree.add(portable1);
|
||||||
|
}
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
csUserPinsService.channelTree(list, tree, 4);
|
csUserPinsService.channelTree(list, tree, 4);
|
||||||
@@ -703,6 +704,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
|
|
||||||
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(portables)) {
|
||||||
String id = IdUtil.simpleUUID();
|
String id = IdUtil.simpleUUID();
|
||||||
CsLedgerVO portable1 = new CsLedgerVO();
|
CsLedgerVO portable1 = new CsLedgerVO();
|
||||||
portable1.setLevel(0);
|
portable1.setLevel(0);
|
||||||
@@ -721,6 +723,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
portable2List.add(portable2);
|
portable2List.add(portable2);
|
||||||
portable1.setChildren(portable2List);
|
portable1.setChildren(portable2List);
|
||||||
tree.add(portable1);
|
tree.add(portable1);
|
||||||
|
}
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
csUserPinsService.channelTree(list, tree, 4);
|
csUserPinsService.channelTree(list, tree, 4);
|
||||||
@@ -843,6 +846,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
device.setEquipmentName(dev.getName());
|
device.setEquipmentName(dev.getName());
|
||||||
device.setEquipmentId(devId);
|
device.setEquipmentId(devId);
|
||||||
device.setDevMac(po.getMac());
|
device.setDevMac(po.getMac());
|
||||||
|
device.setNDid(po.getNdid());
|
||||||
device.setProjectId("/");
|
device.setProjectId("/");
|
||||||
device.setProjectName("/");
|
device.setProjectName("/");
|
||||||
device.setEngineeringid("/");
|
device.setEngineeringid("/");
|
||||||
@@ -851,6 +855,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
device.setEquipmentName(dev.getName());
|
device.setEquipmentName(dev.getName());
|
||||||
device.setEquipmentId(devId);
|
device.setEquipmentId(devId);
|
||||||
device.setDevMac(po.getMac());
|
device.setDevMac(po.getMac());
|
||||||
|
device.setNDid(po.getNdid());
|
||||||
CsLedger project = this.findDataById(dev.getPid());
|
CsLedger project = this.findDataById(dev.getPid());
|
||||||
if (ObjectUtil.isNotNull(project)) {
|
if (ObjectUtil.isNotNull(project)) {
|
||||||
device.setProjectId(project.getId());
|
device.setProjectId(project.getId());
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.access.api.CsLineLatestDataFeignClient;
|
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.utils.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
@@ -24,7 +23,11 @@ import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
|||||||
import com.njcn.csdevice.service.CsDevModelService;
|
import com.njcn.csdevice.service.CsDevModelService;
|
||||||
import com.njcn.csdevice.service.CsLinePOService;
|
import com.njcn.csdevice.service.CsLinePOService;
|
||||||
import com.njcn.csdevice.service.ICsDataSetService;
|
import com.njcn.csdevice.service.ICsDataSetService;
|
||||||
|
import com.njcn.csharmonic.api.CsHarmonicPlanFeignClient;
|
||||||
|
import com.njcn.csharmonic.api.CsHarmonicPlanLineFeignClient;
|
||||||
import com.njcn.csharmonic.api.PqSensitiveUserFeignClient;
|
import com.njcn.csharmonic.api.PqSensitiveUserFeignClient;
|
||||||
|
import com.njcn.csharmonic.param.CsHarmonicPlanLineParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsHarmonicPlan;
|
||||||
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
||||||
import com.njcn.oss.constant.OssPath;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
@@ -64,7 +67,6 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
private final ICsDataSetService csDataSetService;
|
private final ICsDataSetService csDataSetService;
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
private final CsTerminalLogsMapper csTerminalLogsMapper;
|
private final CsTerminalLogsMapper csTerminalLogsMapper;
|
||||||
private final CsLineLatestDataFeignClient csLineLatestDataFeignClient;
|
|
||||||
private final PqSensitiveUserFeignClient pqSensitiveUserFeignClient;
|
private final PqSensitiveUserFeignClient pqSensitiveUserFeignClient;
|
||||||
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
@@ -72,6 +74,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||||
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
||||||
private final DictTreeFeignClient dictTreeFeignClient;
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
|
private final CsHarmonicPlanFeignClient csHarmonicPlanFeignClient;
|
||||||
|
private final CsHarmonicPlanLineFeignClient csHarmonicPlanLineFeignClient;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -158,7 +162,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
po.setClDid(param.getLineNo());
|
po.setClDid(param.getLineNo());
|
||||||
//监测位置
|
//监测位置
|
||||||
//DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.GRID_SIDE.getCode()).getData();
|
//DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.GRID_SIDE.getCode()).getData();
|
||||||
po.setPosition(param.getPosition());
|
po.setPosition(param.getPosition().isEmpty()?null:param.getPosition());
|
||||||
this.save(po);
|
this.save(po);
|
||||||
|
|
||||||
//2.新增台账树信息
|
//2.新增台账树信息
|
||||||
@@ -171,6 +175,17 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
csLedger.setState(1);
|
csLedger.setState(1);
|
||||||
csLedger.setSort(0);
|
csLedger.setSort(0);
|
||||||
csLedgerMapper.insert(csLedger);
|
csLedgerMapper.insert(csLedger);
|
||||||
|
|
||||||
|
//3.新增稳态事件指标配置
|
||||||
|
csHarmonicPlanLineFeignClient.deleteByLineIds(Collections.singletonList(lineId));
|
||||||
|
List<CsHarmonicPlan> planList = csHarmonicPlanFeignClient.getByName("通用方案").getData();
|
||||||
|
if (CollectionUtil.isNotEmpty(planList)) {
|
||||||
|
CsHarmonicPlan plan = planList.get(0);
|
||||||
|
CsHarmonicPlanLineParam param1 = new CsHarmonicPlanLineParam();
|
||||||
|
param1.setId(plan.getId());
|
||||||
|
param1.setLineIds(Collections.singletonList(lineId));
|
||||||
|
csHarmonicPlanLineFeignClient.savePlanLines(param1);
|
||||||
|
}
|
||||||
return po;
|
return po;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,6 +249,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
|
|
||||||
this.removeById(id);
|
this.removeById(id);
|
||||||
csLedgerMapper.deleteById(id);
|
csLedgerMapper.deleteById(id);
|
||||||
|
//删除稳态事件指标配置
|
||||||
|
csHarmonicPlanLineFeignClient.deleteByLineIds(Collections.singletonList(id));
|
||||||
|
|
||||||
//新增台账日志
|
//新增台账日志
|
||||||
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||||
@@ -473,8 +490,10 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
public List<CsLinePO> getLineList(CsLinePO param) {
|
public List<CsLinePO> getLineList(CsLinePO param) {
|
||||||
List<String> keywordsLineIds = new ArrayList<>();
|
List<String> keywordsLineIds = new ArrayList<>();
|
||||||
List<CsLinePO> poList = getSimpleLine();
|
List<CsLinePO> poList = getSimpleLine();
|
||||||
if (CollUtil.isNotEmpty(poList)) {
|
if (CollUtil.isNotEmpty(poList) && !poList.isEmpty()) {
|
||||||
keywordsLineIds = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
keywordsLineIds = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
return poList;
|
||||||
}
|
}
|
||||||
List<CsLinePO> result = this.list(new LambdaQueryWrapper<CsLinePO>()
|
List<CsLinePO> result = this.list(new LambdaQueryWrapper<CsLinePO>()
|
||||||
.eq(CsLinePO::getStatus, 1)
|
.eq(CsLinePO::getStatus, 1)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@@ -163,7 +164,7 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
|||||||
@Override
|
@Override
|
||||||
public List<CsTerminalReply> getBzReplyData(String lineId) {
|
public List<CsTerminalReply> getBzReplyData(String lineId) {
|
||||||
LambdaQueryWrapper<CsTerminalReply> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsTerminalReply> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.in(CsTerminalReply::getCode,Arrays.asList("allFile","allEvent","oneFile"))
|
wrapper.in(CsTerminalReply::getCode,Arrays.asList("allFile","allEvent","oneFile","harmonic"))
|
||||||
.orderByDesc(CsTerminalReply::getCreateTime);
|
.orderByDesc(CsTerminalReply::getCreateTime);
|
||||||
if (!Objects.isNull(lineId) && StringUtils.isNotBlank(lineId)) {
|
if (!Objects.isNull(lineId) && StringUtils.isNotBlank(lineId)) {
|
||||||
wrapper.like(CsTerminalReply::getLineId,lineId);
|
wrapper.like(CsTerminalReply::getLineId,lineId);
|
||||||
@@ -177,30 +178,13 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
|||||||
QueryWrapper<CsTerminalReply> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<CsTerminalReply> queryWrapper = new QueryWrapper<>();
|
||||||
if (StrUtil.isNotBlank(param.getSearchValue())) {
|
if (StrUtil.isNotBlank(param.getSearchValue())) {
|
||||||
queryWrapper.like("cs_terminal_reply.line_id", param.getSearchValue());
|
queryWrapper.like("cs_terminal_reply.line_id", param.getSearchValue());
|
||||||
// //获取监测点id
|
|
||||||
// List<CsLinePO> list = csLinePOService.getLineByName(param.getSearchValue());
|
|
||||||
// if (CollectionUtil.isEmpty(list)) {
|
|
||||||
// return page;
|
|
||||||
// } else {
|
|
||||||
// queryWrapper.and(pr -> {
|
|
||||||
// // 获取所有 lineId
|
|
||||||
// List<String> lineIds = list.stream()
|
|
||||||
// .map(CsLinePO::getLineId)
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
// // 使用 OR 条件连接多个 lineId
|
|
||||||
// for (int i = 0; i < lineIds.size(); i++) {
|
|
||||||
// if (i == 0) {
|
|
||||||
// pr.like("cs_terminal_reply.line_id", lineIds.get(i));
|
|
||||||
// } else {
|
|
||||||
// pr.or().like("cs_terminal_reply.line_id", lineIds.get(i));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
queryWrapper.between("cs_terminal_reply.Create_Time"
|
||||||
|
, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime()))
|
||||||
|
, DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())));
|
||||||
//排序
|
//排序
|
||||||
queryWrapper.orderBy(true, false, "cs_terminal_reply.create_time");
|
queryWrapper.orderBy(true, false, "cs_terminal_reply.create_time");
|
||||||
queryWrapper.in("cs_terminal_reply.code", Arrays.asList("allFile", "allEvent", "oneFile"));
|
queryWrapper.in("cs_terminal_reply.code", Arrays.asList("allFile", "allEvent", "oneFile","harmonic"));
|
||||||
Page<CsTerminalReply> csTerminalReplyPage = this.baseMapper.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), queryWrapper);
|
Page<CsTerminalReply> csTerminalReplyPage = this.baseMapper.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), queryWrapper);
|
||||||
|
|
||||||
List<CsTerminalReply> records = csTerminalReplyPage.getRecords();
|
List<CsTerminalReply> records = csTerminalReplyPage.getRecords();
|
||||||
@@ -209,6 +193,9 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
|||||||
Map<String, CsLedgerVO> ledgerMap = data.stream().collect(Collectors.toMap(CsLedgerVO::getId, Function.identity()));
|
Map<String, CsLedgerVO> ledgerMap = data.stream().collect(Collectors.toMap(CsLedgerVO::getId, Function.identity()));
|
||||||
List<CldLogsVo> cldLogsVos = new ArrayList<>();
|
List<CldLogsVo> cldLogsVos = new ArrayList<>();
|
||||||
records.forEach(item->{
|
records.forEach(item->{
|
||||||
|
if (Objects.isNull(ledgerMap.get(item.getDeviceId()))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String pids = ledgerMap.get(item.getDeviceId()).getPids();
|
String pids = ledgerMap.get(item.getDeviceId()).getPids();
|
||||||
String[] split = pids.split(",");
|
String[] split = pids.split(",");
|
||||||
CldLogsVo cldLogsVo = new CldLogsVo();
|
CldLogsVo cldLogsVo = new CldLogsVo();
|
||||||
@@ -278,6 +265,9 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
|||||||
case "oneFile":
|
case "oneFile":
|
||||||
result = "补召单事件波形";
|
result = "补召单事件波形";
|
||||||
break;
|
break;
|
||||||
|
case "harmonic":
|
||||||
|
result = "稳态数据";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
result = "未知";
|
result = "未知";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.csdevice.mapper.CsUpgradeLogsMapper;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsUpgradeLogs;
|
||||||
|
import com.njcn.csdevice.service.CsUpgradeLogsService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2026-04-23
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CsUpgradeLogsServiceImpl extends ServiceImpl<CsUpgradeLogsMapper, CsUpgradeLogs> implements CsUpgradeLogsService {
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
|
||||||
import com.njcn.csdevice.api.CsDeviceUserFeignClient;
|
import com.njcn.csdevice.api.CsDeviceUserFeignClient;
|
||||||
import com.njcn.csdevice.param.DeviceMessageParam;
|
import com.njcn.csdevice.param.DeviceMessageParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
@@ -18,6 +17,7 @@ import com.njcn.user.api.UserFeignClient;
|
|||||||
import com.njcn.user.pojo.po.User;
|
import com.njcn.user.pojo.po.User;
|
||||||
import com.njcn.user.pojo.po.app.AppInfoSet;
|
import com.njcn.user.pojo.po.app.AppInfoSet;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -25,6 +25,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
class DeviceMessageServiceImpl implements DeviceMessageService {
|
class DeviceMessageServiceImpl implements DeviceMessageService {
|
||||||
|
|
||||||
private final AppUserFeignClient appUserFeignClient;
|
private final AppUserFeignClient appUserFeignClient;
|
||||||
@@ -37,17 +38,17 @@ class DeviceMessageServiceImpl implements DeviceMessageService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getEventUserByDeviceId(String devId, Boolean isAdmin) {
|
public List<String> getEventUserByDeviceId(String devId, Boolean isAdmin) {
|
||||||
List<String> list = csDeviceUserFeignClient.findUserById(devId).getData();
|
|
||||||
List<String> result = new ArrayList<>(list);
|
|
||||||
if (isAdmin) {
|
|
||||||
List<User> adminUser = appUserFeignClient.getAdminInfo().getData();
|
List<User> adminUser = appUserFeignClient.getAdminInfo().getData();
|
||||||
List<String> adminList = adminUser.stream().map(User::getId).collect(Collectors.toList());
|
List<String> adminList = adminUser.stream().map(User::getId).collect(Collectors.toList());
|
||||||
result.addAll(adminList);
|
if (isAdmin) {
|
||||||
|
List<String> list = csDeviceUserFeignClient.findUserById(devId).getData();
|
||||||
|
List<String> result = new ArrayList<>(list);
|
||||||
|
adminList.addAll(result);
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(result)) {
|
if (CollectionUtil.isNotEmpty(adminList)) {
|
||||||
result = result.stream().distinct().collect(Collectors.toList());
|
adminList = adminList.stream().distinct().collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
return result;
|
return adminList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -86,14 +87,20 @@ class DeviceMessageServiceImpl implements DeviceMessageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getLineInfo(String id) {
|
public void getLineInfo(String id, List<CsLinePO> list) {
|
||||||
Map<Integer,String> map = new HashMap<>();
|
Map<Integer,String> map = new HashMap<>();
|
||||||
List<CsLinePO> lineList = csLinePOService.findByNdid(id);
|
List<CsLinePO> lineList;
|
||||||
|
if (CollectionUtil.isNotEmpty(list) && list != null) {
|
||||||
|
lineList = list;
|
||||||
|
} else {
|
||||||
|
lineList = csLinePOService.findByNdid(id);
|
||||||
|
}
|
||||||
if (CollectionUtil.isEmpty(lineList)){
|
if (CollectionUtil.isEmpty(lineList)){
|
||||||
throw new BusinessException("监测点为空");
|
log.error("监测点为空");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
for (CsLinePO item : lineList) {
|
for (CsLinePO item : lineList) {
|
||||||
if (Objects.isNull(item.getPosition())){
|
if (Objects.isNull(item.getPosition()) || item.getPosition().isEmpty()){
|
||||||
map.put(item.getClDid(),item.getLineId());
|
map.put(item.getClDid(),item.getLineId());
|
||||||
} else {
|
} else {
|
||||||
DictData dictData = dicDataFeignClient.getDicDataById(item.getPosition()).getData();
|
DictData dictData = dicDataFeignClient.getDicDataById(item.getPosition()).getData();
|
||||||
@@ -103,6 +110,8 @@ class DeviceMessageServiceImpl implements DeviceMessageService {
|
|||||||
map.put(1,item.getLineId());
|
map.put(1,item.getLineId());
|
||||||
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
|
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
|
||||||
map.put(2,item.getLineId());
|
map.put(2,item.getLineId());
|
||||||
|
} else {
|
||||||
|
map.put(item.getClDid(),item.getLineId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,13 +251,13 @@ class IcdServiceImpl implements IcdService {
|
|||||||
DatePattern.NORM_DATETIME_PATTERN
|
DatePattern.NORM_DATETIME_PATTERN
|
||||||
);
|
);
|
||||||
if (CollectionUtil.isNotEmpty(param.getLineList())) {
|
if (CollectionUtil.isNotEmpty(param.getLineList())) {
|
||||||
processWithLineIds(param.getLineList(), beginDay, endDay);
|
processWithLineIds(param.getLineList(), beginDay, endDay, param.getBzType());
|
||||||
} else {
|
} else {
|
||||||
processWithoutLineIds(beginDay, endDay);
|
processWithoutLineIds(beginDay, endDay, param.getBzType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processWithLineIds(List<String> lineList, String beginDay, String endDay) {
|
private void processWithLineIds(List<String> lineList, String beginDay, String endDay, Integer bzType) {
|
||||||
List<CsLinePO> csLineList = csLinePOService.listByIds(lineList);
|
List<CsLinePO> csLineList = csLinePOService.listByIds(lineList);
|
||||||
List<String> deviceIdList = csLineList.stream()
|
List<String> deviceIdList = csLineList.stream()
|
||||||
.map(CsLinePO::getDeviceId)
|
.map(CsLinePO::getDeviceId)
|
||||||
@@ -268,10 +268,10 @@ class IcdServiceImpl implements IcdService {
|
|||||||
Map<String, List<CsEquipmentDeliveryPO>> devMap = equipmentList.stream()
|
Map<String, List<CsEquipmentDeliveryPO>> devMap = equipmentList.stream()
|
||||||
.collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeId));
|
.collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeId));
|
||||||
|
|
||||||
handleEventsAndLogs(devMap, csLineList, beginDay, endDay);
|
handleEventsAndLogs(devMap, csLineList, beginDay, endDay, bzType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processWithoutLineIds(String beginDay, String endDay) {
|
private void processWithoutLineIds(String beginDay, String endDay, Integer bzType) {
|
||||||
List<CsEquipmentDeliveryPO> devList = csEquipmentDeliveryService.getAllOnline();
|
List<CsEquipmentDeliveryPO> devList = csEquipmentDeliveryService.getAllOnline();
|
||||||
if (CollectionUtil.isEmpty(devList)) return;
|
if (CollectionUtil.isEmpty(devList)) return;
|
||||||
|
|
||||||
@@ -283,14 +283,15 @@ class IcdServiceImpl implements IcdService {
|
|||||||
Map<String, List<CsEquipmentDeliveryPO>> devMap = devList.stream()
|
Map<String, List<CsEquipmentDeliveryPO>> devMap = devList.stream()
|
||||||
.collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeId));
|
.collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeId));
|
||||||
|
|
||||||
handleEventsAndLogs(devMap, csLineList, beginDay, endDay);
|
handleEventsAndLogs(devMap, csLineList, beginDay, endDay, bzType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleEventsAndLogs(
|
private void handleEventsAndLogs(
|
||||||
Map<String, List<CsEquipmentDeliveryPO>> devMap,
|
Map<String, List<CsEquipmentDeliveryPO>> devMap,
|
||||||
List<CsLinePO> csLineList,
|
List<CsLinePO> csLineList,
|
||||||
String beginDay,
|
String beginDay,
|
||||||
String endDay
|
String endDay,
|
||||||
|
Integer bzType
|
||||||
) {
|
) {
|
||||||
devMap.forEach((nodeId, devices) -> {
|
devMap.forEach((nodeId, devices) -> {
|
||||||
List<BZEventMessage.Event> events = new ArrayList<>();
|
List<BZEventMessage.Event> events = new ArrayList<>();
|
||||||
@@ -300,13 +301,13 @@ class IcdServiceImpl implements IcdService {
|
|||||||
for (CsEquipmentDeliveryPO device : devices) {
|
for (CsEquipmentDeliveryPO device : devices) {
|
||||||
String uuid = IdUtil.simpleUUID();
|
String uuid = IdUtil.simpleUUID();
|
||||||
|
|
||||||
BZEventMessage.Event event = buildEvent(uuid, device, csLineList, beginDay, endDay);
|
BZEventMessage.Event event = buildEvent(uuid, device, csLineList, beginDay, endDay, bzType);
|
||||||
events.add(event);
|
events.add(event);
|
||||||
|
|
||||||
CsTerminalLogs log = buildTerminalLog(uuid, device, csLineList);
|
CsTerminalLogs log = buildTerminalLog(uuid, device, csLineList);
|
||||||
logsToSave.add(log);
|
logsToSave.add(log);
|
||||||
|
|
||||||
List<CsTerminalReply> reply = buildTerminalReply(uuid, device, csLineList);
|
List<CsTerminalReply> reply = buildTerminalReply(uuid, device, csLineList, bzType);
|
||||||
repliesToSave.addAll(reply);
|
repliesToSave.addAll(reply);
|
||||||
}
|
}
|
||||||
csTerminalLogsService.saveBatch(logsToSave);
|
csTerminalLogsService.saveBatch(logsToSave);
|
||||||
@@ -316,7 +317,7 @@ class IcdServiceImpl implements IcdService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private BZEventMessage.Event buildEvent(String guid, CsEquipmentDeliveryPO device,
|
private BZEventMessage.Event buildEvent(String guid, CsEquipmentDeliveryPO device,
|
||||||
List<CsLinePO> csLineList, String beginDay, String endDay) {
|
List<CsLinePO> csLineList, String beginDay, String endDay, Integer bzType) {
|
||||||
BZEventMessage.Event event = new BZEventMessage.Event();
|
BZEventMessage.Event event = new BZEventMessage.Event();
|
||||||
event.setGuid(guid);
|
event.setGuid(guid);
|
||||||
event.setTerminalId(device.getId());
|
event.setTerminalId(device.getId());
|
||||||
@@ -327,7 +328,11 @@ class IcdServiceImpl implements IcdService {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
event.setMonitorIdList(monitorIds);
|
event.setMonitorIdList(monitorIds);
|
||||||
|
if (bzType == 0) {
|
||||||
|
event.setDataType(0);
|
||||||
|
} else {
|
||||||
event.setDataType(1);
|
event.setDataType(1);
|
||||||
|
}
|
||||||
event.setTimeInterval(Collections.singletonList(beginDay + "~" + endDay));
|
event.setTimeInterval(Collections.singletonList(beginDay + "~" + endDay));
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
@@ -351,7 +356,7 @@ class IcdServiceImpl implements IcdService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<CsTerminalReply> buildTerminalReply(String replyId, CsEquipmentDeliveryPO device,
|
private List<CsTerminalReply> buildTerminalReply(String replyId, CsEquipmentDeliveryPO device,
|
||||||
List<CsLinePO> csLineList) {
|
List<CsLinePO> csLineList, Integer bzType) {
|
||||||
List<CsTerminalReply> replies = new ArrayList<>();
|
List<CsTerminalReply> replies = new ArrayList<>();
|
||||||
List<String> lineIds = csLineList.stream()
|
List<String> lineIds = csLineList.stream()
|
||||||
.filter(line -> Objects.equals(line.getDeviceId(), device.getId()))
|
.filter(line -> Objects.equals(line.getDeviceId(), device.getId()))
|
||||||
@@ -366,7 +371,11 @@ class IcdServiceImpl implements IcdService {
|
|||||||
reply.setDeviceId(device.getId());
|
reply.setDeviceId(device.getId());
|
||||||
reply.setLineId(lineId);
|
reply.setLineId(lineId);
|
||||||
reply.setIsReceived(0);
|
reply.setIsReceived(0);
|
||||||
|
if (bzType == 0) {
|
||||||
|
reply.setCode("harmonic");
|
||||||
|
} else {
|
||||||
reply.setCode("allEvent");
|
reply.setCode("allEvent");
|
||||||
|
}
|
||||||
replies.add(reply);
|
replies.add(reply);
|
||||||
});
|
});
|
||||||
return replies;
|
return replies;
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import java.time.ZoneId;
|
|||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,6 +66,27 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PqsCommunicateDto> getRawDataOne(LineCountEvaluateParam lineParam) {
|
||||||
|
List<PqsCommunicateDto> result = new ArrayList<>();
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
||||||
|
influxQueryWrapper.regular(PqsCommunicate::getDevId, lineParam.getLineId())
|
||||||
|
.select(PqsCommunicate::getTime)
|
||||||
|
.select(PqsCommunicate::getDevId)
|
||||||
|
.select(PqsCommunicate::getDescription)
|
||||||
|
.select(PqsCommunicate::getType)
|
||||||
|
.timeAsc()
|
||||||
|
.limit(1);
|
||||||
|
List<PqsCommunicate> list = pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||||
|
list.forEach(item -> {
|
||||||
|
PqsCommunicateDto dto = new PqsCommunicateDto();
|
||||||
|
BeanUtils.copyProperties(item, dto);
|
||||||
|
dto.setTime(DATE_TIME_FORMATTER.format(item.getTime()));
|
||||||
|
result.add(dto);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 获取时间段内的数据
|
* @Description: 获取时间段内的数据
|
||||||
* @Param:
|
* @Param:
|
||||||
@@ -88,6 +108,18 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PqsCommunicateDto> getRawData2(LineCountEvaluateParam lineParam) {
|
||||||
|
List<PqsCommunicateDto> result = new ArrayList<>();
|
||||||
|
List<PqsCommunicate> list = getPqsCommunicateData(lineParam);
|
||||||
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
|
list.forEach(item -> {
|
||||||
|
result.add(convertToDto(item));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理有数据的情况
|
* 处理有数据的情况
|
||||||
*/
|
*/
|
||||||
@@ -95,6 +127,20 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
|||||||
List<PqsCommunicateDto> result = new ArrayList<>();
|
List<PqsCommunicateDto> result = new ArrayList<>();
|
||||||
int lastIndex = list.size() - 1;
|
int lastIndex = list.size() - 1;
|
||||||
|
|
||||||
|
// 获取第一条数据,补充0点数据(状态与第一条相反)
|
||||||
|
PqsCommunicate firstItem = list.get(0);
|
||||||
|
PqsCommunicateDto firstData = new PqsCommunicateDto();
|
||||||
|
firstData.setTime(lineParam.getStartTime() + " 00:00:00");
|
||||||
|
firstData.setDevId(lineParam.getLineId().get(0));
|
||||||
|
if (Objects.equals(firstItem.getType(), 0)) {
|
||||||
|
firstData.setType(1);
|
||||||
|
firstData.setDescription("通讯正常");
|
||||||
|
} else {
|
||||||
|
firstData.setType(0);
|
||||||
|
firstData.setDescription("通讯中断");
|
||||||
|
}
|
||||||
|
result.add(firstData);
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
PqsCommunicate item = list.get(i);
|
PqsCommunicate item = list.get(i);
|
||||||
PqsCommunicateDto dto = convertToDto(item);
|
PqsCommunicateDto dto = convertToDto(item);
|
||||||
@@ -106,10 +152,10 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
|||||||
result.add(endData);
|
result.add(endData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理无数据的情况
|
* 处理无数据的情况
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,27 +2,27 @@ package com.njcn.csdevice.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||||
|
import com.njcn.advance.api.EventCauseFeignClient;
|
||||||
|
import com.njcn.advance.pojo.dto.EventAnalysisDTO;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
import com.njcn.csdevice.constant.DataParam;
|
import com.njcn.csdevice.constant.DataParam;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.csdevice.mapper.PortableOfflLogMapper;
|
import com.njcn.csdevice.mapper.PortableOfflLogMapper;
|
||||||
|
import com.njcn.csdevice.param.UploadDataParam;
|
||||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
|
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
|
||||||
import com.njcn.csdevice.pojo.po.PortableOfflLog;
|
import com.njcn.csdevice.pojo.po.PortableOfflLog;
|
||||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||||
import com.njcn.csdevice.service.CsLinePOService;
|
import com.njcn.csdevice.service.*;
|
||||||
import com.njcn.csdevice.service.IPortableOfflLogService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.njcn.csdevice.param.UploadDataParam;
|
|
||||||
import com.njcn.csdevice.service.IWlRecordService;
|
|
||||||
import com.njcn.csdevice.service.PortableOffMainLogService;
|
|
||||||
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||||
import com.njcn.csharmonic.api.EventFeignClient;
|
import com.njcn.csharmonic.api.EventFeignClient;
|
||||||
import com.njcn.csharmonic.api.OfflineDataUploadFeignClient;
|
import com.njcn.csharmonic.api.OfflineDataUploadFeignClient;
|
||||||
@@ -36,13 +36,17 @@ import com.njcn.csharmonic.offline.mincfg.AnalyseComtradeCfg;
|
|||||||
import com.njcn.csharmonic.offline.mincfg.vo.CmnModeCfg;
|
import com.njcn.csharmonic.offline.mincfg.vo.CmnModeCfg;
|
||||||
import com.njcn.csharmonic.offline.vo.Response;
|
import com.njcn.csharmonic.offline.vo.Response;
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.influx.imapper.EvtDataMapper;
|
import com.njcn.event.common.mapper.WlRmpEventDetailMapper;
|
||||||
import com.njcn.influx.imapper.PqdDataMapper;
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
|
import com.njcn.influx.imapper.*;
|
||||||
|
import com.njcn.influx.pojo.po.*;
|
||||||
import com.njcn.influx.pojo.po.cs.EntData;
|
import com.njcn.influx.pojo.po.cs.EntData;
|
||||||
import com.njcn.influx.pojo.po.cs.PqdData;
|
import com.njcn.influx.pojo.po.cs.PqdData;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.api.EleEvtFeignClient;
|
import com.njcn.system.api.EleEvtFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
import com.njcn.system.pojo.po.DictData;
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import com.njcn.web.pojo.param.BaseParam;
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -50,11 +54,10 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.collections4.ListUtils;
|
import org.apache.commons.collections4.ListUtils;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
@@ -81,29 +84,37 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
|
|
||||||
|
|
||||||
private final DecimalFormat df = new DecimalFormat("#0.000");
|
private final DecimalFormat df = new DecimalFormat("#0.000");
|
||||||
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
private final OfflineDataUploadFeignClient offlineDataUploadFeignClient;
|
private final OfflineDataUploadFeignClient offlineDataUploadFeignClient;
|
||||||
|
|
||||||
private final EleEvtFeignClient eleEvtFeignClient;
|
private final EleEvtFeignClient eleEvtFeignClient;
|
||||||
|
|
||||||
private final EventFeignClient eventFeignClient;
|
private final EventFeignClient eventFeignClient;
|
||||||
|
|
||||||
private final EquipmentFeignClient equipmentFeignClient;
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
private final InfluxDbParamUtil influxDbParamUtil;
|
private final InfluxDbParamUtil influxDbParamUtil;
|
||||||
|
|
||||||
private final PqdDataMapper pqdDataMapper;
|
private final PqdDataMapper pqdDataMapper;
|
||||||
|
|
||||||
private final EvtDataMapper evtDataMapper;
|
private final EvtDataMapper evtDataMapper;
|
||||||
|
|
||||||
|
private final DataVMapper dataVMapper;
|
||||||
|
private final DataIMapper dataIMapper;
|
||||||
|
private final DataHarmRateVMapper dataHarmRateV;
|
||||||
|
private final DataHarmRateIMapper dataHarmRateI;
|
||||||
|
private final DataInHarmVMapper dataInHarmV;
|
||||||
|
private final DataHarmPowerPMapper dataHarmPowerP;
|
||||||
|
private final DataHarmPowerQMapper dataHarmPowerQ;
|
||||||
|
private final DataHarmPowerSMapper dataHarmPowerS;
|
||||||
|
private final DataFlickerMapper dataFlicker;
|
||||||
|
private final DataFlucMapper dataFluc;
|
||||||
|
private final DataPltMapper dataPlt;
|
||||||
|
private final DataHarmPhasicVMapper dataHarmPhasicV;
|
||||||
|
private final DataHarmPhasicIMapper dataHarmPhasicI;
|
||||||
|
|
||||||
|
private final IPqdDataSplitService pqdDataSplitService;
|
||||||
private final MqttPublisher publisher;
|
private final MqttPublisher publisher;
|
||||||
private final PortableOffMainLogService portableOffMainLogService;
|
private final PortableOffMainLogService portableOffMainLogService;
|
||||||
private final IWlRecordService wlRecordService;
|
private final IWlRecordService wlRecordService;
|
||||||
private final CsLinePOService csLinePOService;
|
private final CsLinePOService csLinePOService;
|
||||||
|
private final WlRmpEventDetailMapper wlRmpEventDetailMapper;
|
||||||
|
private final EventCauseFeignClient eventCauseFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
|
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
|
||||||
@@ -177,7 +188,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@DSTransactional
|
||||||
public void importEquipment(UploadDataParam uploadDataParam){
|
public void importEquipment(UploadDataParam uploadDataParam){
|
||||||
String lineId = uploadDataParam.getLineId();
|
String lineId = uploadDataParam.getLineId();
|
||||||
//获取监测点信息
|
//获取监测点信息
|
||||||
@@ -337,7 +348,6 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
.eq(WlRecord::getEndTime,wlRecord.getEndTime()).update();
|
.eq(WlRecord::getEndTime,wlRecord.getEndTime()).update();
|
||||||
wlRecordService.save(wlRecord);
|
wlRecordService.save(wlRecord);
|
||||||
|
|
||||||
|
|
||||||
//如果明确返回了state 那么当前文件解析出错
|
//如果明确返回了state 那么当前文件解析出错
|
||||||
if(response.getState() != null){
|
if(response.getState() != null){
|
||||||
portableOfflLog.setState(response.getState());
|
portableOfflLog.setState(response.getState());
|
||||||
@@ -353,7 +363,8 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
List<List<PqdData>> partition = ListUtils.partition(pqdData, 1500);
|
List<List<PqdData>> partition = ListUtils.partition(pqdData, 1500);
|
||||||
for (List<PqdData> sliceList : partition) {
|
for (List<PqdData> sliceList : partition) {
|
||||||
List<PqdData> sublistAsOriginalListType = new ArrayList<>(sliceList);
|
List<PqdData> sublistAsOriginalListType = new ArrayList<>(sliceList);
|
||||||
pqdDataMapper.insertBatch(sublistAsOriginalListType);
|
Map<String, Object> map = pqdDataSplitService.splitPqdData(sublistAsOriginalListType);
|
||||||
|
insertData(map);
|
||||||
}
|
}
|
||||||
//min结果集解析入库后就不需要在解析了
|
//min结果集解析入库后就不需要在解析了
|
||||||
minFlag = false;
|
minFlag = false;
|
||||||
@@ -381,6 +392,8 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
}
|
}
|
||||||
List<NewTaglogbuffer> newTaglogbuffers = (List<NewTaglogbuffer>) response.getObj();
|
List<NewTaglogbuffer> newTaglogbuffers = (List<NewTaglogbuffer>) response.getObj();
|
||||||
if(newTaglogbuffers != null && !newTaglogbuffers.isEmpty()){
|
if(newTaglogbuffers != null && !newTaglogbuffers.isEmpty()){
|
||||||
|
List<DictData> list1 = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_REASON.getCode()).getData();
|
||||||
|
List<DictData> list2 = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_TYPE.getCode()).getData();
|
||||||
//否则正常标记为成功解析
|
//否则正常标记为成功解析
|
||||||
portableOfflLog.setState(1);
|
portableOfflLog.setState(1);
|
||||||
portableOfflLog.setAllCount(newTaglogbuffers.size());
|
portableOfflLog.setAllCount(newTaglogbuffers.size());
|
||||||
@@ -451,14 +464,32 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
csEventPO.setWavePath(wavePath);
|
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);
|
csEventPO.setType(0);
|
||||||
String clDid = influxDbParamUtil.getClDidByLineId(uploadDataParam.getLineId());
|
String clDid = influxDbParamUtil.getClDidByLineId(uploadDataParam.getLineId());
|
||||||
csEventPO.setClDid(clDid == null ? null : Integer.parseInt(clDid));
|
csEventPO.setClDid(clDid == null ? null : Integer.parseInt(clDid));
|
||||||
|
|
||||||
|
|
||||||
csEventPO.setProcess(csEquipmentDeliveryDTO.getProcess());
|
csEventPO.setProcess(csEquipmentDeliveryDTO.getProcess());
|
||||||
csEventPOS.add(csEventPO);
|
|
||||||
|
|
||||||
EntData entData = new EntData();
|
EntData entData = new EntData();
|
||||||
entData.setUuid(csEventPO.getId());
|
entData.setUuid(csEventPO.getId());
|
||||||
entData.setTime(new Date().toInstant());
|
entData.setTime(new Date().toInstant());
|
||||||
@@ -503,12 +534,19 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
log.info("类型log,插入infulxDb的evtData");
|
log.info("类型log,插入infulxDb的evtData");
|
||||||
try {
|
try {
|
||||||
evtDataMapper.insertOne(entData);
|
evtDataMapper.insertOne(entData);
|
||||||
|
//添加其余数据
|
||||||
|
csEventPO.setPhase(entData.getEvtParamPhase());
|
||||||
|
csEventPO.setPersistTime(entData.getEvtParamTm());
|
||||||
|
csEventPO.setAmplitude(entData.getEvtParamVVaDepth());
|
||||||
|
csEventPOS.add(csEventPO);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("类型log,插入mysql事件表cs_event");
|
log.info("类型log,插入mysql事件表cs_event");
|
||||||
eventFeignClient.saveBatchEventList(csEventPOS);
|
eventFeignClient.saveBatchEventList(csEventPOS);
|
||||||
|
//同步数据到 r_mp_event_detail
|
||||||
|
csEventPOS.forEach(this::insertEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -529,6 +567,62 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
portableOffMainLogService.save(portableOffMainLog);
|
portableOffMainLogService.save(portableOffMainLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void insertEvent(CsEventPO item) {
|
||||||
|
RmpEventDetailPO rmpEventDetailPo = new RmpEventDetailPO();
|
||||||
|
rmpEventDetailPo.setEventId(item.getId());
|
||||||
|
rmpEventDetailPo.setMeasurementPointId(item.getLineId());
|
||||||
|
rmpEventDetailPo.setStartTime(item.getStartTime());
|
||||||
|
rmpEventDetailPo.setEventType(getEventType(item.getTag()));
|
||||||
|
rmpEventDetailPo.setFeatureAmplitude(item.getAmplitude());
|
||||||
|
rmpEventDetailPo.setDuration(item.getPersistTime());
|
||||||
|
rmpEventDetailPo.setEventDescribe(getTag(item.getTag()));
|
||||||
|
rmpEventDetailPo.setDealFlag(0);
|
||||||
|
rmpEventDetailPo.setFileFlag(0);
|
||||||
|
rmpEventDetailPo.setPhase(item.getPhase());
|
||||||
|
rmpEventDetailPo.setAdvanceReason(item.getAdvanceReason());
|
||||||
|
rmpEventDetailPo.setAdvanceType(item.getAdvanceType());
|
||||||
|
wlRmpEventDetailMapper.insert(rmpEventDetailPo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTag(String tag) {
|
||||||
|
switch (tag) {
|
||||||
|
case "Evt_Sys_DipStr":
|
||||||
|
tag = DicDataEnum.VOLTAGE_DIP.getCode();
|
||||||
|
break;
|
||||||
|
case "Evt_Sys_SwlStr":
|
||||||
|
tag = DicDataEnum.VOLTAGE_RISE.getCode();
|
||||||
|
break;
|
||||||
|
case "Evt_Sys_IntrStr":
|
||||||
|
tag = DicDataEnum.SHORT_INTERRUPTIONS.getCode();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tag = "Un_Know";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEventType(String tag) {
|
||||||
|
switch (tag) {
|
||||||
|
case "Evt_Sys_DipStr":
|
||||||
|
DictData dip = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
|
||||||
|
tag = dip.getId();
|
||||||
|
break;
|
||||||
|
case "Evt_Sys_SwlStr":
|
||||||
|
DictData rise = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_RISE.getCode()).getData();
|
||||||
|
tag = rise.getId();
|
||||||
|
break;
|
||||||
|
case "Evt_Sys_IntrStr":
|
||||||
|
DictData interruptions = dicDataFeignClient.getDicDataByCode(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getData();
|
||||||
|
tag = interruptions.getId();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tag = "Un_Know";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<PortableOffMainLog> queryMainLogPage(BaseParam baseParam) {
|
public Page<PortableOffMainLog> queryMainLogPage(BaseParam baseParam) {
|
||||||
Page<PortableOffMainLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ());
|
Page<PortableOffMainLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ());
|
||||||
@@ -587,7 +681,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
String dictDataCode = null;
|
String dictDataCode = null;
|
||||||
switch (volConType) {
|
switch (volConType) {
|
||||||
case 0:
|
case 0:
|
||||||
dictDataCode = "star";
|
dictDataCode = "Trans_Business";
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
dictDataCode = "Star_Triangle";
|
dictDataCode = "Star_Triangle";
|
||||||
@@ -604,4 +698,87 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
}
|
}
|
||||||
return Objects.isNull(result)?null:result;
|
return Objects.isNull(result)?null:result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void insertData(Map<String, Object> map) {
|
||||||
|
//13张表
|
||||||
|
map.forEach((key, value) -> {
|
||||||
|
switch (key) {
|
||||||
|
case "data_v":
|
||||||
|
dataVMapper.insertBatch((List<DataV>) value);
|
||||||
|
break;
|
||||||
|
case "data_i":
|
||||||
|
dataIMapper.insertBatch((List<DataI>) value);
|
||||||
|
break;
|
||||||
|
case "data_flicker":
|
||||||
|
//10分钟入一组
|
||||||
|
List<DataFlicker> list = (List<DataFlicker>) value;
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
list.forEach(item->{
|
||||||
|
Instant time = getTime(item.getTime(),600);
|
||||||
|
item.setTime(time);
|
||||||
|
});
|
||||||
|
dataFlicker.insertBatch(list);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "data_fluc":
|
||||||
|
//10分钟入一组
|
||||||
|
List<DataFluc> list2 = (List<DataFluc>) value;
|
||||||
|
if (!CollectionUtils.isEmpty(list2)) {
|
||||||
|
list2.forEach(item->{
|
||||||
|
Instant time = getTime(item.getTime(),600);
|
||||||
|
item.setTime(time);
|
||||||
|
});
|
||||||
|
dataFluc.insertBatch(list2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "data_harmphasic_i":
|
||||||
|
dataHarmPhasicI.insertBatch((List<DataHarmPhasicI>) value);
|
||||||
|
break;
|
||||||
|
case "data_harmphasic_v":
|
||||||
|
dataHarmPhasicV.insertBatch((List<DataHarmPhasicV>) value);
|
||||||
|
break;
|
||||||
|
case "data_harmpower_p":
|
||||||
|
dataHarmPowerP.insertBatch((List<DataHarmPowerP>) value);
|
||||||
|
break;
|
||||||
|
case "data_harmpower_q":
|
||||||
|
dataHarmPowerQ.insertBatch((List<DataHarmPowerQ>) value);
|
||||||
|
break;
|
||||||
|
case "data_harmpower_s":
|
||||||
|
dataHarmPowerS.insertBatch((List<DataHarmPowerS>) value);
|
||||||
|
break;
|
||||||
|
case "data_harmrate_v":
|
||||||
|
dataHarmRateV.insertBatch((List<DataHarmRateV>) value);
|
||||||
|
break;
|
||||||
|
case "data_harmrate_i":
|
||||||
|
dataHarmRateI.insertBatch((List<DataHarmRateI>) value);
|
||||||
|
break;
|
||||||
|
case "data_inharm_v":
|
||||||
|
dataInHarmV.insertBatch((List<DataInHarmV>) value);
|
||||||
|
break;
|
||||||
|
case "data_plt":
|
||||||
|
//2小时入一组
|
||||||
|
List<DataPlt> list3 = (List<DataPlt>) value;
|
||||||
|
if (!CollectionUtils.isEmpty(list3)) {
|
||||||
|
list3.forEach(item->{
|
||||||
|
Instant time = getTime(item.getTime(),7200);
|
||||||
|
item.setTime(time);
|
||||||
|
});
|
||||||
|
dataPlt.insertBatch(list3);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "pqd_data":
|
||||||
|
pqdDataMapper.insertBatch((List<PqdData>) value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
log.warn("不支持的目标表: {}", key);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getTime(Instant time, Integer interval) {
|
||||||
|
long originalTimeSec = time.getEpochSecond();
|
||||||
|
long newTimeSec = (originalTimeSec / interval) * interval;
|
||||||
|
return Instant.ofEpochSecond(newTimeSec);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,470 @@
|
|||||||
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||||
|
import com.njcn.csdevice.service.IPqdDataSplitService;
|
||||||
|
import com.njcn.influx.pojo.po.*;
|
||||||
|
import com.njcn.influx.pojo.po.cs.PqdData;
|
||||||
|
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||||
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
|
import com.njcn.system.api.EpdFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.pojo.po.DictData;
|
||||||
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
|
import com.njcn.system.pojo.vo.EleEpdPqdListVO;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PqdData数据拆分服务实现
|
||||||
|
*
|
||||||
|
* @author system
|
||||||
|
* @since 2026-05-22
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class PqdDataSplitServiceImpl implements IPqdDataSplitService {
|
||||||
|
private final RedisUtil redisUtil;
|
||||||
|
private final EpdFeignClient epdFeignClient;
|
||||||
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> splitPqdData(List<PqdData> pqdDataList) {
|
||||||
|
//获取表映射关系
|
||||||
|
Map<String,String> map1 = new Gson().fromJson(String.valueOf(redisUtil.getObjectByKey(AppRedisKey.ELE_EPD_PQD)), Map.class);
|
||||||
|
//获取字段映射关系
|
||||||
|
DictData pqd = dicDataFeignClient.getDicDataByCode(DicDataEnum.PQD.getCode()).getData();
|
||||||
|
List<EleEpdPqdListVO> list = epdFeignClient.selectAll().getData();
|
||||||
|
List<EleEpdPqd> epdList = list.stream().filter(item -> Objects.equals(item.getDataType(), pqd.getId()))
|
||||||
|
.findFirst()
|
||||||
|
.map(EleEpdPqdListVO::getEleEpdPqdVOS)
|
||||||
|
.orElse(new ArrayList<>());
|
||||||
|
// 处理 harmStart 和 harmEnd
|
||||||
|
List<EleEpdPqd> resultList = epdList.stream()
|
||||||
|
.flatMap(item -> {
|
||||||
|
if (item.getHarmStart() != null && item.getHarmEnd() != null) {
|
||||||
|
List<EleEpdPqd> expandedList = new ArrayList<>();
|
||||||
|
for (int i = item.getHarmStart(); i <= item.getHarmEnd(); i++) {
|
||||||
|
EleEpdPqd newItem = copyEleEpdPqd(item);
|
||||||
|
newItem.setName(item.getName() + "_" + i);
|
||||||
|
newItem.setOtherName(item.getOtherName() + "_" + i);
|
||||||
|
expandedList.add(newItem);
|
||||||
|
}
|
||||||
|
return expandedList.stream();
|
||||||
|
} else {
|
||||||
|
return Stream.of(item);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
Map<String,List<EleEpdPqd>> map2 = resultList.stream().collect(Collectors.groupingBy(EleEpdPqd::getName,LinkedHashMap::new,Collectors.toList()));
|
||||||
|
Map<String,Object> map3 = new HashMap<>();
|
||||||
|
List<Object> list1 = new ArrayList<>();
|
||||||
|
List<Object> list2 = new ArrayList<>();
|
||||||
|
List<Object> list3 = new ArrayList<>();
|
||||||
|
List<Object> list4 = new ArrayList<>();
|
||||||
|
List<Object> list5 = new ArrayList<>();
|
||||||
|
List<Object> list6 = new ArrayList<>();
|
||||||
|
List<Object> list7 = new ArrayList<>();
|
||||||
|
List<Object> list8 = new ArrayList<>();
|
||||||
|
List<Object> list9 = new ArrayList<>();
|
||||||
|
List<Object> list10 = new ArrayList<>();
|
||||||
|
List<Object> list11 = new ArrayList<>();
|
||||||
|
List<Object> list12 = new ArrayList<>();
|
||||||
|
List<Object> list13 = new ArrayList<>();
|
||||||
|
List<Object> list14 = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (PqdData item : pqdDataList) {
|
||||||
|
Map<String, Object> map = extractFieldValues(item);
|
||||||
|
|
||||||
|
DataV dataV = new DataV();
|
||||||
|
dataV.setTime(item.getTime());
|
||||||
|
dataV.setLineId(item.getLineId());
|
||||||
|
dataV.setPhaseType(item.getPhaseType());
|
||||||
|
dataV.setValueType(item.getValueType());
|
||||||
|
dataV.setClDid(item.getClDid());
|
||||||
|
dataV.setProcess(item.getProcess());
|
||||||
|
dataV.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataI dataI = new DataI();
|
||||||
|
dataI.setTime(item.getTime());
|
||||||
|
dataI.setLineId(item.getLineId());
|
||||||
|
dataI.setPhaseType(item.getPhaseType());
|
||||||
|
dataI.setValueType(item.getValueType());
|
||||||
|
dataI.setClDid(item.getClDid());
|
||||||
|
dataI.setProcess(item.getProcess());
|
||||||
|
dataI.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataFlicker dataFlicker = new DataFlicker();
|
||||||
|
dataFlicker.setTime(item.getTime());
|
||||||
|
dataFlicker.setLineId(item.getLineId());
|
||||||
|
dataFlicker.setPhaseType(item.getPhaseType());
|
||||||
|
dataFlicker.setValueType(item.getValueType());
|
||||||
|
dataFlicker.setClDid(item.getClDid());
|
||||||
|
dataFlicker.setProcess(item.getProcess());
|
||||||
|
dataFlicker.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataFluc dataFluc = new DataFluc();
|
||||||
|
dataFluc.setTime(item.getTime());
|
||||||
|
dataFluc.setLineId(item.getLineId());
|
||||||
|
dataFluc.setPhaseType(item.getPhaseType());
|
||||||
|
dataFluc.setValueType(item.getValueType());
|
||||||
|
dataFluc.setClDid(item.getClDid());
|
||||||
|
dataFluc.setProcess(item.getProcess());
|
||||||
|
dataFluc.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataHarmPhasicI dataHarmPhasicI = new DataHarmPhasicI();
|
||||||
|
dataHarmPhasicI.setTime(item.getTime());
|
||||||
|
dataHarmPhasicI.setLineId(item.getLineId());
|
||||||
|
dataHarmPhasicI.setPhaseType(item.getPhaseType());
|
||||||
|
dataHarmPhasicI.setValueType(item.getValueType());
|
||||||
|
dataHarmPhasicI.setClDid(item.getClDid());
|
||||||
|
dataHarmPhasicI.setProcess(item.getProcess());
|
||||||
|
dataHarmPhasicI.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataHarmPhasicV dataHarmPhasicV = new DataHarmPhasicV();
|
||||||
|
dataHarmPhasicV.setTime(item.getTime());
|
||||||
|
dataHarmPhasicV.setLineId(item.getLineId());
|
||||||
|
dataHarmPhasicV.setPhaseType(item.getPhaseType());
|
||||||
|
dataHarmPhasicV.setValueType(item.getValueType());
|
||||||
|
dataHarmPhasicV.setClDid(item.getClDid());
|
||||||
|
dataHarmPhasicV.setProcess(item.getProcess());
|
||||||
|
dataHarmPhasicV.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataHarmPowerP dataHarmPowerP = new DataHarmPowerP();
|
||||||
|
dataHarmPowerP.setTime(item.getTime());
|
||||||
|
dataHarmPowerP.setLineId(item.getLineId());
|
||||||
|
dataHarmPowerP.setPhaseType(item.getPhaseType());
|
||||||
|
dataHarmPowerP.setValueType(item.getValueType());
|
||||||
|
dataHarmPowerP.setClDid(item.getClDid());
|
||||||
|
dataHarmPowerP.setProcess(item.getProcess());
|
||||||
|
dataHarmPowerP.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataHarmPowerQ dataHarmPowerQ = new DataHarmPowerQ();
|
||||||
|
dataHarmPowerQ.setTime(item.getTime());
|
||||||
|
dataHarmPowerQ.setLineId(item.getLineId());
|
||||||
|
dataHarmPowerQ.setPhaseType(item.getPhaseType());
|
||||||
|
dataHarmPowerQ.setValueType(item.getValueType());
|
||||||
|
dataHarmPowerQ.setClDid(item.getClDid());
|
||||||
|
dataHarmPowerQ.setProcess(item.getProcess());
|
||||||
|
dataHarmPowerQ.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataHarmPowerS dataHarmPowerS = new DataHarmPowerS();
|
||||||
|
dataHarmPowerS.setTime(item.getTime());
|
||||||
|
dataHarmPowerS.setLineId(item.getLineId());
|
||||||
|
dataHarmPowerS.setPhaseType(item.getPhaseType());
|
||||||
|
dataHarmPowerS.setValueType(item.getValueType());
|
||||||
|
dataHarmPowerS.setClDid(item.getClDid());
|
||||||
|
dataHarmPowerS.setProcess(item.getProcess());
|
||||||
|
dataHarmPowerS.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataHarmRateV dataHarmRateV = new DataHarmRateV();
|
||||||
|
dataHarmRateV.setTime(item.getTime());
|
||||||
|
dataHarmRateV.setLineId(item.getLineId());
|
||||||
|
dataHarmRateV.setPhaseType(item.getPhaseType());
|
||||||
|
dataHarmRateV.setValueType(item.getValueType());
|
||||||
|
dataHarmRateV.setClDid(item.getClDid());
|
||||||
|
dataHarmRateV.setProcess(item.getProcess());
|
||||||
|
dataHarmRateV.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataHarmRateI dataHarmRateI = new DataHarmRateI();
|
||||||
|
dataHarmRateI.setTime(item.getTime());
|
||||||
|
dataHarmRateI.setLineId(item.getLineId());
|
||||||
|
dataHarmRateI.setPhaseType(item.getPhaseType());
|
||||||
|
dataHarmRateI.setValueType(item.getValueType());
|
||||||
|
dataHarmRateI.setClDid(item.getClDid());
|
||||||
|
dataHarmRateI.setProcess(item.getProcess());
|
||||||
|
dataHarmRateI.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataInHarmV dataInHarmV = new DataInHarmV();
|
||||||
|
dataInHarmV.setTime(item.getTime());
|
||||||
|
dataInHarmV.setLineId(item.getLineId());
|
||||||
|
dataInHarmV.setPhaseType(item.getPhaseType());
|
||||||
|
dataInHarmV.setValueType(item.getValueType());
|
||||||
|
dataInHarmV.setClDid(item.getClDid());
|
||||||
|
dataInHarmV.setProcess(item.getProcess());
|
||||||
|
dataInHarmV.setQualityFlag("0");
|
||||||
|
|
||||||
|
DataPlt dataPlt = new DataPlt();
|
||||||
|
dataPlt.setTime(item.getTime());
|
||||||
|
dataPlt.setLineId(item.getLineId());
|
||||||
|
dataPlt.setPhaseType(item.getPhaseType());
|
||||||
|
dataPlt.setValueType(item.getValueType());
|
||||||
|
dataPlt.setClDid(item.getClDid());
|
||||||
|
dataPlt.setProcess(item.getProcess());
|
||||||
|
dataPlt.setQualityFlag("0");
|
||||||
|
|
||||||
|
PqdData pqdData = new PqdData();
|
||||||
|
pqdData.setTime(item.getTime());
|
||||||
|
pqdData.setLineId(item.getLineId());
|
||||||
|
pqdData.setPhaseType(item.getPhaseType());
|
||||||
|
pqdData.setValueType(item.getValueType());
|
||||||
|
pqdData.setClDid(item.getClDid());
|
||||||
|
pqdData.setProcess(item.getProcess());
|
||||||
|
pqdData.setQualityFlag("0");
|
||||||
|
|
||||||
|
|
||||||
|
boolean hasDataV = false;
|
||||||
|
boolean hasDataI = false;
|
||||||
|
boolean hasData1 = false;
|
||||||
|
boolean hasData2 = false;
|
||||||
|
boolean hasData3 = false;
|
||||||
|
boolean hasData4 = false;
|
||||||
|
boolean hasData5 = false;
|
||||||
|
boolean hasData6 = false;
|
||||||
|
boolean hasData7 = false;
|
||||||
|
boolean hasData8 = false;
|
||||||
|
boolean hasData9 = false;
|
||||||
|
boolean hasData10 = false;
|
||||||
|
boolean hasData11 = false;
|
||||||
|
boolean hasData12 = false;
|
||||||
|
|
||||||
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||||
|
String fieldName = entry.getKey();
|
||||||
|
Object value = entry.getValue();
|
||||||
|
String capitalizedFieldName = StringUtils.capitalize(fieldName);
|
||||||
|
|
||||||
|
// 跳过公共字段和 null 值
|
||||||
|
if (isCommonField(fieldName) || value == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String table = map1.get(capitalizedFieldName);
|
||||||
|
if (StrUtil.isBlank(table)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<EleEpdPqd> epdPqdList = map2.get(capitalizedFieldName);
|
||||||
|
if (CollectionUtils.isEmpty(epdPqdList)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String influxdbName2 = epdPqdList.get(0).getOtherName();
|
||||||
|
if (StrUtil.isBlank(influxdbName2) || influxdbName2.equals(capitalizedFieldName)) {
|
||||||
|
influxdbName2 = capitalizedFieldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Objects.equals(table, "data_v")) {
|
||||||
|
setFieldValue(dataV, influxdbName2, value, true);
|
||||||
|
hasDataV = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_i")) {
|
||||||
|
setFieldValue(dataI, influxdbName2, value, true);
|
||||||
|
hasDataI = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_flicker")) {
|
||||||
|
setFieldValue(dataFlicker, influxdbName2, value, true);
|
||||||
|
hasData1 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_fluc")) {
|
||||||
|
setFieldValue(dataFluc, influxdbName2, value, true);
|
||||||
|
hasData2 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_harmphasic_i")) {
|
||||||
|
setFieldValue(dataHarmPhasicI, influxdbName2, value, true);
|
||||||
|
hasData3 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_harmphasic_v")) {
|
||||||
|
setFieldValue(dataHarmPhasicV, influxdbName2, value, true);
|
||||||
|
hasData4 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_harmpower_p")) {
|
||||||
|
setFieldValue(dataHarmPowerP, influxdbName2, value, true);
|
||||||
|
hasData5 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_harmpower_q")) {
|
||||||
|
setFieldValue(dataHarmPowerQ, influxdbName2, value, true);
|
||||||
|
hasData6 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_harmpower_s")) {
|
||||||
|
setFieldValue(dataHarmPowerS, influxdbName2, value, true);
|
||||||
|
hasData7 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_harmrate_v")) {
|
||||||
|
setFieldValue(dataHarmRateV, influxdbName2, value, true);
|
||||||
|
hasData8 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_harmrate_i")) {
|
||||||
|
setFieldValue(dataHarmRateI, influxdbName2, value, true);
|
||||||
|
hasData9 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_inharm_v")) {
|
||||||
|
setFieldValue(dataInHarmV, influxdbName2, value, true);
|
||||||
|
hasData10 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "data_plt")) {
|
||||||
|
setFieldValue(dataPlt, influxdbName2, value, true);
|
||||||
|
hasData11 = true;
|
||||||
|
}
|
||||||
|
if (Objects.equals(table, "pqd_data")) {
|
||||||
|
setFieldValue(pqdData, StringUtils.uncapitalize(influxdbName2), value, false);
|
||||||
|
hasData12 = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasDataV) {
|
||||||
|
list1.add(dataV);
|
||||||
|
}
|
||||||
|
if (hasDataI) {
|
||||||
|
list2.add(dataI);
|
||||||
|
}
|
||||||
|
if (hasData1) {
|
||||||
|
list3.add(dataFlicker);
|
||||||
|
}
|
||||||
|
if (hasData2) {
|
||||||
|
list4.add(dataFluc);
|
||||||
|
}
|
||||||
|
if (hasData3) {
|
||||||
|
list5.add(dataHarmPhasicI);
|
||||||
|
}
|
||||||
|
if (hasData4) {
|
||||||
|
list6.add(dataHarmPhasicV);
|
||||||
|
}
|
||||||
|
if (hasData5) {
|
||||||
|
list7.add(dataHarmPowerP);
|
||||||
|
}
|
||||||
|
if (hasData6) {
|
||||||
|
list8.add(dataHarmPowerQ);
|
||||||
|
}
|
||||||
|
if (hasData7) {
|
||||||
|
list9.add(dataHarmPowerS);
|
||||||
|
}
|
||||||
|
if (hasData8) {
|
||||||
|
list10.add(dataHarmRateV);
|
||||||
|
}
|
||||||
|
if (hasData9) {
|
||||||
|
list11.add(dataHarmRateI);
|
||||||
|
}
|
||||||
|
if (hasData10) {
|
||||||
|
list12.add(dataInHarmV);
|
||||||
|
}
|
||||||
|
if (hasData11) {
|
||||||
|
list13.add(dataPlt);
|
||||||
|
}
|
||||||
|
if (hasData12) {
|
||||||
|
list14.add(pqdData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
map3.put("data_v", list1);
|
||||||
|
map3.put("data_i", list2);
|
||||||
|
map3.put("data_flicker", list3);
|
||||||
|
map3.put("data_fluc", list4);
|
||||||
|
map3.put("data_harmphasic_i", list5);
|
||||||
|
map3.put("data_harmphasic_v", list6);
|
||||||
|
map3.put("data_harmpower_p", list7);
|
||||||
|
map3.put("data_harmpower_q", list8);
|
||||||
|
map3.put("data_harmpower_s", list9);
|
||||||
|
map3.put("data_harmrate_v", list10);
|
||||||
|
map3.put("data_harmrate_i", list11);
|
||||||
|
map3.put("data_inharm_v", list12);
|
||||||
|
map3.put("data_plt", list13);
|
||||||
|
map3.put("pqd_data", list14);
|
||||||
|
return map3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Map<String, Object> extractFieldValues(PqdData pqdData) {
|
||||||
|
Map<String, Object> fieldValues = new HashMap<>();
|
||||||
|
Field[] fields = PqdData.class.getDeclaredFields();
|
||||||
|
|
||||||
|
for (Field field : fields) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
try {
|
||||||
|
Object value = field.get(pqdData);
|
||||||
|
if (value != null) {
|
||||||
|
fieldValues.put(field.getName(), value);
|
||||||
|
} else {
|
||||||
|
fieldValues.put(field.getName(), 0.0d);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
log.warn("获取字段 {} 的值失败", field.getName(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fieldValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean isCommonField(String fieldName) {
|
||||||
|
Set<String> commonFields = new HashSet<>(Arrays.asList(
|
||||||
|
"time", "lineId", "phasicType", "valueType", "clDid",
|
||||||
|
"process", "qualityFlag"
|
||||||
|
));
|
||||||
|
return commonFields.contains(fieldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setFieldValue(Object obj, String fieldName, Object value, boolean isCamelCase) {
|
||||||
|
try {
|
||||||
|
String camelCaseFieldName = fieldName;
|
||||||
|
if (isCamelCase) {
|
||||||
|
camelCaseFieldName = toCamelCase(fieldName);
|
||||||
|
}
|
||||||
|
Field field = obj.getClass().getDeclaredField(camelCaseFieldName);
|
||||||
|
field.setAccessible(true);
|
||||||
|
if (value == null) {
|
||||||
|
Class<?> fieldType = field.getType();
|
||||||
|
if (fieldType == Double.class || fieldType == double.class) {
|
||||||
|
value = 0.0D;
|
||||||
|
} else if (fieldType == Integer.class || fieldType == int.class) {
|
||||||
|
value = 0;
|
||||||
|
} else if (fieldType == Float.class || fieldType == float.class) {
|
||||||
|
value = 0.0F;
|
||||||
|
} else if (fieldType == Long.class || fieldType == long.class) {
|
||||||
|
value = 0L;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
field.set(obj, value);
|
||||||
|
} catch (NoSuchFieldException | IllegalAccessException | IllegalArgumentException e) {
|
||||||
|
log.warn("设置字段 {} 的值失败", fieldName, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String toCamelCase(String input) {
|
||||||
|
if (input == null || input.isEmpty()) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
StringBuilder result = new StringBuilder();
|
||||||
|
boolean toUpper = false;
|
||||||
|
|
||||||
|
for (char c : input.toCharArray()) {
|
||||||
|
if (c == '_') {
|
||||||
|
toUpper = true;
|
||||||
|
} else {
|
||||||
|
if (toUpper) {
|
||||||
|
result.append(Character.toUpperCase(c));
|
||||||
|
toUpper = false;
|
||||||
|
} else {
|
||||||
|
result.append(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 确保首字母小写,以匹配Java实体字段命名规范
|
||||||
|
if (result.length() > 0 && Character.isUpperCase(result.charAt(0))) {
|
||||||
|
result.setCharAt(0, Character.toLowerCase(result.charAt(0)));
|
||||||
|
}
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private EleEpdPqd copyEleEpdPqd(EleEpdPqd source) {
|
||||||
|
if (source == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
EleEpdPqd target = new EleEpdPqd();
|
||||||
|
BeanUtils.copyProperties(source, target);
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,6 @@ package com.njcn.csdevice.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
@@ -68,8 +67,8 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
|||||||
List<CsLinePO> csLinePOList = csLineFeignClient.getLinesByDevList(devIdList).getData();
|
List<CsLinePO> csLinePOList = csLineFeignClient.getLinesByDevList(devIdList).getData();
|
||||||
csLinePOList.forEach(item->{
|
csLinePOList.forEach(item->{
|
||||||
//没有统计间隔就计算下一次监测点
|
//没有统计间隔就计算下一次监测点
|
||||||
if (Objects.isNull(item.getLineInterval())) {
|
if (Objects.isNull(item.getLineInterval()) || item.getLineInterval() == 0) {
|
||||||
return;
|
item.setLineInterval(1);
|
||||||
}
|
}
|
||||||
//应收数据
|
//应收数据
|
||||||
int dueCount = 1440 / item.getLineInterval();
|
int dueCount = 1440 / item.getLineInterval();
|
||||||
@@ -79,17 +78,11 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
|||||||
RStatIntegrityD data = new RStatIntegrityD();
|
RStatIntegrityD data = new RStatIntegrityD();
|
||||||
//治理监测点
|
//治理监测点
|
||||||
if (item.getClDid() == 0) {
|
if (item.getClDid() == 0) {
|
||||||
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"apf_data","Apf_Freq","value","M","avg",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"apf_data","Apf_Freq","value","T","AVG",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//云前置监测点
|
//云前置监测点 && 治理、无线监测点
|
||||||
if (ObjectUtil.isNotNull(item.getLineNo())) {
|
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"data_v","freq","value","T","AVG",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
||||||
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"data_v","Pq_Freq","value","M","avg",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
|
||||||
}
|
|
||||||
//治理、无线监测点
|
|
||||||
else {
|
|
||||||
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"pqd_data","Pq_Freq","value","M","avg",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
data.setTimeId(LocalDate.parse(time, DatePattern.NORM_DATE_FORMATTER));
|
data.setTimeId(LocalDate.parse(time, DatePattern.NORM_DATE_FORMATTER));
|
||||||
data.setLineIndex(item.getLineId());
|
data.setLineIndex(item.getLineId());
|
||||||
|
|||||||
@@ -16,13 +16,10 @@ import com.njcn.csdevice.service.ICsCommunicateService;
|
|||||||
import com.njcn.csdevice.service.IRStatOnlineRateDService;
|
import com.njcn.csdevice.service.IRStatOnlineRateDService;
|
||||||
import com.njcn.csdevice.util.TimeUtil;
|
import com.njcn.csdevice.util.TimeUtil;
|
||||||
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||||
import com.njcn.influx.deprecated.InfluxDBPublicParam;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -62,48 +59,95 @@ public class RStatOnlineRateDServiceImpl extends MppServiceImpl<RStatOnlineRateD
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(devList)) {
|
int onlineMinutes = 0;
|
||||||
//获取需要计算的时间
|
//获取需要计算的时间
|
||||||
List<String> dateRange = TimeUtil.getDateRangeAsString(param.getStartTime(), param.getEndTime());
|
List<String> dateRange = TimeUtil.getDateRangeAsString(param.getStartTime(), param.getEndTime());
|
||||||
for (String time : dateRange) {
|
for (String time : dateRange) {
|
||||||
List<PqsCommunicateDto> outCommunicateData = new ArrayList<>();
|
Date statDate = DateUtil.parse(time);
|
||||||
|
// 按设备分别统计
|
||||||
|
for (CsEquipmentDeliveryPO device : devList) {
|
||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(time + " 00:00:00");
|
lineParam.setLineId(Collections.singletonList(device.getId()));
|
||||||
lineParam.setEndTime(time + " 23:59:59");
|
lineParam.setStartTime(time);
|
||||||
for (CsEquipmentDeliveryPO s : devList) {
|
lineParam.setEndTime(time);
|
||||||
lineParam.setLineId(Collections.singletonList(s.getId()));
|
List<PqsCommunicateDto> dayData = pqsCommunicateService.getRawData2(lineParam);
|
||||||
List<PqsCommunicateDto> data = pqsCommunicateService.getRawDataLatest(lineParam);
|
if (CollectionUtil.isNotEmpty(dayData)) {
|
||||||
if (CollectionUtil.isEmpty(data)) {
|
if (dayData.size() == 1) {
|
||||||
PqsCommunicateDto dto = new PqsCommunicateDto();
|
PqsCommunicateDto singleRecord = dayData.get(0);
|
||||||
dto.setTime(time + " 00:00:00");
|
long minutesFromMidnight = DateUtil.between(statDate, DateUtil.parse(singleRecord.getTime()), DateUnit.MINUTE);
|
||||||
dto.setDevId(s.getId());
|
if (online.equals(singleRecord.getType())) {
|
||||||
if (s.getRunStatus() == 1) {
|
// 如果是在线状态,则从该时间点之后都在线
|
||||||
dto.setType(0);
|
onlineMinutes = 1440 - (int) minutesFromMidnight;
|
||||||
dto.setDescription("通讯中断");
|
} else {
|
||||||
} else if (s.getRunStatus() == 2) {
|
// 如果是离线状态,则从该时间点之前都在线(假设之前是在线的)
|
||||||
dto.setType(1);
|
onlineMinutes = (int) minutesFromMidnight;
|
||||||
dto.setDescription("通讯正常");
|
|
||||||
}
|
}
|
||||||
outCommunicateData.add(dto);
|
} else {
|
||||||
|
// 多条记录,逐段计算
|
||||||
|
long totalOnlineMinutes = 0L;
|
||||||
|
Date lastTime = statDate;
|
||||||
|
|
||||||
|
for (int i = 0; i < dayData.size(); i++) {
|
||||||
|
PqsCommunicateDto current = dayData.get(i);
|
||||||
|
Date currentTime = DateUtil.parse(current.getTime());
|
||||||
|
long intervalMinutes = DateUtil.between(lastTime, currentTime, DateUnit.MINUTE);
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
// 处理第一段:从0点到第一条记录
|
||||||
|
// 如果第一条记录是离线(type=0),则之前是在线;如果第一条是在线(type=1),则之前是离线
|
||||||
|
if (!online.equals(current.getType())) {
|
||||||
|
totalOnlineMinutes += intervalMinutes;
|
||||||
}
|
}
|
||||||
outCommunicateData.addAll(data);
|
} else {
|
||||||
|
// 处理后续段:根据上一条记录的状态判断
|
||||||
|
if (online.equals(dayData.get(i - 1).getType())) {
|
||||||
|
totalOnlineMinutes += intervalMinutes;
|
||||||
}
|
}
|
||||||
Date dateOut = DateUtil.parse(time);
|
}
|
||||||
for (PqsCommunicateDto pqsCommunicate : outCommunicateData) {
|
|
||||||
|
lastTime = currentTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理最后一段:从最后一条记录到当天结束
|
||||||
|
Date endOfDay = DateUtil.beginOfDay(DateUtil.offsetDay(statDate, 1));
|
||||||
|
long lastInterval = DateUtil.between(lastTime, endOfDay, DateUnit.MINUTE);
|
||||||
|
if (online.equals(dayData.get(dayData.size() - 1).getType())) {
|
||||||
|
totalOnlineMinutes += lastInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
onlineMinutes = (int) Math.min(totalOnlineMinutes, 1440);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
List<PqsCommunicateDto> firstData = pqsCommunicateService.getRawDataOne(lineParam);
|
||||||
|
if (CollectionUtil.isNotEmpty(firstData)) {
|
||||||
|
Date statDate2 = DateUtil.parse(firstData.get(0).getTime());
|
||||||
|
if (statDate.before(statDate2)) {
|
||||||
|
onlineMinutes = 0;
|
||||||
|
} else {
|
||||||
|
List<PqsCommunicateDto> latestData = pqsCommunicateService.getRawDataLatest(lineParam);
|
||||||
|
if (online.equals(latestData.get(0).getType())){
|
||||||
|
onlineMinutes = 1440;
|
||||||
|
} else {
|
||||||
|
onlineMinutes = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//如果设备连一条记录没有,那就根本没接入,不需要统计
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RStatOnlineRateD po = new RStatOnlineRateD();
|
RStatOnlineRateD po = new RStatOnlineRateD();
|
||||||
Date newDate = DateUtil.parse(pqsCommunicate.getTime());
|
|
||||||
lineParam.setLineId(Collections.singletonList(pqsCommunicate.getDevId()));
|
|
||||||
RStatOnlineRateD onLineRate = onLineMinute(newDate, dateOut, pqsCommunicate.getType(), lineParam);
|
|
||||||
po.setTimeId(LocalDate.parse(time, DatePattern.NORM_DATE_FORMATTER));
|
po.setTimeId(LocalDate.parse(time, DatePattern.NORM_DATE_FORMATTER));
|
||||||
po.setDevIndex(pqsCommunicate.getDevId());
|
po.setDevIndex(device.getId());
|
||||||
po.setOnlineMin(onLineRate.getOnlineMin());
|
po.setOnlineMin(onlineMinutes);
|
||||||
po.setOfflineMin(onLineRate.getOfflineMin());
|
po.setOfflineMin(1440 - onlineMinutes);
|
||||||
list.add(po);
|
list.add(po);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
this.saveOrUpdateBatchByMultiId(list,1000);
|
this.saveOrUpdateBatchByMultiId(list, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,97 +158,4 @@ public class RStatOnlineRateDServiceImpl extends MppServiceImpl<RStatOnlineRateD
|
|||||||
.between(RStatOnlineRateD::getTimeId,startTime,endTime)
|
.between(RStatOnlineRateD::getTimeId,startTime,endTime)
|
||||||
.list();
|
.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* new的时间和当前统计时间 不是/是 同一天
|
|
||||||
*/
|
|
||||||
private RStatOnlineRateD onLineMinute(Date newDate, Date date, Integer type, LineCountEvaluateParam lineParam) {
|
|
||||||
RStatOnlineRateD onLineRate = new RStatOnlineRateD();
|
|
||||||
Integer minute = 0;
|
|
||||||
/*new的时间和当前统计时间是同一天*/
|
|
||||||
if (DateUtil.isSameDay(newDate, date)) {
|
|
||||||
minute = processData(newDate, date, type, lineParam);
|
|
||||||
} else {
|
|
||||||
/*new的时间和当前统计时间不是同一天*/
|
|
||||||
Date nowDate = new Date();
|
|
||||||
/*数据补招的情况下*/
|
|
||||||
if (DateUtil.between(date, nowDate, DateUnit.DAY) > DateUtil.between(newDate, nowDate, DateUnit.DAY)) {
|
|
||||||
minute = processData(newDate, date, null, lineParam);
|
|
||||||
} else {
|
|
||||||
if (online.equals(type)) {
|
|
||||||
minute = InfluxDBPublicParam.DAY_MINUTE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onLineRate.setOnlineMin(minute);
|
|
||||||
onLineRate.setOfflineMin(InfluxDBPublicParam.DAY_MINUTE - minute);
|
|
||||||
return onLineRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Integer processData(Date newDate, Date date, Integer type,LineCountEvaluateParam lineParam) {
|
|
||||||
int minute = 0;
|
|
||||||
List<PqsCommunicateDto> communicateData = pqsCommunicateService.getRawData(lineParam);
|
|
||||||
/*当前统计时间内存在多条数据*/
|
|
||||||
if (communicateData.size() > 1) {
|
|
||||||
Date lastTime = null;
|
|
||||||
long onlineTime = 0;
|
|
||||||
long offlineTime = 0;
|
|
||||||
for (int i = 0; i < communicateData.size(); i++) {
|
|
||||||
long differ;
|
|
||||||
if (i == 0) {
|
|
||||||
/*首次比较取统计时间*/
|
|
||||||
differ = DateUtil.between(date, DateUtil.parse(communicateData.get(i).getTime()), DateUnit.MINUTE);
|
|
||||||
} else {
|
|
||||||
/*后续取上一次数据时间*/
|
|
||||||
differ = DateUtil.between(lastTime, DateUtil.parse(communicateData.get(i).getTime()), DateUnit.MINUTE);
|
|
||||||
}
|
|
||||||
if (online.equals(communicateData.get(i).getType())) {
|
|
||||||
offlineTime = offlineTime + differ;
|
|
||||||
} else {
|
|
||||||
onlineTime = onlineTime + differ;
|
|
||||||
}
|
|
||||||
lastTime = DateUtil.parse(communicateData.get(i).getTime());
|
|
||||||
}
|
|
||||||
if (online.equals(communicateData.get(communicateData.size() - 1).getType())) {
|
|
||||||
minute = InfluxDBPublicParam.DAY_MINUTE - (int) offlineTime;
|
|
||||||
} else {
|
|
||||||
minute = (int) onlineTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*当前统计时间内仅有一条数据*/
|
|
||||||
else {
|
|
||||||
if (type != null) {
|
|
||||||
long differ = DateUtil.between(date, newDate, DateUnit.MINUTE);
|
|
||||||
if (online.equals(type)) {
|
|
||||||
minute = InfluxDBPublicParam.DAY_MINUTE - (int) differ;
|
|
||||||
} else {
|
|
||||||
minute = (int) differ;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
List<PqsCommunicateDto> communicateDataOld = pqsCommunicateService.getRawDataEnd(lineParam);
|
|
||||||
// if (!communicateDataOld.isEmpty()){
|
|
||||||
// if (online.equals(communicateDataOld.get(0).getType())){
|
|
||||||
// minute = InfluxDBPublicParam.DAY_MINUTE;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
if (!communicateDataOld.isEmpty()){
|
|
||||||
try {
|
|
||||||
if (online.equals(communicateDataOld.get(0).getType())){
|
|
||||||
minute = (int) DateUtil.between(new SimpleDateFormat(DatePattern.NORM_DATETIME_PATTERN).parse(communicateDataOld.get(0).getTime()), new SimpleDateFormat(DatePattern.NORM_DATETIME_PATTERN).parse(lineParam.getEndTime()), DateUnit.MINUTE);
|
|
||||||
} else {
|
|
||||||
minute = (int) DateUtil.between(new SimpleDateFormat(DatePattern.NORM_DATETIME_PATTERN).parse(lineParam.getStartTime()), new SimpleDateFormat(DatePattern.NORM_DATETIME_PATTERN).parse(communicateDataOld.get(0).getTime()), DateUnit.MINUTE);
|
|
||||||
}
|
|
||||||
} catch (ParseException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
minute = InfluxDBPublicParam.DAY_MINUTE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return minute;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,24 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
|||||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
List<String> collect = new ArrayList<>();
|
List<String> collect = new ArrayList<>();
|
||||||
if(Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER_8000.getCode())){
|
if ( Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||
|
||||||
|
Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())) {
|
||||||
|
QueryWrapper<CsMarketData> csMarketDataQueryWrapper = new QueryWrapper<>();
|
||||||
|
csMarketDataQueryWrapper.eq("user_id", userIndex);
|
||||||
|
List<CsMarketData> csMarketData = csMarketDataMapper.selectList(csMarketDataQueryWrapper);
|
||||||
|
collect = csMarketData.stream().map(CsMarketData::getEngineerId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
} else if (Objects.equals(role,AppRoleEnum.TOURIST.getCode())) {
|
||||||
|
//todo查询配置的游客工程
|
||||||
|
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
|
||||||
|
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getEnginerId).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
}
|
||||||
|
// ||Objects.equals(role,"bxs_user")
|
||||||
|
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode()) || Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||||
|
List<CsEngineeringPO> csEngineeringPOS = csEngineeringMapper.selectList(null);
|
||||||
|
collect =csEngineeringPOS.stream().filter(temp->Objects.equals(temp.getStatus(),"1")).map(CsEngineeringPO::getId).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
csDeviceUserPOQueryWrapper.clear();
|
csDeviceUserPOQueryWrapper.clear();
|
||||||
csEngineeringUserPOQueryWrapper.clear();
|
csEngineeringUserPOQueryWrapper.clear();
|
||||||
csLedgerQueryWrapper.clear();
|
csLedgerQueryWrapper.clear();
|
||||||
@@ -79,24 +96,6 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
|||||||
collect = collect.stream().distinct().collect(Collectors.toList());
|
collect = collect.stream().distinct().collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
return collect;
|
return collect;
|
||||||
|
|
||||||
} else if ( Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||
|
|
||||||
Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())) {
|
|
||||||
QueryWrapper<CsMarketData> csMarketDataQueryWrapper = new QueryWrapper<>();
|
|
||||||
csMarketDataQueryWrapper.eq("user_id", userIndex);
|
|
||||||
List<CsMarketData> csMarketData = csMarketDataMapper.selectList(csMarketDataQueryWrapper);
|
|
||||||
collect = csMarketData.stream().map(CsMarketData::getEngineerId).collect(Collectors.toList());
|
|
||||||
|
|
||||||
} else if (Objects.equals(role,AppRoleEnum.TOURIST.getCode())) {
|
|
||||||
//todo查询配置的游客工程
|
|
||||||
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
|
|
||||||
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getEnginerId).distinct().collect(Collectors.toList());
|
|
||||||
|
|
||||||
}
|
|
||||||
// ||Objects.equals(role,"bxs_user")
|
|
||||||
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode()) || Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER.getCode()) ){
|
|
||||||
List<CsEngineeringPO> csEngineeringPOS = csEngineeringMapper.selectList(null);
|
|
||||||
collect =csEngineeringPOS.stream().filter(temp->Objects.equals(temp.getStatus(),"1")).map(CsEngineeringPO::getId).collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return collect;
|
return collect;
|
||||||
@@ -115,37 +114,11 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
|||||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
List<String> collect = new ArrayList<>();
|
List<String> collect = new ArrayList<>();
|
||||||
if(
|
|
||||||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER_8000.getCode()) || Objects.equals(role,"bxs_user")){
|
|
||||||
csDeviceUserPOQueryWrapper.clear();
|
|
||||||
csDeviceUserPOQueryWrapper.eq("status","1").and(wq -> {
|
|
||||||
wq.eq("primary_user_id", userIndex)
|
|
||||||
.or()
|
|
||||||
.eq("sub_user_id",userIndex);
|
|
||||||
});
|
|
||||||
List<CsDeviceUserPO> csDeviceUserPOS = csDeviceUserPOMapper.selectList(csDeviceUserPOQueryWrapper);
|
|
||||||
if(CollectionUtils.isEmpty(csDeviceUserPOS)){
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
List<String> collect1 = csDeviceUserPOS.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
|
||||||
return collect1;
|
|
||||||
|
|
||||||
}
|
|
||||||
//fix 新需求 工程用户可以看到关注工程的设备和对应的主用户和子用户的设备
|
//fix 新需求 工程用户可以看到关注工程的设备和对应的主用户和子用户的设备
|
||||||
//note 这边工程用户不查询主设备,只看关注的工程,做下调整,不然会出现工程用户未关注任何工程,但是有一台主设备,导致界面有数据
|
//note 这边工程用户不查询主设备,只看关注的工程,做下调整,不然会出现工程用户未关注任何工程,但是有一台主设备,导致界面有数据
|
||||||
else if (Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())) {
|
if (Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())) {
|
||||||
List<String> sumDevId = new ArrayList<>();
|
List<String> sumDevId = new ArrayList<>();
|
||||||
csDeviceUserPOQueryWrapper.clear();
|
csDeviceUserPOQueryWrapper.clear();
|
||||||
// csDeviceUserPOQueryWrapper.eq("status","1").and(wq -> {
|
|
||||||
// wq.eq("primary_user_id", userIndex)
|
|
||||||
// .or()
|
|
||||||
// .eq("sub_user_id",userIndex);
|
|
||||||
// });
|
|
||||||
// List<CsDeviceUserPO> csDeviceUserPOS = csDeviceUserPOMapper.selectList(csDeviceUserPOQueryWrapper);
|
|
||||||
// if(!CollectionUtils.isEmpty(csDeviceUserPOS)){
|
|
||||||
// sumDevId = csDeviceUserPOS.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
|
||||||
// }
|
|
||||||
|
|
||||||
QueryWrapper<CsMarketData> csMarketDataQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<CsMarketData> csMarketDataQueryWrapper = new QueryWrapper<>();
|
||||||
csMarketDataQueryWrapper.eq("user_id", userIndex);
|
csMarketDataQueryWrapper.eq("user_id", userIndex);
|
||||||
List<CsMarketData> csMarketData = csMarketDataMapper.selectList(csMarketDataQueryWrapper);
|
List<CsMarketData> csMarketData = csMarketDataMapper.selectList(csMarketDataQueryWrapper);
|
||||||
@@ -198,15 +171,25 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
|||||||
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getDeviceId).distinct().collect(Collectors.toList());
|
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
}
|
}
|
||||||
// ||Objects.equals(role,"bxs_user")
|
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||||
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER.getCode())){
|
|
||||||
csLedgerQueryWrapper.clear();
|
csLedgerQueryWrapper.clear();
|
||||||
csLedgerQueryWrapper.eq("level",2).eq("state",1);
|
csLedgerQueryWrapper.eq("level",2).eq("state",1);
|
||||||
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||||
collect = csLedgers.stream().map(CsLedger::getId).distinct().collect(Collectors.toList());
|
collect = csLedgers.stream().map(CsLedger::getId).distinct().collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
csDeviceUserPOQueryWrapper.clear();
|
||||||
|
csDeviceUserPOQueryWrapper.eq("status","1").and(wq -> {
|
||||||
|
wq.eq("primary_user_id", userIndex)
|
||||||
|
.or()
|
||||||
|
.eq("sub_user_id",userIndex);
|
||||||
|
});
|
||||||
|
List<CsDeviceUserPO> csDeviceUserPOS = csDeviceUserPOMapper.selectList(csDeviceUserPOQueryWrapper);
|
||||||
|
if(CollectionUtils.isEmpty(csDeviceUserPOS)){
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
List<String> collect1 = csDeviceUserPOS.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
return collect1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return collect;
|
return collect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,417 +0,0 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
|
||||||
|
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.JsonObject;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
|
||||||
import com.njcn.csdevice.mapper.CsSmsSendRecordMapper;
|
|
||||||
import com.njcn.csdevice.pojo.dto.CredentialReqDTO;
|
|
||||||
import com.njcn.csdevice.pojo.dto.SendResult;
|
|
||||||
import com.njcn.csdevice.pojo.po.CsSmsSendRecord;
|
|
||||||
import com.njcn.csdevice.pojo.vo.MessageRecordReqVO;
|
|
||||||
import com.njcn.csdevice.service.ISmsSendService;
|
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.net.ConnectException;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.SocketTimeoutException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xy
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
@AllArgsConstructor
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class SmsSendServiceImpl extends ServiceImpl<CsSmsSendRecordMapper, CsSmsSendRecord> implements ISmsSendService {
|
|
||||||
|
|
||||||
@Value("${msg.credential_url:http://192.168.2.126:48083/admin-api/push/credential/generate}")
|
|
||||||
private String CREDENTIAL_URL;
|
|
||||||
@Value("${msg.sms_send_url:http://192.168.2.126:48083/admin-api/push/message/send/sms}")
|
|
||||||
private String SMS_SEND_URL;
|
|
||||||
@Value("${msg.connect_timeout:5000}")
|
|
||||||
private Integer CONNECT_TIMEOUT;
|
|
||||||
@Value("${msg.read_timeout:30000}")
|
|
||||||
private Integer READ_TIMEOUT;
|
|
||||||
@Value("${msg.system_name:NPQS-9500}")
|
|
||||||
private String SYSTEM_NAME;
|
|
||||||
@Value("${msg.secret_key:123456}")
|
|
||||||
private String SECRET_KEY;
|
|
||||||
|
|
||||||
private static final int[] RETRY_DELAYS = {1, 2, 3};
|
|
||||||
private static final int MAX_RETRY = 3;
|
|
||||||
private static final String CREDENTIAL_CACHE_KEY = "SMS_CREDENTIAL_TOKEN";
|
|
||||||
private static final Gson GSON = new Gson();
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private RedisUtil redisUtil;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendSmsWithRetry(String receiver, String content, String messageType) {
|
|
||||||
MessageRecordReqVO vo = new MessageRecordReqVO();
|
|
||||||
vo.setReceiver(receiver);
|
|
||||||
vo.setContent(content);
|
|
||||||
vo.setMessageType(messageType);
|
|
||||||
sendSmsWithRetry(vo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendSmsWithRetry(MessageRecordReqVO messageRecordReqVO) {
|
|
||||||
CsSmsSendRecord record = initRecord(messageRecordReqVO);
|
|
||||||
|
|
||||||
this.save(record);
|
|
||||||
|
|
||||||
try {
|
|
||||||
String credentialToken = getOrRefreshCredentialWithRetry(record);
|
|
||||||
|
|
||||||
if (credentialToken == null) {
|
|
||||||
record.setSendStatus(0);
|
|
||||||
record.setFailReason("获取凭证失败,已重试3次");
|
|
||||||
log.error("获取凭证失败,短信未发送,接收者: {}", messageRecordReqVO.getReceiver());
|
|
||||||
this.updateById(record);
|
|
||||||
throw new BusinessException("获取凭证失败,已重试3次");
|
|
||||||
}
|
|
||||||
|
|
||||||
record.setCredentialToken(credentialToken);
|
|
||||||
record.setSendTime(LocalDateTime.now());
|
|
||||||
this.updateById(record);
|
|
||||||
|
|
||||||
boolean success = attemptSendWithRetry(messageRecordReqVO, credentialToken, record);
|
|
||||||
|
|
||||||
if (success) {
|
|
||||||
record.setSendStatus(1);
|
|
||||||
record.setFailReason(null);
|
|
||||||
log.info("短信发送成功,接收者: {}", messageRecordReqVO.getReceiver());
|
|
||||||
} else {
|
|
||||||
record.setSendStatus(0);
|
|
||||||
if (record.getFailReason() == null) {
|
|
||||||
record.setFailReason("超过最大重试次数,发送失败");
|
|
||||||
}
|
|
||||||
log.error("短信发送失败,接收者: {},已重试{}次,原因: {}",
|
|
||||||
messageRecordReqVO.getReceiver(), record.getRetryCount(), record.getFailReason());
|
|
||||||
throw new BusinessException("短信发送失败: " + record.getFailReason());
|
|
||||||
}
|
|
||||||
} catch (BusinessException e) {
|
|
||||||
record.setSendStatus(0);
|
|
||||||
record.setFailReason(e.getMessage());
|
|
||||||
log.error("短信发送业务异常,接收者: {}", messageRecordReqVO.getReceiver(), e);
|
|
||||||
this.updateById(record);
|
|
||||||
throw e;
|
|
||||||
} catch (Exception e) {
|
|
||||||
record.setSendStatus(0);
|
|
||||||
record.setFailReason("发送异常: " + e.getMessage());
|
|
||||||
log.error("短信发送异常,接收者: {}", messageRecordReqVO.getReceiver(), e);
|
|
||||||
this.updateById(record);
|
|
||||||
throw new BusinessException("短信发送异常: " + e.getMessage());
|
|
||||||
} finally {
|
|
||||||
this.updateById(record);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private CsSmsSendRecord initRecord(MessageRecordReqVO vo) {
|
|
||||||
CsSmsSendRecord record = new CsSmsSendRecord();
|
|
||||||
record.setReceiver(vo.getReceiver());
|
|
||||||
record.setContent(vo.getContent());
|
|
||||||
record.setMessageType(vo.getMessageType());
|
|
||||||
record.setSendStatus(-1);
|
|
||||||
record.setRetryCount(0);
|
|
||||||
record.setMaxRetry(MAX_RETRY);
|
|
||||||
record.setCreateTime(LocalDateTime.now());
|
|
||||||
return record;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getOrRefreshCredentialWithRetry(CsSmsSendRecord record) {
|
|
||||||
Object cachedToken = redisUtil.getObjectByKey(CREDENTIAL_CACHE_KEY);
|
|
||||||
if (cachedToken != null) {
|
|
||||||
log.info("使用缓存的凭证令牌");
|
|
||||||
return cachedToken.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info("缓存中无凭证,开始获取新凭证(最多重试3次)");
|
|
||||||
|
|
||||||
for (int i = 1; i <= 3; i++) {
|
|
||||||
try {
|
|
||||||
String token = fetchNewCredential();
|
|
||||||
log.info("第{}次尝试获取凭证成功", i);
|
|
||||||
return token;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.warn("第{}次获取凭证失败: {}", i, e.getMessage());
|
|
||||||
|
|
||||||
record.setFailReason("获取凭证第" + i + "次失败: " + e.getMessage());
|
|
||||||
this.updateById(record);
|
|
||||||
|
|
||||||
try {
|
|
||||||
int waitSeconds = i * 10;
|
|
||||||
log.info("等待{}秒后重试...", waitSeconds);
|
|
||||||
TimeUnit.SECONDS.sleep(waitSeconds);
|
|
||||||
} catch (InterruptedException ie) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
log.error("凭证获取重试被中断");
|
|
||||||
record.setFailReason("获取凭证实例被中断");
|
|
||||||
this.updateById(record);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.error("获取凭证失败,已重试3次");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String fetchNewCredential() {
|
|
||||||
CredentialReqDTO reqDTO = new CredentialReqDTO();
|
|
||||||
reqDTO.setSystemName(SYSTEM_NAME);
|
|
||||||
reqDTO.setSecretKey(SECRET_KEY);
|
|
||||||
|
|
||||||
HttpURLConnection connection = null;
|
|
||||||
try {
|
|
||||||
URL url = new URL(CREDENTIAL_URL);
|
|
||||||
connection = (HttpURLConnection) url.openConnection();
|
|
||||||
connection.setRequestMethod("POST");
|
|
||||||
connection.setRequestProperty("Content-Type", "application/json");
|
|
||||||
connection.setConnectTimeout(CONNECT_TIMEOUT);
|
|
||||||
connection.setReadTimeout(READ_TIMEOUT);
|
|
||||||
connection.setDoOutput(true);
|
|
||||||
|
|
||||||
OutputStream outputStream = connection.getOutputStream();
|
|
||||||
outputStream.write(GSON.toJson(reqDTO).getBytes(StandardCharsets.UTF_8));
|
|
||||||
outputStream.flush();
|
|
||||||
outputStream.close();
|
|
||||||
|
|
||||||
int responseCode = connection.getResponseCode();
|
|
||||||
if (responseCode != 200) {
|
|
||||||
throw new BusinessException("获取凭证失败,HTTP响应码: " + responseCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(
|
|
||||||
new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
|
|
||||||
StringBuilder response = new StringBuilder();
|
|
||||||
String inputLine;
|
|
||||||
while ((inputLine = reader.readLine()) != null) {
|
|
||||||
response.append(inputLine);
|
|
||||||
}
|
|
||||||
reader.close();
|
|
||||||
|
|
||||||
JsonObject jsonResponse = GSON.fromJson(response.toString(), JsonObject.class);
|
|
||||||
int code = jsonResponse.get("code").getAsInt();
|
|
||||||
|
|
||||||
if (code != 0) {
|
|
||||||
String msg = jsonResponse.has("msg") ? jsonResponse.get("msg").getAsString() : "未知错误";
|
|
||||||
throw new BusinessException("获取凭证失败,错误码: " + code + ",错误信息: " + msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
JsonObject data = jsonResponse.getAsJsonObject("data");
|
|
||||||
String token = data.get("credentialToken").getAsString();
|
|
||||||
long expiresTimestamp = data.get("expiresTime").getAsLong();
|
|
||||||
|
|
||||||
LocalDateTime expiresTime = LocalDateTime.ofInstant(
|
|
||||||
Instant.ofEpochMilli(expiresTimestamp),
|
|
||||||
ZoneId.systemDefault()
|
|
||||||
);
|
|
||||||
|
|
||||||
long expireSeconds = calculateExpireSeconds(expiresTime);
|
|
||||||
redisUtil.saveByKeyWithExpire(CREDENTIAL_CACHE_KEY, token, expireSeconds);
|
|
||||||
|
|
||||||
log.info("获取新凭证成功,过期时间: {},缓存有效期: {}秒", expiresTime, expireSeconds);
|
|
||||||
return token;
|
|
||||||
|
|
||||||
} catch (SocketTimeoutException e) {
|
|
||||||
throw new BusinessException("获取凭证超时(30秒),请检查网络连接");
|
|
||||||
} catch (ConnectException e) {
|
|
||||||
throw new BusinessException("无法连接到凭证服务,请检查服务是否启动和网络是否正常");
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new BusinessException("获取凭证IO异常: " + e.getMessage());
|
|
||||||
} finally {
|
|
||||||
if (connection != null) {
|
|
||||||
connection.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private long calculateExpireSeconds(LocalDateTime expiresTime) {
|
|
||||||
long expireSeconds = java.time.Duration.between(
|
|
||||||
LocalDateTime.now(),
|
|
||||||
expiresTime
|
|
||||||
).getSeconds();
|
|
||||||
|
|
||||||
expireSeconds = expireSeconds - 60;
|
|
||||||
|
|
||||||
return Math.max(expireSeconds, 60);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean attemptSendWithRetry(MessageRecordReqVO vo, String token, CsSmsSendRecord record) {
|
|
||||||
for (int attempt = 0; attempt <= MAX_RETRY; attempt++) {
|
|
||||||
if (attempt > 0) {
|
|
||||||
int delayMinutes = RETRY_DELAYS[attempt - 1];
|
|
||||||
log.info("第{}次重试,等待{}分钟后发送...", attempt, delayMinutes);
|
|
||||||
|
|
||||||
try {
|
|
||||||
TimeUnit.MINUTES.sleep(delayMinutes);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
log.error("重试等待被中断", e);
|
|
||||||
record.setFailReason("重试等待被中断");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
record.setRetryCount(attempt);
|
|
||||||
}
|
|
||||||
|
|
||||||
SendResult result = executeSendSms(vo, token, record);
|
|
||||||
|
|
||||||
if (result.isSuccess()) {
|
|
||||||
record.setFailReason(null);
|
|
||||||
log.info("第{}次尝试发送成功,消息ID: {}", attempt, result.getMessageId());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
record.setFailReason(result.getFailReason());
|
|
||||||
|
|
||||||
if (result.isUnauthorized()) {
|
|
||||||
log.warn("凭证失效(401),重新获取凭证后重试...");
|
|
||||||
String newToken = getOrRefreshCredentialWithRetry(record);
|
|
||||||
if (newToken == null) {
|
|
||||||
record.setFailReason("凭证刷新失败,无法重新获取凭证");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
token = newToken;
|
|
||||||
record.setCredentialToken(newToken);
|
|
||||||
this.updateById(record);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!result.isTimeOut()) {
|
|
||||||
log.warn("发送失败且非超时,不再重试,原因: {},响应时间: {}ms",
|
|
||||||
result.getFailReason(), record.getResponseTime());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
log.warn("第{}次发送超时,将重试,响应时间: {}ms",
|
|
||||||
attempt, record.getResponseTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
record.setFailReason("超过最大重试次数,发送超时");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SendResult executeSendSms(MessageRecordReqVO vo, String token, CsSmsSendRecord record) {
|
|
||||||
HttpURLConnection connection = null;
|
|
||||||
long startTime = System.currentTimeMillis();
|
|
||||||
|
|
||||||
try {
|
|
||||||
URL url = new URL(SMS_SEND_URL);
|
|
||||||
connection = (HttpURLConnection) url.openConnection();
|
|
||||||
connection.setRequestMethod("POST");
|
|
||||||
connection.setRequestProperty("Content-Type", "application/json");
|
|
||||||
connection.setRequestProperty("X-Credential-Token", token);
|
|
||||||
connection.setConnectTimeout(CONNECT_TIMEOUT);
|
|
||||||
connection.setReadTimeout(READ_TIMEOUT);
|
|
||||||
connection.setDoOutput(true);
|
|
||||||
|
|
||||||
OutputStream outputStream = connection.getOutputStream();
|
|
||||||
outputStream.write(GSON.toJson(Collections.singletonList(vo)).getBytes(StandardCharsets.UTF_8));
|
|
||||||
outputStream.flush();
|
|
||||||
outputStream.close();
|
|
||||||
|
|
||||||
int responseCode = connection.getResponseCode();
|
|
||||||
long responseTime = System.currentTimeMillis() - startTime;
|
|
||||||
record.setResponseTime(responseTime);
|
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(
|
|
||||||
new InputStreamReader(
|
|
||||||
responseCode == 200 ? connection.getInputStream() : connection.getErrorStream(),
|
|
||||||
StandardCharsets.UTF_8
|
|
||||||
)
|
|
||||||
);
|
|
||||||
StringBuilder response = new StringBuilder();
|
|
||||||
String inputLine;
|
|
||||||
while ((inputLine = reader.readLine()) != null) {
|
|
||||||
response.append(inputLine);
|
|
||||||
}
|
|
||||||
reader.close();
|
|
||||||
|
|
||||||
if (responseCode != 200) {
|
|
||||||
String failReason = "HTTP响应码异常: " + responseCode;
|
|
||||||
if (response.length() > 0) {
|
|
||||||
failReason += ",响应: " + response.toString();
|
|
||||||
}
|
|
||||||
record.setFailReason(failReason);
|
|
||||||
return new SendResult(false, null, failReason, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
JsonObject jsonResponse = GSON.fromJson(response.toString(), JsonObject.class);
|
|
||||||
int code = jsonResponse.get("code").getAsInt();
|
|
||||||
|
|
||||||
if (code == 401) {
|
|
||||||
String failReason = "凭证失效(HTTP 401)";
|
|
||||||
record.setFailReason(failReason);
|
|
||||||
redisUtil.delete(CREDENTIAL_CACHE_KEY);
|
|
||||||
return new SendResult(false, null, failReason, false, true);
|
|
||||||
} else {
|
|
||||||
if (code != 0) {
|
|
||||||
String msg = jsonResponse.has("msg") ? jsonResponse.get("msg").getAsString() : "未知错误";
|
|
||||||
String failReason = "业务错误码: " + code + ",错误信息: " + msg;
|
|
||||||
record.setFailReason(failReason);
|
|
||||||
return new SendResult(false, null, failReason, false, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
JsonObject firstResult = jsonResponse.getAsJsonArray("data").get(0).getAsJsonObject();
|
|
||||||
boolean result = firstResult.get("result").getAsBoolean();
|
|
||||||
String messageId = firstResult.has("messageId") ? firstResult.get("messageId").getAsString() : null;
|
|
||||||
String detail = firstResult.has("detail") ? firstResult.get("detail").getAsString() : null;
|
|
||||||
|
|
||||||
if (result) {
|
|
||||||
log.info("短信发送成功,接收者: {},消息ID: {},详情: {},耗时: {}ms",
|
|
||||||
vo.getReceiver(), messageId, detail, responseTime);
|
|
||||||
return new SendResult(true, messageId, null, false, false);
|
|
||||||
} else {
|
|
||||||
String failReason = "发送失败: " + detail;
|
|
||||||
record.setFailReason(failReason);
|
|
||||||
return new SendResult(false, messageId, failReason, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SocketTimeoutException e) {
|
|
||||||
long responseTime = System.currentTimeMillis() - startTime;
|
|
||||||
record.setResponseTime(responseTime);
|
|
||||||
String failReason = "请求超时(30秒)";
|
|
||||||
record.setFailReason(failReason);
|
|
||||||
log.warn("短信发送超时,接收者: {},耗时: {}ms", vo.getReceiver(), responseTime);
|
|
||||||
return new SendResult(false, null, failReason, true, false);
|
|
||||||
} catch (ConnectException e) {
|
|
||||||
long responseTime = System.currentTimeMillis() - startTime;
|
|
||||||
record.setResponseTime(responseTime);
|
|
||||||
String failReason = "无法连接到短信服务";
|
|
||||||
record.setFailReason(failReason);
|
|
||||||
log.error("短信服务连接失败,接收者: {}", vo.getReceiver(), e);
|
|
||||||
return new SendResult(false, null, failReason, false, false);
|
|
||||||
} catch (IOException e) {
|
|
||||||
long responseTime = System.currentTimeMillis() - startTime;
|
|
||||||
record.setResponseTime(responseTime);
|
|
||||||
String failReason = "IO异常: " + e.getMessage();
|
|
||||||
record.setFailReason(failReason);
|
|
||||||
log.error("短信发送IO异常,接收者: {},耗时: {}ms", vo.getReceiver(), responseTime, e);
|
|
||||||
return new SendResult(false, null, failReason, false, false);
|
|
||||||
} finally {
|
|
||||||
if (connection != null) {
|
|
||||||
connection.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -466,7 +466,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
if(param.getStatisticalId() == null){
|
if(param.getStatisticalId() == null){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(param.getStatisticalId())).getData();
|
||||||
for(WlRecord wl : data){
|
for(WlRecord wl : data){
|
||||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(wl.getLineId())).getData();
|
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(wl.getLineId())).getData();
|
||||||
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId()));
|
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId()));
|
||||||
@@ -482,11 +482,15 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
commonQueryParam.setLineId(temp.getLineId());
|
commonQueryParam.setLineId(temp.getLineId());
|
||||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||||
|
if (epdPqd.getName() == null || epdPqd.getName().isEmpty()) {
|
||||||
commonQueryParam.setColumnName(epdPqd.getName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
|
commonQueryParam.setColumnName(epdPqd.getName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
|
||||||
|
} else {
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getOtherName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
|
||||||
|
}
|
||||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||||
commonQueryParam.setStartTime(LocalDateTimeUtil.format(wl.getStartTime(), DateTimeFormatter.ofPattern(DataParam.timeFormat)));
|
commonQueryParam.setStartTime(LocalDateTimeUtil.format(wl.getStartTime(), DateTimeFormatter.ofPattern(DataParam.timeFormat)));
|
||||||
commonQueryParam.setEndTime(LocalDateTimeUtil.format(wl.getEndTime(), DateTimeFormatter.ofPattern(DataParam.timeFormat)));
|
commonQueryParam.setEndTime(LocalDateTimeUtil.format(wl.getEndTime(), DateTimeFormatter.ofPattern(DataParam.timeFormat)));
|
||||||
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType());
|
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType().toUpperCase());
|
||||||
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||||
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
||||||
return commonQueryParam;
|
return commonQueryParam;
|
||||||
@@ -500,7 +504,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
String unit;
|
String unit;
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
vo.setPhase(Objects.equals("T",temp.getPhaseType())?null:temp.getPhaseType());
|
||||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
vo.setPosition(position);
|
vo.setPosition(position);
|
||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
@@ -677,13 +681,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
if(Objects.isNull(list.get(i).getEndTime())){
|
if(Objects.isNull(list.get(i).getEndTime())){
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
String sqlNow = now.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
String sqlNow = now.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper("pqd_data",StatisticalDataDTO.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper("data_v",StatisticalDataDTO.class);
|
||||||
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
|
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
|
||||||
.select(StatisticalDataDTO::getPhaseType)
|
.select(StatisticalDataDTO::getPhaseType)
|
||||||
.select(StatisticalDataDTO::getValueType)
|
.select(StatisticalDataDTO::getValueType)
|
||||||
.last("Pq_Freq")
|
.last("freq")
|
||||||
.eq(InfluxDBTableConstant.LINE_ID,lineId)
|
.eq(InfluxDBTableConstant.LINE_ID,lineId)
|
||||||
.eq(InfluxDBTableConstant.PHASIC_TYPE,"M")
|
.eq(InfluxDBTableConstant.PHASIC_TYPE,"T")
|
||||||
.between(InfluxDBTableConstant.TIME,startSql,sqlNow);
|
.between(InfluxDBTableConstant.TIME,startSql,sqlNow);
|
||||||
System.out.println(influxQueryWrapper.generateSql());
|
System.out.println(influxQueryWrapper.generateSql());
|
||||||
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
||||||
@@ -704,13 +708,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
//如果不存在结束时间,则取后面一条的起始时间作为结束判断标识
|
//如果不存在结束时间,则取后面一条的起始时间作为结束判断标识
|
||||||
if(Objects.isNull(list.get(i).getEndTime())){
|
if(Objects.isNull(list.get(i).getEndTime())){
|
||||||
String end = list.get(i+1).getStartTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
String end = list.get(i+1).getStartTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper("pqd_data",StatisticalDataDTO.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper("data_v",StatisticalDataDTO.class);
|
||||||
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
|
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
|
||||||
.select(StatisticalDataDTO::getPhaseType)
|
.select(StatisticalDataDTO::getPhaseType)
|
||||||
.select(StatisticalDataDTO::getValueType)
|
.select(StatisticalDataDTO::getValueType)
|
||||||
.last("Pq_Freq")
|
.last("freq")
|
||||||
.eq(InfluxDBTableConstant.LINE_ID,lineId)
|
.eq(InfluxDBTableConstant.LINE_ID,lineId)
|
||||||
.eq(InfluxDBTableConstant.PHASIC_TYPE,"M")
|
.eq(InfluxDBTableConstant.PHASIC_TYPE,"T")
|
||||||
.between(InfluxDBTableConstant.TIME,startSql,end);
|
.between(InfluxDBTableConstant.TIME,startSql,end);
|
||||||
System.out.println(influxQueryWrapper.generateSql());
|
System.out.println(influxQueryWrapper.generateSql());
|
||||||
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import org.springframework.cloud.openfeign.FeignClient;
|
|||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xy
|
* @author xy
|
||||||
*/
|
*/
|
||||||
@@ -19,4 +21,8 @@ public interface CsHarmonicPlanFeignClient {
|
|||||||
@ApiOperation("根据ID查询稳态指标方案")
|
@ApiOperation("根据ID查询稳态指标方案")
|
||||||
HttpResult<CsHarmonicPlan> getById(@RequestParam("id") String id);
|
HttpResult<CsHarmonicPlan> getById(@RequestParam("id") String id);
|
||||||
|
|
||||||
|
@GetMapping("/getByName")
|
||||||
|
@ApiOperation("根据名称查询稳态指标方案")
|
||||||
|
HttpResult<List<CsHarmonicPlan>> getByName(@RequestParam("name") String name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,17 @@ package com.njcn.csharmonic.api;
|
|||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csharmonic.api.fallback.CsHarmonicPlanLineFeignClientFallbackFactory;
|
import com.njcn.csharmonic.api.fallback.CsHarmonicPlanLineFeignClientFallbackFactory;
|
||||||
|
import com.njcn.csharmonic.param.CsHarmonicPlanLineParam;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
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 org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xy
|
* @author xy
|
||||||
*/
|
*/
|
||||||
@@ -18,4 +24,12 @@ public interface CsHarmonicPlanLineFeignClient {
|
|||||||
@ApiOperation("根据监测点ID查询方案ID")
|
@ApiOperation("根据监测点ID查询方案ID")
|
||||||
HttpResult<String> getPlanIdByLineId(@RequestParam("lineId") String lineId);
|
HttpResult<String> getPlanIdByLineId(@RequestParam("lineId") String lineId);
|
||||||
|
|
||||||
|
@PostMapping("/savePlanLines")
|
||||||
|
@ApiOperation("新增方案与监测点关联")
|
||||||
|
HttpResult<Boolean> savePlanLines(@RequestBody @Validated CsHarmonicPlanLineParam param);
|
||||||
|
|
||||||
|
@PostMapping("/deleteByLineIds")
|
||||||
|
@ApiOperation("根据监测点ID集合删除关联")
|
||||||
|
HttpResult<Boolean> deleteByLineIds(@RequestBody List<String> lineIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,12 @@
|
|||||||
package com.njcn.csharmonic.api;
|
package com.njcn.csharmonic.api;
|
||||||
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
|
||||||
import com.njcn.csharmonic.api.fallback.EventUserFeignClientFallbackFactory;
|
import com.njcn.csharmonic.api.fallback.EventUserFeignClientFallbackFactory;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
|
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ package com.njcn.csharmonic.api.fallback;
|
|||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csharmonic.api.CsHarmonicFeignClient;
|
|
||||||
import com.njcn.csharmonic.api.CsHarmonicPlanFeignClient;
|
import com.njcn.csharmonic.api.CsHarmonicPlanFeignClient;
|
||||||
import com.njcn.csharmonic.pojo.po.CsHarmonic;
|
|
||||||
import com.njcn.csharmonic.pojo.po.CsHarmonicPlan;
|
import com.njcn.csharmonic.pojo.po.CsHarmonicPlan;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -34,6 +32,12 @@ public class CsHarmonicPlanFeignClientFallbackFactory implements FallbackFactory
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据ID查询稳态指标方案异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据ID查询稳态指标方案异常",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<CsHarmonicPlan>> getByName(String name) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据名称查询稳态指标方案异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,13 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csharmonic.api.CsHarmonicPlanLineFeignClient;
|
import com.njcn.csharmonic.api.CsHarmonicPlanLineFeignClient;
|
||||||
|
import com.njcn.csharmonic.param.CsHarmonicPlanLineParam;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xy
|
* @author xy
|
||||||
*/
|
*/
|
||||||
@@ -28,6 +31,18 @@ public class CsHarmonicPlanLineFeignClientFallbackFactory implements FallbackFac
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据监测点ID查询方案ID异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据监测点ID查询方案ID异常",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<Boolean> savePlanLines(CsHarmonicPlanLineParam param) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","新增方案与监测点关联异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<Boolean> deleteByLineIds(List<String> lineIds) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据监测点ID集合删除关联异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,10 +57,10 @@ public class AnalyseComtradeCfg {
|
|||||||
List<PqdData> result = new ArrayList<>();
|
List<PqdData> result = new ArrayList<>();
|
||||||
minDataHashMap.forEach((dateTime,data)->{
|
minDataHashMap.forEach((dateTime,data)->{
|
||||||
|
|
||||||
List<PqdData> pqdDataA = convertDataByValueType(data.getMin(), "min",dateTime);
|
List<PqdData> pqdDataA = convertDataByValueType(data.getMin(), "MIN",dateTime);
|
||||||
List<PqdData> pqdDataB = convertDataByValueType(data.getMax(), "max",dateTime);
|
List<PqdData> pqdDataB = convertDataByValueType(data.getMax(), "MAX",dateTime);
|
||||||
List<PqdData> pqdDataC = convertDataByValueType(data.getAvg(), "avg",dateTime);
|
List<PqdData> pqdDataC = convertDataByValueType(data.getAvg(), "AVG",dateTime);
|
||||||
List<PqdData> pqdDataT = convertDataByValueType(data.getCp95(), "cp95",dateTime);
|
List<PqdData> pqdDataT = convertDataByValueType(data.getCp95(), "CP95",dateTime);
|
||||||
result.addAll(pqdDataA);
|
result.addAll(pqdDataA);
|
||||||
result.addAll(pqdDataB);
|
result.addAll(pqdDataB);
|
||||||
result.addAll(pqdDataC);
|
result.addAll(pqdDataC);
|
||||||
@@ -91,7 +91,7 @@ public class AnalyseComtradeCfg {
|
|||||||
hashMapC.put("time",dateTime.toInstant());
|
hashMapC.put("time",dateTime.toInstant());
|
||||||
|
|
||||||
HashMap hashMapM = new HashMap<>();
|
HashMap hashMapM = new HashMap<>();
|
||||||
hashMapM.put("phaseType","M");
|
hashMapM.put("phaseType","T");
|
||||||
hashMapM.put("valueType",valueType);
|
hashMapM.put("valueType",valueType);
|
||||||
hashMapM.put("time",dateTime.toInstant());
|
hashMapM.put("time",dateTime.toInstant());
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.njcn.csharmonic.param;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,9 +44,12 @@ public class CommonStatisticalQueryParam {
|
|||||||
private List<String> frequencys;
|
private List<String> frequencys;
|
||||||
private int pageNum;
|
private int pageNum;
|
||||||
private int pageSize;
|
private int pageSize;
|
||||||
@ApiModelProperty(value = "查询分类:传1 则是趋势数据tab页面,传2 则是实时数据tab页面,传3 则是暂态事件tab页面")
|
@ApiModelProperty(value = "查询分类:传1 则是趋势数据tab页面,传2 则是实时数据tab页面,传3 则是暂态事件tab页面,传4 则是电度事件tab页面")
|
||||||
private String type;
|
private String type;
|
||||||
@ApiModelProperty(value = "监测点")
|
@ApiModelProperty(value = "监测点")
|
||||||
private String lineId;
|
private String lineId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "数据模型 0:全量查询 1:增量查询")
|
||||||
|
private Integer dataModel;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class CsAlarm implements Serializable {
|
|||||||
private String interruptEvent;
|
private String interruptEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 中断事件描述
|
* 告警事件描述
|
||||||
*/
|
*/
|
||||||
private String alarmEvent;
|
private String alarmEvent;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.po;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CsAlarmData implements Serializable {
|
||||||
|
|
||||||
|
//设备id
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
// 在线率异常记录
|
||||||
|
private OnlineRateAlarm onlineRate;
|
||||||
|
|
||||||
|
// 完整性异常记录
|
||||||
|
private IntegrityAlarm integrity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线率异常信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class OnlineRateAlarm implements Serializable {
|
||||||
|
// 实际在线率值
|
||||||
|
private Double value;
|
||||||
|
// 阈值
|
||||||
|
private Double threshold;
|
||||||
|
// 是否异常
|
||||||
|
private Boolean isAbnormal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 完整性异常信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class IntegrityAlarm implements Serializable {
|
||||||
|
// 阈值
|
||||||
|
private Double threshold;
|
||||||
|
// 各监测点的完整性数据
|
||||||
|
private List<MonitorPointIntegrity> monitorPoints;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点完整性信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class MonitorPointIntegrity implements Serializable {
|
||||||
|
// 监测点ID
|
||||||
|
private String monitorPointId;
|
||||||
|
// 监测点名称
|
||||||
|
private String monitorName;
|
||||||
|
// 该监测点的完整性值
|
||||||
|
private Double value;
|
||||||
|
// 是否异常
|
||||||
|
private Boolean isAbnormal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -129,4 +129,19 @@ public class CsEventPO extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@TableField(value = "phase")
|
@TableField(value = "phase")
|
||||||
private String phase;
|
private String phase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂降原因
|
||||||
|
*/
|
||||||
|
@TableField(value = "advance_reason")
|
||||||
|
private String advanceReason;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂降类型
|
||||||
|
*/
|
||||||
|
@TableField(value = "advance_type")
|
||||||
|
private String advanceType;
|
||||||
|
|
||||||
|
@TableField(value = "land_point")
|
||||||
|
private String landPoint;
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.njcn.csharmonic.pojo.vo;
|
package com.njcn.csharmonic.pojo.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsAlarmData;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -24,8 +24,11 @@ public class AlarmVO implements Serializable {
|
|||||||
@ApiModelProperty(value = "告警设备台数")
|
@ApiModelProperty(value = "告警设备台数")
|
||||||
private Integer warnNums;
|
private Integer warnNums;
|
||||||
|
|
||||||
@ApiModelProperty(value = "通讯中断告警次数")
|
@ApiModelProperty(value = "在线率是否告警")
|
||||||
private Integer interruptCounts;
|
private Boolean onlineRateIsWarn;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "完整性是否告警")
|
||||||
|
private Boolean integrityIsWarn;
|
||||||
|
|
||||||
@ApiModelProperty(value = "终端告警次数")
|
@ApiModelProperty(value = "终端告警次数")
|
||||||
private Integer warnCounts;
|
private Integer warnCounts;
|
||||||
@@ -57,11 +60,8 @@ public class AlarmVO implements Serializable {
|
|||||||
@ApiModelProperty(value = "告警详情")
|
@ApiModelProperty(value = "告警详情")
|
||||||
private List<WarnDetail> warnDetails = new ArrayList<>();
|
private List<WarnDetail> warnDetails = new ArrayList<>();
|
||||||
|
|
||||||
@ApiModelProperty(value = "中断次数")
|
@ApiModelProperty(value = "在线率、完整性详情")
|
||||||
private Integer interruptCounts = 0;
|
private CsAlarmData dataDetails;
|
||||||
|
|
||||||
@ApiModelProperty(value = "中断详情")
|
|
||||||
private List<String> interruptDetails = new ArrayList<>();
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class WarnDetail implements Serializable {
|
public static class WarnDetail implements Serializable {
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AppLineDetailVo implements Serializable {
|
||||||
|
|
||||||
|
private final static long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目名称")
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备名称")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点名称")
|
||||||
|
private String pointName;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点id")
|
||||||
|
private String pointId;
|
||||||
|
|
||||||
|
@ApiModelProperty("数据时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Instant dataTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点类型 0:治理监测点 1:监测监测点")
|
||||||
|
private Integer lineType;
|
||||||
|
|
||||||
|
@ApiModelProperty("指标数据")
|
||||||
|
private List<targetDetail> children;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class targetDetail implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("指标id")
|
||||||
|
private String targetId;
|
||||||
|
|
||||||
|
@ApiModelProperty("指标名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("单位")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
@ApiModelProperty("相别")
|
||||||
|
private String phase;
|
||||||
|
|
||||||
|
@ApiModelProperty("一二次值转换")
|
||||||
|
private String primaryFormula;
|
||||||
|
|
||||||
|
@ApiModelProperty("排序")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
@ApiModelProperty("数据")
|
||||||
|
private Double data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -62,6 +62,13 @@ public class EventDetailVO {
|
|||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS",timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS",timezone = "GMT+8")
|
||||||
private LocalDateTime startTime;
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件时间 不带毫秒
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
private LocalDateTime startTime2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 事件类型
|
* 事件类型
|
||||||
*/
|
*/
|
||||||
@@ -123,4 +130,13 @@ public class EventDetailVO {
|
|||||||
@ApiModelProperty("逻辑子设备编码")
|
@ApiModelProperty("逻辑子设备编码")
|
||||||
private Integer clDid;
|
private Integer clDid;
|
||||||
|
|
||||||
|
@ApiModelProperty("ITIC描述")
|
||||||
|
private String itic;
|
||||||
|
|
||||||
|
@ApiModelProperty("F47描述")
|
||||||
|
private String f47;
|
||||||
|
|
||||||
|
@ApiModelProperty("事件落点")
|
||||||
|
private String landPoint;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import com.njcn.csharmonic.pojo.param.EventStatisticParam;
|
|||||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventStatisticsVo;
|
|
||||||
import com.njcn.csharmonic.service.CsEventPOService;
|
import com.njcn.csharmonic.service.CsEventPOService;
|
||||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -78,10 +77,13 @@ public class CsEventController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@GetMapping("/analyseWave")
|
@GetMapping("/analyseWave")
|
||||||
@ApiOperation("暂态事件波形分析")
|
@ApiOperation("暂态事件波形分析")
|
||||||
@ApiImplicitParam(name = "eventId", value = "暂态事件索引", required = true)
|
@ApiImplicitParams({
|
||||||
public HttpResult<WaveDataDTO> analyseWave(String eventId) {
|
@ApiImplicitParam(name = "eventId", value = "暂态事件索引"),
|
||||||
|
@ApiImplicitParam(name = "isApp", value = "是否是移动端查询")
|
||||||
|
})
|
||||||
|
public HttpResult<WaveDataDTO> analyseWave(@RequestParam(value = "eventId") String eventId,@RequestParam(value = "isApp", required = false) Boolean isApp) {
|
||||||
String methodDescribe = getMethodDescribe("analyseWave");
|
String methodDescribe = getMethodDescribe("analyseWave");
|
||||||
WaveDataDTO wave = csEventPOService.analyseWave(eventId,2);
|
WaveDataDTO wave = csEventPOService.analyseWave(eventId,2,isApp);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, wave, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, wave, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,4 +112,17 @@ public class CsHarmonicPlanController extends BaseController {
|
|||||||
List<CsHarmonicPlan> list = csHarmonicPlanService.listAllOrderBySort();
|
List<CsHarmonicPlan> list = csHarmonicPlanService.listAllOrderBySort();
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询稳态指标方案(包含监测点列表)
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/getByName")
|
||||||
|
@ApiOperation("根据名称查询稳态指标方案")
|
||||||
|
@ApiImplicitParam(name = "name", value = "name", required = true)
|
||||||
|
public HttpResult<List<CsHarmonicPlan>> getByName(@RequestParam("name") String name) {
|
||||||
|
String methodDescribe = getMethodDescribe("getByName");
|
||||||
|
List<CsHarmonicPlan> plan = csHarmonicPlanService.getByName(name);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, plan, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
|||||||
import com.njcn.csdevice.pojo.vo.EachModuleVO;
|
import com.njcn.csdevice.pojo.vo.EachModuleVO;
|
||||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||||
import com.njcn.csharmonic.param.DataParam;
|
import com.njcn.csharmonic.param.DataParam;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.AppLineDetailVo;
|
||||||
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
||||||
import com.njcn.csharmonic.service.IDataService;
|
import com.njcn.csharmonic.service.IDataService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -83,4 +84,14 @@ public class DataController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getLineDataByEngineer")
|
||||||
|
@ApiOperation("App-》工程下所有监测点数据")
|
||||||
|
@ApiImplicitParam(name = "id", value = "工程id", required = true)
|
||||||
|
public HttpResult<List<AppLineDetailVo>> getLineDataByEngineer(@RequestParam("id") String id) {
|
||||||
|
String methodDescribe = getMethodDescribe("getLineDataByEngineer");
|
||||||
|
List<AppLineDetailVo> list = dataService.getLineDataByEngineer(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ import com.github.tocrhz.mqtt.annotation.MqttSubscribe;
|
|||||||
import com.github.tocrhz.mqtt.annotation.NamedValue;
|
import com.github.tocrhz.mqtt.annotation.NamedValue;
|
||||||
import com.github.tocrhz.mqtt.annotation.Payload;
|
import com.github.tocrhz.mqtt.annotation.Payload;
|
||||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.CsLineTopologyFeignClient;
|
||||||
import com.njcn.csdevice.api.DevCapacityFeignClient;
|
import com.njcn.csdevice.api.DevCapacityFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||||
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
||||||
import com.njcn.csharmonic.param.FrequencyStatisticalQueryParam;
|
import com.njcn.csharmonic.param.FrequencyStatisticalQueryParam;
|
||||||
import com.njcn.csharmonic.pojo.dto.RealTimeDataDTO;
|
import com.njcn.csharmonic.pojo.dto.RealTimeDataDTO;
|
||||||
@@ -21,6 +24,10 @@ import com.njcn.csharmonic.service.TemperatureService;
|
|||||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import com.njcn.system.api.CsStatisticalSetFeignClient;
|
import com.njcn.system.api.CsStatisticalSetFeignClient;
|
||||||
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
import com.njcn.zlevent.api.FileFeignClient;
|
import com.njcn.zlevent.api.FileFeignClient;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -33,6 +40,7 @@ import org.springframework.util.CollectionUtils;
|
|||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@@ -56,6 +64,9 @@ public class MqttMessageHandler {
|
|||||||
private final DecimalFormat df = new DecimalFormat("#0.000");
|
private final DecimalFormat df = new DecimalFormat("#0.000");
|
||||||
private final FileFeignClient fileFeignClient;
|
private final FileFeignClient fileFeignClient;
|
||||||
private final CsEventPOService csEventPOService;
|
private final CsEventPOService csEventPOService;
|
||||||
|
private final CsLineTopologyFeignClient csLineTopologyClient;
|
||||||
|
private final CsLineFeignClient csLineFeignClient;
|
||||||
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实时数据应答
|
* 实时数据应答
|
||||||
@@ -109,111 +120,6 @@ public class MqttMessageHandler {
|
|||||||
publisher.send("/zl/TemperData/" + pageId, gson.toJson(recallReplyDTO), 1, false);
|
publisher.send("/zl/TemperData/" + pageId, gson.toJson(recallReplyDTO), 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 实时数据应答
|
|
||||||
*/
|
|
||||||
// @MqttSubscribe(value = "/zl/askDevData/{devId}",qos = 1)
|
|
||||||
// public void responseTopoData(String topic, @NamedValue("devId") String devId, MqttMessage message, @Payload String payload) {
|
|
||||||
// String topoDataJson =redisUtil.getStringByKey (devId);
|
|
||||||
// if(StringUtils.isEmpty(topoDataJson)){
|
|
||||||
// List<ThdDataVO> result = new ArrayList<>();
|
|
||||||
// List<ThdDataVO> tempList = new ArrayList<>();
|
|
||||||
//
|
|
||||||
// //1.查询拓扑图配置的指标:拓扑图扑图配置:7677f94c749dedaff30f911949cbd724
|
|
||||||
// List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect("b934664f9592d1c5e92caa90695b7103").getData();
|
|
||||||
// data.forEach(temp->{
|
|
||||||
// if(Objects.nonNull(temp.getHarmStart())&&Objects.nonNull(temp.getHarmEnd())){
|
|
||||||
// FrequencyStatisticalQueryParam frequencyStatisticalQueryParam = new FrequencyStatisticalQueryParam();
|
|
||||||
// frequencyStatisticalQueryParam.setDevId(devId);
|
|
||||||
// frequencyStatisticalQueryParam.setStatisticalId(temp.getId());
|
|
||||||
// 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");
|
|
||||||
// List<ThdDataVO> listFuture= stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
|
|
||||||
// tempList.addAll(listFuture);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
// //过滤M相
|
|
||||||
// List<ThdDataVO> m = tempList.stream().filter(temp -> Objects.equals(temp.getPhase(), "M")).collect(Collectors.toList());
|
|
||||||
// m.stream().forEach(temp->{
|
|
||||||
// Stream.of("A","B","C").forEach(phase->{
|
|
||||||
// ThdDataVO thdDataVO = new ThdDataVO();
|
|
||||||
// BeanUtils.copyProperties(temp,thdDataVO);
|
|
||||||
// thdDataVO.setPhase(phase);
|
|
||||||
// result.add(thdDataVO);
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// List<ThdDataVO> apfThdI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Load(%)")).collect(Collectors.toList());
|
|
||||||
// Map<String, List<ThdDataVO>> collect3 = apfThdI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
|
||||||
// collect3.forEach((k,v)->{
|
|
||||||
// if(!CollectionUtil.isEmpty(v)){
|
|
||||||
// double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
|
||||||
// ThdDataVO thdDataVO = new ThdDataVO();
|
|
||||||
// BeanUtils.copyProperties(v.get(0),thdDataVO);
|
|
||||||
// thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
|
||||||
// thdDataVO.setPhase("avg");
|
|
||||||
// result.add(thdDataVO);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// List<ThdDataVO> apfRmsI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_RmsI_TolOut(A)")).collect(Collectors.toList());
|
|
||||||
// Map<String, List<ThdDataVO>> collect2 = apfRmsI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
|
||||||
// collect2.forEach((k,v)->{
|
|
||||||
// if(!CollectionUtil.isEmpty(v)){
|
|
||||||
// double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
|
||||||
// ThdDataVO thdDataVO = new ThdDataVO();
|
|
||||||
// BeanUtils.copyProperties(v.get(0),thdDataVO);
|
|
||||||
// thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
|
||||||
// thdDataVO.setPhase("avg");
|
|
||||||
// result.add(thdDataVO);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// List<ThdDataVO> apfThdISys = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Sys(%)")).collect(Collectors.toList());
|
|
||||||
// Map<String, List<ThdDataVO>> collect4 = apfThdISys.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
|
||||||
// collect4.forEach((k,v)->{
|
|
||||||
// if(!CollectionUtil.isEmpty(v)){
|
|
||||||
// double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
|
||||||
// ThdDataVO thdDataVO = new ThdDataVO();
|
|
||||||
// BeanUtils.copyProperties(v.get(0),thdDataVO);
|
|
||||||
// thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
|
||||||
// thdDataVO.setPhase("avg");
|
|
||||||
// result.add(thdDataVO);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// Double capacity = devCapacityFeignClient.getDevCapacity(devId).getData();
|
|
||||||
// apfRmsI.forEach(temp->{
|
|
||||||
// ThdDataVO thdDataVO = new ThdDataVO();
|
|
||||||
// BeanUtils.copyProperties(temp,thdDataVO);
|
|
||||||
// thdDataVO.setUnit("%");
|
|
||||||
// thdDataVO.setStatisticalName("load_Rate");
|
|
||||||
// thdDataVO.setAnotherName("负载率");
|
|
||||||
// if (capacity<=0){
|
|
||||||
// thdDataVO.setStatisticalData(3.1415926);
|
|
||||||
// }else {
|
|
||||||
// double v = temp.getStatisticalData()*100 / capacity;
|
|
||||||
// thdDataVO.setStatisticalData(Double.valueOf(df.format(v)));
|
|
||||||
// }
|
|
||||||
// result.add(thdDataVO);
|
|
||||||
// });
|
|
||||||
// List<ThdDataVO> notM = tempList.stream().filter(temp -> !Objects.equals(temp.getPhase(), "M")).collect(Collectors.toList());
|
|
||||||
// result.addAll(notM);
|
|
||||||
// Gson gson = new Gson();
|
|
||||||
// topoDataJson = gson.toJson(result);
|
|
||||||
// redisUtil.saveByKeyWithExpire(devId, (Object) topoDataJson, 30L);
|
|
||||||
// }
|
|
||||||
// publisher.send("/zl/devData/"+devId,topoDataJson,1,false);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实时数据应答
|
* 实时数据应答
|
||||||
*/
|
*/
|
||||||
@@ -225,7 +131,7 @@ public class MqttMessageHandler {
|
|||||||
List<ThdDataVO> tempList = new ArrayList<>();
|
List<ThdDataVO> tempList = new ArrayList<>();
|
||||||
|
|
||||||
//1.查询拓扑图配置的指标:拓扑图扑图配置:7677f94c749dedaff30f911949cbd724
|
//1.查询拓扑图配置的指标:拓扑图扑图配置:7677f94c749dedaff30f911949cbd724
|
||||||
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(typeId).getData();
|
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(typeId)).getData();
|
||||||
data.forEach(temp -> {
|
data.forEach(temp -> {
|
||||||
if (Objects.nonNull(temp.getHarmStart()) && Objects.nonNull(temp.getHarmEnd())) {
|
if (Objects.nonNull(temp.getHarmStart()) && Objects.nonNull(temp.getHarmEnd())) {
|
||||||
FrequencyStatisticalQueryParam frequencyStatisticalQueryParam = new FrequencyStatisticalQueryParam();
|
FrequencyStatisticalQueryParam frequencyStatisticalQueryParam = new FrequencyStatisticalQueryParam();
|
||||||
@@ -248,8 +154,8 @@ public class MqttMessageHandler {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//过滤M相
|
//过滤T相
|
||||||
List<ThdDataVO> m = tempList.stream().filter(temp -> Objects.equals(temp.getPhase(), "M")).collect(Collectors.toList());
|
List<ThdDataVO> m = tempList.stream().filter(temp -> Objects.equals(temp.getPhase(), "T")).collect(Collectors.toList());
|
||||||
m.stream().forEach(temp -> {
|
m.stream().forEach(temp -> {
|
||||||
Stream.of("A", "B", "C").forEach(phase -> {
|
Stream.of("A", "B", "C").forEach(phase -> {
|
||||||
ThdDataVO thdDataVO = new ThdDataVO();
|
ThdDataVO thdDataVO = new ThdDataVO();
|
||||||
@@ -260,6 +166,121 @@ public class MqttMessageHandler {
|
|||||||
});
|
});
|
||||||
//如果是基础数据则添加拓扑图的数据
|
//如果是基础数据则添加拓扑图的数据
|
||||||
if (Objects.equals("fc8c86dbc3f2d9810f5cd8f53c295415", typeId)) {
|
if (Objects.equals("fc8c86dbc3f2d9810f5cd8f53c295415", typeId)) {
|
||||||
|
List<ThdDataVO> apfRmsI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_RmsI_TolOut(A)")).collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<DictData> dictData = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_POSITION.getCode()).getData();
|
||||||
|
Map<String, DictData> codeToDictData = dictData.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||||
|
//添加拓扑图上自定义的指标
|
||||||
|
//根据设备id查询拓扑图
|
||||||
|
AppTopologyDiagramVO vo = csLineTopologyClient.queryTopologyDiagram(devId).getData();
|
||||||
|
vo.getAppsLineTopologyDiagramPO().forEach(item -> {
|
||||||
|
String linePositionCode = codeToDictData.get(item.getLinePostion()).getCode();
|
||||||
|
if (Objects.equals(linePositionCode, DicDataEnum.OUTPUT_SIDE.getCode())) {
|
||||||
|
//输出侧
|
||||||
|
if (item.getTarget() != null && !item.getTarget().isEmpty()) {
|
||||||
|
List<ThdDataVO> l1 = new ArrayList<>();
|
||||||
|
//根据指标查询
|
||||||
|
List<EleEpdPqd> data1 = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(item.getTarget())).getData();
|
||||||
|
data1.forEach(temp -> {
|
||||||
|
CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
|
||||||
|
commonStatisticalQueryParam.setDevId(devId);
|
||||||
|
commonStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||||
|
commonStatisticalQueryParam.setValueType("avg");
|
||||||
|
List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
|
||||||
|
l1.addAll(listFuture);
|
||||||
|
});
|
||||||
|
Map<String, List<ThdDataVO>> collect3 = l1.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||||
|
collect3.forEach((k, v) -> {
|
||||||
|
if (!CollectionUtil.isEmpty(v)) {
|
||||||
|
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||||
|
ThdDataVO thdDataVO = new ThdDataVO();
|
||||||
|
BeanUtils.copyProperties(v.get(0), thdDataVO);
|
||||||
|
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||||
|
thdDataVO.setPhase("avg");
|
||||||
|
result.add(thdDataVO);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Map<String, List<ThdDataVO>> collect2 = apfRmsI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||||
|
collect2.forEach((k, v) -> {
|
||||||
|
if (!CollectionUtil.isEmpty(v)) {
|
||||||
|
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||||
|
ThdDataVO thdDataVO = new ThdDataVO();
|
||||||
|
BeanUtils.copyProperties(v.get(0), thdDataVO);
|
||||||
|
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||||
|
thdDataVO.setPhase("avg");
|
||||||
|
result.add(thdDataVO);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (Objects.equals(linePositionCode, DicDataEnum.GRID_SIDE.getCode())) {
|
||||||
|
//电网侧
|
||||||
|
if (item.getTarget() != null && !item.getTarget().isEmpty()) {
|
||||||
|
//根据指标查询
|
||||||
|
List<ThdDataVO> l1 = new ArrayList<>();
|
||||||
|
//根据指标查询
|
||||||
|
List<EleEpdPqd> data1 = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(item.getTarget())).getData();
|
||||||
|
data1.forEach(temp -> {
|
||||||
|
CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
|
||||||
|
commonStatisticalQueryParam.setDevId(devId);
|
||||||
|
commonStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||||
|
commonStatisticalQueryParam.setValueType("avg");
|
||||||
|
List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
|
||||||
|
l1.addAll(listFuture);
|
||||||
|
});
|
||||||
|
Map<String, List<ThdDataVO>> collect3 = l1.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||||
|
collect3.forEach((k, v) -> {
|
||||||
|
if (!CollectionUtil.isEmpty(v)) {
|
||||||
|
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||||
|
ThdDataVO thdDataVO = new ThdDataVO();
|
||||||
|
BeanUtils.copyProperties(v.get(0), thdDataVO);
|
||||||
|
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||||
|
thdDataVO.setPhase("avg");
|
||||||
|
result.add(thdDataVO);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
List<ThdDataVO> apfThdISys = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Sys(%)")).collect(Collectors.toList());
|
||||||
|
Map<String, List<ThdDataVO>> collect4 = apfThdISys.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||||
|
collect4.forEach((k, v) -> {
|
||||||
|
if (!CollectionUtil.isEmpty(v)) {
|
||||||
|
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||||
|
ThdDataVO thdDataVO = new ThdDataVO();
|
||||||
|
BeanUtils.copyProperties(v.get(0), thdDataVO);
|
||||||
|
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||||
|
thdDataVO.setPhase("avg");
|
||||||
|
result.add(thdDataVO);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (Objects.equals(linePositionCode, DicDataEnum.LOAD_SIDE.getCode())) {
|
||||||
|
//负载侧
|
||||||
|
if (item.getTarget() != null && !item.getTarget().isEmpty()) {
|
||||||
|
//根据指标查询
|
||||||
|
List<ThdDataVO> l1 = new ArrayList<>();
|
||||||
|
//根据指标查询
|
||||||
|
List<EleEpdPqd> data1 = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(item.getTarget())).getData();
|
||||||
|
data1.forEach(temp -> {
|
||||||
|
CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
|
||||||
|
commonStatisticalQueryParam.setDevId(devId);
|
||||||
|
commonStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||||
|
commonStatisticalQueryParam.setValueType("avg");
|
||||||
|
List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
|
||||||
|
l1.addAll(listFuture);
|
||||||
|
});
|
||||||
|
Map<String, List<ThdDataVO>> collect3 = l1.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||||
|
collect3.forEach((k, v) -> {
|
||||||
|
if (!CollectionUtil.isEmpty(v)) {
|
||||||
|
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||||
|
ThdDataVO thdDataVO = new ThdDataVO();
|
||||||
|
BeanUtils.copyProperties(v.get(0), thdDataVO);
|
||||||
|
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||||
|
thdDataVO.setPhase("avg");
|
||||||
|
result.add(thdDataVO);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
List<ThdDataVO> apfThdI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Load(%)")).collect(Collectors.toList());
|
List<ThdDataVO> apfThdI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Load(%)")).collect(Collectors.toList());
|
||||||
Map<String, List<ThdDataVO>> collect3 = apfThdI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
Map<String, List<ThdDataVO>> collect3 = apfThdI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||||
collect3.forEach((k, v) -> {
|
collect3.forEach((k, v) -> {
|
||||||
@@ -272,29 +293,7 @@ public class MqttMessageHandler {
|
|||||||
result.add(thdDataVO);
|
result.add(thdDataVO);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
List<ThdDataVO> apfRmsI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_RmsI_TolOut(A)")).collect(Collectors.toList());
|
|
||||||
Map<String, List<ThdDataVO>> collect2 = apfRmsI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
|
||||||
collect2.forEach((k, v) -> {
|
|
||||||
if (!CollectionUtil.isEmpty(v)) {
|
|
||||||
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
|
||||||
ThdDataVO thdDataVO = new ThdDataVO();
|
|
||||||
BeanUtils.copyProperties(v.get(0), thdDataVO);
|
|
||||||
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
|
||||||
thdDataVO.setPhase("avg");
|
|
||||||
result.add(thdDataVO);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
List<ThdDataVO> apfThdISys = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Sys(%)")).collect(Collectors.toList());
|
|
||||||
Map<String, List<ThdDataVO>> collect4 = apfThdISys.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
|
||||||
collect4.forEach((k, v) -> {
|
|
||||||
if (!CollectionUtil.isEmpty(v)) {
|
|
||||||
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
|
||||||
ThdDataVO thdDataVO = new ThdDataVO();
|
|
||||||
BeanUtils.copyProperties(v.get(0), thdDataVO);
|
|
||||||
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
|
||||||
thdDataVO.setPhase("avg");
|
|
||||||
result.add(thdDataVO);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Double capacity = devCapacityFeignClient.getDevCapacity(devId).getData();
|
Double capacity = devCapacityFeignClient.getDevCapacity(devId).getData();
|
||||||
@@ -314,7 +313,7 @@ public class MqttMessageHandler {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ThdDataVO> notM = tempList.stream().filter(temp -> !Objects.equals(temp.getPhase(), "M")).collect(Collectors.toList());
|
List<ThdDataVO> notM = tempList.stream().filter(temp -> !Objects.equals(temp.getPhase(), "T")).collect(Collectors.toList());
|
||||||
result.addAll(notM);
|
result.addAll(notM);
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
topoDataJson = gson.toJson(result);
|
topoDataJson = gson.toJson(result);
|
||||||
@@ -323,7 +322,6 @@ public class MqttMessageHandler {
|
|||||||
publisher.send("/zl/devData/" + devId + "/" + typeId, topoDataJson, 1, false);
|
publisher.send("/zl/devData/" + devId + "/" + typeId, topoDataJson, 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getCldidName(String cldid) {
|
public String getCldidName(String cldid) {
|
||||||
|
|
||||||
switch (cldid) {
|
switch (cldid) {
|
||||||
|
|||||||
@@ -168,7 +168,8 @@
|
|||||||
b.type type,
|
b.type type,
|
||||||
b.LEVEL LEVEL,
|
b.LEVEL LEVEL,
|
||||||
b.location location,
|
b.location location,
|
||||||
c.dev_type devType
|
c.dev_type devType,
|
||||||
|
b.land_point landPoint
|
||||||
<if test="csEventUserQueryPage != null and csEventUserQueryPage.type != null and csEventUserQueryPage.type != '' and csEventUserQueryPage.type ==0">
|
<if test="csEventUserQueryPage != null and csEventUserQueryPage.type != null and csEventUserQueryPage.type != '' and csEventUserQueryPage.type ==0">
|
||||||
,d.NAME lineName
|
,d.NAME lineName
|
||||||
</if>
|
</if>
|
||||||
@@ -176,7 +177,7 @@
|
|||||||
cs_event b
|
cs_event b
|
||||||
inner join cs_equipment_delivery c on b.device_id=c.id
|
inner join cs_equipment_delivery c on b.device_id=c.id
|
||||||
<if test="csEventUserQueryPage != null and csEventUserQueryPage.type != null and csEventUserQueryPage.type != '' and csEventUserQueryPage.type ==0">
|
<if test="csEventUserQueryPage != null and csEventUserQueryPage.type != null and csEventUserQueryPage.type != '' and csEventUserQueryPage.type ==0">
|
||||||
inner join cs_line d on d.device_id=b.device_id
|
inner join cs_line d on d.device_id = b.device_id and d.clDid=b.cl_did
|
||||||
</if>
|
</if>
|
||||||
where 1=1
|
where 1=1
|
||||||
and b.process=c.process
|
and b.process=c.process
|
||||||
@@ -374,7 +375,7 @@
|
|||||||
SUM(CASE WHEN tag = 'Evt_Sys_DipStr' THEN 1 ELSE 0 END) AS eventDown,
|
SUM(CASE WHEN tag = 'Evt_Sys_DipStr' THEN 1 ELSE 0 END) AS eventDown,
|
||||||
SUM(CASE WHEN tag = 'Evt_Sys_IntrStr' THEN 1 ELSE 0 END) AS eventOff,
|
SUM(CASE WHEN tag = 'Evt_Sys_IntrStr' THEN 1 ELSE 0 END) AS eventOff,
|
||||||
SUM(CASE WHEN tag = 'Evt_Sys_SwlStr' THEN 1 ELSE 0 END) AS eventUp,
|
SUM(CASE WHEN tag = 'Evt_Sys_SwlStr' THEN 1 ELSE 0 END) AS eventUp,
|
||||||
COUNT(*) AS allNum
|
SUM(CASE WHEN tag IN ('Evt_Sys_DipStr', 'Evt_Sys_IntrStr', 'Evt_Sys_SwlStr') THEN 1 ELSE 0 END) AS allNum
|
||||||
FROM
|
FROM
|
||||||
cs_event
|
cs_event
|
||||||
WHERE
|
WHERE
|
||||||
|
|||||||
@@ -1,113 +0,0 @@
|
|||||||
package com.njcn.csharmonic.service;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.date.DatePattern;
|
|
||||||
import com.njcn.access.pojo.dto.NoticeUserDto;
|
|
||||||
import com.njcn.access.utils.SendMessageUtil;
|
|
||||||
import com.njcn.csdevice.api.DeviceMessageFeignClient;
|
|
||||||
import com.njcn.csdevice.param.DeviceMessageParam;
|
|
||||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
|
|
||||||
import com.njcn.system.api.EpdFeignClient;
|
|
||||||
import com.njcn.user.pojo.po.User;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.scheduling.annotation.Async;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xy
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class AppNotificationService {
|
|
||||||
|
|
||||||
private final EpdFeignClient epdFeignClient;
|
|
||||||
private final SendMessageUtil sendMessageUtil;
|
|
||||||
private final DeviceMessageFeignClient deviceMessageClient;
|
|
||||||
private final CsEventUserPOService csEventUserPOService;
|
|
||||||
|
|
||||||
@Async("eventNotificationExecutor")
|
|
||||||
public void asyncSaveEventUserAndNotify(String eventId
|
|
||||||
, List<String> eventUser
|
|
||||||
, DevDetailDTO devDetailDto
|
|
||||||
, LocalDateTime time
|
|
||||||
, Integer eventType
|
|
||||||
, Double amplitude
|
|
||||||
, Double persistTime) {
|
|
||||||
NoticeUserDto noticeUserDto = new NoticeUserDto();
|
|
||||||
NoticeUserDto.Payload payload = new NoticeUserDto.Payload();
|
|
||||||
List<CsEventUserPO> result = new ArrayList<>();
|
|
||||||
|
|
||||||
eventUser.forEach(item -> {
|
|
||||||
CsEventUserPO csEventUser = new CsEventUserPO();
|
|
||||||
csEventUser.setUserId(item);
|
|
||||||
csEventUser.setStatus(0);
|
|
||||||
csEventUser.setEventId(eventId);
|
|
||||||
result.add(csEventUser);
|
|
||||||
});
|
|
||||||
|
|
||||||
DeviceMessageParam param = new DeviceMessageParam();
|
|
||||||
param.setUserList(eventUser);
|
|
||||||
param.setEventType(0);
|
|
||||||
List<User> users = deviceMessageClient.getSendUserByType(param).getData();
|
|
||||||
if (CollectionUtil.isNotEmpty(users)) {
|
|
||||||
List<String> devCodeList = users.stream().map(User::getDevCode).distinct().collect(Collectors.toList());
|
|
||||||
noticeUserDto.setPushClientId(devCodeList);
|
|
||||||
noticeUserDto.setTitle("暂态事件");
|
|
||||||
}
|
|
||||||
|
|
||||||
String eventName = epdFeignClient.findByName(getTag(eventType)).getData().getShowName();
|
|
||||||
String content = devDetailDto.getEngineeringName() + "-" + devDetailDto.getProjectName() + "-" + devDetailDto.getEquipmentName()
|
|
||||||
+ "于" + time.format(DatePattern.NORM_DATETIME_MS_FORMATTER) + "发生暂态事件,事件类型:"
|
|
||||||
+ eventName
|
|
||||||
+ ",特征幅值:" + amplitude + "%"
|
|
||||||
+ ",持续时间:" + persistTime + "s";
|
|
||||||
noticeUserDto.setContent(content);
|
|
||||||
payload.setType(0);
|
|
||||||
payload.setPath("/pages/index/message1?type=" + payload.getType());
|
|
||||||
noticeUserDto.setPayload(payload);
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(noticeUserDto.getPushClientId())) {
|
|
||||||
List<String> filteredList = noticeUserDto.getPushClientId().stream()
|
|
||||||
.filter(s -> s != null && !s.isEmpty())
|
|
||||||
.distinct()
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (CollectionUtil.isNotEmpty(filteredList)) {
|
|
||||||
noticeUserDto.setPushClientId(filteredList);
|
|
||||||
sendMessageUtil.sendEventToUser(noticeUserDto);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (CollectionUtil.isNotEmpty(result)) {
|
|
||||||
csEventUserPOService.saveBatch(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTag(Integer type) {
|
|
||||||
String tag;
|
|
||||||
switch (type) {
|
|
||||||
case 1:
|
|
||||||
tag = "Evt_Sys_DipStr";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
tag = "Evt_Sys_SwlStr";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
tag = "Evt_Sys_IntrStr";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
tag = "Transient";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
tag = "Un_Know";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,10 +12,7 @@ import com.njcn.csharmonic.pojo.po.CsEventPO;
|
|||||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||||
import com.njcn.csharmonic.pojo.vo.CsWarnDescVO;
|
import com.njcn.csharmonic.pojo.vo.CsWarnDescVO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventStatisticsVo;
|
|
||||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -40,7 +37,7 @@ public interface CsEventPOService extends IService<CsEventPO>{
|
|||||||
* @date 2023/9/20 14:23
|
* @date 2023/9/20 14:23
|
||||||
* @return WaveDataDTO
|
* @return WaveDataDTO
|
||||||
*/
|
*/
|
||||||
WaveDataDTO analyseWave(String eventId, int i);
|
WaveDataDTO analyseWave(String eventId, int i, Boolean isApp);
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 获取事件波形图信息
|
* 获取事件波形图信息
|
||||||
|
|||||||
@@ -60,4 +60,6 @@ public interface ICsHarmonicPlanService extends IService<CsHarmonicPlan> {
|
|||||||
* @return 方案详情
|
* @return 方案详情
|
||||||
*/
|
*/
|
||||||
CsHarmonicPlan getByIdWithLines(String id);
|
CsHarmonicPlan getByIdWithLines(String id);
|
||||||
|
|
||||||
|
List<CsHarmonicPlan> getByName(String name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
|||||||
import com.njcn.csdevice.pojo.vo.EachModuleVO;
|
import com.njcn.csdevice.pojo.vo.EachModuleVO;
|
||||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||||
import com.njcn.csharmonic.param.DataParam;
|
import com.njcn.csharmonic.param.DataParam;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.AppLineDetailVo;
|
||||||
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -38,4 +39,6 @@ public interface IDataService {
|
|||||||
|
|
||||||
List<EachModuleVO> getModuleState(String id);
|
List<EachModuleVO> getModuleState(String id);
|
||||||
|
|
||||||
|
List<AppLineDetailVo> getLineDataByEngineer(String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
package com.njcn.csharmonic.service;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.date.DatePattern;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.njcn.csdevice.api.SmsSendFeignClient;
|
|
||||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
|
||||||
import com.njcn.cssystem.api.AppMsgSetFeignClient;
|
|
||||||
import com.njcn.user.api.UserFeignClient;
|
|
||||||
import com.njcn.user.pojo.po.User;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.scheduling.annotation.Async;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xy
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class SmsNotificationService {
|
|
||||||
private final AppMsgSetFeignClient appMsgSetFeignClient;
|
|
||||||
private final UserFeignClient userFeignClient;
|
|
||||||
private final SmsSendFeignClient smsSendFeignClient;
|
|
||||||
@Value("${msg.msg_sign:南京灿能电力}")
|
|
||||||
private String msgSign;
|
|
||||||
|
|
||||||
@Async("smsNotificationExecutor")
|
|
||||||
public void asyncSendSmsNotification(String deviceId
|
|
||||||
, DevDetailDTO devDetailDto
|
|
||||||
, LocalDateTime eventTime
|
|
||||||
, Double amplitude
|
|
||||||
, Double persistTime) {
|
|
||||||
List<String> userIdList = appMsgSetFeignClient.queryUserIdsByDeviceId(deviceId).getData();
|
|
||||||
if (CollectionUtil.isNotEmpty(userIdList)) {
|
|
||||||
List<User> userList = userFeignClient.getUserListByIds(userIdList).getData();
|
|
||||||
if (CollectionUtil.isNotEmpty(userList)) {
|
|
||||||
List<User> userList1 = userList.stream()
|
|
||||||
.filter(item -> StrUtil.isNotBlank(item.getPhone()) && Objects.equals(item.getSmsNotice(), 1))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (CollectionUtil.isNotEmpty(userList1)) {
|
|
||||||
String msgContent = "【" + msgSign + "】" + devDetailDto.getEngineeringName() + "-" + devDetailDto.getProjectName() + "-" + devDetailDto.getEquipmentName()
|
|
||||||
+ "于" + eventTime.format(DatePattern.NORM_DATETIME_MS_FORMATTER) + "发生暂降事件"
|
|
||||||
+ ",特征幅值:" + amplitude + "%"
|
|
||||||
+ ",持续时间:" + persistTime + "s";
|
|
||||||
userList1.forEach(item -> {
|
|
||||||
smsSendFeignClient.sendSmsSimple(item.getPhone(), msgContent, "verify_code");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user