Compare commits
32 Commits
6bb9d932b8
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 38be9f6839 | |||
| 85f0775c97 | |||
| 681ec99f23 | |||
| 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>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.paho</groupId>
|
||||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||
<version>1.2.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -3,8 +3,7 @@ package com.njcn.csdevice.api;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.fallback.CsCommTerminalFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.api.fallback.CsDeviceUserClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -31,4 +30,7 @@ public interface CsCommTerminalFeignClient {
|
||||
|
||||
@GetMapping("getPqUserIdsByUser")
|
||||
HttpResult<List<String>> getPqUserIdsByUser(@RequestParam("userId") String userId);
|
||||
|
||||
@PostMapping("/getLedgerByLineId")
|
||||
HttpResult<List<DevDetailDTO>> getLedgerByLineId(@RequestBody List<String> list);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.njcn.csdevice.api.fallback.CsEdDataFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.po.CsEdDataPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEdDataVO;
|
||||
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.RequestParam;
|
||||
|
||||
@@ -14,7 +16,7 @@ import java.util.List;
|
||||
/**
|
||||
* @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 {
|
||||
|
||||
@PostMapping("/findByDevTypeId")
|
||||
@@ -22,4 +24,7 @@ public interface CsEdDataFeignClient {
|
||||
|
||||
@PostMapping("/getAll")
|
||||
HttpResult<List<CsEdDataPO>> getAll(@RequestParam("devType") String devType);
|
||||
|
||||
@GetMapping("/getById")
|
||||
HttpResult<CsEdDataPO> getById(@RequestParam("id") String id);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package com.njcn.csdevice.api;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
@@ -75,9 +72,9 @@ public interface CsLineFeignClient {
|
||||
@PostMapping("/getOverLimitDataByIds")
|
||||
HttpResult<List<Overlimit>> getOverLimitData(@RequestBody List<String> ids);
|
||||
|
||||
@PostMapping("/getLineBySensitiveUser")
|
||||
@ApiOperation("根据敏感用户查询监测点")
|
||||
HttpResult<List<CsLinePO>> getLineBySensitiveUser(@RequestBody List<String> list);
|
||||
@PostMapping("/getDevBySensitiveUser")
|
||||
@ApiOperation("根据敏感用户查询装置")
|
||||
HttpResult<List<CsEquipmentDeliveryPO>> getDevBySensitiveUser(@RequestBody List<String> list);
|
||||
|
||||
@PostMapping("/list")
|
||||
HttpResult<List<CsLinePO>> list(@RequestBody CsLinePO param);
|
||||
|
||||
@@ -4,9 +4,12 @@ import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.fallback.CsLineTopologyClientFallbackFactory;
|
||||
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.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -19,4 +22,8 @@ public interface CsLineTopologyFeignClient {
|
||||
@PostMapping("/addList")
|
||||
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.csdevice.api.fallback.DeviceMessageClientFallbackFactory;
|
||||
import com.njcn.csdevice.param.DeviceMessageParam;
|
||||
import com.njcn.csdevice.param.LineInfoParam;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
@@ -29,6 +30,6 @@ public interface DeviceMessageFeignClient {
|
||||
|
||||
@PostMapping("/getLineInfo")
|
||||
@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);
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -51,6 +52,12 @@ public class CsCommTerminalFeignClientFallbackFactory implements FallbackFactory
|
||||
log.error("{}异常,降级处理,异常为:{}","根据登录用户id获取电能质量用户id集合",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<DevDetailDTO>> getLedgerByLineId(List<String> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据监测点id集合获取所有台账信息异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,12 @@ public class CsEdDataFeignClientFallbackFactory implements FallbackFactory<CsEdD
|
||||
log.error("{}异常,降级处理,异常为:{}","根据装置型号获取装置类型",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<CsEdDataPO> getById(String id) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据id获取装置类型",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
@@ -117,7 +118,7 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsLinePO>> getLineBySensitiveUser(List<String> list) {
|
||||
public HttpResult<List<CsEquipmentDeliveryPO>> getDevBySensitiveUser(List<String> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据敏感用户查询监测点异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.CsLineTopologyFeignClient;
|
||||
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -33,6 +34,12 @@ public class CsLineTopologyClientFallbackFactory implements FallbackFactory<CsLi
|
||||
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.exception.BusinessException;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
* @author caozehui
|
||||
* @data 2026-04-23
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SmsSendClientFallbackFactory implements FallbackFactory<SmsSendFeignClient> {
|
||||
public class CsUpgradeLogsClientFallbackFactory implements FallbackFactory<CsUpgradeLogsFeignClient> {
|
||||
@Override
|
||||
public SmsSendFeignClient create(Throwable cause) {
|
||||
public CsUpgradeLogsFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new SmsSendFeignClient() {
|
||||
|
||||
return new CsUpgradeLogsFeignClient() {
|
||||
@Override
|
||||
public HttpResult<String> sendSmsSimple(String receiver, String content, String messageType) {
|
||||
log.error("{}异常,降级处理,异常为:{}","发送短信(简化参数)数据异常",cause.toString());
|
||||
public HttpResult add(CsUpgradeLogs csUpgradeLogs) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "新增升级日志异常", 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.csdevice.api.DeviceMessageFeignClient;
|
||||
import com.njcn.csdevice.param.DeviceMessageParam;
|
||||
import com.njcn.csdevice.param.LineInfoParam;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -41,7 +42,7 @@ public class DeviceMessageClientFallbackFactory implements FallbackFactory<Devic
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<String> getLineInfo(String id) {
|
||||
public HttpResult<String> getLineInfo(LineInfoParam param) {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取监测点信息数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@@ -21,4 +21,7 @@ public class IcdBzParam implements Serializable {
|
||||
@ApiModelProperty("结束时间")
|
||||
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,24 @@ public class CsEquipmentDeliveryDTO {
|
||||
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
|
||||
*/
|
||||
private String devLogLevel;
|
||||
|
||||
/**
|
||||
* 设备软件信息id
|
||||
*/
|
||||
private String softinfoId;
|
||||
|
||||
/**
|
||||
* 治理方法
|
||||
*/
|
||||
private String governMethod;
|
||||
|
||||
/**
|
||||
* 敏感用户id
|
||||
*/
|
||||
private String monitorUser;
|
||||
|
||||
/**
|
||||
* 治理类型(稳态:harmonic 暂态:event)
|
||||
*/
|
||||
private String governType;
|
||||
}
|
||||
@@ -34,12 +34,27 @@ public class DevDetailDTO {
|
||||
@ApiModelProperty(value = "设备名称")
|
||||
private String equipmentName;
|
||||
|
||||
@ApiModelProperty(value = "监测点id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty(value = "监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty(value = "设备通讯状态")
|
||||
private Integer runStatus;
|
||||
|
||||
@ApiModelProperty(value = "设备MAC地址")
|
||||
private String devMac;
|
||||
|
||||
@ApiModelProperty(value = "nDid")
|
||||
private String nDid;
|
||||
|
||||
@ApiModelProperty(value = "监测对象")
|
||||
private String objType;
|
||||
|
||||
@ApiModelProperty(value = "设备治理方案")
|
||||
private String governType;
|
||||
|
||||
@ApiModelProperty(value = "监测点id集合")
|
||||
private List<String> lineList;
|
||||
}
|
||||
|
||||
@@ -44,5 +44,6 @@ public class AppLineTopologyDiagramParm extends BaseEntity {
|
||||
|
||||
private Double lat;
|
||||
|
||||
private String target;
|
||||
|
||||
}
|
||||
@@ -106,4 +106,18 @@ public class CsEquipmentDeliveryAddParm implements Serializable {
|
||||
@ApiModelProperty(value="所属项目")
|
||||
private String associatedProject;
|
||||
|
||||
@ApiModelProperty(value="icd")
|
||||
private String icd;
|
||||
|
||||
@ApiModelProperty(value="是否支持升级(0:否 1:是)")
|
||||
private Integer upgrade;
|
||||
|
||||
@ApiModelProperty(value="治理方法")
|
||||
private String governMethod;
|
||||
|
||||
@ApiModelProperty(value="敏感用户id")
|
||||
private String monitorUser;
|
||||
|
||||
@ApiModelProperty(value="治理类型(稳态:harmonic 暂态:event)")
|
||||
private String governType;
|
||||
}
|
||||
@@ -110,4 +110,19 @@ public class CsEquipmentDeliveryAuditParm {
|
||||
|
||||
@ApiModelProperty(value="所属项目")
|
||||
private String associatedProject;
|
||||
|
||||
@ApiModelProperty(value="icd")
|
||||
private String icd;
|
||||
|
||||
@ApiModelProperty(value="是否支持升级(0:否 1:是)")
|
||||
private Integer upgrade;
|
||||
|
||||
@ApiModelProperty(value="治理方法")
|
||||
private String governMethod;
|
||||
|
||||
@ApiModelProperty(value="敏感用户id")
|
||||
private String monitorUser;
|
||||
|
||||
@ApiModelProperty(value="治理类型(稳态:harmonic 暂态:event)")
|
||||
private String governType;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.pojo.param;
|
||||
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -40,4 +41,9 @@ public class CsEquipmentDeliveryQueryParm extends BaseParam {
|
||||
@ApiModelProperty("物联通讯状态 0:未连接 1:已连接")
|
||||
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")
|
||||
private Double lat;
|
||||
|
||||
@TableField(value = "target")
|
||||
private String target;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.csdevice.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
@@ -43,6 +44,12 @@ public class CsDataArray extends BaseEntity {
|
||||
*/
|
||||
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.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/4/7 11:29【需求编号】
|
||||
@@ -62,7 +61,7 @@ public class CsEdDataPO extends BaseEntity {
|
||||
* 版本日期
|
||||
*/
|
||||
@TableField(value = "version_date")
|
||||
private Date versionDate;
|
||||
private LocalDateTime versionDate;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
@@ -95,5 +94,4 @@ public class CsEdDataPO extends BaseEntity {
|
||||
private String crc;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -148,4 +148,32 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
|
||||
@TableField(value = "associated_project")
|
||||
private String associatedProject;
|
||||
|
||||
/**
|
||||
* icd模型
|
||||
*/
|
||||
@TableField(value = "icd")
|
||||
private String icd;
|
||||
|
||||
/**
|
||||
* 是否支持升级(0:否 1:是)
|
||||
*/
|
||||
private Integer upgrade;
|
||||
|
||||
/**
|
||||
* 治理方法
|
||||
*/
|
||||
@TableField(value = "govern_method")
|
||||
private String governMethod;
|
||||
|
||||
/**
|
||||
* 敏感用户id
|
||||
*/
|
||||
@TableField(value = "monitor_user")
|
||||
private String monitorUser;
|
||||
|
||||
/**
|
||||
* 治理类型(稳态:harmonic 暂态:event)
|
||||
*/
|
||||
@TableField(value = "govern_type")
|
||||
private String governType;
|
||||
}
|
||||
@@ -127,14 +127,7 @@ public class CsLinePO extends BaseEntity {
|
||||
*/
|
||||
@TableField(value = "monitor_obj")
|
||||
private String monitorObj;
|
||||
/**
|
||||
* 是否治理(0:未治理 1:已治理)
|
||||
*/
|
||||
@TableField(value = "is_govern")
|
||||
private Integer govern;
|
||||
|
||||
@TableField(value = "monitor_user")
|
||||
private String monitorUser;
|
||||
|
||||
/**
|
||||
* 短路容量
|
||||
|
||||
@@ -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;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -43,5 +41,6 @@ public class AppLineTopologyDiagramVO {
|
||||
|
||||
private String linePostion;
|
||||
|
||||
|
||||
@ApiModelProperty(value="绑定的指标")
|
||||
private String target;
|
||||
}
|
||||
@@ -70,12 +70,11 @@ public class CsEdDataVO extends BaseEntity {
|
||||
@ApiModelProperty(value = "版本类型")
|
||||
private String versionType;
|
||||
|
||||
@ApiModelProperty(value = "crc信息")
|
||||
private String crcInfo;
|
||||
|
||||
@ApiModelProperty(value = ".bin文件")
|
||||
private String filePath;
|
||||
|
||||
@ApiModelProperty(value = "CRC校验")
|
||||
private String crc;
|
||||
|
||||
|
||||
}
|
||||
@@ -106,4 +106,13 @@ public class CsEquipmentDeliveryVO extends BaseEntity {
|
||||
@ApiModelProperty(value="所属项目名称")
|
||||
private String associatedProjectName;
|
||||
|
||||
@ApiModelProperty(value="治理方法")
|
||||
private String governMethod;
|
||||
|
||||
@ApiModelProperty(value="敏感用户id")
|
||||
private String monitorUser;
|
||||
|
||||
@ApiModelProperty(value="治理类型(稳态:harmonic 暂态:event)")
|
||||
private String governType;
|
||||
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@@ -31,6 +30,9 @@ public class DataGroupEventVO {
|
||||
@ApiModelProperty("装置ID")
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty("设备网络码")
|
||||
private String nDid;
|
||||
|
||||
@ApiModelProperty("装置名称")
|
||||
private String devName;
|
||||
|
||||
@@ -65,9 +67,24 @@ public class DataGroupEventVO {
|
||||
private Double amplitude;
|
||||
|
||||
@ApiModelProperty("严重度")
|
||||
private String severity;
|
||||
private Double severity;
|
||||
|
||||
@ApiModelProperty("波形路径")
|
||||
private String wavePath;
|
||||
|
||||
@ApiModelProperty("事件落点")
|
||||
private String landPoint;
|
||||
|
||||
@ApiModelProperty("暂降原因")
|
||||
private String advanceReason;
|
||||
|
||||
@ApiModelProperty("暂降类型")
|
||||
private String advanceType;
|
||||
|
||||
@ApiModelProperty("暂降源与监测位置关系 0-未知、1-上游、2-下游")
|
||||
private String sagSource;
|
||||
|
||||
@ApiModelProperty("监测点电压等级")
|
||||
private Double lineVoltage;
|
||||
|
||||
}
|
||||
|
||||
@@ -71,4 +71,7 @@ public class DevCountVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "反馈数")
|
||||
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;
|
||||
}
|
||||
@@ -62,5 +62,8 @@ public class DeviceManagerVO {
|
||||
|
||||
@ApiModelProperty(value = "数据类型 rt:实时数据 history:历史数据")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -8,17 +8,25 @@ import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class PqSensitiveUserLineVO {
|
||||
@ApiModelProperty("工程名称")
|
||||
private String engineeringName;
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
@ApiModelProperty("设备id")
|
||||
private String devId;
|
||||
@ApiModelProperty("设备名称")
|
||||
private String devName;
|
||||
@ApiModelProperty("治理对象")
|
||||
private String sensitiveUser;
|
||||
@ApiModelProperty("监测点ID")
|
||||
private String lineId;
|
||||
@ApiModelProperty("测点名称")
|
||||
private String lineName;
|
||||
@ApiModelProperty("是否治理")
|
||||
@ApiModelProperty("治理方案")
|
||||
private String govern;
|
||||
@ApiModelProperty("电压等级")
|
||||
private double volGrade;
|
||||
@ApiModelProperty("监测类型")
|
||||
@ApiModelProperty("监测位置")
|
||||
private String position;
|
||||
@ApiModelProperty("运行状态")
|
||||
private String runStatus;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -20,6 +21,9 @@ public class RecordAllDevTreeVo {
|
||||
@ApiModelProperty("设备名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("设备状态")
|
||||
private Integer runStatus;
|
||||
|
||||
@ApiModelProperty("线路")
|
||||
private List<RecordAllLineTreeVo> children;
|
||||
|
||||
|
||||
@@ -167,6 +167,11 @@
|
||||
<artifactId>message-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>event-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -19,7 +19,6 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -101,7 +100,6 @@ public class CsDataArrayController extends BaseController {
|
||||
@PostMapping("/findListByParam")
|
||||
@ApiOperation("根据条件查询详细数据")
|
||||
@ApiImplicitParam(name = "param", value = "参数集合", required = true)
|
||||
@ApiIgnore
|
||||
public HttpResult<List<CsDataArray>> findListByParam(@RequestBody DataArrayParam param){
|
||||
String methodDescribe = getMethodDescribe("findListByParam");
|
||||
List<CsDataArray> list = csDataArrayService.findListByParam(param);
|
||||
|
||||
@@ -66,7 +66,5 @@ public class CsSoftInfoController extends BaseController {
|
||||
csSoftInfoService.removeById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 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)
|
||||
@PostMapping("/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.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
@@ -45,9 +47,9 @@ public class DevModelController extends BaseController {
|
||||
@ApiOperation("新增设备模板")
|
||||
@ApiImplicitParam(name = "csDevModelAddParm", value = "新增设备模板参数", required = true)
|
||||
@Deprecated
|
||||
public HttpResult<CsDevModelPO> addDevModel(@RequestBody @Validated CsDevModelAddParm csDevModelAddParm){
|
||||
public HttpResult<CsDevModelPO> addDevModel(@RequestBody @Validated CsDevModelAddParm csDevModelAddParm) {
|
||||
String methodDescribe = getMethodDescribe("addDevModel");
|
||||
CsDevModelPO flag = csDevModelService.addDevModel (csDevModelAddParm);
|
||||
CsDevModelPO flag = csDevModelService.addDevModel(csDevModelAddParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -56,7 +58,7 @@ public class DevModelController extends BaseController {
|
||||
@PostMapping("/AuditDevModel")
|
||||
@ApiOperation("更新/删除设备模板参数")
|
||||
@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");
|
||||
|
||||
Boolean flag = csDevModelService.AuditDevModel(csDevModelAuditParm);
|
||||
@@ -64,15 +66,14 @@ public class DevModelController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryDevModelPage")
|
||||
@ApiOperation("设备模板分页查询")
|
||||
@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");
|
||||
|
||||
IPage<CsDevModelPageVO> page = csDevModelService.queryPage (csDevModelQueryParm);
|
||||
IPage<CsDevModelPageVO> page = csDevModelService.queryPage(csDevModelQueryParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -80,10 +81,10 @@ public class DevModelController extends BaseController {
|
||||
@PostMapping("/queryDevModelOne")
|
||||
@ApiOperation("设备模板查询")
|
||||
@ApiImplicitParam(name = "csDevModelQueryListParm", value = "设备模板信息", required = true)
|
||||
public HttpResult<CsDevModelPageVO> queryDevModelOne(@RequestBody CsDevModelQueryListParm csDevModelQueryListParm){
|
||||
public HttpResult<CsDevModelPageVO> queryDevModelOne(@RequestBody CsDevModelQueryListParm csDevModelQueryListParm) {
|
||||
String methodDescribe = getMethodDescribe("queryDevModelOne");
|
||||
|
||||
CsDevModelPageVO csDevModelPageVO = csDevModelService.queryDevModelOne(csDevModelQueryListParm);
|
||||
CsDevModelPageVO csDevModelPageVO = csDevModelService.queryDevModelOne(csDevModelQueryListParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csDevModelPageVO, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -91,13 +92,13 @@ public class DevModelController extends BaseController {
|
||||
@PostMapping("/findModel")
|
||||
@ApiOperation("根据条件查询模板")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "devType", value = "装置类型", required = true),
|
||||
@ApiImplicitParam(name = "version", value = "版本", required = true),
|
||||
@ApiImplicitParam(name = "time", value = "时间", required = true)
|
||||
@ApiImplicitParam(name = "devType", value = "装置类型", required = true),
|
||||
@ApiImplicitParam(name = "version", 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");
|
||||
CsDevModelPO csDevModelPo = csDevModelService.findModel(devType,version,time);
|
||||
CsDevModelPO csDevModelPo = csDevModelService.findModel(devType, version, time);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csDevModelPo, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -105,10 +106,9 @@ public class DevModelController extends BaseController {
|
||||
@PostMapping("/getModelById")
|
||||
@ApiOperation("根据模板Id获取模板数据")
|
||||
@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");
|
||||
CsDevModelPO po = csDevModelService.getModelById(id);
|
||||
CsDevModelPO po = csDevModelService.getModelById(id);
|
||||
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.param.*;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLogsPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import com.njcn.csdevice.pojo.vo.DevVersionVO;
|
||||
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||
import com.njcn.csdevice.service.CsDevModelRelationService;
|
||||
@@ -28,6 +30,7 @@ import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import com.njcn.web.advice.DeviceLog;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -46,6 +49,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
@@ -63,20 +67,20 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||
private final IMqttUserService mqttUserService;
|
||||
private final CsDevModelRelationService csDevModelRelationService;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/addEquipmentDelivery")
|
||||
@ApiOperation("新增出厂设备")
|
||||
@ApiImplicitParam(name = "csEquipmentDeliveryAddParm", value = "新增项目参数", required = true)
|
||||
@DeviceLog(operateType = DeviceOperate.ADD)
|
||||
public HttpResult<CsEquipmentDeliveryPO> addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm){
|
||||
public HttpResult<CsEquipmentDeliveryPO> addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||
String methodDescribe = getMethodDescribe("addEquipmentDelivery");
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.save(csEquipmentDeliveryAddParm);
|
||||
if (Objects.nonNull(po)){
|
||||
if (Objects.nonNull(po)) {
|
||||
//查询mqtt用户名和密码是否存在
|
||||
boolean result = mqttUserService.findMqttUser(csEquipmentDeliveryAddParm.getNdid());
|
||||
if (result){
|
||||
if (result) {
|
||||
//初始化装置mqtt连接信息(使用sha256加密)
|
||||
mqttUserService.insertMqttUser(csEquipmentDeliveryAddParm.getNdid());
|
||||
}
|
||||
@@ -88,7 +92,7 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@PostMapping("/AuditEquipmentDelivery")
|
||||
@ApiOperation("删除出厂设备")
|
||||
@DeviceLog(operateType = DeviceOperate.DELETE)
|
||||
public HttpResult<Boolean> AuditEquipmentDelivery(@RequestParam("id")String id ){
|
||||
public HttpResult<Boolean> AuditEquipmentDelivery(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("AuditEquipmentDelivery");
|
||||
Boolean flag = csEquipmentDeliveryService.AuditEquipmentDelivery(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
@@ -99,13 +103,13 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ApiOperation("修改出厂设备")
|
||||
@DeviceLog(operateType = DeviceOperate.UPDATE)
|
||||
@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");
|
||||
Boolean flag = csEquipmentDeliveryService.updateEquipmentDelivery(csEquipmentDeliveryAuditParm);
|
||||
if (flag){
|
||||
if (flag) {
|
||||
//查询mqtt用户名和密码是否存在
|
||||
boolean result = mqttUserService.findMqttUser(csEquipmentDeliveryAuditParm.getNdid());
|
||||
if (result){
|
||||
if (result) {
|
||||
//初始化装置mqtt连接信息(使用sha256加密)
|
||||
mqttUserService.insertMqttUser(csEquipmentDeliveryAuditParm.getNdid());
|
||||
}
|
||||
@@ -117,9 +121,9 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@PostMapping("/queryEquipmentByndid")
|
||||
@ApiOperation("通过ndid查询出厂设备")
|
||||
@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");
|
||||
CsEquipmentDeliveryVO csEquipmentDeliveryVO = csEquipmentDeliveryService.queryEquipmentByndid (ndid);
|
||||
CsEquipmentDeliveryVO csEquipmentDeliveryVO = csEquipmentDeliveryService.queryEquipmentByndid(ndid);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csEquipmentDeliveryVO, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -127,9 +131,9 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@PostMapping("/queryEquipmentByProject")
|
||||
@ApiOperation("通过项目查询出厂设备")
|
||||
@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");
|
||||
IPage<ProjectEquipmentVO> projectEquipmentVos = csEquipmentDeliveryService.queryEquipmentByProject(projectEquipmentQueryParm);
|
||||
IPage<ProjectEquipmentVO> projectEquipmentVos = csEquipmentDeliveryService.queryEquipmentByProject(projectEquipmentQueryParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, projectEquipmentVos, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -141,9 +145,9 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ApiImplicitParam(name = "status", value = "状态", required = true)
|
||||
})
|
||||
@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");
|
||||
csEquipmentDeliveryService.updateStatusBynDid(nDid,status);
|
||||
csEquipmentDeliveryService.updateStatusBynDid(nDid, status);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -151,7 +155,7 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@PostMapping("/queryEquipmentById")
|
||||
@ApiOperation("设备查询通过id获取")
|
||||
@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");
|
||||
if (CollectionUtil.isEmpty(ids)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
@@ -171,7 +175,7 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("出厂设备列表")
|
||||
@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");
|
||||
Page<CsEquipmentDeliveryVO> page = csEquipmentDeliveryService.list(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
@@ -185,9 +189,9 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ApiImplicitParam(name = "type", value = "类型", required = true),
|
||||
@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");
|
||||
DeviceManagerVO vo = csEquipmentDeliveryService.getDeviceData(deviceId,type,lineId);
|
||||
DeviceManagerVO vo = csEquipmentDeliveryService.getDeviceData(deviceId, type, lineId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -200,9 +204,9 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ApiImplicitParam(name = "module", value = "模块个数", required = true)
|
||||
})
|
||||
@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");
|
||||
csEquipmentDeliveryService.updateSoftInfoBynDid(nDid,id,module);
|
||||
csEquipmentDeliveryService.updateSoftInfoBynDid(nDid, id, module);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -210,9 +214,9 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@PostMapping("/findDevByNDid")
|
||||
@ApiOperation("通过nDid查询设备信息")
|
||||
@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");
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.findDevByNDid(nDid);
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.findDevByNDid(nDid);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -225,13 +229,13 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
exportParams.setStyle(ExcelStyleUtil.class);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, DeviceExcelTemplete.class, new ArrayList<DeviceExcelTemplete>());
|
||||
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());
|
||||
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());
|
||||
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";
|
||||
ExportParams exportExcel = new ExportParams("设备模板", "设备模板");
|
||||
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) {
|
||||
String methodDescribe = getMethodDescribe("importEquipment");
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.importEquipment(file, response);
|
||||
if (!CollectionUtils.isEmpty(csEquipmentDeliveryPOS)){
|
||||
csEquipmentDeliveryPOS.forEach(temp->{
|
||||
if (!CollectionUtils.isEmpty(csEquipmentDeliveryPOS)) {
|
||||
csEquipmentDeliveryPOS.forEach(temp -> {
|
||||
//查询mqtt用户名和密码是否存在
|
||||
boolean result = mqttUserService.findMqttUser(temp.getNdid());
|
||||
if (result){
|
||||
if (result) {
|
||||
//初始化装置mqtt连接信息(使用sha256加密)
|
||||
mqttUserService.insertMqttUser(temp.getNdid());
|
||||
}
|
||||
@@ -260,18 +264,18 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ResponseBody
|
||||
@ApiOperation("联调完成")
|
||||
@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");
|
||||
csEquipmentDeliveryService.testCompletion(deviceId,type, remark);
|
||||
csEquipmentDeliveryService.testCompletion(deviceId, type, remark);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@ApiOperation("取消联调")
|
||||
@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");
|
||||
csEquipmentDeliveryService.deleteTest(deviceId,type, remark);
|
||||
csEquipmentDeliveryService.deleteTest(deviceId, type, remark);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -283,9 +287,9 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ApiImplicitParam(name = "id", value = "软件信息id", required = true)
|
||||
})
|
||||
@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");
|
||||
csEquipmentDeliveryService.updateSoftInfo(nDid,id);
|
||||
csEquipmentDeliveryService.updateSoftInfo(nDid, id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -297,9 +301,9 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ApiImplicitParam(name = "number", value = "模块个数", required = true)
|
||||
})
|
||||
@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");
|
||||
csEquipmentDeliveryService.updateModuleNumber(nDid,number);
|
||||
csEquipmentDeliveryService.updateModuleNumber(nDid, number);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -307,7 +311,7 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@PostMapping("/rebootDevice")
|
||||
@ApiOperation("重启设备")
|
||||
@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");
|
||||
boolean result = csEquipmentDeliveryService.rebootDevice(nDid);
|
||||
if (result) {
|
||||
@@ -320,7 +324,7 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getAll")
|
||||
@ApiOperation("获取所有装置")
|
||||
public HttpResult<List<CsEquipmentDeliveryPO>> getAll(){
|
||||
public HttpResult<List<CsEquipmentDeliveryPO>> getAll() {
|
||||
String methodDescribe = getMethodDescribe("getAll");
|
||||
List<CsEquipmentDeliveryPO> result = csEquipmentDeliveryService.getAll();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
@@ -329,7 +333,7 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/judgeDevModel")
|
||||
@ApiOperation("判断设备型号")
|
||||
public HttpResult<Boolean> judgeDevModel(@RequestParam("nDid") String nDid){
|
||||
public HttpResult<Boolean> judgeDevModel(@RequestParam("nDid") String nDid) {
|
||||
String methodDescribe = getMethodDescribe("judgeDevModel");
|
||||
boolean result = csEquipmentDeliveryService.judgeDevModel(nDid);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
@@ -338,7 +342,7 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getDevByLineId")
|
||||
@ApiOperation("根据监测点id查询装置信息")
|
||||
public HttpResult<CsEquipmentDeliveryPO> getDevByLineId(@RequestParam("lineId") String lineId){
|
||||
public HttpResult<CsEquipmentDeliveryPO> getDevByLineId(@RequestParam("lineId") String lineId) {
|
||||
String methodDescribe = getMethodDescribe("getDevByLineId");
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.getDevByLineId(lineId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||
@@ -349,7 +353,7 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ApiOperation("新增云前置设备")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
@DeviceLog(operateType = DeviceOperate.ADD)
|
||||
public HttpResult<CsEquipmentDeliveryPO> addCldDev(@RequestBody @Validated CsEquipmentDeliveryAddParm param){
|
||||
public HttpResult<CsEquipmentDeliveryPO> addCldDev(@RequestBody @Validated CsEquipmentDeliveryAddParm param) {
|
||||
String methodDescribe = getMethodDescribe("addCldDev");
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.saveCld(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||
@@ -360,7 +364,7 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ApiOperation("删除云前置设备")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||
@DeviceLog(operateType = DeviceOperate.DELETE)
|
||||
public HttpResult<Boolean> delCldDev(@RequestParam("id") String id){
|
||||
public HttpResult<Boolean> delCldDev(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("delCldDev");
|
||||
boolean result = csEquipmentDeliveryService.delCldDev(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
@@ -371,7 +375,7 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ApiOperation("修改云前置设备")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
@DeviceLog(operateType = DeviceOperate.UPDATE)
|
||||
public HttpResult<Boolean> updateCldDev(@RequestBody @Validated CsEquipmentDeliveryAuditParm param){
|
||||
public HttpResult<Boolean> updateCldDev(@RequestBody @Validated CsEquipmentDeliveryAuditParm param) {
|
||||
String methodDescribe = getMethodDescribe("updateCldDev");
|
||||
boolean result = csEquipmentDeliveryService.updateCldDev(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
@@ -385,9 +389,9 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ApiImplicitParam(name = "processNo", value = "进程号", required = true)
|
||||
})
|
||||
@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");
|
||||
csEquipmentDeliveryService.updateCldDevStatus(nodeId,processNo);
|
||||
csEquipmentDeliveryService.updateCldDevStatus(nodeId, processNo);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -395,14 +399,14 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@PostMapping("/flipCldDevStatus")
|
||||
@ApiOperation("云前置设备状态翻转")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "date", value = "时间", required = true),
|
||||
@ApiImplicitParam(name = "devId", value = "设备id", required = true),
|
||||
@ApiImplicitParam(name = "status", value = "状态", required = true)
|
||||
@ApiImplicitParam(name = "date", value = "时间", required = true),
|
||||
@ApiImplicitParam(name = "devId", value = "设备id", required = true),
|
||||
@ApiImplicitParam(name = "status", value = "状态", required = true)
|
||||
})
|
||||
@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");
|
||||
csEquipmentDeliveryService.flipCldDevStatus(date,devId,status);
|
||||
csEquipmentDeliveryService.flipCldDevStatus(date, devId, status);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -410,10 +414,22 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@PostMapping("/getRunPortableDev")
|
||||
@ApiOperation("获取用户未绑定的在运的便携式设备")
|
||||
@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");
|
||||
List<CsEquipmentDeliveryPO> result = csEquipmentDeliveryService.getRunPortableDev(userId);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,39 +1,23 @@
|
||||
package com.njcn.csdevice.controller.ledger;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.mapper.PqsDeviceUnitMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.service.CsCommTerminalService;
|
||||
import com.njcn.csdevice.service.CsDeviceUserPOService;
|
||||
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.constant.UserType;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -108,11 +92,17 @@ public class CsCommTerminalController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据监测点id集合,获取所有台账信息
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLedgerByLineId")
|
||||
@ApiOperation("根据监测点id集合获取所有台账信息")
|
||||
@ApiImplicitParam(name = "list", value = "实体", required = true)
|
||||
public HttpResult<List<DevDetailDTO>> getLedgerByLineId(@RequestBody List<String> list) {
|
||||
String methodDescribe = getMethodDescribe("getLedgerByLineId");
|
||||
List<DevDetailDTO> result = commTerminalService.getLedgerByLineId(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class CsLedgerController extends BaseController {
|
||||
@PostMapping("/AppLineTree")
|
||||
@ApiOperation("app端监测点树")
|
||||
public HttpResult<List<CsLedgerVO>> appLineTree(){
|
||||
String methodDescribe = getMethodDescribe("AppLineTree");
|
||||
String methodDescribe = getMethodDescribe("appLineTree");
|
||||
List<CsLedgerVO> list = csLedgerService.appLineTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
@@ -90,14 +90,14 @@ public class CsLedgerController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/objTree")
|
||||
@ApiOperation("三层对象用户树")
|
||||
public HttpResult<List<CsLedgerVO>> objTree(){
|
||||
String methodDescribe = getMethodDescribe("getProjectTree");
|
||||
List<CsLedgerVO> list = csLedgerService.objTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
// @PostMapping("/objTree")
|
||||
// @ApiOperation("三层对象用户树")
|
||||
// public HttpResult<List<CsLedgerVO>> objTree(){
|
||||
// String methodDescribe = getMethodDescribe("getProjectTree");
|
||||
// List<CsLedgerVO> list = csLedgerService.objTree();
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
// }
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/add")
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||
@@ -295,11 +296,11 @@ public class CslineController extends BaseController {
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLineBySensitiveUser")
|
||||
@ApiOperation("根据敏感用户查询监测点")
|
||||
public HttpResult<List<CsLinePO>> getLineBySensitiveUser(@RequestBody List<String> list) {
|
||||
String methodDescribe = getMethodDescribe("getLineBySensitiveUser");
|
||||
List<CsLinePO> result = csLinePOService.getLineBySensitiveUser(list);
|
||||
@PostMapping("/getDevBySensitiveUser")
|
||||
@ApiOperation("根据敏感用户查询装置")
|
||||
public HttpResult<List<CsEquipmentDeliveryPO>> getDevBySensitiveUser(@RequestBody List<String> list) {
|
||||
String methodDescribe = getMethodDescribe("getDevBySensitiveUser");
|
||||
List<CsEquipmentDeliveryPO> result = csLinePOService.getDevBySensitiveUser(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,12 +7,8 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.param.DeviceMessageParam;
|
||||
import com.njcn.csdevice.pojo.param.DataArrayParam;
|
||||
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.param.LineInfoParam;
|
||||
import com.njcn.csdevice.service.DeviceMessageService;
|
||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -22,7 +18,6 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -47,8 +42,8 @@ public class DeviceMessageController extends BaseController {
|
||||
@PostMapping("/getEventUserByDeviceId")
|
||||
@ApiOperation("根据设备获取需要推送的用户id")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "devId", value = "设备id", required = true, paramType = "query"),
|
||||
@ApiImplicitParam(name = "isAdmin", value = "是否需要推送给管理员", required = true, paramType = "query")
|
||||
@ApiImplicitParam(name = "devId", value = "设备id", 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){
|
||||
String methodDescribe = getMethodDescribe("getEventUserByDeviceId");
|
||||
@@ -69,10 +64,10 @@ public class DeviceMessageController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLineInfo")
|
||||
@ApiOperation("获取监测点信息")
|
||||
@ApiImplicitParam(name = "id", value = "参数", required = true, paramType = "query")
|
||||
public HttpResult<String> getLineInfo(@RequestParam("id") String id){
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<String> getLineInfo(@RequestBody LineInfoParam param){
|
||||
String methodDescribe = getMethodDescribe("getLineInfo");
|
||||
deviceMessageService.getLineInfo(id);
|
||||
deviceMessageService.getLineInfo(param.getNDid(),param.getList());
|
||||
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.CsEdDataAuditParm;
|
||||
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.service.CsEdDataService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -79,4 +80,14 @@ public class CsEdDataController extends BaseController {
|
||||
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}
|
||||
and t1.did = #{param.did}
|
||||
and t3.cl_dev = #{param.cldId}
|
||||
and (t3.data_type = 'Stat' or t3.data_type is NULL)
|
||||
and t3.idx = #{param.idx}
|
||||
and t4.stat_method = #{param.statMethod}
|
||||
order by t4.sort
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
where
|
||||
pid = #{modelId}
|
||||
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
|
||||
</select>
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
t1.*
|
||||
from
|
||||
cs_equipment_delivery t0
|
||||
left join cs_line t1 on
|
||||
right join cs_line t1 on
|
||||
t0.id = t1.device_id
|
||||
where
|
||||
t0.ndid = #{id}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<select id="getRecordAll" resultType="com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo">
|
||||
<if test="wlRecordPageParam.isTrueFlag == 0">
|
||||
select a.dev_id as id,b.name as name from wl_record a
|
||||
select a.dev_id as id,b.name as name,b.run_status as runStatus from wl_record a
|
||||
left join cs_equipment_delivery b on a.dev_id = b.id
|
||||
where a.type=1 and a.state =1 and a.end_time is not null
|
||||
and
|
||||
@@ -31,7 +31,7 @@
|
||||
group by a.dev_id,b.name having a.dev_id is not null and b.name is not null
|
||||
</if>
|
||||
<if test="wlRecordPageParam.isTrueFlag == 1">
|
||||
select a.dev_id as id,b.name as name from wl_record a
|
||||
select a.dev_id as id,b.name as name,b.run_status as runStatus from wl_record a
|
||||
left join cs_equipment_delivery b on a.dev_id = b.id
|
||||
where a.type=1 and a.state =1 and a.end_time is not null
|
||||
and exists
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
|
||||
import java.util.List;
|
||||
@@ -14,4 +15,6 @@ public interface CsCommTerminalService {
|
||||
PqsDeviceUnit lineUnitDetail(String lineId);
|
||||
|
||||
List<String> commGetDevIds(String userId);
|
||||
|
||||
List<DevDetailDTO> getLedgerByLineId(List<String> id);
|
||||
}
|
||||
|
||||
@@ -55,4 +55,10 @@ public interface CsDeviceUserPOService extends IService<CsDeviceUserPO>{
|
||||
void channelDevByUserId(UserDevParam param);
|
||||
|
||||
List<CsDeviceUserPO> getList(UserDevParam param);
|
||||
|
||||
/**
|
||||
* 新增用户设备关系表数据 新增主用户信息 && 新增已关联工程的用户的设备关系
|
||||
* @return
|
||||
*/
|
||||
Boolean addRelation(UserDevParam param);
|
||||
}
|
||||
|
||||
@@ -48,5 +48,13 @@ public interface CsEdDataService extends IService<CsEdDataPO> {
|
||||
* @author: xuyang
|
||||
*/
|
||||
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.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAddParm;
|
||||
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.param.*;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLogsPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import com.njcn.csdevice.pojo.vo.DevVersionVO;
|
||||
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -195,4 +196,5 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
||||
|
||||
List<CsEquipmentDeliveryPO> getRunPortableDev(String userId);
|
||||
|
||||
IPage<DevVersionVO> versionPage(CsEquipmentDeliveryQueryParm baseParam);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||
@@ -86,7 +87,7 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
||||
|
||||
List<CsLinePO> getSimpleLine();
|
||||
|
||||
List<CsLinePO> getLineBySensitiveUser(List<String> list);
|
||||
List<CsEquipmentDeliveryPO> getDevBySensitiveUser(List<String> list);
|
||||
|
||||
Page<PqSensitiveUserLineVO> getSensitiveUserLineList(BaseParam param);
|
||||
boolean uploadReport(MultipartFile file, String lineId);
|
||||
|
||||
@@ -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;
|
||||
|
||||
import com.njcn.csdevice.param.DeviceMessageParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
|
||||
import java.util.List;
|
||||
@@ -14,6 +15,6 @@ public interface DeviceMessageService {
|
||||
|
||||
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.pojo.dto.PqsCommunicateDto;
|
||||
import com.njcn.influx.pojo.po.PqsCommunicate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -20,6 +21,13 @@ public interface ICsCommunicateService {
|
||||
*/
|
||||
List<PqsCommunicateDto> getRawDataLatest(LineCountEvaluateParam lineParam);
|
||||
|
||||
/**
|
||||
* 取出第一条装置数据
|
||||
* @param lineParam
|
||||
* @return
|
||||
*/
|
||||
List<PqsCommunicateDto> getRawDataOne(LineCountEvaluateParam lineParam);
|
||||
|
||||
/**
|
||||
* 获取时间范围数据
|
||||
* @param lineParam
|
||||
@@ -27,6 +35,8 @@ public interface ICsCommunicateService {
|
||||
*/
|
||||
List<PqsCommunicateDto> getRawData(LineCountEvaluateParam lineParam);
|
||||
|
||||
List<PqsCommunicateDto> getRawData2(LineCountEvaluateParam lineParam);
|
||||
|
||||
/**
|
||||
*是否有当天最后一条数据
|
||||
* @param lineParam
|
||||
|
||||
@@ -80,7 +80,7 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
||||
List<CsLedgerVO> getztProjectTree();
|
||||
|
||||
|
||||
List<CsLedgerVO> objTree();
|
||||
// List<CsLedgerVO> objTree();
|
||||
|
||||
/**
|
||||
* 根据设备集合获取项目和工程
|
||||
|
||||
@@ -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> {
|
||||
|
||||
/**
|
||||
* 1.查询该设备当前计算周期是否存在上下线记录
|
||||
* 2.
|
||||
* a.存在记录,如果只有1条数据,则根据这一条记录的状态计算在线时长;如果是多条数据,则根据上下线时间计算在线时长;
|
||||
* b.不存在记录,则需要借助历史记录判断:
|
||||
* 1) 先查询设备第一条记录时间
|
||||
* - 如果统计日期 < 第一条记录时间 → 设备未上线 → 离线
|
||||
* 2) 再查询最新记录时间和状态
|
||||
* - 如果统计日期 > 最新记录时间 → 延续最新状态
|
||||
* * 最新是在线 → 全天在线
|
||||
* * 最新是离线 → 全天离线
|
||||
* @param param
|
||||
*/
|
||||
void addData(StatisticsDataParam param);
|
||||
|
||||
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.njcn.common.pojo.exception.BusinessException;
|
||||
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.LinePostionParam;
|
||||
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.vo.AppLineTopologyDiagramVO;
|
||||
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.AppTopologyDiagramService;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
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 org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -41,6 +43,9 @@ public class AppLineTopologyDiagramServiceImpl extends ServiceImpl<AppLineTopolo
|
||||
private final CsLinePOService csLinePOService;
|
||||
private final AppTopologyDiagramService appTopologyDiagramService;
|
||||
private final ICsLedgerService iCsLedgerService;
|
||||
private final RedisUtil redisUtil;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
|
||||
@Override
|
||||
public AppTopologyDiagramVO query(String devId) {
|
||||
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) {
|
||||
List<AppLineTopologyDiagramVO> result = new ArrayList<>();
|
||||
if (lineIds != null && lineIds.size() > 0) {
|
||||
if (lineIds != null && !lineIds.isEmpty()) {
|
||||
result = this.getBaseMapper().queryByLineIds( lineIds);
|
||||
}
|
||||
return result;
|
||||
@@ -83,15 +88,22 @@ public class AppLineTopologyDiagramServiceImpl extends ServiceImpl<AppLineTopolo
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void auditList(LinePostionParam linePostionParam) {
|
||||
|
||||
|
||||
linePostionParam.getPointList().forEach(temp->{
|
||||
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()).
|
||||
eq(AppLineTopologyDiagramPO::getLineId,temp.getLineId()).set(AppLineTopologyDiagramPO::getLat,temp.getLat()).
|
||||
set(AppLineTopologyDiagramPO::getLng,temp.getLng()).set(AppLineTopologyDiagramPO::getId,linePostionParam.getId()).update();
|
||||
|
||||
iCsLedgerService.lambdaUpdate().eq(CsLedger::getId,temp.getLineId()).set(CsLedger::getName,temp.getName()).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();
|
||||
});
|
||||
//修改指标后,删除缓存数据
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.njcn.csdevice.mapper.PqsDeviceUnitMapper;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.CsMarketDataVO;
|
||||
import com.njcn.csdevice.pojo.vo.CsTouristDataParmVO;
|
||||
@@ -21,9 +22,7 @@ import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -70,12 +69,9 @@ public class CsCommTerminalServiceImpl implements CsCommTerminalService {
|
||||
if (CollUtil.isEmpty(devIds)) {
|
||||
return result;
|
||||
}
|
||||
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(CsLinePO::getLineId, CsLinePO::getMonitorUser).in(CsLinePO::getDeviceId, devIds)
|
||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||
List<CsLinePO> poList =csLinePOMapper.selectList(lambdaQueryWrapper);
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
result = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryPO> po = csEquipmentDeliveryService.listByIds(devIds);
|
||||
if (CollUtil.isEmpty(po)) {
|
||||
result = po.stream().map(CsEquipmentDeliveryPO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -126,4 +122,91 @@ public class CsCommTerminalServiceImpl implements CsCommTerminalService {
|
||||
}
|
||||
return devIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevDetailDTO> getLedgerByLineId(List<String> id) {
|
||||
List<DevDetailDTO> result = new ArrayList<>();
|
||||
List<CsLedger> lineLedgers = csLedgerService.listByIds(id);
|
||||
Set<String> equipmentIds = new HashSet<>();
|
||||
Set<String> projectIds = new HashSet<>();
|
||||
Set<String> engineeringIds = new HashSet<>();
|
||||
|
||||
if (CollUtil.isEmpty(lineLedgers)) {
|
||||
return result;
|
||||
}
|
||||
for (CsLedger item : lineLedgers) {
|
||||
String pids = item.getPids();
|
||||
if (pids == null) {
|
||||
continue;
|
||||
}
|
||||
String[] pidArr = pids.split(",");
|
||||
if (pidArr.length < 4) {
|
||||
continue;
|
||||
}
|
||||
engineeringIds.add(pidArr[1]);
|
||||
projectIds.add(pidArr[2]);
|
||||
equipmentIds.add(pidArr[3]);
|
||||
}
|
||||
|
||||
Map<String, CsLinePO> csLinePoMap = csLinePOMapper.selectBatchIds(id)
|
||||
.stream().collect(Collectors.toMap(CsLinePO::getLineId, item -> item));
|
||||
Map<String, CsLedger> equipmentLedgerMap = csLedgerService.listByIds(equipmentIds)
|
||||
.stream().collect(Collectors.toMap(CsLedger::getId, item -> item));
|
||||
Map<String, CsEquipmentDeliveryPO> equipmentDeliveryMap = csEquipmentDeliveryService.listByIds(equipmentIds)
|
||||
.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, item -> item));
|
||||
Map<String, CsLedger> projectLedgerMap = csLedgerService.listByIds(projectIds)
|
||||
.stream().collect(Collectors.toMap(CsLedger::getId, item -> item));
|
||||
Map<String, CsLedger> engineeringLedgerMap = csLedgerService.listByIds(engineeringIds)
|
||||
.stream().collect(Collectors.toMap(CsLedger::getId, item -> item));
|
||||
|
||||
for (CsLedger item : lineLedgers) {
|
||||
String pids = item.getPids();
|
||||
if (pids == null) {
|
||||
continue;
|
||||
}
|
||||
String[] pidArr = pids.split(",");
|
||||
if (pidArr.length < 4) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String engineeringId = pidArr[1];
|
||||
String projectId = pidArr[2];
|
||||
String equipmentId = pidArr[3];
|
||||
|
||||
CsLedger engineeringLedger = engineeringLedgerMap.get(engineeringId);
|
||||
CsLedger projectLedger = projectLedgerMap.get(projectId);
|
||||
CsLedger equipmentLedger = equipmentLedgerMap.get(equipmentId);
|
||||
if (engineeringLedger == null || projectLedger == null || equipmentLedger == null) {
|
||||
continue;
|
||||
}
|
||||
DevDetailDTO dto = new DevDetailDTO();
|
||||
dto.setEngineeringid(engineeringId);
|
||||
dto.setEngineeringName(engineeringLedger.getName());
|
||||
dto.setProjectId(projectId);
|
||||
dto.setProjectName(projectLedger.getName());
|
||||
dto.setEquipmentId(equipmentId);
|
||||
dto.setEquipmentName(equipmentLedger.getName());
|
||||
dto.setLineId(item.getId());
|
||||
dto.setLineName(item.getName());
|
||||
|
||||
if (Objects.isNull(csLinePoMap.get(item.getId()).getRunStatus())) {
|
||||
CsEquipmentDeliveryPO delivery = equipmentDeliveryMap.get(equipmentId);
|
||||
if (delivery != null) {
|
||||
Integer runStatus = delivery.getRunStatus();
|
||||
if (runStatus == 1) {
|
||||
dto.setRunStatus(2);
|
||||
} else if (runStatus == 2) {
|
||||
dto.setRunStatus(0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dto.setRunStatus(csLinePoMap.get(item.getId()).getRunStatus());
|
||||
}
|
||||
dto.setObjType(csLinePoMap.get(item.getId()).getMonitorObj());
|
||||
dto.setGovernType(equipmentDeliveryMap.get(equipmentId).getGovernType());
|
||||
result.add(dto);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,22 +1,26 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.CsDataArrayMapper;
|
||||
import com.njcn.csdevice.pojo.dto.DataArrayDTO;
|
||||
import com.njcn.csdevice.pojo.param.DataArrayParam;
|
||||
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.DeviceManagerDetailVO;
|
||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||
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 lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@@ -33,6 +37,7 @@ import java.util.stream.Collectors;
|
||||
public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDataArray> implements ICsDataArrayService {
|
||||
|
||||
private final EpdFeignClient epdFeignClient;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
@Override
|
||||
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()) {
|
||||
DeviceManagerDetailVO vo = new DeviceManagerDetailVO();
|
||||
EleEpdPqd eleEpdPqd = entry.getValue().get(0);
|
||||
if (Objects.equals(eleEpdPqd.getPhase(),"M")){
|
||||
if (Objects.equals(eleEpdPqd.getPhase(),"T")){
|
||||
vo.setPhasic("/");
|
||||
} else {
|
||||
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();
|
||||
vo3.setId(item.getDataSetId() + item.getDataArrayName()+item2);
|
||||
vo3.setName(item2);
|
||||
if (Objects.equals(item2,"M")){
|
||||
if (Objects.equals(item2,"T")){
|
||||
vo3.setShowName("无相别");
|
||||
} else {
|
||||
vo3.setShowName(item2);
|
||||
@@ -173,7 +178,34 @@ public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDat
|
||||
|
||||
@Override
|
||||
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
|
||||
|
||||
@@ -38,7 +38,7 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
|
||||
.eq(CsDataSet::getPid,modelId)
|
||||
.in(CsDataSet::getType, Arrays.asList(0,2))
|
||||
.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)
|
||||
.list();
|
||||
}
|
||||
|
||||
@@ -234,6 +234,7 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
}
|
||||
|
||||
//note 当前工程数据
|
||||
vo.setLineCount(0);
|
||||
//当前工程id
|
||||
vo.setCurrentId(id);
|
||||
//设备集合
|
||||
@@ -286,6 +287,7 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
}
|
||||
//获取未读事件数量
|
||||
if (CollectionUtil.isNotEmpty(currentLineIds)) {
|
||||
vo.setLineCount(currentLineIds.size());
|
||||
CsEventUserQueryParam param1 = new CsEventUserQueryParam();
|
||||
param1.setUserId(RequestUtil.getUserIndex());
|
||||
param1.setStartTime(PublicDataUtils.calculateMonthStart(time));
|
||||
@@ -545,4 +547,59 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
queryWrapper.eq(CsDeviceUserPO::getStatus, "1");
|
||||
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;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -40,33 +41,35 @@ public class CsEdDataServiceImpl extends ServiceImpl<CsEdDataMapper, CsEdDataPO>
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean addEdData(CsEdDataAddParm csEdDataAddParm) {
|
||||
CsEdDataPO csEdDataPO = new CsEdDataPO ();
|
||||
BeanUtils.copyProperties (csEdDataAddParm, csEdDataPO);
|
||||
String filePath = fileStorageUtil.uploadMultipart (csEdDataAddParm.getFile (), OssPath.EDDATA);
|
||||
csEdDataPO.setFilePath (filePath);
|
||||
csEdDataPO.setStatus ("1");
|
||||
boolean save = this.save (csEdDataPO);
|
||||
CsEdDataPO csEdDataPO = new CsEdDataPO();
|
||||
BeanUtils.copyProperties(csEdDataAddParm, csEdDataPO);
|
||||
String remoteDir = StrUtil.SLASH + OssPath.EDDATA + csEdDataAddParm.getDevTypeName() + StrUtil.SLASH + csEdDataAddParm.getVersionNo() + StrUtil.SLASH;
|
||||
String filePath = fileStorageUtil.uploadMultipart(csEdDataAddParm.getFile(), remoteDir, true);
|
||||
csEdDataPO.setCrc(csEdDataAddParm.getCrcInfo());
|
||||
csEdDataPO.setFilePath(filePath);
|
||||
csEdDataPO.setStatus("1");
|
||||
boolean save = this.save(csEdDataPO);
|
||||
return save;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean auditEdData(CsEdDataAuditParm csEdDataAuditParm) {
|
||||
CsEdDataPO csEdDataPO = new CsEdDataPO ();
|
||||
BeanUtils.copyProperties (csEdDataAuditParm, csEdDataPO);
|
||||
if(!Objects.isNull (csEdDataAuditParm.getFile ())){
|
||||
String filePath = fileStorageUtil.uploadMultipart (csEdDataAuditParm.getFile (), OssPath.EDDATA);
|
||||
csEdDataPO.setFilePath (filePath);
|
||||
CsEdDataPO csEdDataPO = new CsEdDataPO();
|
||||
BeanUtils.copyProperties(csEdDataAuditParm, csEdDataPO);
|
||||
if (!Objects.isNull(csEdDataAuditParm.getFile())) {
|
||||
String filePath = fileStorageUtil.uploadMultipart(csEdDataAuditParm.getFile(), StrUtil.SLASH + OssPath.EDDATA + csEdDataAuditParm.getDevTypeName() + StrUtil.SLASH + csEdDataAuditParm.getVersionNo() + StrUtil.SLASH, true);
|
||||
csEdDataPO.setFilePath(filePath);
|
||||
}
|
||||
boolean b = this.updateById (csEdDataPO);
|
||||
boolean b = this.updateById(csEdDataPO);
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -74,15 +77,21 @@ public class CsEdDataServiceImpl extends ServiceImpl<CsEdDataMapper, CsEdDataPO>
|
||||
public CsEdDataVO findByDevTypeId(String devType) {
|
||||
CsEdDataPO csEdDataPo = new CsEdDataPO();
|
||||
LambdaQueryWrapper<CsEdDataPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEdDataPO::getDevType,devType);
|
||||
lambdaQueryWrapper.eq(CsEdDataPO::getStatus,1);
|
||||
lambdaQueryWrapper.eq(CsEdDataPO::getDevType, devType);
|
||||
lambdaQueryWrapper.eq(CsEdDataPO::getStatus, 1);
|
||||
List<CsEdDataPO> list = this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
csEdDataPo = list.get(0);
|
||||
}
|
||||
CsEdDataVO csEdDataVo = new CsEdDataVO();
|
||||
BeanUtils.copyProperties(csEdDataPo,csEdDataVo);
|
||||
BeanUtils.copyProperties(csEdDataPo, 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,6 +138,7 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
||||
if(StringUtils.isNotBlank(csEngineeringAuditParm.getName())){
|
||||
csLedger1.setName(csEngineeringAuditParm.getName());
|
||||
}
|
||||
csLedger1.setSort(csEngineeringAuditParm.getSort());
|
||||
csLedgerMapper.updateById(csLedger1);
|
||||
List<CsEngineeringPO> list = this.lambdaQuery().eq(CsEngineeringPO::getName, csEngineeringAuditParm.getName()).eq(CsEngineeringPO::getStatus, "1").list();
|
||||
if(list.size()>1){
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,12 +25,14 @@ import com.njcn.csdevice.mapper.CsDataSetMapper;
|
||||
import com.njcn.csdevice.mapper.CsGroArrMapper;
|
||||
import com.njcn.csdevice.mapper.CsGroupMapper;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.param.EnergyBaseParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsGroupVO;
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
|
||||
import com.njcn.csdevice.pojo.vo.EnergyTemplateVO;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||
import com.njcn.csdevice.service.ICsGroupService;
|
||||
import com.njcn.csdevice.service.ICsLedgerService;
|
||||
@@ -65,11 +67,8 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Function;
|
||||
@@ -112,6 +111,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
|
||||
private final String GRID_SIDE_DICT_CODE = "Grid_Side";
|
||||
private final String LOAD_SIDE_DICT_CODE = "Load_Side";
|
||||
private final CsLinePOService csLinePOService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -316,24 +316,28 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||
}
|
||||
Double ct = finalCsLinePOList.get(0).getCtRatio();
|
||||
Double pt = finalCsLinePOList.get(0).getPtRatio();
|
||||
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(param.getStatisticalId()).getData();
|
||||
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()));
|
||||
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.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.setDataType(commonStatisticalQueryParam.getValueType());
|
||||
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType().toUpperCase());
|
||||
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
||||
return commonQueryParam;
|
||||
@@ -343,7 +347,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
String unit;
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
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();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
@@ -451,21 +455,6 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
vo.setAnotherName(epdPqd.getShowName());
|
||||
return vo;
|
||||
}).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);
|
||||
});
|
||||
}
|
||||
@@ -493,8 +482,13 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
commonQueryParam.setLineId(temp.getLineId());
|
||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||
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.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.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
||||
return commonQueryParam;
|
||||
@@ -503,7 +497,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
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();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
@@ -526,9 +520,24 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
csEventUserQueryPage.setLineId(commonStatisticalQueryParam.getLineId());
|
||||
csEventUserQueryPage.setStartTime(commonStatisticalQueryParam.getStartTime());
|
||||
csEventUserQueryPage.setEndTime(commonStatisticalQueryParam.getEndTime());
|
||||
csEventUserQueryPage.setEvtParamTmMin(commonStatisticalQueryParam.getEvtParamTmMin());
|
||||
csEventUserQueryPage.setEvtParamTmMax(commonStatisticalQueryParam.getEvtParamTmMax());
|
||||
csEventUserQueryPage.setFeatureAmplitudeMin(commonStatisticalQueryParam.getFeatureAmplitudeMin());
|
||||
csEventUserQueryPage.setFeatureAmplitudeMax(commonStatisticalQueryParam.getFeatureAmplitudeMax());
|
||||
csEventUserQueryPage.setSeverityMin(commonStatisticalQueryParam.getSeverityMin());
|
||||
csEventUserQueryPage.setSeverityMax(commonStatisticalQueryParam.getSeverityMax());
|
||||
csEventUserQueryPage.setTarget(commonStatisticalQueryParam.getTarget());
|
||||
csEventUserQueryPage.setFileFlag(commonStatisticalQueryParam.getFileFlag());
|
||||
Page<DataGroupEventVO> csEventVOPage = eventFeignClient.pageQueryByLineId(csEventUserQueryPage).getData();
|
||||
|
||||
//获取监测点电压等级
|
||||
List<CsLineDTO> list = csLinePOService.getAllLineDetail();
|
||||
Map<String, CsLineDTO> map = list.stream().collect(Collectors.toMap(CsLineDTO::getLineId, temp -> temp));
|
||||
csEventVOPage.getRecords().forEach(temp->{
|
||||
//监测点电压等级
|
||||
Double volGrade = map.get(temp.getLineId()).getVolGrade();
|
||||
if (!Objects.isNull(volGrade)) {
|
||||
temp.setLineVoltage(volGrade);
|
||||
}
|
||||
//事件描述、相别、暂降幅值,需要特殊处理赋值
|
||||
//事件描述
|
||||
CsLedger dataById = iCsLedgerService.findDataById(temp.getLineId());
|
||||
@@ -579,24 +588,165 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
}
|
||||
});
|
||||
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缺失)");
|
||||
}
|
||||
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)));
|
||||
}
|
||||
|
||||
}
|
||||
} 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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
private void formatQueryParamList(CommonStatisticalQueryParam commonStatisticalQueryParam){
|
||||
List<CommonStatisticalQueryParam> list = new ArrayList<>();
|
||||
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
|
||||
@@ -659,7 +809,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
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();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
@@ -736,7 +886,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(commonStatisticalQueryParam.getLineId())).getData();
|
||||
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
|
||||
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();
|
||||
List<ThdDataVO> result = new ArrayList();
|
||||
eleEpdPqds.forEach(epdPqd->{
|
||||
@@ -759,7 +909,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
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();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
@@ -838,23 +988,25 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())) {
|
||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||
}
|
||||
Double ct = finalCsLinePO.getCtRatio();
|
||||
Double pt = finalCsLinePO.getPtRatio();
|
||||
Double ct = finalCsLinePO.getCtRatio() / (Objects.isNull(finalCsLinePO.getCt2Ratio())?1.0:finalCsLinePO.getCt2Ratio());
|
||||
Double pt = finalCsLinePO.getPtRatio() / (Objects.isNull(finalCsLinePO.getPt2Ratio())?1.0:finalCsLinePO.getPt2Ratio());
|
||||
if(CollectionUtil.isNotEmpty(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) {
|
||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||
commonQueryParam.setLineId(finalCsLinePO.getLineId());
|
||||
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.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.setDataType(trendDataQueryParam.getValueType());
|
||||
|
||||
commonQueryParam.setDataType(trendDataQueryParam.getValueType().toUpperCase());
|
||||
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(finalCsLinePO.getLineId()));
|
||||
|
||||
List<StatisticalDataDTO> deviceRtData = commonService.getNewDeviceRtDataByTime(Collections.singletonList(commonQueryParam));
|
||||
@@ -862,7 +1014,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
String unit;
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
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();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
@@ -970,21 +1122,6 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
vo.setAnotherName(epdPqd.getShowName());
|
||||
return vo;
|
||||
}).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);
|
||||
}
|
||||
}
|
||||
@@ -1000,9 +1137,10 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||
}
|
||||
Double ct = finalCsLinePO.getCtRatio();
|
||||
Double pt = finalCsLinePO.getPtRatio();
|
||||
// String position = finalCsLinePO.getPosition();
|
||||
Double ct = finalCsLinePO.getCtRatio() / (Objects.isNull(finalCsLinePO.getCt2Ratio())?1.0:finalCsLinePO.getCt2Ratio());
|
||||
Double pt = finalCsLinePO.getPtRatio() / (Objects.isNull(finalCsLinePO.getPt2Ratio())?1.0:finalCsLinePO.getPt2Ratio());
|
||||
|
||||
// String position = finalCsLinePO.getPosition();
|
||||
Overlimit overlimit = overLimitWlMapper.selectById(finalCsLinePO.getLineId());
|
||||
if (Objects.isNull(overlimit)) {
|
||||
throw new BusinessException("当前测点限值信息缺失,请联系管理员排查");
|
||||
@@ -1011,13 +1149,13 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
if(CollectionUtil.isNotEmpty(fittingDataQueryParam.getList())) {
|
||||
for (FittingDataQueryParam param : fittingDataQueryParam.getList()) {
|
||||
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<>();
|
||||
for (EleEpdPqd epdPqd : eleEpdPqds) {
|
||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||
commonQueryParam.setLineId(finalCsLinePO.getLineId());
|
||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||
commonQueryParam.setColumnName(epdPqd.getName() + (StringUtils.isEmpty(param.getFrequency()) ? "" : "_" + param.getFrequency()));
|
||||
commonQueryParam.setColumnName(epdPqd.getOtherName() + (StringUtils.isEmpty(param.getFrequency()) ? "" : "_" + param.getFrequency()));
|
||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||
|
||||
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(fittingDataQueryParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
|
||||
@@ -1026,7 +1164,9 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
String dataType = param.getValueType();
|
||||
if (StrUtil.isEmpty(dataType)) {
|
||||
// 电能质量指标,取限值计算类型,判断是否越限
|
||||
dataType = epdPqd.getFormula();
|
||||
dataType = epdPqd.getFormula().toUpperCase();
|
||||
} else {
|
||||
dataType = dataType.toUpperCase();
|
||||
}
|
||||
commonQueryParam.setDataType(dataType);
|
||||
|
||||
@@ -1038,7 +1178,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
vo.setLineId(temp.getLineId());
|
||||
// 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.setTime(temp.getTime());
|
||||
vo.setStatMethod(commonQueryParam.getDataType());
|
||||
@@ -1197,10 +1337,12 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
result.put("before", new ArrayList<>());
|
||||
result.put("after", new ArrayList<>());
|
||||
String sensitiveUserId = param.getSensitiveUserId();
|
||||
List<CsLinePO> linePOList = csLineFeignClient.getLineBySensitiveUser(Collections.singletonList(sensitiveUserId)).getData();
|
||||
if (CollUtil.isEmpty(linePOList)) {
|
||||
List<CsEquipmentDeliveryPO> devList = csLineFeignClient.getDevBySensitiveUser(Collections.singletonList(sensitiveUserId)).getData();
|
||||
if (CollUtil.isEmpty(devList)) {
|
||||
return result;
|
||||
}
|
||||
List<String> devIds = devList.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
List<CsLinePO> linePOList = csLineFeignClient.getLinesByDevList(devIds).getData();
|
||||
DictData loadSideDictData = dicDataFeignClient.getDicDataByCode(LOAD_SIDE_DICT_CODE).getData();
|
||||
DictData gridSideDictData = dicDataFeignClient.getDicDataByCode(GRID_SIDE_DICT_CODE).getData();
|
||||
CsLinePO gridSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(gridSideDictData.getId())).findFirst().orElse(null);
|
||||
@@ -1208,7 +1350,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
TrendDataQueryParam trendDataQueryParam = new TrendDataQueryParam();
|
||||
trendDataQueryParam.setSearchBeginTime(param.getSearchBeginTime());
|
||||
trendDataQueryParam.setSearchEndTime(param.getSearchEndTime());
|
||||
trendDataQueryParam.setValueType(param.getValueType());
|
||||
trendDataQueryParam.setValueType(param.getValueType().toUpperCase());
|
||||
trendDataQueryParam.setDataLevel(param.getDataLevel());
|
||||
List<SensitiveUserTrendDataQueryParam> paramList = param.getList();
|
||||
List<TrendDataQueryParam> indexList = paramList.stream().map(item -> {
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||
import com.njcn.csdevice.api.CsMarketDataFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
@@ -71,7 +70,6 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final ICsUserPinsService csUserPinsService;
|
||||
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
||||
private final CsMarketDataFeignClient csMarketDataFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -291,22 +289,24 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
||||
|
||||
String id = IdUtil.simpleUUID();
|
||||
CsLedgerVO portable1 = new CsLedgerVO();
|
||||
portable1.setLevel(0);
|
||||
portable1.setName("便携式工程");
|
||||
portable1.setPid("0");
|
||||
portable1.setId(id);
|
||||
if (CollUtil.isNotEmpty(portables)) {
|
||||
String id = IdUtil.simpleUUID();
|
||||
CsLedgerVO portable1 = new CsLedgerVO();
|
||||
portable1.setLevel(0);
|
||||
portable1.setName("便携式工程");
|
||||
portable1.setPid("0");
|
||||
portable1.setId(id);
|
||||
|
||||
CsLedgerVO portable2 = new CsLedgerVO();
|
||||
portable2.setLevel(1);
|
||||
portable2.setName("便携式项目");
|
||||
portable2.setPid(id);
|
||||
portable2.setId(IdUtil.simpleUUID());
|
||||
portable2.setChildren(portables);
|
||||
CsLedgerVO portable2 = new CsLedgerVO();
|
||||
portable2.setLevel(1);
|
||||
portable2.setName("便携式项目");
|
||||
portable2.setPid(id);
|
||||
portable2.setId(IdUtil.simpleUUID());
|
||||
portable2.setChildren(portables);
|
||||
|
||||
portable1.setChildren(Collections.singletonList(portable2));
|
||||
tree.add(portable1);
|
||||
portable1.setChildren(Collections.singletonList(portable2));
|
||||
tree.add(portable1);
|
||||
}
|
||||
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
csUserPinsService.channelTree(list, tree, 4);
|
||||
@@ -703,24 +703,26 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
||||
|
||||
String id = IdUtil.simpleUUID();
|
||||
CsLedgerVO portable1 = new CsLedgerVO();
|
||||
portable1.setLevel(0);
|
||||
portable1.setName("便携式工程");
|
||||
portable1.setPid("0");
|
||||
portable1.setId(id);
|
||||
if (CollUtil.isNotEmpty(portables)) {
|
||||
String id = IdUtil.simpleUUID();
|
||||
CsLedgerVO portable1 = new CsLedgerVO();
|
||||
portable1.setLevel(0);
|
||||
portable1.setName("便携式工程");
|
||||
portable1.setPid("0");
|
||||
portable1.setId(id);
|
||||
|
||||
CsLedgerVO portable2 = new CsLedgerVO();
|
||||
portable2.setLevel(1);
|
||||
portable2.setName("便携式项目");
|
||||
portable2.setPid(id);
|
||||
portable2.setId(IdUtil.simpleUUID());
|
||||
portable2.setChildren(portables);
|
||||
CsLedgerVO portable2 = new CsLedgerVO();
|
||||
portable2.setLevel(1);
|
||||
portable2.setName("便携式项目");
|
||||
portable2.setPid(id);
|
||||
portable2.setId(IdUtil.simpleUUID());
|
||||
portable2.setChildren(portables);
|
||||
|
||||
List<CsLedgerVO> portable2List = new ArrayList<>();
|
||||
portable2List.add(portable2);
|
||||
portable1.setChildren(portable2List);
|
||||
tree.add(portable1);
|
||||
List<CsLedgerVO> portable2List = new ArrayList<>();
|
||||
portable2List.add(portable2);
|
||||
portable1.setChildren(portable2List);
|
||||
tree.add(portable1);
|
||||
}
|
||||
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
csUserPinsService.channelTree(list, tree, 4);
|
||||
@@ -843,6 +845,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
device.setEquipmentName(dev.getName());
|
||||
device.setEquipmentId(devId);
|
||||
device.setDevMac(po.getMac());
|
||||
device.setNDid(po.getNdid());
|
||||
device.setProjectId("/");
|
||||
device.setProjectName("/");
|
||||
device.setEngineeringid("/");
|
||||
@@ -851,6 +854,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
device.setEquipmentName(dev.getName());
|
||||
device.setEquipmentId(devId);
|
||||
device.setDevMac(po.getMac());
|
||||
device.setNDid(po.getNdid());
|
||||
CsLedger project = this.findDataById(dev.getPid());
|
||||
if (ObjectUtil.isNotNull(project)) {
|
||||
device.setProjectId(project.getId());
|
||||
@@ -1053,88 +1057,88 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> objTree() {
|
||||
List<CsLedgerVO> result = new ArrayList<>();
|
||||
String userId = RequestUtil.getUserIndex();
|
||||
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||
List<String> devIds;
|
||||
if (userVO.getType().equals(UserType.SUPER_ADMINISTRATOR) || userVO.getType().equals(UserType.ADMINISTRATOR)) {
|
||||
devIds = csEquipmentDeliveryMapper.selectList(null).stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
} else {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(CsDeviceUserPO::getDeviceId)
|
||||
.and(w -> w.eq(CsDeviceUserPO::getPrimaryUserId, userId).or().eq(CsDeviceUserPO::getSubUserId, userId))
|
||||
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||
List<CsDeviceUserPO> devList = csDeviceUserPOMapper.selectList(lambdaQueryWrapper);
|
||||
devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
if (CollUtil.isEmpty(devIds)) {
|
||||
return result;
|
||||
}
|
||||
List<CsLinePO> poList = csLinePOService.lambdaQuery().in(CsLinePO::getDeviceId, devIds)
|
||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).ne(CsLinePO::getMonitorUser,"").isNotNull(CsLinePO::getMonitorUser).list();
|
||||
if (CollUtil.isEmpty(poList)) {
|
||||
return result;
|
||||
}
|
||||
List<String> objIds = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
List<String> lineIds = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
|
||||
List<PqSensitiveUser> pqSensitiveUserList = pqSensitiveUserFeignClient.getListByIds(objIds).getData();
|
||||
if (CollUtil.isEmpty(pqSensitiveUserList)) {
|
||||
return result;
|
||||
}
|
||||
Map<String,String> objMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
||||
|
||||
List<CsLedger> csLineList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, lineIds));
|
||||
Map<String,List<String>> lineMap = csLineList.stream().collect(Collectors.groupingBy(it->it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1],Collectors.mapping(CsLedger::getId,Collectors.toList())));
|
||||
|
||||
List<String> projectIds = csLineList.stream().map(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).distinct().collect(Collectors.toList());
|
||||
List<CsLedger> projectList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, projectIds));
|
||||
|
||||
List<CsLedgerVO> realProjectList = new ArrayList<>();
|
||||
projectList.forEach(pro->{
|
||||
CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||
csLedgerVO.setId(pro.getId());
|
||||
csLedgerVO.setPid(pro.getPid());
|
||||
csLedgerVO.setLevel(pro.getLevel());
|
||||
csLedgerVO.setName(pro.getName());
|
||||
|
||||
List<CsLedgerVO> temObjList = new ArrayList<>();
|
||||
if(lineMap.containsKey(pro.getId())){
|
||||
List<String> ids = lineMap.get(pro.getId());
|
||||
List<String> objTemIds = poList.stream().filter(it->ids.contains(it.getLineId())).map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(objTemIds)){
|
||||
objTemIds.forEach(it->{
|
||||
CsLedgerVO inner = new CsLedgerVO();
|
||||
inner.setName(objMap.getOrDefault(it,"未知异常用户"));
|
||||
inner.setId(it);
|
||||
inner.setLevel(2);
|
||||
temObjList.add(inner);
|
||||
});
|
||||
}
|
||||
}
|
||||
csLedgerVO.setChildren(temObjList);
|
||||
realProjectList.add(csLedgerVO);
|
||||
});
|
||||
|
||||
List<String> gcIds = projectList.stream().map(CsLedger::getPid).collect(Collectors.toList());
|
||||
List<CsLedger> gcList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, gcIds));
|
||||
|
||||
List<CsLedgerVO> realGcList = new ArrayList<>();
|
||||
gcList.forEach(gc->{
|
||||
CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||
csLedgerVO.setId(gc.getId());
|
||||
csLedgerVO.setPid(gc.getPid());
|
||||
csLedgerVO.setLevel(gc.getLevel());
|
||||
csLedgerVO.setName(gc.getName());
|
||||
|
||||
List<CsLedgerVO> proList = realProjectList.stream().filter(it->gc.getId().equals(it.getPid())).collect(Collectors.toList());
|
||||
csLedgerVO.setChildren(proList);
|
||||
realGcList.add(csLedgerVO);
|
||||
});
|
||||
return realGcList;
|
||||
}
|
||||
// @Override
|
||||
// public List<CsLedgerVO> objTree() {
|
||||
// List<CsLedgerVO> result = new ArrayList<>();
|
||||
// String userId = RequestUtil.getUserIndex();
|
||||
// UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||
// List<String> devIds;
|
||||
// if (userVO.getType().equals(UserType.SUPER_ADMINISTRATOR) || userVO.getType().equals(UserType.ADMINISTRATOR)) {
|
||||
// devIds = csEquipmentDeliveryMapper.selectList(null).stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
// } else {
|
||||
// LambdaQueryWrapper<CsDeviceUserPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// lambdaQueryWrapper.select(CsDeviceUserPO::getDeviceId)
|
||||
// .and(w -> w.eq(CsDeviceUserPO::getPrimaryUserId, userId).or().eq(CsDeviceUserPO::getSubUserId, userId))
|
||||
// .eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||
// List<CsDeviceUserPO> devList = csDeviceUserPOMapper.selectList(lambdaQueryWrapper);
|
||||
// devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
// }
|
||||
// if (CollUtil.isEmpty(devIds)) {
|
||||
// return result;
|
||||
// }
|
||||
// List<CsLinePO> poList = csLinePOService.lambdaQuery().in(CsLinePO::getDeviceId, devIds)
|
||||
// .eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).ne(CsLinePO::getMonitorUser,"").isNotNull(CsLinePO::getMonitorUser).list();
|
||||
// if (CollUtil.isEmpty(poList)) {
|
||||
// return result;
|
||||
// }
|
||||
// List<String> objIds = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
// List<String> lineIds = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
//
|
||||
// List<PqSensitiveUser> pqSensitiveUserList = pqSensitiveUserFeignClient.getListByIds(objIds).getData();
|
||||
// if (CollUtil.isEmpty(pqSensitiveUserList)) {
|
||||
// return result;
|
||||
// }
|
||||
// Map<String,String> objMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
||||
//
|
||||
// List<CsLedger> csLineList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, lineIds));
|
||||
// Map<String,List<String>> lineMap = csLineList.stream().collect(Collectors.groupingBy(it->it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1],Collectors.mapping(CsLedger::getId,Collectors.toList())));
|
||||
//
|
||||
// List<String> projectIds = csLineList.stream().map(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).distinct().collect(Collectors.toList());
|
||||
// List<CsLedger> projectList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, projectIds));
|
||||
//
|
||||
// List<CsLedgerVO> realProjectList = new ArrayList<>();
|
||||
// projectList.forEach(pro->{
|
||||
// CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||
// csLedgerVO.setId(pro.getId());
|
||||
// csLedgerVO.setPid(pro.getPid());
|
||||
// csLedgerVO.setLevel(pro.getLevel());
|
||||
// csLedgerVO.setName(pro.getName());
|
||||
//
|
||||
// List<CsLedgerVO> temObjList = new ArrayList<>();
|
||||
// if(lineMap.containsKey(pro.getId())){
|
||||
// List<String> ids = lineMap.get(pro.getId());
|
||||
// List<String> objTemIds = poList.stream().filter(it->ids.contains(it.getLineId())).map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
// if(CollUtil.isNotEmpty(objTemIds)){
|
||||
// objTemIds.forEach(it->{
|
||||
// CsLedgerVO inner = new CsLedgerVO();
|
||||
// inner.setName(objMap.getOrDefault(it,"未知异常用户"));
|
||||
// inner.setId(it);
|
||||
// inner.setLevel(2);
|
||||
// temObjList.add(inner);
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// csLedgerVO.setChildren(temObjList);
|
||||
// realProjectList.add(csLedgerVO);
|
||||
// });
|
||||
//
|
||||
// List<String> gcIds = projectList.stream().map(CsLedger::getPid).collect(Collectors.toList());
|
||||
// List<CsLedger> gcList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, gcIds));
|
||||
//
|
||||
// List<CsLedgerVO> realGcList = new ArrayList<>();
|
||||
// gcList.forEach(gc->{
|
||||
// CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||
// csLedgerVO.setId(gc.getId());
|
||||
// csLedgerVO.setPid(gc.getPid());
|
||||
// csLedgerVO.setLevel(gc.getLevel());
|
||||
// csLedgerVO.setName(gc.getName());
|
||||
//
|
||||
// List<CsLedgerVO> proList = realProjectList.stream().filter(it->gc.getId().equals(it.getPid())).collect(Collectors.toList());
|
||||
// csLedgerVO.setChildren(proList);
|
||||
// realGcList.add(csLedgerVO);
|
||||
// });
|
||||
// return realGcList;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> getProAndEngineer(List<String> id) {
|
||||
@@ -1166,60 +1170,33 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
public CsLedgerVO cldTree() {
|
||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
if (CollectionUtil.isEmpty(allList)) {
|
||||
CsLedgerVO government = new CsLedgerVO();
|
||||
government.setLevel(-1);
|
||||
government.setName("台账树");
|
||||
government.setPid("0");
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(new ArrayList<>());
|
||||
return government;
|
||||
return buildTreeRootNode(new ArrayList<>());
|
||||
}
|
||||
|
||||
List<CsLedgerVO> engineeringList = allList.stream()
|
||||
.filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode()))
|
||||
Map<Integer, List<CsLedgerVO>> levelMap = allList.stream()
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
.collect(Collectors.groupingBy(CsLedgerVO::getLevel));
|
||||
|
||||
List<CsLedgerVO> projectList = allList.stream()
|
||||
.filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode()))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<CsLedgerVO> deviceList = allList.stream()
|
||||
.filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode()))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<CsLedgerVO> lineList = allList.stream()
|
||||
.filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode()))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
List<CsLedgerVO> engineeringList = levelMap.getOrDefault(LineBaseEnum.ENGINEERING_LEVEL.getCode(), new ArrayList<>());
|
||||
List<CsLedgerVO> projectList = levelMap.getOrDefault(LineBaseEnum.PROJECT_LEVEL.getCode(), new ArrayList<>());
|
||||
List<CsLedgerVO> deviceList = levelMap.getOrDefault(LineBaseEnum.DEVICE_LEVEL.getCode(), new ArrayList<>());
|
||||
List<CsLedgerVO> lineList = levelMap.getOrDefault(LineBaseEnum.LINE_LEVEL.getCode(), new ArrayList<>());
|
||||
|
||||
if (CollectionUtil.isEmpty(deviceList)) {
|
||||
CsLedgerVO government = new CsLedgerVO();
|
||||
government.setLevel(-1);
|
||||
government.setName("台账树");
|
||||
government.setPid("0");
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(engineeringList);
|
||||
return government;
|
||||
Map<String, List<CsLedgerVO>> projectByPidMap = projectList.stream()
|
||||
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||
engineeringList.forEach(eng -> eng.setChildren(projectByPidMap.getOrDefault(eng.getId(), new ArrayList<>())));
|
||||
return buildTreeRootNode(engineeringList);
|
||||
}
|
||||
|
||||
// 批量查询设备交付信息
|
||||
List<String> devIds = deviceList.stream().map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryPO> devs = csEquipmentDeliveryMapper.selectBatchIds(devIds);
|
||||
Map<String, CsEquipmentDeliveryPO> devsMap = devs.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity()));
|
||||
Map<String, String> lineDevMap = lineList.stream().collect(Collectors.toMap(CsLedgerVO::getId, CsLedgerVO::getPid));
|
||||
|
||||
Set<String> cldDevIds = devs.stream()
|
||||
.map(CsEquipmentDeliveryPO::getId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Map<String, List<CsLedgerVO>> projectToDeviceMap = deviceList.stream()
|
||||
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||
|
||||
Map<String, List<CsLedgerVO>> deviceToLineMap = lineList.stream()
|
||||
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||
Map<String, CsEquipmentDeliveryPO> devsMap = devs.stream()
|
||||
.collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity()));
|
||||
Set<String> cldDevIds = devs.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toSet());
|
||||
|
||||
// 填充设备状态信息
|
||||
deviceList.forEach(device -> {
|
||||
CsEquipmentDeliveryPO dev = devsMap.get(device.getId());
|
||||
if (dev != null) {
|
||||
@@ -1228,6 +1205,9 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
}
|
||||
});
|
||||
|
||||
// 填充监测点状态信息
|
||||
Map<String, String> lineDevMap = lineList.stream()
|
||||
.collect(Collectors.toMap(CsLedgerVO::getId, CsLedgerVO::getPid));
|
||||
lineList.forEach(line -> {
|
||||
String devId = lineDevMap.get(line.getId());
|
||||
if (devId != null) {
|
||||
@@ -1238,39 +1218,48 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
}
|
||||
});
|
||||
|
||||
engineeringList.forEach(engineering -> {
|
||||
List<CsLedgerVO> sortedProjects = projectList.stream()
|
||||
.filter(project -> project.getPid().equals(engineering.getId()))
|
||||
.peek(project -> {
|
||||
List<CsLedgerVO> projectDevices = projectToDeviceMap.getOrDefault(project.getId(), new ArrayList<>());
|
||||
if (CollectionUtil.isNotEmpty(projectDevices)) {
|
||||
List<CsLedgerVO> sortedDevices = projectDevices.stream()
|
||||
.filter(device -> cldDevIds.contains(device.getId()))
|
||||
.peek(device -> {
|
||||
List<CsLedgerVO> sortedLines = deviceToLineMap.getOrDefault(device.getId(), new ArrayList<>())
|
||||
.stream()
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
device.setChildren(sortedLines);
|
||||
})
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
project.setChildren(sortedDevices);
|
||||
}
|
||||
})
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
engineering.setChildren(sortedProjects);
|
||||
// 预构建pid映射
|
||||
Map<String, List<CsLedgerVO>> projectByEngineeringMap = projectList.stream()
|
||||
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||
Map<String, List<CsLedgerVO>> deviceByProjectMap = deviceList.stream()
|
||||
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||
Map<String, List<CsLedgerVO>> lineByDeviceMap = lineList.stream()
|
||||
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||
|
||||
// 逐层构建树:设备 -> 监测点
|
||||
deviceList.forEach(device -> {
|
||||
if (cldDevIds.contains(device.getId())) {
|
||||
device.setChildren(lineByDeviceMap.getOrDefault(device.getId(), new ArrayList<>()));
|
||||
}
|
||||
});
|
||||
|
||||
CsLedgerVO government = new CsLedgerVO();
|
||||
government.setLevel(-1);
|
||||
government.setName("台账树");
|
||||
government.setPid("0");
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(engineeringList);
|
||||
// 项目 -> 设备(仅包含有交付记录的设备)
|
||||
projectList.forEach(project -> {
|
||||
List<CsLedgerVO> projectDevices = deviceByProjectMap.getOrDefault(project.getId(), new ArrayList<>());
|
||||
if (CollectionUtil.isNotEmpty(projectDevices)) {
|
||||
List<CsLedgerVO> validDevices = projectDevices.stream()
|
||||
.filter(device -> cldDevIds.contains(device.getId()))
|
||||
.collect(Collectors.toList());
|
||||
project.setChildren(validDevices);
|
||||
}
|
||||
});
|
||||
|
||||
return government;
|
||||
// 工程 -> 项目
|
||||
engineeringList.forEach(eng ->
|
||||
eng.setChildren(projectByEngineeringMap.getOrDefault(eng.getId(), new ArrayList<>()))
|
||||
);
|
||||
|
||||
return buildTreeRootNode(engineeringList);
|
||||
}
|
||||
|
||||
private CsLedgerVO buildTreeRootNode(List<CsLedgerVO> children) {
|
||||
CsLedgerVO root = new CsLedgerVO();
|
||||
root.setLevel(-1);
|
||||
root.setName("台账树");
|
||||
root.setPid("0");
|
||||
root.setId(IdUtil.simpleUUID());
|
||||
root.setChildren(children);
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,12 +11,15 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.access.api.CsLineLatestDataFeignClient;
|
||||
import com.njcn.access.pojo.po.CsLineLatestData;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
@@ -24,7 +27,11 @@ import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||
import com.njcn.csdevice.service.CsDevModelService;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.csdevice.service.ICsDataSetService;
|
||||
import com.njcn.csharmonic.api.CsHarmonicPlanFeignClient;
|
||||
import com.njcn.csharmonic.api.CsHarmonicPlanLineFeignClient;
|
||||
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.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
@@ -64,7 +71,6 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
private final ICsDataSetService csDataSetService;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final CsTerminalLogsMapper csTerminalLogsMapper;
|
||||
private final CsLineLatestDataFeignClient csLineLatestDataFeignClient;
|
||||
private final PqSensitiveUserFeignClient pqSensitiveUserFeignClient;
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
@@ -72,6 +78,10 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final CsHarmonicPlanFeignClient csHarmonicPlanFeignClient;
|
||||
private final CsHarmonicPlanLineFeignClient csHarmonicPlanLineFeignClient;
|
||||
private final CsLineLatestDataFeignClient csLineLatestDataFeignClient;
|
||||
private final CsCommTerminalFeignClient csCommTerminal;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -158,7 +168,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
po.setClDid(param.getLineNo());
|
||||
//监测位置
|
||||
//DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.GRID_SIDE.getCode()).getData();
|
||||
po.setPosition(param.getPosition());
|
||||
po.setPosition(param.getPosition().isEmpty()?null:param.getPosition());
|
||||
this.save(po);
|
||||
|
||||
//2.新增台账树信息
|
||||
@@ -171,6 +181,17 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
csLedger.setState(1);
|
||||
csLedger.setSort(0);
|
||||
csLedgerMapper.insert(csLedger);
|
||||
|
||||
//3.新增稳态事件指标配置
|
||||
csHarmonicPlanLineFeignClient.deleteByLineIds(Collections.singletonList(lineId));
|
||||
List<CsHarmonicPlan> planList = csHarmonicPlanFeignClient.getByName("通用方案").getData();
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -205,9 +226,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
.set(CsLinePO::getShortCircuitCapacity,param.getShortCircuitCapacity())
|
||||
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
||||
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
||||
.set(CsLinePO::getGovern,param.getGovern())
|
||||
.set(CsLinePO::getPosition,param.getPosition())
|
||||
.set(CsLinePO::getMonitorUser,param.getMonitorUser())
|
||||
.set(CsLinePO::getLineLogLevel,param.getLineLogLevel())
|
||||
.set(CsLinePO::getIsImportant,param.getIsImportant());
|
||||
this.update(lambdaUpdateWrapper);
|
||||
@@ -234,6 +253,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
|
||||
this.removeById(id);
|
||||
csLedgerMapper.deleteById(id);
|
||||
//删除稳态事件指标配置
|
||||
csHarmonicPlanLineFeignClient.deleteByLineIds(Collections.singletonList(id));
|
||||
|
||||
//新增台账日志
|
||||
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||
@@ -305,11 +326,11 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLinePO> getLineBySensitiveUser(List<String> list) {
|
||||
return this.lambdaQuery()
|
||||
.in(CsLinePO::getMonitorUser,list)
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
.list();
|
||||
public List<CsEquipmentDeliveryPO> getDevBySensitiveUser(List<String> list) {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(CsEquipmentDeliveryPO::getMonitorUser,list)
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus, DataStateEnum.DELETED.getCode());
|
||||
return csEquipmentDeliveryMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -322,10 +343,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
List<CsLinePO> poList = getSimpleLine();
|
||||
// 构建基础查询条件
|
||||
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<CsLinePO>()
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
// 关联敏感用户
|
||||
//.isNotNull(CsLinePO::getMonitorUser)
|
||||
.orderByAsc(CsLinePO::getMonitorUser);
|
||||
.eq(CsLinePO::getStatus, 1);
|
||||
// 只有当lineList不为空时才添加in条件
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
List<String> lineList = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
@@ -340,6 +358,9 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
if (CollUtil.isEmpty(records)) {
|
||||
return result;
|
||||
}
|
||||
List<String> devIds = records.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryPO> devList = csEquipmentDeliveryMapper.selectBatchIds(devIds);
|
||||
Map<String, CsEquipmentDeliveryPO> devMap = devList.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, item -> item));
|
||||
|
||||
List<PqSensitiveUserLineVO> list = new ArrayList<>();
|
||||
List<String> sensitiveUserIds = list.stream().map(PqSensitiveUserLineVO::getSensitiveUser).distinct().collect(Collectors.toList());
|
||||
@@ -349,23 +370,32 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
if (CollUtil.isNotEmpty(pqSensitiveUserList)) {
|
||||
sensitiveUserNameMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
||||
}
|
||||
// 最新数据时间
|
||||
List<CsLineLatestData> lineLatestDataList = csLineLatestDataFeignClient.listData().getData();
|
||||
Map<String,CsLineLatestData> lineLatestDataMap = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(lineLatestDataList)) {
|
||||
lineLatestDataMap = lineLatestDataList.stream().collect(Collectors.toMap(CsLineLatestData::getLineId, item -> item));
|
||||
}
|
||||
|
||||
PqSensitiveUserLineVO sensitiveUserLineVO;
|
||||
|
||||
List<String> lineIds = records.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
List<DevDetailDTO> devDetailDTOList = csCommTerminal.getLedgerByLineId(lineIds).getData();
|
||||
Map<String, DevDetailDTO> devDetailDTOMap = devDetailDTOList.stream().collect(Collectors.toMap(DevDetailDTO::getLineId, item -> item));
|
||||
|
||||
for (CsLinePO record : records) {
|
||||
sensitiveUserLineVO = new PqSensitiveUserLineVO();
|
||||
sensitiveUserLineVO.setEngineeringName(devDetailDTOMap.get(record.getLineId()).getEngineeringName());
|
||||
sensitiveUserLineVO.setProjectName(devDetailDTOMap.get(record.getLineId()).getProjectName());
|
||||
sensitiveUserLineVO.setDevName(devDetailDTOMap.get(record.getLineId()).getEquipmentName());
|
||||
// 治理对象
|
||||
sensitiveUserLineVO.setSensitiveUser(sensitiveUserNameMap.getOrDefault(record.getMonitorUser(), null));
|
||||
sensitiveUserLineVO.setSensitiveUser(sensitiveUserNameMap.getOrDefault(devMap.get(record.getDeviceId()).getMonitorUser(), null));
|
||||
// 测点名称
|
||||
sensitiveUserLineVO.setLineId(record.getLineId());
|
||||
sensitiveUserLineVO.setLineName(record.getName());
|
||||
// 是否治理
|
||||
if (ObjectUtil.isNotEmpty(record.getGovern())) {
|
||||
if (record.getGovern().equals(0)) {
|
||||
sensitiveUserLineVO.setGovern("未治理");
|
||||
}
|
||||
if (record.getGovern().equals(1)) {
|
||||
sensitiveUserLineVO.setGovern("已治理");
|
||||
}
|
||||
}
|
||||
String governMethod = devMap.get(record.getDeviceId()).getGovernMethod();
|
||||
sensitiveUserLineVO.setGovern(Objects.isNull(governMethod) ? "未治理" : governMethod);
|
||||
// 监测类型
|
||||
if (ObjectUtil.isNotNull(record.getPosition())) {
|
||||
sensitiveUserLineVO.setPosition(record.getPosition());
|
||||
@@ -379,22 +409,11 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
sensitiveUserLineVO.setVolGrade(record.getVolGrade());
|
||||
}
|
||||
// 运行状态
|
||||
if (ObjectUtil.isNotNull(record.getRunStatus())) {
|
||||
//获取设备状态
|
||||
int devRunStatus = csEquipmentDeliveryMapper.selectById(record.getDeviceId()).getRunStatus();
|
||||
sensitiveUserLineVO.setRunStatus(getRunStatusDescription(devRunStatus));
|
||||
}
|
||||
sensitiveUserLineVO.setRunStatus(String.valueOf(devDetailDTOMap.get(record.getLineId()).getRunStatus()));
|
||||
// 报告文件
|
||||
sensitiveUserLineVO.setReportFilePath(record.getReportFilePath());
|
||||
// 最新数据时间
|
||||
// List<CsLineLatestData> lineLatestDataList = csLineLatestDataFeignClient.listData().getData();
|
||||
// if (CollUtil.isNotEmpty(lineLatestDataList)) {
|
||||
// sensitiveUserLineVO.setLatestTime(lineLatestDataList.stream()
|
||||
// .filter(item -> item.getLineId().equals(record.getLineId()))
|
||||
// .map(CsLineLatestData::getTimeId)
|
||||
// .max(LocalDateTime::compareTo)
|
||||
// .orElse(null));
|
||||
// }
|
||||
//最新数据时间
|
||||
sensitiveUserLineVO.setLatestTime(Objects.isNull(lineLatestDataMap.get(record.getLineId()))? null : lineLatestDataMap.get(record.getLineId()).getTimeId());
|
||||
list.add(sensitiveUserLineVO);
|
||||
}
|
||||
result.setRecords(list);
|
||||
@@ -442,15 +461,6 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
lineDetailDataVO.setBdName(csLedgerMapper.selectById(csLedger.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).getName());
|
||||
}
|
||||
lineDetailDataVO.setLineName(csLinePO.getName());
|
||||
//Device device = deviceMapper.selectById(devId);
|
||||
//lineDetailDataVO.setComFlag(PubUtils.comFlag(device.getComFlag()));
|
||||
//lineDetailDataVO.setRunFlag(PubUtils.lineRunFlag(lineDetail.getRunFlag()));
|
||||
//lineDetailDataVO.setIp(device.getIp());
|
||||
//lineDetailDataVO.setLoginTime(device.getLoginTime());
|
||||
//lineDetailDataVO.setDevId(device.getId());
|
||||
//lineDetailDataVO.setBusinessType(dicDataFeignClient.getDicDataById(lineDetail.getBusinessType()).getData().getName());
|
||||
//lineDetailDataVO.setLoadType(dicDataFeignClient.getDicDataById(lineDetail.getLoadType()).getData().getName());
|
||||
lineDetailDataVO.setObjName(csLinePO.getMonitorUser());
|
||||
lineDetailDataVO.setLineId(csLinePO.getLineId());
|
||||
lineDetailDataVO.setPtType(PubUtils.ptType(csLinePO.getConType()));
|
||||
lineDetailDataVO.setPt(csLinePO.getPtRatio() + "/" + (Objects.isNull(csLinePO.getPt2Ratio())?1.0:csLinePO.getPt2Ratio()));
|
||||
@@ -473,8 +483,10 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
public List<CsLinePO> getLineList(CsLinePO param) {
|
||||
List<String> keywordsLineIds = new ArrayList<>();
|
||||
List<CsLinePO> poList = getSimpleLine();
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
if (CollUtil.isNotEmpty(poList) && !poList.isEmpty()) {
|
||||
keywordsLineIds = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
} else {
|
||||
return poList;
|
||||
}
|
||||
List<CsLinePO> result = this.list(new LambdaQueryWrapper<CsLinePO>()
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -163,7 +164,7 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
||||
@Override
|
||||
public List<CsTerminalReply> getBzReplyData(String lineId) {
|
||||
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);
|
||||
if (!Objects.isNull(lineId) && StringUtils.isNotBlank(lineId)) {
|
||||
wrapper.like(CsTerminalReply::getLineId,lineId);
|
||||
@@ -177,30 +178,13 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
||||
QueryWrapper<CsTerminalReply> queryWrapper = new QueryWrapper<>();
|
||||
if (StrUtil.isNotBlank(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.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);
|
||||
|
||||
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()));
|
||||
List<CldLogsVo> cldLogsVos = new ArrayList<>();
|
||||
records.forEach(item->{
|
||||
if (Objects.isNull(ledgerMap.get(item.getDeviceId()))) {
|
||||
return;
|
||||
}
|
||||
String pids = ledgerMap.get(item.getDeviceId()).getPids();
|
||||
String[] split = pids.split(",");
|
||||
CldLogsVo cldLogsVo = new CldLogsVo();
|
||||
@@ -278,6 +265,9 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
||||
case "oneFile":
|
||||
result = "补召单事件波形";
|
||||
break;
|
||||
case "harmonic":
|
||||
result = "稳态数据";
|
||||
break;
|
||||
default:
|
||||
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;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.CsDeviceUserFeignClient;
|
||||
import com.njcn.csdevice.param.DeviceMessageParam;
|
||||
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.app.AppInfoSet;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
@@ -25,6 +25,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
class DeviceMessageServiceImpl implements DeviceMessageService {
|
||||
|
||||
private final AppUserFeignClient appUserFeignClient;
|
||||
@@ -37,17 +38,17 @@ class DeviceMessageServiceImpl implements DeviceMessageService {
|
||||
|
||||
@Override
|
||||
public List<String> getEventUserByDeviceId(String devId, Boolean isAdmin) {
|
||||
List<String> list = csDeviceUserFeignClient.findUserById(devId).getData();
|
||||
List<String> result = new ArrayList<>(list);
|
||||
List<User> adminUser = appUserFeignClient.getAdminInfo().getData();
|
||||
List<String> adminList = adminUser.stream().map(User::getId).collect(Collectors.toList());
|
||||
if (isAdmin) {
|
||||
List<User> adminUser = appUserFeignClient.getAdminInfo().getData();
|
||||
List<String> adminList = adminUser.stream().map(User::getId).collect(Collectors.toList());
|
||||
result.addAll(adminList);
|
||||
List<String> list = csDeviceUserFeignClient.findUserById(devId).getData();
|
||||
List<String> result = new ArrayList<>(list);
|
||||
adminList.addAll(result);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
result = result.stream().distinct().collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(adminList)) {
|
||||
adminList = adminList.stream().distinct().collect(Collectors.toList());
|
||||
}
|
||||
return result;
|
||||
return adminList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,14 +87,20 @@ class DeviceMessageServiceImpl implements DeviceMessageService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getLineInfo(String id) {
|
||||
public void getLineInfo(String id, List<CsLinePO> list) {
|
||||
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)){
|
||||
throw new BusinessException("监测点为空");
|
||||
log.error("监测点为空");
|
||||
return;
|
||||
}
|
||||
for (CsLinePO item : lineList) {
|
||||
if (Objects.isNull(item.getPosition())){
|
||||
if (Objects.isNull(item.getPosition()) || item.getPosition().isEmpty()){
|
||||
map.put(item.getClDid(),item.getLineId());
|
||||
} else {
|
||||
DictData dictData = dicDataFeignClient.getDicDataById(item.getPosition()).getData();
|
||||
@@ -103,6 +110,8 @@ class DeviceMessageServiceImpl implements DeviceMessageService {
|
||||
map.put(1,item.getLineId());
|
||||
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
|
||||
map.put(2,item.getLineId());
|
||||
} else {
|
||||
map.put(item.getClDid(),item.getLineId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,9 +164,8 @@ class IcdServiceImpl implements IcdService {
|
||||
}
|
||||
Integer level = csLedger.getLevel();
|
||||
String[] pids = csLedger.getPids().split(StrUtil.COMMA);
|
||||
Integer sort = csLedger.getSort();
|
||||
// 设置工程信息(所有级别都需要)
|
||||
setEngineeringInfo(vo, level, pids, id, sort);
|
||||
setEngineeringInfo(vo, level, pids, id);
|
||||
// 根据级别设置不同的业务数据
|
||||
switch (level) {
|
||||
case 0:
|
||||
@@ -251,13 +250,13 @@ class IcdServiceImpl implements IcdService {
|
||||
DatePattern.NORM_DATETIME_PATTERN
|
||||
);
|
||||
if (CollectionUtil.isNotEmpty(param.getLineList())) {
|
||||
processWithLineIds(param.getLineList(), beginDay, endDay);
|
||||
processWithLineIds(param.getLineList(), beginDay, endDay, param.getBzType());
|
||||
} 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<String> deviceIdList = csLineList.stream()
|
||||
.map(CsLinePO::getDeviceId)
|
||||
@@ -268,10 +267,10 @@ class IcdServiceImpl implements IcdService {
|
||||
Map<String, List<CsEquipmentDeliveryPO>> devMap = equipmentList.stream()
|
||||
.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();
|
||||
if (CollectionUtil.isEmpty(devList)) return;
|
||||
|
||||
@@ -283,14 +282,15 @@ class IcdServiceImpl implements IcdService {
|
||||
Map<String, List<CsEquipmentDeliveryPO>> devMap = devList.stream()
|
||||
.collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeId));
|
||||
|
||||
handleEventsAndLogs(devMap, csLineList, beginDay, endDay);
|
||||
handleEventsAndLogs(devMap, csLineList, beginDay, endDay, bzType);
|
||||
}
|
||||
|
||||
private void handleEventsAndLogs(
|
||||
Map<String, List<CsEquipmentDeliveryPO>> devMap,
|
||||
List<CsLinePO> csLineList,
|
||||
String beginDay,
|
||||
String endDay
|
||||
String endDay,
|
||||
Integer bzType
|
||||
) {
|
||||
devMap.forEach((nodeId, devices) -> {
|
||||
List<BZEventMessage.Event> events = new ArrayList<>();
|
||||
@@ -300,13 +300,13 @@ class IcdServiceImpl implements IcdService {
|
||||
for (CsEquipmentDeliveryPO device : devices) {
|
||||
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);
|
||||
|
||||
CsTerminalLogs log = buildTerminalLog(uuid, device, csLineList);
|
||||
logsToSave.add(log);
|
||||
|
||||
List<CsTerminalReply> reply = buildTerminalReply(uuid, device, csLineList);
|
||||
List<CsTerminalReply> reply = buildTerminalReply(uuid, device, csLineList, bzType);
|
||||
repliesToSave.addAll(reply);
|
||||
}
|
||||
csTerminalLogsService.saveBatch(logsToSave);
|
||||
@@ -316,7 +316,7 @@ class IcdServiceImpl implements IcdService {
|
||||
}
|
||||
|
||||
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();
|
||||
event.setGuid(guid);
|
||||
event.setTerminalId(device.getId());
|
||||
@@ -327,7 +327,11 @@ class IcdServiceImpl implements IcdService {
|
||||
.collect(Collectors.toList());
|
||||
|
||||
event.setMonitorIdList(monitorIds);
|
||||
event.setDataType(1);
|
||||
if (!Objects.isNull(bzType) && bzType == 0) {
|
||||
event.setDataType(0);
|
||||
} else {
|
||||
event.setDataType(1);
|
||||
}
|
||||
event.setTimeInterval(Collections.singletonList(beginDay + "~" + endDay));
|
||||
return event;
|
||||
}
|
||||
@@ -351,7 +355,7 @@ class IcdServiceImpl implements IcdService {
|
||||
}
|
||||
|
||||
private List<CsTerminalReply> buildTerminalReply(String replyId, CsEquipmentDeliveryPO device,
|
||||
List<CsLinePO> csLineList) {
|
||||
List<CsLinePO> csLineList, Integer bzType) {
|
||||
List<CsTerminalReply> replies = new ArrayList<>();
|
||||
List<String> lineIds = csLineList.stream()
|
||||
.filter(line -> Objects.equals(line.getDeviceId(), device.getId()))
|
||||
@@ -366,7 +370,11 @@ class IcdServiceImpl implements IcdService {
|
||||
reply.setDeviceId(device.getId());
|
||||
reply.setLineId(lineId);
|
||||
reply.setIsReceived(0);
|
||||
reply.setCode("allEvent");
|
||||
if (!Objects.isNull(bzType) && bzType == 0) {
|
||||
reply.setCode("harmonic");
|
||||
} else {
|
||||
reply.setCode("allEvent");
|
||||
}
|
||||
replies.add(reply);
|
||||
});
|
||||
return replies;
|
||||
@@ -485,7 +493,7 @@ class IcdServiceImpl implements IcdService {
|
||||
/**
|
||||
* 设置工程信息
|
||||
*/
|
||||
private void setEngineeringInfo(CldLedgerVo vo, Integer level, String[] pids, String id, Integer sort) {
|
||||
private void setEngineeringInfo(CldLedgerVo vo, Integer level, String[] pids, String id) {
|
||||
String engineeringId;
|
||||
|
||||
if (level == 0) {
|
||||
@@ -504,7 +512,7 @@ class IcdServiceImpl implements IcdService {
|
||||
vo.setProvince(po.getProvince());
|
||||
vo.setCity(po.getCity());
|
||||
vo.setEngineeringDescription(po.getDescription());
|
||||
vo.setSort(sort);
|
||||
vo.setSort(po.getSort());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
|
||||
/**
|
||||
@@ -67,6 +66,27 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
||||
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: 获取时间段内的数据
|
||||
* @Param:
|
||||
@@ -88,6 +108,18 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
||||
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<>();
|
||||
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++) {
|
||||
PqsCommunicate item = list.get(i);
|
||||
PqsCommunicateDto dto = convertToDto(item);
|
||||
@@ -106,10 +152,10 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
||||
result.add(endData);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理无数据的情况
|
||||
*/
|
||||
|
||||
@@ -2,27 +2,27 @@ package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
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.QueryWrapper;
|
||||
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.njcn.advance.api.EventCauseFeignClient;
|
||||
import com.njcn.advance.pojo.dto.EventAnalysisDTO;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.PortableOfflLogMapper;
|
||||
import com.njcn.csdevice.param.UploadDataParam;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
|
||||
import com.njcn.csdevice.pojo.po.PortableOfflLog;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
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.service.*;
|
||||
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||
import com.njcn.csharmonic.api.EventFeignClient;
|
||||
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.vo.Response;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.influx.imapper.EvtDataMapper;
|
||||
import com.njcn.influx.imapper.PqdDataMapper;
|
||||
import com.njcn.event.common.mapper.WlRmpEventDetailMapper;
|
||||
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.PqdData;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
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.web.pojo.param.BaseParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -50,11 +54,10 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
@@ -81,29 +84,37 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
|
||||
|
||||
private final DecimalFormat df = new DecimalFormat("#0.000");
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final OfflineDataUploadFeignClient offlineDataUploadFeignClient;
|
||||
|
||||
private final EleEvtFeignClient eleEvtFeignClient;
|
||||
|
||||
private final EventFeignClient eventFeignClient;
|
||||
|
||||
private final EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private final InfluxDbParamUtil influxDbParamUtil;
|
||||
|
||||
private final PqdDataMapper pqdDataMapper;
|
||||
|
||||
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 PortableOffMainLogService portableOffMainLogService;
|
||||
private final IWlRecordService wlRecordService;
|
||||
private final CsLinePOService csLinePOService;
|
||||
private final WlRmpEventDetailMapper wlRmpEventDetailMapper;
|
||||
private final EventCauseFeignClient eventCauseFeignClient;
|
||||
|
||||
@Override
|
||||
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
|
||||
@@ -177,7 +188,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@DSTransactional
|
||||
public void importEquipment(UploadDataParam uploadDataParam){
|
||||
String lineId = uploadDataParam.getLineId();
|
||||
//获取监测点信息
|
||||
@@ -337,7 +348,6 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
.eq(WlRecord::getEndTime,wlRecord.getEndTime()).update();
|
||||
wlRecordService.save(wlRecord);
|
||||
|
||||
|
||||
//如果明确返回了state 那么当前文件解析出错
|
||||
if(response.getState() != null){
|
||||
portableOfflLog.setState(response.getState());
|
||||
@@ -353,7 +363,8 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
List<List<PqdData>> partition = ListUtils.partition(pqdData, 1500);
|
||||
for (List<PqdData> sliceList : partition) {
|
||||
List<PqdData> sublistAsOriginalListType = new ArrayList<>(sliceList);
|
||||
pqdDataMapper.insertBatch(sublistAsOriginalListType);
|
||||
Map<String, Object> map = pqdDataSplitService.splitPqdData(sublistAsOriginalListType);
|
||||
insertData(map);
|
||||
}
|
||||
//min结果集解析入库后就不需要在解析了
|
||||
minFlag = false;
|
||||
@@ -381,6 +392,8 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
}
|
||||
List<NewTaglogbuffer> newTaglogbuffers = (List<NewTaglogbuffer>) response.getObj();
|
||||
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.setAllCount(newTaglogbuffers.size());
|
||||
@@ -451,14 +464,32 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
}
|
||||
}
|
||||
csEventPO.setWavePath(wavePath);
|
||||
if (Objects.equals(csEventPO.getTag(),DataParam.dipStrName)) {
|
||||
EventAnalysisDTO var1 = new EventAnalysisDTO();
|
||||
var1.setWlFilePath(wavePath);
|
||||
EventAnalysisDTO dto = eventCauseFeignClient.analysisCauseAndType(var1).getData();
|
||||
String id1 = list1.stream()
|
||||
.filter(item -> Objects.equals(item.getAlgoDescribe(), dto.getCause()))
|
||||
.map(DictData::getId)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
csEventPO.setAdvanceReason(id1);
|
||||
|
||||
String id2 = list2.stream()
|
||||
.filter(item -> Objects.equals(item.getAlgoDescribe(), dto.getType()))
|
||||
.map(DictData::getId)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
csEventPO.setAdvanceType(id2);
|
||||
}
|
||||
|
||||
//默认暂态事件
|
||||
csEventPO.setType(0);
|
||||
String clDid = influxDbParamUtil.getClDidByLineId(uploadDataParam.getLineId());
|
||||
csEventPO.setClDid(clDid == null ? null : Integer.parseInt(clDid));
|
||||
|
||||
|
||||
csEventPO.setProcess(csEquipmentDeliveryDTO.getProcess());
|
||||
csEventPOS.add(csEventPO);
|
||||
|
||||
|
||||
EntData entData = new EntData();
|
||||
entData.setUuid(csEventPO.getId());
|
||||
entData.setTime(new Date().toInstant());
|
||||
@@ -503,12 +534,19 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
log.info("类型log,插入infulxDb的evtData");
|
||||
try {
|
||||
evtDataMapper.insertOne(entData);
|
||||
//添加其余数据
|
||||
csEventPO.setPhase(entData.getEvtParamPhase());
|
||||
csEventPO.setPersistTime(entData.getEvtParamTm());
|
||||
csEventPO.setAmplitude(entData.getEvtParamVVaDepth());
|
||||
csEventPOS.add(csEventPO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
log.info("类型log,插入mysql事件表cs_event");
|
||||
eventFeignClient.saveBatchEventList(csEventPOS);
|
||||
//同步数据到 r_mp_event_detail
|
||||
csEventPOS.forEach(this::insertEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -529,6 +567,62 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
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
|
||||
public Page<PortableOffMainLog> queryMainLogPage(BaseParam baseParam) {
|
||||
Page<PortableOffMainLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ());
|
||||
@@ -587,7 +681,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
String dictDataCode = null;
|
||||
switch (volConType) {
|
||||
case 0:
|
||||
dictDataCode = "star";
|
||||
dictDataCode = "Trans_Business";
|
||||
break;
|
||||
case 1:
|
||||
dictDataCode = "Star_Triangle";
|
||||
@@ -604,4 +698,87 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
}
|
||||
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.date.DatePattern;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
@@ -68,8 +67,8 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
||||
List<CsLinePO> csLinePOList = csLineFeignClient.getLinesByDevList(devIdList).getData();
|
||||
csLinePOList.forEach(item->{
|
||||
//没有统计间隔就计算下一次监测点
|
||||
if (Objects.isNull(item.getLineInterval())) {
|
||||
return;
|
||||
if (Objects.isNull(item.getLineInterval()) || item.getLineInterval() == 0) {
|
||||
item.setLineInterval(1);
|
||||
}
|
||||
//应收数据
|
||||
int dueCount = 1440 / item.getLineInterval();
|
||||
@@ -79,17 +78,11 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
||||
RStatIntegrityD data = new RStatIntegrityD();
|
||||
//治理监测点
|
||||
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 {
|
||||
//云前置监测点
|
||||
if (ObjectUtil.isNotNull(item.getLineNo())) {
|
||||
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");
|
||||
}
|
||||
//云前置监测点 && 治理、无线监测点
|
||||
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"data_v","freq","value","T","AVG",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
||||
}
|
||||
data.setTimeId(LocalDate.parse(time, DatePattern.NORM_DATE_FORMATTER));
|
||||
data.setLineIndex(item.getLineId());
|
||||
|
||||
@@ -16,13 +16,10 @@ import com.njcn.csdevice.service.ICsCommunicateService;
|
||||
import com.njcn.csdevice.service.IRStatOnlineRateDService;
|
||||
import com.njcn.csdevice.util.TimeUtil;
|
||||
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||
import com.njcn.influx.deprecated.InfluxDBPublicParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -62,48 +59,95 @@ public class RStatOnlineRateDServiceImpl extends MppServiceImpl<RStatOnlineRateD
|
||||
return;
|
||||
}
|
||||
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
//获取需要计算的时间
|
||||
List<String> dateRange = TimeUtil.getDateRangeAsString(param.getStartTime(), param.getEndTime());
|
||||
for (String time : dateRange) {
|
||||
List<PqsCommunicateDto> outCommunicateData = new ArrayList<>();
|
||||
int onlineMinutes = 0;
|
||||
//获取需要计算的时间
|
||||
List<String> dateRange = TimeUtil.getDateRangeAsString(param.getStartTime(), param.getEndTime());
|
||||
for (String time : dateRange) {
|
||||
Date statDate = DateUtil.parse(time);
|
||||
// 按设备分别统计
|
||||
for (CsEquipmentDeliveryPO device : devList) {
|
||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||
lineParam.setStartTime(time + " 00:00:00");
|
||||
lineParam.setEndTime(time + " 23:59:59");
|
||||
for (CsEquipmentDeliveryPO s : devList) {
|
||||
lineParam.setLineId(Collections.singletonList(s.getId()));
|
||||
List<PqsCommunicateDto> data = pqsCommunicateService.getRawDataLatest(lineParam);
|
||||
if (CollectionUtil.isEmpty(data)) {
|
||||
PqsCommunicateDto dto = new PqsCommunicateDto();
|
||||
dto.setTime(time + " 00:00:00");
|
||||
dto.setDevId(s.getId());
|
||||
if (s.getRunStatus() == 1) {
|
||||
dto.setType(0);
|
||||
dto.setDescription("通讯中断");
|
||||
} else if (s.getRunStatus() == 2) {
|
||||
dto.setType(1);
|
||||
dto.setDescription("通讯正常");
|
||||
lineParam.setLineId(Collections.singletonList(device.getId()));
|
||||
lineParam.setStartTime(time);
|
||||
lineParam.setEndTime(time);
|
||||
List<PqsCommunicateDto> dayData = pqsCommunicateService.getRawData2(lineParam);
|
||||
if (CollectionUtil.isNotEmpty(dayData)) {
|
||||
if (dayData.size() == 1) {
|
||||
PqsCommunicateDto singleRecord = dayData.get(0);
|
||||
long minutesFromMidnight = DateUtil.between(statDate, DateUtil.parse(singleRecord.getTime()), DateUnit.MINUTE);
|
||||
if (online.equals(singleRecord.getType())) {
|
||||
// 如果是在线状态,则从该时间点之后都在线
|
||||
onlineMinutes = 1440 - (int) minutesFromMidnight;
|
||||
} else {
|
||||
// 如果是离线状态,则从该时间点之前都在线(假设之前是在线的)
|
||||
onlineMinutes = (int) minutesFromMidnight;
|
||||
}
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
// 处理后续段:根据上一条记录的状态判断
|
||||
if (online.equals(dayData.get(i - 1).getType())) {
|
||||
totalOnlineMinutes += intervalMinutes;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
outCommunicateData.addAll(data);
|
||||
}
|
||||
Date dateOut = DateUtil.parse(time);
|
||||
for (PqsCommunicateDto pqsCommunicate : outCommunicateData) {
|
||||
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.setDevIndex(pqsCommunicate.getDevId());
|
||||
po.setOnlineMin(onLineRate.getOnlineMin());
|
||||
po.setOfflineMin(onLineRate.getOfflineMin());
|
||||
list.add(po);
|
||||
}
|
||||
|
||||
RStatOnlineRateD po = new RStatOnlineRateD();
|
||||
po.setTimeId(LocalDate.parse(time, DatePattern.NORM_DATE_FORMATTER));
|
||||
po.setDevIndex(device.getId());
|
||||
po.setOnlineMin(onlineMinutes);
|
||||
po.setOfflineMin(1440 - onlineMinutes);
|
||||
list.add(po);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
.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<>();
|
||||
|
||||
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();
|
||||
csEngineeringUserPOQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.clear();
|
||||
@@ -79,24 +96,6 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
collect = collect.stream().distinct().collect(Collectors.toList());
|
||||
}
|
||||
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;
|
||||
@@ -115,37 +114,11 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
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 新需求 工程用户可以看到关注工程的设备和对应的主用户和子用户的设备
|
||||
//note 这边工程用户不查询主设备,只看关注的工程,做下调整,不然会出现工程用户未关注任何工程,但是有一台主设备,导致界面有数据
|
||||
else if (Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())) {
|
||||
if (Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())) {
|
||||
List<String> sumDevId = new ArrayList<>();
|
||||
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<>();
|
||||
csMarketDataQueryWrapper.eq("user_id", userIndex);
|
||||
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());
|
||||
|
||||
}
|
||||
// ||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())){
|
||||
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
csLedgerQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.eq("level",2).eq("state",1);
|
||||
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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){
|
||||
continue;
|
||||
}
|
||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(Collections.singletonList(param.getStatisticalId())).getData();
|
||||
for(WlRecord wl : data){
|
||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(wl.getLineId())).getData();
|
||||
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.setLineId(temp.getLineId());
|
||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||
commonQueryParam.setColumnName(epdPqd.getName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
|
||||
if (epdPqd.getName() == null || epdPqd.getName().isEmpty()) {
|
||||
commonQueryParam.setColumnName(epdPqd.getName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
|
||||
} else {
|
||||
commonQueryParam.setColumnName(epdPqd.getOtherName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
|
||||
}
|
||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||
commonQueryParam.setStartTime(LocalDateTimeUtil.format(wl.getStartTime(), 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.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
||||
return commonQueryParam;
|
||||
@@ -500,7 +504,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
String unit;
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
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();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
@@ -677,13 +681,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
if(Objects.isNull(list.get(i).getEndTime())){
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
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)
|
||||
.select(StatisticalDataDTO::getPhaseType)
|
||||
.select(StatisticalDataDTO::getValueType)
|
||||
.last("Pq_Freq")
|
||||
.last("freq")
|
||||
.eq(InfluxDBTableConstant.LINE_ID,lineId)
|
||||
.eq(InfluxDBTableConstant.PHASIC_TYPE,"M")
|
||||
.eq(InfluxDBTableConstant.PHASIC_TYPE,"T")
|
||||
.between(InfluxDBTableConstant.TIME,startSql,sqlNow);
|
||||
System.out.println(influxQueryWrapper.generateSql());
|
||||
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
||||
@@ -704,13 +708,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
//如果不存在结束时间,则取后面一条的起始时间作为结束判断标识
|
||||
if(Objects.isNull(list.get(i).getEndTime())){
|
||||
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)
|
||||
.select(StatisticalDataDTO::getPhaseType)
|
||||
.select(StatisticalDataDTO::getValueType)
|
||||
.last("Pq_Freq")
|
||||
.last("freq")
|
||||
.eq(InfluxDBTableConstant.LINE_ID,lineId)
|
||||
.eq(InfluxDBTableConstant.PHASIC_TYPE,"M")
|
||||
.eq(InfluxDBTableConstant.PHASIC_TYPE,"T")
|
||||
.between(InfluxDBTableConstant.TIME,startSql,end);
|
||||
System.out.println(influxQueryWrapper.generateSql());
|
||||
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
||||
|
||||
@@ -43,7 +43,7 @@ spring:
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
root: warn
|
||||
|
||||
data:
|
||||
source:
|
||||
|
||||
@@ -9,6 +9,8 @@ import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@@ -19,4 +21,8 @@ public interface CsHarmonicPlanFeignClient {
|
||||
@ApiOperation("根据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.response.HttpResult;
|
||||
import com.njcn.csharmonic.api.fallback.CsHarmonicPlanLineFeignClientFallbackFactory;
|
||||
import com.njcn.csharmonic.param.CsHarmonicPlanLineParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@@ -18,4 +24,12 @@ public interface CsHarmonicPlanLineFeignClient {
|
||||
@ApiOperation("根据监测点ID查询方案ID")
|
||||
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;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csharmonic.api.fallback.EventUserFeignClientFallbackFactory;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
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.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csharmonic.api.CsHarmonicFeignClient;
|
||||
import com.njcn.csharmonic.api.CsHarmonicPlanFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.CsHarmonic;
|
||||
import com.njcn.csharmonic.pojo.po.CsHarmonicPlan;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -34,6 +32,12 @@ public class CsHarmonicPlanFeignClientFallbackFactory implements FallbackFactory
|
||||
log.error("{}异常,降级处理,异常为:{}","根据ID查询稳态指标方案异常",cause.toString());
|
||||
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.response.HttpResult;
|
||||
import com.njcn.csharmonic.api.CsHarmonicPlanLineFeignClient;
|
||||
import com.njcn.csharmonic.param.CsHarmonicPlanLineParam;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@@ -28,6 +31,18 @@ public class CsHarmonicPlanLineFeignClientFallbackFactory implements FallbackFac
|
||||
log.error("{}异常,降级处理,异常为:{}","根据监测点ID查询方案ID异常",cause.toString());
|
||||
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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user